blob: bf829dc98cf410f3a6d09a7a45cc7995779babab [file] [log] [blame]
Daniel Veillardd93f6252004-11-02 15:53:51 +00001/*
2 * testapi.c: libxml2 API tester program.
3 *
4 * Automatically generated by gentest.py from libxml2-api.xml
5 *
6 * See Copyright for the status of this software.
7 *
8 * daniel@veillard.com
9 */
10
11#include <stdio.h>
Daniel Veillardce244ad2004-11-05 10:03:46 +000012#include <string.h>
Daniel Veillardd93f6252004-11-02 15:53:51 +000013#include <libxml/xmlerror.h>
Daniel Veillard3d97e662004-11-04 10:49:00 +000014#include <libxml/relaxng.h>
Daniel Veillardd93f6252004-11-02 15:53:51 +000015
16static int testlibxml2(void);
Daniel Veillardce244ad2004-11-05 10:03:46 +000017static int test_module(const char *module);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018
19static int generic_errors = 0;
20static int call_tests = 0;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021static int function_tests = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022
Daniel Veillard5ea30d72004-11-08 11:54:28 +000023static xmlChar chartab[1024];
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000024static int inttab[1024];
25static unsigned long longtab[1024];
Daniel Veillardce244ad2004-11-05 10:03:46 +000026
27static xmlDocPtr api_doc = NULL;
Daniel Veillard27f20102004-11-05 11:50:11 +000028static xmlDtdPtr api_dtd = NULL;
Daniel Veillardce244ad2004-11-05 10:03:46 +000029static xmlNodePtr api_root = NULL;
30static xmlAttrPtr api_attr = NULL;
Daniel Veillard27f20102004-11-05 11:50:11 +000031static xmlNsPtr api_ns = NULL;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032
Daniel Veillardd93f6252004-11-02 15:53:51 +000033static void
34structured_errors(void *userData ATTRIBUTE_UNUSED,
35 xmlErrorPtr error ATTRIBUTE_UNUSED) {
36 generic_errors++;
37}
38
Daniel Veillardce244ad2004-11-05 10:03:46 +000039static void
40free_api_doc(void) {
41 xmlFreeDoc(api_doc);
42 api_doc = NULL;
Daniel Veillard27f20102004-11-05 11:50:11 +000043 api_dtd = NULL;
Daniel Veillardce244ad2004-11-05 10:03:46 +000044 api_root = NULL;
45 api_attr = NULL;
Daniel Veillard27f20102004-11-05 11:50:11 +000046 api_ns = NULL;
Daniel Veillardce244ad2004-11-05 10:03:46 +000047}
48
49static xmlDocPtr
50get_api_doc(void) {
51 if (api_doc == NULL) {
Daniel Veillard27f20102004-11-05 11:50:11 +000052 api_doc = xmlReadMemory("<!DOCTYPE root [<!ELEMENT root EMPTY>]><root xmlns:h='http://example.com/' h:foo='bar'/>", 88, "root_test", NULL, 0);
Daniel Veillardce244ad2004-11-05 10:03:46 +000053 api_root = NULL;
54 api_attr = NULL;
55 }
56 return(api_doc);
57}
58
Daniel Veillard27f20102004-11-05 11:50:11 +000059static xmlDtdPtr
60get_api_dtd(void) {
61 if ((api_dtd == NULL) || (api_dtd->type != XML_DTD_NODE)) {
62 get_api_doc();
63 if ((api_doc != NULL) && (api_doc->children != NULL) &&
64 (api_doc->children->type == XML_DTD_NODE))
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000065 api_dtd = (xmlDtdPtr) api_doc->children;
Daniel Veillard27f20102004-11-05 11:50:11 +000066 }
67 return(api_dtd);
68}
69
Daniel Veillardce244ad2004-11-05 10:03:46 +000070static xmlNodePtr
71get_api_root(void) {
72 if ((api_root == NULL) || (api_root->type != XML_ELEMENT_NODE)) {
73 get_api_doc();
74 if ((api_doc != NULL) && (api_doc->children != NULL) &&
Daniel Veillard27f20102004-11-05 11:50:11 +000075 (api_doc->children->next != NULL) &&
76 (api_doc->children->next->type == XML_ELEMENT_NODE))
77 api_root = api_doc->children->next;
Daniel Veillardce244ad2004-11-05 10:03:46 +000078 }
79 return(api_root);
80}
81
Daniel Veillard27f20102004-11-05 11:50:11 +000082static xmlNsPtr
83get_api_ns(void) {
84 get_api_root();
85 if (api_root != NULL)
86 api_ns = api_root->nsDef;
87 return(api_ns);
88}
89
Daniel Veillardce244ad2004-11-05 10:03:46 +000090static xmlAttrPtr
91get_api_attr(void) {
Daniel Veillardc8311492004-11-08 16:51:13 +000092#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED)
Daniel Veillardce244ad2004-11-05 10:03:46 +000093 static int nr = 0;
94 xmlChar name[20];
Daniel Veillardc8311492004-11-08 16:51:13 +000095#endif
Daniel Veillardce244ad2004-11-05 10:03:46 +000096
97 if ((api_root == NULL) || (api_root->type != XML_ELEMENT_NODE)) {
98 get_api_root();
99 }
100 if (api_root == NULL)
101 return(NULL);
102 if (api_root->properties != NULL) {
103 api_attr = api_root->properties;
104 return(api_root->properties);
105 }
Daniel Veillardc8311492004-11-08 16:51:13 +0000106 api_attr = NULL;
107#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED)
Daniel Veillardce244ad2004-11-05 10:03:46 +0000108 snprintf((char *) name, 20, "foo%d", nr++);
109 api_attr = xmlSetProp(api_root, name, (const xmlChar *) "bar");
Daniel Veillardc8311492004-11-08 16:51:13 +0000110#endif
Daniel Veillardce244ad2004-11-05 10:03:46 +0000111 return(api_attr);
112}
113
Daniel Veillardd0cf7f62004-11-09 16:17:02 +0000114static int quiet = 0;
115
Daniel Veillardce244ad2004-11-05 10:03:46 +0000116int main(int argc, char **argv) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000117 int ret;
118 int blocks, mem;
119
Daniel Veillard5ea30d72004-11-08 11:54:28 +0000120 memset(chartab, 0, sizeof(chartab));
Daniel Veillardc8311492004-11-08 16:51:13 +0000121 strncpy((char *) chartab, " chartab\n", 20);
Daniel Veillard5ea30d72004-11-08 11:54:28 +0000122 memset(inttab, 0, sizeof(inttab));
123 memset(longtab, 0, sizeof(longtab));
124
Daniel Veillarda03e3652004-11-02 18:45:30 +0000125 xmlInitParser();
Daniel Veillard3d97e662004-11-04 10:49:00 +0000126#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillarddd6d3002004-11-03 14:20:29 +0000127 xmlRelaxNGInitTypes();
Daniel Veillard3d97e662004-11-04 10:49:00 +0000128#endif
Daniel Veillarda03e3652004-11-02 18:45:30 +0000129
Daniel Veillardd93f6252004-11-02 15:53:51 +0000130 LIBXML_TEST_VERSION
131
132 xmlSetStructuredErrorFunc(NULL, structured_errors);
133
Daniel Veillardd0cf7f62004-11-09 16:17:02 +0000134 if (argc >= 2) {
135 if (!strcmp(argv[1], "-q")) {
136 quiet = 1;
137 if (argc >= 3)
138 ret = test_module(argv[2]);
139 else
140 ret = testlibxml2();
141 } else {
142 ret = test_module(argv[1]);
143 }
144 } else
Daniel Veillardce244ad2004-11-05 10:03:46 +0000145 ret = testlibxml2();
Daniel Veillardd93f6252004-11-02 15:53:51 +0000146
147 xmlCleanupParser();
148 blocks = xmlMemBlocks();
149 mem = xmlMemUsed();
150 if ((blocks != 0) || (mem != 0)) {
151 printf("testapi leaked %d bytes in %d blocks\n", mem, blocks);
152 }
153 xmlMemoryDump();
154
155 return (ret != 0);
156}
157
158#include <libxml/HTMLparser.h>
159#include <libxml/HTMLtree.h>
Daniel Veillardd93f6252004-11-02 15:53:51 +0000160#include <libxml/catalog.h>
161#include <libxml/chvalid.h>
162#include <libxml/dict.h>
163#include <libxml/encoding.h>
164#include <libxml/entities.h>
165#include <libxml/hash.h>
166#include <libxml/list.h>
167#include <libxml/nanoftp.h>
168#include <libxml/nanohttp.h>
169#include <libxml/parser.h>
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +0000170#include <libxml/parserInternals.h>
Daniel Veillardd93f6252004-11-02 15:53:51 +0000171#include <libxml/pattern.h>
172#include <libxml/relaxng.h>
173#include <libxml/schemasInternals.h>
174#include <libxml/tree.h>
175#include <libxml/uri.h>
176#include <libxml/valid.h>
177#include <libxml/xinclude.h>
178#include <libxml/xmlIO.h>
Daniel Veillardd93f6252004-11-02 15:53:51 +0000179#include <libxml/xmlerror.h>
Daniel Veillardd93f6252004-11-02 15:53:51 +0000180#include <libxml/xmlreader.h>
Daniel Veillardd93f6252004-11-02 15:53:51 +0000181#include <libxml/xmlsave.h>
182#include <libxml/xmlschemas.h>
183#include <libxml/xmlschemastypes.h>
184#include <libxml/xmlstring.h>
185#include <libxml/xmlwriter.h>
186#include <libxml/xpath.h>
187#include <libxml/xpointer.h>
Daniel Veillarda521d282004-11-09 14:59:59 +0000188#include <libxml/debugXML.h>
Daniel Veillardd93f6252004-11-02 15:53:51 +0000189
William M. Brackf13f77f2004-11-12 16:03:48 +0000190/*
191 We manually define xmlErrMemory because it's normal declaration
192 is "hidden" by #ifdef IN_LIBXML
193*/
194void xmlErrMemory(xmlParserCtxtPtr ctxt, const char *extra);
195
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000196#define gen_nb_void_ptr 2
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +0000197
Daniel Veillard3d97e662004-11-04 10:49:00 +0000198static void *gen_void_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +0000199 return(NULL);
200}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000201static void des_void_ptr(int no ATTRIBUTE_UNUSED, void *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +0000202}
203
Daniel Veillardce244ad2004-11-05 10:03:46 +0000204#if 0
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000205#define gen_nb_const_void_ptr 2
206
207static const void *gen_const_void_ptr(int no, int nr ATTRIBUTE_UNUSED) {
208 if (no == 0) return((const void *) "immutable string");
209 return(NULL);
210}
211static void des_const_void_ptr(int no ATTRIBUTE_UNUSED, const void *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
212}
Daniel Veillardce244ad2004-11-05 10:03:46 +0000213#endif
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000214
Daniel Veillard8a32fe42004-11-02 22:10:16 +0000215#define gen_nb_userdata 3
216
Daniel Veillard3d97e662004-11-04 10:49:00 +0000217static void *gen_userdata(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillard8a32fe42004-11-02 22:10:16 +0000218 if (no == 0) return((void *) &call_tests);
219 if (no == 1) return((void *) -1);
220 return(NULL);
221}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000222static void des_userdata(int no ATTRIBUTE_UNUSED, void *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillard8a32fe42004-11-02 22:10:16 +0000223}
224
225
Daniel Veillardd93f6252004-11-02 15:53:51 +0000226#define gen_nb_int 4
227
Daniel Veillard3d97e662004-11-04 10:49:00 +0000228static int gen_int(int no, int nr ATTRIBUTE_UNUSED) {
229 if (no == 0) return(0);
230 if (no == 1) return(1);
Daniel Veillardc2c894f2004-11-07 12:17:35 +0000231 if (no == 2) return(-1);
232 if (no == 3) return(122);
Daniel Veillard3d97e662004-11-04 10:49:00 +0000233 return(-1);
234}
235
236static void des_int(int no ATTRIBUTE_UNUSED, int val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
237}
238
Daniel Veillard6128c012004-11-08 17:16:15 +0000239#define gen_nb_parseroptions 5
240
241static int gen_parseroptions(int no, int nr ATTRIBUTE_UNUSED) {
242 if (no == 0) return(XML_PARSE_NOBLANKS | XML_PARSE_RECOVER);
243 if (no == 1) return(XML_PARSE_NOENT | XML_PARSE_DTDLOAD | XML_PARSE_DTDATTR | XML_PARSE_DTDVALID | XML_PARSE_NOCDATA);
244 if (no == 2) return(XML_PARSE_XINCLUDE | XML_PARSE_NOXINCNODE | XML_PARSE_NSCLEAN);
245 if (no == 3) return(XML_PARSE_XINCLUDE | XML_PARSE_NODICT);
246 return(XML_PARSE_SAX1);
247}
248
249static void des_parseroptions(int no ATTRIBUTE_UNUSED, int val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
250}
251
Daniel Veillardce244ad2004-11-05 10:03:46 +0000252#if 0
Daniel Veillardf2a36f92004-11-08 17:55:01 +0000253#define gen_nb_long 5
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000254
255static long gen_long(int no, int nr ATTRIBUTE_UNUSED) {
256 if (no == 0) return(0);
257 if (no == 1) return(1);
Daniel Veillardc2c894f2004-11-07 12:17:35 +0000258 if (no == 2) return(-1);
259 if (no == 3) return(122);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000260 return(-1);
261}
262
263static void des_long(int no ATTRIBUTE_UNUSED, long val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
264}
Daniel Veillardce244ad2004-11-05 10:03:46 +0000265#endif
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000266
Daniel Veillardf2a36f92004-11-08 17:55:01 +0000267#define gen_nb_xmlChar 4
268
269static xmlChar gen_xmlChar(int no, int nr ATTRIBUTE_UNUSED) {
270 if (no == 0) return('a');
271 if (no == 1) return(' ');
272 if (no == 2) return('ø');
273 return(0);
274}
275
276static void des_xmlChar(int no ATTRIBUTE_UNUSED, xmlChar val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
277}
278
Daniel Veillard3d97e662004-11-04 10:49:00 +0000279#define gen_nb_unsigned_int 3
280
281static unsigned int gen_unsigned_int(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000282 if (no == 0) return(0);
283 if (no == 1) return(1);
284 if (no == 2) return(122);
285 return(-1);
286}
287
Daniel Veillard3d97e662004-11-04 10:49:00 +0000288static void des_unsigned_int(int no ATTRIBUTE_UNUSED, unsigned int val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000289}
290
Daniel Veillard3d95c732004-11-06 22:25:14 +0000291#define gen_nb_unsigned_long 4
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000292
293static unsigned long gen_unsigned_long(int no, int nr ATTRIBUTE_UNUSED) {
294 if (no == 0) return(0);
295 if (no == 1) return(1);
296 if (no == 2) return(122);
297 return(-1);
298}
299
300static void des_unsigned_long(int no ATTRIBUTE_UNUSED, unsigned long val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
301}
302
Daniel Veillard3d95c732004-11-06 22:25:14 +0000303#define gen_nb_double 4
304
305static double gen_double(int no, int nr ATTRIBUTE_UNUSED) {
306 if (no == 0) return(0);
307 if (no == 1) return(-1.1);
Daniel Veillardd0cf7f62004-11-09 16:17:02 +0000308#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard3d95c732004-11-06 22:25:14 +0000309 if (no == 2) return(xmlXPathNAN);
Daniel Veillardc8311492004-11-08 16:51:13 +0000310#endif
Daniel Veillard3d95c732004-11-06 22:25:14 +0000311 return(-1);
312}
313
314static void des_double(int no ATTRIBUTE_UNUSED, double val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
315}
316
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000317#define gen_nb_unsigned_long_ptr 2
318
319static unsigned long *gen_unsigned_long_ptr(int no, int nr) {
320 if (no == 0) return(&longtab[nr]);
321 return(NULL);
322}
323
324static void des_unsigned_long_ptr(int no ATTRIBUTE_UNUSED, unsigned long *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
325}
326
327#define gen_nb_int_ptr 2
328
329static int *gen_int_ptr(int no, int nr) {
330 if (no == 0) return(&inttab[nr]);
331 return(NULL);
332}
333
334static void des_int_ptr(int no ATTRIBUTE_UNUSED, int *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
335}
336
Daniel Veillardd93f6252004-11-02 15:53:51 +0000337#define gen_nb_const_char_ptr 4
338
Daniel Veillardce682bc2004-11-05 17:22:25 +0000339static char *gen_const_char_ptr(int no, int nr ATTRIBUTE_UNUSED) {
340 if (no == 0) return((char *) "foo");
341 if (no == 1) return((char *) "<foo/>");
342 if (no == 2) return((char *) "test/ent2");
Daniel Veillardd93f6252004-11-02 15:53:51 +0000343 return(NULL);
344}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000345static void des_const_char_ptr(int no ATTRIBUTE_UNUSED, const char *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000346}
347
Daniel Veillard8a32fe42004-11-02 22:10:16 +0000348#define gen_nb_xmlChar_ptr 2
349
Daniel Veillard3d97e662004-11-04 10:49:00 +0000350static xmlChar *gen_xmlChar_ptr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000351 if (no == 0) return(&chartab[0]);
Daniel Veillard8a32fe42004-11-02 22:10:16 +0000352 return(NULL);
353}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000354static void des_xmlChar_ptr(int no ATTRIBUTE_UNUSED, xmlChar *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillard8a32fe42004-11-02 22:10:16 +0000355}
356
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000357#define gen_nb_FILE_ptr 2
358
359static FILE *gen_FILE_ptr(int no, int nr ATTRIBUTE_UNUSED) {
360 if (no == 0) return(fopen("test.out", "a+"));
361 return(NULL);
362}
363static void des_FILE_ptr(int no ATTRIBUTE_UNUSED, FILE *val, int nr ATTRIBUTE_UNUSED) {
364 if (val != NULL) fclose(val);
365}
366
Daniel Veillarda82b1822004-11-08 16:24:57 +0000367#define gen_nb_debug_FILE_ptr 2
368static FILE *gen_debug_FILE_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
369 return(fopen("test.out", "a+"));
370}
371static void des_debug_FILE_ptr(int no ATTRIBUTE_UNUSED, FILE *val, int nr ATTRIBUTE_UNUSED) {
372 if (val != NULL) fclose(val);
373}
374
Daniel Veillardd93f6252004-11-02 15:53:51 +0000375#define gen_nb_const_xmlChar_ptr 5
376
Daniel Veillardce682bc2004-11-05 17:22:25 +0000377static xmlChar *gen_const_xmlChar_ptr(int no, int nr ATTRIBUTE_UNUSED) {
378 if (no == 0) return((xmlChar *) "foo");
379 if (no == 1) return((xmlChar *) "<foo/>");
380 if (no == 2) return((xmlChar *) "nøne");
381 if (no == 3) return((xmlChar *) " 2ab ");
Daniel Veillardd93f6252004-11-02 15:53:51 +0000382 return(NULL);
383}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000384static void des_const_xmlChar_ptr(int no ATTRIBUTE_UNUSED, const xmlChar *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000385}
386
387#define gen_nb_filepath 8
388
Daniel Veillard3d97e662004-11-04 10:49:00 +0000389static const char *gen_filepath(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000390 if (no == 0) return("missing.xml");
391 if (no == 1) return("<foo/>");
392 if (no == 2) return("test/ent2");
393 if (no == 3) return("test/valid/REC-xml-19980210.xml");
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000394 if (no == 4) return("test/valid/dtds/xhtml1-strict.dtd");
Daniel Veillardd93f6252004-11-02 15:53:51 +0000395 if (no == 5) return("http://missing.example.org/");
396 if (no == 6) return("http://missing. example.org/");
397 return(NULL);
398}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000399static void des_filepath(int no ATTRIBUTE_UNUSED, const char *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000400}
401
Daniel Veillard27f20102004-11-05 11:50:11 +0000402#define gen_nb_eaten_name 2
403
404static xmlChar *gen_eaten_name(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +0000405 if (no == 0) return(xmlStrdup(BAD_CAST "eaten"));
Daniel Veillard27f20102004-11-05 11:50:11 +0000406 return(NULL);
407}
408static void des_eaten_name(int no ATTRIBUTE_UNUSED, xmlChar *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
409}
410
Daniel Veillardd93f6252004-11-02 15:53:51 +0000411#define gen_nb_fileoutput 6
412
Daniel Veillard3d97e662004-11-04 10:49:00 +0000413static const char *gen_fileoutput(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000414 if (no == 0) return("/missing.xml");
415 if (no == 1) return("<foo/>");
416 if (no == 2) return("ftp://missing.example.org/foo");
417 if (no == 3) return("http://missing.example.org/");
418 if (no == 4) return("http://missing. example.org/");
419 return(NULL);
420}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000421static void des_fileoutput(int no ATTRIBUTE_UNUSED, const char *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000422}
423
Daniel Veillarda521d282004-11-09 14:59:59 +0000424#define gen_nb_xmlParserCtxtPtr 3
Daniel Veillard3d97e662004-11-04 10:49:00 +0000425static xmlParserCtxtPtr gen_xmlParserCtxtPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000426 if (no == 0) return(xmlNewParserCtxt());
Daniel Veillarda521d282004-11-09 14:59:59 +0000427 if (no == 1) return(xmlCreateMemoryParserCtxt("<doc/>", 6));
Daniel Veillardd93f6252004-11-02 15:53:51 +0000428 return(NULL);
429}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000430static void des_xmlParserCtxtPtr(int no ATTRIBUTE_UNUSED, xmlParserCtxtPtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000431 if (val != NULL)
432 xmlFreeParserCtxt(val);
433}
434
Daniel Veillard34099b42004-11-04 17:34:35 +0000435#define gen_nb_xmlSAXHandlerPtr 2
436static xmlSAXHandlerPtr gen_xmlSAXHandlerPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillarda521d282004-11-09 14:59:59 +0000437#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +0000438 if (no == 0) return((xmlSAXHandlerPtr) &xmlDefaultSAXHandler);
Daniel Veillarda521d282004-11-09 14:59:59 +0000439#endif
Daniel Veillard34099b42004-11-04 17:34:35 +0000440 return(NULL);
441}
442static void des_xmlSAXHandlerPtr(int no ATTRIBUTE_UNUSED, xmlSAXHandlerPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
443}
444
Daniel Veillardc0be74b2004-11-03 19:16:55 +0000445#define gen_nb_xmlValidCtxtPtr 2
Daniel Veillard3d97e662004-11-04 10:49:00 +0000446static xmlValidCtxtPtr gen_xmlValidCtxtPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillarda521d282004-11-09 14:59:59 +0000447#ifdef LIBXML_VALID_ENABLED
Daniel Veillardc0be74b2004-11-03 19:16:55 +0000448 if (no == 0) return(xmlNewValidCtxt());
Daniel Veillarda521d282004-11-09 14:59:59 +0000449#endif
Daniel Veillardc0be74b2004-11-03 19:16:55 +0000450 return(NULL);
451}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000452static void des_xmlValidCtxtPtr(int no ATTRIBUTE_UNUSED, xmlValidCtxtPtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillarda521d282004-11-09 14:59:59 +0000453#ifdef LIBXML_VALID_ENABLED
Daniel Veillardc0be74b2004-11-03 19:16:55 +0000454 if (val != NULL)
455 xmlFreeValidCtxt(val);
Daniel Veillarda521d282004-11-09 14:59:59 +0000456#endif
Daniel Veillardc0be74b2004-11-03 19:16:55 +0000457}
458
Daniel Veillard34099b42004-11-04 17:34:35 +0000459#define gen_nb_xmlParserInputBufferPtr 8
460
461static xmlParserInputBufferPtr gen_xmlParserInputBufferPtr(int no, int nr ATTRIBUTE_UNUSED) {
462 if (no == 0) return(xmlParserInputBufferCreateFilename("missing.xml", XML_CHAR_ENCODING_NONE));
463 if (no == 1) return(xmlParserInputBufferCreateFilename("<foo/>", XML_CHAR_ENCODING_NONE));
464 if (no == 2) return(xmlParserInputBufferCreateFilename("test/ent2", XML_CHAR_ENCODING_NONE));
465 if (no == 3) return(xmlParserInputBufferCreateFilename("test/valid/REC-xml-19980210.xml", XML_CHAR_ENCODING_NONE));
466 if (no == 4) return(xmlParserInputBufferCreateFilename("test/valid/dtds/xhtml1-strict.dtd", XML_CHAR_ENCODING_NONE));
467 if (no == 5) return(xmlParserInputBufferCreateFilename("http://missing.example.org/", XML_CHAR_ENCODING_NONE));
468 if (no == 6) return(xmlParserInputBufferCreateFilename("http://missing. example.org/", XML_CHAR_ENCODING_NONE));
469 return(NULL);
470}
471static void des_xmlParserInputBufferPtr(int no ATTRIBUTE_UNUSED, xmlParserInputBufferPtr val, int nr ATTRIBUTE_UNUSED) {
472 xmlFreeParserInputBuffer(val);
473}
474
Daniel Veillardd93f6252004-11-02 15:53:51 +0000475#define gen_nb_xmlDocPtr 3
Daniel Veillard3d97e662004-11-04 10:49:00 +0000476static xmlDocPtr gen_xmlDocPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000477 if (no == 0) return(xmlNewDoc(BAD_CAST "1.0"));
478 if (no == 1) return(xmlReadMemory("<foo/>", 6, "test", NULL, 0));
479 return(NULL);
480}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000481static void des_xmlDocPtr(int no ATTRIBUTE_UNUSED, xmlDocPtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardce244ad2004-11-05 10:03:46 +0000482 if ((val != NULL) && (val != api_doc) && (val->doc != api_doc))
Daniel Veillardd93f6252004-11-02 15:53:51 +0000483 xmlFreeDoc(val);
484}
485
Daniel Veillardce244ad2004-11-05 10:03:46 +0000486#define gen_nb_xmlAttrPtr 2
487static xmlAttrPtr gen_xmlAttrPtr(int no, int nr ATTRIBUTE_UNUSED) {
488 if (no == 0) return(get_api_attr());
489 return(NULL);
490}
491static void des_xmlAttrPtr(int no, xmlAttrPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
492 if (no == 0) free_api_doc();
493}
494
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000495#define gen_nb_xmlDictPtr 2
496static xmlDictPtr gen_xmlDictPtr(int no, int nr ATTRIBUTE_UNUSED) {
497 if (no == 0) return(xmlDictCreate());
498 return(NULL);
499}
500static void des_xmlDictPtr(int no ATTRIBUTE_UNUSED, xmlDictPtr val, int nr ATTRIBUTE_UNUSED) {
501 if (val != NULL)
502 xmlDictFree(val);
503}
504
Daniel Veillardce244ad2004-11-05 10:03:46 +0000505#define gen_nb_xmlNodePtr 3
Daniel Veillard3d97e662004-11-04 10:49:00 +0000506static xmlNodePtr gen_xmlNodePtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000507 if (no == 0) return(xmlNewPI(BAD_CAST "test", NULL));
Daniel Veillardce244ad2004-11-05 10:03:46 +0000508 if (no == 1) return(get_api_root());
Daniel Veillardd93f6252004-11-02 15:53:51 +0000509 return(NULL);
Daniel Veillardce244ad2004-11-05 10:03:46 +0000510/* if (no == 2) return((xmlNodePtr) get_api_doc()); */
Daniel Veillardd93f6252004-11-02 15:53:51 +0000511}
Daniel Veillard27f20102004-11-05 11:50:11 +0000512static void des_xmlNodePtr(int no, xmlNodePtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardce244ad2004-11-05 10:03:46 +0000513 if (no == 1) free_api_doc();
514 else if (val != NULL) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000515 xmlUnlinkNode(val);
516 xmlFreeNode(val);
517 }
518}
519
Daniel Veillard27f20102004-11-05 11:50:11 +0000520#define gen_nb_xmlDtdPtr 3
521static xmlDtdPtr gen_xmlDtdPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +0000522 if (no == 0)
523 return(xmlNewDtd(NULL, BAD_CAST "dtd", BAD_CAST"foo", BAD_CAST"bar"));
Daniel Veillard27f20102004-11-05 11:50:11 +0000524 if (no == 1) return(get_api_dtd());
525 return(NULL);
526}
527static void des_xmlDtdPtr(int no, xmlDtdPtr val, int nr ATTRIBUTE_UNUSED) {
528 if (no == 1) free_api_doc();
529 else if (val != NULL) {
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +0000530 xmlUnlinkNode((xmlNodePtr) val);
531 xmlFreeNode((xmlNodePtr) val);
Daniel Veillard27f20102004-11-05 11:50:11 +0000532 }
533}
534
535#define gen_nb_xmlNsPtr 2
536static xmlNsPtr gen_xmlNsPtr(int no, int nr ATTRIBUTE_UNUSED) {
537 if (no == 0) return(get_api_ns());
538 return(NULL);
539}
540static void des_xmlNsPtr(int no, xmlNsPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
541 if (no == 0) free_api_doc();
542}
543
Daniel Veillardd93f6252004-11-02 15:53:51 +0000544#define gen_nb_xmlNodePtr_in 3
Daniel Veillard3d97e662004-11-04 10:49:00 +0000545static xmlNodePtr gen_xmlNodePtr_in(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000546 if (no == 0) return(xmlNewPI(BAD_CAST "test", NULL));
547 if (no == 0) return(xmlNewText(BAD_CAST "text"));
548 return(NULL);
549}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000550static void des_xmlNodePtr_in(int no ATTRIBUTE_UNUSED, xmlNodePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000551}
552
Daniel Veillardc8311492004-11-08 16:51:13 +0000553#ifdef LIBXML_WRITER_ENABLED
Daniel Veillarde43cc572004-11-03 11:50:29 +0000554#define gen_nb_xmlTextWriterPtr 2
Daniel Veillard3d97e662004-11-04 10:49:00 +0000555static xmlTextWriterPtr gen_xmlTextWriterPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillarde43cc572004-11-03 11:50:29 +0000556 if (no == 0) return(xmlNewTextWriterFilename("test.out", 0));
557 return(NULL);
558}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000559static void des_xmlTextWriterPtr(int no ATTRIBUTE_UNUSED, xmlTextWriterPtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillarde43cc572004-11-03 11:50:29 +0000560 if (val != NULL) xmlFreeTextWriter(val);
561}
Daniel Veillardc8311492004-11-08 16:51:13 +0000562#endif
Daniel Veillarde43cc572004-11-03 11:50:29 +0000563
Daniel Veillardc8311492004-11-08 16:51:13 +0000564#ifdef LIBXML_READER_ENABLED
Daniel Veillarddd6d3002004-11-03 14:20:29 +0000565#define gen_nb_xmlTextReaderPtr 4
Daniel Veillard3d97e662004-11-04 10:49:00 +0000566static xmlTextReaderPtr gen_xmlTextReaderPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillarddd6d3002004-11-03 14:20:29 +0000567 if (no == 0) return(xmlNewTextReaderFilename("test/ent2"));
568 if (no == 1) return(xmlNewTextReaderFilename("test/valid/REC-xml-19980210.xml"));
569 if (no == 2) return(xmlNewTextReaderFilename("test/valid/dtds/xhtml1-strict.dtd"));
570 return(NULL);
571}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000572static void des_xmlTextReaderPtr(int no ATTRIBUTE_UNUSED, xmlTextReaderPtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillarddd6d3002004-11-03 14:20:29 +0000573 if (val != NULL) xmlFreeTextReader(val);
574}
Daniel Veillardc8311492004-11-08 16:51:13 +0000575#endif
Daniel Veillarddd6d3002004-11-03 14:20:29 +0000576
Daniel Veillard34099b42004-11-04 17:34:35 +0000577#define gen_nb_xmlBufferPtr 3
Daniel Veillard3d97e662004-11-04 10:49:00 +0000578static xmlBufferPtr gen_xmlBufferPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000579 if (no == 0) return(xmlBufferCreate());
Daniel Veillardce244ad2004-11-05 10:03:46 +0000580 if (no == 1) return(xmlBufferCreateStatic((void *)"a static buffer", 13));
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000581 return(NULL);
582}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000583static void des_xmlBufferPtr(int no ATTRIBUTE_UNUSED, xmlBufferPtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000584 if (val != NULL) {
585 xmlBufferFree(val);
586 }
587}
588
589#define gen_nb_xmlListPtr 2
Daniel Veillard3d97e662004-11-04 10:49:00 +0000590static xmlListPtr gen_xmlListPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000591 if (no == 0) return(xmlListCreate(NULL, NULL));
592 return(NULL);
593}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000594static void des_xmlListPtr(int no ATTRIBUTE_UNUSED, xmlListPtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000595 if (val != NULL) {
596 xmlListDelete(val);
597 }
598}
599
600#define gen_nb_xmlHashTablePtr 2
Daniel Veillard3d97e662004-11-04 10:49:00 +0000601static xmlHashTablePtr gen_xmlHashTablePtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000602 if (no == 0) return(xmlHashCreate(10));
603 return(NULL);
604}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000605static void des_xmlHashTablePtr(int no ATTRIBUTE_UNUSED, xmlHashTablePtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000606 if (val != NULL) {
607 xmlHashFree(val, NULL);
608 }
609}
610
611#include <libxml/xpathInternals.h>
612
Daniel Veillardc8311492004-11-08 16:51:13 +0000613#ifdef LIBXML_XPATH_ENABLED
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000614#define gen_nb_xmlXPathObjectPtr 5
Daniel Veillard3d97e662004-11-04 10:49:00 +0000615static xmlXPathObjectPtr gen_xmlXPathObjectPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000616 if (no == 0) return(xmlXPathNewString(BAD_CAST "string object"));
617 if (no == 1) return(xmlXPathNewFloat(1.1));
618 if (no == 2) return(xmlXPathNewBoolean(1));
619 if (no == 3) return(xmlXPathNewNodeSet(NULL));
620 return(NULL);
621}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000622static void des_xmlXPathObjectPtr(int no ATTRIBUTE_UNUSED, xmlXPathObjectPtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000623 if (val != NULL) {
624 xmlXPathFreeObject(val);
625 }
626}
Daniel Veillardc8311492004-11-08 16:51:13 +0000627#endif
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000628
Daniel Veillardc8311492004-11-08 16:51:13 +0000629#ifdef LIBXML_OUTPUT_ENABLED
Daniel Veillard3d97e662004-11-04 10:49:00 +0000630#define gen_nb_xmlOutputBufferPtr 2
631static xmlOutputBufferPtr gen_xmlOutputBufferPtr(int no, int nr ATTRIBUTE_UNUSED) {
632 if (no == 0) return(xmlOutputBufferCreateFilename("test.out", NULL, 0));
633 return(NULL);
634}
635static void des_xmlOutputBufferPtr(int no ATTRIBUTE_UNUSED, xmlOutputBufferPtr val, int nr ATTRIBUTE_UNUSED) {
636 if (val != NULL) {
637 xmlOutputBufferClose(val);
638 }
639}
Daniel Veillardc8311492004-11-08 16:51:13 +0000640#endif
Daniel Veillard3d97e662004-11-04 10:49:00 +0000641
Daniel Veillardc8311492004-11-08 16:51:13 +0000642#ifdef LIBXML_FTP_ENABLED
Daniel Veillard27f20102004-11-05 11:50:11 +0000643#define gen_nb_xmlNanoFTPCtxtPtr 4
644static void *gen_xmlNanoFTPCtxtPtr(int no, int nr ATTRIBUTE_UNUSED) {
645 if (no == 0) return(xmlNanoFTPNewCtxt("ftp://example.com/"));
646 if (no == 1) return(xmlNanoFTPNewCtxt("http://example.com/"));
647 if (no == 2) return(xmlNanoFTPNewCtxt("foo"));
648 return(NULL);
649}
650static void des_xmlNanoFTPCtxtPtr(int no ATTRIBUTE_UNUSED, void *val, int nr ATTRIBUTE_UNUSED) {
651 if (val != NULL) {
652 xmlNanoFTPFreeCtxt(val);
653 }
654}
Daniel Veillardc8311492004-11-08 16:51:13 +0000655#endif
Daniel Veillard27f20102004-11-05 11:50:11 +0000656
Daniel Veillardc8311492004-11-08 16:51:13 +0000657#ifdef LIBXML_HTTP_ENABLED
Daniel Veillard27f20102004-11-05 11:50:11 +0000658#define gen_nb_xmlNanoHTTPCtxtPtr 1
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +0000659static void *gen_xmlNanoHTTPCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillard27f20102004-11-05 11:50:11 +0000660 return(NULL);
661}
662static void des_xmlNanoHTTPCtxtPtr(int no ATTRIBUTE_UNUSED, void *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
663}
Daniel Veillardc8311492004-11-08 16:51:13 +0000664#endif
Daniel Veillard27f20102004-11-05 11:50:11 +0000665
Daniel Veillard3d97e662004-11-04 10:49:00 +0000666#define gen_nb_xmlCharEncoding 4
667static xmlCharEncoding gen_xmlCharEncoding(int no, int nr ATTRIBUTE_UNUSED) {
668 if (no == 0) return(XML_CHAR_ENCODING_UTF8);
669 if (no == 1) return(XML_CHAR_ENCODING_NONE);
670 if (no == 0) return(XML_CHAR_ENCODING_8859_1);
671 return(XML_CHAR_ENCODING_ERROR);
672}
673static void des_xmlCharEncoding(int no ATTRIBUTE_UNUSED, xmlCharEncoding val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
674}
675
Daniel Veillard42595322004-11-08 10:52:06 +0000676#define gen_nb_xmlHashDeallocator 2
677static void
678test_xmlHashDeallocator(void *payload ATTRIBUTE_UNUSED, xmlChar *name ATTRIBUTE_UNUSED) {
679}
680
681static xmlHashDeallocator gen_xmlHashDeallocator(int no, int nr ATTRIBUTE_UNUSED) {
682 if (no == 0) return(test_xmlHashDeallocator);
683 return(NULL);
684}
685static void des_xmlHashDeallocator(int no ATTRIBUTE_UNUSED, xmlHashDeallocator val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
686}
687
Daniel Veillardd93f6252004-11-02 15:53:51 +0000688
689static void desret_int(int val ATTRIBUTE_UNUSED) {
690}
Daniel Veillardf2a36f92004-11-08 17:55:01 +0000691static void desret_xmlChar(xmlChar val ATTRIBUTE_UNUSED) {
692}
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000693static void desret_long(long val ATTRIBUTE_UNUSED) {
694}
William M. Brack094dd862004-11-14 14:28:34 +0000695static void desret_unsigned_long(unsigned long val ATTRIBUTE_UNUSED) {
696}
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000697static void desret_double(double val ATTRIBUTE_UNUSED) {
698}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000699static void desret_xmlCharEncoding(xmlCharEncoding val ATTRIBUTE_UNUSED) {
700}
Daniel Veillardce244ad2004-11-05 10:03:46 +0000701#if 0
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000702static void desret_const_void_ptr(void *val ATTRIBUTE_UNUSED) {
703}
Daniel Veillardce244ad2004-11-05 10:03:46 +0000704#endif
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +0000705static void desret_void_ptr(void *val ATTRIBUTE_UNUSED) {
706}
Daniel Veillardd93f6252004-11-02 15:53:51 +0000707static void desret_const_char_ptr(const char *val ATTRIBUTE_UNUSED) {
708}
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000709static void desret_const_xmlChar_ptr(const xmlChar *val ATTRIBUTE_UNUSED) {
710}
Daniel Veillard8a32fe42004-11-02 22:10:16 +0000711static void desret_xmlChar_ptr(xmlChar *val) {
712 if (val != NULL)
713 xmlFree(val);
714}
Daniel Veillardd93f6252004-11-02 15:53:51 +0000715static void desret_xmlDocPtr(xmlDocPtr val) {
Daniel Veillardce244ad2004-11-05 10:03:46 +0000716 if (val != api_doc)
717 xmlFreeDoc(val);
Daniel Veillardd93f6252004-11-02 15:53:51 +0000718}
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000719static void desret_xmlDictPtr(xmlDictPtr val) {
720 xmlDictFree(val);
721}
Daniel Veillardc8311492004-11-08 16:51:13 +0000722#ifdef LIBXML_OUTPUT_ENABLED
Daniel Veillard3d95c732004-11-06 22:25:14 +0000723static void desret_xmlOutputBufferPtr(xmlOutputBufferPtr val) {
724 xmlOutputBufferClose(val);
725}
Daniel Veillardc8311492004-11-08 16:51:13 +0000726#endif
727#ifdef LIBXML_READER_ENABLED
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000728static void desret_xmlTextReaderPtr(xmlTextReaderPtr val) {
729 xmlFreeTextReader(val);
730}
Daniel Veillardc8311492004-11-08 16:51:13 +0000731#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +0000732static void desret_xmlNodePtr(xmlNodePtr val) {
Daniel Veillardce244ad2004-11-05 10:03:46 +0000733 if ((val != NULL) && (val != api_root) && (val != (xmlNodePtr) api_doc)) {
734 xmlUnlinkNode(val);
735 xmlFreeNode(val);
736 }
Daniel Veillardd93f6252004-11-02 15:53:51 +0000737}
Daniel Veillard57b25162004-11-06 14:50:18 +0000738static void desret_xmlAttrPtr(xmlAttrPtr val) {
739 if (val != NULL) {
740 xmlUnlinkNode((xmlNodePtr) val);
741 xmlFreeNode((xmlNodePtr) val);
742 }
743}
Daniel Veillardd5cc0f72004-11-06 19:24:28 +0000744static void desret_xmlEntityPtr(xmlEntityPtr val) {
745 if (val != NULL) {
746 xmlUnlinkNode((xmlNodePtr) val);
747 xmlFreeNode((xmlNodePtr) val);
748 }
749}
Daniel Veillard42595322004-11-08 10:52:06 +0000750static void desret_xmlElementPtr(xmlElementPtr val) {
751 if (val != NULL) {
752 xmlUnlinkNode((xmlNodePtr) val);
753 }
754}
755static void desret_xmlAttributePtr(xmlAttributePtr val) {
756 if (val != NULL) {
757 xmlUnlinkNode((xmlNodePtr) val);
758 }
759}
Daniel Veillardd5cc0f72004-11-06 19:24:28 +0000760static void desret_xmlNsPtr(xmlNsPtr val ATTRIBUTE_UNUSED) {
761}
Daniel Veillard34099b42004-11-04 17:34:35 +0000762static void desret_xmlDtdPtr(xmlDtdPtr val) {
763 desret_xmlNodePtr((xmlNodePtr)val);
764}
Daniel Veillardc8311492004-11-08 16:51:13 +0000765#ifdef LIBXML_XPATH_ENABLED
Daniel Veillard3d97e662004-11-04 10:49:00 +0000766static void desret_xmlXPathObjectPtr(xmlXPathObjectPtr val) {
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000767 xmlXPathFreeObject(val);
Daniel Veillard3d97e662004-11-04 10:49:00 +0000768}
Daniel Veillardf2a36f92004-11-08 17:55:01 +0000769static void desret_xmlNodeSetPtr(xmlNodeSetPtr val) {
770 xmlXPathFreeNodeSet(val);
771}
Daniel Veillardc8311492004-11-08 16:51:13 +0000772#endif
Daniel Veillard34099b42004-11-04 17:34:35 +0000773static void desret_xmlParserCtxtPtr(xmlParserCtxtPtr val) {
774 xmlFreeParserCtxt(val);
775}
Daniel Veillardd5cc0f72004-11-06 19:24:28 +0000776static void desret_xmlParserInputBufferPtr(xmlParserInputBufferPtr val) {
777 xmlFreeParserInputBuffer(val);
778}
Daniel Veillard42595322004-11-08 10:52:06 +0000779static void desret_xmlParserInputPtr(xmlParserInputPtr val) {
780 xmlFreeInputStream(val);
781}
Daniel Veillardc8311492004-11-08 16:51:13 +0000782#ifdef LIBXML_WRITER_ENABLED
Daniel Veillardd5cc0f72004-11-06 19:24:28 +0000783static void desret_xmlTextWriterPtr(xmlTextWriterPtr val) {
784 xmlFreeTextWriter(val);
785}
Daniel Veillardc8311492004-11-08 16:51:13 +0000786#endif
Daniel Veillard3d95c732004-11-06 22:25:14 +0000787static void desret_xmlBufferPtr(xmlBufferPtr val) {
788 xmlBufferFree(val);
789}
Daniel Veillardc8311492004-11-08 16:51:13 +0000790#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillard42595322004-11-08 10:52:06 +0000791static void desret_xmlSchemaParserCtxtPtr(xmlSchemaParserCtxtPtr val) {
792 xmlSchemaFreeParserCtxt(val);
793}
794static void desret_xmlSchemaTypePtr(xmlSchemaTypePtr val ATTRIBUTE_UNUSED) {
795}
796static void desret_xmlRelaxNGParserCtxtPtr(xmlRelaxNGParserCtxtPtr val) {
797 xmlRelaxNGFreeParserCtxt(val);
798}
Daniel Veillardc8311492004-11-08 16:51:13 +0000799#endif
800#ifdef LIBXML_HTML_ENABLED
William M. Brackf13f77f2004-11-12 16:03:48 +0000801static void desret_const_htmlEntityDesc_ptr(const htmlEntityDesc * val ATTRIBUTE_UNUSED) {
Daniel Veillard42595322004-11-08 10:52:06 +0000802}
Daniel Veillardc8311492004-11-08 16:51:13 +0000803#endif
Daniel Veillardd5cc0f72004-11-06 19:24:28 +0000804
Daniel Veillarda521d282004-11-09 14:59:59 +0000805/* cut and pasted from autogenerated to avoid troubles */
806#define gen_nb_const_xmlChar_ptr_ptr 1
807static xmlChar ** gen_const_xmlChar_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
808 return(NULL);
809}
810static void des_const_xmlChar_ptr_ptr(int no ATTRIBUTE_UNUSED, const xmlChar ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
811}
812
813#define gen_nb_unsigned_char_ptr 1
814static unsigned char * gen_unsigned_char_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
815 return(NULL);
816}
817static void des_unsigned_char_ptr(int no ATTRIBUTE_UNUSED, unsigned char * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
818}
819
820#define gen_nb_const_unsigned_char_ptr 1
821static unsigned char * gen_const_unsigned_char_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
822 return(NULL);
823}
824static void des_const_unsigned_char_ptr(int no ATTRIBUTE_UNUSED, const unsigned char * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
825}
826
827#ifdef LIBXML_HTML_ENABLED
828#define gen_nb_const_htmlNodePtr 1
829static htmlNodePtr gen_const_htmlNodePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
830 return(NULL);
831}
832static void des_const_htmlNodePtr(int no ATTRIBUTE_UNUSED, const htmlNodePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
833}
834#endif
835
836#ifdef LIBXML_HTML_ENABLED
837#define gen_nb_htmlDocPtr 3
838static htmlDocPtr gen_htmlDocPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
839 if (no == 0) return(htmlNewDoc(NULL, NULL));
840 if (no == 1) return(htmlReadMemory("<html/>", 7, "test", NULL, 0));
841 return(NULL);
842}
843static void des_htmlDocPtr(int no ATTRIBUTE_UNUSED, htmlDocPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
844 if ((val != NULL) && (val != api_doc) && (val->doc != api_doc))
845 xmlFreeDoc(val);
846}
847static void desret_htmlDocPtr(htmlDocPtr val) {
848 if ((val != NULL) && (val != api_doc) && (val->doc != api_doc))
849 xmlFreeDoc(val);
850}
851#define gen_nb_htmlParserCtxtPtr 3
852static htmlParserCtxtPtr gen_htmlParserCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
853 if (no == 0) return(xmlNewParserCtxt());
854 if (no == 1) return(htmlCreateMemoryParserCtxt("<html/>", 7));
855 return(NULL);
856}
857static void des_htmlParserCtxtPtr(int no ATTRIBUTE_UNUSED, htmlParserCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
858 if (val != NULL)
859 htmlFreeParserCtxt(val);
860}
861static void desret_htmlParserCtxtPtr(htmlParserCtxtPtr val) {
862 if (val != NULL)
863 htmlFreeParserCtxt(val);
864}
865#endif
866
867#ifdef LIBXML_XPATH_ENABLED
868#define gen_nb_xmlNodeSetPtr 1
869static xmlNodeSetPtr gen_xmlNodeSetPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
870 return(NULL);
871}
872static void des_xmlNodeSetPtr(int no ATTRIBUTE_UNUSED, xmlNodeSetPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
873}
874#endif
875
876#ifdef LIBXML_DEBUG_ENABLED
Daniel Veillardd0cf7f62004-11-09 16:17:02 +0000877#ifdef LIBXML_XPATH_ENABLED
Daniel Veillarda521d282004-11-09 14:59:59 +0000878#define gen_nb_xmlShellCtxtPtr 1
879static xmlShellCtxtPtr gen_xmlShellCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
880 return(NULL);
881}
882static void des_xmlShellCtxtPtr(int no ATTRIBUTE_UNUSED, xmlShellCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
883}
884#endif
Daniel Veillardd0cf7f62004-11-09 16:17:02 +0000885#endif
Daniel Veillarda521d282004-11-09 14:59:59 +0000886
887#ifdef LIBXML_PATTERN_ENABLED
888#define gen_nb_xmlPatternPtr 1
889static xmlPatternPtr gen_xmlPatternPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
890 return(NULL);
891}
892static void des_xmlPatternPtr(int no ATTRIBUTE_UNUSED, xmlPatternPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
893}
894#endif
895
William M. Brack094dd862004-11-14 14:28:34 +0000896#define gen_nb_xmlElementContentPtr 1
897static xmlElementContentPtr gen_xmlElementContentPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
898 return(NULL);
899}
900static void des_xmlElementContentPtr(int no ATTRIBUTE_UNUSED, xmlElementContentPtr val, int nr ATTRIBUTE_UNUSED) {
901 if (val != NULL)
902 xmlFreeElementContent(val);
903}
904static void desret_xmlElementContentPtr(xmlElementContentPtr val) {
905 if (val != NULL)
906 xmlFreeElementContent(val);
907}
908
909#define gen_nb_xmlParserNodeInfoSeqPtr 1
910static xmlParserNodeInfoSeqPtr gen_xmlParserNodeInfoSeqPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
911 return(NULL);
912}
913static void des_xmlParserNodeInfoSeqPtr(int no ATTRIBUTE_UNUSED, xmlParserNodeInfoSeqPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
914}
915
916static void desret_const_xmlParserNodeInfo_ptr(const xmlParserNodeInfo *val ATTRIBUTE_UNUSED) {
917}
918
Daniel Veillardd5cc0f72004-11-06 19:24:28 +0000919/************************************************************************
920 * *
921 * WARNING: end of the manually maintained part of the test code *
922 * do not remove or alter the CUT HERE line *
923 * *
924 ************************************************************************/
925
Daniel Veillard34099b42004-11-04 17:34:35 +0000926/* CUT HERE: everything below that line is generated */
Daniel Veillarda521d282004-11-09 14:59:59 +0000927#ifdef LIBXML_HTML_ENABLED
Daniel Veillard57b25162004-11-06 14:50:18 +0000928static void desret_htmlStatus(htmlStatus val ATTRIBUTE_UNUSED) {
929}
930
Daniel Veillarda521d282004-11-09 14:59:59 +0000931#endif
932
Daniel Veillard57b25162004-11-06 14:50:18 +0000933#define gen_nb_xmlAttributeDefault 4
934static xmlAttributeDefault gen_xmlAttributeDefault(int no, int nr ATTRIBUTE_UNUSED) {
935 if (no == 1) return(XML_ATTRIBUTE_FIXED);
936 if (no == 2) return(XML_ATTRIBUTE_IMPLIED);
937 if (no == 3) return(XML_ATTRIBUTE_NONE);
938 if (no == 4) return(XML_ATTRIBUTE_REQUIRED);
939 return(0);
940}
William M. Brack094dd862004-11-14 14:28:34 +0000941
Daniel Veillard57b25162004-11-06 14:50:18 +0000942static void des_xmlAttributeDefault(int no ATTRIBUTE_UNUSED, xmlAttributeDefault val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
943}
Daniel Veillard57b25162004-11-06 14:50:18 +0000944
945#define gen_nb_xmlAttributeType 4
946static xmlAttributeType gen_xmlAttributeType(int no, int nr ATTRIBUTE_UNUSED) {
947 if (no == 1) return(XML_ATTRIBUTE_CDATA);
948 if (no == 2) return(XML_ATTRIBUTE_ENTITIES);
949 if (no == 3) return(XML_ATTRIBUTE_ENTITY);
950 if (no == 4) return(XML_ATTRIBUTE_ENUMERATION);
951 return(0);
952}
William M. Brack094dd862004-11-14 14:28:34 +0000953
Daniel Veillard57b25162004-11-06 14:50:18 +0000954static void des_xmlAttributeType(int no ATTRIBUTE_UNUSED, xmlAttributeType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
955}
Daniel Veillard57b25162004-11-06 14:50:18 +0000956
957#define gen_nb_xmlBufferAllocationScheme 3
958static xmlBufferAllocationScheme gen_xmlBufferAllocationScheme(int no, int nr ATTRIBUTE_UNUSED) {
959 if (no == 1) return(XML_BUFFER_ALLOC_DOUBLEIT);
960 if (no == 2) return(XML_BUFFER_ALLOC_EXACT);
961 if (no == 3) return(XML_BUFFER_ALLOC_IMMUTABLE);
962 return(0);
963}
William M. Brack094dd862004-11-14 14:28:34 +0000964
Daniel Veillard57b25162004-11-06 14:50:18 +0000965static void des_xmlBufferAllocationScheme(int no ATTRIBUTE_UNUSED, xmlBufferAllocationScheme val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
966}
William M. Brack094dd862004-11-14 14:28:34 +0000967
Daniel Veillard57b25162004-11-06 14:50:18 +0000968static void desret_xmlBufferAllocationScheme(xmlBufferAllocationScheme val ATTRIBUTE_UNUSED) {
969}
970
Daniel Veillarda521d282004-11-09 14:59:59 +0000971#ifdef LIBXML_CATALOG_ENABLED
Daniel Veillard57b25162004-11-06 14:50:18 +0000972#define gen_nb_xmlCatalogAllow 4
973static xmlCatalogAllow gen_xmlCatalogAllow(int no, int nr ATTRIBUTE_UNUSED) {
974 if (no == 1) return(XML_CATA_ALLOW_ALL);
975 if (no == 2) return(XML_CATA_ALLOW_DOCUMENT);
976 if (no == 3) return(XML_CATA_ALLOW_GLOBAL);
977 if (no == 4) return(XML_CATA_ALLOW_NONE);
978 return(0);
979}
William M. Brack094dd862004-11-14 14:28:34 +0000980
Daniel Veillard57b25162004-11-06 14:50:18 +0000981static void des_xmlCatalogAllow(int no ATTRIBUTE_UNUSED, xmlCatalogAllow val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
982}
William M. Brack094dd862004-11-14 14:28:34 +0000983
Daniel Veillard57b25162004-11-06 14:50:18 +0000984static void desret_xmlCatalogAllow(xmlCatalogAllow val ATTRIBUTE_UNUSED) {
985}
986
Daniel Veillarda521d282004-11-09 14:59:59 +0000987#endif
988
989#ifdef LIBXML_CATALOG_ENABLED
Daniel Veillard57b25162004-11-06 14:50:18 +0000990#define gen_nb_xmlCatalogPrefer 3
991static xmlCatalogPrefer gen_xmlCatalogPrefer(int no, int nr ATTRIBUTE_UNUSED) {
992 if (no == 1) return(XML_CATA_PREFER_NONE);
993 if (no == 2) return(XML_CATA_PREFER_PUBLIC);
994 if (no == 3) return(XML_CATA_PREFER_SYSTEM);
995 return(0);
996}
William M. Brack094dd862004-11-14 14:28:34 +0000997
Daniel Veillard57b25162004-11-06 14:50:18 +0000998static void des_xmlCatalogPrefer(int no ATTRIBUTE_UNUSED, xmlCatalogPrefer val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
999}
William M. Brack094dd862004-11-14 14:28:34 +00001000
Daniel Veillard57b25162004-11-06 14:50:18 +00001001static void desret_xmlCatalogPrefer(xmlCatalogPrefer val ATTRIBUTE_UNUSED) {
1002}
1003
Daniel Veillarda521d282004-11-09 14:59:59 +00001004#endif
1005
Daniel Veillard57b25162004-11-06 14:50:18 +00001006#define gen_nb_xmlElementContentType 4
1007static xmlElementContentType gen_xmlElementContentType(int no, int nr ATTRIBUTE_UNUSED) {
1008 if (no == 1) return(XML_ELEMENT_CONTENT_ELEMENT);
1009 if (no == 2) return(XML_ELEMENT_CONTENT_OR);
1010 if (no == 3) return(XML_ELEMENT_CONTENT_PCDATA);
1011 if (no == 4) return(XML_ELEMENT_CONTENT_SEQ);
1012 return(0);
1013}
Daniel Veillard57b25162004-11-06 14:50:18 +00001014
William M. Brack094dd862004-11-14 14:28:34 +00001015static void des_xmlElementContentType(int no ATTRIBUTE_UNUSED, xmlElementContentType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillard57b25162004-11-06 14:50:18 +00001016}
1017
1018#define gen_nb_xmlElementTypeVal 4
1019static xmlElementTypeVal gen_xmlElementTypeVal(int no, int nr ATTRIBUTE_UNUSED) {
1020 if (no == 1) return(XML_ELEMENT_TYPE_ANY);
1021 if (no == 2) return(XML_ELEMENT_TYPE_ELEMENT);
1022 if (no == 3) return(XML_ELEMENT_TYPE_EMPTY);
1023 if (no == 4) return(XML_ELEMENT_TYPE_MIXED);
1024 return(0);
1025}
William M. Brack094dd862004-11-14 14:28:34 +00001026
Daniel Veillard57b25162004-11-06 14:50:18 +00001027static void des_xmlElementTypeVal(int no ATTRIBUTE_UNUSED, xmlElementTypeVal val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1028}
Daniel Veillard57b25162004-11-06 14:50:18 +00001029
Daniel Veillard57b25162004-11-06 14:50:18 +00001030static void desret_xmlParserErrors(xmlParserErrors val ATTRIBUTE_UNUSED) {
1031}
1032
Daniel Veillarda521d282004-11-09 14:59:59 +00001033#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillard57b25162004-11-06 14:50:18 +00001034#define gen_nb_xmlSchemaValType 4
1035static xmlSchemaValType gen_xmlSchemaValType(int no, int nr ATTRIBUTE_UNUSED) {
1036 if (no == 1) return(XML_SCHEMAS_ANYSIMPLETYPE);
1037 if (no == 2) return(XML_SCHEMAS_ANYTYPE);
1038 if (no == 3) return(XML_SCHEMAS_ANYURI);
1039 if (no == 4) return(XML_SCHEMAS_BASE64BINARY);
1040 return(0);
1041}
William M. Brack094dd862004-11-14 14:28:34 +00001042
Daniel Veillard57b25162004-11-06 14:50:18 +00001043static void des_xmlSchemaValType(int no ATTRIBUTE_UNUSED, xmlSchemaValType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1044}
Daniel Veillard57b25162004-11-06 14:50:18 +00001045
Daniel Veillarda521d282004-11-09 14:59:59 +00001046#endif
1047
Daniel Veillard34099b42004-11-04 17:34:35 +00001048#include <libxml/HTMLparser.h>
1049#include <libxml/HTMLtree.h>
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00001050#include <libxml/SAX2.h>
Daniel Veillarda82b1822004-11-08 16:24:57 +00001051#include <libxml/c14n.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001052#include <libxml/catalog.h>
1053#include <libxml/chvalid.h>
Daniel Veillarda82b1822004-11-08 16:24:57 +00001054#include <libxml/debugXML.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001055#include <libxml/dict.h>
1056#include <libxml/encoding.h>
1057#include <libxml/entities.h>
1058#include <libxml/hash.h>
1059#include <libxml/list.h>
1060#include <libxml/nanoftp.h>
1061#include <libxml/nanohttp.h>
1062#include <libxml/parser.h>
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00001063#include <libxml/parserInternals.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001064#include <libxml/pattern.h>
1065#include <libxml/relaxng.h>
1066#include <libxml/schemasInternals.h>
1067#include <libxml/tree.h>
1068#include <libxml/uri.h>
1069#include <libxml/valid.h>
1070#include <libxml/xinclude.h>
1071#include <libxml/xmlIO.h>
Daniel Veillarda82b1822004-11-08 16:24:57 +00001072#include <libxml/xmlautomata.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001073#include <libxml/xmlerror.h>
Daniel Veillardf6b71bd2005-01-04 17:50:14 +00001074#include <libxml/xmlmodule.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001075#include <libxml/xmlreader.h>
Daniel Veillarda82b1822004-11-08 16:24:57 +00001076#include <libxml/xmlregexp.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001077#include <libxml/xmlsave.h>
1078#include <libxml/xmlschemas.h>
1079#include <libxml/xmlschemastypes.h>
1080#include <libxml/xmlstring.h>
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +00001081#include <libxml/xmlunicode.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001082#include <libxml/xmlwriter.h>
1083#include <libxml/xpath.h>
Daniel Veillarda82b1822004-11-08 16:24:57 +00001084#include <libxml/xpathInternals.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001085#include <libxml/xpointer.h>
1086static int test_HTMLparser(void);
1087static int test_HTMLtree(void);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00001088static int test_SAX2(void);
Daniel Veillarda82b1822004-11-08 16:24:57 +00001089static int test_c14n(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001090static int test_catalog(void);
1091static int test_chvalid(void);
Daniel Veillarda82b1822004-11-08 16:24:57 +00001092static int test_debugXML(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001093static int test_dict(void);
1094static int test_encoding(void);
1095static int test_entities(void);
1096static int test_hash(void);
1097static int test_list(void);
1098static int test_nanoftp(void);
1099static int test_nanohttp(void);
1100static int test_parser(void);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00001101static int test_parserInternals(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001102static int test_pattern(void);
1103static int test_relaxng(void);
1104static int test_schemasInternals(void);
1105static int test_tree(void);
1106static int test_uri(void);
1107static int test_valid(void);
1108static int test_xinclude(void);
1109static int test_xmlIO(void);
Daniel Veillarda82b1822004-11-08 16:24:57 +00001110static int test_xmlautomata(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001111static int test_xmlerror(void);
Daniel Veillardf6b71bd2005-01-04 17:50:14 +00001112static int test_xmlmodule(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001113static int test_xmlreader(void);
Daniel Veillarda82b1822004-11-08 16:24:57 +00001114static int test_xmlregexp(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001115static int test_xmlsave(void);
1116static int test_xmlschemas(void);
1117static int test_xmlschemastypes(void);
1118static int test_xmlstring(void);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +00001119static int test_xmlunicode(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001120static int test_xmlwriter(void);
1121static int test_xpath(void);
Daniel Veillarda82b1822004-11-08 16:24:57 +00001122static int test_xpathInternals(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001123static int test_xpointer(void);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001124
1125/**
1126 * testlibxml2:
1127 *
1128 * Main entry point of the tester for the full libxml2 module,
1129 * it calls all the tester entry point for each module.
1130 *
1131 * Returns the number of error found
1132 */
1133static int
1134testlibxml2(void)
1135{
Daniel Veillard42595322004-11-08 10:52:06 +00001136 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001137
Daniel Veillard42595322004-11-08 10:52:06 +00001138 test_ret += test_HTMLparser();
1139 test_ret += test_HTMLtree();
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00001140 test_ret += test_SAX2();
Daniel Veillarda82b1822004-11-08 16:24:57 +00001141 test_ret += test_c14n();
Daniel Veillard42595322004-11-08 10:52:06 +00001142 test_ret += test_catalog();
1143 test_ret += test_chvalid();
Daniel Veillarda82b1822004-11-08 16:24:57 +00001144 test_ret += test_debugXML();
Daniel Veillard42595322004-11-08 10:52:06 +00001145 test_ret += test_dict();
1146 test_ret += test_encoding();
1147 test_ret += test_entities();
1148 test_ret += test_hash();
1149 test_ret += test_list();
1150 test_ret += test_nanoftp();
1151 test_ret += test_nanohttp();
1152 test_ret += test_parser();
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00001153 test_ret += test_parserInternals();
Daniel Veillard42595322004-11-08 10:52:06 +00001154 test_ret += test_pattern();
1155 test_ret += test_relaxng();
1156 test_ret += test_schemasInternals();
1157 test_ret += test_tree();
1158 test_ret += test_uri();
1159 test_ret += test_valid();
1160 test_ret += test_xinclude();
1161 test_ret += test_xmlIO();
Daniel Veillarda82b1822004-11-08 16:24:57 +00001162 test_ret += test_xmlautomata();
Daniel Veillard42595322004-11-08 10:52:06 +00001163 test_ret += test_xmlerror();
Daniel Veillardf6b71bd2005-01-04 17:50:14 +00001164 test_ret += test_xmlmodule();
Daniel Veillard42595322004-11-08 10:52:06 +00001165 test_ret += test_xmlreader();
Daniel Veillarda82b1822004-11-08 16:24:57 +00001166 test_ret += test_xmlregexp();
Daniel Veillard42595322004-11-08 10:52:06 +00001167 test_ret += test_xmlsave();
1168 test_ret += test_xmlschemas();
1169 test_ret += test_xmlschemastypes();
1170 test_ret += test_xmlstring();
1171 test_ret += test_xmlunicode();
1172 test_ret += test_xmlwriter();
1173 test_ret += test_xpath();
Daniel Veillarda82b1822004-11-08 16:24:57 +00001174 test_ret += test_xpathInternals();
Daniel Veillard42595322004-11-08 10:52:06 +00001175 test_ret += test_xpointer();
Daniel Veillardd93f6252004-11-02 15:53:51 +00001176
Daniel Veillard3d97e662004-11-04 10:49:00 +00001177 printf("Total: %d functions, %d tests, %d errors\n",
Daniel Veillard42595322004-11-08 10:52:06 +00001178 function_tests, call_tests, test_ret);
1179 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001180}
1181
1182
1183static int
1184test_UTF8ToHtml(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001185 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001186
William M. Brack21e4ef22005-01-02 09:53:13 +00001187#if defined(LIBXML_HTML_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00001188 int mem_base;
1189 int ret_val;
1190 unsigned char * out; /* a pointer to an array of bytes to store the result */
1191 int n_out;
1192 int * outlen; /* the length of @out */
1193 int n_outlen;
1194 unsigned char * in; /* a pointer to an array of UTF-8 chars */
1195 int n_in;
1196 int * inlen; /* the length of @in */
1197 int n_inlen;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001198
Daniel Veillardce682bc2004-11-05 17:22:25 +00001199 for (n_out = 0;n_out < gen_nb_unsigned_char_ptr;n_out++) {
1200 for (n_outlen = 0;n_outlen < gen_nb_int_ptr;n_outlen++) {
1201 for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) {
1202 for (n_inlen = 0;n_inlen < gen_nb_int_ptr;n_inlen++) {
1203 mem_base = xmlMemBlocks();
1204 out = gen_unsigned_char_ptr(n_out, 0);
1205 outlen = gen_int_ptr(n_outlen, 1);
1206 in = gen_const_unsigned_char_ptr(n_in, 2);
1207 inlen = gen_int_ptr(n_inlen, 3);
1208
William M. Brackf13f77f2004-11-12 16:03:48 +00001209 ret_val = UTF8ToHtml(out, outlen, (const unsigned char *)in, inlen);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001210 desret_int(ret_val);
1211 call_tests++;
1212 des_unsigned_char_ptr(n_out, out, 0);
1213 des_int_ptr(n_outlen, outlen, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00001214 des_const_unsigned_char_ptr(n_in, (const unsigned char *)in, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001215 des_int_ptr(n_inlen, inlen, 3);
1216 xmlResetLastError();
1217 if (mem_base != xmlMemBlocks()) {
1218 printf("Leak of %d blocks found in UTF8ToHtml",
1219 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001220 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001221 printf(" %d", n_out);
1222 printf(" %d", n_outlen);
1223 printf(" %d", n_in);
1224 printf(" %d", n_inlen);
1225 printf("\n");
1226 }
1227 }
1228 }
1229 }
1230 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001231 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001232#endif
1233
Daniel Veillard42595322004-11-08 10:52:06 +00001234 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001235}
1236
Daniel Veillarda521d282004-11-09 14:59:59 +00001237#ifdef LIBXML_HTML_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +00001238
Daniel Veillardce682bc2004-11-05 17:22:25 +00001239#define gen_nb_const_htmlElemDesc_ptr 1
1240static htmlElemDesc * gen_const_htmlElemDesc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1241 return(NULL);
1242}
1243static void des_const_htmlElemDesc_ptr(int no ATTRIBUTE_UNUSED, const htmlElemDesc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1244}
Daniel Veillarda521d282004-11-09 14:59:59 +00001245#endif
1246
Daniel Veillardce682bc2004-11-05 17:22:25 +00001247
Daniel Veillardd93f6252004-11-02 15:53:51 +00001248static int
1249test_htmlAttrAllowed(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001250 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001251
William M. Brack21e4ef22005-01-02 09:53:13 +00001252#if defined(LIBXML_HTML_ENABLED)
Daniel Veillard57b25162004-11-06 14:50:18 +00001253 int mem_base;
1254 htmlStatus ret_val;
1255 htmlElemDesc * elt; /* HTML element */
1256 int n_elt;
1257 xmlChar * attr; /* HTML attribute */
1258 int n_attr;
1259 int legacy; /* whether to allow deprecated attributes */
1260 int n_legacy;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001261
Daniel Veillard57b25162004-11-06 14:50:18 +00001262 for (n_elt = 0;n_elt < gen_nb_const_htmlElemDesc_ptr;n_elt++) {
1263 for (n_attr = 0;n_attr < gen_nb_const_xmlChar_ptr;n_attr++) {
1264 for (n_legacy = 0;n_legacy < gen_nb_int;n_legacy++) {
1265 mem_base = xmlMemBlocks();
1266 elt = gen_const_htmlElemDesc_ptr(n_elt, 0);
1267 attr = gen_const_xmlChar_ptr(n_attr, 1);
1268 legacy = gen_int(n_legacy, 2);
1269
William M. Brackf13f77f2004-11-12 16:03:48 +00001270 ret_val = htmlAttrAllowed((const htmlElemDesc *)elt, (const xmlChar *)attr, legacy);
Daniel Veillard57b25162004-11-06 14:50:18 +00001271 desret_htmlStatus(ret_val);
1272 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00001273 des_const_htmlElemDesc_ptr(n_elt, (const htmlElemDesc *)elt, 0);
1274 des_const_xmlChar_ptr(n_attr, (const xmlChar *)attr, 1);
Daniel Veillard57b25162004-11-06 14:50:18 +00001275 des_int(n_legacy, legacy, 2);
1276 xmlResetLastError();
1277 if (mem_base != xmlMemBlocks()) {
1278 printf("Leak of %d blocks found in htmlAttrAllowed",
1279 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001280 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +00001281 printf(" %d", n_elt);
1282 printf(" %d", n_attr);
1283 printf(" %d", n_legacy);
1284 printf("\n");
1285 }
1286 }
1287 }
1288 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001289 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +00001290#endif
1291
Daniel Veillard42595322004-11-08 10:52:06 +00001292 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001293}
1294
Daniel Veillarda521d282004-11-09 14:59:59 +00001295#ifdef LIBXML_HTML_ENABLED
1296
1297#define gen_nb_htmlNodePtr 1
1298static htmlNodePtr gen_htmlNodePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1299 return(NULL);
1300}
1301static void des_htmlNodePtr(int no ATTRIBUTE_UNUSED, htmlNodePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1302}
1303#endif
1304
Daniel Veillardd93f6252004-11-02 15:53:51 +00001305
1306static int
1307test_htmlAutoCloseTag(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001308 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001309
William M. Brack21e4ef22005-01-02 09:53:13 +00001310#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00001311 int mem_base;
1312 int ret_val;
1313 htmlDocPtr doc; /* the HTML document */
1314 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001315 xmlChar * name; /* The tag name */
Daniel Veillarda03e3652004-11-02 18:45:30 +00001316 int n_name;
1317 htmlNodePtr elem; /* the HTML element */
1318 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001319
Daniel Veillarda521d282004-11-09 14:59:59 +00001320 for (n_doc = 0;n_doc < gen_nb_htmlDocPtr;n_doc++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00001321 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
Daniel Veillarda521d282004-11-09 14:59:59 +00001322 for (n_elem = 0;n_elem < gen_nb_htmlNodePtr;n_elem++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00001323 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00001324 doc = gen_htmlDocPtr(n_doc, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001325 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarda521d282004-11-09 14:59:59 +00001326 elem = gen_htmlNodePtr(n_elem, 2);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001327
William M. Brackf13f77f2004-11-12 16:03:48 +00001328 ret_val = htmlAutoCloseTag(doc, (const xmlChar *)name, elem);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001329 desret_int(ret_val);
1330 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00001331 des_htmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00001332 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarda521d282004-11-09 14:59:59 +00001333 des_htmlNodePtr(n_elem, elem, 2);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001334 xmlResetLastError();
1335 if (mem_base != xmlMemBlocks()) {
1336 printf("Leak of %d blocks found in htmlAutoCloseTag",
1337 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001338 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001339 printf(" %d", n_doc);
1340 printf(" %d", n_name);
1341 printf(" %d", n_elem);
1342 printf("\n");
1343 }
1344 }
1345 }
1346 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001347 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001348#endif
1349
Daniel Veillard42595322004-11-08 10:52:06 +00001350 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001351}
1352
1353
1354static int
1355test_htmlCreateMemoryParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001356 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001357
William M. Brack21e4ef22005-01-02 09:53:13 +00001358#if defined(LIBXML_HTML_ENABLED)
Daniel Veillard34099b42004-11-04 17:34:35 +00001359 int mem_base;
1360 htmlParserCtxtPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001361 char * buffer; /* a pointer to a char array */
Daniel Veillard34099b42004-11-04 17:34:35 +00001362 int n_buffer;
1363 int size; /* the size of the array */
1364 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001365
Daniel Veillard34099b42004-11-04 17:34:35 +00001366 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
1367 for (n_size = 0;n_size < gen_nb_int;n_size++) {
1368 mem_base = xmlMemBlocks();
1369 buffer = gen_const_char_ptr(n_buffer, 0);
1370 size = gen_int(n_size, 1);
1371
William M. Brackf13f77f2004-11-12 16:03:48 +00001372 ret_val = htmlCreateMemoryParserCtxt((const char *)buffer, size);
Daniel Veillarda521d282004-11-09 14:59:59 +00001373 desret_htmlParserCtxtPtr(ret_val);
Daniel Veillard34099b42004-11-04 17:34:35 +00001374 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00001375 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard34099b42004-11-04 17:34:35 +00001376 des_int(n_size, size, 1);
1377 xmlResetLastError();
1378 if (mem_base != xmlMemBlocks()) {
1379 printf("Leak of %d blocks found in htmlCreateMemoryParserCtxt",
1380 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001381 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +00001382 printf(" %d", n_buffer);
1383 printf(" %d", n_size);
1384 printf("\n");
1385 }
1386 }
1387 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001388 function_tests++;
Daniel Veillard34099b42004-11-04 17:34:35 +00001389#endif
1390
Daniel Veillard42595322004-11-08 10:52:06 +00001391 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001392}
1393
Daniel Veillarda521d282004-11-09 14:59:59 +00001394#ifdef LIBXML_HTML_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +00001395
Daniel Veillardce682bc2004-11-05 17:22:25 +00001396#define gen_nb_htmlSAXHandlerPtr 1
1397static htmlSAXHandlerPtr gen_htmlSAXHandlerPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1398 return(NULL);
1399}
1400static void des_htmlSAXHandlerPtr(int no ATTRIBUTE_UNUSED, htmlSAXHandlerPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1401}
Daniel Veillarda521d282004-11-09 14:59:59 +00001402#endif
1403
Daniel Veillardce682bc2004-11-05 17:22:25 +00001404
Daniel Veillardd93f6252004-11-02 15:53:51 +00001405static int
1406test_htmlCreatePushParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001407 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001408
William M. Brack21e4ef22005-01-02 09:53:13 +00001409#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_PUSH_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00001410 int mem_base;
1411 htmlParserCtxtPtr ret_val;
1412 htmlSAXHandlerPtr sax; /* a SAX handler */
1413 int n_sax;
1414 void * user_data; /* The user data returned on SAX callbacks */
1415 int n_user_data;
1416 char * chunk; /* a pointer to an array of chars */
1417 int n_chunk;
1418 int size; /* number of chars in the array */
1419 int n_size;
1420 const char * filename; /* an optional file name or URI */
1421 int n_filename;
1422 xmlCharEncoding enc; /* an optional encoding */
1423 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001424
Daniel Veillardce682bc2004-11-05 17:22:25 +00001425 for (n_sax = 0;n_sax < gen_nb_htmlSAXHandlerPtr;n_sax++) {
1426 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
1427 for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) {
1428 for (n_size = 0;n_size < gen_nb_int;n_size++) {
Daniel Veillard42595322004-11-08 10:52:06 +00001429 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
Daniel Veillardce682bc2004-11-05 17:22:25 +00001430 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
1431 mem_base = xmlMemBlocks();
1432 sax = gen_htmlSAXHandlerPtr(n_sax, 0);
1433 user_data = gen_userdata(n_user_data, 1);
1434 chunk = gen_const_char_ptr(n_chunk, 2);
1435 size = gen_int(n_size, 3);
Daniel Veillard42595322004-11-08 10:52:06 +00001436 filename = gen_fileoutput(n_filename, 4);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001437 enc = gen_xmlCharEncoding(n_enc, 5);
1438
William M. Brackf13f77f2004-11-12 16:03:48 +00001439 ret_val = htmlCreatePushParserCtxt(sax, user_data, (const char *)chunk, size, filename, enc);
Daniel Veillarda521d282004-11-09 14:59:59 +00001440 desret_htmlParserCtxtPtr(ret_val);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001441 call_tests++;
1442 des_htmlSAXHandlerPtr(n_sax, sax, 0);
1443 des_userdata(n_user_data, user_data, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00001444 des_const_char_ptr(n_chunk, (const char *)chunk, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001445 des_int(n_size, size, 3);
Daniel Veillard42595322004-11-08 10:52:06 +00001446 des_fileoutput(n_filename, filename, 4);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001447 des_xmlCharEncoding(n_enc, enc, 5);
1448 xmlResetLastError();
1449 if (mem_base != xmlMemBlocks()) {
1450 printf("Leak of %d blocks found in htmlCreatePushParserCtxt",
1451 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001452 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001453 printf(" %d", n_sax);
1454 printf(" %d", n_user_data);
1455 printf(" %d", n_chunk);
1456 printf(" %d", n_size);
1457 printf(" %d", n_filename);
1458 printf(" %d", n_enc);
1459 printf("\n");
1460 }
1461 }
1462 }
1463 }
1464 }
1465 }
1466 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001467 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001468#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +00001469
Daniel Veillard42595322004-11-08 10:52:06 +00001470 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001471}
1472
1473
1474static int
1475test_htmlCtxtReadDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001476 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001477
William M. Brack21e4ef22005-01-02 09:53:13 +00001478#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00001479 int mem_base;
1480 htmlDocPtr ret_val;
1481 htmlParserCtxtPtr ctxt; /* an HTML parser context */
1482 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001483 xmlChar * cur; /* a pointer to a zero terminated string */
Daniel Veillarda03e3652004-11-02 18:45:30 +00001484 int n_cur;
1485 const char * URL; /* the base URL to use for the document */
1486 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001487 char * encoding; /* the document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00001488 int n_encoding;
1489 int options; /* a combination of htmlParserOption(s) */
1490 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001491
Daniel Veillarda521d282004-11-09 14:59:59 +00001492 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00001493 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
1494 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
1495 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
1496 for (n_options = 0;n_options < gen_nb_int;n_options++) {
1497 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00001498 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001499 cur = gen_const_xmlChar_ptr(n_cur, 1);
1500 URL = gen_filepath(n_URL, 2);
1501 encoding = gen_const_char_ptr(n_encoding, 3);
1502 options = gen_int(n_options, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001503
William M. Brackf13f77f2004-11-12 16:03:48 +00001504 ret_val = htmlCtxtReadDoc(ctxt, (const xmlChar *)cur, URL, (const char *)encoding, options);
Daniel Veillarda521d282004-11-09 14:59:59 +00001505 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001506 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00001507 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00001508 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001509 des_filepath(n_URL, URL, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +00001510 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001511 des_int(n_options, options, 4);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001512 xmlResetLastError();
1513 if (mem_base != xmlMemBlocks()) {
1514 printf("Leak of %d blocks found in htmlCtxtReadDoc",
1515 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001516 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001517 printf(" %d", n_ctxt);
1518 printf(" %d", n_cur);
1519 printf(" %d", n_URL);
1520 printf(" %d", n_encoding);
1521 printf(" %d", n_options);
1522 printf("\n");
1523 }
1524 }
1525 }
1526 }
1527 }
1528 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001529 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001530#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +00001531
Daniel Veillard42595322004-11-08 10:52:06 +00001532 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001533}
1534
1535
1536static int
1537test_htmlCtxtReadFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001538 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001539
William M. Brack21e4ef22005-01-02 09:53:13 +00001540#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00001541 htmlDocPtr ret_val;
1542 htmlParserCtxtPtr ctxt; /* an HTML parser context */
1543 int n_ctxt;
1544 const char * filename; /* a file or URL */
1545 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001546 char * encoding; /* the document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00001547 int n_encoding;
1548 int options; /* a combination of htmlParserOption(s) */
1549 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001550
Daniel Veillarda521d282004-11-09 14:59:59 +00001551 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00001552 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
1553 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
1554 for (n_options = 0;n_options < gen_nb_int;n_options++) {
Daniel Veillarda521d282004-11-09 14:59:59 +00001555 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001556 filename = gen_filepath(n_filename, 1);
1557 encoding = gen_const_char_ptr(n_encoding, 2);
1558 options = gen_int(n_options, 3);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001559
William M. Brackf13f77f2004-11-12 16:03:48 +00001560 ret_val = htmlCtxtReadFile(ctxt, filename, (const char *)encoding, options);
Daniel Veillarda521d282004-11-09 14:59:59 +00001561 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001562 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00001563 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001564 des_filepath(n_filename, filename, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00001565 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001566 des_int(n_options, options, 3);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001567 xmlResetLastError();
Daniel Veillarda03e3652004-11-02 18:45:30 +00001568 }
1569 }
1570 }
1571 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001572 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001573#endif
1574
Daniel Veillard42595322004-11-08 10:52:06 +00001575 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001576}
1577
1578
1579static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00001580test_htmlCtxtReadMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001581 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001582
William M. Brack21e4ef22005-01-02 09:53:13 +00001583#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00001584 int mem_base;
1585 htmlDocPtr ret_val;
1586 htmlParserCtxtPtr ctxt; /* an HTML parser context */
1587 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001588 char * buffer; /* a pointer to a char array */
Daniel Veillarda03e3652004-11-02 18:45:30 +00001589 int n_buffer;
1590 int size; /* the size of the array */
1591 int n_size;
1592 const char * URL; /* the base URL to use for the document */
1593 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001594 char * encoding; /* the document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00001595 int n_encoding;
1596 int options; /* a combination of htmlParserOption(s) */
1597 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001598
Daniel Veillarda521d282004-11-09 14:59:59 +00001599 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00001600 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
1601 for (n_size = 0;n_size < gen_nb_int;n_size++) {
1602 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
1603 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
1604 for (n_options = 0;n_options < gen_nb_int;n_options++) {
1605 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00001606 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001607 buffer = gen_const_char_ptr(n_buffer, 1);
1608 size = gen_int(n_size, 2);
1609 URL = gen_filepath(n_URL, 3);
1610 encoding = gen_const_char_ptr(n_encoding, 4);
1611 options = gen_int(n_options, 5);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001612
William M. Brackf13f77f2004-11-12 16:03:48 +00001613 ret_val = htmlCtxtReadMemory(ctxt, (const char *)buffer, size, URL, (const char *)encoding, options);
Daniel Veillarda521d282004-11-09 14:59:59 +00001614 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001615 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00001616 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00001617 des_const_char_ptr(n_buffer, (const char *)buffer, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001618 des_int(n_size, size, 2);
1619 des_filepath(n_URL, URL, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +00001620 des_const_char_ptr(n_encoding, (const char *)encoding, 4);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001621 des_int(n_options, options, 5);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001622 xmlResetLastError();
1623 if (mem_base != xmlMemBlocks()) {
1624 printf("Leak of %d blocks found in htmlCtxtReadMemory",
1625 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001626 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001627 printf(" %d", n_ctxt);
1628 printf(" %d", n_buffer);
1629 printf(" %d", n_size);
1630 printf(" %d", n_URL);
1631 printf(" %d", n_encoding);
1632 printf(" %d", n_options);
1633 printf("\n");
1634 }
1635 }
1636 }
1637 }
1638 }
1639 }
1640 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001641 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001642#endif
1643
Daniel Veillard42595322004-11-08 10:52:06 +00001644 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001645}
1646
1647
1648static int
1649test_htmlCtxtReset(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001650 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001651
William M. Brack21e4ef22005-01-02 09:53:13 +00001652#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00001653 int mem_base;
1654 htmlParserCtxtPtr ctxt; /* an HTML parser context */
1655 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001656
Daniel Veillarda521d282004-11-09 14:59:59 +00001657 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00001658 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00001659 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001660
1661 htmlCtxtReset(ctxt);
1662 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00001663 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001664 xmlResetLastError();
1665 if (mem_base != xmlMemBlocks()) {
1666 printf("Leak of %d blocks found in htmlCtxtReset",
1667 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001668 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001669 printf(" %d", n_ctxt);
1670 printf("\n");
1671 }
1672 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001673 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001674#endif
1675
Daniel Veillard42595322004-11-08 10:52:06 +00001676 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001677}
1678
1679
1680static int
1681test_htmlCtxtUseOptions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001682 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001683
William M. Brack21e4ef22005-01-02 09:53:13 +00001684#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00001685 int mem_base;
1686 int ret_val;
1687 htmlParserCtxtPtr ctxt; /* an HTML parser context */
1688 int n_ctxt;
1689 int options; /* a combination of htmlParserOption(s) */
1690 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001691
Daniel Veillarda521d282004-11-09 14:59:59 +00001692 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00001693 for (n_options = 0;n_options < gen_nb_int;n_options++) {
1694 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00001695 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001696 options = gen_int(n_options, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001697
1698 ret_val = htmlCtxtUseOptions(ctxt, options);
1699 desret_int(ret_val);
1700 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00001701 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001702 des_int(n_options, options, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001703 xmlResetLastError();
1704 if (mem_base != xmlMemBlocks()) {
1705 printf("Leak of %d blocks found in htmlCtxtUseOptions",
1706 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001707 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001708 printf(" %d", n_ctxt);
1709 printf(" %d", n_options);
1710 printf("\n");
1711 }
1712 }
1713 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001714 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001715#endif
1716
Daniel Veillard42595322004-11-08 10:52:06 +00001717 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001718}
1719
1720
1721static int
1722test_htmlElementAllowedHere(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001723 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001724
William M. Brack21e4ef22005-01-02 09:53:13 +00001725#if defined(LIBXML_HTML_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00001726 int mem_base;
1727 int ret_val;
1728 htmlElemDesc * parent; /* HTML parent element */
1729 int n_parent;
1730 xmlChar * elt; /* HTML element */
1731 int n_elt;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001732
Daniel Veillardce682bc2004-11-05 17:22:25 +00001733 for (n_parent = 0;n_parent < gen_nb_const_htmlElemDesc_ptr;n_parent++) {
1734 for (n_elt = 0;n_elt < gen_nb_const_xmlChar_ptr;n_elt++) {
1735 mem_base = xmlMemBlocks();
1736 parent = gen_const_htmlElemDesc_ptr(n_parent, 0);
1737 elt = gen_const_xmlChar_ptr(n_elt, 1);
1738
William M. Brackf13f77f2004-11-12 16:03:48 +00001739 ret_val = htmlElementAllowedHere((const htmlElemDesc *)parent, (const xmlChar *)elt);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001740 desret_int(ret_val);
1741 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00001742 des_const_htmlElemDesc_ptr(n_parent, (const htmlElemDesc *)parent, 0);
1743 des_const_xmlChar_ptr(n_elt, (const xmlChar *)elt, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001744 xmlResetLastError();
1745 if (mem_base != xmlMemBlocks()) {
1746 printf("Leak of %d blocks found in htmlElementAllowedHere",
1747 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001748 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001749 printf(" %d", n_parent);
1750 printf(" %d", n_elt);
1751 printf("\n");
1752 }
1753 }
1754 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001755 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001756#endif
1757
Daniel Veillard42595322004-11-08 10:52:06 +00001758 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001759}
1760
1761
1762static int
1763test_htmlElementStatusHere(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001764 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001765
William M. Brack21e4ef22005-01-02 09:53:13 +00001766#if defined(LIBXML_HTML_ENABLED)
Daniel Veillard57b25162004-11-06 14:50:18 +00001767 int mem_base;
1768 htmlStatus ret_val;
1769 htmlElemDesc * parent; /* HTML parent element */
1770 int n_parent;
1771 htmlElemDesc * elt; /* HTML element */
1772 int n_elt;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001773
Daniel Veillard57b25162004-11-06 14:50:18 +00001774 for (n_parent = 0;n_parent < gen_nb_const_htmlElemDesc_ptr;n_parent++) {
1775 for (n_elt = 0;n_elt < gen_nb_const_htmlElemDesc_ptr;n_elt++) {
1776 mem_base = xmlMemBlocks();
1777 parent = gen_const_htmlElemDesc_ptr(n_parent, 0);
1778 elt = gen_const_htmlElemDesc_ptr(n_elt, 1);
1779
William M. Brackf13f77f2004-11-12 16:03:48 +00001780 ret_val = htmlElementStatusHere((const htmlElemDesc *)parent, (const htmlElemDesc *)elt);
Daniel Veillard57b25162004-11-06 14:50:18 +00001781 desret_htmlStatus(ret_val);
1782 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00001783 des_const_htmlElemDesc_ptr(n_parent, (const htmlElemDesc *)parent, 0);
1784 des_const_htmlElemDesc_ptr(n_elt, (const htmlElemDesc *)elt, 1);
Daniel Veillard57b25162004-11-06 14:50:18 +00001785 xmlResetLastError();
1786 if (mem_base != xmlMemBlocks()) {
1787 printf("Leak of %d blocks found in htmlElementStatusHere",
1788 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001789 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +00001790 printf(" %d", n_parent);
1791 printf(" %d", n_elt);
1792 printf("\n");
1793 }
1794 }
1795 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001796 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +00001797#endif
1798
Daniel Veillard42595322004-11-08 10:52:06 +00001799 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001800}
1801
1802
1803static int
1804test_htmlEncodeEntities(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001805 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001806
William M. Brack21e4ef22005-01-02 09:53:13 +00001807#if defined(LIBXML_HTML_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00001808 int mem_base;
1809 int ret_val;
1810 unsigned char * out; /* a pointer to an array of bytes to store the result */
1811 int n_out;
1812 int * outlen; /* the length of @out */
1813 int n_outlen;
1814 unsigned char * in; /* a pointer to an array of UTF-8 chars */
1815 int n_in;
1816 int * inlen; /* the length of @in */
1817 int n_inlen;
1818 int quoteChar; /* the quote character to escape (' or ") or zero. */
1819 int n_quoteChar;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001820
Daniel Veillardce682bc2004-11-05 17:22:25 +00001821 for (n_out = 0;n_out < gen_nb_unsigned_char_ptr;n_out++) {
1822 for (n_outlen = 0;n_outlen < gen_nb_int_ptr;n_outlen++) {
1823 for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) {
1824 for (n_inlen = 0;n_inlen < gen_nb_int_ptr;n_inlen++) {
1825 for (n_quoteChar = 0;n_quoteChar < gen_nb_int;n_quoteChar++) {
1826 mem_base = xmlMemBlocks();
1827 out = gen_unsigned_char_ptr(n_out, 0);
1828 outlen = gen_int_ptr(n_outlen, 1);
1829 in = gen_const_unsigned_char_ptr(n_in, 2);
1830 inlen = gen_int_ptr(n_inlen, 3);
1831 quoteChar = gen_int(n_quoteChar, 4);
1832
William M. Brackf13f77f2004-11-12 16:03:48 +00001833 ret_val = htmlEncodeEntities(out, outlen, (const unsigned char *)in, inlen, quoteChar);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001834 desret_int(ret_val);
1835 call_tests++;
1836 des_unsigned_char_ptr(n_out, out, 0);
1837 des_int_ptr(n_outlen, outlen, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00001838 des_const_unsigned_char_ptr(n_in, (const unsigned char *)in, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001839 des_int_ptr(n_inlen, inlen, 3);
1840 des_int(n_quoteChar, quoteChar, 4);
1841 xmlResetLastError();
1842 if (mem_base != xmlMemBlocks()) {
1843 printf("Leak of %d blocks found in htmlEncodeEntities",
1844 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001845 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001846 printf(" %d", n_out);
1847 printf(" %d", n_outlen);
1848 printf(" %d", n_in);
1849 printf(" %d", n_inlen);
1850 printf(" %d", n_quoteChar);
1851 printf("\n");
1852 }
1853 }
1854 }
1855 }
1856 }
1857 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001858 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001859#endif
1860
Daniel Veillard42595322004-11-08 10:52:06 +00001861 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001862}
1863
1864
1865static int
1866test_htmlEntityLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001867 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001868
William M. Brack21e4ef22005-01-02 09:53:13 +00001869#if defined(LIBXML_HTML_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +00001870 int mem_base;
1871 const htmlEntityDesc * ret_val;
1872 xmlChar * name; /* the entity name */
1873 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001874
Daniel Veillard42595322004-11-08 10:52:06 +00001875 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
1876 mem_base = xmlMemBlocks();
1877 name = gen_const_xmlChar_ptr(n_name, 0);
1878
William M. Brackf13f77f2004-11-12 16:03:48 +00001879 ret_val = htmlEntityLookup((const xmlChar *)name);
Daniel Veillard42595322004-11-08 10:52:06 +00001880 desret_const_htmlEntityDesc_ptr(ret_val);
1881 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00001882 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
Daniel Veillard42595322004-11-08 10:52:06 +00001883 xmlResetLastError();
1884 if (mem_base != xmlMemBlocks()) {
1885 printf("Leak of %d blocks found in htmlEntityLookup",
1886 xmlMemBlocks() - mem_base);
1887 test_ret++;
1888 printf(" %d", n_name);
1889 printf("\n");
1890 }
1891 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001892 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00001893#endif
1894
Daniel Veillard42595322004-11-08 10:52:06 +00001895 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001896}
1897
1898
1899static int
1900test_htmlEntityValueLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001901 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001902
William M. Brack21e4ef22005-01-02 09:53:13 +00001903#if defined(LIBXML_HTML_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +00001904 int mem_base;
1905 const htmlEntityDesc * ret_val;
1906 unsigned int value; /* the entity's unicode value */
1907 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001908
Daniel Veillard42595322004-11-08 10:52:06 +00001909 for (n_value = 0;n_value < gen_nb_unsigned_int;n_value++) {
1910 mem_base = xmlMemBlocks();
1911 value = gen_unsigned_int(n_value, 0);
1912
1913 ret_val = htmlEntityValueLookup(value);
1914 desret_const_htmlEntityDesc_ptr(ret_val);
1915 call_tests++;
1916 des_unsigned_int(n_value, value, 0);
1917 xmlResetLastError();
1918 if (mem_base != xmlMemBlocks()) {
1919 printf("Leak of %d blocks found in htmlEntityValueLookup",
1920 xmlMemBlocks() - mem_base);
1921 test_ret++;
1922 printf(" %d", n_value);
1923 printf("\n");
1924 }
1925 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001926 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00001927#endif
1928
Daniel Veillard42595322004-11-08 10:52:06 +00001929 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001930}
1931
1932
1933static int
1934test_htmlHandleOmittedElem(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001935 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001936
William M. Brack21e4ef22005-01-02 09:53:13 +00001937#if defined(LIBXML_HTML_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00001938 int mem_base;
1939 int ret_val;
1940 int val; /* int 0 or 1 */
1941 int n_val;
1942
1943 for (n_val = 0;n_val < gen_nb_int;n_val++) {
1944 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00001945 val = gen_int(n_val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001946
1947 ret_val = htmlHandleOmittedElem(val);
1948 desret_int(ret_val);
1949 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00001950 des_int(n_val, val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001951 xmlResetLastError();
1952 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00001953 printf("Leak of %d blocks found in htmlHandleOmittedElem",
Daniel Veillardd93f6252004-11-02 15:53:51 +00001954 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001955 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001956 printf(" %d", n_val);
1957 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00001958 }
1959 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001960 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001961#endif
1962
Daniel Veillard42595322004-11-08 10:52:06 +00001963 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001964}
1965
1966
1967static int
1968test_htmlIsAutoClosed(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001969 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001970
William M. Brack21e4ef22005-01-02 09:53:13 +00001971#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00001972 int mem_base;
1973 int ret_val;
1974 htmlDocPtr doc; /* the HTML document */
1975 int n_doc;
1976 htmlNodePtr elem; /* the HTML element */
1977 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001978
Daniel Veillarda521d282004-11-09 14:59:59 +00001979 for (n_doc = 0;n_doc < gen_nb_htmlDocPtr;n_doc++) {
1980 for (n_elem = 0;n_elem < gen_nb_htmlNodePtr;n_elem++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00001981 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00001982 doc = gen_htmlDocPtr(n_doc, 0);
1983 elem = gen_htmlNodePtr(n_elem, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001984
1985 ret_val = htmlIsAutoClosed(doc, elem);
1986 desret_int(ret_val);
1987 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00001988 des_htmlDocPtr(n_doc, doc, 0);
1989 des_htmlNodePtr(n_elem, elem, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001990 xmlResetLastError();
1991 if (mem_base != xmlMemBlocks()) {
1992 printf("Leak of %d blocks found in htmlIsAutoClosed",
1993 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001994 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001995 printf(" %d", n_doc);
1996 printf(" %d", n_elem);
1997 printf("\n");
1998 }
1999 }
2000 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002001 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002002#endif
2003
Daniel Veillard42595322004-11-08 10:52:06 +00002004 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002005}
2006
2007
2008static int
2009test_htmlIsScriptAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002010 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002011
William M. Brack21e4ef22005-01-02 09:53:13 +00002012#if defined(LIBXML_HTML_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00002013 int mem_base;
2014 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002015 xmlChar * name; /* an attribute name */
Daniel Veillardd93f6252004-11-02 15:53:51 +00002016 int n_name;
2017
2018 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
2019 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002020 name = gen_const_xmlChar_ptr(n_name, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002021
William M. Brackf13f77f2004-11-12 16:03:48 +00002022 ret_val = htmlIsScriptAttribute((const xmlChar *)name);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002023 desret_int(ret_val);
2024 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00002025 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002026 xmlResetLastError();
2027 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00002028 printf("Leak of %d blocks found in htmlIsScriptAttribute",
Daniel Veillardd93f6252004-11-02 15:53:51 +00002029 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002030 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002031 printf(" %d", n_name);
2032 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00002033 }
2034 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002035 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002036#endif
2037
Daniel Veillard42595322004-11-08 10:52:06 +00002038 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002039}
2040
2041
2042static int
2043test_htmlNodeStatus(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002044 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002045
William M. Brack21e4ef22005-01-02 09:53:13 +00002046#if defined(LIBXML_HTML_ENABLED)
Daniel Veillard57b25162004-11-06 14:50:18 +00002047 int mem_base;
2048 htmlStatus ret_val;
2049 htmlNodePtr node; /* an htmlNodePtr in a tree */
2050 int n_node;
2051 int legacy; /* whether to allow deprecated elements (YES is faster here for Element nodes) */
2052 int n_legacy;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002053
Daniel Veillarda521d282004-11-09 14:59:59 +00002054 for (n_node = 0;n_node < gen_nb_const_htmlNodePtr;n_node++) {
Daniel Veillard57b25162004-11-06 14:50:18 +00002055 for (n_legacy = 0;n_legacy < gen_nb_int;n_legacy++) {
2056 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00002057 node = gen_const_htmlNodePtr(n_node, 0);
Daniel Veillard57b25162004-11-06 14:50:18 +00002058 legacy = gen_int(n_legacy, 1);
2059
William M. Brackf13f77f2004-11-12 16:03:48 +00002060 ret_val = htmlNodeStatus((const htmlNodePtr)node, legacy);
Daniel Veillard57b25162004-11-06 14:50:18 +00002061 desret_htmlStatus(ret_val);
2062 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00002063 des_const_htmlNodePtr(n_node, (const htmlNodePtr)node, 0);
Daniel Veillard57b25162004-11-06 14:50:18 +00002064 des_int(n_legacy, legacy, 1);
2065 xmlResetLastError();
2066 if (mem_base != xmlMemBlocks()) {
2067 printf("Leak of %d blocks found in htmlNodeStatus",
2068 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002069 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +00002070 printf(" %d", n_node);
2071 printf(" %d", n_legacy);
2072 printf("\n");
2073 }
2074 }
2075 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002076 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +00002077#endif
2078
Daniel Veillard42595322004-11-08 10:52:06 +00002079 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002080}
2081
2082
2083static int
2084test_htmlParseCharRef(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002085 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002086
William M. Brack21e4ef22005-01-02 09:53:13 +00002087#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00002088 int mem_base;
2089 int ret_val;
2090 htmlParserCtxtPtr ctxt; /* an HTML parser context */
2091 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002092
Daniel Veillarda521d282004-11-09 14:59:59 +00002093 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00002094 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00002095 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002096
2097 ret_val = htmlParseCharRef(ctxt);
2098 desret_int(ret_val);
2099 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00002100 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002101 xmlResetLastError();
2102 if (mem_base != xmlMemBlocks()) {
2103 printf("Leak of %d blocks found in htmlParseCharRef",
2104 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002105 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002106 printf(" %d", n_ctxt);
2107 printf("\n");
2108 }
2109 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002110 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002111#endif
2112
Daniel Veillard42595322004-11-08 10:52:06 +00002113 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002114}
2115
2116
2117static int
2118test_htmlParseChunk(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002119 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002120
William M. Brack21e4ef22005-01-02 09:53:13 +00002121#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_PUSH_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00002122 int mem_base;
2123 int ret_val;
2124 htmlParserCtxtPtr ctxt; /* an HTML parser context */
2125 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002126 char * chunk; /* an char array */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002127 int n_chunk;
2128 int size; /* the size in byte of the chunk */
2129 int n_size;
2130 int terminate; /* last chunk indicator */
2131 int n_terminate;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002132
Daniel Veillarda521d282004-11-09 14:59:59 +00002133 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00002134 for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) {
2135 for (n_size = 0;n_size < gen_nb_int;n_size++) {
2136 for (n_terminate = 0;n_terminate < gen_nb_int;n_terminate++) {
2137 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00002138 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002139 chunk = gen_const_char_ptr(n_chunk, 1);
2140 size = gen_int(n_size, 2);
2141 terminate = gen_int(n_terminate, 3);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002142
William M. Brackf13f77f2004-11-12 16:03:48 +00002143 ret_val = htmlParseChunk(ctxt, (const char *)chunk, size, terminate);
Daniel Veillarda521d282004-11-09 14:59:59 +00002144 if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;}
Daniel Veillarda03e3652004-11-02 18:45:30 +00002145 desret_int(ret_val);
2146 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00002147 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00002148 des_const_char_ptr(n_chunk, (const char *)chunk, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002149 des_int(n_size, size, 2);
2150 des_int(n_terminate, terminate, 3);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002151 xmlResetLastError();
2152 if (mem_base != xmlMemBlocks()) {
2153 printf("Leak of %d blocks found in htmlParseChunk",
2154 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002155 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002156 printf(" %d", n_ctxt);
2157 printf(" %d", n_chunk);
2158 printf(" %d", n_size);
2159 printf(" %d", n_terminate);
2160 printf("\n");
2161 }
2162 }
2163 }
2164 }
2165 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002166 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002167#endif
Daniel Veillarda03e3652004-11-02 18:45:30 +00002168
Daniel Veillard42595322004-11-08 10:52:06 +00002169 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002170}
2171
2172
2173static int
2174test_htmlParseDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002175 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002176
William M. Brack21e4ef22005-01-02 09:53:13 +00002177#if defined(LIBXML_HTML_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002178 int mem_base;
2179 htmlDocPtr ret_val;
2180 xmlChar * cur; /* a pointer to an array of xmlChar */
2181 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002182 char * encoding; /* a free form C string describing the HTML document encoding, or NULL */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002183 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002184
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002185 for (n_cur = 0;n_cur < gen_nb_xmlChar_ptr;n_cur++) {
2186 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2187 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002188 cur = gen_xmlChar_ptr(n_cur, 0);
2189 encoding = gen_const_char_ptr(n_encoding, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002190
William M. Brackf13f77f2004-11-12 16:03:48 +00002191 ret_val = htmlParseDoc(cur, (const char *)encoding);
Daniel Veillarda521d282004-11-09 14:59:59 +00002192 desret_htmlDocPtr(ret_val);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002193 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002194 des_xmlChar_ptr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00002195 des_const_char_ptr(n_encoding, (const char *)encoding, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002196 xmlResetLastError();
2197 if (mem_base != xmlMemBlocks()) {
2198 printf("Leak of %d blocks found in htmlParseDoc",
2199 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002200 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002201 printf(" %d", n_cur);
2202 printf(" %d", n_encoding);
2203 printf("\n");
2204 }
2205 }
2206 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002207 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002208#endif
2209
Daniel Veillard42595322004-11-08 10:52:06 +00002210 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002211}
2212
2213
2214static int
2215test_htmlParseDocument(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002216 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002217
William M. Brack21e4ef22005-01-02 09:53:13 +00002218#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00002219 int mem_base;
2220 int ret_val;
2221 htmlParserCtxtPtr ctxt; /* an HTML parser context */
2222 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002223
Daniel Veillarda521d282004-11-09 14:59:59 +00002224 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00002225 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00002226 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002227
2228 ret_val = htmlParseDocument(ctxt);
Daniel Veillarda521d282004-11-09 14:59:59 +00002229 if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;}
Daniel Veillarda03e3652004-11-02 18:45:30 +00002230 desret_int(ret_val);
2231 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00002232 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002233 xmlResetLastError();
2234 if (mem_base != xmlMemBlocks()) {
2235 printf("Leak of %d blocks found in htmlParseDocument",
2236 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002237 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002238 printf(" %d", n_ctxt);
2239 printf("\n");
2240 }
2241 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002242 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002243#endif
2244
Daniel Veillard42595322004-11-08 10:52:06 +00002245 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002246}
2247
2248
2249static int
2250test_htmlParseElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002251 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002252
William M. Brack21e4ef22005-01-02 09:53:13 +00002253#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00002254 int mem_base;
2255 htmlParserCtxtPtr ctxt; /* an HTML parser context */
2256 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002257
Daniel Veillarda521d282004-11-09 14:59:59 +00002258 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00002259 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00002260 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002261
2262 htmlParseElement(ctxt);
2263 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00002264 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002265 xmlResetLastError();
2266 if (mem_base != xmlMemBlocks()) {
2267 printf("Leak of %d blocks found in htmlParseElement",
2268 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002269 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002270 printf(" %d", n_ctxt);
2271 printf("\n");
2272 }
2273 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002274 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002275#endif
2276
Daniel Veillard42595322004-11-08 10:52:06 +00002277 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002278}
2279
2280
2281static int
2282test_htmlParseEntityRef(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002283 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002284
William M. Brack21e4ef22005-01-02 09:53:13 +00002285#if defined(LIBXML_HTML_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +00002286 int mem_base;
2287 const htmlEntityDesc * ret_val;
2288 htmlParserCtxtPtr ctxt; /* an HTML parser context */
2289 int n_ctxt;
2290 xmlChar ** str; /* location to store the entity name */
2291 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002292
Daniel Veillarda521d282004-11-09 14:59:59 +00002293 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillard42595322004-11-08 10:52:06 +00002294 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr_ptr;n_str++) {
2295 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00002296 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillard42595322004-11-08 10:52:06 +00002297 str = gen_const_xmlChar_ptr_ptr(n_str, 1);
2298
William M. Brackf13f77f2004-11-12 16:03:48 +00002299 ret_val = htmlParseEntityRef(ctxt, (const xmlChar **)str);
Daniel Veillard42595322004-11-08 10:52:06 +00002300 desret_const_htmlEntityDesc_ptr(ret_val);
2301 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00002302 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00002303 des_const_xmlChar_ptr_ptr(n_str, (const xmlChar **)str, 1);
Daniel Veillard42595322004-11-08 10:52:06 +00002304 xmlResetLastError();
2305 if (mem_base != xmlMemBlocks()) {
2306 printf("Leak of %d blocks found in htmlParseEntityRef",
2307 xmlMemBlocks() - mem_base);
2308 test_ret++;
2309 printf(" %d", n_ctxt);
2310 printf(" %d", n_str);
2311 printf("\n");
2312 }
2313 }
2314 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002315 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00002316#endif
2317
Daniel Veillard42595322004-11-08 10:52:06 +00002318 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002319}
2320
2321
2322static int
2323test_htmlParseFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002324 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002325
William M. Brack21e4ef22005-01-02 09:53:13 +00002326#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00002327 htmlDocPtr ret_val;
2328 const char * filename; /* the filename */
2329 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002330 char * encoding; /* a free form C string describing the HTML document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002331 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002332
Daniel Veillarda03e3652004-11-02 18:45:30 +00002333 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
2334 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +00002335 filename = gen_filepath(n_filename, 0);
2336 encoding = gen_const_char_ptr(n_encoding, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002337
William M. Brackf13f77f2004-11-12 16:03:48 +00002338 ret_val = htmlParseFile(filename, (const char *)encoding);
Daniel Veillarda521d282004-11-09 14:59:59 +00002339 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002340 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002341 des_filepath(n_filename, filename, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00002342 des_const_char_ptr(n_encoding, (const char *)encoding, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002343 xmlResetLastError();
2344 }
2345 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002346 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002347#endif
2348
Daniel Veillard42595322004-11-08 10:52:06 +00002349 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002350}
2351
2352
2353static int
2354test_htmlReadDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002355 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002356
William M. Brack21e4ef22005-01-02 09:53:13 +00002357#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00002358 int mem_base;
2359 htmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002360 xmlChar * cur; /* a pointer to a zero terminated string */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002361 int n_cur;
2362 const char * URL; /* the base URL to use for the document */
2363 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002364 char * encoding; /* the document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002365 int n_encoding;
2366 int options; /* a combination of htmlParserOption(s) */
2367 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002368
Daniel Veillarda03e3652004-11-02 18:45:30 +00002369 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
2370 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
2371 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2372 for (n_options = 0;n_options < gen_nb_int;n_options++) {
2373 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002374 cur = gen_const_xmlChar_ptr(n_cur, 0);
2375 URL = gen_filepath(n_URL, 1);
2376 encoding = gen_const_char_ptr(n_encoding, 2);
2377 options = gen_int(n_options, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002378
William M. Brackf13f77f2004-11-12 16:03:48 +00002379 ret_val = htmlReadDoc((const xmlChar *)cur, URL, (const char *)encoding, options);
Daniel Veillarda521d282004-11-09 14:59:59 +00002380 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002381 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00002382 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002383 des_filepath(n_URL, URL, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00002384 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002385 des_int(n_options, options, 3);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002386 xmlResetLastError();
2387 if (mem_base != xmlMemBlocks()) {
2388 printf("Leak of %d blocks found in htmlReadDoc",
2389 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002390 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002391 printf(" %d", n_cur);
2392 printf(" %d", n_URL);
2393 printf(" %d", n_encoding);
2394 printf(" %d", n_options);
2395 printf("\n");
2396 }
2397 }
2398 }
2399 }
2400 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002401 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002402#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +00002403
Daniel Veillard42595322004-11-08 10:52:06 +00002404 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002405}
2406
2407
2408static int
2409test_htmlReadFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002410 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002411
William M. Brack21e4ef22005-01-02 09:53:13 +00002412#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00002413 int mem_base;
2414 htmlDocPtr ret_val;
2415 const char * filename; /* a file or URL */
2416 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002417 char * encoding; /* the document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002418 int n_encoding;
2419 int options; /* a combination of htmlParserOption(s) */
2420 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002421
Daniel Veillarda03e3652004-11-02 18:45:30 +00002422 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
2423 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2424 for (n_options = 0;n_options < gen_nb_int;n_options++) {
2425 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002426 filename = gen_filepath(n_filename, 0);
2427 encoding = gen_const_char_ptr(n_encoding, 1);
2428 options = gen_int(n_options, 2);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002429
William M. Brackf13f77f2004-11-12 16:03:48 +00002430 ret_val = htmlReadFile(filename, (const char *)encoding, options);
Daniel Veillarda521d282004-11-09 14:59:59 +00002431 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002432 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002433 des_filepath(n_filename, filename, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00002434 des_const_char_ptr(n_encoding, (const char *)encoding, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002435 des_int(n_options, options, 2);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002436 xmlResetLastError();
2437 if (mem_base != xmlMemBlocks()) {
2438 printf("Leak of %d blocks found in htmlReadFile",
2439 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002440 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002441 printf(" %d", n_filename);
2442 printf(" %d", n_encoding);
2443 printf(" %d", n_options);
2444 printf("\n");
2445 }
2446 }
2447 }
2448 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002449 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002450#endif
2451
Daniel Veillard42595322004-11-08 10:52:06 +00002452 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002453}
2454
2455
2456static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00002457test_htmlReadMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002458 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002459
William M. Brack21e4ef22005-01-02 09:53:13 +00002460#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00002461 int mem_base;
2462 htmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002463 char * buffer; /* a pointer to a char array */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002464 int n_buffer;
2465 int size; /* the size of the array */
2466 int n_size;
2467 const char * URL; /* the base URL to use for the document */
2468 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002469 char * encoding; /* the document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002470 int n_encoding;
2471 int options; /* a combination of htmlParserOption(s) */
2472 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002473
Daniel Veillarda03e3652004-11-02 18:45:30 +00002474 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
2475 for (n_size = 0;n_size < gen_nb_int;n_size++) {
2476 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
2477 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2478 for (n_options = 0;n_options < gen_nb_int;n_options++) {
2479 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002480 buffer = gen_const_char_ptr(n_buffer, 0);
2481 size = gen_int(n_size, 1);
2482 URL = gen_filepath(n_URL, 2);
2483 encoding = gen_const_char_ptr(n_encoding, 3);
2484 options = gen_int(n_options, 4);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002485
William M. Brackf13f77f2004-11-12 16:03:48 +00002486 ret_val = htmlReadMemory((const char *)buffer, size, URL, (const char *)encoding, options);
Daniel Veillarda521d282004-11-09 14:59:59 +00002487 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002488 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00002489 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002490 des_int(n_size, size, 1);
2491 des_filepath(n_URL, URL, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +00002492 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002493 des_int(n_options, options, 4);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002494 xmlResetLastError();
2495 if (mem_base != xmlMemBlocks()) {
2496 printf("Leak of %d blocks found in htmlReadMemory",
2497 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002498 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002499 printf(" %d", n_buffer);
2500 printf(" %d", n_size);
2501 printf(" %d", n_URL);
2502 printf(" %d", n_encoding);
2503 printf(" %d", n_options);
2504 printf("\n");
2505 }
2506 }
2507 }
2508 }
2509 }
2510 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002511 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002512#endif
2513
Daniel Veillard42595322004-11-08 10:52:06 +00002514 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002515}
2516
2517
2518static int
2519test_htmlSAXParseDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002520 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002521
William M. Brack21e4ef22005-01-02 09:53:13 +00002522#if defined(LIBXML_HTML_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00002523 int mem_base;
2524 htmlDocPtr ret_val;
2525 xmlChar * cur; /* a pointer to an array of xmlChar */
2526 int n_cur;
2527 char * encoding; /* a free form C string describing the HTML document encoding, or NULL */
2528 int n_encoding;
2529 htmlSAXHandlerPtr sax; /* the SAX handler block */
2530 int n_sax;
2531 void * userData; /* if using SAX, this pointer will be provided on callbacks. */
2532 int n_userData;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002533
Daniel Veillardce682bc2004-11-05 17:22:25 +00002534 for (n_cur = 0;n_cur < gen_nb_xmlChar_ptr;n_cur++) {
2535 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2536 for (n_sax = 0;n_sax < gen_nb_htmlSAXHandlerPtr;n_sax++) {
2537 for (n_userData = 0;n_userData < gen_nb_userdata;n_userData++) {
2538 mem_base = xmlMemBlocks();
2539 cur = gen_xmlChar_ptr(n_cur, 0);
2540 encoding = gen_const_char_ptr(n_encoding, 1);
2541 sax = gen_htmlSAXHandlerPtr(n_sax, 2);
2542 userData = gen_userdata(n_userData, 3);
2543
William M. Brackf13f77f2004-11-12 16:03:48 +00002544 ret_val = htmlSAXParseDoc(cur, (const char *)encoding, sax, userData);
Daniel Veillarda521d282004-11-09 14:59:59 +00002545 desret_htmlDocPtr(ret_val);
Daniel Veillardce682bc2004-11-05 17:22:25 +00002546 call_tests++;
2547 des_xmlChar_ptr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00002548 des_const_char_ptr(n_encoding, (const char *)encoding, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +00002549 des_htmlSAXHandlerPtr(n_sax, sax, 2);
2550 des_userdata(n_userData, userData, 3);
2551 xmlResetLastError();
2552 if (mem_base != xmlMemBlocks()) {
2553 printf("Leak of %d blocks found in htmlSAXParseDoc",
2554 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002555 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002556 printf(" %d", n_cur);
2557 printf(" %d", n_encoding);
2558 printf(" %d", n_sax);
2559 printf(" %d", n_userData);
2560 printf("\n");
2561 }
2562 }
2563 }
2564 }
2565 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002566 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002567#endif
2568
Daniel Veillard42595322004-11-08 10:52:06 +00002569 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002570}
2571
2572
2573static int
2574test_htmlSAXParseFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002575 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002576
William M. Brack21e4ef22005-01-02 09:53:13 +00002577#if defined(LIBXML_HTML_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00002578 int mem_base;
2579 htmlDocPtr ret_val;
2580 const char * filename; /* the filename */
2581 int n_filename;
2582 char * encoding; /* a free form C string describing the HTML document encoding, or NULL */
2583 int n_encoding;
2584 htmlSAXHandlerPtr sax; /* the SAX handler block */
2585 int n_sax;
2586 void * userData; /* if using SAX, this pointer will be provided on callbacks. */
2587 int n_userData;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002588
Daniel Veillardce682bc2004-11-05 17:22:25 +00002589 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
2590 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2591 for (n_sax = 0;n_sax < gen_nb_htmlSAXHandlerPtr;n_sax++) {
2592 for (n_userData = 0;n_userData < gen_nb_userdata;n_userData++) {
2593 mem_base = xmlMemBlocks();
2594 filename = gen_filepath(n_filename, 0);
2595 encoding = gen_const_char_ptr(n_encoding, 1);
2596 sax = gen_htmlSAXHandlerPtr(n_sax, 2);
2597 userData = gen_userdata(n_userData, 3);
2598
William M. Brackf13f77f2004-11-12 16:03:48 +00002599 ret_val = htmlSAXParseFile(filename, (const char *)encoding, sax, userData);
Daniel Veillarda521d282004-11-09 14:59:59 +00002600 desret_htmlDocPtr(ret_val);
Daniel Veillardce682bc2004-11-05 17:22:25 +00002601 call_tests++;
2602 des_filepath(n_filename, filename, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00002603 des_const_char_ptr(n_encoding, (const char *)encoding, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +00002604 des_htmlSAXHandlerPtr(n_sax, sax, 2);
2605 des_userdata(n_userData, userData, 3);
2606 xmlResetLastError();
2607 if (mem_base != xmlMemBlocks()) {
2608 printf("Leak of %d blocks found in htmlSAXParseFile",
2609 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002610 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002611 printf(" %d", n_filename);
2612 printf(" %d", n_encoding);
2613 printf(" %d", n_sax);
2614 printf(" %d", n_userData);
2615 printf("\n");
2616 }
2617 }
2618 }
2619 }
2620 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002621 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002622#endif
2623
Daniel Veillard42595322004-11-08 10:52:06 +00002624 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002625}
2626
2627
2628static int
2629test_htmlTagLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002630 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002631
2632
2633 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00002634 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002635}
2636
2637static int
2638test_HTMLparser(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002639 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002640
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002641 if (quiet == 0) printf("Testing HTMLparser : 31 of 37 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00002642 test_ret += test_UTF8ToHtml();
2643 test_ret += test_htmlAttrAllowed();
2644 test_ret += test_htmlAutoCloseTag();
2645 test_ret += test_htmlCreateMemoryParserCtxt();
2646 test_ret += test_htmlCreatePushParserCtxt();
2647 test_ret += test_htmlCtxtReadDoc();
2648 test_ret += test_htmlCtxtReadFile();
2649 test_ret += test_htmlCtxtReadMemory();
2650 test_ret += test_htmlCtxtReset();
2651 test_ret += test_htmlCtxtUseOptions();
2652 test_ret += test_htmlElementAllowedHere();
2653 test_ret += test_htmlElementStatusHere();
2654 test_ret += test_htmlEncodeEntities();
2655 test_ret += test_htmlEntityLookup();
2656 test_ret += test_htmlEntityValueLookup();
2657 test_ret += test_htmlHandleOmittedElem();
2658 test_ret += test_htmlIsAutoClosed();
2659 test_ret += test_htmlIsScriptAttribute();
2660 test_ret += test_htmlNodeStatus();
2661 test_ret += test_htmlParseCharRef();
2662 test_ret += test_htmlParseChunk();
2663 test_ret += test_htmlParseDoc();
2664 test_ret += test_htmlParseDocument();
2665 test_ret += test_htmlParseElement();
2666 test_ret += test_htmlParseEntityRef();
2667 test_ret += test_htmlParseFile();
2668 test_ret += test_htmlReadDoc();
2669 test_ret += test_htmlReadFile();
2670 test_ret += test_htmlReadMemory();
2671 test_ret += test_htmlSAXParseDoc();
2672 test_ret += test_htmlSAXParseFile();
2673 test_ret += test_htmlTagLookup();
Daniel Veillardd93f6252004-11-02 15:53:51 +00002674
Daniel Veillard42595322004-11-08 10:52:06 +00002675 if (test_ret != 0)
2676 printf("Module HTMLparser: %d errors\n", test_ret);
2677 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002678}
2679
2680static int
2681test_htmlDocContentDumpFormatOutput(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002682 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002683
William M. Brack21e4ef22005-01-02 09:53:13 +00002684#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +00002685 int mem_base;
2686 xmlOutputBufferPtr buf; /* the HTML buffer output */
2687 int n_buf;
2688 xmlDocPtr cur; /* the document */
2689 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002690 char * encoding; /* the encoding string */
Daniel Veillard3d97e662004-11-04 10:49:00 +00002691 int n_encoding;
2692 int format; /* should formatting spaces been added */
2693 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002694
Daniel Veillard3d97e662004-11-04 10:49:00 +00002695 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
2696 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
2697 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2698 for (n_format = 0;n_format < gen_nb_int;n_format++) {
2699 mem_base = xmlMemBlocks();
2700 buf = gen_xmlOutputBufferPtr(n_buf, 0);
2701 cur = gen_xmlDocPtr(n_cur, 1);
2702 encoding = gen_const_char_ptr(n_encoding, 2);
2703 format = gen_int(n_format, 3);
2704
William M. Brackf13f77f2004-11-12 16:03:48 +00002705 htmlDocContentDumpFormatOutput(buf, cur, (const char *)encoding, format);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002706 call_tests++;
2707 des_xmlOutputBufferPtr(n_buf, buf, 0);
2708 des_xmlDocPtr(n_cur, cur, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00002709 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002710 des_int(n_format, format, 3);
2711 xmlResetLastError();
2712 if (mem_base != xmlMemBlocks()) {
2713 printf("Leak of %d blocks found in htmlDocContentDumpFormatOutput",
2714 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002715 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002716 printf(" %d", n_buf);
2717 printf(" %d", n_cur);
2718 printf(" %d", n_encoding);
2719 printf(" %d", n_format);
2720 printf("\n");
2721 }
2722 }
2723 }
2724 }
2725 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002726 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002727#endif
Daniel Veillard3d97e662004-11-04 10:49:00 +00002728
Daniel Veillard42595322004-11-08 10:52:06 +00002729 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002730}
2731
2732
2733static int
2734test_htmlDocContentDumpOutput(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002735 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002736
William M. Brack21e4ef22005-01-02 09:53:13 +00002737#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +00002738 int mem_base;
2739 xmlOutputBufferPtr buf; /* the HTML buffer output */
2740 int n_buf;
2741 xmlDocPtr cur; /* the document */
2742 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002743 char * encoding; /* the encoding string */
Daniel Veillard3d97e662004-11-04 10:49:00 +00002744 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002745
Daniel Veillard3d97e662004-11-04 10:49:00 +00002746 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
2747 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
2748 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2749 mem_base = xmlMemBlocks();
2750 buf = gen_xmlOutputBufferPtr(n_buf, 0);
2751 cur = gen_xmlDocPtr(n_cur, 1);
2752 encoding = gen_const_char_ptr(n_encoding, 2);
2753
William M. Brackf13f77f2004-11-12 16:03:48 +00002754 htmlDocContentDumpOutput(buf, cur, (const char *)encoding);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002755 call_tests++;
2756 des_xmlOutputBufferPtr(n_buf, buf, 0);
2757 des_xmlDocPtr(n_cur, cur, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00002758 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002759 xmlResetLastError();
2760 if (mem_base != xmlMemBlocks()) {
2761 printf("Leak of %d blocks found in htmlDocContentDumpOutput",
2762 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002763 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002764 printf(" %d", n_buf);
2765 printf(" %d", n_cur);
2766 printf(" %d", n_encoding);
2767 printf("\n");
2768 }
2769 }
2770 }
2771 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002772 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002773#endif
Daniel Veillard3d97e662004-11-04 10:49:00 +00002774
Daniel Veillard42595322004-11-08 10:52:06 +00002775 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002776}
2777
2778
2779static int
2780test_htmlDocDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002781 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002782
William M. Brack21e4ef22005-01-02 09:53:13 +00002783#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00002784 int mem_base;
2785 int ret_val;
2786 FILE * f; /* the FILE* */
2787 int n_f;
2788 xmlDocPtr cur; /* the document */
2789 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002790
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00002791 for (n_f = 0;n_f < gen_nb_FILE_ptr;n_f++) {
2792 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
2793 mem_base = xmlMemBlocks();
2794 f = gen_FILE_ptr(n_f, 0);
2795 cur = gen_xmlDocPtr(n_cur, 1);
2796
2797 ret_val = htmlDocDump(f, cur);
2798 desret_int(ret_val);
2799 call_tests++;
2800 des_FILE_ptr(n_f, f, 0);
2801 des_xmlDocPtr(n_cur, cur, 1);
2802 xmlResetLastError();
2803 if (mem_base != xmlMemBlocks()) {
2804 printf("Leak of %d blocks found in htmlDocDump",
2805 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002806 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00002807 printf(" %d", n_f);
2808 printf(" %d", n_cur);
2809 printf("\n");
2810 }
2811 }
2812 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002813 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00002814#endif
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00002815
Daniel Veillard42595322004-11-08 10:52:06 +00002816 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002817}
2818
2819
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00002820#define gen_nb_xmlChar_ptr_ptr 1
2821static xmlChar ** gen_xmlChar_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
2822 return(NULL);
2823}
2824static void des_xmlChar_ptr_ptr(int no ATTRIBUTE_UNUSED, xmlChar ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
2825}
2826
Daniel Veillardd93f6252004-11-02 15:53:51 +00002827static int
2828test_htmlDocDumpMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002829 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002830
William M. Brack21e4ef22005-01-02 09:53:13 +00002831#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00002832 int mem_base;
2833 xmlDocPtr cur; /* the document */
2834 int n_cur;
2835 xmlChar ** mem; /* OUT: the memory pointer */
2836 int n_mem;
2837 int * size; /* OUT: the memory length */
2838 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002839
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00002840 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
2841 for (n_mem = 0;n_mem < gen_nb_xmlChar_ptr_ptr;n_mem++) {
2842 for (n_size = 0;n_size < gen_nb_int_ptr;n_size++) {
2843 mem_base = xmlMemBlocks();
2844 cur = gen_xmlDocPtr(n_cur, 0);
2845 mem = gen_xmlChar_ptr_ptr(n_mem, 1);
2846 size = gen_int_ptr(n_size, 2);
2847
2848 htmlDocDumpMemory(cur, mem, size);
2849 call_tests++;
2850 des_xmlDocPtr(n_cur, cur, 0);
2851 des_xmlChar_ptr_ptr(n_mem, mem, 1);
2852 des_int_ptr(n_size, size, 2);
2853 xmlResetLastError();
2854 if (mem_base != xmlMemBlocks()) {
2855 printf("Leak of %d blocks found in htmlDocDumpMemory",
2856 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002857 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00002858 printf(" %d", n_cur);
2859 printf(" %d", n_mem);
2860 printf(" %d", n_size);
2861 printf("\n");
2862 }
2863 }
2864 }
2865 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002866 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00002867#endif
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00002868
Daniel Veillard42595322004-11-08 10:52:06 +00002869 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002870}
2871
2872
2873static int
2874test_htmlGetMetaEncoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002875 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002876
William M. Brack21e4ef22005-01-02 09:53:13 +00002877#if defined(LIBXML_HTML_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +00002878 int mem_base;
2879 const xmlChar * ret_val;
2880 htmlDocPtr doc; /* the document */
2881 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002882
Daniel Veillarda521d282004-11-09 14:59:59 +00002883 for (n_doc = 0;n_doc < gen_nb_htmlDocPtr;n_doc++) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +00002884 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00002885 doc = gen_htmlDocPtr(n_doc, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00002886
2887 ret_val = htmlGetMetaEncoding(doc);
2888 desret_const_xmlChar_ptr(ret_val);
2889 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00002890 des_htmlDocPtr(n_doc, doc, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00002891 xmlResetLastError();
2892 if (mem_base != xmlMemBlocks()) {
2893 printf("Leak of %d blocks found in htmlGetMetaEncoding",
2894 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002895 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00002896 printf(" %d", n_doc);
2897 printf("\n");
2898 }
2899 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002900 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00002901#endif
2902
Daniel Veillard42595322004-11-08 10:52:06 +00002903 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002904}
2905
2906
2907static int
2908test_htmlIsBooleanAttr(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002909 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002910
William M. Brack21e4ef22005-01-02 09:53:13 +00002911#if defined(LIBXML_HTML_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00002912 int mem_base;
2913 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002914 xmlChar * name; /* the name of the attribute to check */
Daniel Veillardd93f6252004-11-02 15:53:51 +00002915 int n_name;
2916
2917 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
2918 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002919 name = gen_const_xmlChar_ptr(n_name, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002920
William M. Brackf13f77f2004-11-12 16:03:48 +00002921 ret_val = htmlIsBooleanAttr((const xmlChar *)name);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002922 desret_int(ret_val);
2923 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00002924 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002925 xmlResetLastError();
2926 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00002927 printf("Leak of %d blocks found in htmlIsBooleanAttr",
Daniel Veillardd93f6252004-11-02 15:53:51 +00002928 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002929 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002930 printf(" %d", n_name);
2931 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00002932 }
2933 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002934 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002935#endif
2936
Daniel Veillard42595322004-11-08 10:52:06 +00002937 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002938}
2939
2940
2941static int
2942test_htmlNewDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002943 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002944
William M. Brack21e4ef22005-01-02 09:53:13 +00002945#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00002946 int mem_base;
2947 htmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002948 xmlChar * URI; /* URI for the dtd, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002949 int n_URI;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002950 xmlChar * ExternalID; /* the external ID of the DTD, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002951 int n_ExternalID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002952
Daniel Veillarda03e3652004-11-02 18:45:30 +00002953 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
2954 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
2955 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002956 URI = gen_const_xmlChar_ptr(n_URI, 0);
2957 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002958
William M. Brackf13f77f2004-11-12 16:03:48 +00002959 ret_val = htmlNewDoc((const xmlChar *)URI, (const xmlChar *)ExternalID);
Daniel Veillarda521d282004-11-09 14:59:59 +00002960 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002961 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00002962 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 0);
2963 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002964 xmlResetLastError();
2965 if (mem_base != xmlMemBlocks()) {
2966 printf("Leak of %d blocks found in htmlNewDoc",
2967 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002968 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002969 printf(" %d", n_URI);
2970 printf(" %d", n_ExternalID);
2971 printf("\n");
2972 }
2973 }
2974 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002975 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002976#endif
2977
Daniel Veillard42595322004-11-08 10:52:06 +00002978 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002979}
2980
2981
2982static int
2983test_htmlNewDocNoDtD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002984 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002985
William M. Brack21e4ef22005-01-02 09:53:13 +00002986#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00002987 int mem_base;
2988 htmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002989 xmlChar * URI; /* URI for the dtd, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002990 int n_URI;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002991 xmlChar * ExternalID; /* the external ID of the DTD, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002992 int n_ExternalID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002993
Daniel Veillarda03e3652004-11-02 18:45:30 +00002994 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
2995 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
2996 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002997 URI = gen_const_xmlChar_ptr(n_URI, 0);
2998 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002999
William M. Brackf13f77f2004-11-12 16:03:48 +00003000 ret_val = htmlNewDocNoDtD((const xmlChar *)URI, (const xmlChar *)ExternalID);
Daniel Veillarda521d282004-11-09 14:59:59 +00003001 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003002 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00003003 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 0);
3004 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003005 xmlResetLastError();
3006 if (mem_base != xmlMemBlocks()) {
3007 printf("Leak of %d blocks found in htmlNewDocNoDtD",
3008 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003009 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003010 printf(" %d", n_URI);
3011 printf(" %d", n_ExternalID);
3012 printf("\n");
3013 }
3014 }
3015 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003016 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003017#endif
3018
Daniel Veillard42595322004-11-08 10:52:06 +00003019 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003020}
3021
3022
3023static int
3024test_htmlNodeDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003025 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003026
William M. Brack21e4ef22005-01-02 09:53:13 +00003027#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003028 int mem_base;
3029 int ret_val;
3030 xmlBufferPtr buf; /* the HTML buffer output */
3031 int n_buf;
3032 xmlDocPtr doc; /* the document */
3033 int n_doc;
3034 xmlNodePtr cur; /* the current node */
3035 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003036
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003037 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
3038 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
3039 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
3040 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00003041 buf = gen_xmlBufferPtr(n_buf, 0);
3042 doc = gen_xmlDocPtr(n_doc, 1);
3043 cur = gen_xmlNodePtr(n_cur, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003044
3045 ret_val = htmlNodeDump(buf, doc, cur);
3046 desret_int(ret_val);
3047 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003048 des_xmlBufferPtr(n_buf, buf, 0);
3049 des_xmlDocPtr(n_doc, doc, 1);
3050 des_xmlNodePtr(n_cur, cur, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003051 xmlResetLastError();
3052 if (mem_base != xmlMemBlocks()) {
3053 printf("Leak of %d blocks found in htmlNodeDump",
3054 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003055 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003056 printf(" %d", n_buf);
3057 printf(" %d", n_doc);
3058 printf(" %d", n_cur);
3059 printf("\n");
3060 }
3061 }
3062 }
3063 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003064 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003065#endif
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003066
Daniel Veillard42595322004-11-08 10:52:06 +00003067 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003068}
3069
3070
3071static int
3072test_htmlNodeDumpFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003073 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003074
William M. Brack21e4ef22005-01-02 09:53:13 +00003075#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003076 int mem_base;
3077 FILE * out; /* the FILE pointer */
3078 int n_out;
3079 xmlDocPtr doc; /* the document */
3080 int n_doc;
3081 xmlNodePtr cur; /* the current node */
3082 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003083
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003084 for (n_out = 0;n_out < gen_nb_FILE_ptr;n_out++) {
3085 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
3086 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
3087 mem_base = xmlMemBlocks();
3088 out = gen_FILE_ptr(n_out, 0);
3089 doc = gen_xmlDocPtr(n_doc, 1);
3090 cur = gen_xmlNodePtr(n_cur, 2);
3091
3092 htmlNodeDumpFile(out, doc, cur);
3093 call_tests++;
3094 des_FILE_ptr(n_out, out, 0);
3095 des_xmlDocPtr(n_doc, doc, 1);
3096 des_xmlNodePtr(n_cur, cur, 2);
3097 xmlResetLastError();
3098 if (mem_base != xmlMemBlocks()) {
3099 printf("Leak of %d blocks found in htmlNodeDumpFile",
3100 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003101 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003102 printf(" %d", n_out);
3103 printf(" %d", n_doc);
3104 printf(" %d", n_cur);
3105 printf("\n");
3106 }
3107 }
3108 }
3109 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003110 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003111#endif
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003112
Daniel Veillard42595322004-11-08 10:52:06 +00003113 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003114}
3115
3116
3117static int
3118test_htmlNodeDumpFileFormat(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003119 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003120
William M. Brack21e4ef22005-01-02 09:53:13 +00003121#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003122 int mem_base;
3123 int ret_val;
3124 FILE * out; /* the FILE pointer */
3125 int n_out;
3126 xmlDocPtr doc; /* the document */
3127 int n_doc;
3128 xmlNodePtr cur; /* the current node */
3129 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003130 char * encoding; /* the document encoding */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003131 int n_encoding;
3132 int format; /* should formatting spaces been added */
3133 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003134
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003135 for (n_out = 0;n_out < gen_nb_FILE_ptr;n_out++) {
3136 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
3137 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
3138 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
3139 for (n_format = 0;n_format < gen_nb_int;n_format++) {
3140 mem_base = xmlMemBlocks();
3141 out = gen_FILE_ptr(n_out, 0);
3142 doc = gen_xmlDocPtr(n_doc, 1);
3143 cur = gen_xmlNodePtr(n_cur, 2);
3144 encoding = gen_const_char_ptr(n_encoding, 3);
3145 format = gen_int(n_format, 4);
3146
William M. Brackf13f77f2004-11-12 16:03:48 +00003147 ret_val = htmlNodeDumpFileFormat(out, doc, cur, (const char *)encoding, format);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003148 desret_int(ret_val);
3149 call_tests++;
3150 des_FILE_ptr(n_out, out, 0);
3151 des_xmlDocPtr(n_doc, doc, 1);
3152 des_xmlNodePtr(n_cur, cur, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +00003153 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003154 des_int(n_format, format, 4);
3155 xmlResetLastError();
3156 if (mem_base != xmlMemBlocks()) {
3157 printf("Leak of %d blocks found in htmlNodeDumpFileFormat",
3158 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003159 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003160 printf(" %d", n_out);
3161 printf(" %d", n_doc);
3162 printf(" %d", n_cur);
3163 printf(" %d", n_encoding);
3164 printf(" %d", n_format);
3165 printf("\n");
3166 }
3167 }
3168 }
3169 }
3170 }
3171 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003172 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003173#endif
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003174
Daniel Veillard42595322004-11-08 10:52:06 +00003175 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003176}
3177
3178
3179static int
3180test_htmlNodeDumpFormatOutput(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003181 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003182
William M. Brack21e4ef22005-01-02 09:53:13 +00003183#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +00003184 int mem_base;
3185 xmlOutputBufferPtr buf; /* the HTML buffer output */
3186 int n_buf;
3187 xmlDocPtr doc; /* the document */
3188 int n_doc;
3189 xmlNodePtr cur; /* the current node */
3190 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003191 char * encoding; /* the encoding string */
Daniel Veillard3d97e662004-11-04 10:49:00 +00003192 int n_encoding;
3193 int format; /* should formatting spaces been added */
3194 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003195
Daniel Veillard3d97e662004-11-04 10:49:00 +00003196 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
3197 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
3198 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
3199 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
3200 for (n_format = 0;n_format < gen_nb_int;n_format++) {
3201 mem_base = xmlMemBlocks();
3202 buf = gen_xmlOutputBufferPtr(n_buf, 0);
3203 doc = gen_xmlDocPtr(n_doc, 1);
3204 cur = gen_xmlNodePtr(n_cur, 2);
3205 encoding = gen_const_char_ptr(n_encoding, 3);
3206 format = gen_int(n_format, 4);
3207
William M. Brackf13f77f2004-11-12 16:03:48 +00003208 htmlNodeDumpFormatOutput(buf, doc, cur, (const char *)encoding, format);
Daniel Veillard3d97e662004-11-04 10:49:00 +00003209 call_tests++;
3210 des_xmlOutputBufferPtr(n_buf, buf, 0);
3211 des_xmlDocPtr(n_doc, doc, 1);
3212 des_xmlNodePtr(n_cur, cur, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +00003213 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard3d97e662004-11-04 10:49:00 +00003214 des_int(n_format, format, 4);
3215 xmlResetLastError();
3216 if (mem_base != xmlMemBlocks()) {
3217 printf("Leak of %d blocks found in htmlNodeDumpFormatOutput",
3218 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003219 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003220 printf(" %d", n_buf);
3221 printf(" %d", n_doc);
3222 printf(" %d", n_cur);
3223 printf(" %d", n_encoding);
3224 printf(" %d", n_format);
3225 printf("\n");
3226 }
3227 }
3228 }
3229 }
3230 }
3231 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003232 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003233#endif
Daniel Veillard3d97e662004-11-04 10:49:00 +00003234
Daniel Veillard42595322004-11-08 10:52:06 +00003235 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003236}
3237
3238
3239static int
3240test_htmlNodeDumpOutput(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003241 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003242
William M. Brack21e4ef22005-01-02 09:53:13 +00003243#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +00003244 int mem_base;
3245 xmlOutputBufferPtr buf; /* the HTML buffer output */
3246 int n_buf;
3247 xmlDocPtr doc; /* the document */
3248 int n_doc;
3249 xmlNodePtr cur; /* the current node */
3250 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003251 char * encoding; /* the encoding string */
Daniel Veillard3d97e662004-11-04 10:49:00 +00003252 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003253
Daniel Veillard3d97e662004-11-04 10:49:00 +00003254 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
3255 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
3256 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
3257 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
3258 mem_base = xmlMemBlocks();
3259 buf = gen_xmlOutputBufferPtr(n_buf, 0);
3260 doc = gen_xmlDocPtr(n_doc, 1);
3261 cur = gen_xmlNodePtr(n_cur, 2);
3262 encoding = gen_const_char_ptr(n_encoding, 3);
3263
William M. Brackf13f77f2004-11-12 16:03:48 +00003264 htmlNodeDumpOutput(buf, doc, cur, (const char *)encoding);
Daniel Veillard3d97e662004-11-04 10:49:00 +00003265 call_tests++;
3266 des_xmlOutputBufferPtr(n_buf, buf, 0);
3267 des_xmlDocPtr(n_doc, doc, 1);
3268 des_xmlNodePtr(n_cur, cur, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +00003269 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard3d97e662004-11-04 10:49:00 +00003270 xmlResetLastError();
3271 if (mem_base != xmlMemBlocks()) {
3272 printf("Leak of %d blocks found in htmlNodeDumpOutput",
3273 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003274 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003275 printf(" %d", n_buf);
3276 printf(" %d", n_doc);
3277 printf(" %d", n_cur);
3278 printf(" %d", n_encoding);
3279 printf("\n");
3280 }
3281 }
3282 }
3283 }
3284 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003285 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003286#endif
Daniel Veillard3d97e662004-11-04 10:49:00 +00003287
Daniel Veillard42595322004-11-08 10:52:06 +00003288 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003289}
3290
3291
3292static int
3293test_htmlSaveFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003294 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003295
William M. Brack21e4ef22005-01-02 09:53:13 +00003296#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00003297 int mem_base;
3298 int ret_val;
3299 const char * filename; /* the filename (or URL) */
3300 int n_filename;
3301 xmlDocPtr cur; /* the document */
3302 int n_cur;
3303
3304 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
3305 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
3306 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00003307 filename = gen_fileoutput(n_filename, 0);
3308 cur = gen_xmlDocPtr(n_cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003309
3310 ret_val = htmlSaveFile(filename, cur);
3311 desret_int(ret_val);
3312 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003313 des_fileoutput(n_filename, filename, 0);
3314 des_xmlDocPtr(n_cur, cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003315 xmlResetLastError();
3316 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00003317 printf("Leak of %d blocks found in htmlSaveFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +00003318 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003319 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003320 printf(" %d", n_filename);
3321 printf(" %d", n_cur);
3322 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00003323 }
3324 }
3325 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003326 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003327#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +00003328
Daniel Veillard42595322004-11-08 10:52:06 +00003329 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003330}
3331
3332
3333static int
3334test_htmlSaveFileEnc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003335 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003336
William M. Brack21e4ef22005-01-02 09:53:13 +00003337#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00003338 int mem_base;
3339 int ret_val;
3340 const char * filename; /* the filename */
3341 int n_filename;
3342 xmlDocPtr cur; /* the document */
3343 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003344 char * encoding; /* the document encoding */
Daniel Veillardd93f6252004-11-02 15:53:51 +00003345 int n_encoding;
3346
3347 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
3348 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
3349 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
3350 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00003351 filename = gen_fileoutput(n_filename, 0);
3352 cur = gen_xmlDocPtr(n_cur, 1);
3353 encoding = gen_const_char_ptr(n_encoding, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003354
William M. Brackf13f77f2004-11-12 16:03:48 +00003355 ret_val = htmlSaveFileEnc(filename, cur, (const char *)encoding);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003356 desret_int(ret_val);
3357 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003358 des_fileoutput(n_filename, filename, 0);
3359 des_xmlDocPtr(n_cur, cur, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00003360 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003361 xmlResetLastError();
3362 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00003363 printf("Leak of %d blocks found in htmlSaveFileEnc",
Daniel Veillardd93f6252004-11-02 15:53:51 +00003364 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003365 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003366 printf(" %d", n_filename);
3367 printf(" %d", n_cur);
3368 printf(" %d", n_encoding);
3369 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00003370 }
3371 }
3372 }
3373 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003374 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003375#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +00003376
Daniel Veillard42595322004-11-08 10:52:06 +00003377 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003378}
3379
3380
3381static int
3382test_htmlSaveFileFormat(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003383 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003384
William M. Brack21e4ef22005-01-02 09:53:13 +00003385#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00003386 int mem_base;
3387 int ret_val;
3388 const char * filename; /* the filename */
3389 int n_filename;
3390 xmlDocPtr cur; /* the document */
3391 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003392 char * encoding; /* the document encoding */
Daniel Veillardd93f6252004-11-02 15:53:51 +00003393 int n_encoding;
3394 int format; /* should formatting spaces been added */
3395 int n_format;
3396
3397 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
3398 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
3399 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
3400 for (n_format = 0;n_format < gen_nb_int;n_format++) {
3401 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00003402 filename = gen_fileoutput(n_filename, 0);
3403 cur = gen_xmlDocPtr(n_cur, 1);
3404 encoding = gen_const_char_ptr(n_encoding, 2);
3405 format = gen_int(n_format, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003406
William M. Brackf13f77f2004-11-12 16:03:48 +00003407 ret_val = htmlSaveFileFormat(filename, cur, (const char *)encoding, format);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003408 desret_int(ret_val);
3409 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003410 des_fileoutput(n_filename, filename, 0);
3411 des_xmlDocPtr(n_cur, cur, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00003412 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +00003413 des_int(n_format, format, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003414 xmlResetLastError();
3415 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00003416 printf("Leak of %d blocks found in htmlSaveFileFormat",
Daniel Veillardd93f6252004-11-02 15:53:51 +00003417 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003418 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003419 printf(" %d", n_filename);
3420 printf(" %d", n_cur);
3421 printf(" %d", n_encoding);
3422 printf(" %d", n_format);
3423 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00003424 }
3425 }
3426 }
3427 }
3428 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003429 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003430#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +00003431
Daniel Veillard42595322004-11-08 10:52:06 +00003432 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003433}
3434
3435
3436static int
3437test_htmlSetMetaEncoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003438 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003439
William M. Brack21e4ef22005-01-02 09:53:13 +00003440#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00003441 int mem_base;
3442 int ret_val;
3443 htmlDocPtr doc; /* the document */
3444 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003445 xmlChar * encoding; /* the encoding string */
Daniel Veillarda03e3652004-11-02 18:45:30 +00003446 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003447
Daniel Veillarda521d282004-11-09 14:59:59 +00003448 for (n_doc = 0;n_doc < gen_nb_htmlDocPtr;n_doc++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00003449 for (n_encoding = 0;n_encoding < gen_nb_const_xmlChar_ptr;n_encoding++) {
3450 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00003451 doc = gen_htmlDocPtr(n_doc, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00003452 encoding = gen_const_xmlChar_ptr(n_encoding, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003453
William M. Brackf13f77f2004-11-12 16:03:48 +00003454 ret_val = htmlSetMetaEncoding(doc, (const xmlChar *)encoding);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003455 desret_int(ret_val);
3456 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00003457 des_htmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00003458 des_const_xmlChar_ptr(n_encoding, (const xmlChar *)encoding, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003459 xmlResetLastError();
3460 if (mem_base != xmlMemBlocks()) {
3461 printf("Leak of %d blocks found in htmlSetMetaEncoding",
3462 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003463 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003464 printf(" %d", n_doc);
3465 printf(" %d", n_encoding);
3466 printf("\n");
3467 }
3468 }
3469 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003470 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003471#endif
3472
Daniel Veillard42595322004-11-08 10:52:06 +00003473 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003474}
3475
3476static int
3477test_HTMLtree(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003478 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003479
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003480 if (quiet == 0) printf("Testing HTMLtree : 17 of 17 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00003481 test_ret += test_htmlDocContentDumpFormatOutput();
3482 test_ret += test_htmlDocContentDumpOutput();
3483 test_ret += test_htmlDocDump();
3484 test_ret += test_htmlDocDumpMemory();
3485 test_ret += test_htmlGetMetaEncoding();
3486 test_ret += test_htmlIsBooleanAttr();
3487 test_ret += test_htmlNewDoc();
3488 test_ret += test_htmlNewDocNoDtD();
3489 test_ret += test_htmlNodeDump();
3490 test_ret += test_htmlNodeDumpFile();
3491 test_ret += test_htmlNodeDumpFileFormat();
3492 test_ret += test_htmlNodeDumpFormatOutput();
3493 test_ret += test_htmlNodeDumpOutput();
3494 test_ret += test_htmlSaveFile();
3495 test_ret += test_htmlSaveFileEnc();
3496 test_ret += test_htmlSaveFileFormat();
3497 test_ret += test_htmlSetMetaEncoding();
Daniel Veillardd93f6252004-11-02 15:53:51 +00003498
Daniel Veillard42595322004-11-08 10:52:06 +00003499 if (test_ret != 0)
3500 printf("Module HTMLtree: %d errors\n", test_ret);
3501 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003502}
3503
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003504static int
3505test_docbDefaultSAXHandlerInit(void) {
3506 int test_ret = 0;
3507
William M. Brack21e4ef22005-01-02 09:53:13 +00003508#if defined(LIBXML_DOCB_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +00003509#ifdef LIBXML_DOCB_ENABLED
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003510 int mem_base;
3511
3512 mem_base = xmlMemBlocks();
3513
3514 docbDefaultSAXHandlerInit();
3515 call_tests++;
3516 xmlResetLastError();
3517 if (mem_base != xmlMemBlocks()) {
3518 printf("Leak of %d blocks found in docbDefaultSAXHandlerInit",
3519 xmlMemBlocks() - mem_base);
3520 test_ret++;
3521 printf("\n");
3522 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003523 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00003524#endif
William M. Brack21e4ef22005-01-02 09:53:13 +00003525#endif
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003526
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003527 return(test_ret);
3528}
3529
3530
3531static int
3532test_htmlDefaultSAXHandlerInit(void) {
3533 int test_ret = 0;
3534
William M. Brack21e4ef22005-01-02 09:53:13 +00003535#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +00003536#ifdef LIBXML_HTML_ENABLED
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003537 int mem_base;
3538
3539 mem_base = xmlMemBlocks();
3540
3541 htmlDefaultSAXHandlerInit();
3542 call_tests++;
3543 xmlResetLastError();
3544 if (mem_base != xmlMemBlocks()) {
3545 printf("Leak of %d blocks found in htmlDefaultSAXHandlerInit",
3546 xmlMemBlocks() - mem_base);
3547 test_ret++;
3548 printf("\n");
3549 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003550 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00003551#endif
William M. Brack21e4ef22005-01-02 09:53:13 +00003552#endif
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003553
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003554 return(test_ret);
3555}
3556
3557
3558static int
3559test_xmlDefaultSAXHandlerInit(void) {
3560 int test_ret = 0;
3561
3562 int mem_base;
3563
3564 mem_base = xmlMemBlocks();
3565
3566 xmlDefaultSAXHandlerInit();
3567 call_tests++;
3568 xmlResetLastError();
3569 if (mem_base != xmlMemBlocks()) {
3570 printf("Leak of %d blocks found in xmlDefaultSAXHandlerInit",
3571 xmlMemBlocks() - mem_base);
3572 test_ret++;
3573 printf("\n");
3574 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003575 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003576
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003577 return(test_ret);
3578}
3579
3580
3581#define gen_nb_xmlEnumerationPtr 1
3582static xmlEnumerationPtr gen_xmlEnumerationPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
3583 return(NULL);
3584}
3585static void des_xmlEnumerationPtr(int no ATTRIBUTE_UNUSED, xmlEnumerationPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
3586}
3587
3588static int
3589test_xmlSAX2AttributeDecl(void) {
3590 int test_ret = 0;
3591
3592 int mem_base;
3593 void * ctx; /* the user data (XML parser context) */
3594 int n_ctx;
3595 xmlChar * elem; /* the name of the element */
3596 int n_elem;
3597 xmlChar * fullname; /* the attribute name */
3598 int n_fullname;
3599 int type; /* the attribute type */
3600 int n_type;
3601 int def; /* the type of default value */
3602 int n_def;
3603 xmlChar * defaultValue; /* the attribute default value */
3604 int n_defaultValue;
3605 xmlEnumerationPtr tree; /* the tree of enumerated value set */
3606 int n_tree;
3607
3608 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
3609 for (n_elem = 0;n_elem < gen_nb_const_xmlChar_ptr;n_elem++) {
3610 for (n_fullname = 0;n_fullname < gen_nb_const_xmlChar_ptr;n_fullname++) {
3611 for (n_type = 0;n_type < gen_nb_int;n_type++) {
3612 for (n_def = 0;n_def < gen_nb_int;n_def++) {
3613 for (n_defaultValue = 0;n_defaultValue < gen_nb_const_xmlChar_ptr;n_defaultValue++) {
3614 for (n_tree = 0;n_tree < gen_nb_xmlEnumerationPtr;n_tree++) {
3615 mem_base = xmlMemBlocks();
3616 ctx = gen_void_ptr(n_ctx, 0);
3617 elem = gen_const_xmlChar_ptr(n_elem, 1);
3618 fullname = gen_const_xmlChar_ptr(n_fullname, 2);
3619 type = gen_int(n_type, 3);
3620 def = gen_int(n_def, 4);
3621 defaultValue = gen_const_xmlChar_ptr(n_defaultValue, 5);
3622 tree = gen_xmlEnumerationPtr(n_tree, 6);
3623
William M. Brackf13f77f2004-11-12 16:03:48 +00003624 xmlSAX2AttributeDecl(ctx, (const xmlChar *)elem, (const xmlChar *)fullname, type, def, (const xmlChar *)defaultValue, tree);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003625 call_tests++;
3626 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00003627 des_const_xmlChar_ptr(n_elem, (const xmlChar *)elem, 1);
3628 des_const_xmlChar_ptr(n_fullname, (const xmlChar *)fullname, 2);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003629 des_int(n_type, type, 3);
3630 des_int(n_def, def, 4);
William M. Brackf13f77f2004-11-12 16:03:48 +00003631 des_const_xmlChar_ptr(n_defaultValue, (const xmlChar *)defaultValue, 5);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003632 des_xmlEnumerationPtr(n_tree, tree, 6);
3633 xmlResetLastError();
3634 if (mem_base != xmlMemBlocks()) {
3635 printf("Leak of %d blocks found in xmlSAX2AttributeDecl",
3636 xmlMemBlocks() - mem_base);
3637 test_ret++;
3638 printf(" %d", n_ctx);
3639 printf(" %d", n_elem);
3640 printf(" %d", n_fullname);
3641 printf(" %d", n_type);
3642 printf(" %d", n_def);
3643 printf(" %d", n_defaultValue);
3644 printf(" %d", n_tree);
3645 printf("\n");
3646 }
3647 }
3648 }
3649 }
3650 }
3651 }
3652 }
3653 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003654 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003655
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003656 return(test_ret);
3657}
3658
3659
3660static int
3661test_xmlSAX2CDataBlock(void) {
3662 int test_ret = 0;
3663
3664 int mem_base;
3665 void * ctx; /* the user data (XML parser context) */
3666 int n_ctx;
3667 xmlChar * value; /* The pcdata content */
3668 int n_value;
3669 int len; /* the block length */
3670 int n_len;
3671
3672 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
3673 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
3674 for (n_len = 0;n_len < gen_nb_int;n_len++) {
3675 mem_base = xmlMemBlocks();
3676 ctx = gen_void_ptr(n_ctx, 0);
3677 value = gen_const_xmlChar_ptr(n_value, 1);
3678 len = gen_int(n_len, 2);
3679
William M. Brackf13f77f2004-11-12 16:03:48 +00003680 xmlSAX2CDataBlock(ctx, (const xmlChar *)value, len);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003681 call_tests++;
3682 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00003683 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003684 des_int(n_len, len, 2);
3685 xmlResetLastError();
3686 if (mem_base != xmlMemBlocks()) {
3687 printf("Leak of %d blocks found in xmlSAX2CDataBlock",
3688 xmlMemBlocks() - mem_base);
3689 test_ret++;
3690 printf(" %d", n_ctx);
3691 printf(" %d", n_value);
3692 printf(" %d", n_len);
3693 printf("\n");
3694 }
3695 }
3696 }
3697 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003698 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003699
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003700 return(test_ret);
3701}
3702
3703
3704static int
3705test_xmlSAX2Characters(void) {
3706 int test_ret = 0;
3707
3708 int mem_base;
3709 void * ctx; /* the user data (XML parser context) */
3710 int n_ctx;
3711 xmlChar * ch; /* a xmlChar string */
3712 int n_ch;
3713 int len; /* the number of xmlChar */
3714 int n_len;
3715
3716 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
3717 for (n_ch = 0;n_ch < gen_nb_const_xmlChar_ptr;n_ch++) {
3718 for (n_len = 0;n_len < gen_nb_int;n_len++) {
3719 mem_base = xmlMemBlocks();
3720 ctx = gen_void_ptr(n_ctx, 0);
3721 ch = gen_const_xmlChar_ptr(n_ch, 1);
3722 len = gen_int(n_len, 2);
3723
William M. Brackf13f77f2004-11-12 16:03:48 +00003724 xmlSAX2Characters(ctx, (const xmlChar *)ch, len);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003725 call_tests++;
3726 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00003727 des_const_xmlChar_ptr(n_ch, (const xmlChar *)ch, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003728 des_int(n_len, len, 2);
3729 xmlResetLastError();
3730 if (mem_base != xmlMemBlocks()) {
3731 printf("Leak of %d blocks found in xmlSAX2Characters",
3732 xmlMemBlocks() - mem_base);
3733 test_ret++;
3734 printf(" %d", n_ctx);
3735 printf(" %d", n_ch);
3736 printf(" %d", n_len);
3737 printf("\n");
3738 }
3739 }
3740 }
3741 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003742 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003743
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003744 return(test_ret);
3745}
3746
3747
3748static int
3749test_xmlSAX2Comment(void) {
3750 int test_ret = 0;
3751
3752 int mem_base;
3753 void * ctx; /* the user data (XML parser context) */
3754 int n_ctx;
3755 xmlChar * value; /* the xmlSAX2Comment content */
3756 int n_value;
3757
3758 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
3759 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
3760 mem_base = xmlMemBlocks();
3761 ctx = gen_void_ptr(n_ctx, 0);
3762 value = gen_const_xmlChar_ptr(n_value, 1);
3763
William M. Brackf13f77f2004-11-12 16:03:48 +00003764 xmlSAX2Comment(ctx, (const xmlChar *)value);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003765 call_tests++;
3766 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00003767 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003768 xmlResetLastError();
3769 if (mem_base != xmlMemBlocks()) {
3770 printf("Leak of %d blocks found in xmlSAX2Comment",
3771 xmlMemBlocks() - mem_base);
3772 test_ret++;
3773 printf(" %d", n_ctx);
3774 printf(" %d", n_value);
3775 printf("\n");
3776 }
3777 }
3778 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003779 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003780
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003781 return(test_ret);
3782}
3783
3784
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003785static int
3786test_xmlSAX2ElementDecl(void) {
3787 int test_ret = 0;
3788
3789 int mem_base;
3790 void * ctx; /* the user data (XML parser context) */
3791 int n_ctx;
3792 xmlChar * name; /* the element name */
3793 int n_name;
3794 int type; /* the element type */
3795 int n_type;
3796 xmlElementContentPtr content; /* the element value tree */
3797 int n_content;
3798
3799 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
3800 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
3801 for (n_type = 0;n_type < gen_nb_int;n_type++) {
3802 for (n_content = 0;n_content < gen_nb_xmlElementContentPtr;n_content++) {
3803 mem_base = xmlMemBlocks();
3804 ctx = gen_void_ptr(n_ctx, 0);
3805 name = gen_const_xmlChar_ptr(n_name, 1);
3806 type = gen_int(n_type, 2);
3807 content = gen_xmlElementContentPtr(n_content, 3);
3808
William M. Brackf13f77f2004-11-12 16:03:48 +00003809 xmlSAX2ElementDecl(ctx, (const xmlChar *)name, type, content);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003810 call_tests++;
3811 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00003812 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003813 des_int(n_type, type, 2);
3814 des_xmlElementContentPtr(n_content, content, 3);
3815 xmlResetLastError();
3816 if (mem_base != xmlMemBlocks()) {
3817 printf("Leak of %d blocks found in xmlSAX2ElementDecl",
3818 xmlMemBlocks() - mem_base);
3819 test_ret++;
3820 printf(" %d", n_ctx);
3821 printf(" %d", n_name);
3822 printf(" %d", n_type);
3823 printf(" %d", n_content);
3824 printf("\n");
3825 }
3826 }
3827 }
3828 }
3829 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003830 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003831
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003832 return(test_ret);
3833}
3834
3835
3836static int
3837test_xmlSAX2EndDocument(void) {
3838 int test_ret = 0;
3839
3840 int mem_base;
3841 void * ctx; /* the user data (XML parser context) */
3842 int n_ctx;
3843
3844 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
3845 mem_base = xmlMemBlocks();
3846 ctx = gen_void_ptr(n_ctx, 0);
3847
3848 xmlSAX2EndDocument(ctx);
3849 call_tests++;
3850 des_void_ptr(n_ctx, ctx, 0);
3851 xmlResetLastError();
3852 if (mem_base != xmlMemBlocks()) {
3853 printf("Leak of %d blocks found in xmlSAX2EndDocument",
3854 xmlMemBlocks() - mem_base);
3855 test_ret++;
3856 printf(" %d", n_ctx);
3857 printf("\n");
3858 }
3859 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003860 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003861
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003862 return(test_ret);
3863}
3864
3865
3866static int
3867test_xmlSAX2EndElement(void) {
3868 int test_ret = 0;
3869
William M. Brack21e4ef22005-01-02 09:53:13 +00003870#if defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_HTML_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +00003871#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003872 int mem_base;
3873 void * ctx; /* the user data (XML parser context) */
3874 int n_ctx;
3875 xmlChar * name; /* The element name */
3876 int n_name;
3877
3878 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
3879 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
3880 mem_base = xmlMemBlocks();
3881 ctx = gen_void_ptr(n_ctx, 0);
3882 name = gen_const_xmlChar_ptr(n_name, 1);
3883
William M. Brackf13f77f2004-11-12 16:03:48 +00003884 xmlSAX2EndElement(ctx, (const xmlChar *)name);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003885 call_tests++;
3886 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00003887 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003888 xmlResetLastError();
3889 if (mem_base != xmlMemBlocks()) {
3890 printf("Leak of %d blocks found in xmlSAX2EndElement",
3891 xmlMemBlocks() - mem_base);
3892 test_ret++;
3893 printf(" %d", n_ctx);
3894 printf(" %d", n_name);
3895 printf("\n");
3896 }
3897 }
3898 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003899 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00003900#endif
William M. Brack21e4ef22005-01-02 09:53:13 +00003901#endif
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003902
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003903 return(test_ret);
3904}
3905
3906
3907static int
3908test_xmlSAX2EndElementNs(void) {
3909 int test_ret = 0;
3910
3911 int mem_base;
3912 void * ctx; /* the user data (XML parser context) */
3913 int n_ctx;
3914 xmlChar * localname; /* the local name of the element */
3915 int n_localname;
3916 xmlChar * prefix; /* the element namespace prefix if available */
3917 int n_prefix;
3918 xmlChar * URI; /* the element namespace name if available */
3919 int n_URI;
3920
3921 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
3922 for (n_localname = 0;n_localname < gen_nb_const_xmlChar_ptr;n_localname++) {
3923 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
3924 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
3925 mem_base = xmlMemBlocks();
3926 ctx = gen_void_ptr(n_ctx, 0);
3927 localname = gen_const_xmlChar_ptr(n_localname, 1);
3928 prefix = gen_const_xmlChar_ptr(n_prefix, 2);
3929 URI = gen_const_xmlChar_ptr(n_URI, 3);
3930
William M. Brackf13f77f2004-11-12 16:03:48 +00003931 xmlSAX2EndElementNs(ctx, (const xmlChar *)localname, (const xmlChar *)prefix, (const xmlChar *)URI);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003932 call_tests++;
3933 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00003934 des_const_xmlChar_ptr(n_localname, (const xmlChar *)localname, 1);
3935 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 2);
3936 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 3);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003937 xmlResetLastError();
3938 if (mem_base != xmlMemBlocks()) {
3939 printf("Leak of %d blocks found in xmlSAX2EndElementNs",
3940 xmlMemBlocks() - mem_base);
3941 test_ret++;
3942 printf(" %d", n_ctx);
3943 printf(" %d", n_localname);
3944 printf(" %d", n_prefix);
3945 printf(" %d", n_URI);
3946 printf("\n");
3947 }
3948 }
3949 }
3950 }
3951 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003952 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003953
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003954 return(test_ret);
3955}
3956
3957
3958static int
3959test_xmlSAX2EntityDecl(void) {
3960 int test_ret = 0;
3961
3962 int mem_base;
3963 void * ctx; /* the user data (XML parser context) */
3964 int n_ctx;
3965 xmlChar * name; /* the entity name */
3966 int n_name;
3967 int type; /* the entity type */
3968 int n_type;
3969 xmlChar * publicId; /* The public ID of the entity */
3970 int n_publicId;
3971 xmlChar * systemId; /* The system ID of the entity */
3972 int n_systemId;
3973 xmlChar * content; /* the entity value (without processing). */
3974 int n_content;
3975
3976 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
3977 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
3978 for (n_type = 0;n_type < gen_nb_int;n_type++) {
3979 for (n_publicId = 0;n_publicId < gen_nb_const_xmlChar_ptr;n_publicId++) {
3980 for (n_systemId = 0;n_systemId < gen_nb_const_xmlChar_ptr;n_systemId++) {
3981 for (n_content = 0;n_content < gen_nb_xmlChar_ptr;n_content++) {
3982 mem_base = xmlMemBlocks();
3983 ctx = gen_void_ptr(n_ctx, 0);
3984 name = gen_const_xmlChar_ptr(n_name, 1);
3985 type = gen_int(n_type, 2);
3986 publicId = gen_const_xmlChar_ptr(n_publicId, 3);
3987 systemId = gen_const_xmlChar_ptr(n_systemId, 4);
3988 content = gen_xmlChar_ptr(n_content, 5);
3989
William M. Brackf13f77f2004-11-12 16:03:48 +00003990 xmlSAX2EntityDecl(ctx, (const xmlChar *)name, type, (const xmlChar *)publicId, (const xmlChar *)systemId, content);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003991 call_tests++;
3992 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00003993 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003994 des_int(n_type, type, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +00003995 des_const_xmlChar_ptr(n_publicId, (const xmlChar *)publicId, 3);
3996 des_const_xmlChar_ptr(n_systemId, (const xmlChar *)systemId, 4);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003997 des_xmlChar_ptr(n_content, content, 5);
3998 xmlResetLastError();
3999 if (mem_base != xmlMemBlocks()) {
4000 printf("Leak of %d blocks found in xmlSAX2EntityDecl",
4001 xmlMemBlocks() - mem_base);
4002 test_ret++;
4003 printf(" %d", n_ctx);
4004 printf(" %d", n_name);
4005 printf(" %d", n_type);
4006 printf(" %d", n_publicId);
4007 printf(" %d", n_systemId);
4008 printf(" %d", n_content);
4009 printf("\n");
4010 }
4011 }
4012 }
4013 }
4014 }
4015 }
4016 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004017 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004018
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004019 return(test_ret);
4020}
4021
4022
4023static int
4024test_xmlSAX2ExternalSubset(void) {
4025 int test_ret = 0;
4026
4027 int mem_base;
4028 void * ctx; /* the user data (XML parser context) */
4029 int n_ctx;
4030 xmlChar * name; /* the root element name */
4031 int n_name;
4032 xmlChar * ExternalID; /* the external ID */
4033 int n_ExternalID;
4034 xmlChar * SystemID; /* the SYSTEM ID (e.g. filename or URL) */
4035 int n_SystemID;
4036
4037 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4038 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4039 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
4040 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
4041 mem_base = xmlMemBlocks();
4042 ctx = gen_void_ptr(n_ctx, 0);
4043 name = gen_const_xmlChar_ptr(n_name, 1);
4044 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 2);
4045 SystemID = gen_const_xmlChar_ptr(n_SystemID, 3);
4046
William M. Brackf13f77f2004-11-12 16:03:48 +00004047 xmlSAX2ExternalSubset(ctx, (const xmlChar *)name, (const xmlChar *)ExternalID, (const xmlChar *)SystemID);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004048 call_tests++;
4049 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004050 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
4051 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 2);
4052 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 3);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004053 xmlResetLastError();
4054 if (mem_base != xmlMemBlocks()) {
4055 printf("Leak of %d blocks found in xmlSAX2ExternalSubset",
4056 xmlMemBlocks() - mem_base);
4057 test_ret++;
4058 printf(" %d", n_ctx);
4059 printf(" %d", n_name);
4060 printf(" %d", n_ExternalID);
4061 printf(" %d", n_SystemID);
4062 printf("\n");
4063 }
4064 }
4065 }
4066 }
4067 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004068 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004069
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004070 return(test_ret);
4071}
4072
4073
4074static int
4075test_xmlSAX2GetColumnNumber(void) {
4076 int test_ret = 0;
4077
4078 int mem_base;
4079 int ret_val;
4080 void * ctx; /* the user data (XML parser context) */
4081 int n_ctx;
4082
4083 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4084 mem_base = xmlMemBlocks();
4085 ctx = gen_void_ptr(n_ctx, 0);
4086
4087 ret_val = xmlSAX2GetColumnNumber(ctx);
4088 desret_int(ret_val);
4089 call_tests++;
4090 des_void_ptr(n_ctx, ctx, 0);
4091 xmlResetLastError();
4092 if (mem_base != xmlMemBlocks()) {
4093 printf("Leak of %d blocks found in xmlSAX2GetColumnNumber",
4094 xmlMemBlocks() - mem_base);
4095 test_ret++;
4096 printf(" %d", n_ctx);
4097 printf("\n");
4098 }
4099 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004100 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004101
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004102 return(test_ret);
4103}
4104
4105
4106static int
4107test_xmlSAX2GetEntity(void) {
4108 int test_ret = 0;
4109
4110 int mem_base;
4111 xmlEntityPtr ret_val;
4112 void * ctx; /* the user data (XML parser context) */
4113 int n_ctx;
4114 xmlChar * name; /* The entity name */
4115 int n_name;
4116
4117 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4118 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4119 mem_base = xmlMemBlocks();
4120 ctx = gen_void_ptr(n_ctx, 0);
4121 name = gen_const_xmlChar_ptr(n_name, 1);
4122
William M. Brackf13f77f2004-11-12 16:03:48 +00004123 ret_val = xmlSAX2GetEntity(ctx, (const xmlChar *)name);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004124 desret_xmlEntityPtr(ret_val);
4125 call_tests++;
4126 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004127 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004128 xmlResetLastError();
4129 if (mem_base != xmlMemBlocks()) {
4130 printf("Leak of %d blocks found in xmlSAX2GetEntity",
4131 xmlMemBlocks() - mem_base);
4132 test_ret++;
4133 printf(" %d", n_ctx);
4134 printf(" %d", n_name);
4135 printf("\n");
4136 }
4137 }
4138 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004139 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004140
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004141 return(test_ret);
4142}
4143
4144
4145static int
4146test_xmlSAX2GetLineNumber(void) {
4147 int test_ret = 0;
4148
4149 int mem_base;
4150 int ret_val;
4151 void * ctx; /* the user data (XML parser context) */
4152 int n_ctx;
4153
4154 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4155 mem_base = xmlMemBlocks();
4156 ctx = gen_void_ptr(n_ctx, 0);
4157
4158 ret_val = xmlSAX2GetLineNumber(ctx);
4159 desret_int(ret_val);
4160 call_tests++;
4161 des_void_ptr(n_ctx, ctx, 0);
4162 xmlResetLastError();
4163 if (mem_base != xmlMemBlocks()) {
4164 printf("Leak of %d blocks found in xmlSAX2GetLineNumber",
4165 xmlMemBlocks() - mem_base);
4166 test_ret++;
4167 printf(" %d", n_ctx);
4168 printf("\n");
4169 }
4170 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004171 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004172
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004173 return(test_ret);
4174}
4175
4176
4177static int
4178test_xmlSAX2GetParameterEntity(void) {
4179 int test_ret = 0;
4180
4181 int mem_base;
4182 xmlEntityPtr ret_val;
4183 void * ctx; /* the user data (XML parser context) */
4184 int n_ctx;
4185 xmlChar * name; /* The entity name */
4186 int n_name;
4187
4188 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4189 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4190 mem_base = xmlMemBlocks();
4191 ctx = gen_void_ptr(n_ctx, 0);
4192 name = gen_const_xmlChar_ptr(n_name, 1);
4193
William M. Brackf13f77f2004-11-12 16:03:48 +00004194 ret_val = xmlSAX2GetParameterEntity(ctx, (const xmlChar *)name);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004195 desret_xmlEntityPtr(ret_val);
4196 call_tests++;
4197 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004198 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004199 xmlResetLastError();
4200 if (mem_base != xmlMemBlocks()) {
4201 printf("Leak of %d blocks found in xmlSAX2GetParameterEntity",
4202 xmlMemBlocks() - mem_base);
4203 test_ret++;
4204 printf(" %d", n_ctx);
4205 printf(" %d", n_name);
4206 printf("\n");
4207 }
4208 }
4209 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004210 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004211
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004212 return(test_ret);
4213}
4214
4215
4216static int
4217test_xmlSAX2GetPublicId(void) {
4218 int test_ret = 0;
4219
4220 int mem_base;
4221 const xmlChar * ret_val;
4222 void * ctx; /* the user data (XML parser context) */
4223 int n_ctx;
4224
4225 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4226 mem_base = xmlMemBlocks();
4227 ctx = gen_void_ptr(n_ctx, 0);
4228
4229 ret_val = xmlSAX2GetPublicId(ctx);
4230 desret_const_xmlChar_ptr(ret_val);
4231 call_tests++;
4232 des_void_ptr(n_ctx, ctx, 0);
4233 xmlResetLastError();
4234 if (mem_base != xmlMemBlocks()) {
4235 printf("Leak of %d blocks found in xmlSAX2GetPublicId",
4236 xmlMemBlocks() - mem_base);
4237 test_ret++;
4238 printf(" %d", n_ctx);
4239 printf("\n");
4240 }
4241 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004242 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004243
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004244 return(test_ret);
4245}
4246
4247
4248static int
4249test_xmlSAX2GetSystemId(void) {
4250 int test_ret = 0;
4251
4252 int mem_base;
4253 const xmlChar * ret_val;
4254 void * ctx; /* the user data (XML parser context) */
4255 int n_ctx;
4256
4257 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4258 mem_base = xmlMemBlocks();
4259 ctx = gen_void_ptr(n_ctx, 0);
4260
4261 ret_val = xmlSAX2GetSystemId(ctx);
4262 desret_const_xmlChar_ptr(ret_val);
4263 call_tests++;
4264 des_void_ptr(n_ctx, ctx, 0);
4265 xmlResetLastError();
4266 if (mem_base != xmlMemBlocks()) {
4267 printf("Leak of %d blocks found in xmlSAX2GetSystemId",
4268 xmlMemBlocks() - mem_base);
4269 test_ret++;
4270 printf(" %d", n_ctx);
4271 printf("\n");
4272 }
4273 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004274 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004275
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004276 return(test_ret);
4277}
4278
4279
4280static int
4281test_xmlSAX2HasExternalSubset(void) {
4282 int test_ret = 0;
4283
4284 int mem_base;
4285 int ret_val;
4286 void * ctx; /* the user data (XML parser context) */
4287 int n_ctx;
4288
4289 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4290 mem_base = xmlMemBlocks();
4291 ctx = gen_void_ptr(n_ctx, 0);
4292
4293 ret_val = xmlSAX2HasExternalSubset(ctx);
4294 desret_int(ret_val);
4295 call_tests++;
4296 des_void_ptr(n_ctx, ctx, 0);
4297 xmlResetLastError();
4298 if (mem_base != xmlMemBlocks()) {
4299 printf("Leak of %d blocks found in xmlSAX2HasExternalSubset",
4300 xmlMemBlocks() - mem_base);
4301 test_ret++;
4302 printf(" %d", n_ctx);
4303 printf("\n");
4304 }
4305 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004306 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004307
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004308 return(test_ret);
4309}
4310
4311
4312static int
4313test_xmlSAX2HasInternalSubset(void) {
4314 int test_ret = 0;
4315
4316 int mem_base;
4317 int ret_val;
4318 void * ctx; /* the user data (XML parser context) */
4319 int n_ctx;
4320
4321 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4322 mem_base = xmlMemBlocks();
4323 ctx = gen_void_ptr(n_ctx, 0);
4324
4325 ret_val = xmlSAX2HasInternalSubset(ctx);
4326 desret_int(ret_val);
4327 call_tests++;
4328 des_void_ptr(n_ctx, ctx, 0);
4329 xmlResetLastError();
4330 if (mem_base != xmlMemBlocks()) {
4331 printf("Leak of %d blocks found in xmlSAX2HasInternalSubset",
4332 xmlMemBlocks() - mem_base);
4333 test_ret++;
4334 printf(" %d", n_ctx);
4335 printf("\n");
4336 }
4337 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004338 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004339
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004340 return(test_ret);
4341}
4342
4343
4344static int
4345test_xmlSAX2IgnorableWhitespace(void) {
4346 int test_ret = 0;
4347
4348 int mem_base;
4349 void * ctx; /* the user data (XML parser context) */
4350 int n_ctx;
4351 xmlChar * ch; /* a xmlChar string */
4352 int n_ch;
4353 int len; /* the number of xmlChar */
4354 int n_len;
4355
4356 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4357 for (n_ch = 0;n_ch < gen_nb_const_xmlChar_ptr;n_ch++) {
4358 for (n_len = 0;n_len < gen_nb_int;n_len++) {
4359 mem_base = xmlMemBlocks();
4360 ctx = gen_void_ptr(n_ctx, 0);
4361 ch = gen_const_xmlChar_ptr(n_ch, 1);
4362 len = gen_int(n_len, 2);
4363
William M. Brackf13f77f2004-11-12 16:03:48 +00004364 xmlSAX2IgnorableWhitespace(ctx, (const xmlChar *)ch, len);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004365 call_tests++;
4366 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004367 des_const_xmlChar_ptr(n_ch, (const xmlChar *)ch, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004368 des_int(n_len, len, 2);
4369 xmlResetLastError();
4370 if (mem_base != xmlMemBlocks()) {
4371 printf("Leak of %d blocks found in xmlSAX2IgnorableWhitespace",
4372 xmlMemBlocks() - mem_base);
4373 test_ret++;
4374 printf(" %d", n_ctx);
4375 printf(" %d", n_ch);
4376 printf(" %d", n_len);
4377 printf("\n");
4378 }
4379 }
4380 }
4381 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004382 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004383
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004384 return(test_ret);
4385}
4386
4387
4388#define gen_nb_xmlSAXHandler_ptr 1
4389static xmlSAXHandler * gen_xmlSAXHandler_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
4390 return(NULL);
4391}
4392static void des_xmlSAXHandler_ptr(int no ATTRIBUTE_UNUSED, xmlSAXHandler * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
4393}
4394
4395static int
4396test_xmlSAX2InitDefaultSAXHandler(void) {
4397 int test_ret = 0;
4398
4399 int mem_base;
4400 xmlSAXHandler * hdlr; /* the SAX handler */
4401 int n_hdlr;
4402 int warning; /* flag if non-zero sets the handler warning procedure */
4403 int n_warning;
4404
4405 for (n_hdlr = 0;n_hdlr < gen_nb_xmlSAXHandler_ptr;n_hdlr++) {
4406 for (n_warning = 0;n_warning < gen_nb_int;n_warning++) {
4407 mem_base = xmlMemBlocks();
4408 hdlr = gen_xmlSAXHandler_ptr(n_hdlr, 0);
4409 warning = gen_int(n_warning, 1);
4410
4411 xmlSAX2InitDefaultSAXHandler(hdlr, warning);
4412 call_tests++;
4413 des_xmlSAXHandler_ptr(n_hdlr, hdlr, 0);
4414 des_int(n_warning, warning, 1);
4415 xmlResetLastError();
4416 if (mem_base != xmlMemBlocks()) {
4417 printf("Leak of %d blocks found in xmlSAX2InitDefaultSAXHandler",
4418 xmlMemBlocks() - mem_base);
4419 test_ret++;
4420 printf(" %d", n_hdlr);
4421 printf(" %d", n_warning);
4422 printf("\n");
4423 }
4424 }
4425 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004426 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004427
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004428 return(test_ret);
4429}
4430
4431
4432static int
4433test_xmlSAX2InitDocbDefaultSAXHandler(void) {
4434 int test_ret = 0;
4435
William M. Brack21e4ef22005-01-02 09:53:13 +00004436#if defined(LIBXML_DOCB_ENABLED)
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004437 int mem_base;
4438 xmlSAXHandler * hdlr; /* the SAX handler */
4439 int n_hdlr;
4440
4441 for (n_hdlr = 0;n_hdlr < gen_nb_xmlSAXHandler_ptr;n_hdlr++) {
4442 mem_base = xmlMemBlocks();
4443 hdlr = gen_xmlSAXHandler_ptr(n_hdlr, 0);
4444
4445 xmlSAX2InitDocbDefaultSAXHandler(hdlr);
4446 call_tests++;
4447 des_xmlSAXHandler_ptr(n_hdlr, hdlr, 0);
4448 xmlResetLastError();
4449 if (mem_base != xmlMemBlocks()) {
4450 printf("Leak of %d blocks found in xmlSAX2InitDocbDefaultSAXHandler",
4451 xmlMemBlocks() - mem_base);
4452 test_ret++;
4453 printf(" %d", n_hdlr);
4454 printf("\n");
4455 }
4456 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004457 function_tests++;
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004458#endif
4459
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004460 return(test_ret);
4461}
4462
4463
4464static int
4465test_xmlSAX2InitHtmlDefaultSAXHandler(void) {
4466 int test_ret = 0;
4467
William M. Brack21e4ef22005-01-02 09:53:13 +00004468#if defined(LIBXML_HTML_ENABLED)
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004469 int mem_base;
4470 xmlSAXHandler * hdlr; /* the SAX handler */
4471 int n_hdlr;
4472
4473 for (n_hdlr = 0;n_hdlr < gen_nb_xmlSAXHandler_ptr;n_hdlr++) {
4474 mem_base = xmlMemBlocks();
4475 hdlr = gen_xmlSAXHandler_ptr(n_hdlr, 0);
4476
4477 xmlSAX2InitHtmlDefaultSAXHandler(hdlr);
4478 call_tests++;
4479 des_xmlSAXHandler_ptr(n_hdlr, hdlr, 0);
4480 xmlResetLastError();
4481 if (mem_base != xmlMemBlocks()) {
4482 printf("Leak of %d blocks found in xmlSAX2InitHtmlDefaultSAXHandler",
4483 xmlMemBlocks() - mem_base);
4484 test_ret++;
4485 printf(" %d", n_hdlr);
4486 printf("\n");
4487 }
4488 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004489 function_tests++;
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004490#endif
4491
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004492 return(test_ret);
4493}
4494
4495
4496static int
4497test_xmlSAX2InternalSubset(void) {
4498 int test_ret = 0;
4499
4500 int mem_base;
4501 void * ctx; /* the user data (XML parser context) */
4502 int n_ctx;
4503 xmlChar * name; /* the root element name */
4504 int n_name;
4505 xmlChar * ExternalID; /* the external ID */
4506 int n_ExternalID;
4507 xmlChar * SystemID; /* the SYSTEM ID (e.g. filename or URL) */
4508 int n_SystemID;
4509
4510 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4511 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4512 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
4513 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
4514 mem_base = xmlMemBlocks();
4515 ctx = gen_void_ptr(n_ctx, 0);
4516 name = gen_const_xmlChar_ptr(n_name, 1);
4517 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 2);
4518 SystemID = gen_const_xmlChar_ptr(n_SystemID, 3);
4519
William M. Brackf13f77f2004-11-12 16:03:48 +00004520 xmlSAX2InternalSubset(ctx, (const xmlChar *)name, (const xmlChar *)ExternalID, (const xmlChar *)SystemID);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004521 call_tests++;
4522 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004523 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
4524 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 2);
4525 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 3);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004526 xmlResetLastError();
4527 if (mem_base != xmlMemBlocks()) {
4528 printf("Leak of %d blocks found in xmlSAX2InternalSubset",
4529 xmlMemBlocks() - mem_base);
4530 test_ret++;
4531 printf(" %d", n_ctx);
4532 printf(" %d", n_name);
4533 printf(" %d", n_ExternalID);
4534 printf(" %d", n_SystemID);
4535 printf("\n");
4536 }
4537 }
4538 }
4539 }
4540 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004541 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004542
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004543 return(test_ret);
4544}
4545
4546
4547static int
4548test_xmlSAX2IsStandalone(void) {
4549 int test_ret = 0;
4550
4551 int mem_base;
4552 int ret_val;
4553 void * ctx; /* the user data (XML parser context) */
4554 int n_ctx;
4555
4556 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4557 mem_base = xmlMemBlocks();
4558 ctx = gen_void_ptr(n_ctx, 0);
4559
4560 ret_val = xmlSAX2IsStandalone(ctx);
4561 desret_int(ret_val);
4562 call_tests++;
4563 des_void_ptr(n_ctx, ctx, 0);
4564 xmlResetLastError();
4565 if (mem_base != xmlMemBlocks()) {
4566 printf("Leak of %d blocks found in xmlSAX2IsStandalone",
4567 xmlMemBlocks() - mem_base);
4568 test_ret++;
4569 printf(" %d", n_ctx);
4570 printf("\n");
4571 }
4572 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004573 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004574
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004575 return(test_ret);
4576}
4577
4578
4579static int
4580test_xmlSAX2NotationDecl(void) {
4581 int test_ret = 0;
4582
4583 int mem_base;
4584 void * ctx; /* the user data (XML parser context) */
4585 int n_ctx;
4586 xmlChar * name; /* The name of the notation */
4587 int n_name;
4588 xmlChar * publicId; /* The public ID of the entity */
4589 int n_publicId;
4590 xmlChar * systemId; /* The system ID of the entity */
4591 int n_systemId;
4592
4593 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4594 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4595 for (n_publicId = 0;n_publicId < gen_nb_const_xmlChar_ptr;n_publicId++) {
4596 for (n_systemId = 0;n_systemId < gen_nb_const_xmlChar_ptr;n_systemId++) {
4597 mem_base = xmlMemBlocks();
4598 ctx = gen_void_ptr(n_ctx, 0);
4599 name = gen_const_xmlChar_ptr(n_name, 1);
4600 publicId = gen_const_xmlChar_ptr(n_publicId, 2);
4601 systemId = gen_const_xmlChar_ptr(n_systemId, 3);
4602
William M. Brackf13f77f2004-11-12 16:03:48 +00004603 xmlSAX2NotationDecl(ctx, (const xmlChar *)name, (const xmlChar *)publicId, (const xmlChar *)systemId);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004604 call_tests++;
4605 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004606 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
4607 des_const_xmlChar_ptr(n_publicId, (const xmlChar *)publicId, 2);
4608 des_const_xmlChar_ptr(n_systemId, (const xmlChar *)systemId, 3);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004609 xmlResetLastError();
4610 if (mem_base != xmlMemBlocks()) {
4611 printf("Leak of %d blocks found in xmlSAX2NotationDecl",
4612 xmlMemBlocks() - mem_base);
4613 test_ret++;
4614 printf(" %d", n_ctx);
4615 printf(" %d", n_name);
4616 printf(" %d", n_publicId);
4617 printf(" %d", n_systemId);
4618 printf("\n");
4619 }
4620 }
4621 }
4622 }
4623 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004624 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004625
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004626 return(test_ret);
4627}
4628
4629
4630static int
4631test_xmlSAX2ProcessingInstruction(void) {
4632 int test_ret = 0;
4633
4634 int mem_base;
4635 void * ctx; /* the user data (XML parser context) */
4636 int n_ctx;
4637 xmlChar * target; /* the target name */
4638 int n_target;
4639 xmlChar * data; /* the PI data's */
4640 int n_data;
4641
4642 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4643 for (n_target = 0;n_target < gen_nb_const_xmlChar_ptr;n_target++) {
4644 for (n_data = 0;n_data < gen_nb_const_xmlChar_ptr;n_data++) {
4645 mem_base = xmlMemBlocks();
4646 ctx = gen_void_ptr(n_ctx, 0);
4647 target = gen_const_xmlChar_ptr(n_target, 1);
4648 data = gen_const_xmlChar_ptr(n_data, 2);
4649
William M. Brackf13f77f2004-11-12 16:03:48 +00004650 xmlSAX2ProcessingInstruction(ctx, (const xmlChar *)target, (const xmlChar *)data);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004651 call_tests++;
4652 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004653 des_const_xmlChar_ptr(n_target, (const xmlChar *)target, 1);
4654 des_const_xmlChar_ptr(n_data, (const xmlChar *)data, 2);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004655 xmlResetLastError();
4656 if (mem_base != xmlMemBlocks()) {
4657 printf("Leak of %d blocks found in xmlSAX2ProcessingInstruction",
4658 xmlMemBlocks() - mem_base);
4659 test_ret++;
4660 printf(" %d", n_ctx);
4661 printf(" %d", n_target);
4662 printf(" %d", n_data);
4663 printf("\n");
4664 }
4665 }
4666 }
4667 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004668 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004669
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004670 return(test_ret);
4671}
4672
4673
4674static int
4675test_xmlSAX2Reference(void) {
4676 int test_ret = 0;
4677
4678 int mem_base;
4679 void * ctx; /* the user data (XML parser context) */
4680 int n_ctx;
4681 xmlChar * name; /* The entity name */
4682 int n_name;
4683
4684 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4685 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4686 mem_base = xmlMemBlocks();
4687 ctx = gen_void_ptr(n_ctx, 0);
4688 name = gen_const_xmlChar_ptr(n_name, 1);
4689
William M. Brackf13f77f2004-11-12 16:03:48 +00004690 xmlSAX2Reference(ctx, (const xmlChar *)name);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004691 call_tests++;
4692 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004693 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004694 xmlResetLastError();
4695 if (mem_base != xmlMemBlocks()) {
4696 printf("Leak of %d blocks found in xmlSAX2Reference",
4697 xmlMemBlocks() - mem_base);
4698 test_ret++;
4699 printf(" %d", n_ctx);
4700 printf(" %d", n_name);
4701 printf("\n");
4702 }
4703 }
4704 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004705 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004706
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004707 return(test_ret);
4708}
4709
4710
4711static int
4712test_xmlSAX2ResolveEntity(void) {
4713 int test_ret = 0;
4714
4715 int mem_base;
4716 xmlParserInputPtr ret_val;
4717 void * ctx; /* the user data (XML parser context) */
4718 int n_ctx;
4719 xmlChar * publicId; /* The public ID of the entity */
4720 int n_publicId;
4721 xmlChar * systemId; /* The system ID of the entity */
4722 int n_systemId;
4723
4724 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4725 for (n_publicId = 0;n_publicId < gen_nb_const_xmlChar_ptr;n_publicId++) {
4726 for (n_systemId = 0;n_systemId < gen_nb_const_xmlChar_ptr;n_systemId++) {
4727 mem_base = xmlMemBlocks();
4728 ctx = gen_void_ptr(n_ctx, 0);
4729 publicId = gen_const_xmlChar_ptr(n_publicId, 1);
4730 systemId = gen_const_xmlChar_ptr(n_systemId, 2);
4731
William M. Brackf13f77f2004-11-12 16:03:48 +00004732 ret_val = xmlSAX2ResolveEntity(ctx, (const xmlChar *)publicId, (const xmlChar *)systemId);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004733 desret_xmlParserInputPtr(ret_val);
4734 call_tests++;
4735 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004736 des_const_xmlChar_ptr(n_publicId, (const xmlChar *)publicId, 1);
4737 des_const_xmlChar_ptr(n_systemId, (const xmlChar *)systemId, 2);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004738 xmlResetLastError();
4739 if (mem_base != xmlMemBlocks()) {
4740 printf("Leak of %d blocks found in xmlSAX2ResolveEntity",
4741 xmlMemBlocks() - mem_base);
4742 test_ret++;
4743 printf(" %d", n_ctx);
4744 printf(" %d", n_publicId);
4745 printf(" %d", n_systemId);
4746 printf("\n");
4747 }
4748 }
4749 }
4750 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004751 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004752
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004753 return(test_ret);
4754}
4755
4756
4757#define gen_nb_xmlSAXLocatorPtr 1
4758static xmlSAXLocatorPtr gen_xmlSAXLocatorPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
4759 return(NULL);
4760}
4761static void des_xmlSAXLocatorPtr(int no ATTRIBUTE_UNUSED, xmlSAXLocatorPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
4762}
4763
4764static int
4765test_xmlSAX2SetDocumentLocator(void) {
4766 int test_ret = 0;
4767
4768 int mem_base;
4769 void * ctx; /* the user data (XML parser context) */
4770 int n_ctx;
4771 xmlSAXLocatorPtr loc; /* A SAX Locator */
4772 int n_loc;
4773
4774 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4775 for (n_loc = 0;n_loc < gen_nb_xmlSAXLocatorPtr;n_loc++) {
4776 mem_base = xmlMemBlocks();
4777 ctx = gen_void_ptr(n_ctx, 0);
4778 loc = gen_xmlSAXLocatorPtr(n_loc, 1);
4779
4780 xmlSAX2SetDocumentLocator(ctx, loc);
4781 call_tests++;
4782 des_void_ptr(n_ctx, ctx, 0);
4783 des_xmlSAXLocatorPtr(n_loc, loc, 1);
4784 xmlResetLastError();
4785 if (mem_base != xmlMemBlocks()) {
4786 printf("Leak of %d blocks found in xmlSAX2SetDocumentLocator",
4787 xmlMemBlocks() - mem_base);
4788 test_ret++;
4789 printf(" %d", n_ctx);
4790 printf(" %d", n_loc);
4791 printf("\n");
4792 }
4793 }
4794 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004795 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004796
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004797 return(test_ret);
4798}
4799
4800
4801static int
4802test_xmlSAX2StartDocument(void) {
4803 int test_ret = 0;
4804
4805 int mem_base;
4806 void * ctx; /* the user data (XML parser context) */
4807 int n_ctx;
4808
4809 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4810 mem_base = xmlMemBlocks();
4811 ctx = gen_void_ptr(n_ctx, 0);
4812
4813 xmlSAX2StartDocument(ctx);
4814 call_tests++;
4815 des_void_ptr(n_ctx, ctx, 0);
4816 xmlResetLastError();
4817 if (mem_base != xmlMemBlocks()) {
4818 printf("Leak of %d blocks found in xmlSAX2StartDocument",
4819 xmlMemBlocks() - mem_base);
4820 test_ret++;
4821 printf(" %d", n_ctx);
4822 printf("\n");
4823 }
4824 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004825 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004826
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004827 return(test_ret);
4828}
4829
4830
4831static int
4832test_xmlSAX2StartElement(void) {
4833 int test_ret = 0;
4834
William M. Brack21e4ef22005-01-02 09:53:13 +00004835#if defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_HTML_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +00004836#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004837 int mem_base;
4838 void * ctx; /* the user data (XML parser context) */
4839 int n_ctx;
4840 xmlChar * fullname; /* The element name, including namespace prefix */
4841 int n_fullname;
4842 xmlChar ** atts; /* An array of name/value attributes pairs, NULL terminated */
4843 int n_atts;
4844
4845 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4846 for (n_fullname = 0;n_fullname < gen_nb_const_xmlChar_ptr;n_fullname++) {
4847 for (n_atts = 0;n_atts < gen_nb_const_xmlChar_ptr_ptr;n_atts++) {
4848 mem_base = xmlMemBlocks();
4849 ctx = gen_void_ptr(n_ctx, 0);
4850 fullname = gen_const_xmlChar_ptr(n_fullname, 1);
4851 atts = gen_const_xmlChar_ptr_ptr(n_atts, 2);
4852
William M. Brackf13f77f2004-11-12 16:03:48 +00004853 xmlSAX2StartElement(ctx, (const xmlChar *)fullname, (const xmlChar **)atts);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004854 call_tests++;
4855 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004856 des_const_xmlChar_ptr(n_fullname, (const xmlChar *)fullname, 1);
4857 des_const_xmlChar_ptr_ptr(n_atts, (const xmlChar **)atts, 2);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004858 xmlResetLastError();
4859 if (mem_base != xmlMemBlocks()) {
4860 printf("Leak of %d blocks found in xmlSAX2StartElement",
4861 xmlMemBlocks() - mem_base);
4862 test_ret++;
4863 printf(" %d", n_ctx);
4864 printf(" %d", n_fullname);
4865 printf(" %d", n_atts);
4866 printf("\n");
4867 }
4868 }
4869 }
4870 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004871 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00004872#endif
William M. Brack21e4ef22005-01-02 09:53:13 +00004873#endif
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004874
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004875 return(test_ret);
4876}
4877
4878
4879static int
4880test_xmlSAX2StartElementNs(void) {
4881 int test_ret = 0;
4882
4883 int mem_base;
4884 void * ctx; /* the user data (XML parser context) */
4885 int n_ctx;
4886 xmlChar * localname; /* the local name of the element */
4887 int n_localname;
4888 xmlChar * prefix; /* the element namespace prefix if available */
4889 int n_prefix;
4890 xmlChar * URI; /* the element namespace name if available */
4891 int n_URI;
4892 int nb_namespaces; /* number of namespace definitions on that node */
4893 int n_nb_namespaces;
4894 xmlChar ** namespaces; /* pointer to the array of prefix/URI pairs namespace definitions */
4895 int n_namespaces;
4896 int nb_attributes; /* the number of attributes on that node */
4897 int n_nb_attributes;
4898 int nb_defaulted; /* the number of defaulted attributes. */
4899 int n_nb_defaulted;
4900 xmlChar ** attributes; /* pointer to the array of (localname/prefix/URI/value/end) attribute values. */
4901 int n_attributes;
4902
4903 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4904 for (n_localname = 0;n_localname < gen_nb_const_xmlChar_ptr;n_localname++) {
4905 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
4906 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
4907 for (n_nb_namespaces = 0;n_nb_namespaces < gen_nb_int;n_nb_namespaces++) {
4908 for (n_namespaces = 0;n_namespaces < gen_nb_const_xmlChar_ptr_ptr;n_namespaces++) {
4909 for (n_nb_attributes = 0;n_nb_attributes < gen_nb_int;n_nb_attributes++) {
4910 for (n_nb_defaulted = 0;n_nb_defaulted < gen_nb_int;n_nb_defaulted++) {
4911 for (n_attributes = 0;n_attributes < gen_nb_const_xmlChar_ptr_ptr;n_attributes++) {
4912 mem_base = xmlMemBlocks();
4913 ctx = gen_void_ptr(n_ctx, 0);
4914 localname = gen_const_xmlChar_ptr(n_localname, 1);
4915 prefix = gen_const_xmlChar_ptr(n_prefix, 2);
4916 URI = gen_const_xmlChar_ptr(n_URI, 3);
4917 nb_namespaces = gen_int(n_nb_namespaces, 4);
4918 namespaces = gen_const_xmlChar_ptr_ptr(n_namespaces, 5);
4919 nb_attributes = gen_int(n_nb_attributes, 6);
4920 nb_defaulted = gen_int(n_nb_defaulted, 7);
4921 attributes = gen_const_xmlChar_ptr_ptr(n_attributes, 8);
4922
William M. Brackf13f77f2004-11-12 16:03:48 +00004923 xmlSAX2StartElementNs(ctx, (const xmlChar *)localname, (const xmlChar *)prefix, (const xmlChar *)URI, nb_namespaces, (const xmlChar **)namespaces, nb_attributes, nb_defaulted, (const xmlChar **)attributes);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004924 call_tests++;
4925 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004926 des_const_xmlChar_ptr(n_localname, (const xmlChar *)localname, 1);
4927 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 2);
4928 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 3);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004929 des_int(n_nb_namespaces, nb_namespaces, 4);
William M. Brackf13f77f2004-11-12 16:03:48 +00004930 des_const_xmlChar_ptr_ptr(n_namespaces, (const xmlChar **)namespaces, 5);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004931 des_int(n_nb_attributes, nb_attributes, 6);
4932 des_int(n_nb_defaulted, nb_defaulted, 7);
William M. Brackf13f77f2004-11-12 16:03:48 +00004933 des_const_xmlChar_ptr_ptr(n_attributes, (const xmlChar **)attributes, 8);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004934 xmlResetLastError();
4935 if (mem_base != xmlMemBlocks()) {
4936 printf("Leak of %d blocks found in xmlSAX2StartElementNs",
4937 xmlMemBlocks() - mem_base);
4938 test_ret++;
4939 printf(" %d", n_ctx);
4940 printf(" %d", n_localname);
4941 printf(" %d", n_prefix);
4942 printf(" %d", n_URI);
4943 printf(" %d", n_nb_namespaces);
4944 printf(" %d", n_namespaces);
4945 printf(" %d", n_nb_attributes);
4946 printf(" %d", n_nb_defaulted);
4947 printf(" %d", n_attributes);
4948 printf("\n");
4949 }
4950 }
4951 }
4952 }
4953 }
4954 }
4955 }
4956 }
4957 }
4958 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004959 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004960
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004961 return(test_ret);
4962}
4963
4964
4965static int
4966test_xmlSAX2UnparsedEntityDecl(void) {
4967 int test_ret = 0;
4968
4969 int mem_base;
4970 void * ctx; /* the user data (XML parser context) */
4971 int n_ctx;
4972 xmlChar * name; /* The name of the entity */
4973 int n_name;
4974 xmlChar * publicId; /* The public ID of the entity */
4975 int n_publicId;
4976 xmlChar * systemId; /* The system ID of the entity */
4977 int n_systemId;
4978 xmlChar * notationName; /* the name of the notation */
4979 int n_notationName;
4980
4981 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4982 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4983 for (n_publicId = 0;n_publicId < gen_nb_const_xmlChar_ptr;n_publicId++) {
4984 for (n_systemId = 0;n_systemId < gen_nb_const_xmlChar_ptr;n_systemId++) {
4985 for (n_notationName = 0;n_notationName < gen_nb_const_xmlChar_ptr;n_notationName++) {
4986 mem_base = xmlMemBlocks();
4987 ctx = gen_void_ptr(n_ctx, 0);
4988 name = gen_const_xmlChar_ptr(n_name, 1);
4989 publicId = gen_const_xmlChar_ptr(n_publicId, 2);
4990 systemId = gen_const_xmlChar_ptr(n_systemId, 3);
4991 notationName = gen_const_xmlChar_ptr(n_notationName, 4);
4992
William M. Brackf13f77f2004-11-12 16:03:48 +00004993 xmlSAX2UnparsedEntityDecl(ctx, (const xmlChar *)name, (const xmlChar *)publicId, (const xmlChar *)systemId, (const xmlChar *)notationName);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004994 call_tests++;
4995 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004996 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
4997 des_const_xmlChar_ptr(n_publicId, (const xmlChar *)publicId, 2);
4998 des_const_xmlChar_ptr(n_systemId, (const xmlChar *)systemId, 3);
4999 des_const_xmlChar_ptr(n_notationName, (const xmlChar *)notationName, 4);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005000 xmlResetLastError();
5001 if (mem_base != xmlMemBlocks()) {
5002 printf("Leak of %d blocks found in xmlSAX2UnparsedEntityDecl",
5003 xmlMemBlocks() - mem_base);
5004 test_ret++;
5005 printf(" %d", n_ctx);
5006 printf(" %d", n_name);
5007 printf(" %d", n_publicId);
5008 printf(" %d", n_systemId);
5009 printf(" %d", n_notationName);
5010 printf("\n");
5011 }
5012 }
5013 }
5014 }
5015 }
5016 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005017 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005018
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005019 return(test_ret);
5020}
5021
5022
5023static int
5024test_xmlSAXDefaultVersion(void) {
5025 int test_ret = 0;
5026
William M. Brack21e4ef22005-01-02 09:53:13 +00005027#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +00005028#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005029 int mem_base;
5030 int ret_val;
5031 int version; /* the version, 1 or 2 */
5032 int n_version;
5033
5034 for (n_version = 0;n_version < gen_nb_int;n_version++) {
5035 mem_base = xmlMemBlocks();
5036 version = gen_int(n_version, 0);
5037
5038 ret_val = xmlSAXDefaultVersion(version);
5039 desret_int(ret_val);
5040 call_tests++;
5041 des_int(n_version, version, 0);
5042 xmlResetLastError();
5043 if (mem_base != xmlMemBlocks()) {
5044 printf("Leak of %d blocks found in xmlSAXDefaultVersion",
5045 xmlMemBlocks() - mem_base);
5046 test_ret++;
5047 printf(" %d", n_version);
5048 printf("\n");
5049 }
5050 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005051 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00005052#endif
William M. Brack21e4ef22005-01-02 09:53:13 +00005053#endif
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005054
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005055 return(test_ret);
5056}
5057
5058
5059static int
5060test_xmlSAXVersion(void) {
5061 int test_ret = 0;
5062
5063 int mem_base;
5064 int ret_val;
5065 xmlSAXHandler * hdlr; /* the SAX handler */
5066 int n_hdlr;
5067 int version; /* the version, 1 or 2 */
5068 int n_version;
5069
5070 for (n_hdlr = 0;n_hdlr < gen_nb_xmlSAXHandler_ptr;n_hdlr++) {
5071 for (n_version = 0;n_version < gen_nb_int;n_version++) {
5072 mem_base = xmlMemBlocks();
5073 hdlr = gen_xmlSAXHandler_ptr(n_hdlr, 0);
5074 version = gen_int(n_version, 1);
5075
5076 ret_val = xmlSAXVersion(hdlr, version);
5077 desret_int(ret_val);
5078 call_tests++;
5079 des_xmlSAXHandler_ptr(n_hdlr, hdlr, 0);
5080 des_int(n_version, version, 1);
5081 xmlResetLastError();
5082 if (mem_base != xmlMemBlocks()) {
5083 printf("Leak of %d blocks found in xmlSAXVersion",
5084 xmlMemBlocks() - mem_base);
5085 test_ret++;
5086 printf(" %d", n_hdlr);
5087 printf(" %d", n_version);
5088 printf("\n");
5089 }
5090 }
5091 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005092 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005093
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005094 return(test_ret);
5095}
5096
5097static int
5098test_SAX2(void) {
5099 int test_ret = 0;
5100
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005101 if (quiet == 0) printf("Testing SAX2 : 38 of 38 functions ...\n");
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005102 test_ret += test_docbDefaultSAXHandlerInit();
5103 test_ret += test_htmlDefaultSAXHandlerInit();
5104 test_ret += test_xmlDefaultSAXHandlerInit();
5105 test_ret += test_xmlSAX2AttributeDecl();
5106 test_ret += test_xmlSAX2CDataBlock();
5107 test_ret += test_xmlSAX2Characters();
5108 test_ret += test_xmlSAX2Comment();
5109 test_ret += test_xmlSAX2ElementDecl();
5110 test_ret += test_xmlSAX2EndDocument();
5111 test_ret += test_xmlSAX2EndElement();
5112 test_ret += test_xmlSAX2EndElementNs();
5113 test_ret += test_xmlSAX2EntityDecl();
5114 test_ret += test_xmlSAX2ExternalSubset();
5115 test_ret += test_xmlSAX2GetColumnNumber();
5116 test_ret += test_xmlSAX2GetEntity();
5117 test_ret += test_xmlSAX2GetLineNumber();
5118 test_ret += test_xmlSAX2GetParameterEntity();
5119 test_ret += test_xmlSAX2GetPublicId();
5120 test_ret += test_xmlSAX2GetSystemId();
5121 test_ret += test_xmlSAX2HasExternalSubset();
5122 test_ret += test_xmlSAX2HasInternalSubset();
5123 test_ret += test_xmlSAX2IgnorableWhitespace();
5124 test_ret += test_xmlSAX2InitDefaultSAXHandler();
5125 test_ret += test_xmlSAX2InitDocbDefaultSAXHandler();
5126 test_ret += test_xmlSAX2InitHtmlDefaultSAXHandler();
5127 test_ret += test_xmlSAX2InternalSubset();
5128 test_ret += test_xmlSAX2IsStandalone();
5129 test_ret += test_xmlSAX2NotationDecl();
5130 test_ret += test_xmlSAX2ProcessingInstruction();
5131 test_ret += test_xmlSAX2Reference();
5132 test_ret += test_xmlSAX2ResolveEntity();
5133 test_ret += test_xmlSAX2SetDocumentLocator();
5134 test_ret += test_xmlSAX2StartDocument();
5135 test_ret += test_xmlSAX2StartElement();
5136 test_ret += test_xmlSAX2StartElementNs();
5137 test_ret += test_xmlSAX2UnparsedEntityDecl();
5138 test_ret += test_xmlSAXDefaultVersion();
5139 test_ret += test_xmlSAXVersion();
5140
5141 if (test_ret != 0)
5142 printf("Module SAX2: %d errors\n", test_ret);
5143 return(test_ret);
5144}
5145
Daniel Veillarda82b1822004-11-08 16:24:57 +00005146static int
5147test_xmlC14NDocDumpMemory(void) {
5148 int test_ret = 0;
5149
William M. Brack21e4ef22005-01-02 09:53:13 +00005150#if defined(LIBXML_C14N_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00005151 int mem_base;
5152 int ret_val;
5153 xmlDocPtr doc; /* the XML document for canonization */
5154 int n_doc;
5155 xmlNodeSetPtr nodes; /* the nodes set to be included in the canonized image or NULL if all document nodes should be included */
5156 int n_nodes;
5157 int exclusive; /* the exclusive flag (0 - non-exclusive canonicalization; otherwise - exclusive canonicalization) */
5158 int n_exclusive;
5159 xmlChar ** inclusive_ns_prefixes; /* the list of inclusive namespace prefixes ended with a NULL or NULL if there is no inclusive namespaces (only for exclusive canonicalization, ignored otherwise) */
5160 int n_inclusive_ns_prefixes;
5161 int with_comments; /* include comments in the result (!=0) or not (==0) */
5162 int n_with_comments;
5163 xmlChar ** doc_txt_ptr; /* the memory pointer for allocated canonical XML text; the caller of this functions is responsible for calling xmlFree() to free allocated memory */
5164 int n_doc_txt_ptr;
5165
5166 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
5167 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
5168 for (n_exclusive = 0;n_exclusive < gen_nb_int;n_exclusive++) {
5169 for (n_inclusive_ns_prefixes = 0;n_inclusive_ns_prefixes < gen_nb_xmlChar_ptr_ptr;n_inclusive_ns_prefixes++) {
5170 for (n_with_comments = 0;n_with_comments < gen_nb_int;n_with_comments++) {
5171 for (n_doc_txt_ptr = 0;n_doc_txt_ptr < gen_nb_xmlChar_ptr_ptr;n_doc_txt_ptr++) {
5172 mem_base = xmlMemBlocks();
5173 doc = gen_xmlDocPtr(n_doc, 0);
5174 nodes = gen_xmlNodeSetPtr(n_nodes, 1);
5175 exclusive = gen_int(n_exclusive, 2);
5176 inclusive_ns_prefixes = gen_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, 3);
5177 with_comments = gen_int(n_with_comments, 4);
5178 doc_txt_ptr = gen_xmlChar_ptr_ptr(n_doc_txt_ptr, 5);
5179
5180 ret_val = xmlC14NDocDumpMemory(doc, nodes, exclusive, inclusive_ns_prefixes, with_comments, doc_txt_ptr);
5181 desret_int(ret_val);
5182 call_tests++;
5183 des_xmlDocPtr(n_doc, doc, 0);
5184 des_xmlNodeSetPtr(n_nodes, nodes, 1);
5185 des_int(n_exclusive, exclusive, 2);
5186 des_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, inclusive_ns_prefixes, 3);
5187 des_int(n_with_comments, with_comments, 4);
5188 des_xmlChar_ptr_ptr(n_doc_txt_ptr, doc_txt_ptr, 5);
5189 xmlResetLastError();
5190 if (mem_base != xmlMemBlocks()) {
5191 printf("Leak of %d blocks found in xmlC14NDocDumpMemory",
5192 xmlMemBlocks() - mem_base);
5193 test_ret++;
5194 printf(" %d", n_doc);
5195 printf(" %d", n_nodes);
5196 printf(" %d", n_exclusive);
5197 printf(" %d", n_inclusive_ns_prefixes);
5198 printf(" %d", n_with_comments);
5199 printf(" %d", n_doc_txt_ptr);
5200 printf("\n");
5201 }
5202 }
5203 }
5204 }
5205 }
5206 }
5207 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005208 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00005209#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00005210
Daniel Veillarda82b1822004-11-08 16:24:57 +00005211 return(test_ret);
5212}
5213
5214
5215static int
5216test_xmlC14NDocSave(void) {
5217 int test_ret = 0;
5218
William M. Brack21e4ef22005-01-02 09:53:13 +00005219#if defined(LIBXML_C14N_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00005220 int mem_base;
5221 int ret_val;
5222 xmlDocPtr doc; /* the XML document for canonization */
5223 int n_doc;
5224 xmlNodeSetPtr nodes; /* the nodes set to be included in the canonized image or NULL if all document nodes should be included */
5225 int n_nodes;
5226 int exclusive; /* the exclusive flag (0 - non-exclusive canonicalization; otherwise - exclusive canonicalization) */
5227 int n_exclusive;
5228 xmlChar ** inclusive_ns_prefixes; /* the list of inclusive namespace prefixes ended with a NULL or NULL if there is no inclusive namespaces (only for exclusive canonicalization, ignored otherwise) */
5229 int n_inclusive_ns_prefixes;
5230 int with_comments; /* include comments in the result (!=0) or not (==0) */
5231 int n_with_comments;
5232 const char * filename; /* the filename to store canonical XML image */
5233 int n_filename;
5234 int compression; /* the compression level (zlib requred): -1 - libxml default, 0 - uncompressed, >0 - compression level */
5235 int n_compression;
5236
5237 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
5238 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
5239 for (n_exclusive = 0;n_exclusive < gen_nb_int;n_exclusive++) {
5240 for (n_inclusive_ns_prefixes = 0;n_inclusive_ns_prefixes < gen_nb_xmlChar_ptr_ptr;n_inclusive_ns_prefixes++) {
5241 for (n_with_comments = 0;n_with_comments < gen_nb_int;n_with_comments++) {
5242 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
5243 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
5244 mem_base = xmlMemBlocks();
5245 doc = gen_xmlDocPtr(n_doc, 0);
5246 nodes = gen_xmlNodeSetPtr(n_nodes, 1);
5247 exclusive = gen_int(n_exclusive, 2);
5248 inclusive_ns_prefixes = gen_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, 3);
5249 with_comments = gen_int(n_with_comments, 4);
5250 filename = gen_fileoutput(n_filename, 5);
5251 compression = gen_int(n_compression, 6);
5252
5253 ret_val = xmlC14NDocSave(doc, nodes, exclusive, inclusive_ns_prefixes, with_comments, filename, compression);
5254 desret_int(ret_val);
5255 call_tests++;
5256 des_xmlDocPtr(n_doc, doc, 0);
5257 des_xmlNodeSetPtr(n_nodes, nodes, 1);
5258 des_int(n_exclusive, exclusive, 2);
5259 des_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, inclusive_ns_prefixes, 3);
5260 des_int(n_with_comments, with_comments, 4);
5261 des_fileoutput(n_filename, filename, 5);
5262 des_int(n_compression, compression, 6);
5263 xmlResetLastError();
5264 if (mem_base != xmlMemBlocks()) {
5265 printf("Leak of %d blocks found in xmlC14NDocSave",
5266 xmlMemBlocks() - mem_base);
5267 test_ret++;
5268 printf(" %d", n_doc);
5269 printf(" %d", n_nodes);
5270 printf(" %d", n_exclusive);
5271 printf(" %d", n_inclusive_ns_prefixes);
5272 printf(" %d", n_with_comments);
5273 printf(" %d", n_filename);
5274 printf(" %d", n_compression);
5275 printf("\n");
5276 }
5277 }
5278 }
5279 }
5280 }
5281 }
5282 }
5283 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005284 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00005285#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00005286
Daniel Veillarda82b1822004-11-08 16:24:57 +00005287 return(test_ret);
5288}
5289
5290
5291static int
5292test_xmlC14NDocSaveTo(void) {
5293 int test_ret = 0;
5294
William M. Brack21e4ef22005-01-02 09:53:13 +00005295#if defined(LIBXML_C14N_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00005296 int mem_base;
5297 int ret_val;
5298 xmlDocPtr doc; /* the XML document for canonization */
5299 int n_doc;
5300 xmlNodeSetPtr nodes; /* the nodes set to be included in the canonized image or NULL if all document nodes should be included */
5301 int n_nodes;
5302 int exclusive; /* the exclusive flag (0 - non-exclusive canonicalization; otherwise - exclusive canonicalization) */
5303 int n_exclusive;
5304 xmlChar ** inclusive_ns_prefixes; /* the list of inclusive namespace prefixes ended with a NULL or NULL if there is no inclusive namespaces (only for exclusive canonicalization, ignored otherwise) */
5305 int n_inclusive_ns_prefixes;
5306 int with_comments; /* include comments in the result (!=0) or not (==0) */
5307 int n_with_comments;
5308 xmlOutputBufferPtr buf; /* the output buffer to store canonical XML; this buffer MUST have encoder==NULL because C14N requires UTF-8 output */
5309 int n_buf;
5310
5311 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
5312 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
5313 for (n_exclusive = 0;n_exclusive < gen_nb_int;n_exclusive++) {
5314 for (n_inclusive_ns_prefixes = 0;n_inclusive_ns_prefixes < gen_nb_xmlChar_ptr_ptr;n_inclusive_ns_prefixes++) {
5315 for (n_with_comments = 0;n_with_comments < gen_nb_int;n_with_comments++) {
5316 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
5317 mem_base = xmlMemBlocks();
5318 doc = gen_xmlDocPtr(n_doc, 0);
5319 nodes = gen_xmlNodeSetPtr(n_nodes, 1);
5320 exclusive = gen_int(n_exclusive, 2);
5321 inclusive_ns_prefixes = gen_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, 3);
5322 with_comments = gen_int(n_with_comments, 4);
5323 buf = gen_xmlOutputBufferPtr(n_buf, 5);
5324
5325 ret_val = xmlC14NDocSaveTo(doc, nodes, exclusive, inclusive_ns_prefixes, with_comments, buf);
5326 desret_int(ret_val);
5327 call_tests++;
5328 des_xmlDocPtr(n_doc, doc, 0);
5329 des_xmlNodeSetPtr(n_nodes, nodes, 1);
5330 des_int(n_exclusive, exclusive, 2);
5331 des_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, inclusive_ns_prefixes, 3);
5332 des_int(n_with_comments, with_comments, 4);
5333 des_xmlOutputBufferPtr(n_buf, buf, 5);
5334 xmlResetLastError();
5335 if (mem_base != xmlMemBlocks()) {
5336 printf("Leak of %d blocks found in xmlC14NDocSaveTo",
5337 xmlMemBlocks() - mem_base);
5338 test_ret++;
5339 printf(" %d", n_doc);
5340 printf(" %d", n_nodes);
5341 printf(" %d", n_exclusive);
5342 printf(" %d", n_inclusive_ns_prefixes);
5343 printf(" %d", n_with_comments);
5344 printf(" %d", n_buf);
5345 printf("\n");
5346 }
5347 }
5348 }
5349 }
5350 }
5351 }
5352 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005353 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00005354#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00005355
Daniel Veillarda82b1822004-11-08 16:24:57 +00005356 return(test_ret);
5357}
5358
5359
5360static int
5361test_xmlC14NExecute(void) {
5362 int test_ret = 0;
5363
5364
5365 /* missing type support */
5366 return(test_ret);
5367}
5368
5369static int
5370test_c14n(void) {
5371 int test_ret = 0;
5372
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005373 if (quiet == 0) printf("Testing c14n : 3 of 4 functions ...\n");
Daniel Veillarda82b1822004-11-08 16:24:57 +00005374 test_ret += test_xmlC14NDocDumpMemory();
5375 test_ret += test_xmlC14NDocSave();
5376 test_ret += test_xmlC14NDocSaveTo();
5377 test_ret += test_xmlC14NExecute();
5378
5379 if (test_ret != 0)
5380 printf("Module c14n: %d errors\n", test_ret);
5381 return(test_ret);
5382}
Daniel Veillarda521d282004-11-09 14:59:59 +00005383#ifdef LIBXML_CATALOG_ENABLED
Daniel Veillarda82b1822004-11-08 16:24:57 +00005384
Daniel Veillardce682bc2004-11-05 17:22:25 +00005385#define gen_nb_xmlCatalogPtr 1
5386static xmlCatalogPtr gen_xmlCatalogPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
5387 return(NULL);
5388}
5389static void des_xmlCatalogPtr(int no ATTRIBUTE_UNUSED, xmlCatalogPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
5390}
Daniel Veillarda521d282004-11-09 14:59:59 +00005391#endif
5392
Daniel Veillardce682bc2004-11-05 17:22:25 +00005393
Daniel Veillardd93f6252004-11-02 15:53:51 +00005394static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00005395test_xmlACatalogAdd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005396 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005397
William M. Brack21e4ef22005-01-02 09:53:13 +00005398#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00005399 int mem_base;
5400 int ret_val;
5401 xmlCatalogPtr catal; /* a Catalog */
5402 int n_catal;
5403 xmlChar * type; /* the type of record to add to the catalog */
5404 int n_type;
5405 xmlChar * orig; /* the system, public or prefix to match */
5406 int n_orig;
5407 xmlChar * replace; /* the replacement value for the match */
5408 int n_replace;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005409
Daniel Veillardce682bc2004-11-05 17:22:25 +00005410 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5411 for (n_type = 0;n_type < gen_nb_const_xmlChar_ptr;n_type++) {
5412 for (n_orig = 0;n_orig < gen_nb_const_xmlChar_ptr;n_orig++) {
5413 for (n_replace = 0;n_replace < gen_nb_const_xmlChar_ptr;n_replace++) {
5414 mem_base = xmlMemBlocks();
5415 catal = gen_xmlCatalogPtr(n_catal, 0);
5416 type = gen_const_xmlChar_ptr(n_type, 1);
5417 orig = gen_const_xmlChar_ptr(n_orig, 2);
5418 replace = gen_const_xmlChar_ptr(n_replace, 3);
5419
William M. Brackf13f77f2004-11-12 16:03:48 +00005420 ret_val = xmlACatalogAdd(catal, (const xmlChar *)type, (const xmlChar *)orig, (const xmlChar *)replace);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005421 desret_int(ret_val);
5422 call_tests++;
5423 des_xmlCatalogPtr(n_catal, catal, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00005424 des_const_xmlChar_ptr(n_type, (const xmlChar *)type, 1);
5425 des_const_xmlChar_ptr(n_orig, (const xmlChar *)orig, 2);
5426 des_const_xmlChar_ptr(n_replace, (const xmlChar *)replace, 3);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005427 xmlResetLastError();
5428 if (mem_base != xmlMemBlocks()) {
5429 printf("Leak of %d blocks found in xmlACatalogAdd",
5430 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005431 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005432 printf(" %d", n_catal);
5433 printf(" %d", n_type);
5434 printf(" %d", n_orig);
5435 printf(" %d", n_replace);
5436 printf("\n");
5437 }
5438 }
5439 }
5440 }
5441 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005442 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005443#endif
5444
Daniel Veillard42595322004-11-08 10:52:06 +00005445 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005446}
5447
5448
5449static int
5450test_xmlACatalogDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005451 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005452
William M. Brack21e4ef22005-01-02 09:53:13 +00005453#if defined(LIBXML_CATALOG_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00005454 int mem_base;
5455 xmlCatalogPtr catal; /* a Catalog */
5456 int n_catal;
5457 FILE * out; /* the file. */
5458 int n_out;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005459
Daniel Veillardce682bc2004-11-05 17:22:25 +00005460 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5461 for (n_out = 0;n_out < gen_nb_FILE_ptr;n_out++) {
5462 mem_base = xmlMemBlocks();
5463 catal = gen_xmlCatalogPtr(n_catal, 0);
5464 out = gen_FILE_ptr(n_out, 1);
5465
5466 xmlACatalogDump(catal, out);
5467 call_tests++;
5468 des_xmlCatalogPtr(n_catal, catal, 0);
5469 des_FILE_ptr(n_out, out, 1);
5470 xmlResetLastError();
5471 if (mem_base != xmlMemBlocks()) {
5472 printf("Leak of %d blocks found in xmlACatalogDump",
5473 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005474 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005475 printf(" %d", n_catal);
5476 printf(" %d", n_out);
5477 printf("\n");
5478 }
5479 }
5480 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005481 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005482#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +00005483
Daniel Veillard42595322004-11-08 10:52:06 +00005484 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005485}
5486
5487
5488static int
5489test_xmlACatalogRemove(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005490 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005491
William M. Brack21e4ef22005-01-02 09:53:13 +00005492#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00005493 int mem_base;
5494 int ret_val;
5495 xmlCatalogPtr catal; /* a Catalog */
5496 int n_catal;
5497 xmlChar * value; /* the value to remove */
5498 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005499
Daniel Veillardce682bc2004-11-05 17:22:25 +00005500 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5501 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
5502 mem_base = xmlMemBlocks();
5503 catal = gen_xmlCatalogPtr(n_catal, 0);
5504 value = gen_const_xmlChar_ptr(n_value, 1);
5505
William M. Brackf13f77f2004-11-12 16:03:48 +00005506 ret_val = xmlACatalogRemove(catal, (const xmlChar *)value);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005507 desret_int(ret_val);
5508 call_tests++;
5509 des_xmlCatalogPtr(n_catal, catal, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00005510 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005511 xmlResetLastError();
5512 if (mem_base != xmlMemBlocks()) {
5513 printf("Leak of %d blocks found in xmlACatalogRemove",
5514 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005515 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005516 printf(" %d", n_catal);
5517 printf(" %d", n_value);
5518 printf("\n");
5519 }
5520 }
5521 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005522 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005523#endif
5524
Daniel Veillard42595322004-11-08 10:52:06 +00005525 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005526}
5527
5528
5529static int
5530test_xmlACatalogResolve(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005531 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005532
William M. Brack21e4ef22005-01-02 09:53:13 +00005533#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00005534 int mem_base;
5535 xmlChar * ret_val;
5536 xmlCatalogPtr catal; /* a Catalog */
5537 int n_catal;
5538 xmlChar * pubID; /* the public ID string */
5539 int n_pubID;
5540 xmlChar * sysID; /* the system ID string */
5541 int n_sysID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005542
Daniel Veillardce682bc2004-11-05 17:22:25 +00005543 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5544 for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) {
5545 for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) {
5546 mem_base = xmlMemBlocks();
5547 catal = gen_xmlCatalogPtr(n_catal, 0);
5548 pubID = gen_const_xmlChar_ptr(n_pubID, 1);
5549 sysID = gen_const_xmlChar_ptr(n_sysID, 2);
5550
William M. Brackf13f77f2004-11-12 16:03:48 +00005551 ret_val = xmlACatalogResolve(catal, (const xmlChar *)pubID, (const xmlChar *)sysID);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005552 desret_xmlChar_ptr(ret_val);
5553 call_tests++;
5554 des_xmlCatalogPtr(n_catal, catal, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00005555 des_const_xmlChar_ptr(n_pubID, (const xmlChar *)pubID, 1);
5556 des_const_xmlChar_ptr(n_sysID, (const xmlChar *)sysID, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005557 xmlResetLastError();
5558 if (mem_base != xmlMemBlocks()) {
5559 printf("Leak of %d blocks found in xmlACatalogResolve",
5560 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005561 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005562 printf(" %d", n_catal);
5563 printf(" %d", n_pubID);
5564 printf(" %d", n_sysID);
5565 printf("\n");
5566 }
5567 }
5568 }
5569 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005570 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005571#endif
5572
Daniel Veillard42595322004-11-08 10:52:06 +00005573 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005574}
5575
5576
5577static int
5578test_xmlACatalogResolvePublic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005579 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005580
William M. Brack21e4ef22005-01-02 09:53:13 +00005581#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00005582 int mem_base;
5583 xmlChar * ret_val;
5584 xmlCatalogPtr catal; /* a Catalog */
5585 int n_catal;
5586 xmlChar * pubID; /* the public ID string */
5587 int n_pubID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005588
Daniel Veillardce682bc2004-11-05 17:22:25 +00005589 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5590 for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) {
5591 mem_base = xmlMemBlocks();
5592 catal = gen_xmlCatalogPtr(n_catal, 0);
5593 pubID = gen_const_xmlChar_ptr(n_pubID, 1);
5594
William M. Brackf13f77f2004-11-12 16:03:48 +00005595 ret_val = xmlACatalogResolvePublic(catal, (const xmlChar *)pubID);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005596 desret_xmlChar_ptr(ret_val);
5597 call_tests++;
5598 des_xmlCatalogPtr(n_catal, catal, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00005599 des_const_xmlChar_ptr(n_pubID, (const xmlChar *)pubID, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005600 xmlResetLastError();
5601 if (mem_base != xmlMemBlocks()) {
5602 printf("Leak of %d blocks found in xmlACatalogResolvePublic",
5603 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005604 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005605 printf(" %d", n_catal);
5606 printf(" %d", n_pubID);
5607 printf("\n");
5608 }
5609 }
5610 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005611 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005612#endif
5613
Daniel Veillard42595322004-11-08 10:52:06 +00005614 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005615}
5616
5617
5618static int
5619test_xmlACatalogResolveSystem(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005620 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005621
William M. Brack21e4ef22005-01-02 09:53:13 +00005622#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00005623 int mem_base;
5624 xmlChar * ret_val;
5625 xmlCatalogPtr catal; /* a Catalog */
5626 int n_catal;
5627 xmlChar * sysID; /* the system ID string */
5628 int n_sysID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005629
Daniel Veillardce682bc2004-11-05 17:22:25 +00005630 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5631 for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) {
5632 mem_base = xmlMemBlocks();
5633 catal = gen_xmlCatalogPtr(n_catal, 0);
5634 sysID = gen_const_xmlChar_ptr(n_sysID, 1);
5635
William M. Brackf13f77f2004-11-12 16:03:48 +00005636 ret_val = xmlACatalogResolveSystem(catal, (const xmlChar *)sysID);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005637 desret_xmlChar_ptr(ret_val);
5638 call_tests++;
5639 des_xmlCatalogPtr(n_catal, catal, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00005640 des_const_xmlChar_ptr(n_sysID, (const xmlChar *)sysID, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005641 xmlResetLastError();
5642 if (mem_base != xmlMemBlocks()) {
5643 printf("Leak of %d blocks found in xmlACatalogResolveSystem",
5644 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005645 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005646 printf(" %d", n_catal);
5647 printf(" %d", n_sysID);
5648 printf("\n");
5649 }
5650 }
5651 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005652 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005653#endif
5654
Daniel Veillard42595322004-11-08 10:52:06 +00005655 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005656}
5657
5658
5659static int
5660test_xmlACatalogResolveURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005661 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005662
William M. Brack21e4ef22005-01-02 09:53:13 +00005663#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00005664 int mem_base;
5665 xmlChar * ret_val;
5666 xmlCatalogPtr catal; /* a Catalog */
5667 int n_catal;
5668 xmlChar * URI; /* the URI */
5669 int n_URI;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005670
Daniel Veillardce682bc2004-11-05 17:22:25 +00005671 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5672 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
5673 mem_base = xmlMemBlocks();
5674 catal = gen_xmlCatalogPtr(n_catal, 0);
5675 URI = gen_const_xmlChar_ptr(n_URI, 1);
5676
William M. Brackf13f77f2004-11-12 16:03:48 +00005677 ret_val = xmlACatalogResolveURI(catal, (const xmlChar *)URI);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005678 desret_xmlChar_ptr(ret_val);
5679 call_tests++;
5680 des_xmlCatalogPtr(n_catal, catal, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00005681 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005682 xmlResetLastError();
5683 if (mem_base != xmlMemBlocks()) {
5684 printf("Leak of %d blocks found in xmlACatalogResolveURI",
5685 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005686 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005687 printf(" %d", n_catal);
5688 printf(" %d", n_URI);
5689 printf("\n");
5690 }
5691 }
5692 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005693 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005694#endif
5695
Daniel Veillard42595322004-11-08 10:52:06 +00005696 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005697}
5698
5699
5700static int
5701test_xmlCatalogAdd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005702 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005703
William M. Brack21e4ef22005-01-02 09:53:13 +00005704#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00005705 int mem_base;
5706 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005707 xmlChar * type; /* the type of record to add to the catalog */
Daniel Veillardd93f6252004-11-02 15:53:51 +00005708 int n_type;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005709 xmlChar * orig; /* the system, public or prefix to match */
Daniel Veillardd93f6252004-11-02 15:53:51 +00005710 int n_orig;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005711 xmlChar * replace; /* the replacement value for the match */
Daniel Veillardd93f6252004-11-02 15:53:51 +00005712 int n_replace;
5713
5714 for (n_type = 0;n_type < gen_nb_const_xmlChar_ptr;n_type++) {
5715 for (n_orig = 0;n_orig < gen_nb_const_xmlChar_ptr;n_orig++) {
5716 for (n_replace = 0;n_replace < gen_nb_const_xmlChar_ptr;n_replace++) {
5717 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00005718 type = gen_const_xmlChar_ptr(n_type, 0);
5719 orig = gen_const_xmlChar_ptr(n_orig, 1);
5720 replace = gen_const_xmlChar_ptr(n_replace, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005721
William M. Brackf13f77f2004-11-12 16:03:48 +00005722 ret_val = xmlCatalogAdd((const xmlChar *)type, (const xmlChar *)orig, (const xmlChar *)replace);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005723 desret_int(ret_val);
5724 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00005725 des_const_xmlChar_ptr(n_type, (const xmlChar *)type, 0);
5726 des_const_xmlChar_ptr(n_orig, (const xmlChar *)orig, 1);
5727 des_const_xmlChar_ptr(n_replace, (const xmlChar *)replace, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005728 xmlResetLastError();
5729 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00005730 printf("Leak of %d blocks found in xmlCatalogAdd",
Daniel Veillardd93f6252004-11-02 15:53:51 +00005731 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005732 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00005733 printf(" %d", n_type);
5734 printf(" %d", n_orig);
5735 printf(" %d", n_replace);
5736 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00005737 }
5738 }
5739 }
5740 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005741 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005742#endif
5743
Daniel Veillard42595322004-11-08 10:52:06 +00005744 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005745}
5746
5747
5748static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00005749test_xmlCatalogCleanup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005750 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005751
William M. Brack21e4ef22005-01-02 09:53:13 +00005752#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00005753
Daniel Veillardd93f6252004-11-02 15:53:51 +00005754
5755 xmlCatalogCleanup();
5756 call_tests++;
5757 xmlResetLastError();
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005758 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005759#endif
5760
Daniel Veillard42595322004-11-08 10:52:06 +00005761 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005762}
5763
5764
5765static int
5766test_xmlCatalogConvert(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005767 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005768
William M. Brack21e4ef22005-01-02 09:53:13 +00005769#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00005770 int ret_val;
5771
5772
5773 ret_val = xmlCatalogConvert();
5774 desret_int(ret_val);
5775 call_tests++;
5776 xmlResetLastError();
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005777 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005778#endif
5779
Daniel Veillard42595322004-11-08 10:52:06 +00005780 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005781}
5782
5783
5784static int
5785test_xmlCatalogDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005786 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005787
William M. Brack21e4ef22005-01-02 09:53:13 +00005788#if defined(LIBXML_CATALOG_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00005789 int mem_base;
5790 FILE * out; /* the file. */
5791 int n_out;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005792
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00005793 for (n_out = 0;n_out < gen_nb_FILE_ptr;n_out++) {
5794 mem_base = xmlMemBlocks();
5795 out = gen_FILE_ptr(n_out, 0);
5796
5797 xmlCatalogDump(out);
5798 call_tests++;
5799 des_FILE_ptr(n_out, out, 0);
5800 xmlResetLastError();
5801 if (mem_base != xmlMemBlocks()) {
5802 printf("Leak of %d blocks found in xmlCatalogDump",
5803 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005804 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00005805 printf(" %d", n_out);
5806 printf("\n");
5807 }
5808 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005809 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00005810#endif
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00005811
Daniel Veillard42595322004-11-08 10:52:06 +00005812 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005813}
5814
5815
5816static int
5817test_xmlCatalogGetDefaults(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005818 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005819
William M. Brack21e4ef22005-01-02 09:53:13 +00005820#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillard57b25162004-11-06 14:50:18 +00005821 int mem_base;
5822 xmlCatalogAllow ret_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005823
Daniel Veillard57b25162004-11-06 14:50:18 +00005824 mem_base = xmlMemBlocks();
5825
5826 ret_val = xmlCatalogGetDefaults();
5827 desret_xmlCatalogAllow(ret_val);
5828 call_tests++;
5829 xmlResetLastError();
5830 if (mem_base != xmlMemBlocks()) {
5831 printf("Leak of %d blocks found in xmlCatalogGetDefaults",
5832 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005833 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +00005834 printf("\n");
5835 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005836 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +00005837#endif
5838
Daniel Veillard42595322004-11-08 10:52:06 +00005839 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005840}
5841
5842
5843static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00005844test_xmlCatalogIsEmpty(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005845 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005846
William M. Brack21e4ef22005-01-02 09:53:13 +00005847#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00005848 int mem_base;
5849 int ret_val;
5850 xmlCatalogPtr catal; /* should this create an SGML catalog */
5851 int n_catal;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005852
Daniel Veillardce682bc2004-11-05 17:22:25 +00005853 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5854 mem_base = xmlMemBlocks();
5855 catal = gen_xmlCatalogPtr(n_catal, 0);
5856
5857 ret_val = xmlCatalogIsEmpty(catal);
5858 desret_int(ret_val);
5859 call_tests++;
5860 des_xmlCatalogPtr(n_catal, catal, 0);
5861 xmlResetLastError();
5862 if (mem_base != xmlMemBlocks()) {
5863 printf("Leak of %d blocks found in xmlCatalogIsEmpty",
5864 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005865 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005866 printf(" %d", n_catal);
5867 printf("\n");
5868 }
5869 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005870 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005871#endif
5872
Daniel Veillard42595322004-11-08 10:52:06 +00005873 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005874}
5875
5876
5877static int
5878test_xmlCatalogLocalResolve(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005879 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005880
William M. Brack21e4ef22005-01-02 09:53:13 +00005881#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005882 int mem_base;
5883 xmlChar * ret_val;
5884 void * catalogs; /* a document's list of catalogs */
5885 int n_catalogs;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005886 xmlChar * pubID; /* the public ID string */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005887 int n_pubID;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005888 xmlChar * sysID; /* the system ID string */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005889 int n_sysID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005890
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005891 for (n_catalogs = 0;n_catalogs < gen_nb_void_ptr;n_catalogs++) {
5892 for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) {
5893 for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) {
5894 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00005895 catalogs = gen_void_ptr(n_catalogs, 0);
5896 pubID = gen_const_xmlChar_ptr(n_pubID, 1);
5897 sysID = gen_const_xmlChar_ptr(n_sysID, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005898
William M. Brackf13f77f2004-11-12 16:03:48 +00005899 ret_val = xmlCatalogLocalResolve(catalogs, (const xmlChar *)pubID, (const xmlChar *)sysID);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005900 desret_xmlChar_ptr(ret_val);
5901 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00005902 des_void_ptr(n_catalogs, catalogs, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00005903 des_const_xmlChar_ptr(n_pubID, (const xmlChar *)pubID, 1);
5904 des_const_xmlChar_ptr(n_sysID, (const xmlChar *)sysID, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005905 xmlResetLastError();
5906 if (mem_base != xmlMemBlocks()) {
5907 printf("Leak of %d blocks found in xmlCatalogLocalResolve",
5908 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005909 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005910 printf(" %d", n_catalogs);
5911 printf(" %d", n_pubID);
5912 printf(" %d", n_sysID);
5913 printf("\n");
5914 }
5915 }
5916 }
5917 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005918 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005919#endif
5920
Daniel Veillard42595322004-11-08 10:52:06 +00005921 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005922}
5923
5924
5925static int
5926test_xmlCatalogLocalResolveURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005927 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005928
William M. Brack21e4ef22005-01-02 09:53:13 +00005929#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005930 int mem_base;
5931 xmlChar * ret_val;
5932 void * catalogs; /* a document's list of catalogs */
5933 int n_catalogs;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005934 xmlChar * URI; /* the URI */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005935 int n_URI;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005936
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005937 for (n_catalogs = 0;n_catalogs < gen_nb_void_ptr;n_catalogs++) {
5938 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
5939 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00005940 catalogs = gen_void_ptr(n_catalogs, 0);
5941 URI = gen_const_xmlChar_ptr(n_URI, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005942
William M. Brackf13f77f2004-11-12 16:03:48 +00005943 ret_val = xmlCatalogLocalResolveURI(catalogs, (const xmlChar *)URI);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005944 desret_xmlChar_ptr(ret_val);
5945 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00005946 des_void_ptr(n_catalogs, catalogs, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00005947 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005948 xmlResetLastError();
5949 if (mem_base != xmlMemBlocks()) {
5950 printf("Leak of %d blocks found in xmlCatalogLocalResolveURI",
5951 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005952 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005953 printf(" %d", n_catalogs);
5954 printf(" %d", n_URI);
5955 printf("\n");
5956 }
5957 }
5958 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005959 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005960#endif
5961
Daniel Veillard42595322004-11-08 10:52:06 +00005962 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005963}
5964
5965
5966static int
5967test_xmlCatalogRemove(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005968 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005969
William M. Brack21e4ef22005-01-02 09:53:13 +00005970#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00005971 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005972 xmlChar * value; /* the value to remove */
Daniel Veillardd93f6252004-11-02 15:53:51 +00005973 int n_value;
5974
5975 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +00005976 value = gen_const_xmlChar_ptr(n_value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005977
William M. Brackf13f77f2004-11-12 16:03:48 +00005978 ret_val = xmlCatalogRemove((const xmlChar *)value);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005979 desret_int(ret_val);
5980 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00005981 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005982 xmlResetLastError();
5983 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005984 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005985#endif
5986
Daniel Veillard42595322004-11-08 10:52:06 +00005987 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005988}
5989
5990
5991static int
5992test_xmlCatalogResolve(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005993 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005994
William M. Brack21e4ef22005-01-02 09:53:13 +00005995#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +00005996 int mem_base;
5997 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005998 xmlChar * pubID; /* the public ID string */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00005999 int n_pubID;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006000 xmlChar * sysID; /* the system ID string */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006001 int n_sysID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006002
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006003 for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) {
6004 for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) {
6005 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00006006 pubID = gen_const_xmlChar_ptr(n_pubID, 0);
6007 sysID = gen_const_xmlChar_ptr(n_sysID, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006008
William M. Brackf13f77f2004-11-12 16:03:48 +00006009 ret_val = xmlCatalogResolve((const xmlChar *)pubID, (const xmlChar *)sysID);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006010 desret_xmlChar_ptr(ret_val);
6011 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00006012 des_const_xmlChar_ptr(n_pubID, (const xmlChar *)pubID, 0);
6013 des_const_xmlChar_ptr(n_sysID, (const xmlChar *)sysID, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006014 xmlResetLastError();
6015 if (mem_base != xmlMemBlocks()) {
6016 printf("Leak of %d blocks found in xmlCatalogResolve",
6017 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006018 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006019 printf(" %d", n_pubID);
6020 printf(" %d", n_sysID);
6021 printf("\n");
6022 }
6023 }
6024 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006025 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006026#endif
6027
Daniel Veillard42595322004-11-08 10:52:06 +00006028 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006029}
6030
6031
6032static int
6033test_xmlCatalogResolvePublic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006034 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006035
William M. Brack21e4ef22005-01-02 09:53:13 +00006036#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006037 int mem_base;
6038 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006039 xmlChar * pubID; /* the public ID string */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006040 int n_pubID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006041
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006042 for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) {
6043 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00006044 pubID = gen_const_xmlChar_ptr(n_pubID, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006045
William M. Brackf13f77f2004-11-12 16:03:48 +00006046 ret_val = xmlCatalogResolvePublic((const xmlChar *)pubID);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006047 desret_xmlChar_ptr(ret_val);
6048 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00006049 des_const_xmlChar_ptr(n_pubID, (const xmlChar *)pubID, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006050 xmlResetLastError();
6051 if (mem_base != xmlMemBlocks()) {
6052 printf("Leak of %d blocks found in xmlCatalogResolvePublic",
6053 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006054 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006055 printf(" %d", n_pubID);
6056 printf("\n");
6057 }
6058 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006059 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006060#endif
6061
Daniel Veillard42595322004-11-08 10:52:06 +00006062 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006063}
6064
6065
6066static int
6067test_xmlCatalogResolveSystem(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006068 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006069
William M. Brack21e4ef22005-01-02 09:53:13 +00006070#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006071 int mem_base;
6072 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006073 xmlChar * sysID; /* the system ID string */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006074 int n_sysID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006075
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006076 for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) {
6077 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00006078 sysID = gen_const_xmlChar_ptr(n_sysID, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006079
William M. Brackf13f77f2004-11-12 16:03:48 +00006080 ret_val = xmlCatalogResolveSystem((const xmlChar *)sysID);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006081 desret_xmlChar_ptr(ret_val);
6082 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00006083 des_const_xmlChar_ptr(n_sysID, (const xmlChar *)sysID, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006084 xmlResetLastError();
6085 if (mem_base != xmlMemBlocks()) {
6086 printf("Leak of %d blocks found in xmlCatalogResolveSystem",
6087 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006088 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006089 printf(" %d", n_sysID);
6090 printf("\n");
6091 }
6092 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006093 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006094#endif
6095
Daniel Veillard42595322004-11-08 10:52:06 +00006096 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006097}
6098
6099
6100static int
6101test_xmlCatalogResolveURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006102 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006103
William M. Brack21e4ef22005-01-02 09:53:13 +00006104#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006105 int mem_base;
6106 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006107 xmlChar * URI; /* the URI */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006108 int n_URI;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006109
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006110 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
6111 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00006112 URI = gen_const_xmlChar_ptr(n_URI, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006113
William M. Brackf13f77f2004-11-12 16:03:48 +00006114 ret_val = xmlCatalogResolveURI((const xmlChar *)URI);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006115 desret_xmlChar_ptr(ret_val);
6116 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00006117 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006118 xmlResetLastError();
6119 if (mem_base != xmlMemBlocks()) {
6120 printf("Leak of %d blocks found in xmlCatalogResolveURI",
6121 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006122 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006123 printf(" %d", n_URI);
6124 printf("\n");
6125 }
6126 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006127 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006128#endif
6129
Daniel Veillard42595322004-11-08 10:52:06 +00006130 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006131}
6132
6133
6134static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00006135test_xmlCatalogSetDefaultPrefer(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006136 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006137
William M. Brack21e4ef22005-01-02 09:53:13 +00006138#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillard57b25162004-11-06 14:50:18 +00006139 int mem_base;
6140 xmlCatalogPrefer ret_val;
6141 xmlCatalogPrefer prefer; /* the default preference for delegation */
6142 int n_prefer;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006143
Daniel Veillard57b25162004-11-06 14:50:18 +00006144 for (n_prefer = 0;n_prefer < gen_nb_xmlCatalogPrefer;n_prefer++) {
6145 mem_base = xmlMemBlocks();
6146 prefer = gen_xmlCatalogPrefer(n_prefer, 0);
6147
6148 ret_val = xmlCatalogSetDefaultPrefer(prefer);
6149 desret_xmlCatalogPrefer(ret_val);
6150 call_tests++;
6151 des_xmlCatalogPrefer(n_prefer, prefer, 0);
6152 xmlResetLastError();
6153 if (mem_base != xmlMemBlocks()) {
6154 printf("Leak of %d blocks found in xmlCatalogSetDefaultPrefer",
6155 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006156 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +00006157 printf(" %d", n_prefer);
6158 printf("\n");
6159 }
6160 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006161 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +00006162#endif
6163
Daniel Veillard42595322004-11-08 10:52:06 +00006164 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006165}
6166
6167
6168static int
6169test_xmlCatalogSetDefaults(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006170 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006171
William M. Brack21e4ef22005-01-02 09:53:13 +00006172#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillard57b25162004-11-06 14:50:18 +00006173 int mem_base;
6174 xmlCatalogAllow allow; /* what catalogs should be accepted */
6175 int n_allow;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006176
Daniel Veillard57b25162004-11-06 14:50:18 +00006177 for (n_allow = 0;n_allow < gen_nb_xmlCatalogAllow;n_allow++) {
6178 mem_base = xmlMemBlocks();
6179 allow = gen_xmlCatalogAllow(n_allow, 0);
6180
6181 xmlCatalogSetDefaults(allow);
6182 call_tests++;
6183 des_xmlCatalogAllow(n_allow, allow, 0);
6184 xmlResetLastError();
6185 if (mem_base != xmlMemBlocks()) {
6186 printf("Leak of %d blocks found in xmlCatalogSetDefaults",
6187 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006188 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +00006189 printf(" %d", n_allow);
6190 printf("\n");
6191 }
6192 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006193 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +00006194#endif
6195
Daniel Veillard42595322004-11-08 10:52:06 +00006196 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006197}
6198
6199
6200static int
6201test_xmlConvertSGMLCatalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006202 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006203
William M. Brack21e4ef22005-01-02 09:53:13 +00006204#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00006205 int mem_base;
6206 int ret_val;
6207 xmlCatalogPtr catal; /* the catalog */
6208 int n_catal;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006209
Daniel Veillardce682bc2004-11-05 17:22:25 +00006210 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
6211 mem_base = xmlMemBlocks();
6212 catal = gen_xmlCatalogPtr(n_catal, 0);
6213
6214 ret_val = xmlConvertSGMLCatalog(catal);
6215 desret_int(ret_val);
6216 call_tests++;
6217 des_xmlCatalogPtr(n_catal, catal, 0);
6218 xmlResetLastError();
6219 if (mem_base != xmlMemBlocks()) {
6220 printf("Leak of %d blocks found in xmlConvertSGMLCatalog",
6221 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006222 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006223 printf(" %d", n_catal);
6224 printf("\n");
6225 }
6226 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006227 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006228#endif
6229
Daniel Veillard42595322004-11-08 10:52:06 +00006230 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006231}
6232
6233
6234static int
6235test_xmlInitializeCatalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006236 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006237
William M. Brack21e4ef22005-01-02 09:53:13 +00006238#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00006239 int mem_base;
6240
6241 mem_base = xmlMemBlocks();
6242
6243 xmlInitializeCatalog();
6244 call_tests++;
6245 xmlResetLastError();
6246 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00006247 printf("Leak of %d blocks found in xmlInitializeCatalog",
Daniel Veillardd93f6252004-11-02 15:53:51 +00006248 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006249 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00006250 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00006251 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006252 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006253#endif
6254
Daniel Veillard42595322004-11-08 10:52:06 +00006255 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006256}
6257
6258
6259static int
6260test_xmlLoadACatalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006261 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006262
6263
6264 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00006265 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006266}
6267
6268
6269static int
6270test_xmlLoadCatalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006271 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006272
William M. Brack21e4ef22005-01-02 09:53:13 +00006273#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00006274 int ret_val;
6275 const char * filename; /* a file path */
6276 int n_filename;
6277
6278 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +00006279 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006280
6281 ret_val = xmlLoadCatalog(filename);
6282 desret_int(ret_val);
6283 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006284 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006285 xmlResetLastError();
6286 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006287 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006288#endif
6289
Daniel Veillard42595322004-11-08 10:52:06 +00006290 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006291}
6292
6293
6294static int
6295test_xmlLoadCatalogs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006296 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006297
William M. Brack21e4ef22005-01-02 09:53:13 +00006298#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00006299 char * pathss; /* a list of directories separated by a colon or a space. */
Daniel Veillardd93f6252004-11-02 15:53:51 +00006300 int n_pathss;
6301
6302 for (n_pathss = 0;n_pathss < gen_nb_const_char_ptr;n_pathss++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +00006303 pathss = gen_const_char_ptr(n_pathss, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006304
William M. Brackf13f77f2004-11-12 16:03:48 +00006305 xmlLoadCatalogs((const char *)pathss);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006306 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00006307 des_const_char_ptr(n_pathss, (const char *)pathss, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006308 xmlResetLastError();
6309 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006310 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006311#endif
6312
Daniel Veillard42595322004-11-08 10:52:06 +00006313 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006314}
6315
6316
6317static int
6318test_xmlLoadSGMLSuperCatalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006319 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006320
6321
6322 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00006323 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006324}
6325
6326
6327static int
6328test_xmlNewCatalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006329 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006330
6331
6332 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00006333 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006334}
6335
6336
6337static int
6338test_xmlParseCatalogFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006339 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006340
William M. Brack21e4ef22005-01-02 09:53:13 +00006341#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00006342 int mem_base;
6343 xmlDocPtr ret_val;
6344 const char * filename; /* the filename */
6345 int n_filename;
6346
6347 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
6348 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00006349 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006350
6351 ret_val = xmlParseCatalogFile(filename);
6352 desret_xmlDocPtr(ret_val);
6353 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006354 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006355 xmlResetLastError();
6356 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00006357 printf("Leak of %d blocks found in xmlParseCatalogFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +00006358 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006359 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00006360 printf(" %d", n_filename);
6361 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00006362 }
6363 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006364 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006365#endif
6366
Daniel Veillard42595322004-11-08 10:52:06 +00006367 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006368}
6369
6370static int
6371test_catalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006372 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006373
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006374 if (quiet == 0) printf("Testing catalog : 27 of 36 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00006375 test_ret += test_xmlACatalogAdd();
6376 test_ret += test_xmlACatalogDump();
6377 test_ret += test_xmlACatalogRemove();
6378 test_ret += test_xmlACatalogResolve();
6379 test_ret += test_xmlACatalogResolvePublic();
6380 test_ret += test_xmlACatalogResolveSystem();
6381 test_ret += test_xmlACatalogResolveURI();
6382 test_ret += test_xmlCatalogAdd();
6383 test_ret += test_xmlCatalogCleanup();
6384 test_ret += test_xmlCatalogConvert();
6385 test_ret += test_xmlCatalogDump();
6386 test_ret += test_xmlCatalogGetDefaults();
6387 test_ret += test_xmlCatalogIsEmpty();
6388 test_ret += test_xmlCatalogLocalResolve();
6389 test_ret += test_xmlCatalogLocalResolveURI();
6390 test_ret += test_xmlCatalogRemove();
6391 test_ret += test_xmlCatalogResolve();
6392 test_ret += test_xmlCatalogResolvePublic();
6393 test_ret += test_xmlCatalogResolveSystem();
6394 test_ret += test_xmlCatalogResolveURI();
6395 test_ret += test_xmlCatalogSetDefaultPrefer();
6396 test_ret += test_xmlCatalogSetDefaults();
6397 test_ret += test_xmlConvertSGMLCatalog();
6398 test_ret += test_xmlInitializeCatalog();
6399 test_ret += test_xmlLoadACatalog();
6400 test_ret += test_xmlLoadCatalog();
6401 test_ret += test_xmlLoadCatalogs();
6402 test_ret += test_xmlLoadSGMLSuperCatalog();
6403 test_ret += test_xmlNewCatalog();
6404 test_ret += test_xmlParseCatalogFile();
Daniel Veillardd93f6252004-11-02 15:53:51 +00006405
Daniel Veillard42595322004-11-08 10:52:06 +00006406 if (test_ret != 0)
6407 printf("Module catalog: %d errors\n", test_ret);
6408 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006409}
6410
Daniel Veillardce682bc2004-11-05 17:22:25 +00006411#define gen_nb_const_xmlChRangeGroupPtr 1
6412static xmlChRangeGroupPtr gen_const_xmlChRangeGroupPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
6413 return(NULL);
6414}
6415static void des_const_xmlChRangeGroupPtr(int no ATTRIBUTE_UNUSED, const xmlChRangeGroupPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
6416}
6417
Daniel Veillardd93f6252004-11-02 15:53:51 +00006418static int
6419test_xmlCharInRange(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006420 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006421
Daniel Veillardce682bc2004-11-05 17:22:25 +00006422 int mem_base;
6423 int ret_val;
6424 unsigned int val; /* character to be validated */
6425 int n_val;
6426 xmlChRangeGroupPtr rptr; /* pointer to range to be used to validate */
6427 int n_rptr;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006428
Daniel Veillardce682bc2004-11-05 17:22:25 +00006429 for (n_val = 0;n_val < gen_nb_unsigned_int;n_val++) {
6430 for (n_rptr = 0;n_rptr < gen_nb_const_xmlChRangeGroupPtr;n_rptr++) {
6431 mem_base = xmlMemBlocks();
6432 val = gen_unsigned_int(n_val, 0);
6433 rptr = gen_const_xmlChRangeGroupPtr(n_rptr, 1);
6434
William M. Brackf13f77f2004-11-12 16:03:48 +00006435 ret_val = xmlCharInRange(val, (const xmlChRangeGroupPtr)rptr);
Daniel Veillardce682bc2004-11-05 17:22:25 +00006436 desret_int(ret_val);
6437 call_tests++;
6438 des_unsigned_int(n_val, val, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00006439 des_const_xmlChRangeGroupPtr(n_rptr, (const xmlChRangeGroupPtr)rptr, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +00006440 xmlResetLastError();
6441 if (mem_base != xmlMemBlocks()) {
6442 printf("Leak of %d blocks found in xmlCharInRange",
6443 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006444 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006445 printf(" %d", n_val);
6446 printf(" %d", n_rptr);
6447 printf("\n");
6448 }
6449 }
6450 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00006451 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006452
Daniel Veillard42595322004-11-08 10:52:06 +00006453 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006454}
6455
6456
6457static int
6458test_xmlIsBaseChar(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006459 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006460
Daniel Veillard3d97e662004-11-04 10:49:00 +00006461 int mem_base;
6462 int ret_val;
6463 unsigned int ch; /* character to validate */
6464 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006465
Daniel Veillard3d97e662004-11-04 10:49:00 +00006466 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6467 mem_base = xmlMemBlocks();
6468 ch = gen_unsigned_int(n_ch, 0);
6469
6470 ret_val = xmlIsBaseChar(ch);
6471 desret_int(ret_val);
6472 call_tests++;
6473 des_unsigned_int(n_ch, ch, 0);
6474 xmlResetLastError();
6475 if (mem_base != xmlMemBlocks()) {
6476 printf("Leak of %d blocks found in xmlIsBaseChar",
6477 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006478 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006479 printf(" %d", n_ch);
6480 printf("\n");
6481 }
6482 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00006483 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006484
Daniel Veillard42595322004-11-08 10:52:06 +00006485 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006486}
6487
6488
6489static int
6490test_xmlIsBlank(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006491 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006492
Daniel Veillard3d97e662004-11-04 10:49:00 +00006493 int mem_base;
6494 int ret_val;
6495 unsigned int ch; /* character to validate */
6496 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006497
Daniel Veillard3d97e662004-11-04 10:49:00 +00006498 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6499 mem_base = xmlMemBlocks();
6500 ch = gen_unsigned_int(n_ch, 0);
6501
6502 ret_val = xmlIsBlank(ch);
6503 desret_int(ret_val);
6504 call_tests++;
6505 des_unsigned_int(n_ch, ch, 0);
6506 xmlResetLastError();
6507 if (mem_base != xmlMemBlocks()) {
6508 printf("Leak of %d blocks found in xmlIsBlank",
6509 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006510 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006511 printf(" %d", n_ch);
6512 printf("\n");
6513 }
6514 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00006515 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006516
Daniel Veillard42595322004-11-08 10:52:06 +00006517 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006518}
6519
6520
6521static int
6522test_xmlIsChar(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006523 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006524
Daniel Veillard3d97e662004-11-04 10:49:00 +00006525 int mem_base;
6526 int ret_val;
6527 unsigned int ch; /* character to validate */
6528 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006529
Daniel Veillard3d97e662004-11-04 10:49:00 +00006530 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6531 mem_base = xmlMemBlocks();
6532 ch = gen_unsigned_int(n_ch, 0);
6533
6534 ret_val = xmlIsChar(ch);
6535 desret_int(ret_val);
6536 call_tests++;
6537 des_unsigned_int(n_ch, ch, 0);
6538 xmlResetLastError();
6539 if (mem_base != xmlMemBlocks()) {
6540 printf("Leak of %d blocks found in xmlIsChar",
6541 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006542 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006543 printf(" %d", n_ch);
6544 printf("\n");
6545 }
6546 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00006547 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006548
Daniel Veillard42595322004-11-08 10:52:06 +00006549 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006550}
6551
6552
6553static int
6554test_xmlIsCombining(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006555 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006556
Daniel Veillard3d97e662004-11-04 10:49:00 +00006557 int mem_base;
6558 int ret_val;
6559 unsigned int ch; /* character to validate */
6560 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006561
Daniel Veillard3d97e662004-11-04 10:49:00 +00006562 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6563 mem_base = xmlMemBlocks();
6564 ch = gen_unsigned_int(n_ch, 0);
6565
6566 ret_val = xmlIsCombining(ch);
6567 desret_int(ret_val);
6568 call_tests++;
6569 des_unsigned_int(n_ch, ch, 0);
6570 xmlResetLastError();
6571 if (mem_base != xmlMemBlocks()) {
6572 printf("Leak of %d blocks found in xmlIsCombining",
6573 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006574 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006575 printf(" %d", n_ch);
6576 printf("\n");
6577 }
6578 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00006579 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006580
Daniel Veillard42595322004-11-08 10:52:06 +00006581 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006582}
6583
6584
6585static int
6586test_xmlIsDigit(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006587 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006588
Daniel Veillard3d97e662004-11-04 10:49:00 +00006589 int mem_base;
6590 int ret_val;
6591 unsigned int ch; /* character to validate */
6592 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006593
Daniel Veillard3d97e662004-11-04 10:49:00 +00006594 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6595 mem_base = xmlMemBlocks();
6596 ch = gen_unsigned_int(n_ch, 0);
6597
6598 ret_val = xmlIsDigit(ch);
6599 desret_int(ret_val);
6600 call_tests++;
6601 des_unsigned_int(n_ch, ch, 0);
6602 xmlResetLastError();
6603 if (mem_base != xmlMemBlocks()) {
6604 printf("Leak of %d blocks found in xmlIsDigit",
6605 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006606 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006607 printf(" %d", n_ch);
6608 printf("\n");
6609 }
6610 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00006611 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006612
Daniel Veillard42595322004-11-08 10:52:06 +00006613 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006614}
6615
6616
6617static int
6618test_xmlIsExtender(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006619 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006620
Daniel Veillard3d97e662004-11-04 10:49:00 +00006621 int mem_base;
6622 int ret_val;
6623 unsigned int ch; /* character to validate */
6624 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006625
Daniel Veillard3d97e662004-11-04 10:49:00 +00006626 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6627 mem_base = xmlMemBlocks();
6628 ch = gen_unsigned_int(n_ch, 0);
6629
6630 ret_val = xmlIsExtender(ch);
6631 desret_int(ret_val);
6632 call_tests++;
6633 des_unsigned_int(n_ch, ch, 0);
6634 xmlResetLastError();
6635 if (mem_base != xmlMemBlocks()) {
6636 printf("Leak of %d blocks found in xmlIsExtender",
6637 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006638 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006639 printf(" %d", n_ch);
6640 printf("\n");
6641 }
6642 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00006643 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006644
Daniel Veillard42595322004-11-08 10:52:06 +00006645 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006646}
6647
6648
6649static int
6650test_xmlIsIdeographic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006651 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006652
Daniel Veillard3d97e662004-11-04 10:49:00 +00006653 int mem_base;
6654 int ret_val;
6655 unsigned int ch; /* character to validate */
6656 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006657
Daniel Veillard3d97e662004-11-04 10:49:00 +00006658 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6659 mem_base = xmlMemBlocks();
6660 ch = gen_unsigned_int(n_ch, 0);
6661
6662 ret_val = xmlIsIdeographic(ch);
6663 desret_int(ret_val);
6664 call_tests++;
6665 des_unsigned_int(n_ch, ch, 0);
6666 xmlResetLastError();
6667 if (mem_base != xmlMemBlocks()) {
6668 printf("Leak of %d blocks found in xmlIsIdeographic",
6669 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006670 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006671 printf(" %d", n_ch);
6672 printf("\n");
6673 }
6674 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00006675 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006676
Daniel Veillard42595322004-11-08 10:52:06 +00006677 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006678}
6679
6680
6681static int
6682test_xmlIsPubidChar(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006683 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006684
Daniel Veillard3d97e662004-11-04 10:49:00 +00006685 int mem_base;
6686 int ret_val;
6687 unsigned int ch; /* character to validate */
6688 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006689
Daniel Veillard3d97e662004-11-04 10:49:00 +00006690 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6691 mem_base = xmlMemBlocks();
6692 ch = gen_unsigned_int(n_ch, 0);
6693
6694 ret_val = xmlIsPubidChar(ch);
6695 desret_int(ret_val);
6696 call_tests++;
6697 des_unsigned_int(n_ch, ch, 0);
6698 xmlResetLastError();
6699 if (mem_base != xmlMemBlocks()) {
6700 printf("Leak of %d blocks found in xmlIsPubidChar",
6701 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006702 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006703 printf(" %d", n_ch);
6704 printf("\n");
6705 }
6706 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00006707 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006708
Daniel Veillard42595322004-11-08 10:52:06 +00006709 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006710}
6711
6712static int
6713test_chvalid(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006714 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006715
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006716 if (quiet == 0) printf("Testing chvalid : 9 of 9 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00006717 test_ret += test_xmlCharInRange();
6718 test_ret += test_xmlIsBaseChar();
6719 test_ret += test_xmlIsBlank();
6720 test_ret += test_xmlIsChar();
6721 test_ret += test_xmlIsCombining();
6722 test_ret += test_xmlIsDigit();
6723 test_ret += test_xmlIsExtender();
6724 test_ret += test_xmlIsIdeographic();
6725 test_ret += test_xmlIsPubidChar();
Daniel Veillardd93f6252004-11-02 15:53:51 +00006726
Daniel Veillard42595322004-11-08 10:52:06 +00006727 if (test_ret != 0)
6728 printf("Module chvalid: %d errors\n", test_ret);
6729 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006730}
6731
6732static int
Daniel Veillarda82b1822004-11-08 16:24:57 +00006733test_xmlBoolToText(void) {
6734 int test_ret = 0;
6735
William M. Brack21e4ef22005-01-02 09:53:13 +00006736#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00006737 int mem_base;
6738 const char * ret_val;
6739 int boolval; /* a bool to turn into text */
6740 int n_boolval;
6741
6742 for (n_boolval = 0;n_boolval < gen_nb_int;n_boolval++) {
6743 mem_base = xmlMemBlocks();
6744 boolval = gen_int(n_boolval, 0);
6745
6746 ret_val = xmlBoolToText(boolval);
6747 desret_const_char_ptr(ret_val);
6748 call_tests++;
6749 des_int(n_boolval, boolval, 0);
6750 xmlResetLastError();
6751 if (mem_base != xmlMemBlocks()) {
6752 printf("Leak of %d blocks found in xmlBoolToText",
6753 xmlMemBlocks() - mem_base);
6754 test_ret++;
6755 printf(" %d", n_boolval);
6756 printf("\n");
6757 }
6758 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006759 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00006760#endif
6761
Daniel Veillarda82b1822004-11-08 16:24:57 +00006762 return(test_ret);
6763}
6764
6765
6766static int
6767test_xmlDebugCheckDocument(void) {
6768 int test_ret = 0;
6769
William M. Brack21e4ef22005-01-02 09:53:13 +00006770#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00006771 int mem_base;
6772 int ret_val;
6773 FILE * output; /* the FILE * for the output */
6774 int n_output;
6775 xmlDocPtr doc; /* the document */
6776 int n_doc;
6777
6778 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
6779 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
6780 mem_base = xmlMemBlocks();
6781 output = gen_debug_FILE_ptr(n_output, 0);
6782 doc = gen_xmlDocPtr(n_doc, 1);
6783
6784 ret_val = xmlDebugCheckDocument(output, doc);
6785 desret_int(ret_val);
6786 call_tests++;
6787 des_debug_FILE_ptr(n_output, output, 0);
6788 des_xmlDocPtr(n_doc, doc, 1);
6789 xmlResetLastError();
6790 if (mem_base != xmlMemBlocks()) {
6791 printf("Leak of %d blocks found in xmlDebugCheckDocument",
6792 xmlMemBlocks() - mem_base);
6793 test_ret++;
6794 printf(" %d", n_output);
6795 printf(" %d", n_doc);
6796 printf("\n");
6797 }
6798 }
6799 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006800 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00006801#endif
6802
Daniel Veillarda82b1822004-11-08 16:24:57 +00006803 return(test_ret);
6804}
6805
6806
6807static int
6808test_xmlDebugDumpAttr(void) {
6809 int test_ret = 0;
6810
William M. Brack21e4ef22005-01-02 09:53:13 +00006811#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00006812 int mem_base;
6813 FILE * output; /* the FILE * for the output */
6814 int n_output;
6815 xmlAttrPtr attr; /* the attribute */
6816 int n_attr;
6817 int depth; /* the indentation level. */
6818 int n_depth;
6819
6820 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
6821 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
6822 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
6823 mem_base = xmlMemBlocks();
6824 output = gen_debug_FILE_ptr(n_output, 0);
6825 attr = gen_xmlAttrPtr(n_attr, 1);
6826 depth = gen_int(n_depth, 2);
6827
6828 xmlDebugDumpAttr(output, attr, depth);
6829 call_tests++;
6830 des_debug_FILE_ptr(n_output, output, 0);
6831 des_xmlAttrPtr(n_attr, attr, 1);
6832 des_int(n_depth, depth, 2);
6833 xmlResetLastError();
6834 if (mem_base != xmlMemBlocks()) {
6835 printf("Leak of %d blocks found in xmlDebugDumpAttr",
6836 xmlMemBlocks() - mem_base);
6837 test_ret++;
6838 printf(" %d", n_output);
6839 printf(" %d", n_attr);
6840 printf(" %d", n_depth);
6841 printf("\n");
6842 }
6843 }
6844 }
6845 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006846 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00006847#endif
6848
Daniel Veillarda82b1822004-11-08 16:24:57 +00006849 return(test_ret);
6850}
6851
6852
6853static int
6854test_xmlDebugDumpAttrList(void) {
6855 int test_ret = 0;
6856
William M. Brack21e4ef22005-01-02 09:53:13 +00006857#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00006858 int mem_base;
6859 FILE * output; /* the FILE * for the output */
6860 int n_output;
6861 xmlAttrPtr attr; /* the attribute list */
6862 int n_attr;
6863 int depth; /* the indentation level. */
6864 int n_depth;
6865
6866 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
6867 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
6868 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
6869 mem_base = xmlMemBlocks();
6870 output = gen_debug_FILE_ptr(n_output, 0);
6871 attr = gen_xmlAttrPtr(n_attr, 1);
6872 depth = gen_int(n_depth, 2);
6873
6874 xmlDebugDumpAttrList(output, attr, depth);
6875 call_tests++;
6876 des_debug_FILE_ptr(n_output, output, 0);
6877 des_xmlAttrPtr(n_attr, attr, 1);
6878 des_int(n_depth, depth, 2);
6879 xmlResetLastError();
6880 if (mem_base != xmlMemBlocks()) {
6881 printf("Leak of %d blocks found in xmlDebugDumpAttrList",
6882 xmlMemBlocks() - mem_base);
6883 test_ret++;
6884 printf(" %d", n_output);
6885 printf(" %d", n_attr);
6886 printf(" %d", n_depth);
6887 printf("\n");
6888 }
6889 }
6890 }
6891 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006892 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00006893#endif
6894
Daniel Veillarda82b1822004-11-08 16:24:57 +00006895 return(test_ret);
6896}
6897
6898
6899static int
6900test_xmlDebugDumpDTD(void) {
6901 int test_ret = 0;
6902
William M. Brack21e4ef22005-01-02 09:53:13 +00006903#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00006904 int mem_base;
6905 FILE * output; /* the FILE * for the output */
6906 int n_output;
6907 xmlDtdPtr dtd; /* the DTD */
6908 int n_dtd;
6909
6910 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
6911 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
6912 mem_base = xmlMemBlocks();
6913 output = gen_debug_FILE_ptr(n_output, 0);
6914 dtd = gen_xmlDtdPtr(n_dtd, 1);
6915
6916 xmlDebugDumpDTD(output, dtd);
6917 call_tests++;
6918 des_debug_FILE_ptr(n_output, output, 0);
6919 des_xmlDtdPtr(n_dtd, dtd, 1);
6920 xmlResetLastError();
6921 if (mem_base != xmlMemBlocks()) {
6922 printf("Leak of %d blocks found in xmlDebugDumpDTD",
6923 xmlMemBlocks() - mem_base);
6924 test_ret++;
6925 printf(" %d", n_output);
6926 printf(" %d", n_dtd);
6927 printf("\n");
6928 }
6929 }
6930 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006931 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00006932#endif
6933
Daniel Veillarda82b1822004-11-08 16:24:57 +00006934 return(test_ret);
6935}
6936
6937
6938static int
6939test_xmlDebugDumpDocument(void) {
6940 int test_ret = 0;
6941
William M. Brack21e4ef22005-01-02 09:53:13 +00006942#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00006943 int mem_base;
6944 FILE * output; /* the FILE * for the output */
6945 int n_output;
6946 xmlDocPtr doc; /* the document */
6947 int n_doc;
6948
6949 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
6950 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
6951 mem_base = xmlMemBlocks();
6952 output = gen_debug_FILE_ptr(n_output, 0);
6953 doc = gen_xmlDocPtr(n_doc, 1);
6954
6955 xmlDebugDumpDocument(output, doc);
6956 call_tests++;
6957 des_debug_FILE_ptr(n_output, output, 0);
6958 des_xmlDocPtr(n_doc, doc, 1);
6959 xmlResetLastError();
6960 if (mem_base != xmlMemBlocks()) {
6961 printf("Leak of %d blocks found in xmlDebugDumpDocument",
6962 xmlMemBlocks() - mem_base);
6963 test_ret++;
6964 printf(" %d", n_output);
6965 printf(" %d", n_doc);
6966 printf("\n");
6967 }
6968 }
6969 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006970 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00006971#endif
6972
Daniel Veillarda82b1822004-11-08 16:24:57 +00006973 return(test_ret);
6974}
6975
6976
6977static int
6978test_xmlDebugDumpDocumentHead(void) {
6979 int test_ret = 0;
6980
William M. Brack21e4ef22005-01-02 09:53:13 +00006981#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00006982 int mem_base;
6983 FILE * output; /* the FILE * for the output */
6984 int n_output;
6985 xmlDocPtr doc; /* the document */
6986 int n_doc;
6987
6988 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
6989 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
6990 mem_base = xmlMemBlocks();
6991 output = gen_debug_FILE_ptr(n_output, 0);
6992 doc = gen_xmlDocPtr(n_doc, 1);
6993
6994 xmlDebugDumpDocumentHead(output, doc);
6995 call_tests++;
6996 des_debug_FILE_ptr(n_output, output, 0);
6997 des_xmlDocPtr(n_doc, doc, 1);
6998 xmlResetLastError();
6999 if (mem_base != xmlMemBlocks()) {
7000 printf("Leak of %d blocks found in xmlDebugDumpDocumentHead",
7001 xmlMemBlocks() - mem_base);
7002 test_ret++;
7003 printf(" %d", n_output);
7004 printf(" %d", n_doc);
7005 printf("\n");
7006 }
7007 }
7008 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007009 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007010#endif
7011
Daniel Veillarda82b1822004-11-08 16:24:57 +00007012 return(test_ret);
7013}
7014
7015
7016static int
7017test_xmlDebugDumpEntities(void) {
7018 int test_ret = 0;
7019
William M. Brack21e4ef22005-01-02 09:53:13 +00007020#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007021 int mem_base;
7022 FILE * output; /* the FILE * for the output */
7023 int n_output;
7024 xmlDocPtr doc; /* the document */
7025 int n_doc;
7026
7027 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7028 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
7029 mem_base = xmlMemBlocks();
7030 output = gen_debug_FILE_ptr(n_output, 0);
7031 doc = gen_xmlDocPtr(n_doc, 1);
7032
7033 xmlDebugDumpEntities(output, doc);
7034 call_tests++;
7035 des_debug_FILE_ptr(n_output, output, 0);
7036 des_xmlDocPtr(n_doc, doc, 1);
7037 xmlResetLastError();
7038 if (mem_base != xmlMemBlocks()) {
7039 printf("Leak of %d blocks found in xmlDebugDumpEntities",
7040 xmlMemBlocks() - mem_base);
7041 test_ret++;
7042 printf(" %d", n_output);
7043 printf(" %d", n_doc);
7044 printf("\n");
7045 }
7046 }
7047 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007048 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007049#endif
7050
Daniel Veillarda82b1822004-11-08 16:24:57 +00007051 return(test_ret);
7052}
7053
7054
7055static int
7056test_xmlDebugDumpNode(void) {
7057 int test_ret = 0;
7058
William M. Brack21e4ef22005-01-02 09:53:13 +00007059#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007060 int mem_base;
7061 FILE * output; /* the FILE * for the output */
7062 int n_output;
7063 xmlNodePtr node; /* the node */
7064 int n_node;
7065 int depth; /* the indentation level. */
7066 int n_depth;
7067
7068 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7069 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7070 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
7071 mem_base = xmlMemBlocks();
7072 output = gen_debug_FILE_ptr(n_output, 0);
7073 node = gen_xmlNodePtr(n_node, 1);
7074 depth = gen_int(n_depth, 2);
7075
7076 xmlDebugDumpNode(output, node, depth);
7077 call_tests++;
7078 des_debug_FILE_ptr(n_output, output, 0);
7079 des_xmlNodePtr(n_node, node, 1);
7080 des_int(n_depth, depth, 2);
7081 xmlResetLastError();
7082 if (mem_base != xmlMemBlocks()) {
7083 printf("Leak of %d blocks found in xmlDebugDumpNode",
7084 xmlMemBlocks() - mem_base);
7085 test_ret++;
7086 printf(" %d", n_output);
7087 printf(" %d", n_node);
7088 printf(" %d", n_depth);
7089 printf("\n");
7090 }
7091 }
7092 }
7093 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007094 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007095#endif
7096
Daniel Veillarda82b1822004-11-08 16:24:57 +00007097 return(test_ret);
7098}
7099
7100
7101static int
7102test_xmlDebugDumpNodeList(void) {
7103 int test_ret = 0;
7104
William M. Brack21e4ef22005-01-02 09:53:13 +00007105#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007106 int mem_base;
7107 FILE * output; /* the FILE * for the output */
7108 int n_output;
7109 xmlNodePtr node; /* the node list */
7110 int n_node;
7111 int depth; /* the indentation level. */
7112 int n_depth;
7113
7114 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7115 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7116 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
7117 mem_base = xmlMemBlocks();
7118 output = gen_debug_FILE_ptr(n_output, 0);
7119 node = gen_xmlNodePtr(n_node, 1);
7120 depth = gen_int(n_depth, 2);
7121
7122 xmlDebugDumpNodeList(output, node, depth);
7123 call_tests++;
7124 des_debug_FILE_ptr(n_output, output, 0);
7125 des_xmlNodePtr(n_node, node, 1);
7126 des_int(n_depth, depth, 2);
7127 xmlResetLastError();
7128 if (mem_base != xmlMemBlocks()) {
7129 printf("Leak of %d blocks found in xmlDebugDumpNodeList",
7130 xmlMemBlocks() - mem_base);
7131 test_ret++;
7132 printf(" %d", n_output);
7133 printf(" %d", n_node);
7134 printf(" %d", n_depth);
7135 printf("\n");
7136 }
7137 }
7138 }
7139 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007140 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007141#endif
7142
Daniel Veillarda82b1822004-11-08 16:24:57 +00007143 return(test_ret);
7144}
7145
7146
7147static int
7148test_xmlDebugDumpOneNode(void) {
7149 int test_ret = 0;
7150
William M. Brack21e4ef22005-01-02 09:53:13 +00007151#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007152 int mem_base;
7153 FILE * output; /* the FILE * for the output */
7154 int n_output;
7155 xmlNodePtr node; /* the node */
7156 int n_node;
7157 int depth; /* the indentation level. */
7158 int n_depth;
7159
7160 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7161 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7162 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
7163 mem_base = xmlMemBlocks();
7164 output = gen_debug_FILE_ptr(n_output, 0);
7165 node = gen_xmlNodePtr(n_node, 1);
7166 depth = gen_int(n_depth, 2);
7167
7168 xmlDebugDumpOneNode(output, node, depth);
7169 call_tests++;
7170 des_debug_FILE_ptr(n_output, output, 0);
7171 des_xmlNodePtr(n_node, node, 1);
7172 des_int(n_depth, depth, 2);
7173 xmlResetLastError();
7174 if (mem_base != xmlMemBlocks()) {
7175 printf("Leak of %d blocks found in xmlDebugDumpOneNode",
7176 xmlMemBlocks() - mem_base);
7177 test_ret++;
7178 printf(" %d", n_output);
7179 printf(" %d", n_node);
7180 printf(" %d", n_depth);
7181 printf("\n");
7182 }
7183 }
7184 }
7185 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007186 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007187#endif
7188
Daniel Veillarda82b1822004-11-08 16:24:57 +00007189 return(test_ret);
7190}
7191
7192
7193static int
7194test_xmlDebugDumpString(void) {
7195 int test_ret = 0;
7196
William M. Brack21e4ef22005-01-02 09:53:13 +00007197#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007198 int mem_base;
7199 FILE * output; /* the FILE * for the output */
7200 int n_output;
7201 xmlChar * str; /* the string */
7202 int n_str;
7203
7204 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7205 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
7206 mem_base = xmlMemBlocks();
7207 output = gen_debug_FILE_ptr(n_output, 0);
7208 str = gen_const_xmlChar_ptr(n_str, 1);
7209
William M. Brackf13f77f2004-11-12 16:03:48 +00007210 xmlDebugDumpString(output, (const xmlChar *)str);
Daniel Veillarda82b1822004-11-08 16:24:57 +00007211 call_tests++;
7212 des_debug_FILE_ptr(n_output, output, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00007213 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillarda82b1822004-11-08 16:24:57 +00007214 xmlResetLastError();
7215 if (mem_base != xmlMemBlocks()) {
7216 printf("Leak of %d blocks found in xmlDebugDumpString",
7217 xmlMemBlocks() - mem_base);
7218 test_ret++;
7219 printf(" %d", n_output);
7220 printf(" %d", n_str);
7221 printf("\n");
7222 }
7223 }
7224 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007225 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007226#endif
7227
Daniel Veillarda82b1822004-11-08 16:24:57 +00007228 return(test_ret);
7229}
7230
7231
7232static int
7233test_xmlLsCountNode(void) {
7234 int test_ret = 0;
7235
William M. Brack21e4ef22005-01-02 09:53:13 +00007236#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007237 int mem_base;
7238 int ret_val;
7239 xmlNodePtr node; /* the node to count */
7240 int n_node;
7241
7242 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7243 mem_base = xmlMemBlocks();
7244 node = gen_xmlNodePtr(n_node, 0);
7245
7246 ret_val = xmlLsCountNode(node);
7247 desret_int(ret_val);
7248 call_tests++;
7249 des_xmlNodePtr(n_node, node, 0);
7250 xmlResetLastError();
7251 if (mem_base != xmlMemBlocks()) {
7252 printf("Leak of %d blocks found in xmlLsCountNode",
7253 xmlMemBlocks() - mem_base);
7254 test_ret++;
7255 printf(" %d", n_node);
7256 printf("\n");
7257 }
7258 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007259 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007260#endif
7261
Daniel Veillarda82b1822004-11-08 16:24:57 +00007262 return(test_ret);
7263}
7264
7265
7266static int
7267test_xmlLsOneNode(void) {
7268 int test_ret = 0;
7269
William M. Brack21e4ef22005-01-02 09:53:13 +00007270#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007271 int mem_base;
7272 FILE * output; /* the FILE * for the output */
7273 int n_output;
7274 xmlNodePtr node; /* the node to dump */
7275 int n_node;
7276
7277 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7278 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7279 mem_base = xmlMemBlocks();
7280 output = gen_debug_FILE_ptr(n_output, 0);
7281 node = gen_xmlNodePtr(n_node, 1);
7282
7283 xmlLsOneNode(output, node);
7284 call_tests++;
7285 des_debug_FILE_ptr(n_output, output, 0);
7286 des_xmlNodePtr(n_node, node, 1);
7287 xmlResetLastError();
7288 if (mem_base != xmlMemBlocks()) {
7289 printf("Leak of %d blocks found in xmlLsOneNode",
7290 xmlMemBlocks() - mem_base);
7291 test_ret++;
7292 printf(" %d", n_output);
7293 printf(" %d", n_node);
7294 printf("\n");
7295 }
7296 }
7297 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007298 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007299#endif
7300
Daniel Veillarda82b1822004-11-08 16:24:57 +00007301 return(test_ret);
7302}
7303
7304
7305#define gen_nb_char_ptr 1
7306static char * gen_char_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
7307 return(NULL);
7308}
7309static void des_char_ptr(int no ATTRIBUTE_UNUSED, char * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
7310}
7311
7312static int
7313test_xmlShell(void) {
7314 int test_ret = 0;
7315
7316
7317 /* missing type support */
7318 return(test_ret);
7319}
7320
7321
Daniel Veillarda82b1822004-11-08 16:24:57 +00007322static int
7323test_xmlShellBase(void) {
7324 int test_ret = 0;
7325
William M. Brack21e4ef22005-01-02 09:53:13 +00007326#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007327 int mem_base;
7328 int ret_val;
7329 xmlShellCtxtPtr ctxt; /* the shell context */
7330 int n_ctxt;
7331 char * arg; /* unused */
7332 int n_arg;
7333 xmlNodePtr node; /* a node */
7334 int n_node;
7335 xmlNodePtr node2; /* unused */
7336 int n_node2;
7337
7338 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7339 for (n_arg = 0;n_arg < gen_nb_char_ptr;n_arg++) {
7340 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7341 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7342 mem_base = xmlMemBlocks();
7343 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7344 arg = gen_char_ptr(n_arg, 1);
7345 node = gen_xmlNodePtr(n_node, 2);
7346 node2 = gen_xmlNodePtr(n_node2, 3);
7347
7348 ret_val = xmlShellBase(ctxt, arg, node, node2);
7349 desret_int(ret_val);
7350 call_tests++;
7351 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7352 des_char_ptr(n_arg, arg, 1);
7353 des_xmlNodePtr(n_node, node, 2);
7354 des_xmlNodePtr(n_node2, node2, 3);
7355 xmlResetLastError();
7356 if (mem_base != xmlMemBlocks()) {
7357 printf("Leak of %d blocks found in xmlShellBase",
7358 xmlMemBlocks() - mem_base);
7359 test_ret++;
7360 printf(" %d", n_ctxt);
7361 printf(" %d", n_arg);
7362 printf(" %d", n_node);
7363 printf(" %d", n_node2);
7364 printf("\n");
7365 }
7366 }
7367 }
7368 }
7369 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007370 function_tests++;
7371#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007372
Daniel Veillarda82b1822004-11-08 16:24:57 +00007373 return(test_ret);
7374}
7375
7376
7377static int
7378test_xmlShellCat(void) {
7379 int test_ret = 0;
7380
William M. Brack21e4ef22005-01-02 09:53:13 +00007381#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007382 int mem_base;
7383 int ret_val;
7384 xmlShellCtxtPtr ctxt; /* the shell context */
7385 int n_ctxt;
7386 char * arg; /* unused */
7387 int n_arg;
7388 xmlNodePtr node; /* a node */
7389 int n_node;
7390 xmlNodePtr node2; /* unused */
7391 int n_node2;
7392
7393 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7394 for (n_arg = 0;n_arg < gen_nb_char_ptr;n_arg++) {
7395 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7396 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7397 mem_base = xmlMemBlocks();
7398 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7399 arg = gen_char_ptr(n_arg, 1);
7400 node = gen_xmlNodePtr(n_node, 2);
7401 node2 = gen_xmlNodePtr(n_node2, 3);
7402
7403 ret_val = xmlShellCat(ctxt, arg, node, node2);
7404 desret_int(ret_val);
7405 call_tests++;
7406 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7407 des_char_ptr(n_arg, arg, 1);
7408 des_xmlNodePtr(n_node, node, 2);
7409 des_xmlNodePtr(n_node2, node2, 3);
7410 xmlResetLastError();
7411 if (mem_base != xmlMemBlocks()) {
7412 printf("Leak of %d blocks found in xmlShellCat",
7413 xmlMemBlocks() - mem_base);
7414 test_ret++;
7415 printf(" %d", n_ctxt);
7416 printf(" %d", n_arg);
7417 printf(" %d", n_node);
7418 printf(" %d", n_node2);
7419 printf("\n");
7420 }
7421 }
7422 }
7423 }
7424 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007425 function_tests++;
7426#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007427
Daniel Veillarda82b1822004-11-08 16:24:57 +00007428 return(test_ret);
7429}
7430
7431
7432static int
7433test_xmlShellDir(void) {
7434 int test_ret = 0;
7435
William M. Brack21e4ef22005-01-02 09:53:13 +00007436#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007437 int mem_base;
7438 int ret_val;
7439 xmlShellCtxtPtr ctxt; /* the shell context */
7440 int n_ctxt;
7441 char * arg; /* unused */
7442 int n_arg;
7443 xmlNodePtr node; /* a node */
7444 int n_node;
7445 xmlNodePtr node2; /* unused */
7446 int n_node2;
7447
7448 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7449 for (n_arg = 0;n_arg < gen_nb_char_ptr;n_arg++) {
7450 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7451 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7452 mem_base = xmlMemBlocks();
7453 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7454 arg = gen_char_ptr(n_arg, 1);
7455 node = gen_xmlNodePtr(n_node, 2);
7456 node2 = gen_xmlNodePtr(n_node2, 3);
7457
7458 ret_val = xmlShellDir(ctxt, arg, node, node2);
7459 desret_int(ret_val);
7460 call_tests++;
7461 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7462 des_char_ptr(n_arg, arg, 1);
7463 des_xmlNodePtr(n_node, node, 2);
7464 des_xmlNodePtr(n_node2, node2, 3);
7465 xmlResetLastError();
7466 if (mem_base != xmlMemBlocks()) {
7467 printf("Leak of %d blocks found in xmlShellDir",
7468 xmlMemBlocks() - mem_base);
7469 test_ret++;
7470 printf(" %d", n_ctxt);
7471 printf(" %d", n_arg);
7472 printf(" %d", n_node);
7473 printf(" %d", n_node2);
7474 printf("\n");
7475 }
7476 }
7477 }
7478 }
7479 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007480 function_tests++;
7481#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007482
Daniel Veillarda82b1822004-11-08 16:24:57 +00007483 return(test_ret);
7484}
7485
7486
7487static int
7488test_xmlShellDu(void) {
7489 int test_ret = 0;
7490
William M. Brack21e4ef22005-01-02 09:53:13 +00007491#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007492 int mem_base;
7493 int ret_val;
7494 xmlShellCtxtPtr ctxt; /* the shell context */
7495 int n_ctxt;
7496 char * arg; /* unused */
7497 int n_arg;
7498 xmlNodePtr tree; /* a node defining a subtree */
7499 int n_tree;
7500 xmlNodePtr node2; /* unused */
7501 int n_node2;
7502
7503 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7504 for (n_arg = 0;n_arg < gen_nb_char_ptr;n_arg++) {
7505 for (n_tree = 0;n_tree < gen_nb_xmlNodePtr;n_tree++) {
7506 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7507 mem_base = xmlMemBlocks();
7508 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7509 arg = gen_char_ptr(n_arg, 1);
7510 tree = gen_xmlNodePtr(n_tree, 2);
7511 node2 = gen_xmlNodePtr(n_node2, 3);
7512
7513 ret_val = xmlShellDu(ctxt, arg, tree, node2);
7514 desret_int(ret_val);
7515 call_tests++;
7516 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7517 des_char_ptr(n_arg, arg, 1);
7518 des_xmlNodePtr(n_tree, tree, 2);
7519 des_xmlNodePtr(n_node2, node2, 3);
7520 xmlResetLastError();
7521 if (mem_base != xmlMemBlocks()) {
7522 printf("Leak of %d blocks found in xmlShellDu",
7523 xmlMemBlocks() - mem_base);
7524 test_ret++;
7525 printf(" %d", n_ctxt);
7526 printf(" %d", n_arg);
7527 printf(" %d", n_tree);
7528 printf(" %d", n_node2);
7529 printf("\n");
7530 }
7531 }
7532 }
7533 }
7534 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007535 function_tests++;
7536#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007537
Daniel Veillarda82b1822004-11-08 16:24:57 +00007538 return(test_ret);
7539}
7540
7541
7542static int
7543test_xmlShellList(void) {
7544 int test_ret = 0;
7545
William M. Brack21e4ef22005-01-02 09:53:13 +00007546#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007547 int mem_base;
7548 int ret_val;
7549 xmlShellCtxtPtr ctxt; /* the shell context */
7550 int n_ctxt;
7551 char * arg; /* unused */
7552 int n_arg;
7553 xmlNodePtr node; /* a node */
7554 int n_node;
7555 xmlNodePtr node2; /* unused */
7556 int n_node2;
7557
7558 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7559 for (n_arg = 0;n_arg < gen_nb_char_ptr;n_arg++) {
7560 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7561 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7562 mem_base = xmlMemBlocks();
7563 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7564 arg = gen_char_ptr(n_arg, 1);
7565 node = gen_xmlNodePtr(n_node, 2);
7566 node2 = gen_xmlNodePtr(n_node2, 3);
7567
7568 ret_val = xmlShellList(ctxt, arg, node, node2);
7569 desret_int(ret_val);
7570 call_tests++;
7571 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7572 des_char_ptr(n_arg, arg, 1);
7573 des_xmlNodePtr(n_node, node, 2);
7574 des_xmlNodePtr(n_node2, node2, 3);
7575 xmlResetLastError();
7576 if (mem_base != xmlMemBlocks()) {
7577 printf("Leak of %d blocks found in xmlShellList",
7578 xmlMemBlocks() - mem_base);
7579 test_ret++;
7580 printf(" %d", n_ctxt);
7581 printf(" %d", n_arg);
7582 printf(" %d", n_node);
7583 printf(" %d", n_node2);
7584 printf("\n");
7585 }
7586 }
7587 }
7588 }
7589 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007590 function_tests++;
7591#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007592
Daniel Veillarda82b1822004-11-08 16:24:57 +00007593 return(test_ret);
7594}
7595
7596
7597static int
7598test_xmlShellLoad(void) {
7599 int test_ret = 0;
7600
William M. Brack21e4ef22005-01-02 09:53:13 +00007601#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007602 int mem_base;
7603 int ret_val;
7604 xmlShellCtxtPtr ctxt; /* the shell context */
7605 int n_ctxt;
7606 char * filename; /* the file name */
7607 int n_filename;
7608 xmlNodePtr node; /* unused */
7609 int n_node;
7610 xmlNodePtr node2; /* unused */
7611 int n_node2;
7612
7613 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7614 for (n_filename = 0;n_filename < gen_nb_char_ptr;n_filename++) {
7615 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7616 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7617 mem_base = xmlMemBlocks();
7618 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7619 filename = gen_char_ptr(n_filename, 1);
7620 node = gen_xmlNodePtr(n_node, 2);
7621 node2 = gen_xmlNodePtr(n_node2, 3);
7622
7623 ret_val = xmlShellLoad(ctxt, filename, node, node2);
7624 desret_int(ret_val);
7625 call_tests++;
7626 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7627 des_char_ptr(n_filename, filename, 1);
7628 des_xmlNodePtr(n_node, node, 2);
7629 des_xmlNodePtr(n_node2, node2, 3);
7630 xmlResetLastError();
7631 if (mem_base != xmlMemBlocks()) {
7632 printf("Leak of %d blocks found in xmlShellLoad",
7633 xmlMemBlocks() - mem_base);
7634 test_ret++;
7635 printf(" %d", n_ctxt);
7636 printf(" %d", n_filename);
7637 printf(" %d", n_node);
7638 printf(" %d", n_node2);
7639 printf("\n");
7640 }
7641 }
7642 }
7643 }
7644 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007645 function_tests++;
7646#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007647
Daniel Veillarda82b1822004-11-08 16:24:57 +00007648 return(test_ret);
7649}
7650
7651
7652static int
7653test_xmlShellPrintXPathResult(void) {
7654 int test_ret = 0;
7655
William M. Brack21e4ef22005-01-02 09:53:13 +00007656#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007657 int mem_base;
7658 xmlXPathObjectPtr list; /* a valid result generated by an xpath evaluation */
7659 int n_list;
7660
7661 for (n_list = 0;n_list < gen_nb_xmlXPathObjectPtr;n_list++) {
7662 mem_base = xmlMemBlocks();
7663 list = gen_xmlXPathObjectPtr(n_list, 0);
7664
7665 xmlShellPrintXPathResult(list);
7666 call_tests++;
7667 des_xmlXPathObjectPtr(n_list, list, 0);
7668 xmlResetLastError();
7669 if (mem_base != xmlMemBlocks()) {
7670 printf("Leak of %d blocks found in xmlShellPrintXPathResult",
7671 xmlMemBlocks() - mem_base);
7672 test_ret++;
7673 printf(" %d", n_list);
7674 printf("\n");
7675 }
7676 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007677 function_tests++;
7678#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007679
Daniel Veillarda82b1822004-11-08 16:24:57 +00007680 return(test_ret);
7681}
7682
7683
7684static int
7685test_xmlShellPwd(void) {
7686 int test_ret = 0;
7687
William M. Brack21e4ef22005-01-02 09:53:13 +00007688#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007689 int mem_base;
7690 int ret_val;
7691 xmlShellCtxtPtr ctxt; /* the shell context */
7692 int n_ctxt;
7693 char * buffer; /* the output buffer */
7694 int n_buffer;
7695 xmlNodePtr node; /* a node */
7696 int n_node;
7697 xmlNodePtr node2; /* unused */
7698 int n_node2;
7699
7700 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7701 for (n_buffer = 0;n_buffer < gen_nb_char_ptr;n_buffer++) {
7702 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7703 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7704 mem_base = xmlMemBlocks();
7705 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7706 buffer = gen_char_ptr(n_buffer, 1);
7707 node = gen_xmlNodePtr(n_node, 2);
7708 node2 = gen_xmlNodePtr(n_node2, 3);
7709
7710 ret_val = xmlShellPwd(ctxt, buffer, node, node2);
7711 desret_int(ret_val);
7712 call_tests++;
7713 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7714 des_char_ptr(n_buffer, buffer, 1);
7715 des_xmlNodePtr(n_node, node, 2);
7716 des_xmlNodePtr(n_node2, node2, 3);
7717 xmlResetLastError();
7718 if (mem_base != xmlMemBlocks()) {
7719 printf("Leak of %d blocks found in xmlShellPwd",
7720 xmlMemBlocks() - mem_base);
7721 test_ret++;
7722 printf(" %d", n_ctxt);
7723 printf(" %d", n_buffer);
7724 printf(" %d", n_node);
7725 printf(" %d", n_node2);
7726 printf("\n");
7727 }
7728 }
7729 }
7730 }
7731 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007732 function_tests++;
7733#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007734
Daniel Veillarda82b1822004-11-08 16:24:57 +00007735 return(test_ret);
7736}
7737
7738
7739static int
7740test_xmlShellSave(void) {
7741 int test_ret = 0;
7742
William M. Brack21e4ef22005-01-02 09:53:13 +00007743#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007744 int mem_base;
7745 int ret_val;
7746 xmlShellCtxtPtr ctxt; /* the shell context */
7747 int n_ctxt;
7748 char * filename; /* the file name (optional) */
7749 int n_filename;
7750 xmlNodePtr node; /* unused */
7751 int n_node;
7752 xmlNodePtr node2; /* unused */
7753 int n_node2;
7754
7755 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7756 for (n_filename = 0;n_filename < gen_nb_char_ptr;n_filename++) {
7757 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7758 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7759 mem_base = xmlMemBlocks();
7760 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7761 filename = gen_char_ptr(n_filename, 1);
7762 node = gen_xmlNodePtr(n_node, 2);
7763 node2 = gen_xmlNodePtr(n_node2, 3);
7764
7765 ret_val = xmlShellSave(ctxt, filename, node, node2);
7766 desret_int(ret_val);
7767 call_tests++;
7768 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7769 des_char_ptr(n_filename, filename, 1);
7770 des_xmlNodePtr(n_node, node, 2);
7771 des_xmlNodePtr(n_node2, node2, 3);
7772 xmlResetLastError();
7773 if (mem_base != xmlMemBlocks()) {
7774 printf("Leak of %d blocks found in xmlShellSave",
7775 xmlMemBlocks() - mem_base);
7776 test_ret++;
7777 printf(" %d", n_ctxt);
7778 printf(" %d", n_filename);
7779 printf(" %d", n_node);
7780 printf(" %d", n_node2);
7781 printf("\n");
7782 }
7783 }
7784 }
7785 }
7786 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007787 function_tests++;
7788#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007789
Daniel Veillarda82b1822004-11-08 16:24:57 +00007790 return(test_ret);
7791}
7792
7793
7794static int
7795test_xmlShellValidate(void) {
7796 int test_ret = 0;
7797
William M. Brack21e4ef22005-01-02 09:53:13 +00007798#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED) && defined(LIBXML_VALID_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007799 int mem_base;
7800 int ret_val;
7801 xmlShellCtxtPtr ctxt; /* the shell context */
7802 int n_ctxt;
7803 char * dtd; /* the DTD URI (optional) */
7804 int n_dtd;
7805 xmlNodePtr node; /* unused */
7806 int n_node;
7807 xmlNodePtr node2; /* unused */
7808 int n_node2;
7809
7810 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7811 for (n_dtd = 0;n_dtd < gen_nb_char_ptr;n_dtd++) {
7812 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7813 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7814 mem_base = xmlMemBlocks();
7815 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7816 dtd = gen_char_ptr(n_dtd, 1);
7817 node = gen_xmlNodePtr(n_node, 2);
7818 node2 = gen_xmlNodePtr(n_node2, 3);
7819
7820 ret_val = xmlShellValidate(ctxt, dtd, node, node2);
7821 desret_int(ret_val);
7822 call_tests++;
7823 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7824 des_char_ptr(n_dtd, dtd, 1);
7825 des_xmlNodePtr(n_node, node, 2);
7826 des_xmlNodePtr(n_node2, node2, 3);
7827 xmlResetLastError();
7828 if (mem_base != xmlMemBlocks()) {
7829 printf("Leak of %d blocks found in xmlShellValidate",
7830 xmlMemBlocks() - mem_base);
7831 test_ret++;
7832 printf(" %d", n_ctxt);
7833 printf(" %d", n_dtd);
7834 printf(" %d", n_node);
7835 printf(" %d", n_node2);
7836 printf("\n");
7837 }
7838 }
7839 }
7840 }
7841 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007842 function_tests++;
7843#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007844
Daniel Veillarda82b1822004-11-08 16:24:57 +00007845 return(test_ret);
7846}
7847
7848
7849static int
7850test_xmlShellWrite(void) {
7851 int test_ret = 0;
7852
William M. Brack21e4ef22005-01-02 09:53:13 +00007853#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007854 int mem_base;
7855 int ret_val;
7856 xmlShellCtxtPtr ctxt; /* the shell context */
7857 int n_ctxt;
7858 char * filename; /* the file name */
7859 int n_filename;
7860 xmlNodePtr node; /* a node in the tree */
7861 int n_node;
7862 xmlNodePtr node2; /* unused */
7863 int n_node2;
7864
7865 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7866 for (n_filename = 0;n_filename < gen_nb_char_ptr;n_filename++) {
7867 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7868 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7869 mem_base = xmlMemBlocks();
7870 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7871 filename = gen_char_ptr(n_filename, 1);
7872 node = gen_xmlNodePtr(n_node, 2);
7873 node2 = gen_xmlNodePtr(n_node2, 3);
7874
7875 ret_val = xmlShellWrite(ctxt, filename, node, node2);
7876 desret_int(ret_val);
7877 call_tests++;
7878 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7879 des_char_ptr(n_filename, filename, 1);
7880 des_xmlNodePtr(n_node, node, 2);
7881 des_xmlNodePtr(n_node2, node2, 3);
7882 xmlResetLastError();
7883 if (mem_base != xmlMemBlocks()) {
7884 printf("Leak of %d blocks found in xmlShellWrite",
7885 xmlMemBlocks() - mem_base);
7886 test_ret++;
7887 printf(" %d", n_ctxt);
7888 printf(" %d", n_filename);
7889 printf(" %d", n_node);
7890 printf(" %d", n_node2);
7891 printf("\n");
7892 }
7893 }
7894 }
7895 }
7896 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007897 function_tests++;
7898#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007899
Daniel Veillarda82b1822004-11-08 16:24:57 +00007900 return(test_ret);
7901}
7902
7903static int
7904test_debugXML(void) {
7905 int test_ret = 0;
7906
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007907 if (quiet == 0) printf("Testing debugXML : 25 of 28 functions ...\n");
Daniel Veillarda82b1822004-11-08 16:24:57 +00007908 test_ret += test_xmlBoolToText();
7909 test_ret += test_xmlDebugCheckDocument();
7910 test_ret += test_xmlDebugDumpAttr();
7911 test_ret += test_xmlDebugDumpAttrList();
7912 test_ret += test_xmlDebugDumpDTD();
7913 test_ret += test_xmlDebugDumpDocument();
7914 test_ret += test_xmlDebugDumpDocumentHead();
7915 test_ret += test_xmlDebugDumpEntities();
7916 test_ret += test_xmlDebugDumpNode();
7917 test_ret += test_xmlDebugDumpNodeList();
7918 test_ret += test_xmlDebugDumpOneNode();
7919 test_ret += test_xmlDebugDumpString();
7920 test_ret += test_xmlLsCountNode();
7921 test_ret += test_xmlLsOneNode();
7922 test_ret += test_xmlShell();
7923 test_ret += test_xmlShellBase();
7924 test_ret += test_xmlShellCat();
7925 test_ret += test_xmlShellDir();
7926 test_ret += test_xmlShellDu();
7927 test_ret += test_xmlShellList();
7928 test_ret += test_xmlShellLoad();
7929 test_ret += test_xmlShellPrintXPathResult();
7930 test_ret += test_xmlShellPwd();
7931 test_ret += test_xmlShellSave();
7932 test_ret += test_xmlShellValidate();
7933 test_ret += test_xmlShellWrite();
7934
7935 if (test_ret != 0)
7936 printf("Module debugXML: %d errors\n", test_ret);
7937 return(test_ret);
7938}
7939
7940static int
Daniel Veillard2ae13382005-01-25 23:45:06 +00007941test_xmlDictCleanup(void) {
7942 int test_ret = 0;
7943
7944 int mem_base;
7945
7946 mem_base = xmlMemBlocks();
7947
7948 xmlDictCleanup();
7949 call_tests++;
7950 xmlResetLastError();
7951 if (mem_base != xmlMemBlocks()) {
7952 printf("Leak of %d blocks found in xmlDictCleanup",
7953 xmlMemBlocks() - mem_base);
7954 test_ret++;
7955 printf("\n");
7956 }
7957 function_tests++;
7958
7959 return(test_ret);
7960}
7961
7962
7963static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00007964test_xmlDictCreate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00007965 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00007966
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00007967 int mem_base;
7968 xmlDictPtr ret_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +00007969
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00007970 mem_base = xmlMemBlocks();
7971
7972 ret_val = xmlDictCreate();
7973 desret_xmlDictPtr(ret_val);
7974 call_tests++;
7975 xmlResetLastError();
7976 if (mem_base != xmlMemBlocks()) {
7977 printf("Leak of %d blocks found in xmlDictCreate",
7978 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00007979 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00007980 printf("\n");
7981 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00007982 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007983
Daniel Veillard42595322004-11-08 10:52:06 +00007984 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00007985}
7986
7987
7988static int
7989test_xmlDictCreateSub(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00007990 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00007991
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00007992 int mem_base;
7993 xmlDictPtr ret_val;
7994 xmlDictPtr sub; /* an existing dictionnary */
7995 int n_sub;
Daniel Veillardd93f6252004-11-02 15:53:51 +00007996
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00007997 for (n_sub = 0;n_sub < gen_nb_xmlDictPtr;n_sub++) {
7998 mem_base = xmlMemBlocks();
7999 sub = gen_xmlDictPtr(n_sub, 0);
8000
8001 ret_val = xmlDictCreateSub(sub);
8002 desret_xmlDictPtr(ret_val);
8003 call_tests++;
8004 des_xmlDictPtr(n_sub, sub, 0);
8005 xmlResetLastError();
8006 if (mem_base != xmlMemBlocks()) {
8007 printf("Leak of %d blocks found in xmlDictCreateSub",
8008 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008009 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008010 printf(" %d", n_sub);
8011 printf("\n");
8012 }
8013 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008014 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008015
Daniel Veillard42595322004-11-08 10:52:06 +00008016 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008017}
8018
8019
8020static int
Daniel Veillard91b955c2004-12-10 10:26:42 +00008021test_xmlDictExists(void) {
8022 int test_ret = 0;
8023
8024 int mem_base;
8025 const xmlChar * ret_val;
8026 xmlDictPtr dict; /* the dictionnary */
8027 int n_dict;
8028 xmlChar * name; /* the name of the userdata */
8029 int n_name;
8030 int len; /* the length of the name, if -1 it is recomputed */
8031 int n_len;
8032
8033 for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
8034 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
8035 for (n_len = 0;n_len < gen_nb_int;n_len++) {
8036 mem_base = xmlMemBlocks();
8037 dict = gen_xmlDictPtr(n_dict, 0);
8038 name = gen_const_xmlChar_ptr(n_name, 1);
8039 len = gen_int(n_len, 2);
8040
8041 ret_val = xmlDictExists(dict, (const xmlChar *)name, len);
8042 desret_const_xmlChar_ptr(ret_val);
8043 call_tests++;
8044 des_xmlDictPtr(n_dict, dict, 0);
8045 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
8046 des_int(n_len, len, 2);
8047 xmlResetLastError();
8048 if (mem_base != xmlMemBlocks()) {
8049 printf("Leak of %d blocks found in xmlDictExists",
8050 xmlMemBlocks() - mem_base);
8051 test_ret++;
8052 printf(" %d", n_dict);
8053 printf(" %d", n_name);
8054 printf(" %d", n_len);
8055 printf("\n");
8056 }
8057 }
8058 }
8059 }
8060 function_tests++;
8061
8062 return(test_ret);
8063}
8064
8065
8066static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00008067test_xmlDictLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008068 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008069
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008070 int mem_base;
8071 const xmlChar * ret_val;
8072 xmlDictPtr dict; /* the dictionnary */
8073 int n_dict;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008074 xmlChar * name; /* the name of the userdata */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008075 int n_name;
8076 int len; /* the length of the name, if -1 it is recomputed */
8077 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008078
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008079 for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
8080 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
8081 for (n_len = 0;n_len < gen_nb_int;n_len++) {
8082 mem_base = xmlMemBlocks();
8083 dict = gen_xmlDictPtr(n_dict, 0);
8084 name = gen_const_xmlChar_ptr(n_name, 1);
8085 len = gen_int(n_len, 2);
8086
William M. Brackf13f77f2004-11-12 16:03:48 +00008087 ret_val = xmlDictLookup(dict, (const xmlChar *)name, len);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008088 desret_const_xmlChar_ptr(ret_val);
8089 call_tests++;
8090 des_xmlDictPtr(n_dict, dict, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00008091 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008092 des_int(n_len, len, 2);
8093 xmlResetLastError();
8094 if (mem_base != xmlMemBlocks()) {
8095 printf("Leak of %d blocks found in xmlDictLookup",
8096 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008097 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008098 printf(" %d", n_dict);
8099 printf(" %d", n_name);
8100 printf(" %d", n_len);
8101 printf("\n");
8102 }
8103 }
8104 }
8105 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008106 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008107
Daniel Veillard42595322004-11-08 10:52:06 +00008108 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008109}
8110
8111
8112static int
8113test_xmlDictOwns(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008114 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008115
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008116 int mem_base;
8117 int ret_val;
8118 xmlDictPtr dict; /* the dictionnary */
8119 int n_dict;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008120 xmlChar * str; /* the string */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008121 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008122
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008123 for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
8124 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
8125 mem_base = xmlMemBlocks();
8126 dict = gen_xmlDictPtr(n_dict, 0);
8127 str = gen_const_xmlChar_ptr(n_str, 1);
8128
William M. Brackf13f77f2004-11-12 16:03:48 +00008129 ret_val = xmlDictOwns(dict, (const xmlChar *)str);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008130 desret_int(ret_val);
8131 call_tests++;
8132 des_xmlDictPtr(n_dict, dict, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00008133 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008134 xmlResetLastError();
8135 if (mem_base != xmlMemBlocks()) {
8136 printf("Leak of %d blocks found in xmlDictOwns",
8137 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008138 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008139 printf(" %d", n_dict);
8140 printf(" %d", n_str);
8141 printf("\n");
8142 }
8143 }
8144 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008145 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008146
Daniel Veillard42595322004-11-08 10:52:06 +00008147 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008148}
8149
8150
8151static int
8152test_xmlDictQLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008153 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008154
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008155 int mem_base;
8156 const xmlChar * ret_val;
8157 xmlDictPtr dict; /* the dictionnary */
8158 int n_dict;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008159 xmlChar * prefix; /* the prefix */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008160 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008161 xmlChar * name; /* the name */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008162 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008163
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008164 for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
8165 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
8166 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
8167 mem_base = xmlMemBlocks();
8168 dict = gen_xmlDictPtr(n_dict, 0);
8169 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
8170 name = gen_const_xmlChar_ptr(n_name, 2);
8171
William M. Brackf13f77f2004-11-12 16:03:48 +00008172 ret_val = xmlDictQLookup(dict, (const xmlChar *)prefix, (const xmlChar *)name);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008173 desret_const_xmlChar_ptr(ret_val);
8174 call_tests++;
8175 des_xmlDictPtr(n_dict, dict, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00008176 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
8177 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008178 xmlResetLastError();
8179 if (mem_base != xmlMemBlocks()) {
8180 printf("Leak of %d blocks found in xmlDictQLookup",
8181 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008182 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008183 printf(" %d", n_dict);
8184 printf(" %d", n_prefix);
8185 printf(" %d", n_name);
8186 printf("\n");
8187 }
8188 }
8189 }
8190 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008191 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008192
Daniel Veillard42595322004-11-08 10:52:06 +00008193 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008194}
8195
8196
8197static int
8198test_xmlDictReference(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008199 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008200
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008201 int mem_base;
8202 int ret_val;
8203 xmlDictPtr dict; /* the dictionnary */
8204 int n_dict;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008205
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008206 for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
8207 mem_base = xmlMemBlocks();
8208 dict = gen_xmlDictPtr(n_dict, 0);
8209
8210 ret_val = xmlDictReference(dict);
8211 xmlDictFree(dict);
8212 desret_int(ret_val);
8213 call_tests++;
8214 des_xmlDictPtr(n_dict, dict, 0);
8215 xmlResetLastError();
8216 if (mem_base != xmlMemBlocks()) {
8217 printf("Leak of %d blocks found in xmlDictReference",
8218 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008219 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008220 printf(" %d", n_dict);
8221 printf("\n");
8222 }
8223 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008224 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008225
Daniel Veillard42595322004-11-08 10:52:06 +00008226 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008227}
8228
8229
8230static int
8231test_xmlDictSize(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008232 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008233
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008234 int mem_base;
8235 int ret_val;
8236 xmlDictPtr dict; /* the dictionnary */
8237 int n_dict;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008238
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008239 for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
8240 mem_base = xmlMemBlocks();
8241 dict = gen_xmlDictPtr(n_dict, 0);
8242
8243 ret_val = xmlDictSize(dict);
8244 desret_int(ret_val);
8245 call_tests++;
8246 des_xmlDictPtr(n_dict, dict, 0);
8247 xmlResetLastError();
8248 if (mem_base != xmlMemBlocks()) {
8249 printf("Leak of %d blocks found in xmlDictSize",
8250 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008251 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008252 printf(" %d", n_dict);
8253 printf("\n");
8254 }
8255 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008256 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008257
Daniel Veillard42595322004-11-08 10:52:06 +00008258 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008259}
8260
8261static int
8262test_dict(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008263 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008264
Daniel Veillard2ae13382005-01-25 23:45:06 +00008265 if (quiet == 0) printf("Testing dict : 9 of 10 functions ...\n");
8266 test_ret += test_xmlDictCleanup();
Daniel Veillard42595322004-11-08 10:52:06 +00008267 test_ret += test_xmlDictCreate();
8268 test_ret += test_xmlDictCreateSub();
Daniel Veillard91b955c2004-12-10 10:26:42 +00008269 test_ret += test_xmlDictExists();
Daniel Veillard42595322004-11-08 10:52:06 +00008270 test_ret += test_xmlDictLookup();
8271 test_ret += test_xmlDictOwns();
8272 test_ret += test_xmlDictQLookup();
8273 test_ret += test_xmlDictReference();
8274 test_ret += test_xmlDictSize();
Daniel Veillardd93f6252004-11-02 15:53:51 +00008275
Daniel Veillard42595322004-11-08 10:52:06 +00008276 if (test_ret != 0)
8277 printf("Module dict: %d errors\n", test_ret);
8278 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008279}
8280
8281static int
8282test_UTF8Toisolat1(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008283 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008284
William M. Brack21e4ef22005-01-02 09:53:13 +00008285#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +00008286#ifdef LIBXML_OUTPUT_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +00008287 int mem_base;
8288 int ret_val;
8289 unsigned char * out; /* a pointer to an array of bytes to store the result */
8290 int n_out;
8291 int * outlen; /* the length of @out */
8292 int n_outlen;
8293 unsigned char * in; /* a pointer to an array of UTF-8 chars */
8294 int n_in;
8295 int * inlen; /* the length of @in */
8296 int n_inlen;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008297
Daniel Veillardce682bc2004-11-05 17:22:25 +00008298 for (n_out = 0;n_out < gen_nb_unsigned_char_ptr;n_out++) {
8299 for (n_outlen = 0;n_outlen < gen_nb_int_ptr;n_outlen++) {
8300 for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) {
8301 for (n_inlen = 0;n_inlen < gen_nb_int_ptr;n_inlen++) {
8302 mem_base = xmlMemBlocks();
8303 out = gen_unsigned_char_ptr(n_out, 0);
8304 outlen = gen_int_ptr(n_outlen, 1);
8305 in = gen_const_unsigned_char_ptr(n_in, 2);
8306 inlen = gen_int_ptr(n_inlen, 3);
8307
William M. Brackf13f77f2004-11-12 16:03:48 +00008308 ret_val = UTF8Toisolat1(out, outlen, (const unsigned char *)in, inlen);
Daniel Veillardce682bc2004-11-05 17:22:25 +00008309 desret_int(ret_val);
8310 call_tests++;
8311 des_unsigned_char_ptr(n_out, out, 0);
8312 des_int_ptr(n_outlen, outlen, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00008313 des_const_unsigned_char_ptr(n_in, (const unsigned char *)in, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +00008314 des_int_ptr(n_inlen, inlen, 3);
8315 xmlResetLastError();
8316 if (mem_base != xmlMemBlocks()) {
8317 printf("Leak of %d blocks found in UTF8Toisolat1",
8318 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008319 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008320 printf(" %d", n_out);
8321 printf(" %d", n_outlen);
8322 printf(" %d", n_in);
8323 printf(" %d", n_inlen);
8324 printf("\n");
8325 }
8326 }
8327 }
8328 }
8329 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008330 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00008331#endif
William M. Brack21e4ef22005-01-02 09:53:13 +00008332#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +00008333
Daniel Veillard42595322004-11-08 10:52:06 +00008334 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008335}
8336
8337
8338static int
8339test_isolat1ToUTF8(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008340 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008341
Daniel Veillardce682bc2004-11-05 17:22:25 +00008342 int mem_base;
8343 int ret_val;
8344 unsigned char * out; /* a pointer to an array of bytes to store the result */
8345 int n_out;
8346 int * outlen; /* the length of @out */
8347 int n_outlen;
8348 unsigned char * in; /* a pointer to an array of ISO Latin 1 chars */
8349 int n_in;
8350 int * inlen; /* the length of @in */
8351 int n_inlen;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008352
Daniel Veillardce682bc2004-11-05 17:22:25 +00008353 for (n_out = 0;n_out < gen_nb_unsigned_char_ptr;n_out++) {
8354 for (n_outlen = 0;n_outlen < gen_nb_int_ptr;n_outlen++) {
8355 for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) {
8356 for (n_inlen = 0;n_inlen < gen_nb_int_ptr;n_inlen++) {
8357 mem_base = xmlMemBlocks();
8358 out = gen_unsigned_char_ptr(n_out, 0);
8359 outlen = gen_int_ptr(n_outlen, 1);
8360 in = gen_const_unsigned_char_ptr(n_in, 2);
8361 inlen = gen_int_ptr(n_inlen, 3);
8362
William M. Brackf13f77f2004-11-12 16:03:48 +00008363 ret_val = isolat1ToUTF8(out, outlen, (const unsigned char *)in, inlen);
Daniel Veillardce682bc2004-11-05 17:22:25 +00008364 desret_int(ret_val);
8365 call_tests++;
8366 des_unsigned_char_ptr(n_out, out, 0);
8367 des_int_ptr(n_outlen, outlen, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00008368 des_const_unsigned_char_ptr(n_in, (const unsigned char *)in, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +00008369 des_int_ptr(n_inlen, inlen, 3);
8370 xmlResetLastError();
8371 if (mem_base != xmlMemBlocks()) {
8372 printf("Leak of %d blocks found in isolat1ToUTF8",
8373 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008374 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008375 printf(" %d", n_out);
8376 printf(" %d", n_outlen);
8377 printf(" %d", n_in);
8378 printf(" %d", n_inlen);
8379 printf("\n");
8380 }
8381 }
8382 }
8383 }
8384 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00008385 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008386
Daniel Veillard42595322004-11-08 10:52:06 +00008387 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008388}
8389
8390
8391static int
8392test_xmlAddEncodingAlias(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008393 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008394
8395 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008396 char * name; /* the encoding name as parsed, in UTF-8 format (ASCII actually) */
Daniel Veillardd93f6252004-11-02 15:53:51 +00008397 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008398 char * alias; /* the alias name as parsed, in UTF-8 format (ASCII actually) */
Daniel Veillardd93f6252004-11-02 15:53:51 +00008399 int n_alias;
8400
8401 for (n_name = 0;n_name < gen_nb_const_char_ptr;n_name++) {
8402 for (n_alias = 0;n_alias < gen_nb_const_char_ptr;n_alias++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +00008403 name = gen_const_char_ptr(n_name, 0);
8404 alias = gen_const_char_ptr(n_alias, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008405
William M. Brackf13f77f2004-11-12 16:03:48 +00008406 ret_val = xmlAddEncodingAlias((const char *)name, (const char *)alias);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008407 desret_int(ret_val);
8408 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00008409 des_const_char_ptr(n_name, (const char *)name, 0);
8410 des_const_char_ptr(n_alias, (const char *)alias, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008411 xmlResetLastError();
8412 }
8413 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00008414 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008415
Daniel Veillard42595322004-11-08 10:52:06 +00008416 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008417}
8418
8419
Daniel Veillardce682bc2004-11-05 17:22:25 +00008420#define gen_nb_xmlCharEncodingHandler_ptr 1
8421static xmlCharEncodingHandler * gen_xmlCharEncodingHandler_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
8422 return(NULL);
8423}
8424static void des_xmlCharEncodingHandler_ptr(int no ATTRIBUTE_UNUSED, xmlCharEncodingHandler * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
8425}
8426
Daniel Veillardd93f6252004-11-02 15:53:51 +00008427static int
8428test_xmlCharEncCloseFunc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008429 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008430
Daniel Veillardce682bc2004-11-05 17:22:25 +00008431 int mem_base;
8432 int ret_val;
8433 xmlCharEncodingHandler * handler; /* char enconding transformation data structure */
8434 int n_handler;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008435
Daniel Veillardce682bc2004-11-05 17:22:25 +00008436 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandler_ptr;n_handler++) {
8437 mem_base = xmlMemBlocks();
8438 handler = gen_xmlCharEncodingHandler_ptr(n_handler, 0);
8439
8440 ret_val = xmlCharEncCloseFunc(handler);
8441 desret_int(ret_val);
8442 call_tests++;
8443 des_xmlCharEncodingHandler_ptr(n_handler, handler, 0);
8444 xmlResetLastError();
8445 if (mem_base != xmlMemBlocks()) {
8446 printf("Leak of %d blocks found in xmlCharEncCloseFunc",
8447 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008448 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008449 printf(" %d", n_handler);
8450 printf("\n");
8451 }
8452 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00008453 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008454
Daniel Veillard42595322004-11-08 10:52:06 +00008455 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008456}
8457
8458
8459static int
8460test_xmlCharEncFirstLine(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008461 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008462
Daniel Veillardce682bc2004-11-05 17:22:25 +00008463 int mem_base;
8464 int ret_val;
8465 xmlCharEncodingHandler * handler; /* char enconding transformation data structure */
8466 int n_handler;
8467 xmlBufferPtr out; /* an xmlBuffer for the output. */
8468 int n_out;
8469 xmlBufferPtr in; /* an xmlBuffer for the input */
8470 int n_in;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008471
Daniel Veillardce682bc2004-11-05 17:22:25 +00008472 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandler_ptr;n_handler++) {
8473 for (n_out = 0;n_out < gen_nb_xmlBufferPtr;n_out++) {
8474 for (n_in = 0;n_in < gen_nb_xmlBufferPtr;n_in++) {
8475 mem_base = xmlMemBlocks();
8476 handler = gen_xmlCharEncodingHandler_ptr(n_handler, 0);
8477 out = gen_xmlBufferPtr(n_out, 1);
8478 in = gen_xmlBufferPtr(n_in, 2);
8479
8480 ret_val = xmlCharEncFirstLine(handler, out, in);
8481 desret_int(ret_val);
8482 call_tests++;
8483 des_xmlCharEncodingHandler_ptr(n_handler, handler, 0);
8484 des_xmlBufferPtr(n_out, out, 1);
8485 des_xmlBufferPtr(n_in, in, 2);
8486 xmlResetLastError();
8487 if (mem_base != xmlMemBlocks()) {
8488 printf("Leak of %d blocks found in xmlCharEncFirstLine",
8489 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008490 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008491 printf(" %d", n_handler);
8492 printf(" %d", n_out);
8493 printf(" %d", n_in);
8494 printf("\n");
8495 }
8496 }
8497 }
8498 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00008499 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008500
Daniel Veillard42595322004-11-08 10:52:06 +00008501 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008502}
8503
8504
8505static int
8506test_xmlCharEncInFunc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008507 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008508
Daniel Veillardce682bc2004-11-05 17:22:25 +00008509 int mem_base;
8510 int ret_val;
8511 xmlCharEncodingHandler * handler; /* char encoding transformation data structure */
8512 int n_handler;
8513 xmlBufferPtr out; /* an xmlBuffer for the output. */
8514 int n_out;
8515 xmlBufferPtr in; /* an xmlBuffer for the input */
8516 int n_in;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008517
Daniel Veillardce682bc2004-11-05 17:22:25 +00008518 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandler_ptr;n_handler++) {
8519 for (n_out = 0;n_out < gen_nb_xmlBufferPtr;n_out++) {
8520 for (n_in = 0;n_in < gen_nb_xmlBufferPtr;n_in++) {
8521 mem_base = xmlMemBlocks();
8522 handler = gen_xmlCharEncodingHandler_ptr(n_handler, 0);
8523 out = gen_xmlBufferPtr(n_out, 1);
8524 in = gen_xmlBufferPtr(n_in, 2);
8525
8526 ret_val = xmlCharEncInFunc(handler, out, in);
8527 desret_int(ret_val);
8528 call_tests++;
8529 des_xmlCharEncodingHandler_ptr(n_handler, handler, 0);
8530 des_xmlBufferPtr(n_out, out, 1);
8531 des_xmlBufferPtr(n_in, in, 2);
8532 xmlResetLastError();
8533 if (mem_base != xmlMemBlocks()) {
8534 printf("Leak of %d blocks found in xmlCharEncInFunc",
8535 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008536 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008537 printf(" %d", n_handler);
8538 printf(" %d", n_out);
8539 printf(" %d", n_in);
8540 printf("\n");
8541 }
8542 }
8543 }
8544 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00008545 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008546
Daniel Veillard42595322004-11-08 10:52:06 +00008547 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008548}
8549
8550
8551static int
8552test_xmlCharEncOutFunc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008553 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008554
Daniel Veillardce682bc2004-11-05 17:22:25 +00008555 int mem_base;
8556 int ret_val;
8557 xmlCharEncodingHandler * handler; /* char enconding transformation data structure */
8558 int n_handler;
8559 xmlBufferPtr out; /* an xmlBuffer for the output. */
8560 int n_out;
8561 xmlBufferPtr in; /* an xmlBuffer for the input */
8562 int n_in;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008563
Daniel Veillardce682bc2004-11-05 17:22:25 +00008564 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandler_ptr;n_handler++) {
8565 for (n_out = 0;n_out < gen_nb_xmlBufferPtr;n_out++) {
8566 for (n_in = 0;n_in < gen_nb_xmlBufferPtr;n_in++) {
8567 mem_base = xmlMemBlocks();
8568 handler = gen_xmlCharEncodingHandler_ptr(n_handler, 0);
8569 out = gen_xmlBufferPtr(n_out, 1);
8570 in = gen_xmlBufferPtr(n_in, 2);
8571
8572 ret_val = xmlCharEncOutFunc(handler, out, in);
8573 desret_int(ret_val);
8574 call_tests++;
8575 des_xmlCharEncodingHandler_ptr(n_handler, handler, 0);
8576 des_xmlBufferPtr(n_out, out, 1);
8577 des_xmlBufferPtr(n_in, in, 2);
8578 xmlResetLastError();
8579 if (mem_base != xmlMemBlocks()) {
8580 printf("Leak of %d blocks found in xmlCharEncOutFunc",
8581 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008582 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008583 printf(" %d", n_handler);
8584 printf(" %d", n_out);
8585 printf(" %d", n_in);
8586 printf("\n");
8587 }
8588 }
8589 }
8590 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00008591 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008592
Daniel Veillard42595322004-11-08 10:52:06 +00008593 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008594}
8595
8596
8597static int
8598test_xmlCleanupCharEncodingHandlers(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008599 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008600
8601
8602
8603 xmlCleanupCharEncodingHandlers();
8604 call_tests++;
8605 xmlResetLastError();
Daniel Veillard3d97e662004-11-04 10:49:00 +00008606 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008607
Daniel Veillard42595322004-11-08 10:52:06 +00008608 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008609}
8610
8611
8612static int
8613test_xmlCleanupEncodingAliases(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008614 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008615
8616 int mem_base;
8617
8618 mem_base = xmlMemBlocks();
8619
8620 xmlCleanupEncodingAliases();
8621 call_tests++;
8622 xmlResetLastError();
8623 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00008624 printf("Leak of %d blocks found in xmlCleanupEncodingAliases",
Daniel Veillardd93f6252004-11-02 15:53:51 +00008625 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008626 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00008627 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00008628 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00008629 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008630
Daniel Veillard42595322004-11-08 10:52:06 +00008631 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008632}
8633
8634
8635static int
8636test_xmlDelEncodingAlias(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008637 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008638
8639 int mem_base;
8640 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008641 char * alias; /* the alias name as parsed, in UTF-8 format (ASCII actually) */
Daniel Veillardd93f6252004-11-02 15:53:51 +00008642 int n_alias;
8643
8644 for (n_alias = 0;n_alias < gen_nb_const_char_ptr;n_alias++) {
8645 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00008646 alias = gen_const_char_ptr(n_alias, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008647
William M. Brackf13f77f2004-11-12 16:03:48 +00008648 ret_val = xmlDelEncodingAlias((const char *)alias);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008649 desret_int(ret_val);
8650 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00008651 des_const_char_ptr(n_alias, (const char *)alias, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008652 xmlResetLastError();
8653 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00008654 printf("Leak of %d blocks found in xmlDelEncodingAlias",
Daniel Veillardd93f6252004-11-02 15:53:51 +00008655 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008656 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00008657 printf(" %d", n_alias);
8658 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00008659 }
8660 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00008661 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008662
Daniel Veillard42595322004-11-08 10:52:06 +00008663 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008664}
8665
8666
8667static int
8668test_xmlDetectCharEncoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008669 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008670
Daniel Veillardce682bc2004-11-05 17:22:25 +00008671 int mem_base;
8672 xmlCharEncoding ret_val;
8673 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). */
8674 int n_in;
8675 int len; /* pointer to the length of the buffer */
8676 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008677
Daniel Veillardce682bc2004-11-05 17:22:25 +00008678 for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) {
8679 for (n_len = 0;n_len < gen_nb_int;n_len++) {
8680 mem_base = xmlMemBlocks();
8681 in = gen_const_unsigned_char_ptr(n_in, 0);
8682 len = gen_int(n_len, 1);
8683
William M. Brackf13f77f2004-11-12 16:03:48 +00008684 ret_val = xmlDetectCharEncoding((const unsigned char *)in, len);
Daniel Veillardce682bc2004-11-05 17:22:25 +00008685 desret_xmlCharEncoding(ret_val);
8686 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00008687 des_const_unsigned_char_ptr(n_in, (const unsigned char *)in, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +00008688 des_int(n_len, len, 1);
8689 xmlResetLastError();
8690 if (mem_base != xmlMemBlocks()) {
8691 printf("Leak of %d blocks found in xmlDetectCharEncoding",
8692 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008693 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008694 printf(" %d", n_in);
8695 printf(" %d", n_len);
8696 printf("\n");
8697 }
8698 }
8699 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00008700 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008701
Daniel Veillard42595322004-11-08 10:52:06 +00008702 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008703}
8704
8705
8706static int
8707test_xmlFindCharEncodingHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008708 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008709
8710
8711 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00008712 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008713}
8714
8715
8716static int
8717test_xmlGetCharEncodingHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008718 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008719
8720
8721 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00008722 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008723}
8724
8725
8726static int
8727test_xmlGetCharEncodingName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008728 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008729
Daniel Veillard3d97e662004-11-04 10:49:00 +00008730 int mem_base;
8731 const char * ret_val;
8732 xmlCharEncoding enc; /* the encoding */
8733 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008734
Daniel Veillard3d97e662004-11-04 10:49:00 +00008735 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
8736 mem_base = xmlMemBlocks();
8737 enc = gen_xmlCharEncoding(n_enc, 0);
8738
8739 ret_val = xmlGetCharEncodingName(enc);
8740 desret_const_char_ptr(ret_val);
8741 call_tests++;
8742 des_xmlCharEncoding(n_enc, enc, 0);
8743 xmlResetLastError();
8744 if (mem_base != xmlMemBlocks()) {
8745 printf("Leak of %d blocks found in xmlGetCharEncodingName",
8746 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008747 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00008748 printf(" %d", n_enc);
8749 printf("\n");
8750 }
8751 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00008752 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008753
Daniel Veillard42595322004-11-08 10:52:06 +00008754 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008755}
8756
8757
8758static int
8759test_xmlGetEncodingAlias(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008760 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008761
8762 int mem_base;
8763 const char * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008764 char * alias; /* the alias name as parsed, in UTF-8 format (ASCII actually) */
Daniel Veillardd93f6252004-11-02 15:53:51 +00008765 int n_alias;
8766
8767 for (n_alias = 0;n_alias < gen_nb_const_char_ptr;n_alias++) {
8768 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00008769 alias = gen_const_char_ptr(n_alias, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008770
William M. Brackf13f77f2004-11-12 16:03:48 +00008771 ret_val = xmlGetEncodingAlias((const char *)alias);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008772 desret_const_char_ptr(ret_val);
8773 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00008774 des_const_char_ptr(n_alias, (const char *)alias, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008775 xmlResetLastError();
8776 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00008777 printf("Leak of %d blocks found in xmlGetEncodingAlias",
Daniel Veillardd93f6252004-11-02 15:53:51 +00008778 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008779 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00008780 printf(" %d", n_alias);
8781 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00008782 }
8783 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00008784 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008785
Daniel Veillard42595322004-11-08 10:52:06 +00008786 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008787}
8788
8789
8790static int
8791test_xmlInitCharEncodingHandlers(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008792 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008793
8794
8795
8796 xmlInitCharEncodingHandlers();
8797 call_tests++;
8798 xmlResetLastError();
Daniel Veillard3d97e662004-11-04 10:49:00 +00008799 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008800
Daniel Veillard42595322004-11-08 10:52:06 +00008801 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008802}
8803
8804
8805static int
8806test_xmlNewCharEncodingHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008807 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008808
8809
8810 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00008811 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008812}
8813
8814
8815static int
8816test_xmlParseCharEncoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008817 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008818
Daniel Veillard3d97e662004-11-04 10:49:00 +00008819 int mem_base;
8820 xmlCharEncoding ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008821 char * name; /* the encoding name as parsed, in UTF-8 format (ASCII actually) */
Daniel Veillard3d97e662004-11-04 10:49:00 +00008822 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008823
Daniel Veillard3d97e662004-11-04 10:49:00 +00008824 for (n_name = 0;n_name < gen_nb_const_char_ptr;n_name++) {
8825 mem_base = xmlMemBlocks();
8826 name = gen_const_char_ptr(n_name, 0);
8827
William M. Brackf13f77f2004-11-12 16:03:48 +00008828 ret_val = xmlParseCharEncoding((const char *)name);
Daniel Veillard3d97e662004-11-04 10:49:00 +00008829 desret_xmlCharEncoding(ret_val);
8830 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00008831 des_const_char_ptr(n_name, (const char *)name, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00008832 xmlResetLastError();
8833 if (mem_base != xmlMemBlocks()) {
8834 printf("Leak of %d blocks found in xmlParseCharEncoding",
8835 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008836 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00008837 printf(" %d", n_name);
8838 printf("\n");
8839 }
8840 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00008841 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008842
Daniel Veillard42595322004-11-08 10:52:06 +00008843 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008844}
8845
8846
Daniel Veillardce682bc2004-11-05 17:22:25 +00008847#define gen_nb_xmlCharEncodingHandlerPtr 1
8848static xmlCharEncodingHandlerPtr gen_xmlCharEncodingHandlerPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
8849 return(NULL);
8850}
8851static void des_xmlCharEncodingHandlerPtr(int no ATTRIBUTE_UNUSED, xmlCharEncodingHandlerPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
8852}
8853
Daniel Veillardd93f6252004-11-02 15:53:51 +00008854static int
8855test_xmlRegisterCharEncodingHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008856 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008857
Daniel Veillardce682bc2004-11-05 17:22:25 +00008858 int mem_base;
8859 xmlCharEncodingHandlerPtr handler; /* the xmlCharEncodingHandlerPtr handler block */
8860 int n_handler;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008861
Daniel Veillardce682bc2004-11-05 17:22:25 +00008862 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandlerPtr;n_handler++) {
8863 mem_base = xmlMemBlocks();
8864 handler = gen_xmlCharEncodingHandlerPtr(n_handler, 0);
8865
8866 xmlRegisterCharEncodingHandler(handler);
8867 call_tests++;
8868 des_xmlCharEncodingHandlerPtr(n_handler, handler, 0);
8869 xmlResetLastError();
8870 if (mem_base != xmlMemBlocks()) {
8871 printf("Leak of %d blocks found in xmlRegisterCharEncodingHandler",
8872 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008873 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008874 printf(" %d", n_handler);
8875 printf("\n");
8876 }
8877 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00008878 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008879
Daniel Veillard42595322004-11-08 10:52:06 +00008880 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008881}
8882
8883static int
8884test_encoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008885 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008886
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008887 if (quiet == 0) printf("Testing encoding : 16 of 19 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00008888 test_ret += test_UTF8Toisolat1();
8889 test_ret += test_isolat1ToUTF8();
8890 test_ret += test_xmlAddEncodingAlias();
8891 test_ret += test_xmlCharEncCloseFunc();
8892 test_ret += test_xmlCharEncFirstLine();
8893 test_ret += test_xmlCharEncInFunc();
8894 test_ret += test_xmlCharEncOutFunc();
8895 test_ret += test_xmlCleanupCharEncodingHandlers();
8896 test_ret += test_xmlCleanupEncodingAliases();
8897 test_ret += test_xmlDelEncodingAlias();
8898 test_ret += test_xmlDetectCharEncoding();
8899 test_ret += test_xmlFindCharEncodingHandler();
8900 test_ret += test_xmlGetCharEncodingHandler();
8901 test_ret += test_xmlGetCharEncodingName();
8902 test_ret += test_xmlGetEncodingAlias();
8903 test_ret += test_xmlInitCharEncodingHandlers();
8904 test_ret += test_xmlNewCharEncodingHandler();
8905 test_ret += test_xmlParseCharEncoding();
8906 test_ret += test_xmlRegisterCharEncodingHandler();
Daniel Veillardd93f6252004-11-02 15:53:51 +00008907
Daniel Veillard42595322004-11-08 10:52:06 +00008908 if (test_ret != 0)
8909 printf("Module encoding: %d errors\n", test_ret);
8910 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008911}
8912
8913static int
8914test_xmlAddDocEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008915 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008916
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00008917 int mem_base;
8918 xmlEntityPtr ret_val;
8919 xmlDocPtr doc; /* the document */
8920 int n_doc;
8921 xmlChar * name; /* the entity name */
8922 int n_name;
8923 int type; /* the entity type XML_xxx_yyy_ENTITY */
8924 int n_type;
8925 xmlChar * ExternalID; /* the entity external ID if available */
8926 int n_ExternalID;
8927 xmlChar * SystemID; /* the entity system ID if available */
8928 int n_SystemID;
8929 xmlChar * content; /* the entity content */
8930 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008931
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00008932 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
8933 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
8934 for (n_type = 0;n_type < gen_nb_int;n_type++) {
8935 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
8936 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
8937 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
8938 mem_base = xmlMemBlocks();
8939 doc = gen_xmlDocPtr(n_doc, 0);
8940 name = gen_const_xmlChar_ptr(n_name, 1);
8941 type = gen_int(n_type, 2);
8942 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 3);
8943 SystemID = gen_const_xmlChar_ptr(n_SystemID, 4);
8944 content = gen_const_xmlChar_ptr(n_content, 5);
8945
William M. Brackf13f77f2004-11-12 16:03:48 +00008946 ret_val = xmlAddDocEntity(doc, (const xmlChar *)name, type, (const xmlChar *)ExternalID, (const xmlChar *)SystemID, (const xmlChar *)content);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00008947 desret_xmlEntityPtr(ret_val);
8948 call_tests++;
8949 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00008950 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00008951 des_int(n_type, type, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +00008952 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 3);
8953 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 4);
8954 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 5);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00008955 xmlResetLastError();
8956 if (mem_base != xmlMemBlocks()) {
8957 printf("Leak of %d blocks found in xmlAddDocEntity",
8958 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008959 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00008960 printf(" %d", n_doc);
8961 printf(" %d", n_name);
8962 printf(" %d", n_type);
8963 printf(" %d", n_ExternalID);
8964 printf(" %d", n_SystemID);
8965 printf(" %d", n_content);
8966 printf("\n");
8967 }
8968 }
8969 }
8970 }
8971 }
8972 }
8973 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00008974 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008975
Daniel Veillard42595322004-11-08 10:52:06 +00008976 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008977}
8978
8979
8980static int
8981test_xmlAddDtdEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008982 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008983
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00008984 int mem_base;
8985 xmlEntityPtr ret_val;
8986 xmlDocPtr doc; /* the document */
8987 int n_doc;
8988 xmlChar * name; /* the entity name */
8989 int n_name;
8990 int type; /* the entity type XML_xxx_yyy_ENTITY */
8991 int n_type;
8992 xmlChar * ExternalID; /* the entity external ID if available */
8993 int n_ExternalID;
8994 xmlChar * SystemID; /* the entity system ID if available */
8995 int n_SystemID;
8996 xmlChar * content; /* the entity content */
8997 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008998
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00008999 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
9000 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9001 for (n_type = 0;n_type < gen_nb_int;n_type++) {
9002 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
9003 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
9004 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
9005 mem_base = xmlMemBlocks();
9006 doc = gen_xmlDocPtr(n_doc, 0);
9007 name = gen_const_xmlChar_ptr(n_name, 1);
9008 type = gen_int(n_type, 2);
9009 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 3);
9010 SystemID = gen_const_xmlChar_ptr(n_SystemID, 4);
9011 content = gen_const_xmlChar_ptr(n_content, 5);
9012
William M. Brackf13f77f2004-11-12 16:03:48 +00009013 ret_val = xmlAddDtdEntity(doc, (const xmlChar *)name, type, (const xmlChar *)ExternalID, (const xmlChar *)SystemID, (const xmlChar *)content);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009014 desret_xmlEntityPtr(ret_val);
9015 call_tests++;
9016 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009017 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009018 des_int(n_type, type, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +00009019 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 3);
9020 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 4);
9021 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 5);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009022 xmlResetLastError();
9023 if (mem_base != xmlMemBlocks()) {
9024 printf("Leak of %d blocks found in xmlAddDtdEntity",
9025 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009026 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009027 printf(" %d", n_doc);
9028 printf(" %d", n_name);
9029 printf(" %d", n_type);
9030 printf(" %d", n_ExternalID);
9031 printf(" %d", n_SystemID);
9032 printf(" %d", n_content);
9033 printf("\n");
9034 }
9035 }
9036 }
9037 }
9038 }
9039 }
9040 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009041 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009042
Daniel Veillard42595322004-11-08 10:52:06 +00009043 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009044}
9045
9046
9047static int
9048test_xmlCleanupPredefinedEntities(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009049 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009050
William M. Brack21e4ef22005-01-02 09:53:13 +00009051#if defined(LIBXML_LEGACY_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +00009052#ifdef LIBXML_LEGACY_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +00009053 int mem_base;
9054
9055 mem_base = xmlMemBlocks();
9056
9057 xmlCleanupPredefinedEntities();
9058 call_tests++;
9059 xmlResetLastError();
9060 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00009061 printf("Leak of %d blocks found in xmlCleanupPredefinedEntities",
Daniel Veillardd93f6252004-11-02 15:53:51 +00009062 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009063 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00009064 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00009065 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009066 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00009067#endif
William M. Brack21e4ef22005-01-02 09:53:13 +00009068#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +00009069
Daniel Veillard42595322004-11-08 10:52:06 +00009070 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009071}
9072
9073
Daniel Veillardce682bc2004-11-05 17:22:25 +00009074#define gen_nb_xmlEntitiesTablePtr 1
9075static xmlEntitiesTablePtr gen_xmlEntitiesTablePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
9076 return(NULL);
9077}
9078static void des_xmlEntitiesTablePtr(int no ATTRIBUTE_UNUSED, xmlEntitiesTablePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
9079}
9080
Daniel Veillardd93f6252004-11-02 15:53:51 +00009081static int
9082test_xmlCopyEntitiesTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009083 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009084
9085
9086 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00009087 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009088}
9089
9090
9091static int
9092test_xmlCreateEntitiesTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009093 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009094
9095
9096 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00009097 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009098}
9099
9100
9101static int
9102test_xmlDumpEntitiesTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009103 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009104
William M. Brack21e4ef22005-01-02 09:53:13 +00009105#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00009106 int mem_base;
9107 xmlBufferPtr buf; /* An XML buffer. */
9108 int n_buf;
9109 xmlEntitiesTablePtr table; /* An entity table */
9110 int n_table;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009111
Daniel Veillardce682bc2004-11-05 17:22:25 +00009112 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
9113 for (n_table = 0;n_table < gen_nb_xmlEntitiesTablePtr;n_table++) {
9114 mem_base = xmlMemBlocks();
9115 buf = gen_xmlBufferPtr(n_buf, 0);
9116 table = gen_xmlEntitiesTablePtr(n_table, 1);
9117
9118 xmlDumpEntitiesTable(buf, table);
9119 call_tests++;
9120 des_xmlBufferPtr(n_buf, buf, 0);
9121 des_xmlEntitiesTablePtr(n_table, table, 1);
9122 xmlResetLastError();
9123 if (mem_base != xmlMemBlocks()) {
9124 printf("Leak of %d blocks found in xmlDumpEntitiesTable",
9125 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009126 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009127 printf(" %d", n_buf);
9128 printf(" %d", n_table);
9129 printf("\n");
9130 }
9131 }
9132 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009133 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009134#endif
9135
Daniel Veillard42595322004-11-08 10:52:06 +00009136 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009137}
9138
9139
Daniel Veillardce682bc2004-11-05 17:22:25 +00009140#define gen_nb_xmlEntityPtr 1
9141static xmlEntityPtr gen_xmlEntityPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
9142 return(NULL);
9143}
9144static void des_xmlEntityPtr(int no ATTRIBUTE_UNUSED, xmlEntityPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
9145}
9146
Daniel Veillardd93f6252004-11-02 15:53:51 +00009147static int
9148test_xmlDumpEntityDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009149 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009150
William M. Brack21e4ef22005-01-02 09:53:13 +00009151#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00009152 int mem_base;
9153 xmlBufferPtr buf; /* An XML buffer. */
9154 int n_buf;
9155 xmlEntityPtr ent; /* An entity table */
9156 int n_ent;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009157
Daniel Veillardce682bc2004-11-05 17:22:25 +00009158 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
9159 for (n_ent = 0;n_ent < gen_nb_xmlEntityPtr;n_ent++) {
9160 mem_base = xmlMemBlocks();
9161 buf = gen_xmlBufferPtr(n_buf, 0);
9162 ent = gen_xmlEntityPtr(n_ent, 1);
9163
9164 xmlDumpEntityDecl(buf, ent);
9165 call_tests++;
9166 des_xmlBufferPtr(n_buf, buf, 0);
9167 des_xmlEntityPtr(n_ent, ent, 1);
9168 xmlResetLastError();
9169 if (mem_base != xmlMemBlocks()) {
9170 printf("Leak of %d blocks found in xmlDumpEntityDecl",
9171 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009172 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009173 printf(" %d", n_buf);
9174 printf(" %d", n_ent);
9175 printf("\n");
9176 }
9177 }
9178 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009179 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009180#endif
9181
Daniel Veillard42595322004-11-08 10:52:06 +00009182 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009183}
9184
9185
9186static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00009187test_xmlEncodeEntitiesReentrant(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009188 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009189
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009190 int mem_base;
9191 xmlChar * ret_val;
9192 xmlDocPtr doc; /* the document containing the string */
9193 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009194 xmlChar * input; /* A string to convert to XML. */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009195 int n_input;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009196
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009197 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
9198 for (n_input = 0;n_input < gen_nb_const_xmlChar_ptr;n_input++) {
9199 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009200 doc = gen_xmlDocPtr(n_doc, 0);
9201 input = gen_const_xmlChar_ptr(n_input, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009202
William M. Brackf13f77f2004-11-12 16:03:48 +00009203 ret_val = xmlEncodeEntitiesReentrant(doc, (const xmlChar *)input);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009204 desret_xmlChar_ptr(ret_val);
9205 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009206 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009207 des_const_xmlChar_ptr(n_input, (const xmlChar *)input, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009208 xmlResetLastError();
9209 if (mem_base != xmlMemBlocks()) {
9210 printf("Leak of %d blocks found in xmlEncodeEntitiesReentrant",
9211 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009212 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009213 printf(" %d", n_doc);
9214 printf(" %d", n_input);
9215 printf("\n");
9216 }
9217 }
9218 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009219 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009220
Daniel Veillard42595322004-11-08 10:52:06 +00009221 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009222}
9223
9224
9225static int
9226test_xmlEncodeSpecialChars(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009227 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009228
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009229 int mem_base;
9230 xmlChar * ret_val;
9231 xmlDocPtr doc; /* the document containing the string */
9232 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009233 xmlChar * input; /* A string to convert to XML. */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009234 int n_input;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009235
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009236 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
9237 for (n_input = 0;n_input < gen_nb_const_xmlChar_ptr;n_input++) {
9238 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009239 doc = gen_xmlDocPtr(n_doc, 0);
9240 input = gen_const_xmlChar_ptr(n_input, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009241
William M. Brackf13f77f2004-11-12 16:03:48 +00009242 ret_val = xmlEncodeSpecialChars(doc, (const xmlChar *)input);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009243 desret_xmlChar_ptr(ret_val);
9244 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009245 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009246 des_const_xmlChar_ptr(n_input, (const xmlChar *)input, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009247 xmlResetLastError();
9248 if (mem_base != xmlMemBlocks()) {
9249 printf("Leak of %d blocks found in xmlEncodeSpecialChars",
9250 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009251 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009252 printf(" %d", n_doc);
9253 printf(" %d", n_input);
9254 printf("\n");
9255 }
9256 }
9257 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009258 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009259
Daniel Veillard42595322004-11-08 10:52:06 +00009260 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009261}
9262
9263
9264static int
9265test_xmlGetDocEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009266 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009267
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009268 int mem_base;
9269 xmlEntityPtr ret_val;
9270 xmlDocPtr doc; /* the document referencing the entity */
9271 int n_doc;
9272 xmlChar * name; /* the entity name */
9273 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009274
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009275 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
9276 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9277 mem_base = xmlMemBlocks();
9278 doc = gen_xmlDocPtr(n_doc, 0);
9279 name = gen_const_xmlChar_ptr(n_name, 1);
9280
William M. Brackf13f77f2004-11-12 16:03:48 +00009281 ret_val = xmlGetDocEntity(doc, (const xmlChar *)name);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009282 desret_xmlEntityPtr(ret_val);
9283 call_tests++;
9284 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009285 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009286 xmlResetLastError();
9287 if (mem_base != xmlMemBlocks()) {
9288 printf("Leak of %d blocks found in xmlGetDocEntity",
9289 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009290 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009291 printf(" %d", n_doc);
9292 printf(" %d", n_name);
9293 printf("\n");
9294 }
9295 }
9296 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009297 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009298
Daniel Veillard42595322004-11-08 10:52:06 +00009299 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009300}
9301
9302
9303static int
9304test_xmlGetDtdEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009305 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009306
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009307 int mem_base;
9308 xmlEntityPtr ret_val;
9309 xmlDocPtr doc; /* the document referencing the entity */
9310 int n_doc;
9311 xmlChar * name; /* the entity name */
9312 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009313
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009314 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
9315 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9316 mem_base = xmlMemBlocks();
9317 doc = gen_xmlDocPtr(n_doc, 0);
9318 name = gen_const_xmlChar_ptr(n_name, 1);
9319
William M. Brackf13f77f2004-11-12 16:03:48 +00009320 ret_val = xmlGetDtdEntity(doc, (const xmlChar *)name);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009321 desret_xmlEntityPtr(ret_val);
9322 call_tests++;
9323 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009324 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009325 xmlResetLastError();
9326 if (mem_base != xmlMemBlocks()) {
9327 printf("Leak of %d blocks found in xmlGetDtdEntity",
9328 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009329 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009330 printf(" %d", n_doc);
9331 printf(" %d", n_name);
9332 printf("\n");
9333 }
9334 }
9335 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009336 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009337
Daniel Veillard42595322004-11-08 10:52:06 +00009338 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009339}
9340
9341
9342static int
9343test_xmlGetParameterEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009344 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009345
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009346 int mem_base;
9347 xmlEntityPtr ret_val;
9348 xmlDocPtr doc; /* the document referencing the entity */
9349 int n_doc;
9350 xmlChar * name; /* the entity name */
9351 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009352
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009353 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
9354 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9355 mem_base = xmlMemBlocks();
9356 doc = gen_xmlDocPtr(n_doc, 0);
9357 name = gen_const_xmlChar_ptr(n_name, 1);
9358
William M. Brackf13f77f2004-11-12 16:03:48 +00009359 ret_val = xmlGetParameterEntity(doc, (const xmlChar *)name);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009360 desret_xmlEntityPtr(ret_val);
9361 call_tests++;
9362 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009363 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009364 xmlResetLastError();
9365 if (mem_base != xmlMemBlocks()) {
9366 printf("Leak of %d blocks found in xmlGetParameterEntity",
9367 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009368 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009369 printf(" %d", n_doc);
9370 printf(" %d", n_name);
9371 printf("\n");
9372 }
9373 }
9374 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009375 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009376
Daniel Veillard42595322004-11-08 10:52:06 +00009377 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009378}
9379
9380
9381static int
9382test_xmlGetPredefinedEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009383 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009384
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009385 int mem_base;
9386 xmlEntityPtr ret_val;
9387 xmlChar * name; /* the entity name */
9388 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009389
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009390 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9391 mem_base = xmlMemBlocks();
9392 name = gen_const_xmlChar_ptr(n_name, 0);
9393
William M. Brackf13f77f2004-11-12 16:03:48 +00009394 ret_val = xmlGetPredefinedEntity((const xmlChar *)name);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009395 desret_xmlEntityPtr(ret_val);
9396 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00009397 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009398 xmlResetLastError();
9399 if (mem_base != xmlMemBlocks()) {
9400 printf("Leak of %d blocks found in xmlGetPredefinedEntity",
9401 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009402 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009403 printf(" %d", n_name);
9404 printf("\n");
9405 }
9406 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009407 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009408
Daniel Veillard42595322004-11-08 10:52:06 +00009409 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009410}
9411
9412
9413static int
9414test_xmlInitializePredefinedEntities(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009415 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009416
William M. Brack21e4ef22005-01-02 09:53:13 +00009417#if defined(LIBXML_LEGACY_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +00009418#ifdef LIBXML_LEGACY_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +00009419 int mem_base;
9420
9421 mem_base = xmlMemBlocks();
9422
9423 xmlInitializePredefinedEntities();
9424 call_tests++;
9425 xmlResetLastError();
9426 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00009427 printf("Leak of %d blocks found in xmlInitializePredefinedEntities",
Daniel Veillardd93f6252004-11-02 15:53:51 +00009428 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009429 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00009430 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00009431 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009432 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00009433#endif
William M. Brack21e4ef22005-01-02 09:53:13 +00009434#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +00009435
Daniel Veillard42595322004-11-08 10:52:06 +00009436 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009437}
9438
9439static int
9440test_entities(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009441 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009442
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009443 if (quiet == 0) printf("Testing entities : 12 of 16 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00009444 test_ret += test_xmlAddDocEntity();
9445 test_ret += test_xmlAddDtdEntity();
9446 test_ret += test_xmlCleanupPredefinedEntities();
9447 test_ret += test_xmlCopyEntitiesTable();
9448 test_ret += test_xmlCreateEntitiesTable();
9449 test_ret += test_xmlDumpEntitiesTable();
9450 test_ret += test_xmlDumpEntityDecl();
9451 test_ret += test_xmlEncodeEntitiesReentrant();
9452 test_ret += test_xmlEncodeSpecialChars();
9453 test_ret += test_xmlGetDocEntity();
9454 test_ret += test_xmlGetDtdEntity();
9455 test_ret += test_xmlGetParameterEntity();
9456 test_ret += test_xmlGetPredefinedEntity();
9457 test_ret += test_xmlInitializePredefinedEntities();
Daniel Veillardd93f6252004-11-02 15:53:51 +00009458
Daniel Veillard42595322004-11-08 10:52:06 +00009459 if (test_ret != 0)
9460 printf("Module entities: %d errors\n", test_ret);
9461 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009462}
9463
9464static int
9465test_xmlHashAddEntry(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009466 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009467
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009468 int mem_base;
9469 int ret_val;
9470 xmlHashTablePtr table; /* the hash table */
9471 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009472 xmlChar * name; /* the name of the userdata */
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009473 int n_name;
9474 void * userdata; /* a pointer to the userdata */
9475 int n_userdata;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009476
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009477 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9478 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9479 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
9480 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009481 table = gen_xmlHashTablePtr(n_table, 0);
9482 name = gen_const_xmlChar_ptr(n_name, 1);
9483 userdata = gen_userdata(n_userdata, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009484
William M. Brackf13f77f2004-11-12 16:03:48 +00009485 ret_val = xmlHashAddEntry(table, (const xmlChar *)name, userdata);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009486 desret_int(ret_val);
9487 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009488 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009489 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +00009490 des_userdata(n_userdata, userdata, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009491 xmlResetLastError();
9492 if (mem_base != xmlMemBlocks()) {
9493 printf("Leak of %d blocks found in xmlHashAddEntry",
9494 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009495 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009496 printf(" %d", n_table);
9497 printf(" %d", n_name);
9498 printf(" %d", n_userdata);
9499 printf("\n");
9500 }
9501 }
9502 }
9503 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009504 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009505
Daniel Veillard42595322004-11-08 10:52:06 +00009506 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009507}
9508
9509
9510static int
9511test_xmlHashAddEntry2(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009512 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009513
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009514 int mem_base;
9515 int ret_val;
9516 xmlHashTablePtr table; /* the hash table */
9517 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009518 xmlChar * name; /* the name of the userdata */
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009519 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009520 xmlChar * name2; /* a second name of the userdata */
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009521 int n_name2;
9522 void * userdata; /* a pointer to the userdata */
9523 int n_userdata;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009524
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009525 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9526 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9527 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
9528 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
9529 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009530 table = gen_xmlHashTablePtr(n_table, 0);
9531 name = gen_const_xmlChar_ptr(n_name, 1);
9532 name2 = gen_const_xmlChar_ptr(n_name2, 2);
9533 userdata = gen_userdata(n_userdata, 3);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009534
William M. Brackf13f77f2004-11-12 16:03:48 +00009535 ret_val = xmlHashAddEntry2(table, (const xmlChar *)name, (const xmlChar *)name2, userdata);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009536 desret_int(ret_val);
9537 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009538 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009539 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
9540 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +00009541 des_userdata(n_userdata, userdata, 3);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009542 xmlResetLastError();
9543 if (mem_base != xmlMemBlocks()) {
9544 printf("Leak of %d blocks found in xmlHashAddEntry2",
9545 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009546 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009547 printf(" %d", n_table);
9548 printf(" %d", n_name);
9549 printf(" %d", n_name2);
9550 printf(" %d", n_userdata);
9551 printf("\n");
9552 }
9553 }
9554 }
9555 }
9556 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009557 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009558
Daniel Veillard42595322004-11-08 10:52:06 +00009559 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009560}
9561
9562
9563static int
9564test_xmlHashAddEntry3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009565 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009566
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009567 int mem_base;
9568 int ret_val;
9569 xmlHashTablePtr table; /* the hash table */
9570 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009571 xmlChar * name; /* the name of the userdata */
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009572 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009573 xmlChar * name2; /* a second name of the userdata */
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009574 int n_name2;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009575 xmlChar * name3; /* a third name of the userdata */
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009576 int n_name3;
9577 void * userdata; /* a pointer to the userdata */
9578 int n_userdata;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009579
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009580 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9581 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9582 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
9583 for (n_name3 = 0;n_name3 < gen_nb_const_xmlChar_ptr;n_name3++) {
9584 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
9585 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009586 table = gen_xmlHashTablePtr(n_table, 0);
9587 name = gen_const_xmlChar_ptr(n_name, 1);
9588 name2 = gen_const_xmlChar_ptr(n_name2, 2);
9589 name3 = gen_const_xmlChar_ptr(n_name3, 3);
9590 userdata = gen_userdata(n_userdata, 4);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009591
William M. Brackf13f77f2004-11-12 16:03:48 +00009592 ret_val = xmlHashAddEntry3(table, (const xmlChar *)name, (const xmlChar *)name2, (const xmlChar *)name3, userdata);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009593 desret_int(ret_val);
9594 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009595 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009596 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
9597 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
9598 des_const_xmlChar_ptr(n_name3, (const xmlChar *)name3, 3);
Daniel Veillard3d97e662004-11-04 10:49:00 +00009599 des_userdata(n_userdata, userdata, 4);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009600 xmlResetLastError();
9601 if (mem_base != xmlMemBlocks()) {
9602 printf("Leak of %d blocks found in xmlHashAddEntry3",
9603 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009604 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009605 printf(" %d", n_table);
9606 printf(" %d", n_name);
9607 printf(" %d", n_name2);
9608 printf(" %d", n_name3);
9609 printf(" %d", n_userdata);
9610 printf("\n");
9611 }
9612 }
9613 }
9614 }
9615 }
9616 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009617 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009618
Daniel Veillard42595322004-11-08 10:52:06 +00009619 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009620}
9621
9622
9623static int
9624test_xmlHashCopy(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009625 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009626
9627
9628 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00009629 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009630}
9631
9632
9633static int
9634test_xmlHashCreate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009635 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009636
9637
9638 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00009639 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009640}
9641
9642
9643static int
Daniel Veillard2ae13382005-01-25 23:45:06 +00009644test_xmlHashCreateDict(void) {
9645 int test_ret = 0;
9646
9647
9648 /* missing type support */
9649 return(test_ret);
9650}
9651
9652
9653static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00009654test_xmlHashLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009655 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009656
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009657 int mem_base;
9658 void * ret_val;
9659 xmlHashTablePtr table; /* the hash table */
9660 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009661 xmlChar * name; /* the name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009662 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009663
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009664 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9665 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9666 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009667 table = gen_xmlHashTablePtr(n_table, 0);
9668 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009669
William M. Brackf13f77f2004-11-12 16:03:48 +00009670 ret_val = xmlHashLookup(table, (const xmlChar *)name);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009671 desret_void_ptr(ret_val);
9672 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009673 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009674 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009675 xmlResetLastError();
9676 if (mem_base != xmlMemBlocks()) {
9677 printf("Leak of %d blocks found in xmlHashLookup",
9678 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009679 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009680 printf(" %d", n_table);
9681 printf(" %d", n_name);
9682 printf("\n");
9683 }
9684 }
9685 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009686 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009687
Daniel Veillard42595322004-11-08 10:52:06 +00009688 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009689}
9690
9691
9692static int
9693test_xmlHashLookup2(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009694 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009695
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009696 int mem_base;
9697 void * ret_val;
9698 xmlHashTablePtr table; /* the hash table */
9699 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009700 xmlChar * name; /* the name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009701 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009702 xmlChar * name2; /* a second name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009703 int n_name2;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009704
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009705 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9706 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9707 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
9708 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009709 table = gen_xmlHashTablePtr(n_table, 0);
9710 name = gen_const_xmlChar_ptr(n_name, 1);
9711 name2 = gen_const_xmlChar_ptr(n_name2, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009712
William M. Brackf13f77f2004-11-12 16:03:48 +00009713 ret_val = xmlHashLookup2(table, (const xmlChar *)name, (const xmlChar *)name2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009714 desret_void_ptr(ret_val);
9715 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009716 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009717 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
9718 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009719 xmlResetLastError();
9720 if (mem_base != xmlMemBlocks()) {
9721 printf("Leak of %d blocks found in xmlHashLookup2",
9722 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009723 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009724 printf(" %d", n_table);
9725 printf(" %d", n_name);
9726 printf(" %d", n_name2);
9727 printf("\n");
9728 }
9729 }
9730 }
9731 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009732 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009733
Daniel Veillard42595322004-11-08 10:52:06 +00009734 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009735}
9736
9737
9738static int
9739test_xmlHashLookup3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009740 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009741
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009742 int mem_base;
9743 void * ret_val;
9744 xmlHashTablePtr table; /* the hash table */
9745 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009746 xmlChar * name; /* the name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009747 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009748 xmlChar * name2; /* a second name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009749 int n_name2;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009750 xmlChar * name3; /* a third name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009751 int n_name3;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009752
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009753 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9754 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9755 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
9756 for (n_name3 = 0;n_name3 < gen_nb_const_xmlChar_ptr;n_name3++) {
9757 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009758 table = gen_xmlHashTablePtr(n_table, 0);
9759 name = gen_const_xmlChar_ptr(n_name, 1);
9760 name2 = gen_const_xmlChar_ptr(n_name2, 2);
9761 name3 = gen_const_xmlChar_ptr(n_name3, 3);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009762
William M. Brackf13f77f2004-11-12 16:03:48 +00009763 ret_val = xmlHashLookup3(table, (const xmlChar *)name, (const xmlChar *)name2, (const xmlChar *)name3);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009764 desret_void_ptr(ret_val);
9765 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009766 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009767 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
9768 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
9769 des_const_xmlChar_ptr(n_name3, (const xmlChar *)name3, 3);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009770 xmlResetLastError();
9771 if (mem_base != xmlMemBlocks()) {
9772 printf("Leak of %d blocks found in xmlHashLookup3",
9773 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009774 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009775 printf(" %d", n_table);
9776 printf(" %d", n_name);
9777 printf(" %d", n_name2);
9778 printf(" %d", n_name3);
9779 printf("\n");
9780 }
9781 }
9782 }
9783 }
9784 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009785 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009786
Daniel Veillard42595322004-11-08 10:52:06 +00009787 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009788}
9789
9790
9791static int
9792test_xmlHashQLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009793 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009794
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009795 int mem_base;
9796 void * ret_val;
9797 xmlHashTablePtr table; /* the hash table */
9798 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009799 xmlChar * prefix; /* the prefix of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009800 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009801 xmlChar * name; /* the name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009802 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009803
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009804 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9805 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
9806 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9807 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009808 table = gen_xmlHashTablePtr(n_table, 0);
9809 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
9810 name = gen_const_xmlChar_ptr(n_name, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009811
William M. Brackf13f77f2004-11-12 16:03:48 +00009812 ret_val = xmlHashQLookup(table, (const xmlChar *)prefix, (const xmlChar *)name);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009813 desret_void_ptr(ret_val);
9814 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009815 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009816 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
9817 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009818 xmlResetLastError();
9819 if (mem_base != xmlMemBlocks()) {
9820 printf("Leak of %d blocks found in xmlHashQLookup",
9821 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009822 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009823 printf(" %d", n_table);
9824 printf(" %d", n_prefix);
9825 printf(" %d", n_name);
9826 printf("\n");
9827 }
9828 }
9829 }
9830 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009831 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009832
Daniel Veillard42595322004-11-08 10:52:06 +00009833 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009834}
9835
9836
9837static int
9838test_xmlHashQLookup2(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009839 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009840
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009841 int mem_base;
9842 void * ret_val;
9843 xmlHashTablePtr table; /* the hash table */
9844 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009845 xmlChar * prefix; /* the prefix of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009846 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009847 xmlChar * name; /* the name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009848 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009849 xmlChar * prefix2; /* the second prefix of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009850 int n_prefix2;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009851 xmlChar * name2; /* a second name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009852 int n_name2;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009853
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009854 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9855 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
9856 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9857 for (n_prefix2 = 0;n_prefix2 < gen_nb_const_xmlChar_ptr;n_prefix2++) {
9858 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
9859 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009860 table = gen_xmlHashTablePtr(n_table, 0);
9861 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
9862 name = gen_const_xmlChar_ptr(n_name, 2);
9863 prefix2 = gen_const_xmlChar_ptr(n_prefix2, 3);
9864 name2 = gen_const_xmlChar_ptr(n_name2, 4);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009865
William M. Brackf13f77f2004-11-12 16:03:48 +00009866 ret_val = xmlHashQLookup2(table, (const xmlChar *)prefix, (const xmlChar *)name, (const xmlChar *)prefix2, (const xmlChar *)name2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009867 desret_void_ptr(ret_val);
9868 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009869 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009870 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
9871 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
9872 des_const_xmlChar_ptr(n_prefix2, (const xmlChar *)prefix2, 3);
9873 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 4);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009874 xmlResetLastError();
9875 if (mem_base != xmlMemBlocks()) {
9876 printf("Leak of %d blocks found in xmlHashQLookup2",
9877 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009878 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009879 printf(" %d", n_table);
9880 printf(" %d", n_prefix);
9881 printf(" %d", n_name);
9882 printf(" %d", n_prefix2);
9883 printf(" %d", n_name2);
9884 printf("\n");
9885 }
9886 }
9887 }
9888 }
9889 }
9890 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009891 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009892
Daniel Veillard42595322004-11-08 10:52:06 +00009893 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009894}
9895
9896
9897static int
9898test_xmlHashQLookup3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009899 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009900
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009901 int mem_base;
9902 void * ret_val;
9903 xmlHashTablePtr table; /* the hash table */
9904 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009905 xmlChar * prefix; /* the prefix of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009906 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009907 xmlChar * name; /* the name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009908 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009909 xmlChar * prefix2; /* the second prefix of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009910 int n_prefix2;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009911 xmlChar * name2; /* a second name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009912 int n_name2;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009913 xmlChar * prefix3; /* the third prefix of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009914 int n_prefix3;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009915 xmlChar * name3; /* a third name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009916 int n_name3;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009917
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009918 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9919 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
9920 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9921 for (n_prefix2 = 0;n_prefix2 < gen_nb_const_xmlChar_ptr;n_prefix2++) {
9922 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
9923 for (n_prefix3 = 0;n_prefix3 < gen_nb_const_xmlChar_ptr;n_prefix3++) {
9924 for (n_name3 = 0;n_name3 < gen_nb_const_xmlChar_ptr;n_name3++) {
9925 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009926 table = gen_xmlHashTablePtr(n_table, 0);
9927 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
9928 name = gen_const_xmlChar_ptr(n_name, 2);
9929 prefix2 = gen_const_xmlChar_ptr(n_prefix2, 3);
9930 name2 = gen_const_xmlChar_ptr(n_name2, 4);
9931 prefix3 = gen_const_xmlChar_ptr(n_prefix3, 5);
9932 name3 = gen_const_xmlChar_ptr(n_name3, 6);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009933
William M. Brackf13f77f2004-11-12 16:03:48 +00009934 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 +00009935 desret_void_ptr(ret_val);
9936 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009937 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009938 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
9939 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
9940 des_const_xmlChar_ptr(n_prefix2, (const xmlChar *)prefix2, 3);
9941 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 4);
9942 des_const_xmlChar_ptr(n_prefix3, (const xmlChar *)prefix3, 5);
9943 des_const_xmlChar_ptr(n_name3, (const xmlChar *)name3, 6);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009944 xmlResetLastError();
9945 if (mem_base != xmlMemBlocks()) {
9946 printf("Leak of %d blocks found in xmlHashQLookup3",
9947 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009948 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009949 printf(" %d", n_table);
9950 printf(" %d", n_prefix);
9951 printf(" %d", n_name);
9952 printf(" %d", n_prefix2);
9953 printf(" %d", n_name2);
9954 printf(" %d", n_prefix3);
9955 printf(" %d", n_name3);
9956 printf("\n");
9957 }
9958 }
9959 }
9960 }
9961 }
9962 }
9963 }
9964 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009965 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009966
Daniel Veillard42595322004-11-08 10:52:06 +00009967 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009968}
9969
9970
9971static int
9972test_xmlHashRemoveEntry(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009973 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009974
Daniel Veillard42595322004-11-08 10:52:06 +00009975 int mem_base;
9976 int ret_val;
9977 xmlHashTablePtr table; /* the hash table */
9978 int n_table;
9979 xmlChar * name; /* the name of the userdata */
9980 int n_name;
9981 xmlHashDeallocator f; /* the deallocator function for removed item (if any) */
9982 int n_f;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009983
Daniel Veillard42595322004-11-08 10:52:06 +00009984 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9985 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9986 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
9987 mem_base = xmlMemBlocks();
9988 table = gen_xmlHashTablePtr(n_table, 0);
9989 name = gen_const_xmlChar_ptr(n_name, 1);
9990 f = gen_xmlHashDeallocator(n_f, 2);
9991
William M. Brackf13f77f2004-11-12 16:03:48 +00009992 ret_val = xmlHashRemoveEntry(table, (const xmlChar *)name, f);
Daniel Veillard42595322004-11-08 10:52:06 +00009993 desret_int(ret_val);
9994 call_tests++;
9995 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009996 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard42595322004-11-08 10:52:06 +00009997 des_xmlHashDeallocator(n_f, f, 2);
9998 xmlResetLastError();
9999 if (mem_base != xmlMemBlocks()) {
10000 printf("Leak of %d blocks found in xmlHashRemoveEntry",
10001 xmlMemBlocks() - mem_base);
10002 test_ret++;
10003 printf(" %d", n_table);
10004 printf(" %d", n_name);
10005 printf(" %d", n_f);
10006 printf("\n");
10007 }
10008 }
10009 }
10010 }
Daniel Veillard42595322004-11-08 10:52:06 +000010011 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010012
Daniel Veillard42595322004-11-08 10:52:06 +000010013 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010014}
10015
10016
10017static int
10018test_xmlHashRemoveEntry2(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010019 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010020
Daniel Veillard42595322004-11-08 10:52:06 +000010021 int mem_base;
10022 int ret_val;
10023 xmlHashTablePtr table; /* the hash table */
10024 int n_table;
10025 xmlChar * name; /* the name of the userdata */
10026 int n_name;
10027 xmlChar * name2; /* a second name of the userdata */
10028 int n_name2;
10029 xmlHashDeallocator f; /* the deallocator function for removed item (if any) */
10030 int n_f;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010031
Daniel Veillard42595322004-11-08 10:52:06 +000010032 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10033 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
10034 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
10035 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
10036 mem_base = xmlMemBlocks();
10037 table = gen_xmlHashTablePtr(n_table, 0);
10038 name = gen_const_xmlChar_ptr(n_name, 1);
10039 name2 = gen_const_xmlChar_ptr(n_name2, 2);
10040 f = gen_xmlHashDeallocator(n_f, 3);
10041
William M. Brackf13f77f2004-11-12 16:03:48 +000010042 ret_val = xmlHashRemoveEntry2(table, (const xmlChar *)name, (const xmlChar *)name2, f);
Daniel Veillard42595322004-11-08 10:52:06 +000010043 desret_int(ret_val);
10044 call_tests++;
10045 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000010046 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
10047 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
Daniel Veillard42595322004-11-08 10:52:06 +000010048 des_xmlHashDeallocator(n_f, f, 3);
10049 xmlResetLastError();
10050 if (mem_base != xmlMemBlocks()) {
10051 printf("Leak of %d blocks found in xmlHashRemoveEntry2",
10052 xmlMemBlocks() - mem_base);
10053 test_ret++;
10054 printf(" %d", n_table);
10055 printf(" %d", n_name);
10056 printf(" %d", n_name2);
10057 printf(" %d", n_f);
10058 printf("\n");
10059 }
10060 }
10061 }
10062 }
10063 }
Daniel Veillard42595322004-11-08 10:52:06 +000010064 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010065
Daniel Veillard42595322004-11-08 10:52:06 +000010066 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010067}
10068
10069
10070static int
10071test_xmlHashRemoveEntry3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010072 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010073
Daniel Veillard42595322004-11-08 10:52:06 +000010074 int mem_base;
10075 int ret_val;
10076 xmlHashTablePtr table; /* the hash table */
10077 int n_table;
10078 xmlChar * name; /* the name of the userdata */
10079 int n_name;
10080 xmlChar * name2; /* a second name of the userdata */
10081 int n_name2;
10082 xmlChar * name3; /* a third name of the userdata */
10083 int n_name3;
10084 xmlHashDeallocator f; /* the deallocator function for removed item (if any) */
10085 int n_f;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010086
Daniel Veillard42595322004-11-08 10:52:06 +000010087 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10088 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
10089 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
10090 for (n_name3 = 0;n_name3 < gen_nb_const_xmlChar_ptr;n_name3++) {
10091 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
10092 mem_base = xmlMemBlocks();
10093 table = gen_xmlHashTablePtr(n_table, 0);
10094 name = gen_const_xmlChar_ptr(n_name, 1);
10095 name2 = gen_const_xmlChar_ptr(n_name2, 2);
10096 name3 = gen_const_xmlChar_ptr(n_name3, 3);
10097 f = gen_xmlHashDeallocator(n_f, 4);
10098
William M. Brackf13f77f2004-11-12 16:03:48 +000010099 ret_val = xmlHashRemoveEntry3(table, (const xmlChar *)name, (const xmlChar *)name2, (const xmlChar *)name3, f);
Daniel Veillard42595322004-11-08 10:52:06 +000010100 desret_int(ret_val);
10101 call_tests++;
10102 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000010103 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
10104 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
10105 des_const_xmlChar_ptr(n_name3, (const xmlChar *)name3, 3);
Daniel Veillard42595322004-11-08 10:52:06 +000010106 des_xmlHashDeallocator(n_f, f, 4);
10107 xmlResetLastError();
10108 if (mem_base != xmlMemBlocks()) {
10109 printf("Leak of %d blocks found in xmlHashRemoveEntry3",
10110 xmlMemBlocks() - mem_base);
10111 test_ret++;
10112 printf(" %d", n_table);
10113 printf(" %d", n_name);
10114 printf(" %d", n_name2);
10115 printf(" %d", n_name3);
10116 printf(" %d", n_f);
10117 printf("\n");
10118 }
10119 }
10120 }
10121 }
10122 }
10123 }
Daniel Veillard42595322004-11-08 10:52:06 +000010124 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010125
Daniel Veillard42595322004-11-08 10:52:06 +000010126 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010127}
10128
10129
10130static int
10131test_xmlHashScan(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010132 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010133
10134
10135 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010136 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010137}
10138
10139
10140static int
10141test_xmlHashScan3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010142 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010143
10144
10145 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010146 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010147}
10148
10149
10150static int
10151test_xmlHashScanFull(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010152 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010153
10154
10155 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010156 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010157}
10158
10159
10160static int
10161test_xmlHashScanFull3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010162 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010163
10164
10165 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010166 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010167}
10168
10169
10170static int
10171test_xmlHashSize(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010172 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010173
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010174 int mem_base;
10175 int ret_val;
10176 xmlHashTablePtr table; /* the hash table */
10177 int n_table;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010178
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010179 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10180 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010181 table = gen_xmlHashTablePtr(n_table, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010182
10183 ret_val = xmlHashSize(table);
10184 desret_int(ret_val);
10185 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010186 des_xmlHashTablePtr(n_table, table, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010187 xmlResetLastError();
10188 if (mem_base != xmlMemBlocks()) {
10189 printf("Leak of %d blocks found in xmlHashSize",
10190 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010191 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010192 printf(" %d", n_table);
10193 printf("\n");
10194 }
10195 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010196 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010197
Daniel Veillard42595322004-11-08 10:52:06 +000010198 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010199}
10200
10201
10202static int
10203test_xmlHashUpdateEntry(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010204 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010205
Daniel Veillard42595322004-11-08 10:52:06 +000010206 int mem_base;
10207 int ret_val;
10208 xmlHashTablePtr table; /* the hash table */
10209 int n_table;
10210 xmlChar * name; /* the name of the userdata */
10211 int n_name;
10212 void * userdata; /* a pointer to the userdata */
10213 int n_userdata;
10214 xmlHashDeallocator f; /* the deallocator function for replaced item (if any) */
10215 int n_f;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010216
Daniel Veillard42595322004-11-08 10:52:06 +000010217 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10218 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
10219 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
10220 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
10221 mem_base = xmlMemBlocks();
10222 table = gen_xmlHashTablePtr(n_table, 0);
10223 name = gen_const_xmlChar_ptr(n_name, 1);
10224 userdata = gen_userdata(n_userdata, 2);
10225 f = gen_xmlHashDeallocator(n_f, 3);
10226
William M. Brackf13f77f2004-11-12 16:03:48 +000010227 ret_val = xmlHashUpdateEntry(table, (const xmlChar *)name, userdata, f);
Daniel Veillard42595322004-11-08 10:52:06 +000010228 desret_int(ret_val);
10229 call_tests++;
10230 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000010231 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard42595322004-11-08 10:52:06 +000010232 des_userdata(n_userdata, userdata, 2);
10233 des_xmlHashDeallocator(n_f, f, 3);
10234 xmlResetLastError();
10235 if (mem_base != xmlMemBlocks()) {
10236 printf("Leak of %d blocks found in xmlHashUpdateEntry",
10237 xmlMemBlocks() - mem_base);
10238 test_ret++;
10239 printf(" %d", n_table);
10240 printf(" %d", n_name);
10241 printf(" %d", n_userdata);
10242 printf(" %d", n_f);
10243 printf("\n");
10244 }
10245 }
10246 }
10247 }
10248 }
Daniel Veillard42595322004-11-08 10:52:06 +000010249 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010250
Daniel Veillard42595322004-11-08 10:52:06 +000010251 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010252}
10253
10254
10255static int
10256test_xmlHashUpdateEntry2(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010257 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010258
Daniel Veillard42595322004-11-08 10:52:06 +000010259 int mem_base;
10260 int ret_val;
10261 xmlHashTablePtr table; /* the hash table */
10262 int n_table;
10263 xmlChar * name; /* the name of the userdata */
10264 int n_name;
10265 xmlChar * name2; /* a second name of the userdata */
10266 int n_name2;
10267 void * userdata; /* a pointer to the userdata */
10268 int n_userdata;
10269 xmlHashDeallocator f; /* the deallocator function for replaced item (if any) */
10270 int n_f;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010271
Daniel Veillard42595322004-11-08 10:52:06 +000010272 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10273 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
10274 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
10275 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
10276 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
10277 mem_base = xmlMemBlocks();
10278 table = gen_xmlHashTablePtr(n_table, 0);
10279 name = gen_const_xmlChar_ptr(n_name, 1);
10280 name2 = gen_const_xmlChar_ptr(n_name2, 2);
10281 userdata = gen_userdata(n_userdata, 3);
10282 f = gen_xmlHashDeallocator(n_f, 4);
10283
William M. Brackf13f77f2004-11-12 16:03:48 +000010284 ret_val = xmlHashUpdateEntry2(table, (const xmlChar *)name, (const xmlChar *)name2, userdata, f);
Daniel Veillard42595322004-11-08 10:52:06 +000010285 desret_int(ret_val);
10286 call_tests++;
10287 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000010288 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
10289 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
Daniel Veillard42595322004-11-08 10:52:06 +000010290 des_userdata(n_userdata, userdata, 3);
10291 des_xmlHashDeallocator(n_f, f, 4);
10292 xmlResetLastError();
10293 if (mem_base != xmlMemBlocks()) {
10294 printf("Leak of %d blocks found in xmlHashUpdateEntry2",
10295 xmlMemBlocks() - mem_base);
10296 test_ret++;
10297 printf(" %d", n_table);
10298 printf(" %d", n_name);
10299 printf(" %d", n_name2);
10300 printf(" %d", n_userdata);
10301 printf(" %d", n_f);
10302 printf("\n");
10303 }
10304 }
10305 }
10306 }
10307 }
10308 }
Daniel Veillard42595322004-11-08 10:52:06 +000010309 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010310
Daniel Veillard42595322004-11-08 10:52:06 +000010311 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010312}
10313
10314
10315static int
10316test_xmlHashUpdateEntry3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010317 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010318
Daniel Veillard42595322004-11-08 10:52:06 +000010319 int mem_base;
10320 int ret_val;
10321 xmlHashTablePtr table; /* the hash table */
10322 int n_table;
10323 xmlChar * name; /* the name of the userdata */
10324 int n_name;
10325 xmlChar * name2; /* a second name of the userdata */
10326 int n_name2;
10327 xmlChar * name3; /* a third name of the userdata */
10328 int n_name3;
10329 void * userdata; /* a pointer to the userdata */
10330 int n_userdata;
10331 xmlHashDeallocator f; /* the deallocator function for replaced item (if any) */
10332 int n_f;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010333
Daniel Veillard42595322004-11-08 10:52:06 +000010334 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10335 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
10336 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
10337 for (n_name3 = 0;n_name3 < gen_nb_const_xmlChar_ptr;n_name3++) {
10338 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
10339 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
10340 mem_base = xmlMemBlocks();
10341 table = gen_xmlHashTablePtr(n_table, 0);
10342 name = gen_const_xmlChar_ptr(n_name, 1);
10343 name2 = gen_const_xmlChar_ptr(n_name2, 2);
10344 name3 = gen_const_xmlChar_ptr(n_name3, 3);
10345 userdata = gen_userdata(n_userdata, 4);
10346 f = gen_xmlHashDeallocator(n_f, 5);
10347
William M. Brackf13f77f2004-11-12 16:03:48 +000010348 ret_val = xmlHashUpdateEntry3(table, (const xmlChar *)name, (const xmlChar *)name2, (const xmlChar *)name3, userdata, f);
Daniel Veillard42595322004-11-08 10:52:06 +000010349 desret_int(ret_val);
10350 call_tests++;
10351 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000010352 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
10353 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
10354 des_const_xmlChar_ptr(n_name3, (const xmlChar *)name3, 3);
Daniel Veillard42595322004-11-08 10:52:06 +000010355 des_userdata(n_userdata, userdata, 4);
10356 des_xmlHashDeallocator(n_f, f, 5);
10357 xmlResetLastError();
10358 if (mem_base != xmlMemBlocks()) {
10359 printf("Leak of %d blocks found in xmlHashUpdateEntry3",
10360 xmlMemBlocks() - mem_base);
10361 test_ret++;
10362 printf(" %d", n_table);
10363 printf(" %d", n_name);
10364 printf(" %d", n_name2);
10365 printf(" %d", n_name3);
10366 printf(" %d", n_userdata);
10367 printf(" %d", n_f);
10368 printf("\n");
10369 }
10370 }
10371 }
10372 }
10373 }
10374 }
10375 }
Daniel Veillard42595322004-11-08 10:52:06 +000010376 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010377
Daniel Veillard42595322004-11-08 10:52:06 +000010378 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010379}
10380
10381static int
10382test_hash(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010383 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010384
Daniel Veillard2ae13382005-01-25 23:45:06 +000010385 if (quiet == 0) printf("Testing hash : 16 of 24 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000010386 test_ret += test_xmlHashAddEntry();
10387 test_ret += test_xmlHashAddEntry2();
10388 test_ret += test_xmlHashAddEntry3();
10389 test_ret += test_xmlHashCopy();
10390 test_ret += test_xmlHashCreate();
Daniel Veillard2ae13382005-01-25 23:45:06 +000010391 test_ret += test_xmlHashCreateDict();
Daniel Veillard42595322004-11-08 10:52:06 +000010392 test_ret += test_xmlHashLookup();
10393 test_ret += test_xmlHashLookup2();
10394 test_ret += test_xmlHashLookup3();
10395 test_ret += test_xmlHashQLookup();
10396 test_ret += test_xmlHashQLookup2();
10397 test_ret += test_xmlHashQLookup3();
10398 test_ret += test_xmlHashRemoveEntry();
10399 test_ret += test_xmlHashRemoveEntry2();
10400 test_ret += test_xmlHashRemoveEntry3();
10401 test_ret += test_xmlHashScan();
10402 test_ret += test_xmlHashScan3();
10403 test_ret += test_xmlHashScanFull();
10404 test_ret += test_xmlHashScanFull3();
10405 test_ret += test_xmlHashSize();
10406 test_ret += test_xmlHashUpdateEntry();
10407 test_ret += test_xmlHashUpdateEntry2();
10408 test_ret += test_xmlHashUpdateEntry3();
Daniel Veillardd93f6252004-11-02 15:53:51 +000010409
Daniel Veillard42595322004-11-08 10:52:06 +000010410 if (test_ret != 0)
10411 printf("Module hash: %d errors\n", test_ret);
10412 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010413}
10414
Daniel Veillardce682bc2004-11-05 17:22:25 +000010415#define gen_nb_xmlLinkPtr 1
10416static xmlLinkPtr gen_xmlLinkPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
10417 return(NULL);
10418}
10419static void des_xmlLinkPtr(int no ATTRIBUTE_UNUSED, xmlLinkPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
10420}
10421
Daniel Veillardd93f6252004-11-02 15:53:51 +000010422static int
10423test_xmlLinkGetData(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010424 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010425
Daniel Veillardce682bc2004-11-05 17:22:25 +000010426 int mem_base;
10427 void * ret_val;
10428 xmlLinkPtr lk; /* a link */
10429 int n_lk;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010430
Daniel Veillardce682bc2004-11-05 17:22:25 +000010431 for (n_lk = 0;n_lk < gen_nb_xmlLinkPtr;n_lk++) {
10432 mem_base = xmlMemBlocks();
10433 lk = gen_xmlLinkPtr(n_lk, 0);
10434
10435 ret_val = xmlLinkGetData(lk);
10436 desret_void_ptr(ret_val);
10437 call_tests++;
10438 des_xmlLinkPtr(n_lk, lk, 0);
10439 xmlResetLastError();
10440 if (mem_base != xmlMemBlocks()) {
10441 printf("Leak of %d blocks found in xmlLinkGetData",
10442 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010443 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000010444 printf(" %d", n_lk);
10445 printf("\n");
10446 }
10447 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000010448 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010449
Daniel Veillard42595322004-11-08 10:52:06 +000010450 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010451}
10452
10453
10454static int
10455test_xmlListAppend(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010456 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010457
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010458 int mem_base;
10459 int ret_val;
10460 xmlListPtr l; /* a list */
10461 int n_l;
10462 void * data; /* the data */
10463 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010464
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010465 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10466 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
10467 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010468 l = gen_xmlListPtr(n_l, 0);
10469 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010470
10471 ret_val = xmlListAppend(l, data);
10472 desret_int(ret_val);
10473 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010474 des_xmlListPtr(n_l, l, 0);
10475 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010476 xmlResetLastError();
10477 if (mem_base != xmlMemBlocks()) {
10478 printf("Leak of %d blocks found in xmlListAppend",
10479 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010480 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010481 printf(" %d", n_l);
10482 printf(" %d", n_data);
10483 printf("\n");
10484 }
10485 }
10486 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010487 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010488
Daniel Veillard42595322004-11-08 10:52:06 +000010489 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010490}
10491
10492
10493static int
10494test_xmlListClear(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010495 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010496
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010497 int mem_base;
10498 xmlListPtr l; /* a list */
10499 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010500
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010501 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10502 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010503 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010504
10505 xmlListClear(l);
10506 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010507 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010508 xmlResetLastError();
10509 if (mem_base != xmlMemBlocks()) {
10510 printf("Leak of %d blocks found in xmlListClear",
10511 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010512 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010513 printf(" %d", n_l);
10514 printf("\n");
10515 }
10516 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010517 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010518
Daniel Veillard42595322004-11-08 10:52:06 +000010519 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010520}
10521
10522
Daniel Veillardce682bc2004-11-05 17:22:25 +000010523#define gen_nb_const_xmlListPtr 1
10524static xmlListPtr gen_const_xmlListPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
10525 return(NULL);
10526}
10527static void des_const_xmlListPtr(int no ATTRIBUTE_UNUSED, const xmlListPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
10528}
10529
Daniel Veillardd93f6252004-11-02 15:53:51 +000010530static int
10531test_xmlListCopy(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010532 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010533
Daniel Veillardce682bc2004-11-05 17:22:25 +000010534 int mem_base;
10535 int ret_val;
10536 xmlListPtr cur; /* the new list */
10537 int n_cur;
10538 xmlListPtr old; /* the old list */
10539 int n_old;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010540
Daniel Veillardce682bc2004-11-05 17:22:25 +000010541 for (n_cur = 0;n_cur < gen_nb_xmlListPtr;n_cur++) {
10542 for (n_old = 0;n_old < gen_nb_const_xmlListPtr;n_old++) {
10543 mem_base = xmlMemBlocks();
10544 cur = gen_xmlListPtr(n_cur, 0);
10545 old = gen_const_xmlListPtr(n_old, 1);
10546
William M. Brackf13f77f2004-11-12 16:03:48 +000010547 ret_val = xmlListCopy(cur, (const xmlListPtr)old);
Daniel Veillardce682bc2004-11-05 17:22:25 +000010548 desret_int(ret_val);
10549 call_tests++;
10550 des_xmlListPtr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000010551 des_const_xmlListPtr(n_old, (const xmlListPtr)old, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000010552 xmlResetLastError();
10553 if (mem_base != xmlMemBlocks()) {
10554 printf("Leak of %d blocks found in xmlListCopy",
10555 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010556 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000010557 printf(" %d", n_cur);
10558 printf(" %d", n_old);
10559 printf("\n");
10560 }
10561 }
10562 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000010563 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010564
Daniel Veillard42595322004-11-08 10:52:06 +000010565 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010566}
10567
10568
10569static int
10570test_xmlListCreate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010571 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010572
10573
10574 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010575 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010576}
10577
10578
10579static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000010580test_xmlListDup(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
10590test_xmlListEmpty(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010591 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010592
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010593 int mem_base;
10594 int ret_val;
10595 xmlListPtr l; /* a list */
10596 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010597
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010598 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10599 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010600 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010601
10602 ret_val = xmlListEmpty(l);
10603 desret_int(ret_val);
10604 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010605 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010606 xmlResetLastError();
10607 if (mem_base != xmlMemBlocks()) {
10608 printf("Leak of %d blocks found in xmlListEmpty",
10609 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010610 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010611 printf(" %d", n_l);
10612 printf("\n");
10613 }
10614 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010615 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010616
Daniel Veillard42595322004-11-08 10:52:06 +000010617 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010618}
10619
10620
10621static int
10622test_xmlListEnd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010623 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010624
10625
10626 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010627 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010628}
10629
10630
10631static int
10632test_xmlListFront(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_xmlListInsert(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010643 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010644
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010645 int mem_base;
10646 int ret_val;
10647 xmlListPtr l; /* a list */
10648 int n_l;
10649 void * data; /* the data */
10650 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010651
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010652 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10653 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
10654 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010655 l = gen_xmlListPtr(n_l, 0);
10656 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010657
10658 ret_val = xmlListInsert(l, data);
10659 desret_int(ret_val);
10660 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010661 des_xmlListPtr(n_l, l, 0);
10662 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010663 xmlResetLastError();
10664 if (mem_base != xmlMemBlocks()) {
10665 printf("Leak of %d blocks found in xmlListInsert",
10666 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010667 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010668 printf(" %d", n_l);
10669 printf(" %d", n_data);
10670 printf("\n");
10671 }
10672 }
10673 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010674 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010675
Daniel Veillard42595322004-11-08 10:52:06 +000010676 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010677}
10678
10679
10680static int
10681test_xmlListMerge(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010682 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010683
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010684 int mem_base;
10685 xmlListPtr l1; /* the original list */
10686 int n_l1;
10687 xmlListPtr l2; /* the new list */
10688 int n_l2;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010689
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010690 for (n_l1 = 0;n_l1 < gen_nb_xmlListPtr;n_l1++) {
10691 for (n_l2 = 0;n_l2 < gen_nb_xmlListPtr;n_l2++) {
10692 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010693 l1 = gen_xmlListPtr(n_l1, 0);
10694 l2 = gen_xmlListPtr(n_l2, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010695
10696 xmlListMerge(l1, l2);
10697 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010698 des_xmlListPtr(n_l1, l1, 0);
10699 des_xmlListPtr(n_l2, l2, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010700 xmlResetLastError();
10701 if (mem_base != xmlMemBlocks()) {
10702 printf("Leak of %d blocks found in xmlListMerge",
10703 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010704 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010705 printf(" %d", n_l1);
10706 printf(" %d", n_l2);
10707 printf("\n");
10708 }
10709 }
10710 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010711 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010712
Daniel Veillard42595322004-11-08 10:52:06 +000010713 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010714}
10715
10716
10717static int
10718test_xmlListPopBack(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010719 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010720
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010721 int mem_base;
10722 xmlListPtr l; /* a list */
10723 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010724
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010725 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10726 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010727 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010728
10729 xmlListPopBack(l);
10730 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010731 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010732 xmlResetLastError();
10733 if (mem_base != xmlMemBlocks()) {
10734 printf("Leak of %d blocks found in xmlListPopBack",
10735 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010736 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010737 printf(" %d", n_l);
10738 printf("\n");
10739 }
10740 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010741 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010742
Daniel Veillard42595322004-11-08 10:52:06 +000010743 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010744}
10745
10746
10747static int
10748test_xmlListPopFront(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010749 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010750
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010751 int mem_base;
10752 xmlListPtr l; /* a list */
10753 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010754
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010755 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10756 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010757 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010758
10759 xmlListPopFront(l);
10760 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010761 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010762 xmlResetLastError();
10763 if (mem_base != xmlMemBlocks()) {
10764 printf("Leak of %d blocks found in xmlListPopFront",
10765 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010766 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010767 printf(" %d", n_l);
10768 printf("\n");
10769 }
10770 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010771 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010772
Daniel Veillard42595322004-11-08 10:52:06 +000010773 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010774}
10775
10776
10777static int
10778test_xmlListPushBack(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010779 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010780
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010781 int mem_base;
10782 int ret_val;
10783 xmlListPtr l; /* a list */
10784 int n_l;
10785 void * data; /* new data */
10786 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010787
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010788 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10789 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
10790 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010791 l = gen_xmlListPtr(n_l, 0);
10792 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010793
10794 ret_val = xmlListPushBack(l, data);
10795 desret_int(ret_val);
10796 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010797 des_xmlListPtr(n_l, l, 0);
10798 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010799 xmlResetLastError();
10800 if (mem_base != xmlMemBlocks()) {
10801 printf("Leak of %d blocks found in xmlListPushBack",
10802 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010803 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010804 printf(" %d", n_l);
10805 printf(" %d", n_data);
10806 printf("\n");
10807 }
10808 }
10809 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010810 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010811
Daniel Veillard42595322004-11-08 10:52:06 +000010812 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010813}
10814
10815
10816static int
10817test_xmlListPushFront(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010818 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010819
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010820 int mem_base;
10821 int ret_val;
10822 xmlListPtr l; /* a list */
10823 int n_l;
10824 void * data; /* new data */
10825 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010826
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010827 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10828 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
10829 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010830 l = gen_xmlListPtr(n_l, 0);
10831 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010832
10833 ret_val = xmlListPushFront(l, data);
10834 desret_int(ret_val);
10835 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010836 des_xmlListPtr(n_l, l, 0);
10837 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010838 xmlResetLastError();
10839 if (mem_base != xmlMemBlocks()) {
10840 printf("Leak of %d blocks found in xmlListPushFront",
10841 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010842 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010843 printf(" %d", n_l);
10844 printf(" %d", n_data);
10845 printf("\n");
10846 }
10847 }
10848 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010849 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010850
Daniel Veillard42595322004-11-08 10:52:06 +000010851 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010852}
10853
10854
10855static int
10856test_xmlListRemoveAll(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010857 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010858
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010859 int mem_base;
10860 int ret_val;
10861 xmlListPtr l; /* a list */
10862 int n_l;
10863 void * data; /* list data */
10864 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010865
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010866 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10867 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
10868 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010869 l = gen_xmlListPtr(n_l, 0);
10870 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010871
10872 ret_val = xmlListRemoveAll(l, data);
10873 desret_int(ret_val);
10874 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010875 des_xmlListPtr(n_l, l, 0);
10876 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010877 xmlResetLastError();
10878 if (mem_base != xmlMemBlocks()) {
10879 printf("Leak of %d blocks found in xmlListRemoveAll",
10880 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010881 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010882 printf(" %d", n_l);
10883 printf(" %d", n_data);
10884 printf("\n");
10885 }
10886 }
10887 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010888 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010889
Daniel Veillard42595322004-11-08 10:52:06 +000010890 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010891}
10892
10893
10894static int
10895test_xmlListRemoveFirst(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010896 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010897
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010898 int mem_base;
10899 int ret_val;
10900 xmlListPtr l; /* a list */
10901 int n_l;
10902 void * data; /* list data */
10903 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010904
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010905 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10906 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
10907 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010908 l = gen_xmlListPtr(n_l, 0);
10909 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010910
10911 ret_val = xmlListRemoveFirst(l, data);
10912 desret_int(ret_val);
10913 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010914 des_xmlListPtr(n_l, l, 0);
10915 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010916 xmlResetLastError();
10917 if (mem_base != xmlMemBlocks()) {
10918 printf("Leak of %d blocks found in xmlListRemoveFirst",
10919 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010920 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010921 printf(" %d", n_l);
10922 printf(" %d", n_data);
10923 printf("\n");
10924 }
10925 }
10926 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010927 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010928
Daniel Veillard42595322004-11-08 10:52:06 +000010929 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010930}
10931
10932
10933static int
10934test_xmlListRemoveLast(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010935 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010936
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010937 int mem_base;
10938 int ret_val;
10939 xmlListPtr l; /* a list */
10940 int n_l;
10941 void * data; /* list data */
10942 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010943
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010944 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10945 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
10946 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010947 l = gen_xmlListPtr(n_l, 0);
10948 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010949
10950 ret_val = xmlListRemoveLast(l, data);
10951 desret_int(ret_val);
10952 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010953 des_xmlListPtr(n_l, l, 0);
10954 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010955 xmlResetLastError();
10956 if (mem_base != xmlMemBlocks()) {
10957 printf("Leak of %d blocks found in xmlListRemoveLast",
10958 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010959 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010960 printf(" %d", n_l);
10961 printf(" %d", n_data);
10962 printf("\n");
10963 }
10964 }
10965 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010966 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010967
Daniel Veillard42595322004-11-08 10:52:06 +000010968 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010969}
10970
10971
10972static int
10973test_xmlListReverse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010974 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010975
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010976 int mem_base;
10977 xmlListPtr l; /* a list */
10978 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010979
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010980 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10981 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010982 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010983
10984 xmlListReverse(l);
10985 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010986 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010987 xmlResetLastError();
10988 if (mem_base != xmlMemBlocks()) {
10989 printf("Leak of %d blocks found in xmlListReverse",
10990 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010991 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010992 printf(" %d", n_l);
10993 printf("\n");
10994 }
10995 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010996 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010997
Daniel Veillard42595322004-11-08 10:52:06 +000010998 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010999}
11000
11001
11002static int
11003test_xmlListReverseSearch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011004 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011005
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011006 int mem_base;
11007 void * ret_val;
11008 xmlListPtr l; /* a list */
11009 int n_l;
11010 void * data; /* a search value */
11011 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011012
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011013 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
11014 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
11015 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011016 l = gen_xmlListPtr(n_l, 0);
11017 data = gen_userdata(n_data, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011018
11019 ret_val = xmlListReverseSearch(l, data);
11020 desret_void_ptr(ret_val);
11021 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011022 des_xmlListPtr(n_l, l, 0);
11023 des_userdata(n_data, data, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011024 xmlResetLastError();
11025 if (mem_base != xmlMemBlocks()) {
11026 printf("Leak of %d blocks found in xmlListReverseSearch",
11027 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011028 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011029 printf(" %d", n_l);
11030 printf(" %d", n_data);
11031 printf("\n");
11032 }
11033 }
11034 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000011035 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011036
Daniel Veillard42595322004-11-08 10:52:06 +000011037 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011038}
11039
11040
11041static int
11042test_xmlListReverseWalk(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011043 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011044
11045
11046 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000011047 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011048}
11049
11050
11051static int
11052test_xmlListSearch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011053 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011054
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011055 int mem_base;
11056 void * ret_val;
11057 xmlListPtr l; /* a list */
11058 int n_l;
11059 void * data; /* a search value */
11060 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011061
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011062 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
11063 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
11064 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011065 l = gen_xmlListPtr(n_l, 0);
11066 data = gen_userdata(n_data, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011067
11068 ret_val = xmlListSearch(l, data);
11069 desret_void_ptr(ret_val);
11070 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011071 des_xmlListPtr(n_l, l, 0);
11072 des_userdata(n_data, data, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011073 xmlResetLastError();
11074 if (mem_base != xmlMemBlocks()) {
11075 printf("Leak of %d blocks found in xmlListSearch",
11076 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011077 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011078 printf(" %d", n_l);
11079 printf(" %d", n_data);
11080 printf("\n");
11081 }
11082 }
11083 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000011084 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011085
Daniel Veillard42595322004-11-08 10:52:06 +000011086 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011087}
11088
11089
11090static int
11091test_xmlListSize(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011092 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011093
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011094 int mem_base;
11095 int ret_val;
11096 xmlListPtr l; /* a list */
11097 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011098
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011099 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
11100 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011101 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011102
11103 ret_val = xmlListSize(l);
11104 desret_int(ret_val);
11105 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011106 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011107 xmlResetLastError();
11108 if (mem_base != xmlMemBlocks()) {
11109 printf("Leak of %d blocks found in xmlListSize",
11110 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011111 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011112 printf(" %d", n_l);
11113 printf("\n");
11114 }
11115 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000011116 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011117
Daniel Veillard42595322004-11-08 10:52:06 +000011118 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011119}
11120
11121
11122static int
11123test_xmlListSort(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011124 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011125
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011126 int mem_base;
11127 xmlListPtr l; /* a list */
11128 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011129
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011130 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
11131 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011132 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011133
11134 xmlListSort(l);
11135 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011136 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011137 xmlResetLastError();
11138 if (mem_base != xmlMemBlocks()) {
11139 printf("Leak of %d blocks found in xmlListSort",
11140 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011141 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011142 printf(" %d", n_l);
11143 printf("\n");
11144 }
11145 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000011146 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011147
Daniel Veillard42595322004-11-08 10:52:06 +000011148 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011149}
11150
11151
11152static int
11153test_xmlListWalk(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011154 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011155
11156
11157 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000011158 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011159}
11160
11161static int
11162test_list(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011163 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011164
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011165 if (quiet == 0) printf("Testing list : 19 of 26 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000011166 test_ret += test_xmlLinkGetData();
11167 test_ret += test_xmlListAppend();
11168 test_ret += test_xmlListClear();
11169 test_ret += test_xmlListCopy();
11170 test_ret += test_xmlListCreate();
11171 test_ret += test_xmlListDup();
11172 test_ret += test_xmlListEmpty();
11173 test_ret += test_xmlListEnd();
11174 test_ret += test_xmlListFront();
11175 test_ret += test_xmlListInsert();
11176 test_ret += test_xmlListMerge();
11177 test_ret += test_xmlListPopBack();
11178 test_ret += test_xmlListPopFront();
11179 test_ret += test_xmlListPushBack();
11180 test_ret += test_xmlListPushFront();
11181 test_ret += test_xmlListRemoveAll();
11182 test_ret += test_xmlListRemoveFirst();
11183 test_ret += test_xmlListRemoveLast();
11184 test_ret += test_xmlListReverse();
11185 test_ret += test_xmlListReverseSearch();
11186 test_ret += test_xmlListReverseWalk();
11187 test_ret += test_xmlListSearch();
11188 test_ret += test_xmlListSize();
11189 test_ret += test_xmlListSort();
11190 test_ret += test_xmlListWalk();
Daniel Veillardd93f6252004-11-02 15:53:51 +000011191
Daniel Veillard42595322004-11-08 10:52:06 +000011192 if (test_ret != 0)
11193 printf("Module list: %d errors\n", test_ret);
11194 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011195}
11196
11197static int
11198test_xmlNanoFTPCheckResponse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011199 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011200
William M. Brack21e4ef22005-01-02 09:53:13 +000011201#if defined(LIBXML_FTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011202 int mem_base;
11203 int ret_val;
11204 void * ctx; /* an FTP context */
11205 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011206
Daniel Veillard27f20102004-11-05 11:50:11 +000011207 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11208 mem_base = xmlMemBlocks();
11209 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11210
11211 ret_val = xmlNanoFTPCheckResponse(ctx);
11212 desret_int(ret_val);
11213 call_tests++;
11214 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11215 xmlResetLastError();
11216 if (mem_base != xmlMemBlocks()) {
11217 printf("Leak of %d blocks found in xmlNanoFTPCheckResponse",
11218 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011219 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011220 printf(" %d", n_ctx);
11221 printf("\n");
11222 }
11223 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011224 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011225#endif
11226
Daniel Veillard42595322004-11-08 10:52:06 +000011227 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011228}
11229
11230
11231static int
11232test_xmlNanoFTPCleanup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011233 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011234
William M. Brack21e4ef22005-01-02 09:53:13 +000011235#if defined(LIBXML_FTP_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000011236 int mem_base;
11237
11238 mem_base = xmlMemBlocks();
11239
11240 xmlNanoFTPCleanup();
11241 call_tests++;
11242 xmlResetLastError();
11243 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000011244 printf("Leak of %d blocks found in xmlNanoFTPCleanup",
Daniel Veillardd93f6252004-11-02 15:53:51 +000011245 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011246 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000011247 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000011248 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011249 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011250#endif
11251
Daniel Veillard42595322004-11-08 10:52:06 +000011252 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011253}
11254
11255
11256static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000011257test_xmlNanoFTPCloseConnection(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011258 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011259
William M. Brack21e4ef22005-01-02 09:53:13 +000011260#if defined(LIBXML_FTP_ENABLED)
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011261 int mem_base;
Daniel Veillard27f20102004-11-05 11:50:11 +000011262 int ret_val;
11263 void * ctx; /* an FTP context */
11264 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011265
Daniel Veillard27f20102004-11-05 11:50:11 +000011266 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011267 mem_base = xmlMemBlocks();
Daniel Veillard27f20102004-11-05 11:50:11 +000011268 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011269
Daniel Veillard27f20102004-11-05 11:50:11 +000011270 ret_val = xmlNanoFTPCloseConnection(ctx);
11271 desret_int(ret_val);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011272 call_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011273 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011274 xmlResetLastError();
11275 if (mem_base != xmlMemBlocks()) {
Daniel Veillard27f20102004-11-05 11:50:11 +000011276 printf("Leak of %d blocks found in xmlNanoFTPCloseConnection",
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011277 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011278 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011279 printf(" %d", n_ctx);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011280 printf("\n");
11281 }
11282 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011283 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011284#endif
11285
Daniel Veillard42595322004-11-08 10:52:06 +000011286 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011287}
11288
11289
11290static int
11291test_xmlNanoFTPCwd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011292 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011293
William M. Brack21e4ef22005-01-02 09:53:13 +000011294#if defined(LIBXML_FTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011295 int mem_base;
11296 int ret_val;
11297 void * ctx; /* an FTP context */
11298 int n_ctx;
Daniel Veillardce682bc2004-11-05 17:22:25 +000011299 char * directory; /* a directory on the server */
Daniel Veillard27f20102004-11-05 11:50:11 +000011300 int n_directory;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011301
Daniel Veillard27f20102004-11-05 11:50:11 +000011302 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11303 for (n_directory = 0;n_directory < gen_nb_const_char_ptr;n_directory++) {
11304 mem_base = xmlMemBlocks();
11305 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11306 directory = gen_const_char_ptr(n_directory, 1);
11307
William M. Brackf13f77f2004-11-12 16:03:48 +000011308 ret_val = xmlNanoFTPCwd(ctx, (const char *)directory);
Daniel Veillard27f20102004-11-05 11:50:11 +000011309 desret_int(ret_val);
11310 call_tests++;
11311 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000011312 des_const_char_ptr(n_directory, (const char *)directory, 1);
Daniel Veillard27f20102004-11-05 11:50:11 +000011313 xmlResetLastError();
11314 if (mem_base != xmlMemBlocks()) {
11315 printf("Leak of %d blocks found in xmlNanoFTPCwd",
11316 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011317 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011318 printf(" %d", n_ctx);
11319 printf(" %d", n_directory);
11320 printf("\n");
11321 }
11322 }
11323 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011324 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011325#endif
11326
Daniel Veillard42595322004-11-08 10:52:06 +000011327 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011328}
11329
11330
11331static int
11332test_xmlNanoFTPDele(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011333 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011334
William M. Brack21e4ef22005-01-02 09:53:13 +000011335#if defined(LIBXML_FTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011336 int mem_base;
11337 int ret_val;
11338 void * ctx; /* an FTP context */
11339 int n_ctx;
11340 const char * file; /* a file or directory on the server */
11341 int n_file;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011342
Daniel Veillard27f20102004-11-05 11:50:11 +000011343 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11344 for (n_file = 0;n_file < gen_nb_filepath;n_file++) {
11345 mem_base = xmlMemBlocks();
11346 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11347 file = gen_filepath(n_file, 1);
11348
11349 ret_val = xmlNanoFTPDele(ctx, file);
11350 desret_int(ret_val);
11351 call_tests++;
11352 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11353 des_filepath(n_file, file, 1);
11354 xmlResetLastError();
11355 if (mem_base != xmlMemBlocks()) {
11356 printf("Leak of %d blocks found in xmlNanoFTPDele",
11357 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011358 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011359 printf(" %d", n_ctx);
11360 printf(" %d", n_file);
11361 printf("\n");
11362 }
11363 }
11364 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011365 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011366#endif
11367
Daniel Veillard42595322004-11-08 10:52:06 +000011368 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011369}
11370
11371
11372static int
11373test_xmlNanoFTPGet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011374 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011375
11376
11377 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000011378 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011379}
11380
11381
11382static int
11383test_xmlNanoFTPGetConnection(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011384 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011385
William M. Brack21e4ef22005-01-02 09:53:13 +000011386#if defined(LIBXML_FTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011387 int mem_base;
11388 int ret_val;
11389 void * ctx; /* an FTP context */
11390 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011391
Daniel Veillard27f20102004-11-05 11:50:11 +000011392 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11393 mem_base = xmlMemBlocks();
11394 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11395
11396 ret_val = xmlNanoFTPGetConnection(ctx);
11397 desret_int(ret_val);
11398 call_tests++;
11399 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11400 xmlResetLastError();
11401 if (mem_base != xmlMemBlocks()) {
11402 printf("Leak of %d blocks found in xmlNanoFTPGetConnection",
11403 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011404 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011405 printf(" %d", n_ctx);
11406 printf("\n");
11407 }
11408 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011409 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011410#endif
11411
Daniel Veillard42595322004-11-08 10:52:06 +000011412 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011413}
11414
11415
11416static int
11417test_xmlNanoFTPGetResponse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011418 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011419
William M. Brack21e4ef22005-01-02 09:53:13 +000011420#if defined(LIBXML_FTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011421 int mem_base;
11422 int ret_val;
11423 void * ctx; /* an FTP context */
11424 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011425
Daniel Veillard27f20102004-11-05 11:50:11 +000011426 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11427 mem_base = xmlMemBlocks();
11428 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11429
11430 ret_val = xmlNanoFTPGetResponse(ctx);
11431 desret_int(ret_val);
11432 call_tests++;
11433 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11434 xmlResetLastError();
11435 if (mem_base != xmlMemBlocks()) {
11436 printf("Leak of %d blocks found in xmlNanoFTPGetResponse",
11437 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011438 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011439 printf(" %d", n_ctx);
11440 printf("\n");
11441 }
11442 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011443 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011444#endif
11445
Daniel Veillard42595322004-11-08 10:52:06 +000011446 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011447}
11448
11449
11450static int
11451test_xmlNanoFTPGetSocket(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011452 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011453
William M. Brack21e4ef22005-01-02 09:53:13 +000011454#if defined(LIBXML_FTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011455 int mem_base;
11456 int ret_val;
11457 void * ctx; /* an FTP context */
11458 int n_ctx;
11459 const char * filename; /* the file to retrieve (or NULL if path is in context). */
11460 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011461
Daniel Veillard27f20102004-11-05 11:50:11 +000011462 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11463 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
11464 mem_base = xmlMemBlocks();
11465 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11466 filename = gen_filepath(n_filename, 1);
11467
11468 ret_val = xmlNanoFTPGetSocket(ctx, filename);
11469 desret_int(ret_val);
11470 call_tests++;
11471 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11472 des_filepath(n_filename, filename, 1);
11473 xmlResetLastError();
11474 if (mem_base != xmlMemBlocks()) {
11475 printf("Leak of %d blocks found in xmlNanoFTPGetSocket",
11476 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011477 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011478 printf(" %d", n_ctx);
11479 printf(" %d", n_filename);
11480 printf("\n");
11481 }
11482 }
11483 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011484 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011485#endif
11486
Daniel Veillard42595322004-11-08 10:52:06 +000011487 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011488}
11489
11490
11491static int
11492test_xmlNanoFTPInit(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011493 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011494
William M. Brack21e4ef22005-01-02 09:53:13 +000011495#if defined(LIBXML_FTP_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000011496 int mem_base;
11497
11498 mem_base = xmlMemBlocks();
11499
11500 xmlNanoFTPInit();
11501 call_tests++;
11502 xmlResetLastError();
11503 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000011504 printf("Leak of %d blocks found in xmlNanoFTPInit",
Daniel Veillardd93f6252004-11-02 15:53:51 +000011505 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011506 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000011507 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000011508 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011509 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011510#endif
11511
Daniel Veillard42595322004-11-08 10:52:06 +000011512 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011513}
11514
11515
11516static int
11517test_xmlNanoFTPList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011518 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011519
11520
11521 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000011522 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011523}
11524
11525
11526static int
11527test_xmlNanoFTPNewCtxt(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_xmlNanoFTPOpen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011538 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011539
William M. Brack21e4ef22005-01-02 09:53:13 +000011540#if defined(LIBXML_FTP_ENABLED)
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011541 int mem_base;
11542 void * ret_val;
11543 const char * URL; /* the URL to the resource */
11544 int n_URL;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011545
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011546 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
11547 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011548 URL = gen_filepath(n_URL, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011549
11550 ret_val = xmlNanoFTPOpen(URL);
11551 desret_void_ptr(ret_val);
11552 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011553 des_filepath(n_URL, URL, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011554 xmlResetLastError();
11555 if (mem_base != xmlMemBlocks()) {
11556 printf("Leak of %d blocks found in xmlNanoFTPOpen",
11557 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011558 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011559 printf(" %d", n_URL);
11560 printf("\n");
11561 }
11562 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011563 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011564#endif
11565
Daniel Veillard42595322004-11-08 10:52:06 +000011566 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011567}
11568
11569
11570static int
11571test_xmlNanoFTPProxy(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011572 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011573
William M. Brack21e4ef22005-01-02 09:53:13 +000011574#if defined(LIBXML_FTP_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000011575 char * host; /* the proxy host name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000011576 int n_host;
11577 int port; /* the proxy port */
11578 int n_port;
Daniel Veillardce682bc2004-11-05 17:22:25 +000011579 char * user; /* the proxy user name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000011580 int n_user;
Daniel Veillardce682bc2004-11-05 17:22:25 +000011581 char * passwd; /* the proxy password */
Daniel Veillardd93f6252004-11-02 15:53:51 +000011582 int n_passwd;
11583 int type; /* the type of proxy 1 for using SITE, 2 for USER a@b */
11584 int n_type;
11585
11586 for (n_host = 0;n_host < gen_nb_const_char_ptr;n_host++) {
11587 for (n_port = 0;n_port < gen_nb_int;n_port++) {
11588 for (n_user = 0;n_user < gen_nb_const_char_ptr;n_user++) {
11589 for (n_passwd = 0;n_passwd < gen_nb_const_char_ptr;n_passwd++) {
11590 for (n_type = 0;n_type < gen_nb_int;n_type++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +000011591 host = gen_const_char_ptr(n_host, 0);
11592 port = gen_int(n_port, 1);
11593 user = gen_const_char_ptr(n_user, 2);
11594 passwd = gen_const_char_ptr(n_passwd, 3);
11595 type = gen_int(n_type, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011596
William M. Brackf13f77f2004-11-12 16:03:48 +000011597 xmlNanoFTPProxy((const char *)host, port, (const char *)user, (const char *)passwd, type);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011598 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000011599 des_const_char_ptr(n_host, (const char *)host, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000011600 des_int(n_port, port, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000011601 des_const_char_ptr(n_user, (const char *)user, 2);
11602 des_const_char_ptr(n_passwd, (const char *)passwd, 3);
Daniel Veillard3d97e662004-11-04 10:49:00 +000011603 des_int(n_type, type, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011604 xmlResetLastError();
11605 }
11606 }
11607 }
11608 }
11609 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011610 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011611#endif
11612
Daniel Veillard42595322004-11-08 10:52:06 +000011613 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011614}
11615
11616
11617static int
11618test_xmlNanoFTPQuit(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011619 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011620
William M. Brack21e4ef22005-01-02 09:53:13 +000011621#if defined(LIBXML_FTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011622 int mem_base;
11623 int ret_val;
11624 void * ctx; /* an FTP context */
11625 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011626
Daniel Veillard27f20102004-11-05 11:50:11 +000011627 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11628 mem_base = xmlMemBlocks();
11629 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11630
11631 ret_val = xmlNanoFTPQuit(ctx);
11632 desret_int(ret_val);
11633 call_tests++;
11634 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11635 xmlResetLastError();
11636 if (mem_base != xmlMemBlocks()) {
11637 printf("Leak of %d blocks found in xmlNanoFTPQuit",
11638 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011639 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011640 printf(" %d", n_ctx);
11641 printf("\n");
11642 }
11643 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011644 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011645#endif
11646
Daniel Veillard42595322004-11-08 10:52:06 +000011647 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011648}
11649
11650
11651static int
11652test_xmlNanoFTPRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011653 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011654
William M. Brack21e4ef22005-01-02 09:53:13 +000011655#if defined(LIBXML_FTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011656 int mem_base;
11657 int ret_val;
11658 void * ctx; /* the FTP context */
11659 int n_ctx;
11660 void * dest; /* a buffer */
11661 int n_dest;
11662 int len; /* the buffer length */
11663 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011664
Daniel Veillard27f20102004-11-05 11:50:11 +000011665 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11666 for (n_dest = 0;n_dest < gen_nb_void_ptr;n_dest++) {
11667 for (n_len = 0;n_len < gen_nb_int;n_len++) {
11668 mem_base = xmlMemBlocks();
11669 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11670 dest = gen_void_ptr(n_dest, 1);
11671 len = gen_int(n_len, 2);
11672
11673 ret_val = xmlNanoFTPRead(ctx, dest, len);
11674 desret_int(ret_val);
11675 call_tests++;
11676 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11677 des_void_ptr(n_dest, dest, 1);
11678 des_int(n_len, len, 2);
11679 xmlResetLastError();
11680 if (mem_base != xmlMemBlocks()) {
11681 printf("Leak of %d blocks found in xmlNanoFTPRead",
11682 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011683 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011684 printf(" %d", n_ctx);
11685 printf(" %d", n_dest);
11686 printf(" %d", n_len);
11687 printf("\n");
11688 }
11689 }
11690 }
11691 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011692 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011693#endif
11694
Daniel Veillard42595322004-11-08 10:52:06 +000011695 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011696}
11697
11698
11699static int
11700test_xmlNanoFTPScanProxy(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011701 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011702
William M. Brack21e4ef22005-01-02 09:53:13 +000011703#if defined(LIBXML_FTP_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000011704 const char * URL; /* The proxy URL used to initialize the proxy context */
11705 int n_URL;
11706
11707 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +000011708 URL = gen_filepath(n_URL, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011709
11710 xmlNanoFTPScanProxy(URL);
11711 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011712 des_filepath(n_URL, URL, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011713 xmlResetLastError();
11714 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011715 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011716#endif
11717
Daniel Veillard42595322004-11-08 10:52:06 +000011718 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011719}
11720
11721
11722static int
11723test_xmlNanoFTPUpdateURL(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011724 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011725
William M. Brack21e4ef22005-01-02 09:53:13 +000011726#if defined(LIBXML_FTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011727 int mem_base;
11728 int ret_val;
11729 void * ctx; /* an FTP context */
11730 int n_ctx;
11731 const char * URL; /* The URL used to update the context */
11732 int n_URL;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011733
Daniel Veillard27f20102004-11-05 11:50:11 +000011734 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11735 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
11736 mem_base = xmlMemBlocks();
11737 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11738 URL = gen_filepath(n_URL, 1);
11739
11740 ret_val = xmlNanoFTPUpdateURL(ctx, URL);
11741 desret_int(ret_val);
11742 call_tests++;
11743 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11744 des_filepath(n_URL, URL, 1);
11745 xmlResetLastError();
11746 if (mem_base != xmlMemBlocks()) {
11747 printf("Leak of %d blocks found in xmlNanoFTPUpdateURL",
11748 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011749 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011750 printf(" %d", n_ctx);
11751 printf(" %d", n_URL);
11752 printf("\n");
11753 }
11754 }
11755 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011756 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011757#endif
11758
Daniel Veillard42595322004-11-08 10:52:06 +000011759 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011760}
11761
11762static int
11763test_nanoftp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011764 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011765
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011766 if (quiet == 0) printf("Testing nanoftp : 15 of 22 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000011767 test_ret += test_xmlNanoFTPCheckResponse();
11768 test_ret += test_xmlNanoFTPCleanup();
11769 test_ret += test_xmlNanoFTPCloseConnection();
11770 test_ret += test_xmlNanoFTPCwd();
11771 test_ret += test_xmlNanoFTPDele();
11772 test_ret += test_xmlNanoFTPGet();
11773 test_ret += test_xmlNanoFTPGetConnection();
11774 test_ret += test_xmlNanoFTPGetResponse();
11775 test_ret += test_xmlNanoFTPGetSocket();
11776 test_ret += test_xmlNanoFTPInit();
11777 test_ret += test_xmlNanoFTPList();
11778 test_ret += test_xmlNanoFTPNewCtxt();
11779 test_ret += test_xmlNanoFTPOpen();
11780 test_ret += test_xmlNanoFTPProxy();
11781 test_ret += test_xmlNanoFTPQuit();
11782 test_ret += test_xmlNanoFTPRead();
11783 test_ret += test_xmlNanoFTPScanProxy();
11784 test_ret += test_xmlNanoFTPUpdateURL();
Daniel Veillardd93f6252004-11-02 15:53:51 +000011785
Daniel Veillard42595322004-11-08 10:52:06 +000011786 if (test_ret != 0)
11787 printf("Module nanoftp: %d errors\n", test_ret);
11788 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011789}
11790
11791static int
11792test_xmlNanoHTTPAuthHeader(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011793 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011794
William M. Brack21e4ef22005-01-02 09:53:13 +000011795#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011796 int mem_base;
11797 const char * ret_val;
11798 void * ctx; /* the HTTP context */
11799 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011800
Daniel Veillard27f20102004-11-05 11:50:11 +000011801 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
11802 mem_base = xmlMemBlocks();
11803 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
11804
11805 ret_val = xmlNanoHTTPAuthHeader(ctx);
11806 desret_const_char_ptr(ret_val);
11807 call_tests++;
11808 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
11809 xmlResetLastError();
11810 if (mem_base != xmlMemBlocks()) {
11811 printf("Leak of %d blocks found in xmlNanoHTTPAuthHeader",
11812 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011813 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011814 printf(" %d", n_ctx);
11815 printf("\n");
11816 }
11817 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011818 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011819#endif
11820
Daniel Veillard42595322004-11-08 10:52:06 +000011821 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011822}
11823
11824
11825static int
11826test_xmlNanoHTTPCleanup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011827 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011828
William M. Brack21e4ef22005-01-02 09:53:13 +000011829#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000011830 int mem_base;
11831
11832 mem_base = xmlMemBlocks();
11833
11834 xmlNanoHTTPCleanup();
11835 call_tests++;
11836 xmlResetLastError();
11837 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000011838 printf("Leak of %d blocks found in xmlNanoHTTPCleanup",
Daniel Veillardd93f6252004-11-02 15:53:51 +000011839 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011840 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000011841 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000011842 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011843 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011844#endif
11845
Daniel Veillard42595322004-11-08 10:52:06 +000011846 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011847}
11848
11849
11850static int
11851test_xmlNanoHTTPClose(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011852 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011853
William M. Brack21e4ef22005-01-02 09:53:13 +000011854#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011855 int mem_base;
11856 void * ctx; /* the HTTP context */
11857 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011858
Daniel Veillard27f20102004-11-05 11:50:11 +000011859 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
11860 mem_base = xmlMemBlocks();
11861 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
11862
11863 xmlNanoHTTPClose(ctx);
11864 call_tests++;
11865 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
11866 xmlResetLastError();
11867 if (mem_base != xmlMemBlocks()) {
11868 printf("Leak of %d blocks found in xmlNanoHTTPClose",
11869 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011870 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011871 printf(" %d", n_ctx);
11872 printf("\n");
11873 }
11874 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011875 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011876#endif
11877
Daniel Veillard42595322004-11-08 10:52:06 +000011878 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011879}
11880
11881
11882static int
11883test_xmlNanoHTTPContentLength(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011884 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011885
William M. Brack21e4ef22005-01-02 09:53:13 +000011886#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011887 int mem_base;
11888 int ret_val;
11889 void * ctx; /* the HTTP context */
11890 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011891
Daniel Veillard27f20102004-11-05 11:50:11 +000011892 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
11893 mem_base = xmlMemBlocks();
11894 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
11895
11896 ret_val = xmlNanoHTTPContentLength(ctx);
11897 desret_int(ret_val);
11898 call_tests++;
11899 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
11900 xmlResetLastError();
11901 if (mem_base != xmlMemBlocks()) {
11902 printf("Leak of %d blocks found in xmlNanoHTTPContentLength",
11903 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011904 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011905 printf(" %d", n_ctx);
11906 printf("\n");
11907 }
11908 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011909 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011910#endif
11911
Daniel Veillard42595322004-11-08 10:52:06 +000011912 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011913}
11914
11915
11916static int
11917test_xmlNanoHTTPEncoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011918 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011919
William M. Brack21e4ef22005-01-02 09:53:13 +000011920#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011921 int mem_base;
11922 const char * ret_val;
11923 void * ctx; /* the HTTP context */
11924 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011925
Daniel Veillard27f20102004-11-05 11:50:11 +000011926 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
11927 mem_base = xmlMemBlocks();
11928 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
11929
11930 ret_val = xmlNanoHTTPEncoding(ctx);
11931 desret_const_char_ptr(ret_val);
11932 call_tests++;
11933 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
11934 xmlResetLastError();
11935 if (mem_base != xmlMemBlocks()) {
11936 printf("Leak of %d blocks found in xmlNanoHTTPEncoding",
11937 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011938 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011939 printf(" %d", n_ctx);
11940 printf("\n");
11941 }
11942 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011943 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011944#endif
11945
Daniel Veillard42595322004-11-08 10:52:06 +000011946 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011947}
11948
11949
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000011950#define gen_nb_char_ptr_ptr 1
11951static char ** gen_char_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
11952 return(NULL);
11953}
11954static void des_char_ptr_ptr(int no ATTRIBUTE_UNUSED, char ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
11955}
11956
Daniel Veillardd93f6252004-11-02 15:53:51 +000011957static int
11958test_xmlNanoHTTPFetch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011959 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011960
William M. Brack21e4ef22005-01-02 09:53:13 +000011961#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000011962 int mem_base;
11963 int ret_val;
11964 const char * URL; /* The URL to load */
11965 int n_URL;
11966 const char * filename; /* the filename where the content should be saved */
11967 int n_filename;
11968 char ** contentType; /* if available the Content-Type information will be returned at that location */
11969 int n_contentType;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011970
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000011971 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
11972 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
11973 for (n_contentType = 0;n_contentType < gen_nb_char_ptr_ptr;n_contentType++) {
11974 mem_base = xmlMemBlocks();
11975 URL = gen_filepath(n_URL, 0);
11976 filename = gen_filepath(n_filename, 1);
11977 contentType = gen_char_ptr_ptr(n_contentType, 2);
11978
11979 ret_val = xmlNanoHTTPFetch(URL, filename, contentType);
11980 desret_int(ret_val);
11981 call_tests++;
11982 des_filepath(n_URL, URL, 0);
11983 des_filepath(n_filename, filename, 1);
11984 des_char_ptr_ptr(n_contentType, contentType, 2);
11985 xmlResetLastError();
11986 if (mem_base != xmlMemBlocks()) {
11987 printf("Leak of %d blocks found in xmlNanoHTTPFetch",
11988 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011989 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000011990 printf(" %d", n_URL);
11991 printf(" %d", n_filename);
11992 printf(" %d", n_contentType);
11993 printf("\n");
11994 }
11995 }
11996 }
11997 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011998 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000011999#endif
12000
Daniel Veillard42595322004-11-08 10:52:06 +000012001 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012002}
12003
12004
12005static int
12006test_xmlNanoHTTPInit(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012007 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012008
William M. Brack21e4ef22005-01-02 09:53:13 +000012009#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000012010 int mem_base;
12011
12012 mem_base = xmlMemBlocks();
12013
12014 xmlNanoHTTPInit();
12015 call_tests++;
12016 xmlResetLastError();
12017 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012018 printf("Leak of %d blocks found in xmlNanoHTTPInit",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012019 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012020 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012021 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012022 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012023 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012024#endif
12025
Daniel Veillard42595322004-11-08 10:52:06 +000012026 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012027}
12028
12029
12030static int
12031test_xmlNanoHTTPMethod(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012032 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012033
William M. Brack21e4ef22005-01-02 09:53:13 +000012034#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012035 int mem_base;
12036 void * ret_val;
12037 const char * URL; /* The URL to load */
12038 int n_URL;
12039 char * method; /* the HTTP method to use */
12040 int n_method;
12041 char * input; /* the input string if any */
12042 int n_input;
12043 char ** contentType; /* the Content-Type information IN and OUT */
12044 int n_contentType;
12045 char * headers; /* the extra headers */
12046 int n_headers;
12047 int ilen; /* input length */
12048 int n_ilen;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012049
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012050 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
12051 for (n_method = 0;n_method < gen_nb_const_char_ptr;n_method++) {
12052 for (n_input = 0;n_input < gen_nb_const_char_ptr;n_input++) {
12053 for (n_contentType = 0;n_contentType < gen_nb_char_ptr_ptr;n_contentType++) {
12054 for (n_headers = 0;n_headers < gen_nb_const_char_ptr;n_headers++) {
12055 for (n_ilen = 0;n_ilen < gen_nb_int;n_ilen++) {
12056 mem_base = xmlMemBlocks();
12057 URL = gen_filepath(n_URL, 0);
12058 method = gen_const_char_ptr(n_method, 1);
12059 input = gen_const_char_ptr(n_input, 2);
12060 contentType = gen_char_ptr_ptr(n_contentType, 3);
12061 headers = gen_const_char_ptr(n_headers, 4);
12062 ilen = gen_int(n_ilen, 5);
12063
William M. Brackf13f77f2004-11-12 16:03:48 +000012064 ret_val = xmlNanoHTTPMethod(URL, (const char *)method, (const char *)input, contentType, (const char *)headers, ilen);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012065 desret_void_ptr(ret_val);
12066 call_tests++;
12067 des_filepath(n_URL, URL, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000012068 des_const_char_ptr(n_method, (const char *)method, 1);
12069 des_const_char_ptr(n_input, (const char *)input, 2);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012070 des_char_ptr_ptr(n_contentType, contentType, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +000012071 des_const_char_ptr(n_headers, (const char *)headers, 4);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012072 des_int(n_ilen, ilen, 5);
12073 xmlResetLastError();
12074 if (mem_base != xmlMemBlocks()) {
12075 printf("Leak of %d blocks found in xmlNanoHTTPMethod",
12076 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012077 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012078 printf(" %d", n_URL);
12079 printf(" %d", n_method);
12080 printf(" %d", n_input);
12081 printf(" %d", n_contentType);
12082 printf(" %d", n_headers);
12083 printf(" %d", n_ilen);
12084 printf("\n");
12085 }
12086 }
12087 }
12088 }
12089 }
12090 }
12091 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012092 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012093#endif
12094
Daniel Veillard42595322004-11-08 10:52:06 +000012095 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012096}
12097
12098
12099static int
12100test_xmlNanoHTTPMethodRedir(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012101 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012102
William M. Brack21e4ef22005-01-02 09:53:13 +000012103#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012104 int mem_base;
12105 void * ret_val;
12106 const char * URL; /* The URL to load */
12107 int n_URL;
12108 char * method; /* the HTTP method to use */
12109 int n_method;
12110 char * input; /* the input string if any */
12111 int n_input;
12112 char ** contentType; /* the Content-Type information IN and OUT */
12113 int n_contentType;
12114 char ** redir; /* the redirected URL OUT */
12115 int n_redir;
12116 char * headers; /* the extra headers */
12117 int n_headers;
12118 int ilen; /* input length */
12119 int n_ilen;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012120
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012121 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
12122 for (n_method = 0;n_method < gen_nb_const_char_ptr;n_method++) {
12123 for (n_input = 0;n_input < gen_nb_const_char_ptr;n_input++) {
12124 for (n_contentType = 0;n_contentType < gen_nb_char_ptr_ptr;n_contentType++) {
12125 for (n_redir = 0;n_redir < gen_nb_char_ptr_ptr;n_redir++) {
12126 for (n_headers = 0;n_headers < gen_nb_const_char_ptr;n_headers++) {
12127 for (n_ilen = 0;n_ilen < gen_nb_int;n_ilen++) {
12128 mem_base = xmlMemBlocks();
12129 URL = gen_filepath(n_URL, 0);
12130 method = gen_const_char_ptr(n_method, 1);
12131 input = gen_const_char_ptr(n_input, 2);
12132 contentType = gen_char_ptr_ptr(n_contentType, 3);
12133 redir = gen_char_ptr_ptr(n_redir, 4);
12134 headers = gen_const_char_ptr(n_headers, 5);
12135 ilen = gen_int(n_ilen, 6);
12136
William M. Brackf13f77f2004-11-12 16:03:48 +000012137 ret_val = xmlNanoHTTPMethodRedir(URL, (const char *)method, (const char *)input, contentType, redir, (const char *)headers, ilen);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012138 desret_void_ptr(ret_val);
12139 call_tests++;
12140 des_filepath(n_URL, URL, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000012141 des_const_char_ptr(n_method, (const char *)method, 1);
12142 des_const_char_ptr(n_input, (const char *)input, 2);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012143 des_char_ptr_ptr(n_contentType, contentType, 3);
12144 des_char_ptr_ptr(n_redir, redir, 4);
William M. Brackf13f77f2004-11-12 16:03:48 +000012145 des_const_char_ptr(n_headers, (const char *)headers, 5);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012146 des_int(n_ilen, ilen, 6);
12147 xmlResetLastError();
12148 if (mem_base != xmlMemBlocks()) {
12149 printf("Leak of %d blocks found in xmlNanoHTTPMethodRedir",
12150 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012151 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012152 printf(" %d", n_URL);
12153 printf(" %d", n_method);
12154 printf(" %d", n_input);
12155 printf(" %d", n_contentType);
12156 printf(" %d", n_redir);
12157 printf(" %d", n_headers);
12158 printf(" %d", n_ilen);
12159 printf("\n");
12160 }
12161 }
12162 }
12163 }
12164 }
12165 }
12166 }
12167 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012168 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012169#endif
12170
Daniel Veillard42595322004-11-08 10:52:06 +000012171 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012172}
12173
12174
12175static int
12176test_xmlNanoHTTPMimeType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012177 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012178
William M. Brack21e4ef22005-01-02 09:53:13 +000012179#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000012180 int mem_base;
12181 const char * ret_val;
12182 void * ctx; /* the HTTP context */
12183 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012184
Daniel Veillard27f20102004-11-05 11:50:11 +000012185 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
12186 mem_base = xmlMemBlocks();
12187 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
12188
12189 ret_val = xmlNanoHTTPMimeType(ctx);
12190 desret_const_char_ptr(ret_val);
12191 call_tests++;
12192 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
12193 xmlResetLastError();
12194 if (mem_base != xmlMemBlocks()) {
12195 printf("Leak of %d blocks found in xmlNanoHTTPMimeType",
12196 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012197 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012198 printf(" %d", n_ctx);
12199 printf("\n");
12200 }
12201 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012202 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012203#endif
12204
Daniel Veillard42595322004-11-08 10:52:06 +000012205 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012206}
12207
12208
12209static int
12210test_xmlNanoHTTPOpen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012211 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012212
William M. Brack21e4ef22005-01-02 09:53:13 +000012213#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012214 int mem_base;
12215 void * ret_val;
12216 const char * URL; /* The URL to load */
12217 int n_URL;
12218 char ** contentType; /* if available the Content-Type information will be returned at that location */
12219 int n_contentType;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012220
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012221 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
12222 for (n_contentType = 0;n_contentType < gen_nb_char_ptr_ptr;n_contentType++) {
12223 mem_base = xmlMemBlocks();
12224 URL = gen_filepath(n_URL, 0);
12225 contentType = gen_char_ptr_ptr(n_contentType, 1);
12226
12227 ret_val = xmlNanoHTTPOpen(URL, contentType);
12228 desret_void_ptr(ret_val);
12229 call_tests++;
12230 des_filepath(n_URL, URL, 0);
12231 des_char_ptr_ptr(n_contentType, contentType, 1);
12232 xmlResetLastError();
12233 if (mem_base != xmlMemBlocks()) {
12234 printf("Leak of %d blocks found in xmlNanoHTTPOpen",
12235 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012236 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012237 printf(" %d", n_URL);
12238 printf(" %d", n_contentType);
12239 printf("\n");
12240 }
12241 }
12242 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012243 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012244#endif
12245
Daniel Veillard42595322004-11-08 10:52:06 +000012246 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012247}
12248
12249
12250static int
12251test_xmlNanoHTTPOpenRedir(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012252 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012253
William M. Brack21e4ef22005-01-02 09:53:13 +000012254#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012255 int mem_base;
12256 void * ret_val;
12257 const char * URL; /* The URL to load */
12258 int n_URL;
12259 char ** contentType; /* if available the Content-Type information will be returned at that location */
12260 int n_contentType;
12261 char ** redir; /* if available the redirected URL will be returned */
12262 int n_redir;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012263
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012264 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
12265 for (n_contentType = 0;n_contentType < gen_nb_char_ptr_ptr;n_contentType++) {
12266 for (n_redir = 0;n_redir < gen_nb_char_ptr_ptr;n_redir++) {
12267 mem_base = xmlMemBlocks();
12268 URL = gen_filepath(n_URL, 0);
12269 contentType = gen_char_ptr_ptr(n_contentType, 1);
12270 redir = gen_char_ptr_ptr(n_redir, 2);
12271
12272 ret_val = xmlNanoHTTPOpenRedir(URL, contentType, redir);
12273 desret_void_ptr(ret_val);
12274 call_tests++;
12275 des_filepath(n_URL, URL, 0);
12276 des_char_ptr_ptr(n_contentType, contentType, 1);
12277 des_char_ptr_ptr(n_redir, redir, 2);
12278 xmlResetLastError();
12279 if (mem_base != xmlMemBlocks()) {
12280 printf("Leak of %d blocks found in xmlNanoHTTPOpenRedir",
12281 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012282 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012283 printf(" %d", n_URL);
12284 printf(" %d", n_contentType);
12285 printf(" %d", n_redir);
12286 printf("\n");
12287 }
12288 }
12289 }
12290 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012291 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012292#endif
12293
Daniel Veillard42595322004-11-08 10:52:06 +000012294 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012295}
12296
12297
12298static int
12299test_xmlNanoHTTPRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012300 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012301
William M. Brack21e4ef22005-01-02 09:53:13 +000012302#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000012303 int mem_base;
12304 int ret_val;
12305 void * ctx; /* the HTTP context */
12306 int n_ctx;
12307 void * dest; /* a buffer */
12308 int n_dest;
12309 int len; /* the buffer length */
12310 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012311
Daniel Veillard27f20102004-11-05 11:50:11 +000012312 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
12313 for (n_dest = 0;n_dest < gen_nb_void_ptr;n_dest++) {
12314 for (n_len = 0;n_len < gen_nb_int;n_len++) {
12315 mem_base = xmlMemBlocks();
12316 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
12317 dest = gen_void_ptr(n_dest, 1);
12318 len = gen_int(n_len, 2);
12319
12320 ret_val = xmlNanoHTTPRead(ctx, dest, len);
12321 desret_int(ret_val);
12322 call_tests++;
12323 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
12324 des_void_ptr(n_dest, dest, 1);
12325 des_int(n_len, len, 2);
12326 xmlResetLastError();
12327 if (mem_base != xmlMemBlocks()) {
12328 printf("Leak of %d blocks found in xmlNanoHTTPRead",
12329 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012330 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012331 printf(" %d", n_ctx);
12332 printf(" %d", n_dest);
12333 printf(" %d", n_len);
12334 printf("\n");
12335 }
12336 }
12337 }
12338 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012339 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012340#endif
12341
Daniel Veillard42595322004-11-08 10:52:06 +000012342 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012343}
12344
12345
12346static int
12347test_xmlNanoHTTPRedir(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012348 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012349
12350
12351 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000012352 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012353}
12354
12355
12356static int
12357test_xmlNanoHTTPReturnCode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012358 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012359
William M. Brack21e4ef22005-01-02 09:53:13 +000012360#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000012361 int mem_base;
12362 int ret_val;
12363 void * ctx; /* the HTTP context */
12364 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012365
Daniel Veillard27f20102004-11-05 11:50:11 +000012366 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
12367 mem_base = xmlMemBlocks();
12368 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
12369
12370 ret_val = xmlNanoHTTPReturnCode(ctx);
12371 desret_int(ret_val);
12372 call_tests++;
12373 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
12374 xmlResetLastError();
12375 if (mem_base != xmlMemBlocks()) {
12376 printf("Leak of %d blocks found in xmlNanoHTTPReturnCode",
12377 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012378 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012379 printf(" %d", n_ctx);
12380 printf("\n");
12381 }
12382 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012383 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012384#endif
12385
Daniel Veillard42595322004-11-08 10:52:06 +000012386 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012387}
12388
12389
12390static int
12391test_xmlNanoHTTPSave(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012392 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012393
William M. Brack21e4ef22005-01-02 09:53:13 +000012394#if defined(LIBXML_HTTP_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012395 int mem_base;
12396 int ret_val;
12397 void * ctxt; /* the HTTP context */
12398 int n_ctxt;
12399 const char * filename; /* the filename where the content should be saved */
12400 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012401
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012402 for (n_ctxt = 0;n_ctxt < gen_nb_void_ptr;n_ctxt++) {
12403 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
12404 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012405 ctxt = gen_void_ptr(n_ctxt, 0);
12406 filename = gen_fileoutput(n_filename, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012407
12408 ret_val = xmlNanoHTTPSave(ctxt, filename);
12409 desret_int(ret_val);
12410 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012411 des_void_ptr(n_ctxt, ctxt, 0);
12412 des_fileoutput(n_filename, filename, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012413 xmlResetLastError();
12414 if (mem_base != xmlMemBlocks()) {
12415 printf("Leak of %d blocks found in xmlNanoHTTPSave",
12416 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012417 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012418 printf(" %d", n_ctxt);
12419 printf(" %d", n_filename);
12420 printf("\n");
12421 }
12422 }
12423 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012424 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012425#endif
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012426
Daniel Veillard42595322004-11-08 10:52:06 +000012427 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012428}
12429
12430
12431static int
12432test_xmlNanoHTTPScanProxy(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012433 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012434
William M. Brack21e4ef22005-01-02 09:53:13 +000012435#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000012436 const char * URL; /* The proxy URL used to initialize the proxy context */
12437 int n_URL;
12438
12439 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +000012440 URL = gen_filepath(n_URL, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012441
12442 xmlNanoHTTPScanProxy(URL);
12443 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012444 des_filepath(n_URL, URL, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012445 xmlResetLastError();
12446 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012447 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012448#endif
12449
Daniel Veillard42595322004-11-08 10:52:06 +000012450 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012451}
12452
12453static int
12454test_nanohttp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012455 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012456
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012457 if (quiet == 0) printf("Testing nanohttp : 16 of 17 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000012458 test_ret += test_xmlNanoHTTPAuthHeader();
12459 test_ret += test_xmlNanoHTTPCleanup();
12460 test_ret += test_xmlNanoHTTPClose();
12461 test_ret += test_xmlNanoHTTPContentLength();
12462 test_ret += test_xmlNanoHTTPEncoding();
12463 test_ret += test_xmlNanoHTTPFetch();
12464 test_ret += test_xmlNanoHTTPInit();
12465 test_ret += test_xmlNanoHTTPMethod();
12466 test_ret += test_xmlNanoHTTPMethodRedir();
12467 test_ret += test_xmlNanoHTTPMimeType();
12468 test_ret += test_xmlNanoHTTPOpen();
12469 test_ret += test_xmlNanoHTTPOpenRedir();
12470 test_ret += test_xmlNanoHTTPRead();
12471 test_ret += test_xmlNanoHTTPRedir();
12472 test_ret += test_xmlNanoHTTPReturnCode();
12473 test_ret += test_xmlNanoHTTPSave();
12474 test_ret += test_xmlNanoHTTPScanProxy();
Daniel Veillardd93f6252004-11-02 15:53:51 +000012475
Daniel Veillard42595322004-11-08 10:52:06 +000012476 if (test_ret != 0)
12477 printf("Module nanohttp: %d errors\n", test_ret);
12478 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012479}
12480
12481static int
12482test_xmlByteConsumed(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012483 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012484
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000012485 int mem_base;
12486 long ret_val;
12487 xmlParserCtxtPtr ctxt; /* an XML parser context */
12488 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012489
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000012490 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12491 mem_base = xmlMemBlocks();
12492 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
12493
12494 ret_val = xmlByteConsumed(ctxt);
12495 desret_long(ret_val);
12496 call_tests++;
12497 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
12498 xmlResetLastError();
12499 if (mem_base != xmlMemBlocks()) {
12500 printf("Leak of %d blocks found in xmlByteConsumed",
12501 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012502 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000012503 printf(" %d", n_ctxt);
12504 printf("\n");
12505 }
12506 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000012507 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012508
Daniel Veillard42595322004-11-08 10:52:06 +000012509 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012510}
12511
12512
12513static int
12514test_xmlClearNodeInfoSeq(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012515 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012516
Daniel Veillardce682bc2004-11-05 17:22:25 +000012517 int mem_base;
12518 xmlParserNodeInfoSeqPtr seq; /* a node info sequence pointer */
12519 int n_seq;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012520
Daniel Veillardce682bc2004-11-05 17:22:25 +000012521 for (n_seq = 0;n_seq < gen_nb_xmlParserNodeInfoSeqPtr;n_seq++) {
12522 mem_base = xmlMemBlocks();
12523 seq = gen_xmlParserNodeInfoSeqPtr(n_seq, 0);
12524
12525 xmlClearNodeInfoSeq(seq);
12526 call_tests++;
12527 des_xmlParserNodeInfoSeqPtr(n_seq, seq, 0);
12528 xmlResetLastError();
12529 if (mem_base != xmlMemBlocks()) {
12530 printf("Leak of %d blocks found in xmlClearNodeInfoSeq",
12531 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012532 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012533 printf(" %d", n_seq);
12534 printf("\n");
12535 }
12536 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000012537 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012538
Daniel Veillard42595322004-11-08 10:52:06 +000012539 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012540}
12541
12542
12543static int
12544test_xmlClearParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012545 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012546
12547 int mem_base;
12548 xmlParserCtxtPtr ctxt; /* an XML parser context */
12549 int n_ctxt;
12550
12551 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12552 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012553 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012554
12555 xmlClearParserCtxt(ctxt);
12556 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012557 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012558 xmlResetLastError();
12559 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012560 printf("Leak of %d blocks found in xmlClearParserCtxt",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012561 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012562 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012563 printf(" %d", n_ctxt);
12564 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012565 }
12566 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000012567 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012568
Daniel Veillard42595322004-11-08 10:52:06 +000012569 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012570}
12571
12572
12573static int
12574test_xmlCreateDocParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012575 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012576
Daniel Veillard34099b42004-11-04 17:34:35 +000012577 int mem_base;
12578 xmlParserCtxtPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012579 xmlChar * cur; /* a pointer to an array of xmlChar */
Daniel Veillard34099b42004-11-04 17:34:35 +000012580 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012581
Daniel Veillard34099b42004-11-04 17:34:35 +000012582 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
12583 mem_base = xmlMemBlocks();
12584 cur = gen_const_xmlChar_ptr(n_cur, 0);
12585
William M. Brackf13f77f2004-11-12 16:03:48 +000012586 ret_val = xmlCreateDocParserCtxt((const xmlChar *)cur);
Daniel Veillard34099b42004-11-04 17:34:35 +000012587 desret_xmlParserCtxtPtr(ret_val);
12588 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000012589 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 0);
Daniel Veillard34099b42004-11-04 17:34:35 +000012590 xmlResetLastError();
12591 if (mem_base != xmlMemBlocks()) {
12592 printf("Leak of %d blocks found in xmlCreateDocParserCtxt",
12593 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012594 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000012595 printf(" %d", n_cur);
12596 printf("\n");
12597 }
12598 }
Daniel Veillard34099b42004-11-04 17:34:35 +000012599 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012600
Daniel Veillard42595322004-11-08 10:52:06 +000012601 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012602}
12603
12604
12605static int
12606test_xmlCreatePushParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012607 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012608
William M. Brack21e4ef22005-01-02 09:53:13 +000012609#if defined(LIBXML_PUSH_ENABLED)
Daniel Veillard34099b42004-11-04 17:34:35 +000012610 int mem_base;
12611 xmlParserCtxtPtr ret_val;
12612 xmlSAXHandlerPtr sax; /* a SAX handler */
12613 int n_sax;
12614 void * user_data; /* The user data returned on SAX callbacks */
12615 int n_user_data;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012616 char * chunk; /* a pointer to an array of chars */
Daniel Veillard34099b42004-11-04 17:34:35 +000012617 int n_chunk;
12618 int size; /* number of chars in the array */
12619 int n_size;
12620 const char * filename; /* an optional file name or URI */
12621 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012622
Daniel Veillard34099b42004-11-04 17:34:35 +000012623 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
12624 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
12625 for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) {
12626 for (n_size = 0;n_size < gen_nb_int;n_size++) {
Daniel Veillard42595322004-11-08 10:52:06 +000012627 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
Daniel Veillard34099b42004-11-04 17:34:35 +000012628 mem_base = xmlMemBlocks();
12629 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
12630 user_data = gen_userdata(n_user_data, 1);
12631 chunk = gen_const_char_ptr(n_chunk, 2);
12632 size = gen_int(n_size, 3);
Daniel Veillard42595322004-11-08 10:52:06 +000012633 filename = gen_fileoutput(n_filename, 4);
Daniel Veillard34099b42004-11-04 17:34:35 +000012634
William M. Brackf13f77f2004-11-12 16:03:48 +000012635 ret_val = xmlCreatePushParserCtxt(sax, user_data, (const char *)chunk, size, filename);
Daniel Veillard34099b42004-11-04 17:34:35 +000012636 desret_xmlParserCtxtPtr(ret_val);
12637 call_tests++;
12638 des_xmlSAXHandlerPtr(n_sax, sax, 0);
12639 des_userdata(n_user_data, user_data, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000012640 des_const_char_ptr(n_chunk, (const char *)chunk, 2);
Daniel Veillard34099b42004-11-04 17:34:35 +000012641 des_int(n_size, size, 3);
Daniel Veillard42595322004-11-08 10:52:06 +000012642 des_fileoutput(n_filename, filename, 4);
Daniel Veillard34099b42004-11-04 17:34:35 +000012643 xmlResetLastError();
12644 if (mem_base != xmlMemBlocks()) {
12645 printf("Leak of %d blocks found in xmlCreatePushParserCtxt",
12646 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012647 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000012648 printf(" %d", n_sax);
12649 printf(" %d", n_user_data);
12650 printf(" %d", n_chunk);
12651 printf(" %d", n_size);
12652 printf(" %d", n_filename);
12653 printf("\n");
12654 }
12655 }
12656 }
12657 }
12658 }
12659 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012660 function_tests++;
Daniel Veillard34099b42004-11-04 17:34:35 +000012661#endif
12662
Daniel Veillard42595322004-11-08 10:52:06 +000012663 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012664}
12665
12666
12667static int
12668test_xmlCtxtReadDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012669 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012670
12671 int mem_base;
12672 xmlDocPtr ret_val;
12673 xmlParserCtxtPtr ctxt; /* an XML parser context */
12674 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012675 xmlChar * cur; /* a pointer to a zero terminated string */
Daniel Veillardd93f6252004-11-02 15:53:51 +000012676 int n_cur;
12677 const char * URL; /* the base URL to use for the document */
12678 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012679 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000012680 int n_encoding;
12681 int options; /* a combination of xmlParserOption */
12682 int n_options;
12683
12684 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12685 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
12686 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
12687 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000012688 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000012689 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012690 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
12691 cur = gen_const_xmlChar_ptr(n_cur, 1);
12692 URL = gen_filepath(n_URL, 2);
12693 encoding = gen_const_char_ptr(n_encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000012694 options = gen_parseroptions(n_options, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012695
William M. Brackf13f77f2004-11-12 16:03:48 +000012696 ret_val = xmlCtxtReadDoc(ctxt, (const xmlChar *)cur, URL, (const char *)encoding, options);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012697 desret_xmlDocPtr(ret_val);
12698 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012699 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000012700 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000012701 des_filepath(n_URL, URL, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000012702 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000012703 des_parseroptions(n_options, options, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012704 xmlResetLastError();
12705 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012706 printf("Leak of %d blocks found in xmlCtxtReadDoc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012707 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012708 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012709 printf(" %d", n_ctxt);
12710 printf(" %d", n_cur);
12711 printf(" %d", n_URL);
12712 printf(" %d", n_encoding);
12713 printf(" %d", n_options);
12714 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012715 }
12716 }
12717 }
12718 }
12719 }
12720 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000012721 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012722
Daniel Veillard42595322004-11-08 10:52:06 +000012723 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012724}
12725
12726
12727static int
12728test_xmlCtxtReadFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012729 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012730
12731 int mem_base;
12732 xmlDocPtr ret_val;
12733 xmlParserCtxtPtr ctxt; /* an XML parser context */
12734 int n_ctxt;
12735 const char * filename; /* a file or URL */
12736 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012737 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000012738 int n_encoding;
12739 int options; /* a combination of xmlParserOption */
12740 int n_options;
12741
12742 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12743 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
12744 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000012745 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000012746 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012747 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
12748 filename = gen_filepath(n_filename, 1);
12749 encoding = gen_const_char_ptr(n_encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000012750 options = gen_parseroptions(n_options, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012751
William M. Brackf13f77f2004-11-12 16:03:48 +000012752 ret_val = xmlCtxtReadFile(ctxt, filename, (const char *)encoding, options);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012753 desret_xmlDocPtr(ret_val);
12754 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012755 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
12756 des_filepath(n_filename, filename, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000012757 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000012758 des_parseroptions(n_options, options, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012759 xmlResetLastError();
12760 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012761 printf("Leak of %d blocks found in xmlCtxtReadFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012762 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012763 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012764 printf(" %d", n_ctxt);
12765 printf(" %d", n_filename);
12766 printf(" %d", n_encoding);
12767 printf(" %d", n_options);
12768 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012769 }
12770 }
12771 }
12772 }
12773 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000012774 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012775
Daniel Veillard42595322004-11-08 10:52:06 +000012776 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012777}
12778
12779
12780static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000012781test_xmlCtxtReadMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012782 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012783
12784 int mem_base;
12785 xmlDocPtr ret_val;
12786 xmlParserCtxtPtr ctxt; /* an XML parser context */
12787 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012788 char * buffer; /* a pointer to a char array */
Daniel Veillardd93f6252004-11-02 15:53:51 +000012789 int n_buffer;
12790 int size; /* the size of the array */
12791 int n_size;
12792 const char * URL; /* the base URL to use for the document */
12793 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012794 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000012795 int n_encoding;
12796 int options; /* a combination of xmlParserOption */
12797 int n_options;
12798
12799 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12800 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
12801 for (n_size = 0;n_size < gen_nb_int;n_size++) {
12802 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
12803 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000012804 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000012805 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012806 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
12807 buffer = gen_const_char_ptr(n_buffer, 1);
12808 size = gen_int(n_size, 2);
12809 URL = gen_filepath(n_URL, 3);
12810 encoding = gen_const_char_ptr(n_encoding, 4);
Daniel Veillard6128c012004-11-08 17:16:15 +000012811 options = gen_parseroptions(n_options, 5);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012812
William M. Brackf13f77f2004-11-12 16:03:48 +000012813 ret_val = xmlCtxtReadMemory(ctxt, (const char *)buffer, size, URL, (const char *)encoding, options);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012814 desret_xmlDocPtr(ret_val);
12815 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012816 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000012817 des_const_char_ptr(n_buffer, (const char *)buffer, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000012818 des_int(n_size, size, 2);
12819 des_filepath(n_URL, URL, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +000012820 des_const_char_ptr(n_encoding, (const char *)encoding, 4);
Daniel Veillard6128c012004-11-08 17:16:15 +000012821 des_parseroptions(n_options, options, 5);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012822 xmlResetLastError();
12823 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012824 printf("Leak of %d blocks found in xmlCtxtReadMemory",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012825 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012826 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012827 printf(" %d", n_ctxt);
12828 printf(" %d", n_buffer);
12829 printf(" %d", n_size);
12830 printf(" %d", n_URL);
12831 printf(" %d", n_encoding);
12832 printf(" %d", n_options);
12833 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012834 }
12835 }
12836 }
12837 }
12838 }
12839 }
12840 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000012841 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012842
Daniel Veillard42595322004-11-08 10:52:06 +000012843 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012844}
12845
12846
12847static int
12848test_xmlCtxtReset(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012849 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012850
12851 int mem_base;
12852 xmlParserCtxtPtr ctxt; /* an XML parser context */
12853 int n_ctxt;
12854
12855 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12856 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012857 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012858
12859 xmlCtxtReset(ctxt);
12860 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012861 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012862 xmlResetLastError();
12863 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012864 printf("Leak of %d blocks found in xmlCtxtReset",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012865 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012866 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012867 printf(" %d", n_ctxt);
12868 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012869 }
12870 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000012871 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012872
Daniel Veillard42595322004-11-08 10:52:06 +000012873 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012874}
12875
12876
12877static int
12878test_xmlCtxtResetPush(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012879 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012880
12881 int mem_base;
12882 int ret_val;
12883 xmlParserCtxtPtr ctxt; /* an XML parser context */
12884 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012885 char * chunk; /* a pointer to an array of chars */
Daniel Veillardd93f6252004-11-02 15:53:51 +000012886 int n_chunk;
12887 int size; /* number of chars in the array */
12888 int n_size;
12889 const char * filename; /* an optional file name or URI */
12890 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012891 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000012892 int n_encoding;
12893
12894 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12895 for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) {
12896 for (n_size = 0;n_size < gen_nb_int;n_size++) {
12897 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
12898 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
12899 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012900 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
12901 chunk = gen_const_char_ptr(n_chunk, 1);
12902 size = gen_int(n_size, 2);
12903 filename = gen_filepath(n_filename, 3);
12904 encoding = gen_const_char_ptr(n_encoding, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012905
William M. Brackf13f77f2004-11-12 16:03:48 +000012906 ret_val = xmlCtxtResetPush(ctxt, (const char *)chunk, size, filename, (const char *)encoding);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012907 desret_int(ret_val);
12908 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012909 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000012910 des_const_char_ptr(n_chunk, (const char *)chunk, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000012911 des_int(n_size, size, 2);
12912 des_filepath(n_filename, filename, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +000012913 des_const_char_ptr(n_encoding, (const char *)encoding, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012914 xmlResetLastError();
12915 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012916 printf("Leak of %d blocks found in xmlCtxtResetPush",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012917 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012918 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012919 printf(" %d", n_ctxt);
12920 printf(" %d", n_chunk);
12921 printf(" %d", n_size);
12922 printf(" %d", n_filename);
12923 printf(" %d", n_encoding);
12924 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012925 }
12926 }
12927 }
12928 }
12929 }
12930 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000012931 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012932
Daniel Veillard42595322004-11-08 10:52:06 +000012933 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012934}
12935
12936
12937static int
12938test_xmlCtxtUseOptions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012939 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012940
12941 int mem_base;
12942 int ret_val;
12943 xmlParserCtxtPtr ctxt; /* an XML parser context */
12944 int n_ctxt;
12945 int options; /* a combination of xmlParserOption */
12946 int n_options;
12947
12948 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000012949 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000012950 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012951 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillard6128c012004-11-08 17:16:15 +000012952 options = gen_parseroptions(n_options, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012953
12954 ret_val = xmlCtxtUseOptions(ctxt, options);
12955 desret_int(ret_val);
12956 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012957 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillard6128c012004-11-08 17:16:15 +000012958 des_parseroptions(n_options, options, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012959 xmlResetLastError();
12960 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012961 printf("Leak of %d blocks found in xmlCtxtUseOptions",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012962 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012963 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012964 printf(" %d", n_ctxt);
12965 printf(" %d", n_options);
12966 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012967 }
12968 }
12969 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000012970 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012971
Daniel Veillard42595322004-11-08 10:52:06 +000012972 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012973}
12974
12975
12976static int
12977test_xmlGetExternalEntityLoader(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012978 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012979
12980
12981 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000012982 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012983}
12984
12985
12986static int
12987test_xmlGetFeature(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012988 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012989
William M. Brack21e4ef22005-01-02 09:53:13 +000012990#if defined(LIBXML_LEGACY_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000012991#ifdef LIBXML_LEGACY_ENABLED
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012992 int mem_base;
12993 int ret_val;
12994 xmlParserCtxtPtr ctxt; /* an XML/HTML parser context */
12995 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012996 char * name; /* the feature name */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012997 int n_name;
12998 void * result; /* location to store the result */
12999 int n_result;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013000
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000013001 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13002 for (n_name = 0;n_name < gen_nb_const_char_ptr;n_name++) {
13003 for (n_result = 0;n_result < gen_nb_void_ptr;n_result++) {
13004 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013005 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
13006 name = gen_const_char_ptr(n_name, 1);
13007 result = gen_void_ptr(n_result, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000013008
William M. Brackf13f77f2004-11-12 16:03:48 +000013009 ret_val = xmlGetFeature(ctxt, (const char *)name, result);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000013010 desret_int(ret_val);
13011 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013012 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000013013 des_const_char_ptr(n_name, (const char *)name, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000013014 des_void_ptr(n_result, result, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000013015 xmlResetLastError();
13016 if (mem_base != xmlMemBlocks()) {
13017 printf("Leak of %d blocks found in xmlGetFeature",
13018 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013019 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000013020 printf(" %d", n_ctxt);
13021 printf(" %d", n_name);
13022 printf(" %d", n_result);
13023 printf("\n");
13024 }
13025 }
13026 }
13027 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013028 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013029#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000013030#endif
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000013031
Daniel Veillard42595322004-11-08 10:52:06 +000013032 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013033}
13034
13035
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000013036#define gen_nb_const_char_ptr_ptr 1
13037static char ** gen_const_char_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
13038 return(NULL);
13039}
13040static void des_const_char_ptr_ptr(int no ATTRIBUTE_UNUSED, const char ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
13041}
13042
Daniel Veillardd93f6252004-11-02 15:53:51 +000013043static int
13044test_xmlGetFeaturesList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013045 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013046
William M. Brack21e4ef22005-01-02 09:53:13 +000013047#if defined(LIBXML_LEGACY_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000013048#ifdef LIBXML_LEGACY_ENABLED
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000013049 int mem_base;
13050 int ret_val;
13051 int * len; /* the length of the features name array (input/output) */
13052 int n_len;
13053 char ** result; /* an array of string to be filled with the features name. */
13054 int n_result;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013055
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000013056 for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
13057 for (n_result = 0;n_result < gen_nb_const_char_ptr_ptr;n_result++) {
13058 mem_base = xmlMemBlocks();
13059 len = gen_int_ptr(n_len, 0);
13060 result = gen_const_char_ptr_ptr(n_result, 1);
13061
William M. Brackf13f77f2004-11-12 16:03:48 +000013062 ret_val = xmlGetFeaturesList(len, (const char **)result);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000013063 desret_int(ret_val);
13064 call_tests++;
13065 des_int_ptr(n_len, len, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000013066 des_const_char_ptr_ptr(n_result, (const char **)result, 1);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000013067 xmlResetLastError();
13068 if (mem_base != xmlMemBlocks()) {
13069 printf("Leak of %d blocks found in xmlGetFeaturesList",
13070 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013071 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000013072 printf(" %d", n_len);
13073 printf(" %d", n_result);
13074 printf("\n");
13075 }
13076 }
13077 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013078 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013079#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000013080#endif
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000013081
Daniel Veillard42595322004-11-08 10:52:06 +000013082 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013083}
13084
13085
13086static int
13087test_xmlIOParseDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013088 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013089
William M. Brack21e4ef22005-01-02 09:53:13 +000013090#if defined(LIBXML_VALID_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000013091#ifdef LIBXML_VALID_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000013092 int mem_base;
13093 xmlDtdPtr ret_val;
13094 xmlSAXHandlerPtr sax; /* the SAX handler block or NULL */
13095 int n_sax;
13096 xmlParserInputBufferPtr input; /* an Input Buffer */
13097 int n_input;
13098 xmlCharEncoding enc; /* the charset encoding if known */
13099 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013100
Daniel Veillard34099b42004-11-04 17:34:35 +000013101 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
13102 for (n_input = 0;n_input < gen_nb_xmlParserInputBufferPtr;n_input++) {
13103 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
13104 mem_base = xmlMemBlocks();
13105 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
13106 input = gen_xmlParserInputBufferPtr(n_input, 1);
13107 enc = gen_xmlCharEncoding(n_enc, 2);
13108
13109 ret_val = xmlIOParseDTD(sax, input, enc);
13110 input = NULL;
13111 desret_xmlDtdPtr(ret_val);
13112 call_tests++;
13113 des_xmlSAXHandlerPtr(n_sax, sax, 0);
13114 des_xmlParserInputBufferPtr(n_input, input, 1);
13115 des_xmlCharEncoding(n_enc, enc, 2);
13116 xmlResetLastError();
13117 if (mem_base != xmlMemBlocks()) {
13118 printf("Leak of %d blocks found in xmlIOParseDTD",
13119 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013120 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000013121 printf(" %d", n_sax);
13122 printf(" %d", n_input);
13123 printf(" %d", n_enc);
13124 printf("\n");
13125 }
13126 }
13127 }
13128 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013129 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013130#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000013131#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000013132
Daniel Veillard42595322004-11-08 10:52:06 +000013133 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013134}
13135
13136
13137static int
13138test_xmlInitNodeInfoSeq(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013139 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013140
Daniel Veillardce682bc2004-11-05 17:22:25 +000013141 int mem_base;
13142 xmlParserNodeInfoSeqPtr seq; /* a node info sequence pointer */
13143 int n_seq;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013144
Daniel Veillardce682bc2004-11-05 17:22:25 +000013145 for (n_seq = 0;n_seq < gen_nb_xmlParserNodeInfoSeqPtr;n_seq++) {
13146 mem_base = xmlMemBlocks();
13147 seq = gen_xmlParserNodeInfoSeqPtr(n_seq, 0);
13148
13149 xmlInitNodeInfoSeq(seq);
13150 call_tests++;
13151 des_xmlParserNodeInfoSeqPtr(n_seq, seq, 0);
13152 xmlResetLastError();
13153 if (mem_base != xmlMemBlocks()) {
13154 printf("Leak of %d blocks found in xmlInitNodeInfoSeq",
13155 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013156 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013157 printf(" %d", n_seq);
13158 printf("\n");
13159 }
13160 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000013161 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013162
Daniel Veillard42595322004-11-08 10:52:06 +000013163 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013164}
13165
13166
13167static int
13168test_xmlInitParser(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013169 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013170
13171 int mem_base;
13172
13173 mem_base = xmlMemBlocks();
13174
13175 xmlInitParser();
13176 call_tests++;
13177 xmlResetLastError();
13178 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013179 printf("Leak of %d blocks found in xmlInitParser",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013180 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013181 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013182 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013183 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000013184 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013185
Daniel Veillard42595322004-11-08 10:52:06 +000013186 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013187}
13188
13189
13190static int
13191test_xmlInitParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013192 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013193
13194 int mem_base;
13195 int ret_val;
13196 xmlParserCtxtPtr ctxt; /* an XML parser context */
13197 int n_ctxt;
13198
13199 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13200 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013201 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013202
13203 ret_val = xmlInitParserCtxt(ctxt);
13204 desret_int(ret_val);
13205 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013206 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013207 xmlResetLastError();
13208 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013209 printf("Leak of %d blocks found in xmlInitParserCtxt",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013210 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013211 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013212 printf(" %d", n_ctxt);
13213 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013214 }
13215 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000013216 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013217
Daniel Veillard42595322004-11-08 10:52:06 +000013218 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013219}
13220
13221
13222static int
13223test_xmlKeepBlanksDefault(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013224 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013225
13226 int mem_base;
13227 int ret_val;
13228 int val; /* int 0 or 1 */
13229 int n_val;
13230
13231 for (n_val = 0;n_val < gen_nb_int;n_val++) {
13232 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013233 val = gen_int(n_val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013234
13235 ret_val = xmlKeepBlanksDefault(val);
13236 desret_int(ret_val);
13237 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013238 des_int(n_val, val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013239 xmlResetLastError();
13240 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013241 printf("Leak of %d blocks found in xmlKeepBlanksDefault",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013242 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013243 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013244 printf(" %d", n_val);
13245 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013246 }
13247 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000013248 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013249
Daniel Veillard42595322004-11-08 10:52:06 +000013250 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013251}
13252
13253
13254static int
13255test_xmlLineNumbersDefault(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013256 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013257
13258 int mem_base;
13259 int ret_val;
13260 int val; /* int 0 or 1 */
13261 int n_val;
13262
13263 for (n_val = 0;n_val < gen_nb_int;n_val++) {
13264 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013265 val = gen_int(n_val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013266
13267 ret_val = xmlLineNumbersDefault(val);
13268 desret_int(ret_val);
13269 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013270 des_int(n_val, val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013271 xmlResetLastError();
13272 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013273 printf("Leak of %d blocks found in xmlLineNumbersDefault",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013274 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013275 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013276 printf(" %d", n_val);
13277 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013278 }
13279 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000013280 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013281
Daniel Veillard42595322004-11-08 10:52:06 +000013282 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013283}
13284
13285
13286static int
13287test_xmlLoadExternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013288 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013289
Daniel Veillard42595322004-11-08 10:52:06 +000013290 int mem_base;
13291 xmlParserInputPtr ret_val;
13292 const char * URL; /* the URL for the entity to load */
13293 int n_URL;
13294 char * ID; /* the Public ID for the entity to load */
13295 int n_ID;
13296 xmlParserCtxtPtr ctxt; /* the context in which the entity is called or NULL */
13297 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013298
Daniel Veillard42595322004-11-08 10:52:06 +000013299 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
13300 for (n_ID = 0;n_ID < gen_nb_const_char_ptr;n_ID++) {
13301 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13302 mem_base = xmlMemBlocks();
13303 URL = gen_filepath(n_URL, 0);
13304 ID = gen_const_char_ptr(n_ID, 1);
13305 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 2);
13306
William M. Brackf13f77f2004-11-12 16:03:48 +000013307 ret_val = xmlLoadExternalEntity(URL, (const char *)ID, ctxt);
Daniel Veillard42595322004-11-08 10:52:06 +000013308 desret_xmlParserInputPtr(ret_val);
13309 call_tests++;
13310 des_filepath(n_URL, URL, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000013311 des_const_char_ptr(n_ID, (const char *)ID, 1);
Daniel Veillard42595322004-11-08 10:52:06 +000013312 des_xmlParserCtxtPtr(n_ctxt, ctxt, 2);
13313 xmlResetLastError();
13314 if (mem_base != xmlMemBlocks()) {
13315 printf("Leak of %d blocks found in xmlLoadExternalEntity",
13316 xmlMemBlocks() - mem_base);
13317 test_ret++;
13318 printf(" %d", n_URL);
13319 printf(" %d", n_ID);
13320 printf(" %d", n_ctxt);
13321 printf("\n");
13322 }
13323 }
13324 }
13325 }
Daniel Veillard42595322004-11-08 10:52:06 +000013326 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013327
Daniel Veillard42595322004-11-08 10:52:06 +000013328 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013329}
13330
13331
13332static int
13333test_xmlNewIOInputStream(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013334 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013335
Daniel Veillard42595322004-11-08 10:52:06 +000013336 int mem_base;
13337 xmlParserInputPtr ret_val;
13338 xmlParserCtxtPtr ctxt; /* an XML parser context */
13339 int n_ctxt;
13340 xmlParserInputBufferPtr input; /* an I/O Input */
13341 int n_input;
13342 xmlCharEncoding enc; /* the charset encoding if known */
13343 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013344
Daniel Veillard42595322004-11-08 10:52:06 +000013345 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13346 for (n_input = 0;n_input < gen_nb_xmlParserInputBufferPtr;n_input++) {
13347 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
13348 mem_base = xmlMemBlocks();
13349 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
13350 input = gen_xmlParserInputBufferPtr(n_input, 1);
13351 enc = gen_xmlCharEncoding(n_enc, 2);
13352
13353 ret_val = xmlNewIOInputStream(ctxt, input, enc);
13354 if (ret_val != NULL) input = NULL;
13355 desret_xmlParserInputPtr(ret_val);
13356 call_tests++;
13357 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
13358 des_xmlParserInputBufferPtr(n_input, input, 1);
13359 des_xmlCharEncoding(n_enc, enc, 2);
13360 xmlResetLastError();
13361 if (mem_base != xmlMemBlocks()) {
13362 printf("Leak of %d blocks found in xmlNewIOInputStream",
13363 xmlMemBlocks() - mem_base);
13364 test_ret++;
13365 printf(" %d", n_ctxt);
13366 printf(" %d", n_input);
13367 printf(" %d", n_enc);
13368 printf("\n");
13369 }
13370 }
13371 }
13372 }
Daniel Veillard42595322004-11-08 10:52:06 +000013373 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013374
Daniel Veillard42595322004-11-08 10:52:06 +000013375 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013376}
13377
13378
13379static int
13380test_xmlNewParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013381 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013382
Daniel Veillard34099b42004-11-04 17:34:35 +000013383 int mem_base;
13384 xmlParserCtxtPtr ret_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013385
Daniel Veillard34099b42004-11-04 17:34:35 +000013386 mem_base = xmlMemBlocks();
13387
13388 ret_val = xmlNewParserCtxt();
13389 desret_xmlParserCtxtPtr(ret_val);
13390 call_tests++;
13391 xmlResetLastError();
13392 if (mem_base != xmlMemBlocks()) {
13393 printf("Leak of %d blocks found in xmlNewParserCtxt",
13394 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013395 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000013396 printf("\n");
13397 }
Daniel Veillard34099b42004-11-04 17:34:35 +000013398 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013399
Daniel Veillard42595322004-11-08 10:52:06 +000013400 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013401}
13402
13403
Daniel Veillardce682bc2004-11-05 17:22:25 +000013404#define gen_nb_xmlNodePtr_ptr 1
13405static xmlNodePtr * gen_xmlNodePtr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
13406 return(NULL);
13407}
13408static void des_xmlNodePtr_ptr(int no ATTRIBUTE_UNUSED, xmlNodePtr * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
13409}
13410
Daniel Veillardd93f6252004-11-02 15:53:51 +000013411static int
13412test_xmlParseBalancedChunkMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013413 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013414
William M. Brack21e4ef22005-01-02 09:53:13 +000013415#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000013416#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000013417 int mem_base;
13418 int ret_val;
13419 xmlDocPtr doc; /* the document the chunk pertains to */
13420 int n_doc;
13421 xmlSAXHandlerPtr sax; /* the SAX handler bloc (possibly NULL) */
13422 int n_sax;
13423 void * user_data; /* The user data returned on SAX callbacks (possibly NULL) */
13424 int n_user_data;
13425 int depth; /* Used for loop detection, use 0 */
13426 int n_depth;
13427 xmlChar * string; /* the input string in UTF8 or ISO-Latin (zero terminated) */
13428 int n_string;
13429 xmlNodePtr * lst; /* the return value for the set of parsed nodes */
13430 int n_lst;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013431
Daniel Veillardce682bc2004-11-05 17:22:25 +000013432 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
13433 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
13434 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
13435 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
13436 for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) {
13437 for (n_lst = 0;n_lst < gen_nb_xmlNodePtr_ptr;n_lst++) {
13438 mem_base = xmlMemBlocks();
13439 doc = gen_xmlDocPtr(n_doc, 0);
13440 sax = gen_xmlSAXHandlerPtr(n_sax, 1);
13441 user_data = gen_userdata(n_user_data, 2);
13442 depth = gen_int(n_depth, 3);
13443 string = gen_const_xmlChar_ptr(n_string, 4);
13444 lst = gen_xmlNodePtr_ptr(n_lst, 5);
Daniel Veillarda521d282004-11-09 14:59:59 +000013445
13446#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000013447 if (sax == (xmlSAXHandlerPtr)&xmlDefaultSAXHandler) user_data = NULL;
Daniel Veillarda521d282004-11-09 14:59:59 +000013448#endif
13449
Daniel Veillardce682bc2004-11-05 17:22:25 +000013450
William M. Brackf13f77f2004-11-12 16:03:48 +000013451 ret_val = xmlParseBalancedChunkMemory(doc, sax, user_data, depth, (const xmlChar *)string, lst);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013452 desret_int(ret_val);
13453 call_tests++;
13454 des_xmlDocPtr(n_doc, doc, 0);
13455 des_xmlSAXHandlerPtr(n_sax, sax, 1);
13456 des_userdata(n_user_data, user_data, 2);
13457 des_int(n_depth, depth, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +000013458 des_const_xmlChar_ptr(n_string, (const xmlChar *)string, 4);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013459 des_xmlNodePtr_ptr(n_lst, lst, 5);
13460 xmlResetLastError();
13461 if (mem_base != xmlMemBlocks()) {
13462 printf("Leak of %d blocks found in xmlParseBalancedChunkMemory",
13463 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013464 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013465 printf(" %d", n_doc);
13466 printf(" %d", n_sax);
13467 printf(" %d", n_user_data);
13468 printf(" %d", n_depth);
13469 printf(" %d", n_string);
13470 printf(" %d", n_lst);
13471 printf("\n");
13472 }
13473 }
13474 }
13475 }
13476 }
13477 }
13478 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013479 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013480#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000013481#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +000013482
Daniel Veillard42595322004-11-08 10:52:06 +000013483 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013484}
13485
13486
13487static int
13488test_xmlParseBalancedChunkMemoryRecover(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013489 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013490
William M. Brack21e4ef22005-01-02 09:53:13 +000013491#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000013492#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000013493 int mem_base;
13494 int ret_val;
13495 xmlDocPtr doc; /* the document the chunk pertains to */
13496 int n_doc;
13497 xmlSAXHandlerPtr sax; /* the SAX handler bloc (possibly NULL) */
13498 int n_sax;
13499 void * user_data; /* The user data returned on SAX callbacks (possibly NULL) */
13500 int n_user_data;
13501 int depth; /* Used for loop detection, use 0 */
13502 int n_depth;
13503 xmlChar * string; /* the input string in UTF8 or ISO-Latin (zero terminated) */
13504 int n_string;
13505 xmlNodePtr * lst; /* the return value for the set of parsed nodes */
13506 int n_lst;
13507 int recover; /* return nodes even if the data is broken (use 0) */
13508 int n_recover;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013509
Daniel Veillardce682bc2004-11-05 17:22:25 +000013510 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
13511 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
13512 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
13513 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
13514 for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) {
13515 for (n_lst = 0;n_lst < gen_nb_xmlNodePtr_ptr;n_lst++) {
13516 for (n_recover = 0;n_recover < gen_nb_int;n_recover++) {
13517 mem_base = xmlMemBlocks();
13518 doc = gen_xmlDocPtr(n_doc, 0);
13519 sax = gen_xmlSAXHandlerPtr(n_sax, 1);
13520 user_data = gen_userdata(n_user_data, 2);
13521 depth = gen_int(n_depth, 3);
13522 string = gen_const_xmlChar_ptr(n_string, 4);
13523 lst = gen_xmlNodePtr_ptr(n_lst, 5);
13524 recover = gen_int(n_recover, 6);
Daniel Veillarda521d282004-11-09 14:59:59 +000013525
13526#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000013527 if (sax == (xmlSAXHandlerPtr)&xmlDefaultSAXHandler) user_data = NULL;
Daniel Veillarda521d282004-11-09 14:59:59 +000013528#endif
13529
Daniel Veillardce682bc2004-11-05 17:22:25 +000013530
William M. Brackf13f77f2004-11-12 16:03:48 +000013531 ret_val = xmlParseBalancedChunkMemoryRecover(doc, sax, user_data, depth, (const xmlChar *)string, lst, recover);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013532 desret_int(ret_val);
13533 call_tests++;
13534 des_xmlDocPtr(n_doc, doc, 0);
13535 des_xmlSAXHandlerPtr(n_sax, sax, 1);
13536 des_userdata(n_user_data, user_data, 2);
13537 des_int(n_depth, depth, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +000013538 des_const_xmlChar_ptr(n_string, (const xmlChar *)string, 4);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013539 des_xmlNodePtr_ptr(n_lst, lst, 5);
13540 des_int(n_recover, recover, 6);
13541 xmlResetLastError();
13542 if (mem_base != xmlMemBlocks()) {
13543 printf("Leak of %d blocks found in xmlParseBalancedChunkMemoryRecover",
13544 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013545 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013546 printf(" %d", n_doc);
13547 printf(" %d", n_sax);
13548 printf(" %d", n_user_data);
13549 printf(" %d", n_depth);
13550 printf(" %d", n_string);
13551 printf(" %d", n_lst);
13552 printf(" %d", n_recover);
13553 printf("\n");
13554 }
13555 }
13556 }
13557 }
13558 }
13559 }
13560 }
13561 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013562 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013563#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000013564#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +000013565
Daniel Veillard42595322004-11-08 10:52:06 +000013566 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013567}
13568
13569
13570static int
13571test_xmlParseChunk(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013572 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013573
William M. Brack21e4ef22005-01-02 09:53:13 +000013574#if defined(LIBXML_PUSH_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000013575 int mem_base;
13576 int ret_val;
13577 xmlParserCtxtPtr ctxt; /* an XML parser context */
13578 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013579 char * chunk; /* an char array */
Daniel Veillardd93f6252004-11-02 15:53:51 +000013580 int n_chunk;
13581 int size; /* the size in byte of the chunk */
13582 int n_size;
13583 int terminate; /* last chunk indicator */
13584 int n_terminate;
13585
13586 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13587 for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) {
13588 for (n_size = 0;n_size < gen_nb_int;n_size++) {
13589 for (n_terminate = 0;n_terminate < gen_nb_int;n_terminate++) {
13590 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013591 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
13592 chunk = gen_const_char_ptr(n_chunk, 1);
13593 size = gen_int(n_size, 2);
13594 terminate = gen_int(n_terminate, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013595
William M. Brackf13f77f2004-11-12 16:03:48 +000013596 ret_val = xmlParseChunk(ctxt, (const char *)chunk, size, terminate);
Daniel Veillarda521d282004-11-09 14:59:59 +000013597 if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;}
Daniel Veillardd93f6252004-11-02 15:53:51 +000013598 desret_int(ret_val);
13599 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013600 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000013601 des_const_char_ptr(n_chunk, (const char *)chunk, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000013602 des_int(n_size, size, 2);
13603 des_int(n_terminate, terminate, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013604 xmlResetLastError();
13605 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013606 printf("Leak of %d blocks found in xmlParseChunk",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013607 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013608 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013609 printf(" %d", n_ctxt);
13610 printf(" %d", n_chunk);
13611 printf(" %d", n_size);
13612 printf(" %d", n_terminate);
13613 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013614 }
13615 }
13616 }
13617 }
13618 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013619 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013620#endif
13621
Daniel Veillard42595322004-11-08 10:52:06 +000013622 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013623}
13624
13625
13626static int
13627test_xmlParseCtxtExternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013628 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013629
Daniel Veillardce682bc2004-11-05 17:22:25 +000013630 int mem_base;
13631 int ret_val;
13632 xmlParserCtxtPtr ctx; /* the existing parsing context */
13633 int n_ctx;
13634 xmlChar * URL; /* the URL for the entity to load */
13635 int n_URL;
13636 xmlChar * ID; /* the System ID for the entity to load */
13637 int n_ID;
13638 xmlNodePtr * lst; /* the return value for the set of parsed nodes */
13639 int n_lst;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013640
Daniel Veillardce682bc2004-11-05 17:22:25 +000013641 for (n_ctx = 0;n_ctx < gen_nb_xmlParserCtxtPtr;n_ctx++) {
13642 for (n_URL = 0;n_URL < gen_nb_const_xmlChar_ptr;n_URL++) {
13643 for (n_ID = 0;n_ID < gen_nb_const_xmlChar_ptr;n_ID++) {
13644 for (n_lst = 0;n_lst < gen_nb_xmlNodePtr_ptr;n_lst++) {
13645 mem_base = xmlMemBlocks();
13646 ctx = gen_xmlParserCtxtPtr(n_ctx, 0);
13647 URL = gen_const_xmlChar_ptr(n_URL, 1);
13648 ID = gen_const_xmlChar_ptr(n_ID, 2);
13649 lst = gen_xmlNodePtr_ptr(n_lst, 3);
13650
William M. Brackf13f77f2004-11-12 16:03:48 +000013651 ret_val = xmlParseCtxtExternalEntity(ctx, (const xmlChar *)URL, (const xmlChar *)ID, lst);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013652 desret_int(ret_val);
13653 call_tests++;
13654 des_xmlParserCtxtPtr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000013655 des_const_xmlChar_ptr(n_URL, (const xmlChar *)URL, 1);
13656 des_const_xmlChar_ptr(n_ID, (const xmlChar *)ID, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013657 des_xmlNodePtr_ptr(n_lst, lst, 3);
13658 xmlResetLastError();
13659 if (mem_base != xmlMemBlocks()) {
13660 printf("Leak of %d blocks found in xmlParseCtxtExternalEntity",
13661 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013662 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013663 printf(" %d", n_ctx);
13664 printf(" %d", n_URL);
13665 printf(" %d", n_ID);
13666 printf(" %d", n_lst);
13667 printf("\n");
13668 }
13669 }
13670 }
13671 }
13672 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000013673 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013674
Daniel Veillard42595322004-11-08 10:52:06 +000013675 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013676}
13677
13678
13679static int
13680test_xmlParseDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013681 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013682
William M. Brack21e4ef22005-01-02 09:53:13 +000013683#if defined(LIBXML_VALID_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000013684#ifdef LIBXML_VALID_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000013685 int mem_base;
13686 xmlDtdPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013687 xmlChar * ExternalID; /* a NAME* containing the External ID of the DTD */
Daniel Veillard34099b42004-11-04 17:34:35 +000013688 int n_ExternalID;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013689 xmlChar * SystemID; /* a NAME* containing the URL to the DTD */
Daniel Veillard34099b42004-11-04 17:34:35 +000013690 int n_SystemID;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013691
Daniel Veillard34099b42004-11-04 17:34:35 +000013692 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
13693 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
13694 mem_base = xmlMemBlocks();
13695 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 0);
13696 SystemID = gen_const_xmlChar_ptr(n_SystemID, 1);
13697
William M. Brackf13f77f2004-11-12 16:03:48 +000013698 ret_val = xmlParseDTD((const xmlChar *)ExternalID, (const xmlChar *)SystemID);
Daniel Veillard34099b42004-11-04 17:34:35 +000013699 desret_xmlDtdPtr(ret_val);
13700 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000013701 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 0);
13702 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 1);
Daniel Veillard34099b42004-11-04 17:34:35 +000013703 xmlResetLastError();
13704 if (mem_base != xmlMemBlocks()) {
13705 printf("Leak of %d blocks found in xmlParseDTD",
13706 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013707 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000013708 printf(" %d", n_ExternalID);
13709 printf(" %d", n_SystemID);
13710 printf("\n");
13711 }
13712 }
13713 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013714 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013715#endif
William M. Brack21e4ef22005-01-02 09:53:13 +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
William M. Brack21e4ef22005-01-02 09:53:13 +000013726#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000013727#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard8a32fe42004-11-02 22:10:16 +000013728 int mem_base;
13729 xmlDocPtr ret_val;
13730 xmlChar * cur; /* a pointer to an array of xmlChar */
13731 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013732
Daniel Veillard8a32fe42004-11-02 22:10:16 +000013733 for (n_cur = 0;n_cur < gen_nb_xmlChar_ptr;n_cur++) {
13734 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013735 cur = gen_xmlChar_ptr(n_cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000013736
13737 ret_val = xmlParseDoc(cur);
13738 desret_xmlDocPtr(ret_val);
13739 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013740 des_xmlChar_ptr(n_cur, cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000013741 xmlResetLastError();
13742 if (mem_base != xmlMemBlocks()) {
13743 printf("Leak of %d blocks found in xmlParseDoc",
13744 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013745 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000013746 printf(" %d", n_cur);
13747 printf("\n");
13748 }
13749 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013750 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013751#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000013752#endif
Daniel Veillard8a32fe42004-11-02 22:10:16 +000013753
Daniel Veillard42595322004-11-08 10:52:06 +000013754 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013755}
13756
13757
13758static int
13759test_xmlParseDocument(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013760 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013761
13762 int mem_base;
13763 int ret_val;
13764 xmlParserCtxtPtr ctxt; /* an XML parser context */
13765 int n_ctxt;
13766
13767 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13768 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013769 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013770
13771 ret_val = xmlParseDocument(ctxt);
Daniel Veillarda521d282004-11-09 14:59:59 +000013772 if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;}
Daniel Veillardd93f6252004-11-02 15:53:51 +000013773 desret_int(ret_val);
13774 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013775 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013776 xmlResetLastError();
13777 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013778 printf("Leak of %d blocks found in xmlParseDocument",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013779 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013780 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013781 printf(" %d", n_ctxt);
13782 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013783 }
13784 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000013785 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013786
Daniel Veillard42595322004-11-08 10:52:06 +000013787 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013788}
13789
13790
13791static int
13792test_xmlParseEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013793 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013794
William M. Brack21e4ef22005-01-02 09:53:13 +000013795#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000013796#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000013797 int mem_base;
13798 xmlDocPtr ret_val;
13799 const char * filename; /* the filename */
13800 int n_filename;
13801
13802 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
13803 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013804 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013805
13806 ret_val = xmlParseEntity(filename);
13807 desret_xmlDocPtr(ret_val);
13808 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013809 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013810 xmlResetLastError();
13811 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013812 printf("Leak of %d blocks found in xmlParseEntity",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013813 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013814 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013815 printf(" %d", n_filename);
13816 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013817 }
13818 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013819 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013820#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000013821#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000013822
Daniel Veillard42595322004-11-08 10:52:06 +000013823 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013824}
13825
13826
13827static int
13828test_xmlParseExtParsedEnt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013829 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013830
13831 int mem_base;
13832 int ret_val;
13833 xmlParserCtxtPtr ctxt; /* an XML parser context */
13834 int n_ctxt;
13835
13836 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13837 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013838 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013839
13840 ret_val = xmlParseExtParsedEnt(ctxt);
Daniel Veillarda521d282004-11-09 14:59:59 +000013841 if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;}
Daniel Veillardd93f6252004-11-02 15:53:51 +000013842 desret_int(ret_val);
13843 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013844 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013845 xmlResetLastError();
13846 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013847 printf("Leak of %d blocks found in xmlParseExtParsedEnt",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013848 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013849 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013850 printf(" %d", n_ctxt);
13851 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013852 }
13853 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000013854 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013855
Daniel Veillard42595322004-11-08 10:52:06 +000013856 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013857}
13858
13859
13860static int
13861test_xmlParseExternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013862 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013863
William M. Brack21e4ef22005-01-02 09:53:13 +000013864#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000013865#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000013866 int mem_base;
13867 int ret_val;
13868 xmlDocPtr doc; /* the document the chunk pertains to */
13869 int n_doc;
13870 xmlSAXHandlerPtr sax; /* the SAX handler bloc (possibly NULL) */
13871 int n_sax;
13872 void * user_data; /* The user data returned on SAX callbacks (possibly NULL) */
13873 int n_user_data;
13874 int depth; /* Used for loop detection, use 0 */
13875 int n_depth;
13876 xmlChar * URL; /* the URL for the entity to load */
13877 int n_URL;
13878 xmlChar * ID; /* the System ID for the entity to load */
13879 int n_ID;
13880 xmlNodePtr * lst; /* the return value for the set of parsed nodes */
13881 int n_lst;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013882
Daniel Veillardce682bc2004-11-05 17:22:25 +000013883 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
13884 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
13885 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
13886 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
13887 for (n_URL = 0;n_URL < gen_nb_const_xmlChar_ptr;n_URL++) {
13888 for (n_ID = 0;n_ID < gen_nb_const_xmlChar_ptr;n_ID++) {
13889 for (n_lst = 0;n_lst < gen_nb_xmlNodePtr_ptr;n_lst++) {
13890 mem_base = xmlMemBlocks();
13891 doc = gen_xmlDocPtr(n_doc, 0);
13892 sax = gen_xmlSAXHandlerPtr(n_sax, 1);
13893 user_data = gen_userdata(n_user_data, 2);
13894 depth = gen_int(n_depth, 3);
13895 URL = gen_const_xmlChar_ptr(n_URL, 4);
13896 ID = gen_const_xmlChar_ptr(n_ID, 5);
13897 lst = gen_xmlNodePtr_ptr(n_lst, 6);
13898
William M. Brackf13f77f2004-11-12 16:03:48 +000013899 ret_val = xmlParseExternalEntity(doc, sax, user_data, depth, (const xmlChar *)URL, (const xmlChar *)ID, lst);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013900 desret_int(ret_val);
13901 call_tests++;
13902 des_xmlDocPtr(n_doc, doc, 0);
13903 des_xmlSAXHandlerPtr(n_sax, sax, 1);
13904 des_userdata(n_user_data, user_data, 2);
13905 des_int(n_depth, depth, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +000013906 des_const_xmlChar_ptr(n_URL, (const xmlChar *)URL, 4);
13907 des_const_xmlChar_ptr(n_ID, (const xmlChar *)ID, 5);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013908 des_xmlNodePtr_ptr(n_lst, lst, 6);
13909 xmlResetLastError();
13910 if (mem_base != xmlMemBlocks()) {
13911 printf("Leak of %d blocks found in xmlParseExternalEntity",
13912 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013913 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013914 printf(" %d", n_doc);
13915 printf(" %d", n_sax);
13916 printf(" %d", n_user_data);
13917 printf(" %d", n_depth);
13918 printf(" %d", n_URL);
13919 printf(" %d", n_ID);
13920 printf(" %d", n_lst);
13921 printf("\n");
13922 }
13923 }
13924 }
13925 }
13926 }
13927 }
13928 }
13929 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013930 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013931#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000013932#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +000013933
Daniel Veillard42595322004-11-08 10:52:06 +000013934 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013935}
13936
13937
13938static int
13939test_xmlParseFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013940 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013941
William M. Brack21e4ef22005-01-02 09:53:13 +000013942#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000013943#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000013944 int mem_base;
13945 xmlDocPtr ret_val;
13946 const char * filename; /* the filename */
13947 int n_filename;
13948
13949 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
13950 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013951 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013952
13953 ret_val = xmlParseFile(filename);
13954 desret_xmlDocPtr(ret_val);
13955 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013956 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013957 xmlResetLastError();
13958 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013959 printf("Leak of %d blocks found in xmlParseFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013960 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013961 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013962 printf(" %d", n_filename);
13963 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013964 }
13965 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013966 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013967#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000013968#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000013969
Daniel Veillard42595322004-11-08 10:52:06 +000013970 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013971}
13972
13973
13974static int
13975test_xmlParseInNodeContext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013976 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013977
Daniel Veillard57b25162004-11-06 14:50:18 +000013978 int mem_base;
13979 xmlParserErrors ret_val;
13980 xmlNodePtr node; /* the context node */
13981 int n_node;
13982 char * data; /* the input string */
13983 int n_data;
13984 int datalen; /* the input string length in bytes */
13985 int n_datalen;
13986 int options; /* a combination of xmlParserOption */
13987 int n_options;
13988 xmlNodePtr * lst; /* the return value for the set of parsed nodes */
13989 int n_lst;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013990
Daniel Veillard57b25162004-11-06 14:50:18 +000013991 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
13992 for (n_data = 0;n_data < gen_nb_const_char_ptr;n_data++) {
13993 for (n_datalen = 0;n_datalen < gen_nb_int;n_datalen++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000013994 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillard57b25162004-11-06 14:50:18 +000013995 for (n_lst = 0;n_lst < gen_nb_xmlNodePtr_ptr;n_lst++) {
13996 mem_base = xmlMemBlocks();
13997 node = gen_xmlNodePtr(n_node, 0);
13998 data = gen_const_char_ptr(n_data, 1);
13999 datalen = gen_int(n_datalen, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000014000 options = gen_parseroptions(n_options, 3);
Daniel Veillard57b25162004-11-06 14:50:18 +000014001 lst = gen_xmlNodePtr_ptr(n_lst, 4);
14002
William M. Brackf13f77f2004-11-12 16:03:48 +000014003 ret_val = xmlParseInNodeContext(node, (const char *)data, datalen, options, lst);
Daniel Veillard57b25162004-11-06 14:50:18 +000014004 desret_xmlParserErrors(ret_val);
14005 call_tests++;
14006 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000014007 des_const_char_ptr(n_data, (const char *)data, 1);
Daniel Veillard57b25162004-11-06 14:50:18 +000014008 des_int(n_datalen, datalen, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000014009 des_parseroptions(n_options, options, 3);
Daniel Veillard57b25162004-11-06 14:50:18 +000014010 des_xmlNodePtr_ptr(n_lst, lst, 4);
14011 xmlResetLastError();
14012 if (mem_base != xmlMemBlocks()) {
14013 printf("Leak of %d blocks found in xmlParseInNodeContext",
14014 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014015 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000014016 printf(" %d", n_node);
14017 printf(" %d", n_data);
14018 printf(" %d", n_datalen);
14019 printf(" %d", n_options);
14020 printf(" %d", n_lst);
14021 printf("\n");
14022 }
14023 }
14024 }
14025 }
14026 }
14027 }
Daniel Veillard57b25162004-11-06 14:50:18 +000014028 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014029
Daniel Veillard42595322004-11-08 10:52:06 +000014030 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014031}
14032
14033
14034static int
14035test_xmlParseMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014036 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014037
William M. Brack21e4ef22005-01-02 09:53:13 +000014038#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014039#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000014040 int mem_base;
14041 xmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014042 char * buffer; /* an pointer to a char array */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014043 int n_buffer;
14044 int size; /* the size of the array */
14045 int n_size;
14046
14047 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
14048 for (n_size = 0;n_size < gen_nb_int;n_size++) {
14049 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014050 buffer = gen_const_char_ptr(n_buffer, 0);
14051 size = gen_int(n_size, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014052
William M. Brackf13f77f2004-11-12 16:03:48 +000014053 ret_val = xmlParseMemory((const char *)buffer, size);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014054 desret_xmlDocPtr(ret_val);
14055 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000014056 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000014057 des_int(n_size, size, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014058 xmlResetLastError();
14059 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014060 printf("Leak of %d blocks found in xmlParseMemory",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014061 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014062 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014063 printf(" %d", n_buffer);
14064 printf(" %d", n_size);
14065 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014066 }
14067 }
14068 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014069 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014070#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014071#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000014072
Daniel Veillard42595322004-11-08 10:52:06 +000014073 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014074}
14075
14076
Daniel Veillardce682bc2004-11-05 17:22:25 +000014077#define gen_nb_const_xmlParserNodeInfoPtr 1
14078static xmlParserNodeInfoPtr gen_const_xmlParserNodeInfoPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14079 return(NULL);
14080}
14081static void des_const_xmlParserNodeInfoPtr(int no ATTRIBUTE_UNUSED, const xmlParserNodeInfoPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14082}
14083
Daniel Veillardd93f6252004-11-02 15:53:51 +000014084static int
14085test_xmlParserAddNodeInfo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014086 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014087
Daniel Veillardce682bc2004-11-05 17:22:25 +000014088 int mem_base;
14089 xmlParserCtxtPtr ctxt; /* an XML parser context */
14090 int n_ctxt;
14091 xmlParserNodeInfoPtr info; /* a node info sequence pointer */
14092 int n_info;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014093
Daniel Veillardce682bc2004-11-05 17:22:25 +000014094 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
14095 for (n_info = 0;n_info < gen_nb_const_xmlParserNodeInfoPtr;n_info++) {
14096 mem_base = xmlMemBlocks();
14097 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
14098 info = gen_const_xmlParserNodeInfoPtr(n_info, 1);
14099
William M. Brackf13f77f2004-11-12 16:03:48 +000014100 xmlParserAddNodeInfo(ctxt, (const xmlParserNodeInfoPtr)info);
Daniel Veillardce682bc2004-11-05 17:22:25 +000014101 call_tests++;
14102 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000014103 des_const_xmlParserNodeInfoPtr(n_info, (const xmlParserNodeInfoPtr)info, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000014104 xmlResetLastError();
14105 if (mem_base != xmlMemBlocks()) {
14106 printf("Leak of %d blocks found in xmlParserAddNodeInfo",
14107 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014108 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014109 printf(" %d", n_ctxt);
14110 printf(" %d", n_info);
14111 printf("\n");
14112 }
14113 }
14114 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000014115 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014116
Daniel Veillard42595322004-11-08 10:52:06 +000014117 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014118}
14119
14120
Daniel Veillardce682bc2004-11-05 17:22:25 +000014121#define gen_nb_const_xmlParserCtxtPtr 1
14122static xmlParserCtxtPtr gen_const_xmlParserCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14123 return(NULL);
14124}
14125static void des_const_xmlParserCtxtPtr(int no ATTRIBUTE_UNUSED, const xmlParserCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14126}
14127
Daniel Veillarda521d282004-11-09 14:59:59 +000014128#define gen_nb_const_xmlNodePtr 1
14129static xmlNodePtr gen_const_xmlNodePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14130 return(NULL);
14131}
14132static void des_const_xmlNodePtr(int no ATTRIBUTE_UNUSED, const xmlNodePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14133}
14134
Daniel Veillardd93f6252004-11-02 15:53:51 +000014135static int
14136test_xmlParserFindNodeInfo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014137 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014138
William M. Brack094dd862004-11-14 14:28:34 +000014139 int mem_base;
14140 const xmlParserNodeInfo * ret_val;
14141 xmlParserCtxtPtr ctx; /* an XML parser context */
14142 int n_ctx;
14143 xmlNodePtr node; /* an XML node within the tree */
14144 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014145
William M. Brack094dd862004-11-14 14:28:34 +000014146 for (n_ctx = 0;n_ctx < gen_nb_const_xmlParserCtxtPtr;n_ctx++) {
14147 for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) {
14148 mem_base = xmlMemBlocks();
14149 ctx = gen_const_xmlParserCtxtPtr(n_ctx, 0);
14150 node = gen_const_xmlNodePtr(n_node, 1);
14151
14152 ret_val = xmlParserFindNodeInfo((const xmlParserCtxtPtr)ctx, (const xmlNodePtr)node);
14153 desret_const_xmlParserNodeInfo_ptr(ret_val);
14154 call_tests++;
14155 des_const_xmlParserCtxtPtr(n_ctx, (const xmlParserCtxtPtr)ctx, 0);
14156 des_const_xmlNodePtr(n_node, (const xmlNodePtr)node, 1);
14157 xmlResetLastError();
14158 if (mem_base != xmlMemBlocks()) {
14159 printf("Leak of %d blocks found in xmlParserFindNodeInfo",
14160 xmlMemBlocks() - mem_base);
14161 test_ret++;
14162 printf(" %d", n_ctx);
14163 printf(" %d", n_node);
14164 printf("\n");
14165 }
14166 }
14167 }
14168 function_tests++;
14169
Daniel Veillard42595322004-11-08 10:52:06 +000014170 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014171}
14172
14173
Daniel Veillardce682bc2004-11-05 17:22:25 +000014174#define gen_nb_const_xmlParserNodeInfoSeqPtr 1
14175static xmlParserNodeInfoSeqPtr gen_const_xmlParserNodeInfoSeqPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14176 return(NULL);
14177}
14178static void des_const_xmlParserNodeInfoSeqPtr(int no ATTRIBUTE_UNUSED, const xmlParserNodeInfoSeqPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14179}
14180
Daniel Veillardd93f6252004-11-02 15:53:51 +000014181static int
14182test_xmlParserFindNodeInfoIndex(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014183 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014184
William M. Brack094dd862004-11-14 14:28:34 +000014185 int mem_base;
14186 unsigned long ret_val;
14187 xmlParserNodeInfoSeqPtr seq; /* a node info sequence pointer */
14188 int n_seq;
14189 xmlNodePtr node; /* an XML node pointer */
14190 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014191
William M. Brack094dd862004-11-14 14:28:34 +000014192 for (n_seq = 0;n_seq < gen_nb_const_xmlParserNodeInfoSeqPtr;n_seq++) {
14193 for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) {
14194 mem_base = xmlMemBlocks();
14195 seq = gen_const_xmlParserNodeInfoSeqPtr(n_seq, 0);
14196 node = gen_const_xmlNodePtr(n_node, 1);
14197
14198 ret_val = xmlParserFindNodeInfoIndex((const xmlParserNodeInfoSeqPtr)seq, (const xmlNodePtr)node);
14199 desret_unsigned_long(ret_val);
14200 call_tests++;
14201 des_const_xmlParserNodeInfoSeqPtr(n_seq, (const xmlParserNodeInfoSeqPtr)seq, 0);
14202 des_const_xmlNodePtr(n_node, (const xmlNodePtr)node, 1);
14203 xmlResetLastError();
14204 if (mem_base != xmlMemBlocks()) {
14205 printf("Leak of %d blocks found in xmlParserFindNodeInfoIndex",
14206 xmlMemBlocks() - mem_base);
14207 test_ret++;
14208 printf(" %d", n_seq);
14209 printf(" %d", n_node);
14210 printf("\n");
14211 }
14212 }
14213 }
14214 function_tests++;
14215
Daniel Veillard42595322004-11-08 10:52:06 +000014216 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014217}
14218
14219
Daniel Veillardce682bc2004-11-05 17:22:25 +000014220#define gen_nb_xmlParserInputPtr 1
14221static xmlParserInputPtr gen_xmlParserInputPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14222 return(NULL);
14223}
14224static void des_xmlParserInputPtr(int no ATTRIBUTE_UNUSED, xmlParserInputPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14225}
14226
Daniel Veillardd93f6252004-11-02 15:53:51 +000014227static int
14228test_xmlParserInputGrow(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014229 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014230
Daniel Veillardce682bc2004-11-05 17:22:25 +000014231 int mem_base;
14232 int ret_val;
14233 xmlParserInputPtr in; /* an XML parser input */
14234 int n_in;
14235 int len; /* an indicative size for the lookahead */
14236 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014237
Daniel Veillardce682bc2004-11-05 17:22:25 +000014238 for (n_in = 0;n_in < gen_nb_xmlParserInputPtr;n_in++) {
14239 for (n_len = 0;n_len < gen_nb_int;n_len++) {
14240 mem_base = xmlMemBlocks();
14241 in = gen_xmlParserInputPtr(n_in, 0);
14242 len = gen_int(n_len, 1);
14243
14244 ret_val = xmlParserInputGrow(in, len);
14245 desret_int(ret_val);
14246 call_tests++;
14247 des_xmlParserInputPtr(n_in, in, 0);
14248 des_int(n_len, len, 1);
14249 xmlResetLastError();
14250 if (mem_base != xmlMemBlocks()) {
14251 printf("Leak of %d blocks found in xmlParserInputGrow",
14252 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014253 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014254 printf(" %d", n_in);
14255 printf(" %d", n_len);
14256 printf("\n");
14257 }
14258 }
14259 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000014260 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014261
Daniel Veillard42595322004-11-08 10:52:06 +000014262 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014263}
14264
14265
14266static int
14267test_xmlParserInputRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014268 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014269
Daniel Veillardce682bc2004-11-05 17:22:25 +000014270 int mem_base;
14271 int ret_val;
14272 xmlParserInputPtr in; /* an XML parser input */
14273 int n_in;
14274 int len; /* an indicative size for the lookahead */
14275 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014276
Daniel Veillardce682bc2004-11-05 17:22:25 +000014277 for (n_in = 0;n_in < gen_nb_xmlParserInputPtr;n_in++) {
14278 for (n_len = 0;n_len < gen_nb_int;n_len++) {
14279 mem_base = xmlMemBlocks();
14280 in = gen_xmlParserInputPtr(n_in, 0);
14281 len = gen_int(n_len, 1);
14282
14283 ret_val = xmlParserInputRead(in, len);
14284 desret_int(ret_val);
14285 call_tests++;
14286 des_xmlParserInputPtr(n_in, in, 0);
14287 des_int(n_len, len, 1);
14288 xmlResetLastError();
14289 if (mem_base != xmlMemBlocks()) {
14290 printf("Leak of %d blocks found in xmlParserInputRead",
14291 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014292 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014293 printf(" %d", n_in);
14294 printf(" %d", n_len);
14295 printf("\n");
14296 }
14297 }
14298 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000014299 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014300
Daniel Veillard42595322004-11-08 10:52:06 +000014301 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014302}
14303
14304
14305static int
14306test_xmlPedanticParserDefault(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014307 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014308
14309 int mem_base;
14310 int ret_val;
14311 int val; /* int 0 or 1 */
14312 int n_val;
14313
14314 for (n_val = 0;n_val < gen_nb_int;n_val++) {
14315 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014316 val = gen_int(n_val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014317
14318 ret_val = xmlPedanticParserDefault(val);
14319 desret_int(ret_val);
14320 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000014321 des_int(n_val, val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014322 xmlResetLastError();
14323 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014324 printf("Leak of %d blocks found in xmlPedanticParserDefault",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014325 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014326 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014327 printf(" %d", n_val);
14328 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014329 }
14330 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000014331 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014332
Daniel Veillard42595322004-11-08 10:52:06 +000014333 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014334}
14335
14336
14337static int
14338test_xmlReadDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014339 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014340
14341 int mem_base;
14342 xmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014343 xmlChar * cur; /* a pointer to a zero terminated string */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014344 int n_cur;
14345 const char * URL; /* the base URL to use for the document */
14346 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014347 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014348 int n_encoding;
14349 int options; /* a combination of xmlParserOption */
14350 int n_options;
14351
14352 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
14353 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
14354 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000014355 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000014356 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014357 cur = gen_const_xmlChar_ptr(n_cur, 0);
14358 URL = gen_filepath(n_URL, 1);
14359 encoding = gen_const_char_ptr(n_encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000014360 options = gen_parseroptions(n_options, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014361
William M. Brackf13f77f2004-11-12 16:03:48 +000014362 ret_val = xmlReadDoc((const xmlChar *)cur, URL, (const char *)encoding, options);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014363 desret_xmlDocPtr(ret_val);
14364 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000014365 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000014366 des_filepath(n_URL, URL, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000014367 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000014368 des_parseroptions(n_options, options, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014369 xmlResetLastError();
14370 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014371 printf("Leak of %d blocks found in xmlReadDoc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014372 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014373 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014374 printf(" %d", n_cur);
14375 printf(" %d", n_URL);
14376 printf(" %d", n_encoding);
14377 printf(" %d", n_options);
14378 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014379 }
14380 }
14381 }
14382 }
14383 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000014384 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014385
Daniel Veillard42595322004-11-08 10:52:06 +000014386 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014387}
14388
14389
14390static int
14391test_xmlReadFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014392 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014393
14394 int mem_base;
14395 xmlDocPtr ret_val;
14396 const char * filename; /* a file or URL */
14397 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014398 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014399 int n_encoding;
14400 int options; /* a combination of xmlParserOption */
14401 int n_options;
14402
14403 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
14404 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000014405 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000014406 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014407 filename = gen_filepath(n_filename, 0);
14408 encoding = gen_const_char_ptr(n_encoding, 1);
Daniel Veillard6128c012004-11-08 17:16:15 +000014409 options = gen_parseroptions(n_options, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014410
William M. Brackf13f77f2004-11-12 16:03:48 +000014411 ret_val = xmlReadFile(filename, (const char *)encoding, options);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014412 desret_xmlDocPtr(ret_val);
14413 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000014414 des_filepath(n_filename, filename, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000014415 des_const_char_ptr(n_encoding, (const char *)encoding, 1);
Daniel Veillard6128c012004-11-08 17:16:15 +000014416 des_parseroptions(n_options, options, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014417 xmlResetLastError();
14418 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014419 printf("Leak of %d blocks found in xmlReadFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014420 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014421 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014422 printf(" %d", n_filename);
14423 printf(" %d", n_encoding);
14424 printf(" %d", n_options);
14425 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014426 }
14427 }
14428 }
14429 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000014430 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014431
Daniel Veillard42595322004-11-08 10:52:06 +000014432 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014433}
14434
14435
14436static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000014437test_xmlReadMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014438 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014439
14440 int mem_base;
14441 xmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014442 char * buffer; /* a pointer to a char array */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014443 int n_buffer;
14444 int size; /* the size of the array */
14445 int n_size;
14446 const char * URL; /* the base URL to use for the document */
14447 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014448 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014449 int n_encoding;
14450 int options; /* a combination of xmlParserOption */
14451 int n_options;
14452
14453 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
14454 for (n_size = 0;n_size < gen_nb_int;n_size++) {
14455 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
14456 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000014457 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000014458 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014459 buffer = gen_const_char_ptr(n_buffer, 0);
14460 size = gen_int(n_size, 1);
14461 URL = gen_filepath(n_URL, 2);
14462 encoding = gen_const_char_ptr(n_encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000014463 options = gen_parseroptions(n_options, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014464
William M. Brackf13f77f2004-11-12 16:03:48 +000014465 ret_val = xmlReadMemory((const char *)buffer, size, URL, (const char *)encoding, options);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014466 desret_xmlDocPtr(ret_val);
14467 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000014468 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000014469 des_int(n_size, size, 1);
14470 des_filepath(n_URL, URL, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000014471 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000014472 des_parseroptions(n_options, options, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014473 xmlResetLastError();
14474 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014475 printf("Leak of %d blocks found in xmlReadMemory",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014476 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014477 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014478 printf(" %d", n_buffer);
14479 printf(" %d", n_size);
14480 printf(" %d", n_URL);
14481 printf(" %d", n_encoding);
14482 printf(" %d", n_options);
14483 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014484 }
14485 }
14486 }
14487 }
14488 }
14489 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000014490 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014491
Daniel Veillard42595322004-11-08 10:52:06 +000014492 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014493}
14494
14495
14496static int
14497test_xmlRecoverDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014498 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014499
William M. Brack21e4ef22005-01-02 09:53:13 +000014500#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014501#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014502 int mem_base;
14503 xmlDocPtr ret_val;
14504 xmlChar * cur; /* a pointer to an array of xmlChar */
14505 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014506
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014507 for (n_cur = 0;n_cur < gen_nb_xmlChar_ptr;n_cur++) {
14508 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014509 cur = gen_xmlChar_ptr(n_cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014510
14511 ret_val = xmlRecoverDoc(cur);
14512 desret_xmlDocPtr(ret_val);
14513 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000014514 des_xmlChar_ptr(n_cur, cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014515 xmlResetLastError();
14516 if (mem_base != xmlMemBlocks()) {
14517 printf("Leak of %d blocks found in xmlRecoverDoc",
14518 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014519 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014520 printf(" %d", n_cur);
14521 printf("\n");
14522 }
14523 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014524 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014525#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014526#endif
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014527
Daniel Veillard42595322004-11-08 10:52:06 +000014528 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014529}
14530
14531
14532static int
14533test_xmlRecoverFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014534 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014535
William M. Brack21e4ef22005-01-02 09:53:13 +000014536#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014537#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000014538 int mem_base;
14539 xmlDocPtr ret_val;
14540 const char * filename; /* the filename */
14541 int n_filename;
14542
14543 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
14544 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014545 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014546
14547 ret_val = xmlRecoverFile(filename);
14548 desret_xmlDocPtr(ret_val);
14549 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000014550 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014551 xmlResetLastError();
14552 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014553 printf("Leak of %d blocks found in xmlRecoverFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014554 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014555 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014556 printf(" %d", n_filename);
14557 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014558 }
14559 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014560 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014561#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014562#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000014563
Daniel Veillard42595322004-11-08 10:52:06 +000014564 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014565}
14566
14567
14568static int
14569test_xmlRecoverMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014570 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014571
William M. Brack21e4ef22005-01-02 09:53:13 +000014572#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014573#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000014574 int mem_base;
14575 xmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014576 char * buffer; /* an pointer to a char array */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014577 int n_buffer;
14578 int size; /* the size of the array */
14579 int n_size;
14580
14581 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
14582 for (n_size = 0;n_size < gen_nb_int;n_size++) {
14583 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014584 buffer = gen_const_char_ptr(n_buffer, 0);
14585 size = gen_int(n_size, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014586
William M. Brackf13f77f2004-11-12 16:03:48 +000014587 ret_val = xmlRecoverMemory((const char *)buffer, size);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014588 desret_xmlDocPtr(ret_val);
14589 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000014590 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000014591 des_int(n_size, size, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014592 xmlResetLastError();
14593 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014594 printf("Leak of %d blocks found in xmlRecoverMemory",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014595 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014596 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014597 printf(" %d", n_buffer);
14598 printf(" %d", n_size);
14599 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014600 }
14601 }
14602 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014603 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014604#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014605#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000014606
Daniel Veillard42595322004-11-08 10:52:06 +000014607 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014608}
14609
14610
14611static int
14612test_xmlSAXParseDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014613 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014614
William M. Brack21e4ef22005-01-02 09:53:13 +000014615#if defined(LIBXML_VALID_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014616#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014617 int mem_base;
14618 xmlDtdPtr ret_val;
14619 xmlSAXHandlerPtr sax; /* the SAX handler block */
14620 int n_sax;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014621 xmlChar * ExternalID; /* a NAME* containing the External ID of the DTD */
Daniel Veillard34099b42004-11-04 17:34:35 +000014622 int n_ExternalID;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014623 xmlChar * SystemID; /* a NAME* containing the URL to the DTD */
Daniel Veillard34099b42004-11-04 17:34:35 +000014624 int n_SystemID;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014625
Daniel Veillard34099b42004-11-04 17:34:35 +000014626 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14627 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
14628 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
14629 mem_base = xmlMemBlocks();
14630 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14631 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 1);
14632 SystemID = gen_const_xmlChar_ptr(n_SystemID, 2);
14633
William M. Brackf13f77f2004-11-12 16:03:48 +000014634 ret_val = xmlSAXParseDTD(sax, (const xmlChar *)ExternalID, (const xmlChar *)SystemID);
Daniel Veillard34099b42004-11-04 17:34:35 +000014635 desret_xmlDtdPtr(ret_val);
14636 call_tests++;
14637 des_xmlSAXHandlerPtr(n_sax, sax, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000014638 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 1);
14639 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 2);
Daniel Veillard34099b42004-11-04 17:34:35 +000014640 xmlResetLastError();
14641 if (mem_base != xmlMemBlocks()) {
14642 printf("Leak of %d blocks found in xmlSAXParseDTD",
14643 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014644 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014645 printf(" %d", n_sax);
14646 printf(" %d", n_ExternalID);
14647 printf(" %d", n_SystemID);
14648 printf("\n");
14649 }
14650 }
14651 }
14652 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014653 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014654#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014655#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014656
Daniel Veillard42595322004-11-08 10:52:06 +000014657 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014658}
14659
14660
14661static int
14662test_xmlSAXParseDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014663 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014664
William M. Brack21e4ef22005-01-02 09:53:13 +000014665#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014666#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014667 int mem_base;
14668 xmlDocPtr ret_val;
14669 xmlSAXHandlerPtr sax; /* the SAX handler block */
14670 int n_sax;
14671 xmlChar * cur; /* a pointer to an array of xmlChar */
14672 int n_cur;
14673 int recovery; /* work in recovery mode, i.e. tries to read no Well Formed documents */
14674 int n_recovery;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014675
Daniel Veillard34099b42004-11-04 17:34:35 +000014676 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14677 for (n_cur = 0;n_cur < gen_nb_xmlChar_ptr;n_cur++) {
14678 for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) {
14679 mem_base = xmlMemBlocks();
14680 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14681 cur = gen_xmlChar_ptr(n_cur, 1);
14682 recovery = gen_int(n_recovery, 2);
14683
14684 ret_val = xmlSAXParseDoc(sax, cur, recovery);
14685 desret_xmlDocPtr(ret_val);
14686 call_tests++;
14687 des_xmlSAXHandlerPtr(n_sax, sax, 0);
14688 des_xmlChar_ptr(n_cur, cur, 1);
14689 des_int(n_recovery, recovery, 2);
14690 xmlResetLastError();
14691 if (mem_base != xmlMemBlocks()) {
14692 printf("Leak of %d blocks found in xmlSAXParseDoc",
14693 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014694 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014695 printf(" %d", n_sax);
14696 printf(" %d", n_cur);
14697 printf(" %d", n_recovery);
14698 printf("\n");
14699 }
14700 }
14701 }
14702 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014703 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014704#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014705#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014706
Daniel Veillard42595322004-11-08 10:52:06 +000014707 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014708}
14709
14710
14711static int
14712test_xmlSAXParseEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014713 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014714
William M. Brack21e4ef22005-01-02 09:53:13 +000014715#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014716#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014717 int mem_base;
14718 xmlDocPtr ret_val;
14719 xmlSAXHandlerPtr sax; /* the SAX handler block */
14720 int n_sax;
14721 const char * filename; /* the filename */
14722 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014723
Daniel Veillard34099b42004-11-04 17:34:35 +000014724 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14725 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
14726 mem_base = xmlMemBlocks();
14727 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14728 filename = gen_filepath(n_filename, 1);
14729
14730 ret_val = xmlSAXParseEntity(sax, filename);
14731 desret_xmlDocPtr(ret_val);
14732 call_tests++;
14733 des_xmlSAXHandlerPtr(n_sax, sax, 0);
14734 des_filepath(n_filename, filename, 1);
14735 xmlResetLastError();
14736 if (mem_base != xmlMemBlocks()) {
14737 printf("Leak of %d blocks found in xmlSAXParseEntity",
14738 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014739 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014740 printf(" %d", n_sax);
14741 printf(" %d", n_filename);
14742 printf("\n");
14743 }
14744 }
14745 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014746 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014747#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014748#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014749
Daniel Veillard42595322004-11-08 10:52:06 +000014750 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014751}
14752
14753
14754static int
14755test_xmlSAXParseFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014756 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014757
William M. Brack21e4ef22005-01-02 09:53:13 +000014758#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014759#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014760 int mem_base;
14761 xmlDocPtr ret_val;
14762 xmlSAXHandlerPtr sax; /* the SAX handler block */
14763 int n_sax;
14764 const char * filename; /* the filename */
14765 int n_filename;
14766 int recovery; /* work in recovery mode, i.e. tries to read no Well Formed documents */
14767 int n_recovery;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014768
Daniel Veillard34099b42004-11-04 17:34:35 +000014769 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14770 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
14771 for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) {
14772 mem_base = xmlMemBlocks();
14773 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14774 filename = gen_filepath(n_filename, 1);
14775 recovery = gen_int(n_recovery, 2);
14776
14777 ret_val = xmlSAXParseFile(sax, filename, recovery);
14778 desret_xmlDocPtr(ret_val);
14779 call_tests++;
14780 des_xmlSAXHandlerPtr(n_sax, sax, 0);
14781 des_filepath(n_filename, filename, 1);
14782 des_int(n_recovery, recovery, 2);
14783 xmlResetLastError();
14784 if (mem_base != xmlMemBlocks()) {
14785 printf("Leak of %d blocks found in xmlSAXParseFile",
14786 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014787 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014788 printf(" %d", n_sax);
14789 printf(" %d", n_filename);
14790 printf(" %d", n_recovery);
14791 printf("\n");
14792 }
14793 }
14794 }
14795 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014796 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014797#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014798#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014799
Daniel Veillard42595322004-11-08 10:52:06 +000014800 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014801}
14802
14803
14804static int
14805test_xmlSAXParseFileWithData(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014806 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014807
William M. Brack21e4ef22005-01-02 09:53:13 +000014808#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014809#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014810 int mem_base;
14811 xmlDocPtr ret_val;
14812 xmlSAXHandlerPtr sax; /* the SAX handler block */
14813 int n_sax;
14814 const char * filename; /* the filename */
14815 int n_filename;
14816 int recovery; /* work in recovery mode, i.e. tries to read no Well Formed documents */
14817 int n_recovery;
14818 void * data; /* the userdata */
14819 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014820
Daniel Veillard34099b42004-11-04 17:34:35 +000014821 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14822 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
14823 for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) {
14824 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
14825 mem_base = xmlMemBlocks();
14826 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14827 filename = gen_filepath(n_filename, 1);
14828 recovery = gen_int(n_recovery, 2);
14829 data = gen_userdata(n_data, 3);
14830
14831 ret_val = xmlSAXParseFileWithData(sax, filename, recovery, data);
14832 desret_xmlDocPtr(ret_val);
14833 call_tests++;
14834 des_xmlSAXHandlerPtr(n_sax, sax, 0);
14835 des_filepath(n_filename, filename, 1);
14836 des_int(n_recovery, recovery, 2);
14837 des_userdata(n_data, data, 3);
14838 xmlResetLastError();
14839 if (mem_base != xmlMemBlocks()) {
14840 printf("Leak of %d blocks found in xmlSAXParseFileWithData",
14841 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014842 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014843 printf(" %d", n_sax);
14844 printf(" %d", n_filename);
14845 printf(" %d", n_recovery);
14846 printf(" %d", n_data);
14847 printf("\n");
14848 }
14849 }
14850 }
14851 }
14852 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014853 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014854#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014855#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014856
Daniel Veillard42595322004-11-08 10:52:06 +000014857 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014858}
14859
14860
14861static int
14862test_xmlSAXParseMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014863 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014864
William M. Brack21e4ef22005-01-02 09:53:13 +000014865#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014866#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014867 int mem_base;
14868 xmlDocPtr ret_val;
14869 xmlSAXHandlerPtr sax; /* the SAX handler block */
14870 int n_sax;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014871 char * buffer; /* an pointer to a char array */
Daniel Veillard34099b42004-11-04 17:34:35 +000014872 int n_buffer;
14873 int size; /* the size of the array */
14874 int n_size;
14875 int recovery; /* work in recovery mode, i.e. tries to read not Well Formed documents */
14876 int n_recovery;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014877
Daniel Veillard34099b42004-11-04 17:34:35 +000014878 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14879 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
14880 for (n_size = 0;n_size < gen_nb_int;n_size++) {
14881 for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) {
14882 mem_base = xmlMemBlocks();
14883 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14884 buffer = gen_const_char_ptr(n_buffer, 1);
14885 size = gen_int(n_size, 2);
14886 recovery = gen_int(n_recovery, 3);
14887
William M. Brackf13f77f2004-11-12 16:03:48 +000014888 ret_val = xmlSAXParseMemory(sax, (const char *)buffer, size, recovery);
Daniel Veillard34099b42004-11-04 17:34:35 +000014889 desret_xmlDocPtr(ret_val);
14890 call_tests++;
14891 des_xmlSAXHandlerPtr(n_sax, sax, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000014892 des_const_char_ptr(n_buffer, (const char *)buffer, 1);
Daniel Veillard34099b42004-11-04 17:34:35 +000014893 des_int(n_size, size, 2);
14894 des_int(n_recovery, recovery, 3);
14895 xmlResetLastError();
14896 if (mem_base != xmlMemBlocks()) {
14897 printf("Leak of %d blocks found in xmlSAXParseMemory",
14898 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014899 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014900 printf(" %d", n_sax);
14901 printf(" %d", n_buffer);
14902 printf(" %d", n_size);
14903 printf(" %d", n_recovery);
14904 printf("\n");
14905 }
14906 }
14907 }
14908 }
14909 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014910 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014911#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014912#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014913
Daniel Veillard42595322004-11-08 10:52:06 +000014914 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014915}
14916
14917
14918static int
14919test_xmlSAXParseMemoryWithData(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014920 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014921
William M. Brack21e4ef22005-01-02 09:53:13 +000014922#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014923#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014924 int mem_base;
14925 xmlDocPtr ret_val;
14926 xmlSAXHandlerPtr sax; /* the SAX handler block */
14927 int n_sax;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014928 char * buffer; /* an pointer to a char array */
Daniel Veillard34099b42004-11-04 17:34:35 +000014929 int n_buffer;
14930 int size; /* the size of the array */
14931 int n_size;
14932 int recovery; /* work in recovery mode, i.e. tries to read no Well Formed documents */
14933 int n_recovery;
14934 void * data; /* the userdata */
14935 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014936
Daniel Veillard34099b42004-11-04 17:34:35 +000014937 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14938 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
14939 for (n_size = 0;n_size < gen_nb_int;n_size++) {
14940 for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) {
14941 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
14942 mem_base = xmlMemBlocks();
14943 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14944 buffer = gen_const_char_ptr(n_buffer, 1);
14945 size = gen_int(n_size, 2);
14946 recovery = gen_int(n_recovery, 3);
14947 data = gen_userdata(n_data, 4);
14948
William M. Brackf13f77f2004-11-12 16:03:48 +000014949 ret_val = xmlSAXParseMemoryWithData(sax, (const char *)buffer, size, recovery, data);
Daniel Veillard34099b42004-11-04 17:34:35 +000014950 desret_xmlDocPtr(ret_val);
14951 call_tests++;
14952 des_xmlSAXHandlerPtr(n_sax, sax, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000014953 des_const_char_ptr(n_buffer, (const char *)buffer, 1);
Daniel Veillard34099b42004-11-04 17:34:35 +000014954 des_int(n_size, size, 2);
14955 des_int(n_recovery, recovery, 3);
14956 des_userdata(n_data, data, 4);
14957 xmlResetLastError();
14958 if (mem_base != xmlMemBlocks()) {
14959 printf("Leak of %d blocks found in xmlSAXParseMemoryWithData",
14960 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014961 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014962 printf(" %d", n_sax);
14963 printf(" %d", n_buffer);
14964 printf(" %d", n_size);
14965 printf(" %d", n_recovery);
14966 printf(" %d", n_data);
14967 printf("\n");
14968 }
14969 }
14970 }
14971 }
14972 }
14973 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014974 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014975#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014976#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014977
Daniel Veillard42595322004-11-08 10:52:06 +000014978 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014979}
14980
14981
14982static int
14983test_xmlSAXUserParseFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014984 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014985
William M. Brack21e4ef22005-01-02 09:53:13 +000014986#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014987#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014988 int mem_base;
14989 int ret_val;
14990 xmlSAXHandlerPtr sax; /* a SAX handler */
14991 int n_sax;
14992 void * user_data; /* The user data returned on SAX callbacks */
14993 int n_user_data;
14994 const char * filename; /* a file name */
14995 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014996
Daniel Veillard34099b42004-11-04 17:34:35 +000014997 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14998 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
14999 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
15000 mem_base = xmlMemBlocks();
15001 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
15002 user_data = gen_userdata(n_user_data, 1);
15003 filename = gen_filepath(n_filename, 2);
Daniel Veillarda521d282004-11-09 14:59:59 +000015004
15005#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardce244ad2004-11-05 10:03:46 +000015006 if (sax == (xmlSAXHandlerPtr)&xmlDefaultSAXHandler) user_data = NULL;
Daniel Veillarda521d282004-11-09 14:59:59 +000015007#endif
15008
Daniel Veillard34099b42004-11-04 17:34:35 +000015009
15010 ret_val = xmlSAXUserParseFile(sax, user_data, filename);
15011 desret_int(ret_val);
15012 call_tests++;
15013 des_xmlSAXHandlerPtr(n_sax, sax, 0);
15014 des_userdata(n_user_data, user_data, 1);
15015 des_filepath(n_filename, filename, 2);
15016 xmlResetLastError();
15017 if (mem_base != xmlMemBlocks()) {
15018 printf("Leak of %d blocks found in xmlSAXUserParseFile",
15019 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015020 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000015021 printf(" %d", n_sax);
15022 printf(" %d", n_user_data);
15023 printf(" %d", n_filename);
15024 printf("\n");
15025 }
15026 }
15027 }
15028 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015029 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000015030#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000015031#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000015032
Daniel Veillard42595322004-11-08 10:52:06 +000015033 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015034}
15035
15036
15037static int
15038test_xmlSAXUserParseMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015039 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015040
William M. Brack21e4ef22005-01-02 09:53:13 +000015041#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000015042#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000015043 int mem_base;
15044 int ret_val;
15045 xmlSAXHandlerPtr sax; /* a SAX handler */
15046 int n_sax;
15047 void * user_data; /* The user data returned on SAX callbacks */
15048 int n_user_data;
Daniel Veillardce682bc2004-11-05 17:22:25 +000015049 char * buffer; /* an in-memory XML document input */
Daniel Veillard34099b42004-11-04 17:34:35 +000015050 int n_buffer;
15051 int size; /* the length of the XML document in bytes */
15052 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015053
Daniel Veillard34099b42004-11-04 17:34:35 +000015054 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
15055 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
15056 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
15057 for (n_size = 0;n_size < gen_nb_int;n_size++) {
15058 mem_base = xmlMemBlocks();
15059 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
15060 user_data = gen_userdata(n_user_data, 1);
15061 buffer = gen_const_char_ptr(n_buffer, 2);
15062 size = gen_int(n_size, 3);
Daniel Veillarda521d282004-11-09 14:59:59 +000015063
15064#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardce244ad2004-11-05 10:03:46 +000015065 if (sax == (xmlSAXHandlerPtr)&xmlDefaultSAXHandler) user_data = NULL;
Daniel Veillarda521d282004-11-09 14:59:59 +000015066#endif
15067
Daniel Veillard34099b42004-11-04 17:34:35 +000015068
William M. Brackf13f77f2004-11-12 16:03:48 +000015069 ret_val = xmlSAXUserParseMemory(sax, user_data, (const char *)buffer, size);
Daniel Veillard34099b42004-11-04 17:34:35 +000015070 desret_int(ret_val);
15071 call_tests++;
15072 des_xmlSAXHandlerPtr(n_sax, sax, 0);
15073 des_userdata(n_user_data, user_data, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000015074 des_const_char_ptr(n_buffer, (const char *)buffer, 2);
Daniel Veillard34099b42004-11-04 17:34:35 +000015075 des_int(n_size, size, 3);
15076 xmlResetLastError();
15077 if (mem_base != xmlMemBlocks()) {
15078 printf("Leak of %d blocks found in xmlSAXUserParseMemory",
15079 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015080 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000015081 printf(" %d", n_sax);
15082 printf(" %d", n_user_data);
15083 printf(" %d", n_buffer);
15084 printf(" %d", n_size);
15085 printf("\n");
15086 }
15087 }
15088 }
15089 }
15090 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015091 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000015092#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000015093#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000015094
Daniel Veillard42595322004-11-08 10:52:06 +000015095 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015096}
15097
15098
15099static int
15100test_xmlSetExternalEntityLoader(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015101 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015102
15103
15104 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000015105 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015106}
15107
15108
15109static int
15110test_xmlSetFeature(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015111 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015112
William M. Brack21e4ef22005-01-02 09:53:13 +000015113#if defined(LIBXML_LEGACY_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000015114#ifdef LIBXML_LEGACY_ENABLED
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015115 int mem_base;
15116 int ret_val;
15117 xmlParserCtxtPtr ctxt; /* an XML/HTML parser context */
15118 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000015119 char * name; /* the feature name */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015120 int n_name;
15121 void * value; /* pointer to the location of the new value */
15122 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015123
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015124 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15125 for (n_name = 0;n_name < gen_nb_const_char_ptr;n_name++) {
15126 for (n_value = 0;n_value < gen_nb_void_ptr;n_value++) {
15127 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000015128 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15129 name = gen_const_char_ptr(n_name, 1);
15130 value = gen_void_ptr(n_value, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015131
William M. Brackf13f77f2004-11-12 16:03:48 +000015132 ret_val = xmlSetFeature(ctxt, (const char *)name, value);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015133 desret_int(ret_val);
15134 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000015135 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000015136 des_const_char_ptr(n_name, (const char *)name, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000015137 des_void_ptr(n_value, value, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015138 xmlResetLastError();
15139 if (mem_base != xmlMemBlocks()) {
15140 printf("Leak of %d blocks found in xmlSetFeature",
15141 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015142 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015143 printf(" %d", n_ctxt);
15144 printf(" %d", n_name);
15145 printf(" %d", n_value);
15146 printf("\n");
15147 }
15148 }
15149 }
15150 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015151 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000015152#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000015153#endif
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015154
Daniel Veillard42595322004-11-08 10:52:06 +000015155 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015156}
15157
15158
15159static int
15160test_xmlSetupParserForBuffer(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015161 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015162
William M. Brack21e4ef22005-01-02 09:53:13 +000015163#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000015164#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000015165 int mem_base;
15166 xmlParserCtxtPtr ctxt; /* an XML parser context */
15167 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000015168 xmlChar * buffer; /* a xmlChar * buffer */
Daniel Veillardd93f6252004-11-02 15:53:51 +000015169 int n_buffer;
15170 const char * filename; /* a file name */
15171 int n_filename;
15172
15173 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15174 for (n_buffer = 0;n_buffer < gen_nb_const_xmlChar_ptr;n_buffer++) {
15175 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
15176 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000015177 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15178 buffer = gen_const_xmlChar_ptr(n_buffer, 1);
15179 filename = gen_filepath(n_filename, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015180
William M. Brackf13f77f2004-11-12 16:03:48 +000015181 xmlSetupParserForBuffer(ctxt, (const xmlChar *)buffer, filename);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015182 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000015183 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000015184 des_const_xmlChar_ptr(n_buffer, (const xmlChar *)buffer, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000015185 des_filepath(n_filename, filename, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015186 xmlResetLastError();
15187 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000015188 printf("Leak of %d blocks found in xmlSetupParserForBuffer",
Daniel Veillardd93f6252004-11-02 15:53:51 +000015189 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015190 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000015191 printf(" %d", n_ctxt);
15192 printf(" %d", n_buffer);
15193 printf(" %d", n_filename);
15194 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000015195 }
15196 }
15197 }
15198 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015199 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000015200#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000015201#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000015202
Daniel Veillard42595322004-11-08 10:52:06 +000015203 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015204}
15205
15206
15207static int
15208test_xmlStopParser(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015209 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015210
William M. Brack21e4ef22005-01-02 09:53:13 +000015211#if defined(LIBXML_PUSH_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000015212#ifdef LIBXML_PUSH_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000015213 int mem_base;
15214 xmlParserCtxtPtr ctxt; /* an XML parser context */
15215 int n_ctxt;
15216
15217 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15218 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000015219 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015220
15221 xmlStopParser(ctxt);
15222 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000015223 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015224 xmlResetLastError();
15225 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000015226 printf("Leak of %d blocks found in xmlStopParser",
Daniel Veillardd93f6252004-11-02 15:53:51 +000015227 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015228 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000015229 printf(" %d", n_ctxt);
15230 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000015231 }
15232 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015233 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000015234#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000015235#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000015236
Daniel Veillard42595322004-11-08 10:52:06 +000015237 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015238}
15239
15240
15241static int
15242test_xmlSubstituteEntitiesDefault(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015243 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015244
15245 int mem_base;
15246 int ret_val;
15247 int val; /* int 0 or 1 */
15248 int n_val;
15249
15250 for (n_val = 0;n_val < gen_nb_int;n_val++) {
15251 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000015252 val = gen_int(n_val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015253
15254 ret_val = xmlSubstituteEntitiesDefault(val);
15255 desret_int(ret_val);
15256 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000015257 des_int(n_val, val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015258 xmlResetLastError();
15259 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000015260 printf("Leak of %d blocks found in xmlSubstituteEntitiesDefault",
Daniel Veillardd93f6252004-11-02 15:53:51 +000015261 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015262 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000015263 printf(" %d", n_val);
15264 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000015265 }
15266 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000015267 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015268
Daniel Veillard42595322004-11-08 10:52:06 +000015269 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015270}
15271
15272static int
15273test_parser(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015274 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015275
William M. Brack094dd862004-11-14 14:28:34 +000015276 if (quiet == 0) printf("Testing parser : 60 of 69 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000015277 test_ret += test_xmlByteConsumed();
15278 test_ret += test_xmlClearNodeInfoSeq();
15279 test_ret += test_xmlClearParserCtxt();
15280 test_ret += test_xmlCreateDocParserCtxt();
15281 test_ret += test_xmlCreatePushParserCtxt();
15282 test_ret += test_xmlCtxtReadDoc();
15283 test_ret += test_xmlCtxtReadFile();
15284 test_ret += test_xmlCtxtReadMemory();
15285 test_ret += test_xmlCtxtReset();
15286 test_ret += test_xmlCtxtResetPush();
15287 test_ret += test_xmlCtxtUseOptions();
15288 test_ret += test_xmlGetExternalEntityLoader();
15289 test_ret += test_xmlGetFeature();
15290 test_ret += test_xmlGetFeaturesList();
15291 test_ret += test_xmlIOParseDTD();
15292 test_ret += test_xmlInitNodeInfoSeq();
15293 test_ret += test_xmlInitParser();
15294 test_ret += test_xmlInitParserCtxt();
15295 test_ret += test_xmlKeepBlanksDefault();
15296 test_ret += test_xmlLineNumbersDefault();
15297 test_ret += test_xmlLoadExternalEntity();
15298 test_ret += test_xmlNewIOInputStream();
15299 test_ret += test_xmlNewParserCtxt();
15300 test_ret += test_xmlParseBalancedChunkMemory();
15301 test_ret += test_xmlParseBalancedChunkMemoryRecover();
15302 test_ret += test_xmlParseChunk();
15303 test_ret += test_xmlParseCtxtExternalEntity();
15304 test_ret += test_xmlParseDTD();
15305 test_ret += test_xmlParseDoc();
15306 test_ret += test_xmlParseDocument();
15307 test_ret += test_xmlParseEntity();
15308 test_ret += test_xmlParseExtParsedEnt();
15309 test_ret += test_xmlParseExternalEntity();
15310 test_ret += test_xmlParseFile();
15311 test_ret += test_xmlParseInNodeContext();
15312 test_ret += test_xmlParseMemory();
15313 test_ret += test_xmlParserAddNodeInfo();
15314 test_ret += test_xmlParserFindNodeInfo();
15315 test_ret += test_xmlParserFindNodeInfoIndex();
15316 test_ret += test_xmlParserInputGrow();
15317 test_ret += test_xmlParserInputRead();
15318 test_ret += test_xmlPedanticParserDefault();
15319 test_ret += test_xmlReadDoc();
15320 test_ret += test_xmlReadFile();
15321 test_ret += test_xmlReadMemory();
15322 test_ret += test_xmlRecoverDoc();
15323 test_ret += test_xmlRecoverFile();
15324 test_ret += test_xmlRecoverMemory();
15325 test_ret += test_xmlSAXParseDTD();
15326 test_ret += test_xmlSAXParseDoc();
15327 test_ret += test_xmlSAXParseEntity();
15328 test_ret += test_xmlSAXParseFile();
15329 test_ret += test_xmlSAXParseFileWithData();
15330 test_ret += test_xmlSAXParseMemory();
15331 test_ret += test_xmlSAXParseMemoryWithData();
15332 test_ret += test_xmlSAXUserParseFile();
15333 test_ret += test_xmlSAXUserParseMemory();
15334 test_ret += test_xmlSetExternalEntityLoader();
15335 test_ret += test_xmlSetFeature();
15336 test_ret += test_xmlSetupParserForBuffer();
15337 test_ret += test_xmlStopParser();
15338 test_ret += test_xmlSubstituteEntitiesDefault();
Daniel Veillardd93f6252004-11-02 15:53:51 +000015339
Daniel Veillard42595322004-11-08 10:52:06 +000015340 if (test_ret != 0)
15341 printf("Module parser: %d errors\n", test_ret);
15342 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015343}
15344
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015345static int
15346test_htmlCreateFileParserCtxt(void) {
15347 int test_ret = 0;
15348
William M. Brack21e4ef22005-01-02 09:53:13 +000015349#if defined(LIBXML_HTML_ENABLED)
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015350 int mem_base;
15351 htmlParserCtxtPtr ret_val;
15352 const char * filename; /* the filename */
15353 int n_filename;
15354 char * encoding; /* a free form C string describing the HTML document encoding, or NULL */
15355 int n_encoding;
15356
15357 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
15358 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
15359 mem_base = xmlMemBlocks();
15360 filename = gen_fileoutput(n_filename, 0);
15361 encoding = gen_const_char_ptr(n_encoding, 1);
15362
William M. Brackf13f77f2004-11-12 16:03:48 +000015363 ret_val = htmlCreateFileParserCtxt(filename, (const char *)encoding);
Daniel Veillarda521d282004-11-09 14:59:59 +000015364 desret_htmlParserCtxtPtr(ret_val);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015365 call_tests++;
15366 des_fileoutput(n_filename, filename, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000015367 des_const_char_ptr(n_encoding, (const char *)encoding, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015368 xmlResetLastError();
15369 if (mem_base != xmlMemBlocks()) {
15370 printf("Leak of %d blocks found in htmlCreateFileParserCtxt",
15371 xmlMemBlocks() - mem_base);
15372 test_ret++;
15373 printf(" %d", n_filename);
15374 printf(" %d", n_encoding);
15375 printf("\n");
15376 }
15377 }
15378 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015379 function_tests++;
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015380#endif
15381
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015382 return(test_ret);
15383}
15384
15385
15386static int
15387test_htmlInitAutoClose(void) {
15388 int test_ret = 0;
15389
William M. Brack21e4ef22005-01-02 09:53:13 +000015390#if defined(LIBXML_HTML_ENABLED)
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015391 int mem_base;
15392
15393 mem_base = xmlMemBlocks();
15394
15395 htmlInitAutoClose();
15396 call_tests++;
15397 xmlResetLastError();
15398 if (mem_base != xmlMemBlocks()) {
15399 printf("Leak of %d blocks found in htmlInitAutoClose",
15400 xmlMemBlocks() - mem_base);
15401 test_ret++;
15402 printf("\n");
15403 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015404 function_tests++;
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015405#endif
15406
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015407 return(test_ret);
15408}
15409
15410
15411static int
15412test_inputPop(void) {
15413 int test_ret = 0;
15414
15415 int mem_base;
15416 xmlParserInputPtr ret_val;
15417 xmlParserCtxtPtr ctxt; /* an XML parser context */
15418 int n_ctxt;
15419
15420 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15421 mem_base = xmlMemBlocks();
15422 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15423
15424 ret_val = inputPop(ctxt);
15425 desret_xmlParserInputPtr(ret_val);
15426 call_tests++;
15427 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15428 xmlResetLastError();
15429 if (mem_base != xmlMemBlocks()) {
15430 printf("Leak of %d blocks found in inputPop",
15431 xmlMemBlocks() - mem_base);
15432 test_ret++;
15433 printf(" %d", n_ctxt);
15434 printf("\n");
15435 }
15436 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015437 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015438
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015439 return(test_ret);
15440}
15441
15442
15443static int
15444test_inputPush(void) {
15445 int test_ret = 0;
15446
15447 int mem_base;
15448 int ret_val;
15449 xmlParserCtxtPtr ctxt; /* an XML parser context */
15450 int n_ctxt;
15451 xmlParserInputPtr value; /* the parser input */
15452 int n_value;
15453
15454 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15455 for (n_value = 0;n_value < gen_nb_xmlParserInputPtr;n_value++) {
15456 mem_base = xmlMemBlocks();
15457 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15458 value = gen_xmlParserInputPtr(n_value, 1);
15459
15460 ret_val = inputPush(ctxt, value);
15461 desret_int(ret_val);
15462 call_tests++;
15463 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15464 des_xmlParserInputPtr(n_value, value, 1);
15465 xmlResetLastError();
15466 if (mem_base != xmlMemBlocks()) {
15467 printf("Leak of %d blocks found in inputPush",
15468 xmlMemBlocks() - mem_base);
15469 test_ret++;
15470 printf(" %d", n_ctxt);
15471 printf(" %d", n_value);
15472 printf("\n");
15473 }
15474 }
15475 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015476 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015477
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015478 return(test_ret);
15479}
15480
15481
15482static int
15483test_namePop(void) {
15484 int test_ret = 0;
15485
15486 int mem_base;
15487 const xmlChar * ret_val;
15488 xmlParserCtxtPtr ctxt; /* an XML parser context */
15489 int n_ctxt;
15490
15491 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15492 mem_base = xmlMemBlocks();
15493 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15494
15495 ret_val = namePop(ctxt);
15496 desret_const_xmlChar_ptr(ret_val);
15497 call_tests++;
15498 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15499 xmlResetLastError();
15500 if (mem_base != xmlMemBlocks()) {
15501 printf("Leak of %d blocks found in namePop",
15502 xmlMemBlocks() - mem_base);
15503 test_ret++;
15504 printf(" %d", n_ctxt);
15505 printf("\n");
15506 }
15507 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015508 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015509
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015510 return(test_ret);
15511}
15512
15513
15514static int
15515test_namePush(void) {
15516 int test_ret = 0;
15517
15518 int mem_base;
15519 int ret_val;
15520 xmlParserCtxtPtr ctxt; /* an XML parser context */
15521 int n_ctxt;
15522 xmlChar * value; /* the element name */
15523 int n_value;
15524
15525 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15526 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
15527 mem_base = xmlMemBlocks();
15528 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15529 value = gen_const_xmlChar_ptr(n_value, 1);
15530
William M. Brackf13f77f2004-11-12 16:03:48 +000015531 ret_val = namePush(ctxt, (const xmlChar *)value);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015532 desret_int(ret_val);
15533 call_tests++;
15534 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000015535 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015536 xmlResetLastError();
15537 if (mem_base != xmlMemBlocks()) {
15538 printf("Leak of %d blocks found in namePush",
15539 xmlMemBlocks() - mem_base);
15540 test_ret++;
15541 printf(" %d", n_ctxt);
15542 printf(" %d", n_value);
15543 printf("\n");
15544 }
15545 }
15546 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015547 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015548
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015549 return(test_ret);
15550}
15551
15552
15553static int
15554test_nodePop(void) {
15555 int test_ret = 0;
15556
15557 int mem_base;
15558 xmlNodePtr ret_val;
15559 xmlParserCtxtPtr ctxt; /* an XML parser context */
15560 int n_ctxt;
15561
15562 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15563 mem_base = xmlMemBlocks();
15564 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15565
15566 ret_val = nodePop(ctxt);
15567 desret_xmlNodePtr(ret_val);
15568 call_tests++;
15569 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15570 xmlResetLastError();
15571 if (mem_base != xmlMemBlocks()) {
15572 printf("Leak of %d blocks found in nodePop",
15573 xmlMemBlocks() - mem_base);
15574 test_ret++;
15575 printf(" %d", n_ctxt);
15576 printf("\n");
15577 }
15578 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015579 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015580
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015581 return(test_ret);
15582}
15583
15584
15585static int
15586test_nodePush(void) {
15587 int test_ret = 0;
15588
15589 int mem_base;
15590 int ret_val;
15591 xmlParserCtxtPtr ctxt; /* an XML parser context */
15592 int n_ctxt;
15593 xmlNodePtr value; /* the element node */
15594 int n_value;
15595
15596 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15597 for (n_value = 0;n_value < gen_nb_xmlNodePtr;n_value++) {
15598 mem_base = xmlMemBlocks();
15599 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15600 value = gen_xmlNodePtr(n_value, 1);
15601
15602 ret_val = nodePush(ctxt, value);
15603 desret_int(ret_val);
15604 call_tests++;
15605 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15606 des_xmlNodePtr(n_value, value, 1);
15607 xmlResetLastError();
15608 if (mem_base != xmlMemBlocks()) {
15609 printf("Leak of %d blocks found in nodePush",
15610 xmlMemBlocks() - mem_base);
15611 test_ret++;
15612 printf(" %d", n_ctxt);
15613 printf(" %d", n_value);
15614 printf("\n");
15615 }
15616 }
15617 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015618 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015619
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015620 return(test_ret);
15621}
15622
15623
15624static int
15625test_xmlCheckLanguageID(void) {
15626 int test_ret = 0;
15627
15628 int mem_base;
15629 int ret_val;
15630 xmlChar * lang; /* pointer to the string value */
15631 int n_lang;
15632
15633 for (n_lang = 0;n_lang < gen_nb_const_xmlChar_ptr;n_lang++) {
15634 mem_base = xmlMemBlocks();
15635 lang = gen_const_xmlChar_ptr(n_lang, 0);
15636
William M. Brackf13f77f2004-11-12 16:03:48 +000015637 ret_val = xmlCheckLanguageID((const xmlChar *)lang);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015638 desret_int(ret_val);
15639 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000015640 des_const_xmlChar_ptr(n_lang, (const xmlChar *)lang, 0);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015641 xmlResetLastError();
15642 if (mem_base != xmlMemBlocks()) {
15643 printf("Leak of %d blocks found in xmlCheckLanguageID",
15644 xmlMemBlocks() - mem_base);
15645 test_ret++;
15646 printf(" %d", n_lang);
15647 printf("\n");
15648 }
15649 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015650 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015651
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015652 return(test_ret);
15653}
15654
15655
15656static int
15657test_xmlCopyChar(void) {
15658 int test_ret = 0;
15659
15660 int mem_base;
15661 int ret_val;
15662 int len; /* Ignored, compatibility */
15663 int n_len;
15664 xmlChar * out; /* pointer to an array of xmlChar */
15665 int n_out;
15666 int val; /* the char value */
15667 int n_val;
15668
15669 for (n_len = 0;n_len < gen_nb_int;n_len++) {
15670 for (n_out = 0;n_out < gen_nb_xmlChar_ptr;n_out++) {
15671 for (n_val = 0;n_val < gen_nb_int;n_val++) {
15672 mem_base = xmlMemBlocks();
15673 len = gen_int(n_len, 0);
15674 out = gen_xmlChar_ptr(n_out, 1);
15675 val = gen_int(n_val, 2);
15676
15677 ret_val = xmlCopyChar(len, out, val);
15678 desret_int(ret_val);
15679 call_tests++;
15680 des_int(n_len, len, 0);
15681 des_xmlChar_ptr(n_out, out, 1);
15682 des_int(n_val, val, 2);
15683 xmlResetLastError();
15684 if (mem_base != xmlMemBlocks()) {
15685 printf("Leak of %d blocks found in xmlCopyChar",
15686 xmlMemBlocks() - mem_base);
15687 test_ret++;
15688 printf(" %d", n_len);
15689 printf(" %d", n_out);
15690 printf(" %d", n_val);
15691 printf("\n");
15692 }
15693 }
15694 }
15695 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015696 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015697
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015698 return(test_ret);
15699}
15700
15701
15702static int
15703test_xmlCopyCharMultiByte(void) {
15704 int test_ret = 0;
15705
15706 int mem_base;
15707 int ret_val;
15708 xmlChar * out; /* pointer to an array of xmlChar */
15709 int n_out;
15710 int val; /* the char value */
15711 int n_val;
15712
15713 for (n_out = 0;n_out < gen_nb_xmlChar_ptr;n_out++) {
15714 for (n_val = 0;n_val < gen_nb_int;n_val++) {
15715 mem_base = xmlMemBlocks();
15716 out = gen_xmlChar_ptr(n_out, 0);
15717 val = gen_int(n_val, 1);
15718
15719 ret_val = xmlCopyCharMultiByte(out, val);
15720 desret_int(ret_val);
15721 call_tests++;
15722 des_xmlChar_ptr(n_out, out, 0);
15723 des_int(n_val, val, 1);
15724 xmlResetLastError();
15725 if (mem_base != xmlMemBlocks()) {
15726 printf("Leak of %d blocks found in xmlCopyCharMultiByte",
15727 xmlMemBlocks() - mem_base);
15728 test_ret++;
15729 printf(" %d", n_out);
15730 printf(" %d", n_val);
15731 printf("\n");
15732 }
15733 }
15734 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015735 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015736
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015737 return(test_ret);
15738}
15739
15740
15741static int
15742test_xmlCreateEntityParserCtxt(void) {
15743 int test_ret = 0;
15744
15745 int mem_base;
15746 xmlParserCtxtPtr ret_val;
15747 xmlChar * URL; /* the entity URL */
15748 int n_URL;
15749 xmlChar * ID; /* the entity PUBLIC ID */
15750 int n_ID;
15751 xmlChar * base; /* a possible base for the target URI */
15752 int n_base;
15753
15754 for (n_URL = 0;n_URL < gen_nb_const_xmlChar_ptr;n_URL++) {
15755 for (n_ID = 0;n_ID < gen_nb_const_xmlChar_ptr;n_ID++) {
15756 for (n_base = 0;n_base < gen_nb_const_xmlChar_ptr;n_base++) {
15757 mem_base = xmlMemBlocks();
15758 URL = gen_const_xmlChar_ptr(n_URL, 0);
15759 ID = gen_const_xmlChar_ptr(n_ID, 1);
15760 base = gen_const_xmlChar_ptr(n_base, 2);
15761
William M. Brackf13f77f2004-11-12 16:03:48 +000015762 ret_val = xmlCreateEntityParserCtxt((const xmlChar *)URL, (const xmlChar *)ID, (const xmlChar *)base);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015763 desret_xmlParserCtxtPtr(ret_val);
15764 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000015765 des_const_xmlChar_ptr(n_URL, (const xmlChar *)URL, 0);
15766 des_const_xmlChar_ptr(n_ID, (const xmlChar *)ID, 1);
15767 des_const_xmlChar_ptr(n_base, (const xmlChar *)base, 2);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015768 xmlResetLastError();
15769 if (mem_base != xmlMemBlocks()) {
15770 printf("Leak of %d blocks found in xmlCreateEntityParserCtxt",
15771 xmlMemBlocks() - mem_base);
15772 test_ret++;
15773 printf(" %d", n_URL);
15774 printf(" %d", n_ID);
15775 printf(" %d", n_base);
15776 printf("\n");
15777 }
15778 }
15779 }
15780 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015781 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015782
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015783 return(test_ret);
15784}
15785
15786
15787static int
15788test_xmlCreateFileParserCtxt(void) {
15789 int test_ret = 0;
15790
15791 int mem_base;
15792 xmlParserCtxtPtr ret_val;
15793 const char * filename; /* the filename */
15794 int n_filename;
15795
15796 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
15797 mem_base = xmlMemBlocks();
15798 filename = gen_fileoutput(n_filename, 0);
15799
15800 ret_val = xmlCreateFileParserCtxt(filename);
15801 desret_xmlParserCtxtPtr(ret_val);
15802 call_tests++;
15803 des_fileoutput(n_filename, filename, 0);
15804 xmlResetLastError();
15805 if (mem_base != xmlMemBlocks()) {
15806 printf("Leak of %d blocks found in xmlCreateFileParserCtxt",
15807 xmlMemBlocks() - mem_base);
15808 test_ret++;
15809 printf(" %d", n_filename);
15810 printf("\n");
15811 }
15812 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015813 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015814
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015815 return(test_ret);
15816}
15817
15818
15819static int
15820test_xmlCreateMemoryParserCtxt(void) {
15821 int test_ret = 0;
15822
15823 int mem_base;
15824 xmlParserCtxtPtr ret_val;
15825 char * buffer; /* a pointer to a char array */
15826 int n_buffer;
15827 int size; /* the size of the array */
15828 int n_size;
15829
15830 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
15831 for (n_size = 0;n_size < gen_nb_int;n_size++) {
15832 mem_base = xmlMemBlocks();
15833 buffer = gen_const_char_ptr(n_buffer, 0);
15834 size = gen_int(n_size, 1);
15835
William M. Brackf13f77f2004-11-12 16:03:48 +000015836 ret_val = xmlCreateMemoryParserCtxt((const char *)buffer, size);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015837 desret_xmlParserCtxtPtr(ret_val);
15838 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000015839 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015840 des_int(n_size, size, 1);
15841 xmlResetLastError();
15842 if (mem_base != xmlMemBlocks()) {
15843 printf("Leak of %d blocks found in xmlCreateMemoryParserCtxt",
15844 xmlMemBlocks() - mem_base);
15845 test_ret++;
15846 printf(" %d", n_buffer);
15847 printf(" %d", n_size);
15848 printf("\n");
15849 }
15850 }
15851 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015852 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015853
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015854 return(test_ret);
15855}
15856
15857
15858static int
15859test_xmlCreateURLParserCtxt(void) {
15860 int test_ret = 0;
15861
15862 int mem_base;
15863 xmlParserCtxtPtr ret_val;
15864 const char * filename; /* the filename or URL */
15865 int n_filename;
15866 int options; /* a combination of xmlParserOption */
15867 int n_options;
15868
15869 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
15870 for (n_options = 0;n_options < gen_nb_int;n_options++) {
15871 mem_base = xmlMemBlocks();
15872 filename = gen_fileoutput(n_filename, 0);
15873 options = gen_int(n_options, 1);
15874
15875 ret_val = xmlCreateURLParserCtxt(filename, options);
15876 desret_xmlParserCtxtPtr(ret_val);
15877 call_tests++;
15878 des_fileoutput(n_filename, filename, 0);
15879 des_int(n_options, options, 1);
15880 xmlResetLastError();
15881 if (mem_base != xmlMemBlocks()) {
15882 printf("Leak of %d blocks found in xmlCreateURLParserCtxt",
15883 xmlMemBlocks() - mem_base);
15884 test_ret++;
15885 printf(" %d", n_filename);
15886 printf(" %d", n_options);
15887 printf("\n");
15888 }
15889 }
15890 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015891 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015892
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015893 return(test_ret);
15894}
15895
15896
15897static int
15898test_xmlCurrentChar(void) {
15899 int test_ret = 0;
15900
15901 int mem_base;
15902 int ret_val;
15903 xmlParserCtxtPtr ctxt; /* the XML parser context */
15904 int n_ctxt;
15905 int * len; /* pointer to the length of the char read */
15906 int n_len;
15907
15908 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15909 for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
15910 mem_base = xmlMemBlocks();
15911 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15912 len = gen_int_ptr(n_len, 1);
15913
15914 ret_val = xmlCurrentChar(ctxt, len);
15915 desret_int(ret_val);
15916 call_tests++;
15917 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15918 des_int_ptr(n_len, len, 1);
15919 xmlResetLastError();
15920 if (mem_base != xmlMemBlocks()) {
15921 printf("Leak of %d blocks found in xmlCurrentChar",
15922 xmlMemBlocks() - mem_base);
15923 test_ret++;
15924 printf(" %d", n_ctxt);
15925 printf(" %d", n_len);
15926 printf("\n");
15927 }
15928 }
15929 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015930 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015931
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015932 return(test_ret);
15933}
15934
15935
15936static int
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015937test_xmlErrMemory(void) {
15938 int test_ret = 0;
15939
15940 int mem_base;
15941 xmlParserCtxtPtr ctxt; /* an XML parser context */
15942 int n_ctxt;
15943 char * extra; /* extra informations */
15944 int n_extra;
15945
15946 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15947 for (n_extra = 0;n_extra < gen_nb_const_char_ptr;n_extra++) {
15948 mem_base = xmlMemBlocks();
15949 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15950 extra = gen_const_char_ptr(n_extra, 1);
15951
William M. Brackf13f77f2004-11-12 16:03:48 +000015952 xmlErrMemory(ctxt, (const char *)extra);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015953 call_tests++;
15954 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000015955 des_const_char_ptr(n_extra, (const char *)extra, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015956 xmlResetLastError();
15957 if (mem_base != xmlMemBlocks()) {
15958 printf("Leak of %d blocks found in xmlErrMemory",
15959 xmlMemBlocks() - mem_base);
15960 test_ret++;
15961 printf(" %d", n_ctxt);
15962 printf(" %d", n_extra);
15963 printf("\n");
15964 }
15965 }
15966 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015967 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015968
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015969 return(test_ret);
15970}
15971
15972
15973static int
15974test_xmlIsLetter(void) {
15975 int test_ret = 0;
15976
15977 int mem_base;
15978 int ret_val;
15979 int c; /* an unicode character (int) */
15980 int n_c;
15981
15982 for (n_c = 0;n_c < gen_nb_int;n_c++) {
15983 mem_base = xmlMemBlocks();
15984 c = gen_int(n_c, 0);
15985
15986 ret_val = xmlIsLetter(c);
15987 desret_int(ret_val);
15988 call_tests++;
15989 des_int(n_c, c, 0);
15990 xmlResetLastError();
15991 if (mem_base != xmlMemBlocks()) {
15992 printf("Leak of %d blocks found in xmlIsLetter",
15993 xmlMemBlocks() - mem_base);
15994 test_ret++;
15995 printf(" %d", n_c);
15996 printf("\n");
15997 }
15998 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015999 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016000
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016001 return(test_ret);
16002}
16003
16004
16005static int
16006test_xmlNewEntityInputStream(void) {
16007 int test_ret = 0;
16008
16009 int mem_base;
16010 xmlParserInputPtr ret_val;
16011 xmlParserCtxtPtr ctxt; /* an XML parser context */
16012 int n_ctxt;
16013 xmlEntityPtr entity; /* an Entity pointer */
16014 int n_entity;
16015
16016 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16017 for (n_entity = 0;n_entity < gen_nb_xmlEntityPtr;n_entity++) {
16018 mem_base = xmlMemBlocks();
16019 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16020 entity = gen_xmlEntityPtr(n_entity, 1);
16021
16022 ret_val = xmlNewEntityInputStream(ctxt, entity);
16023 desret_xmlParserInputPtr(ret_val);
16024 call_tests++;
16025 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16026 des_xmlEntityPtr(n_entity, entity, 1);
16027 xmlResetLastError();
16028 if (mem_base != xmlMemBlocks()) {
16029 printf("Leak of %d blocks found in xmlNewEntityInputStream",
16030 xmlMemBlocks() - mem_base);
16031 test_ret++;
16032 printf(" %d", n_ctxt);
16033 printf(" %d", n_entity);
16034 printf("\n");
16035 }
16036 }
16037 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016038 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016039
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016040 return(test_ret);
16041}
16042
16043
16044static int
16045test_xmlNewInputFromFile(void) {
16046 int test_ret = 0;
16047
16048 int mem_base;
16049 xmlParserInputPtr ret_val;
16050 xmlParserCtxtPtr ctxt; /* an XML parser context */
16051 int n_ctxt;
16052 const char * filename; /* the filename to use as entity */
16053 int n_filename;
16054
16055 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16056 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
16057 mem_base = xmlMemBlocks();
16058 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16059 filename = gen_filepath(n_filename, 1);
16060
16061 ret_val = xmlNewInputFromFile(ctxt, filename);
16062 desret_xmlParserInputPtr(ret_val);
16063 call_tests++;
16064 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16065 des_filepath(n_filename, filename, 1);
16066 xmlResetLastError();
16067 if (mem_base != xmlMemBlocks()) {
16068 printf("Leak of %d blocks found in xmlNewInputFromFile",
16069 xmlMemBlocks() - mem_base);
16070 test_ret++;
16071 printf(" %d", n_ctxt);
16072 printf(" %d", n_filename);
16073 printf("\n");
16074 }
16075 }
16076 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016077 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016078
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016079 return(test_ret);
16080}
16081
16082
16083static int
16084test_xmlNewInputStream(void) {
16085 int test_ret = 0;
16086
16087 int mem_base;
16088 xmlParserInputPtr ret_val;
16089 xmlParserCtxtPtr ctxt; /* an XML parser context */
16090 int n_ctxt;
16091
16092 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16093 mem_base = xmlMemBlocks();
16094 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16095
16096 ret_val = xmlNewInputStream(ctxt);
16097 desret_xmlParserInputPtr(ret_val);
16098 call_tests++;
16099 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16100 xmlResetLastError();
16101 if (mem_base != xmlMemBlocks()) {
16102 printf("Leak of %d blocks found in xmlNewInputStream",
16103 xmlMemBlocks() - mem_base);
16104 test_ret++;
16105 printf(" %d", n_ctxt);
16106 printf("\n");
16107 }
16108 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016109 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016110
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016111 return(test_ret);
16112}
16113
16114
16115static int
16116test_xmlNewStringInputStream(void) {
16117 int test_ret = 0;
16118
16119 int mem_base;
16120 xmlParserInputPtr ret_val;
16121 xmlParserCtxtPtr ctxt; /* an XML parser context */
16122 int n_ctxt;
16123 xmlChar * buffer; /* an memory buffer */
16124 int n_buffer;
16125
16126 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16127 for (n_buffer = 0;n_buffer < gen_nb_const_xmlChar_ptr;n_buffer++) {
16128 mem_base = xmlMemBlocks();
16129 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16130 buffer = gen_const_xmlChar_ptr(n_buffer, 1);
16131
William M. Brackf13f77f2004-11-12 16:03:48 +000016132 ret_val = xmlNewStringInputStream(ctxt, (const xmlChar *)buffer);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016133 desret_xmlParserInputPtr(ret_val);
16134 call_tests++;
16135 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000016136 des_const_xmlChar_ptr(n_buffer, (const xmlChar *)buffer, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016137 xmlResetLastError();
16138 if (mem_base != xmlMemBlocks()) {
16139 printf("Leak of %d blocks found in xmlNewStringInputStream",
16140 xmlMemBlocks() - mem_base);
16141 test_ret++;
16142 printf(" %d", n_ctxt);
16143 printf(" %d", n_buffer);
16144 printf("\n");
16145 }
16146 }
16147 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016148 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016149
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016150 return(test_ret);
16151}
16152
16153
16154static int
16155test_xmlNextChar(void) {
16156 int test_ret = 0;
16157
16158 int mem_base;
16159 xmlParserCtxtPtr ctxt; /* the XML parser context */
16160 int n_ctxt;
16161
16162 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16163 mem_base = xmlMemBlocks();
16164 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16165
16166 xmlNextChar(ctxt);
16167 call_tests++;
16168 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16169 xmlResetLastError();
16170 if (mem_base != xmlMemBlocks()) {
16171 printf("Leak of %d blocks found in xmlNextChar",
16172 xmlMemBlocks() - mem_base);
16173 test_ret++;
16174 printf(" %d", n_ctxt);
16175 printf("\n");
16176 }
16177 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016178 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016179
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016180 return(test_ret);
16181}
16182
16183
16184static int
16185test_xmlParserInputShrink(void) {
16186 int test_ret = 0;
16187
16188 int mem_base;
16189 xmlParserInputPtr in; /* an XML parser input */
16190 int n_in;
16191
16192 for (n_in = 0;n_in < gen_nb_xmlParserInputPtr;n_in++) {
16193 mem_base = xmlMemBlocks();
16194 in = gen_xmlParserInputPtr(n_in, 0);
16195
16196 xmlParserInputShrink(in);
16197 call_tests++;
16198 des_xmlParserInputPtr(n_in, in, 0);
16199 xmlResetLastError();
16200 if (mem_base != xmlMemBlocks()) {
16201 printf("Leak of %d blocks found in xmlParserInputShrink",
16202 xmlMemBlocks() - mem_base);
16203 test_ret++;
16204 printf(" %d", n_in);
16205 printf("\n");
16206 }
16207 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016208 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016209
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016210 return(test_ret);
16211}
16212
16213
16214static int
16215test_xmlPopInput(void) {
16216 int test_ret = 0;
16217
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016218 int mem_base;
16219 xmlChar ret_val;
16220 xmlParserCtxtPtr ctxt; /* an XML parser context */
16221 int n_ctxt;
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016222
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016223 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16224 mem_base = xmlMemBlocks();
16225 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16226
16227 ret_val = xmlPopInput(ctxt);
16228 desret_xmlChar(ret_val);
16229 call_tests++;
16230 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16231 xmlResetLastError();
16232 if (mem_base != xmlMemBlocks()) {
16233 printf("Leak of %d blocks found in xmlPopInput",
16234 xmlMemBlocks() - mem_base);
16235 test_ret++;
16236 printf(" %d", n_ctxt);
16237 printf("\n");
16238 }
16239 }
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016240 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016241
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016242 return(test_ret);
16243}
16244
16245
16246static int
16247test_xmlPushInput(void) {
16248 int test_ret = 0;
16249
16250 int mem_base;
16251 xmlParserCtxtPtr ctxt; /* an XML parser context */
16252 int n_ctxt;
16253 xmlParserInputPtr input; /* an XML parser input fragment (entity, XML fragment ...). */
16254 int n_input;
16255
16256 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16257 for (n_input = 0;n_input < gen_nb_xmlParserInputPtr;n_input++) {
16258 mem_base = xmlMemBlocks();
16259 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16260 input = gen_xmlParserInputPtr(n_input, 1);
16261
16262 xmlPushInput(ctxt, input);
16263 call_tests++;
16264 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16265 des_xmlParserInputPtr(n_input, input, 1);
16266 xmlResetLastError();
16267 if (mem_base != xmlMemBlocks()) {
16268 printf("Leak of %d blocks found in xmlPushInput",
16269 xmlMemBlocks() - mem_base);
16270 test_ret++;
16271 printf(" %d", n_ctxt);
16272 printf(" %d", n_input);
16273 printf("\n");
16274 }
16275 }
16276 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016277 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016278
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016279 return(test_ret);
16280}
16281
16282
16283static int
16284test_xmlSetEntityReferenceFunc(void) {
16285 int test_ret = 0;
16286
16287
16288 /* missing type support */
16289 return(test_ret);
16290}
16291
16292
16293static int
16294test_xmlSplitQName(void) {
16295 int test_ret = 0;
16296
16297 int mem_base;
16298 xmlChar * ret_val;
16299 xmlParserCtxtPtr ctxt; /* an XML parser context */
16300 int n_ctxt;
16301 xmlChar * name; /* an XML parser context */
16302 int n_name;
16303 xmlChar ** prefix; /* a xmlChar ** */
16304 int n_prefix;
16305
16306 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16307 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
16308 for (n_prefix = 0;n_prefix < gen_nb_xmlChar_ptr_ptr;n_prefix++) {
16309 mem_base = xmlMemBlocks();
16310 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16311 name = gen_const_xmlChar_ptr(n_name, 1);
16312 prefix = gen_xmlChar_ptr_ptr(n_prefix, 2);
16313
William M. Brackf13f77f2004-11-12 16:03:48 +000016314 ret_val = xmlSplitQName(ctxt, (const xmlChar *)name, prefix);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016315 desret_xmlChar_ptr(ret_val);
16316 call_tests++;
16317 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000016318 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016319 des_xmlChar_ptr_ptr(n_prefix, prefix, 2);
16320 xmlResetLastError();
16321 if (mem_base != xmlMemBlocks()) {
16322 printf("Leak of %d blocks found in xmlSplitQName",
16323 xmlMemBlocks() - mem_base);
16324 test_ret++;
16325 printf(" %d", n_ctxt);
16326 printf(" %d", n_name);
16327 printf(" %d", n_prefix);
16328 printf("\n");
16329 }
16330 }
16331 }
16332 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016333 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016334
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016335 return(test_ret);
16336}
16337
16338
16339static int
16340test_xmlStringCurrentChar(void) {
16341 int test_ret = 0;
16342
16343 int mem_base;
16344 int ret_val;
16345 xmlParserCtxtPtr ctxt; /* the XML parser context */
16346 int n_ctxt;
16347 xmlChar * cur; /* pointer to the beginning of the char */
16348 int n_cur;
16349 int * len; /* pointer to the length of the char read */
16350 int n_len;
16351
16352 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16353 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
16354 for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
16355 mem_base = xmlMemBlocks();
16356 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16357 cur = gen_const_xmlChar_ptr(n_cur, 1);
16358 len = gen_int_ptr(n_len, 2);
16359
William M. Brackf13f77f2004-11-12 16:03:48 +000016360 ret_val = xmlStringCurrentChar(ctxt, (const xmlChar *)cur, len);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016361 desret_int(ret_val);
16362 call_tests++;
16363 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000016364 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016365 des_int_ptr(n_len, len, 2);
16366 xmlResetLastError();
16367 if (mem_base != xmlMemBlocks()) {
16368 printf("Leak of %d blocks found in xmlStringCurrentChar",
16369 xmlMemBlocks() - mem_base);
16370 test_ret++;
16371 printf(" %d", n_ctxt);
16372 printf(" %d", n_cur);
16373 printf(" %d", n_len);
16374 printf("\n");
16375 }
16376 }
16377 }
16378 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016379 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016380
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016381 return(test_ret);
16382}
16383
16384
16385static int
16386test_xmlStringDecodeEntities(void) {
16387 int test_ret = 0;
16388
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016389 int mem_base;
16390 xmlChar * ret_val;
16391 xmlParserCtxtPtr ctxt; /* the parser context */
16392 int n_ctxt;
16393 xmlChar * str; /* the input string */
16394 int n_str;
16395 int what; /* combination of XML_SUBSTITUTE_REF and XML_SUBSTITUTE_PEREF */
16396 int n_what;
16397 xmlChar end; /* an end marker xmlChar, 0 if none */
16398 int n_end;
16399 xmlChar end2; /* an end marker xmlChar, 0 if none */
16400 int n_end2;
16401 xmlChar end3; /* an end marker xmlChar, 0 if none */
16402 int n_end3;
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016403
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016404 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16405 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
16406 for (n_what = 0;n_what < gen_nb_int;n_what++) {
16407 for (n_end = 0;n_end < gen_nb_xmlChar;n_end++) {
16408 for (n_end2 = 0;n_end2 < gen_nb_xmlChar;n_end2++) {
16409 for (n_end3 = 0;n_end3 < gen_nb_xmlChar;n_end3++) {
16410 mem_base = xmlMemBlocks();
16411 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16412 str = gen_const_xmlChar_ptr(n_str, 1);
16413 what = gen_int(n_what, 2);
16414 end = gen_xmlChar(n_end, 3);
16415 end2 = gen_xmlChar(n_end2, 4);
16416 end3 = gen_xmlChar(n_end3, 5);
16417
William M. Brackf13f77f2004-11-12 16:03:48 +000016418 ret_val = xmlStringDecodeEntities(ctxt, (const xmlChar *)str, what, end, end2, end3);
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016419 desret_xmlChar_ptr(ret_val);
16420 call_tests++;
16421 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000016422 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016423 des_int(n_what, what, 2);
16424 des_xmlChar(n_end, end, 3);
16425 des_xmlChar(n_end2, end2, 4);
16426 des_xmlChar(n_end3, end3, 5);
16427 xmlResetLastError();
16428 if (mem_base != xmlMemBlocks()) {
16429 printf("Leak of %d blocks found in xmlStringDecodeEntities",
16430 xmlMemBlocks() - mem_base);
16431 test_ret++;
16432 printf(" %d", n_ctxt);
16433 printf(" %d", n_str);
16434 printf(" %d", n_what);
16435 printf(" %d", n_end);
16436 printf(" %d", n_end2);
16437 printf(" %d", n_end3);
16438 printf("\n");
16439 }
16440 }
16441 }
16442 }
16443 }
16444 }
16445 }
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016446 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016447
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016448 return(test_ret);
16449}
16450
16451
16452static int
16453test_xmlStringLenDecodeEntities(void) {
16454 int test_ret = 0;
16455
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016456 int mem_base;
16457 xmlChar * ret_val;
16458 xmlParserCtxtPtr ctxt; /* the parser context */
16459 int n_ctxt;
16460 xmlChar * str; /* the input string */
16461 int n_str;
16462 int len; /* the string length */
16463 int n_len;
16464 int what; /* combination of XML_SUBSTITUTE_REF and XML_SUBSTITUTE_PEREF */
16465 int n_what;
16466 xmlChar end; /* an end marker xmlChar, 0 if none */
16467 int n_end;
16468 xmlChar end2; /* an end marker xmlChar, 0 if none */
16469 int n_end2;
16470 xmlChar end3; /* an end marker xmlChar, 0 if none */
16471 int n_end3;
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016472
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016473 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16474 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
16475 for (n_len = 0;n_len < gen_nb_int;n_len++) {
16476 for (n_what = 0;n_what < gen_nb_int;n_what++) {
16477 for (n_end = 0;n_end < gen_nb_xmlChar;n_end++) {
16478 for (n_end2 = 0;n_end2 < gen_nb_xmlChar;n_end2++) {
16479 for (n_end3 = 0;n_end3 < gen_nb_xmlChar;n_end3++) {
16480 mem_base = xmlMemBlocks();
16481 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16482 str = gen_const_xmlChar_ptr(n_str, 1);
16483 len = gen_int(n_len, 2);
16484 what = gen_int(n_what, 3);
16485 end = gen_xmlChar(n_end, 4);
16486 end2 = gen_xmlChar(n_end2, 5);
16487 end3 = gen_xmlChar(n_end3, 6);
16488
William M. Brackf13f77f2004-11-12 16:03:48 +000016489 ret_val = xmlStringLenDecodeEntities(ctxt, (const xmlChar *)str, len, what, end, end2, end3);
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016490 desret_xmlChar_ptr(ret_val);
16491 call_tests++;
16492 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000016493 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016494 des_int(n_len, len, 2);
16495 des_int(n_what, what, 3);
16496 des_xmlChar(n_end, end, 4);
16497 des_xmlChar(n_end2, end2, 5);
16498 des_xmlChar(n_end3, end3, 6);
16499 xmlResetLastError();
16500 if (mem_base != xmlMemBlocks()) {
16501 printf("Leak of %d blocks found in xmlStringLenDecodeEntities",
16502 xmlMemBlocks() - mem_base);
16503 test_ret++;
16504 printf(" %d", n_ctxt);
16505 printf(" %d", n_str);
16506 printf(" %d", n_len);
16507 printf(" %d", n_what);
16508 printf(" %d", n_end);
16509 printf(" %d", n_end2);
16510 printf(" %d", n_end3);
16511 printf("\n");
16512 }
16513 }
16514 }
16515 }
16516 }
16517 }
16518 }
16519 }
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016520 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016521
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016522 return(test_ret);
16523}
16524
16525
16526static int
16527test_xmlSwitchEncoding(void) {
16528 int test_ret = 0;
16529
16530 int mem_base;
16531 int ret_val;
16532 xmlParserCtxtPtr ctxt; /* the parser context */
16533 int n_ctxt;
16534 xmlCharEncoding enc; /* the encoding value (number) */
16535 int n_enc;
16536
16537 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16538 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
16539 mem_base = xmlMemBlocks();
16540 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16541 enc = gen_xmlCharEncoding(n_enc, 1);
16542
16543 ret_val = xmlSwitchEncoding(ctxt, enc);
16544 desret_int(ret_val);
16545 call_tests++;
16546 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16547 des_xmlCharEncoding(n_enc, enc, 1);
16548 xmlResetLastError();
16549 if (mem_base != xmlMemBlocks()) {
16550 printf("Leak of %d blocks found in xmlSwitchEncoding",
16551 xmlMemBlocks() - mem_base);
16552 test_ret++;
16553 printf(" %d", n_ctxt);
16554 printf(" %d", n_enc);
16555 printf("\n");
16556 }
16557 }
16558 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016559 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016560
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016561 return(test_ret);
16562}
16563
16564
16565static int
16566test_xmlSwitchInputEncoding(void) {
16567 int test_ret = 0;
16568
16569 int mem_base;
16570 int ret_val;
16571 xmlParserCtxtPtr ctxt; /* the parser context */
16572 int n_ctxt;
16573 xmlParserInputPtr input; /* the input stream */
16574 int n_input;
16575 xmlCharEncodingHandlerPtr handler; /* the encoding handler */
16576 int n_handler;
16577
16578 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16579 for (n_input = 0;n_input < gen_nb_xmlParserInputPtr;n_input++) {
16580 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandlerPtr;n_handler++) {
16581 mem_base = xmlMemBlocks();
16582 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16583 input = gen_xmlParserInputPtr(n_input, 1);
16584 handler = gen_xmlCharEncodingHandlerPtr(n_handler, 2);
16585
16586 ret_val = xmlSwitchInputEncoding(ctxt, input, handler);
16587 desret_int(ret_val);
16588 call_tests++;
16589 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16590 des_xmlParserInputPtr(n_input, input, 1);
16591 des_xmlCharEncodingHandlerPtr(n_handler, handler, 2);
16592 xmlResetLastError();
16593 if (mem_base != xmlMemBlocks()) {
16594 printf("Leak of %d blocks found in xmlSwitchInputEncoding",
16595 xmlMemBlocks() - mem_base);
16596 test_ret++;
16597 printf(" %d", n_ctxt);
16598 printf(" %d", n_input);
16599 printf(" %d", n_handler);
16600 printf("\n");
16601 }
16602 }
16603 }
16604 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016605 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016606
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016607 return(test_ret);
16608}
16609
16610
16611static int
16612test_xmlSwitchToEncoding(void) {
16613 int test_ret = 0;
16614
16615 int mem_base;
16616 int ret_val;
16617 xmlParserCtxtPtr ctxt; /* the parser context */
16618 int n_ctxt;
16619 xmlCharEncodingHandlerPtr handler; /* the encoding handler */
16620 int n_handler;
16621
16622 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16623 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandlerPtr;n_handler++) {
16624 mem_base = xmlMemBlocks();
16625 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16626 handler = gen_xmlCharEncodingHandlerPtr(n_handler, 1);
16627
16628 ret_val = xmlSwitchToEncoding(ctxt, handler);
16629 desret_int(ret_val);
16630 call_tests++;
16631 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16632 des_xmlCharEncodingHandlerPtr(n_handler, handler, 1);
16633 xmlResetLastError();
16634 if (mem_base != xmlMemBlocks()) {
16635 printf("Leak of %d blocks found in xmlSwitchToEncoding",
16636 xmlMemBlocks() - mem_base);
16637 test_ret++;
16638 printf(" %d", n_ctxt);
16639 printf(" %d", n_handler);
16640 printf("\n");
16641 }
16642 }
16643 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016644 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016645
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016646 return(test_ret);
16647}
16648
16649static int
16650test_parserInternals(void) {
16651 int test_ret = 0;
16652
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016653 if (quiet == 0) printf("Testing parserInternals : 33 of 90 functions ...\n");
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016654 test_ret += test_htmlCreateFileParserCtxt();
16655 test_ret += test_htmlInitAutoClose();
16656 test_ret += test_inputPop();
16657 test_ret += test_inputPush();
16658 test_ret += test_namePop();
16659 test_ret += test_namePush();
16660 test_ret += test_nodePop();
16661 test_ret += test_nodePush();
16662 test_ret += test_xmlCheckLanguageID();
16663 test_ret += test_xmlCopyChar();
16664 test_ret += test_xmlCopyCharMultiByte();
16665 test_ret += test_xmlCreateEntityParserCtxt();
16666 test_ret += test_xmlCreateFileParserCtxt();
16667 test_ret += test_xmlCreateMemoryParserCtxt();
16668 test_ret += test_xmlCreateURLParserCtxt();
16669 test_ret += test_xmlCurrentChar();
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016670 test_ret += test_xmlErrMemory();
16671 test_ret += test_xmlIsLetter();
16672 test_ret += test_xmlNewEntityInputStream();
16673 test_ret += test_xmlNewInputFromFile();
16674 test_ret += test_xmlNewInputStream();
16675 test_ret += test_xmlNewStringInputStream();
16676 test_ret += test_xmlNextChar();
16677 test_ret += test_xmlParserInputShrink();
16678 test_ret += test_xmlPopInput();
16679 test_ret += test_xmlPushInput();
16680 test_ret += test_xmlSetEntityReferenceFunc();
16681 test_ret += test_xmlSplitQName();
16682 test_ret += test_xmlStringCurrentChar();
16683 test_ret += test_xmlStringDecodeEntities();
16684 test_ret += test_xmlStringLenDecodeEntities();
16685 test_ret += test_xmlSwitchEncoding();
16686 test_ret += test_xmlSwitchInputEncoding();
16687 test_ret += test_xmlSwitchToEncoding();
16688
16689 if (test_ret != 0)
16690 printf("Module parserInternals: %d errors\n", test_ret);
16691 return(test_ret);
16692}
16693
Daniel Veillardd93f6252004-11-02 15:53:51 +000016694static int
16695test_xmlPatternMatch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016696 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016697
William M. Brack21e4ef22005-01-02 09:53:13 +000016698#if defined(LIBXML_PATTERN_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000016699 int mem_base;
16700 int ret_val;
16701 xmlPatternPtr comp; /* the precompiled pattern */
16702 int n_comp;
16703 xmlNodePtr node; /* a node */
16704 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016705
Daniel Veillardce682bc2004-11-05 17:22:25 +000016706 for (n_comp = 0;n_comp < gen_nb_xmlPatternPtr;n_comp++) {
16707 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
16708 mem_base = xmlMemBlocks();
16709 comp = gen_xmlPatternPtr(n_comp, 0);
16710 node = gen_xmlNodePtr(n_node, 1);
16711
16712 ret_val = xmlPatternMatch(comp, node);
16713 desret_int(ret_val);
16714 call_tests++;
16715 des_xmlPatternPtr(n_comp, comp, 0);
16716 des_xmlNodePtr(n_node, node, 1);
16717 xmlResetLastError();
16718 if (mem_base != xmlMemBlocks()) {
16719 printf("Leak of %d blocks found in xmlPatternMatch",
16720 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000016721 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000016722 printf(" %d", n_comp);
16723 printf(" %d", n_node);
16724 printf("\n");
16725 }
16726 }
16727 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016728 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000016729#endif
16730
Daniel Veillard42595322004-11-08 10:52:06 +000016731 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016732}
16733
16734
16735static int
16736test_xmlPatterncompile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016737 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016738
16739
16740 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000016741 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016742}
16743
16744static int
16745test_pattern(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016746 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016747
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016748 if (quiet == 0) printf("Testing pattern : 1 of 4 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000016749 test_ret += test_xmlPatternMatch();
16750 test_ret += test_xmlPatterncompile();
Daniel Veillardd93f6252004-11-02 15:53:51 +000016751
Daniel Veillard42595322004-11-08 10:52:06 +000016752 if (test_ret != 0)
16753 printf("Module pattern: %d errors\n", test_ret);
16754 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016755}
Daniel Veillarda521d282004-11-09 14:59:59 +000016756#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000016757
Daniel Veillardce682bc2004-11-05 17:22:25 +000016758#define gen_nb_xmlRelaxNGPtr 1
16759static xmlRelaxNGPtr gen_xmlRelaxNGPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16760 return(NULL);
16761}
16762static void des_xmlRelaxNGPtr(int no ATTRIBUTE_UNUSED, xmlRelaxNGPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16763}
Daniel Veillarda521d282004-11-09 14:59:59 +000016764#endif
16765
Daniel Veillardce682bc2004-11-05 17:22:25 +000016766
Daniel Veillardd93f6252004-11-02 15:53:51 +000016767static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000016768test_xmlRelaxNGDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016769 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016770
William M. Brack21e4ef22005-01-02 09:53:13 +000016771#if defined(LIBXML_SCHEMAS_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000016772 int mem_base;
16773 FILE * output; /* the file output */
16774 int n_output;
16775 xmlRelaxNGPtr schema; /* a schema structure */
16776 int n_schema;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016777
Daniel Veillardce682bc2004-11-05 17:22:25 +000016778 for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
16779 for (n_schema = 0;n_schema < gen_nb_xmlRelaxNGPtr;n_schema++) {
16780 mem_base = xmlMemBlocks();
16781 output = gen_FILE_ptr(n_output, 0);
16782 schema = gen_xmlRelaxNGPtr(n_schema, 1);
16783
16784 xmlRelaxNGDump(output, schema);
16785 call_tests++;
16786 des_FILE_ptr(n_output, output, 0);
16787 des_xmlRelaxNGPtr(n_schema, schema, 1);
16788 xmlResetLastError();
16789 if (mem_base != xmlMemBlocks()) {
16790 printf("Leak of %d blocks found in xmlRelaxNGDump",
16791 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000016792 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000016793 printf(" %d", n_output);
16794 printf(" %d", n_schema);
16795 printf("\n");
16796 }
16797 }
16798 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016799 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000016800#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +000016801
Daniel Veillard42595322004-11-08 10:52:06 +000016802 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016803}
16804
16805
16806static int
16807test_xmlRelaxNGDumpTree(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016808 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016809
William M. Brack21e4ef22005-01-02 09:53:13 +000016810#if defined(LIBXML_SCHEMAS_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000016811 int mem_base;
16812 FILE * output; /* the file output */
16813 int n_output;
16814 xmlRelaxNGPtr schema; /* a schema structure */
16815 int n_schema;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016816
Daniel Veillardce682bc2004-11-05 17:22:25 +000016817 for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
16818 for (n_schema = 0;n_schema < gen_nb_xmlRelaxNGPtr;n_schema++) {
16819 mem_base = xmlMemBlocks();
16820 output = gen_FILE_ptr(n_output, 0);
16821 schema = gen_xmlRelaxNGPtr(n_schema, 1);
16822
16823 xmlRelaxNGDumpTree(output, schema);
16824 call_tests++;
16825 des_FILE_ptr(n_output, output, 0);
16826 des_xmlRelaxNGPtr(n_schema, schema, 1);
16827 xmlResetLastError();
16828 if (mem_base != xmlMemBlocks()) {
16829 printf("Leak of %d blocks found in xmlRelaxNGDumpTree",
16830 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000016831 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000016832 printf(" %d", n_output);
16833 printf(" %d", n_schema);
16834 printf("\n");
16835 }
16836 }
16837 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016838 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000016839#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +000016840
Daniel Veillard42595322004-11-08 10:52:06 +000016841 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016842}
16843
Daniel Veillarda521d282004-11-09 14:59:59 +000016844#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000016845
Daniel Veillardce682bc2004-11-05 17:22:25 +000016846#define gen_nb_xmlRelaxNGParserCtxtPtr 1
16847static xmlRelaxNGParserCtxtPtr gen_xmlRelaxNGParserCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16848 return(NULL);
16849}
16850static void des_xmlRelaxNGParserCtxtPtr(int no ATTRIBUTE_UNUSED, xmlRelaxNGParserCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16851}
Daniel Veillarda521d282004-11-09 14:59:59 +000016852#endif
16853
16854#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000016855
16856#define gen_nb_xmlRelaxNGValidityErrorFunc_ptr 1
16857static xmlRelaxNGValidityErrorFunc * gen_xmlRelaxNGValidityErrorFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16858 return(NULL);
16859}
16860static void des_xmlRelaxNGValidityErrorFunc_ptr(int no ATTRIBUTE_UNUSED, xmlRelaxNGValidityErrorFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16861}
Daniel Veillarda521d282004-11-09 14:59:59 +000016862#endif
16863
16864#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000016865
16866#define gen_nb_xmlRelaxNGValidityWarningFunc_ptr 1
16867static xmlRelaxNGValidityWarningFunc * gen_xmlRelaxNGValidityWarningFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16868 return(NULL);
16869}
16870static void des_xmlRelaxNGValidityWarningFunc_ptr(int no ATTRIBUTE_UNUSED, xmlRelaxNGValidityWarningFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16871}
Daniel Veillarda521d282004-11-09 14:59:59 +000016872#endif
16873
16874#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000016875
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000016876#define gen_nb_void_ptr_ptr 1
16877static void ** gen_void_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16878 return(NULL);
16879}
16880static void des_void_ptr_ptr(int no ATTRIBUTE_UNUSED, void ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16881}
Daniel Veillarda521d282004-11-09 14:59:59 +000016882#endif
16883
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000016884
Daniel Veillardd93f6252004-11-02 15:53:51 +000016885static int
16886test_xmlRelaxNGGetParserErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016887 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016888
William M. Brack21e4ef22005-01-02 09:53:13 +000016889#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000016890 int mem_base;
16891 int ret_val;
16892 xmlRelaxNGParserCtxtPtr ctxt; /* a Relax-NG validation context */
16893 int n_ctxt;
16894 xmlRelaxNGValidityErrorFunc * err; /* the error callback result */
16895 int n_err;
16896 xmlRelaxNGValidityWarningFunc * warn; /* the warning callback result */
16897 int n_warn;
16898 void ** ctx; /* contextual data for the callbacks result */
16899 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016900
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000016901 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGParserCtxtPtr;n_ctxt++) {
16902 for (n_err = 0;n_err < gen_nb_xmlRelaxNGValidityErrorFunc_ptr;n_err++) {
16903 for (n_warn = 0;n_warn < gen_nb_xmlRelaxNGValidityWarningFunc_ptr;n_warn++) {
16904 for (n_ctx = 0;n_ctx < gen_nb_void_ptr_ptr;n_ctx++) {
16905 mem_base = xmlMemBlocks();
16906 ctxt = gen_xmlRelaxNGParserCtxtPtr(n_ctxt, 0);
16907 err = gen_xmlRelaxNGValidityErrorFunc_ptr(n_err, 1);
16908 warn = gen_xmlRelaxNGValidityWarningFunc_ptr(n_warn, 2);
16909 ctx = gen_void_ptr_ptr(n_ctx, 3);
16910
16911 ret_val = xmlRelaxNGGetParserErrors(ctxt, err, warn, ctx);
16912 desret_int(ret_val);
16913 call_tests++;
16914 des_xmlRelaxNGParserCtxtPtr(n_ctxt, ctxt, 0);
16915 des_xmlRelaxNGValidityErrorFunc_ptr(n_err, err, 1);
16916 des_xmlRelaxNGValidityWarningFunc_ptr(n_warn, warn, 2);
16917 des_void_ptr_ptr(n_ctx, ctx, 3);
16918 xmlResetLastError();
16919 if (mem_base != xmlMemBlocks()) {
16920 printf("Leak of %d blocks found in xmlRelaxNGGetParserErrors",
16921 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000016922 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000016923 printf(" %d", n_ctxt);
16924 printf(" %d", n_err);
16925 printf(" %d", n_warn);
16926 printf(" %d", n_ctx);
16927 printf("\n");
16928 }
16929 }
16930 }
16931 }
16932 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016933 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000016934#endif
16935
Daniel Veillard42595322004-11-08 10:52:06 +000016936 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016937}
16938
Daniel Veillarda521d282004-11-09 14:59:59 +000016939#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000016940
Daniel Veillardce682bc2004-11-05 17:22:25 +000016941#define gen_nb_xmlRelaxNGValidCtxtPtr 1
16942static xmlRelaxNGValidCtxtPtr gen_xmlRelaxNGValidCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16943 return(NULL);
16944}
16945static void des_xmlRelaxNGValidCtxtPtr(int no ATTRIBUTE_UNUSED, xmlRelaxNGValidCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16946}
Daniel Veillarda521d282004-11-09 14:59:59 +000016947#endif
16948
Daniel Veillardce682bc2004-11-05 17:22:25 +000016949
Daniel Veillardd93f6252004-11-02 15:53:51 +000016950static int
16951test_xmlRelaxNGGetValidErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016952 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016953
William M. Brack21e4ef22005-01-02 09:53:13 +000016954#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000016955 int mem_base;
16956 int ret_val;
16957 xmlRelaxNGValidCtxtPtr ctxt; /* a Relax-NG validation context */
16958 int n_ctxt;
16959 xmlRelaxNGValidityErrorFunc * err; /* the error function result */
16960 int n_err;
16961 xmlRelaxNGValidityWarningFunc * warn; /* the warning function result */
16962 int n_warn;
16963 void ** ctx; /* the functions context result */
16964 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016965
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000016966 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
16967 for (n_err = 0;n_err < gen_nb_xmlRelaxNGValidityErrorFunc_ptr;n_err++) {
16968 for (n_warn = 0;n_warn < gen_nb_xmlRelaxNGValidityWarningFunc_ptr;n_warn++) {
16969 for (n_ctx = 0;n_ctx < gen_nb_void_ptr_ptr;n_ctx++) {
16970 mem_base = xmlMemBlocks();
16971 ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
16972 err = gen_xmlRelaxNGValidityErrorFunc_ptr(n_err, 1);
16973 warn = gen_xmlRelaxNGValidityWarningFunc_ptr(n_warn, 2);
16974 ctx = gen_void_ptr_ptr(n_ctx, 3);
16975
16976 ret_val = xmlRelaxNGGetValidErrors(ctxt, err, warn, ctx);
16977 desret_int(ret_val);
16978 call_tests++;
16979 des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
16980 des_xmlRelaxNGValidityErrorFunc_ptr(n_err, err, 1);
16981 des_xmlRelaxNGValidityWarningFunc_ptr(n_warn, warn, 2);
16982 des_void_ptr_ptr(n_ctx, ctx, 3);
16983 xmlResetLastError();
16984 if (mem_base != xmlMemBlocks()) {
16985 printf("Leak of %d blocks found in xmlRelaxNGGetValidErrors",
16986 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000016987 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000016988 printf(" %d", n_ctxt);
16989 printf(" %d", n_err);
16990 printf(" %d", n_warn);
16991 printf(" %d", n_ctx);
16992 printf("\n");
16993 }
16994 }
16995 }
16996 }
16997 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016998 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000016999#endif
17000
Daniel Veillard42595322004-11-08 10:52:06 +000017001 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017002}
17003
17004
17005static int
Daniel Veillard34099b42004-11-04 17:34:35 +000017006test_xmlRelaxNGInitTypes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017007 int test_ret = 0;
Daniel Veillard34099b42004-11-04 17:34:35 +000017008
William M. Brack21e4ef22005-01-02 09:53:13 +000017009#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard34099b42004-11-04 17:34:35 +000017010 int mem_base;
17011 int ret_val;
17012
17013 mem_base = xmlMemBlocks();
17014
17015 ret_val = xmlRelaxNGInitTypes();
17016 desret_int(ret_val);
17017 call_tests++;
17018 xmlResetLastError();
17019 if (mem_base != xmlMemBlocks()) {
17020 printf("Leak of %d blocks found in xmlRelaxNGInitTypes",
17021 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017022 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000017023 printf("\n");
17024 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017025 function_tests++;
Daniel Veillard34099b42004-11-04 17:34:35 +000017026#endif
17027
Daniel Veillard42595322004-11-08 10:52:06 +000017028 return(test_ret);
Daniel Veillard34099b42004-11-04 17:34:35 +000017029}
17030
17031
17032static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000017033test_xmlRelaxNGNewDocParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017034 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017035
William M. Brack21e4ef22005-01-02 09:53:13 +000017036#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +000017037 int mem_base;
17038 xmlRelaxNGParserCtxtPtr ret_val;
17039 xmlDocPtr doc; /* a preparsed document tree */
17040 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017041
Daniel Veillard42595322004-11-08 10:52:06 +000017042 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
17043 mem_base = xmlMemBlocks();
17044 doc = gen_xmlDocPtr(n_doc, 0);
17045
17046 ret_val = xmlRelaxNGNewDocParserCtxt(doc);
17047 desret_xmlRelaxNGParserCtxtPtr(ret_val);
17048 call_tests++;
17049 des_xmlDocPtr(n_doc, doc, 0);
17050 xmlResetLastError();
17051 if (mem_base != xmlMemBlocks()) {
17052 printf("Leak of %d blocks found in xmlRelaxNGNewDocParserCtxt",
17053 xmlMemBlocks() - mem_base);
17054 test_ret++;
17055 printf(" %d", n_doc);
17056 printf("\n");
17057 }
17058 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017059 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017060#endif
17061
Daniel Veillard42595322004-11-08 10:52:06 +000017062 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017063}
17064
17065
17066static int
17067test_xmlRelaxNGNewMemParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017068 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017069
William M. Brack21e4ef22005-01-02 09:53:13 +000017070#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +000017071 int mem_base;
17072 xmlRelaxNGParserCtxtPtr ret_val;
17073 char * buffer; /* a pointer to a char array containing the schemas */
17074 int n_buffer;
17075 int size; /* the size of the array */
17076 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017077
Daniel Veillard42595322004-11-08 10:52:06 +000017078 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
17079 for (n_size = 0;n_size < gen_nb_int;n_size++) {
17080 mem_base = xmlMemBlocks();
17081 buffer = gen_const_char_ptr(n_buffer, 0);
17082 size = gen_int(n_size, 1);
17083
William M. Brackf13f77f2004-11-12 16:03:48 +000017084 ret_val = xmlRelaxNGNewMemParserCtxt((const char *)buffer, size);
Daniel Veillard42595322004-11-08 10:52:06 +000017085 desret_xmlRelaxNGParserCtxtPtr(ret_val);
17086 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000017087 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard42595322004-11-08 10:52:06 +000017088 des_int(n_size, size, 1);
17089 xmlResetLastError();
17090 if (mem_base != xmlMemBlocks()) {
17091 printf("Leak of %d blocks found in xmlRelaxNGNewMemParserCtxt",
17092 xmlMemBlocks() - mem_base);
17093 test_ret++;
17094 printf(" %d", n_buffer);
17095 printf(" %d", n_size);
17096 printf("\n");
17097 }
17098 }
17099 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017100 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017101#endif
17102
Daniel Veillard42595322004-11-08 10:52:06 +000017103 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017104}
17105
17106
17107static int
17108test_xmlRelaxNGNewParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017109 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017110
William M. Brack21e4ef22005-01-02 09:53:13 +000017111#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +000017112 int mem_base;
17113 xmlRelaxNGParserCtxtPtr ret_val;
17114 char * URL; /* the location of the schema */
17115 int n_URL;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017116
Daniel Veillard42595322004-11-08 10:52:06 +000017117 for (n_URL = 0;n_URL < gen_nb_const_char_ptr;n_URL++) {
17118 mem_base = xmlMemBlocks();
17119 URL = gen_const_char_ptr(n_URL, 0);
17120
William M. Brackf13f77f2004-11-12 16:03:48 +000017121 ret_val = xmlRelaxNGNewParserCtxt((const char *)URL);
Daniel Veillard42595322004-11-08 10:52:06 +000017122 desret_xmlRelaxNGParserCtxtPtr(ret_val);
17123 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000017124 des_const_char_ptr(n_URL, (const char *)URL, 0);
Daniel Veillard42595322004-11-08 10:52:06 +000017125 xmlResetLastError();
17126 if (mem_base != xmlMemBlocks()) {
17127 printf("Leak of %d blocks found in xmlRelaxNGNewParserCtxt",
17128 xmlMemBlocks() - mem_base);
17129 test_ret++;
17130 printf(" %d", n_URL);
17131 printf("\n");
17132 }
17133 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017134 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017135#endif
17136
Daniel Veillard42595322004-11-08 10:52:06 +000017137 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017138}
17139
17140
17141static int
17142test_xmlRelaxNGNewValidCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017143 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017144
17145
17146 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000017147 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017148}
17149
17150
17151static int
17152test_xmlRelaxNGParse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017153 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017154
17155
17156 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000017157 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017158}
17159
17160
17161static int
17162test_xmlRelaxNGSetParserErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017163 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017164
17165
17166 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000017167 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017168}
17169
17170
17171static int
17172test_xmlRelaxNGSetValidErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017173 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017174
17175
17176 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000017177 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017178}
17179
17180
17181static int
17182test_xmlRelaxNGValidateDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017183 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017184
William M. Brack21e4ef22005-01-02 09:53:13 +000017185#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000017186 int mem_base;
17187 int ret_val;
17188 xmlRelaxNGValidCtxtPtr ctxt; /* a Relax-NG validation context */
17189 int n_ctxt;
17190 xmlDocPtr doc; /* a parsed document tree */
17191 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017192
Daniel Veillardce682bc2004-11-05 17:22:25 +000017193 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
17194 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
17195 mem_base = xmlMemBlocks();
17196 ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
17197 doc = gen_xmlDocPtr(n_doc, 1);
17198
17199 ret_val = xmlRelaxNGValidateDoc(ctxt, doc);
17200 desret_int(ret_val);
17201 call_tests++;
17202 des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
17203 des_xmlDocPtr(n_doc, doc, 1);
17204 xmlResetLastError();
17205 if (mem_base != xmlMemBlocks()) {
17206 printf("Leak of %d blocks found in xmlRelaxNGValidateDoc",
17207 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017208 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017209 printf(" %d", n_ctxt);
17210 printf(" %d", n_doc);
17211 printf("\n");
17212 }
17213 }
17214 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017215 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017216#endif
17217
Daniel Veillard42595322004-11-08 10:52:06 +000017218 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017219}
17220
17221
17222static int
17223test_xmlRelaxNGValidateFullElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017224 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017225
William M. Brack21e4ef22005-01-02 09:53:13 +000017226#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000017227 int mem_base;
17228 int ret_val;
17229 xmlRelaxNGValidCtxtPtr ctxt; /* the validation context */
17230 int n_ctxt;
17231 xmlDocPtr doc; /* a document instance */
17232 int n_doc;
17233 xmlNodePtr elem; /* an element instance */
17234 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017235
Daniel Veillardce682bc2004-11-05 17:22:25 +000017236 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
17237 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
17238 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
17239 mem_base = xmlMemBlocks();
17240 ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
17241 doc = gen_xmlDocPtr(n_doc, 1);
17242 elem = gen_xmlNodePtr(n_elem, 2);
17243
17244 ret_val = xmlRelaxNGValidateFullElement(ctxt, doc, elem);
17245 desret_int(ret_val);
17246 call_tests++;
17247 des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
17248 des_xmlDocPtr(n_doc, doc, 1);
17249 des_xmlNodePtr(n_elem, elem, 2);
17250 xmlResetLastError();
17251 if (mem_base != xmlMemBlocks()) {
17252 printf("Leak of %d blocks found in xmlRelaxNGValidateFullElement",
17253 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017254 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017255 printf(" %d", n_ctxt);
17256 printf(" %d", n_doc);
17257 printf(" %d", n_elem);
17258 printf("\n");
17259 }
17260 }
17261 }
17262 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017263 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017264#endif
17265
Daniel Veillard42595322004-11-08 10:52:06 +000017266 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017267}
17268
17269
17270static int
17271test_xmlRelaxNGValidatePopElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017272 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017273
William M. Brack21e4ef22005-01-02 09:53:13 +000017274#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000017275 int mem_base;
17276 int ret_val;
17277 xmlRelaxNGValidCtxtPtr ctxt; /* the RelaxNG validation context */
17278 int n_ctxt;
17279 xmlDocPtr doc; /* a document instance */
17280 int n_doc;
17281 xmlNodePtr elem; /* an element instance */
17282 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017283
Daniel Veillardce682bc2004-11-05 17:22:25 +000017284 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
17285 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
17286 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
17287 mem_base = xmlMemBlocks();
17288 ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
17289 doc = gen_xmlDocPtr(n_doc, 1);
17290 elem = gen_xmlNodePtr(n_elem, 2);
17291
17292 ret_val = xmlRelaxNGValidatePopElement(ctxt, doc, elem);
17293 desret_int(ret_val);
17294 call_tests++;
17295 des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
17296 des_xmlDocPtr(n_doc, doc, 1);
17297 des_xmlNodePtr(n_elem, elem, 2);
17298 xmlResetLastError();
17299 if (mem_base != xmlMemBlocks()) {
17300 printf("Leak of %d blocks found in xmlRelaxNGValidatePopElement",
17301 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017302 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017303 printf(" %d", n_ctxt);
17304 printf(" %d", n_doc);
17305 printf(" %d", n_elem);
17306 printf("\n");
17307 }
17308 }
17309 }
17310 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017311 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017312#endif
17313
Daniel Veillard42595322004-11-08 10:52:06 +000017314 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017315}
17316
17317
17318static int
17319test_xmlRelaxNGValidatePushCData(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017320 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017321
William M. Brack21e4ef22005-01-02 09:53:13 +000017322#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000017323 int mem_base;
17324 int ret_val;
17325 xmlRelaxNGValidCtxtPtr ctxt; /* the RelaxNG validation context */
17326 int n_ctxt;
17327 xmlChar * data; /* some character data read */
17328 int n_data;
17329 int len; /* the lenght of the data */
17330 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017331
Daniel Veillardce682bc2004-11-05 17:22:25 +000017332 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
17333 for (n_data = 0;n_data < gen_nb_const_xmlChar_ptr;n_data++) {
17334 for (n_len = 0;n_len < gen_nb_int;n_len++) {
17335 mem_base = xmlMemBlocks();
17336 ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
17337 data = gen_const_xmlChar_ptr(n_data, 1);
17338 len = gen_int(n_len, 2);
17339
William M. Brackf13f77f2004-11-12 16:03:48 +000017340 ret_val = xmlRelaxNGValidatePushCData(ctxt, (const xmlChar *)data, len);
Daniel Veillardce682bc2004-11-05 17:22:25 +000017341 desret_int(ret_val);
17342 call_tests++;
17343 des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000017344 des_const_xmlChar_ptr(n_data, (const xmlChar *)data, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000017345 des_int(n_len, len, 2);
17346 xmlResetLastError();
17347 if (mem_base != xmlMemBlocks()) {
17348 printf("Leak of %d blocks found in xmlRelaxNGValidatePushCData",
17349 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017350 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017351 printf(" %d", n_ctxt);
17352 printf(" %d", n_data);
17353 printf(" %d", n_len);
17354 printf("\n");
17355 }
17356 }
17357 }
17358 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017359 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017360#endif
17361
Daniel Veillard42595322004-11-08 10:52:06 +000017362 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017363}
17364
17365
17366static int
17367test_xmlRelaxNGValidatePushElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017368 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017369
William M. Brack21e4ef22005-01-02 09:53:13 +000017370#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000017371 int mem_base;
17372 int ret_val;
17373 xmlRelaxNGValidCtxtPtr ctxt; /* the validation context */
17374 int n_ctxt;
17375 xmlDocPtr doc; /* a document instance */
17376 int n_doc;
17377 xmlNodePtr elem; /* an element instance */
17378 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017379
Daniel Veillardce682bc2004-11-05 17:22:25 +000017380 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
17381 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
17382 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
17383 mem_base = xmlMemBlocks();
17384 ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
17385 doc = gen_xmlDocPtr(n_doc, 1);
17386 elem = gen_xmlNodePtr(n_elem, 2);
17387
17388 ret_val = xmlRelaxNGValidatePushElement(ctxt, doc, elem);
17389 desret_int(ret_val);
17390 call_tests++;
17391 des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
17392 des_xmlDocPtr(n_doc, doc, 1);
17393 des_xmlNodePtr(n_elem, elem, 2);
17394 xmlResetLastError();
17395 if (mem_base != xmlMemBlocks()) {
17396 printf("Leak of %d blocks found in xmlRelaxNGValidatePushElement",
17397 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017398 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017399 printf(" %d", n_ctxt);
17400 printf(" %d", n_doc);
17401 printf(" %d", n_elem);
17402 printf("\n");
17403 }
17404 }
17405 }
17406 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017407 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017408#endif
17409
Daniel Veillard42595322004-11-08 10:52:06 +000017410 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017411}
17412
17413
17414static int
17415test_xmlRelaxParserSetFlag(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017416 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017417
William M. Brack21e4ef22005-01-02 09:53:13 +000017418#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000017419 int mem_base;
17420 int ret_val;
17421 xmlRelaxNGParserCtxtPtr ctxt; /* a RelaxNG parser context */
17422 int n_ctxt;
17423 int flags; /* a set of flags values */
17424 int n_flags;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017425
Daniel Veillardce682bc2004-11-05 17:22:25 +000017426 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGParserCtxtPtr;n_ctxt++) {
17427 for (n_flags = 0;n_flags < gen_nb_int;n_flags++) {
17428 mem_base = xmlMemBlocks();
17429 ctxt = gen_xmlRelaxNGParserCtxtPtr(n_ctxt, 0);
17430 flags = gen_int(n_flags, 1);
17431
17432 ret_val = xmlRelaxParserSetFlag(ctxt, flags);
17433 desret_int(ret_val);
17434 call_tests++;
17435 des_xmlRelaxNGParserCtxtPtr(n_ctxt, ctxt, 0);
17436 des_int(n_flags, flags, 1);
17437 xmlResetLastError();
17438 if (mem_base != xmlMemBlocks()) {
17439 printf("Leak of %d blocks found in xmlRelaxParserSetFlag",
17440 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017441 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017442 printf(" %d", n_ctxt);
17443 printf(" %d", n_flags);
17444 printf("\n");
17445 }
17446 }
17447 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017448 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017449#endif
17450
Daniel Veillard42595322004-11-08 10:52:06 +000017451 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017452}
17453
17454static int
17455test_relaxng(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017456 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017457
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017458 if (quiet == 0) printf("Testing relaxng : 14 of 22 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000017459 test_ret += test_xmlRelaxNGDump();
17460 test_ret += test_xmlRelaxNGDumpTree();
17461 test_ret += test_xmlRelaxNGGetParserErrors();
17462 test_ret += test_xmlRelaxNGGetValidErrors();
17463 test_ret += test_xmlRelaxNGInitTypes();
17464 test_ret += test_xmlRelaxNGNewDocParserCtxt();
17465 test_ret += test_xmlRelaxNGNewMemParserCtxt();
17466 test_ret += test_xmlRelaxNGNewParserCtxt();
17467 test_ret += test_xmlRelaxNGNewValidCtxt();
17468 test_ret += test_xmlRelaxNGParse();
17469 test_ret += test_xmlRelaxNGSetParserErrors();
17470 test_ret += test_xmlRelaxNGSetValidErrors();
17471 test_ret += test_xmlRelaxNGValidateDoc();
17472 test_ret += test_xmlRelaxNGValidateFullElement();
17473 test_ret += test_xmlRelaxNGValidatePopElement();
17474 test_ret += test_xmlRelaxNGValidatePushCData();
17475 test_ret += test_xmlRelaxNGValidatePushElement();
17476 test_ret += test_xmlRelaxParserSetFlag();
Daniel Veillardd93f6252004-11-02 15:53:51 +000017477
Daniel Veillard42595322004-11-08 10:52:06 +000017478 if (test_ret != 0)
17479 printf("Module relaxng: %d errors\n", test_ret);
17480 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017481}
17482static int
17483test_schemasInternals(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017484 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017485
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017486 if (quiet == 0) printf("Testing schemasInternals : 0 of 2 functions ...\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017487
Daniel Veillard42595322004-11-08 10:52:06 +000017488 if (test_ret != 0)
17489 printf("Module schemasInternals: %d errors\n", test_ret);
17490 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017491}
17492
17493static int
17494test_xmlAddChild(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017495 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017496
17497 int mem_base;
17498 xmlNodePtr ret_val;
17499 xmlNodePtr parent; /* the parent node */
17500 int n_parent;
17501 xmlNodePtr cur; /* the child node */
17502 int n_cur;
17503
Daniel Veillarda03e3652004-11-02 18:45:30 +000017504 for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000017505 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr_in;n_cur++) {
17506 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017507 parent = gen_xmlNodePtr(n_parent, 0);
17508 cur = gen_xmlNodePtr_in(n_cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017509
17510 ret_val = xmlAddChild(parent, cur);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000017511 if (ret_val == NULL) { xmlFreeNode(cur) ; cur = NULL ; }
Daniel Veillardd93f6252004-11-02 15:53:51 +000017512 desret_xmlNodePtr(ret_val);
17513 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017514 des_xmlNodePtr(n_parent, parent, 0);
17515 des_xmlNodePtr_in(n_cur, cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017516 xmlResetLastError();
17517 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017518 printf("Leak of %d blocks found in xmlAddChild",
Daniel Veillardd93f6252004-11-02 15:53:51 +000017519 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017520 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000017521 printf(" %d", n_parent);
17522 printf(" %d", n_cur);
17523 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017524 }
17525 }
17526 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000017527 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017528
Daniel Veillard42595322004-11-08 10:52:06 +000017529 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017530}
17531
17532
17533static int
17534test_xmlAddChildList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017535 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017536
17537 int mem_base;
17538 xmlNodePtr ret_val;
17539 xmlNodePtr parent; /* the parent node */
17540 int n_parent;
17541 xmlNodePtr cur; /* the first node in the list */
17542 int n_cur;
17543
Daniel Veillarda03e3652004-11-02 18:45:30 +000017544 for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000017545 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr_in;n_cur++) {
17546 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017547 parent = gen_xmlNodePtr(n_parent, 0);
17548 cur = gen_xmlNodePtr_in(n_cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017549
17550 ret_val = xmlAddChildList(parent, cur);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000017551 if (ret_val == NULL) { xmlFreeNodeList(cur) ; cur = NULL ; }
Daniel Veillardd93f6252004-11-02 15:53:51 +000017552 desret_xmlNodePtr(ret_val);
17553 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017554 des_xmlNodePtr(n_parent, parent, 0);
17555 des_xmlNodePtr_in(n_cur, cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017556 xmlResetLastError();
17557 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017558 printf("Leak of %d blocks found in xmlAddChildList",
Daniel Veillardd93f6252004-11-02 15:53:51 +000017559 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017560 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000017561 printf(" %d", n_parent);
17562 printf(" %d", n_cur);
17563 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017564 }
17565 }
17566 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000017567 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017568
Daniel Veillard42595322004-11-08 10:52:06 +000017569 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017570}
17571
17572
17573static int
17574test_xmlAddNextSibling(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017575 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017576
17577 int mem_base;
17578 xmlNodePtr ret_val;
17579 xmlNodePtr cur; /* the child node */
17580 int n_cur;
17581 xmlNodePtr elem; /* the new node */
17582 int n_elem;
17583
17584 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017585 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr_in;n_elem++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000017586 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017587 cur = gen_xmlNodePtr(n_cur, 0);
17588 elem = gen_xmlNodePtr_in(n_elem, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017589
17590 ret_val = xmlAddNextSibling(cur, elem);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000017591 if (ret_val == NULL) { xmlFreeNode(elem) ; elem = NULL ; }
Daniel Veillardd93f6252004-11-02 15:53:51 +000017592 desret_xmlNodePtr(ret_val);
17593 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017594 des_xmlNodePtr(n_cur, cur, 0);
17595 des_xmlNodePtr_in(n_elem, elem, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017596 xmlResetLastError();
17597 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017598 printf("Leak of %d blocks found in xmlAddNextSibling",
Daniel Veillardd93f6252004-11-02 15:53:51 +000017599 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017600 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000017601 printf(" %d", n_cur);
17602 printf(" %d", n_elem);
17603 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017604 }
17605 }
17606 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000017607 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017608
Daniel Veillard42595322004-11-08 10:52:06 +000017609 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017610}
17611
17612
17613static int
17614test_xmlAddPrevSibling(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017615 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017616
William M. Brack21e4ef22005-01-02 09:53:13 +000017617#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000017618 int mem_base;
17619 xmlNodePtr ret_val;
17620 xmlNodePtr cur; /* the child node */
17621 int n_cur;
17622 xmlNodePtr elem; /* the new node */
17623 int n_elem;
17624
17625 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017626 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr_in;n_elem++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000017627 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017628 cur = gen_xmlNodePtr(n_cur, 0);
17629 elem = gen_xmlNodePtr_in(n_elem, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017630
17631 ret_val = xmlAddPrevSibling(cur, elem);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000017632 if (ret_val == NULL) { xmlFreeNode(elem) ; elem = NULL ; }
Daniel Veillardd93f6252004-11-02 15:53:51 +000017633 desret_xmlNodePtr(ret_val);
17634 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017635 des_xmlNodePtr(n_cur, cur, 0);
17636 des_xmlNodePtr_in(n_elem, elem, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017637 xmlResetLastError();
17638 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017639 printf("Leak of %d blocks found in xmlAddPrevSibling",
Daniel Veillardd93f6252004-11-02 15:53:51 +000017640 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017641 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000017642 printf(" %d", n_cur);
17643 printf(" %d", n_elem);
17644 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017645 }
17646 }
17647 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017648 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017649#endif
17650
Daniel Veillard42595322004-11-08 10:52:06 +000017651 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017652}
17653
17654
17655static int
17656test_xmlAddSibling(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017657 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017658
17659 int mem_base;
17660 xmlNodePtr ret_val;
17661 xmlNodePtr cur; /* the child node */
17662 int n_cur;
17663 xmlNodePtr elem; /* the new node */
17664 int n_elem;
17665
17666 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017667 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr_in;n_elem++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000017668 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017669 cur = gen_xmlNodePtr(n_cur, 0);
17670 elem = gen_xmlNodePtr_in(n_elem, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017671
17672 ret_val = xmlAddSibling(cur, elem);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000017673 if (ret_val == NULL) { xmlFreeNode(elem) ; elem = NULL ; }
Daniel Veillardd93f6252004-11-02 15:53:51 +000017674 desret_xmlNodePtr(ret_val);
17675 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017676 des_xmlNodePtr(n_cur, cur, 0);
17677 des_xmlNodePtr_in(n_elem, elem, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017678 xmlResetLastError();
17679 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017680 printf("Leak of %d blocks found in xmlAddSibling",
Daniel Veillardd93f6252004-11-02 15:53:51 +000017681 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017682 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000017683 printf(" %d", n_cur);
17684 printf(" %d", n_elem);
17685 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017686 }
17687 }
17688 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000017689 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017690
Daniel Veillard42595322004-11-08 10:52:06 +000017691 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017692}
17693
17694
17695static int
17696test_xmlAttrSerializeTxtContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017697 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017698
William M. Brack21e4ef22005-01-02 09:53:13 +000017699#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000017700#ifdef LIBXML_OUTPUT_ENABLED
Daniel Veillardce244ad2004-11-05 10:03:46 +000017701 int mem_base;
17702 xmlBufferPtr buf; /* the XML buffer output */
17703 int n_buf;
17704 xmlDocPtr doc; /* the document */
17705 int n_doc;
17706 xmlAttrPtr attr; /* the attribute node */
17707 int n_attr;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017708 xmlChar * string; /* the text content */
Daniel Veillardce244ad2004-11-05 10:03:46 +000017709 int n_string;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017710
Daniel Veillardce244ad2004-11-05 10:03:46 +000017711 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
17712 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
17713 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
17714 for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) {
17715 mem_base = xmlMemBlocks();
17716 buf = gen_xmlBufferPtr(n_buf, 0);
17717 doc = gen_xmlDocPtr(n_doc, 1);
17718 attr = gen_xmlAttrPtr(n_attr, 2);
17719 string = gen_const_xmlChar_ptr(n_string, 3);
17720
William M. Brackf13f77f2004-11-12 16:03:48 +000017721 xmlAttrSerializeTxtContent(buf, doc, attr, (const xmlChar *)string);
Daniel Veillardce244ad2004-11-05 10:03:46 +000017722 call_tests++;
17723 des_xmlBufferPtr(n_buf, buf, 0);
17724 des_xmlDocPtr(n_doc, doc, 1);
17725 des_xmlAttrPtr(n_attr, attr, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000017726 des_const_xmlChar_ptr(n_string, (const xmlChar *)string, 3);
Daniel Veillardce244ad2004-11-05 10:03:46 +000017727 xmlResetLastError();
17728 if (mem_base != xmlMemBlocks()) {
17729 printf("Leak of %d blocks found in xmlAttrSerializeTxtContent",
17730 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017731 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000017732 printf(" %d", n_buf);
17733 printf(" %d", n_doc);
17734 printf(" %d", n_attr);
17735 printf(" %d", n_string);
17736 printf("\n");
17737 }
17738 }
17739 }
17740 }
17741 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017742 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000017743#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000017744#endif
Daniel Veillardce244ad2004-11-05 10:03:46 +000017745
Daniel Veillard42595322004-11-08 10:52:06 +000017746 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017747}
17748
17749
17750static int
17751test_xmlBufferAdd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017752 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017753
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017754 int mem_base;
17755 int ret_val;
17756 xmlBufferPtr buf; /* the buffer to dump */
17757 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017758 xmlChar * str; /* the #xmlChar string */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017759 int n_str;
17760 int len; /* the number of #xmlChar to add */
17761 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017762
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017763 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
17764 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
17765 for (n_len = 0;n_len < gen_nb_int;n_len++) {
17766 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017767 buf = gen_xmlBufferPtr(n_buf, 0);
17768 str = gen_const_xmlChar_ptr(n_str, 1);
17769 len = gen_int(n_len, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017770
William M. Brackf13f77f2004-11-12 16:03:48 +000017771 ret_val = xmlBufferAdd(buf, (const xmlChar *)str, len);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017772 desret_int(ret_val);
17773 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017774 des_xmlBufferPtr(n_buf, buf, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000017775 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000017776 des_int(n_len, len, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017777 xmlResetLastError();
17778 if (mem_base != xmlMemBlocks()) {
17779 printf("Leak of %d blocks found in xmlBufferAdd",
17780 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017781 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017782 printf(" %d", n_buf);
17783 printf(" %d", n_str);
17784 printf(" %d", n_len);
17785 printf("\n");
17786 }
17787 }
17788 }
17789 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000017790 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017791
Daniel Veillard42595322004-11-08 10:52:06 +000017792 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017793}
17794
17795
17796static int
17797test_xmlBufferAddHead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017798 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017799
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017800 int mem_base;
17801 int ret_val;
17802 xmlBufferPtr buf; /* the buffer */
17803 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017804 xmlChar * str; /* the #xmlChar string */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017805 int n_str;
17806 int len; /* the number of #xmlChar to add */
17807 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017808
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017809 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
17810 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
17811 for (n_len = 0;n_len < gen_nb_int;n_len++) {
17812 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017813 buf = gen_xmlBufferPtr(n_buf, 0);
17814 str = gen_const_xmlChar_ptr(n_str, 1);
17815 len = gen_int(n_len, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017816
William M. Brackf13f77f2004-11-12 16:03:48 +000017817 ret_val = xmlBufferAddHead(buf, (const xmlChar *)str, len);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017818 desret_int(ret_val);
17819 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017820 des_xmlBufferPtr(n_buf, buf, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000017821 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000017822 des_int(n_len, len, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017823 xmlResetLastError();
17824 if (mem_base != xmlMemBlocks()) {
17825 printf("Leak of %d blocks found in xmlBufferAddHead",
17826 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017827 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017828 printf(" %d", n_buf);
17829 printf(" %d", n_str);
17830 printf(" %d", n_len);
17831 printf("\n");
17832 }
17833 }
17834 }
17835 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000017836 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017837
Daniel Veillard42595322004-11-08 10:52:06 +000017838 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017839}
17840
17841
17842static int
17843test_xmlBufferCCat(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017844 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017845
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017846 int mem_base;
17847 int ret_val;
17848 xmlBufferPtr buf; /* the buffer to dump */
17849 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017850 char * str; /* the C char string */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017851 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017852
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017853 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
17854 for (n_str = 0;n_str < gen_nb_const_char_ptr;n_str++) {
17855 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017856 buf = gen_xmlBufferPtr(n_buf, 0);
17857 str = gen_const_char_ptr(n_str, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017858
William M. Brackf13f77f2004-11-12 16:03:48 +000017859 ret_val = xmlBufferCCat(buf, (const char *)str);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017860 desret_int(ret_val);
17861 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017862 des_xmlBufferPtr(n_buf, buf, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000017863 des_const_char_ptr(n_str, (const char *)str, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017864 xmlResetLastError();
17865 if (mem_base != xmlMemBlocks()) {
17866 printf("Leak of %d blocks found in xmlBufferCCat",
17867 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017868 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017869 printf(" %d", n_buf);
17870 printf(" %d", n_str);
17871 printf("\n");
17872 }
17873 }
17874 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000017875 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017876
Daniel Veillard42595322004-11-08 10:52:06 +000017877 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017878}
17879
17880
17881static int
17882test_xmlBufferCat(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017883 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017884
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017885 int mem_base;
17886 int ret_val;
17887 xmlBufferPtr buf; /* the buffer to add to */
17888 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017889 xmlChar * str; /* the #xmlChar string */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017890 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017891
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017892 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
17893 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
17894 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017895 buf = gen_xmlBufferPtr(n_buf, 0);
17896 str = gen_const_xmlChar_ptr(n_str, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017897
William M. Brackf13f77f2004-11-12 16:03:48 +000017898 ret_val = xmlBufferCat(buf, (const xmlChar *)str);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017899 desret_int(ret_val);
17900 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017901 des_xmlBufferPtr(n_buf, buf, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000017902 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017903 xmlResetLastError();
17904 if (mem_base != xmlMemBlocks()) {
17905 printf("Leak of %d blocks found in xmlBufferCat",
17906 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017907 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017908 printf(" %d", n_buf);
17909 printf(" %d", n_str);
17910 printf("\n");
17911 }
17912 }
17913 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000017914 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017915
Daniel Veillard42595322004-11-08 10:52:06 +000017916 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017917}
17918
17919
Daniel Veillardce682bc2004-11-05 17:22:25 +000017920#define gen_nb_const_xmlBufferPtr 1
17921static xmlBufferPtr gen_const_xmlBufferPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
17922 return(NULL);
17923}
17924static void des_const_xmlBufferPtr(int no ATTRIBUTE_UNUSED, const xmlBufferPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
17925}
17926
Daniel Veillardd93f6252004-11-02 15:53:51 +000017927static int
17928test_xmlBufferContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017929 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017930
Daniel Veillardce682bc2004-11-05 17:22:25 +000017931 int mem_base;
17932 const xmlChar * ret_val;
17933 xmlBufferPtr buf; /* the buffer */
17934 int n_buf;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017935
Daniel Veillardce682bc2004-11-05 17:22:25 +000017936 for (n_buf = 0;n_buf < gen_nb_const_xmlBufferPtr;n_buf++) {
17937 mem_base = xmlMemBlocks();
17938 buf = gen_const_xmlBufferPtr(n_buf, 0);
17939
William M. Brackf13f77f2004-11-12 16:03:48 +000017940 ret_val = xmlBufferContent((const xmlBufferPtr)buf);
Daniel Veillardce682bc2004-11-05 17:22:25 +000017941 desret_const_xmlChar_ptr(ret_val);
17942 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000017943 des_const_xmlBufferPtr(n_buf, (const xmlBufferPtr)buf, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000017944 xmlResetLastError();
17945 if (mem_base != xmlMemBlocks()) {
17946 printf("Leak of %d blocks found in xmlBufferContent",
17947 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017948 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017949 printf(" %d", n_buf);
17950 printf("\n");
17951 }
17952 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000017953 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017954
Daniel Veillard42595322004-11-08 10:52:06 +000017955 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017956}
17957
17958
17959static int
17960test_xmlBufferCreate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017961 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017962
Daniel Veillard3d95c732004-11-06 22:25:14 +000017963 int mem_base;
17964 xmlBufferPtr ret_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017965
Daniel Veillard3d95c732004-11-06 22:25:14 +000017966 mem_base = xmlMemBlocks();
17967
17968 ret_val = xmlBufferCreate();
17969 desret_xmlBufferPtr(ret_val);
17970 call_tests++;
17971 xmlResetLastError();
17972 if (mem_base != xmlMemBlocks()) {
17973 printf("Leak of %d blocks found in xmlBufferCreate",
17974 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017975 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000017976 printf("\n");
17977 }
Daniel Veillard3d95c732004-11-06 22:25:14 +000017978 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017979
Daniel Veillard42595322004-11-08 10:52:06 +000017980 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017981}
17982
17983
17984static int
17985test_xmlBufferCreateSize(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017986 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017987
17988
17989 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000017990 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017991}
17992
17993
17994static int
17995test_xmlBufferCreateStatic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017996 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017997
17998
17999 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000018000 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018001}
18002
18003
18004static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000018005test_xmlBufferEmpty(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018006 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018007
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018008 int mem_base;
18009 xmlBufferPtr buf; /* the buffer */
18010 int n_buf;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018011
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018012 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18013 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018014 buf = gen_xmlBufferPtr(n_buf, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018015
18016 xmlBufferEmpty(buf);
18017 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018018 des_xmlBufferPtr(n_buf, buf, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018019 xmlResetLastError();
18020 if (mem_base != xmlMemBlocks()) {
18021 printf("Leak of %d blocks found in xmlBufferEmpty",
18022 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018023 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018024 printf(" %d", n_buf);
18025 printf("\n");
18026 }
18027 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018028 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018029
Daniel Veillard42595322004-11-08 10:52:06 +000018030 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018031}
18032
18033
18034static int
18035test_xmlBufferGrow(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018036 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018037
Daniel Veillard3d97e662004-11-04 10:49:00 +000018038 int mem_base;
18039 int ret_val;
18040 xmlBufferPtr buf; /* the buffer */
18041 int n_buf;
18042 unsigned int len; /* the minimum free size to allocate */
18043 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018044
Daniel Veillard3d97e662004-11-04 10:49:00 +000018045 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18046 for (n_len = 0;n_len < gen_nb_unsigned_int;n_len++) {
18047 mem_base = xmlMemBlocks();
18048 buf = gen_xmlBufferPtr(n_buf, 0);
18049 len = gen_unsigned_int(n_len, 1);
18050
18051 ret_val = xmlBufferGrow(buf, len);
18052 desret_int(ret_val);
18053 call_tests++;
18054 des_xmlBufferPtr(n_buf, buf, 0);
18055 des_unsigned_int(n_len, len, 1);
18056 xmlResetLastError();
18057 if (mem_base != xmlMemBlocks()) {
18058 printf("Leak of %d blocks found in xmlBufferGrow",
18059 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018060 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018061 printf(" %d", n_buf);
18062 printf(" %d", n_len);
18063 printf("\n");
18064 }
18065 }
18066 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018067 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018068
Daniel Veillard42595322004-11-08 10:52:06 +000018069 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018070}
18071
18072
18073static int
18074test_xmlBufferLength(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018075 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018076
Daniel Veillardce682bc2004-11-05 17:22:25 +000018077 int mem_base;
18078 int ret_val;
18079 xmlBufferPtr buf; /* the buffer */
18080 int n_buf;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018081
Daniel Veillardce682bc2004-11-05 17:22:25 +000018082 for (n_buf = 0;n_buf < gen_nb_const_xmlBufferPtr;n_buf++) {
18083 mem_base = xmlMemBlocks();
18084 buf = gen_const_xmlBufferPtr(n_buf, 0);
18085
William M. Brackf13f77f2004-11-12 16:03:48 +000018086 ret_val = xmlBufferLength((const xmlBufferPtr)buf);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018087 desret_int(ret_val);
18088 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000018089 des_const_xmlBufferPtr(n_buf, (const xmlBufferPtr)buf, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018090 xmlResetLastError();
18091 if (mem_base != xmlMemBlocks()) {
18092 printf("Leak of %d blocks found in xmlBufferLength",
18093 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018094 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018095 printf(" %d", n_buf);
18096 printf("\n");
18097 }
18098 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000018099 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018100
Daniel Veillard42595322004-11-08 10:52:06 +000018101 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018102}
18103
18104
18105static int
18106test_xmlBufferResize(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018107 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018108
Daniel Veillard3d97e662004-11-04 10:49:00 +000018109 int mem_base;
18110 int ret_val;
18111 xmlBufferPtr buf; /* the buffer to resize */
18112 int n_buf;
18113 unsigned int size; /* the desired size */
18114 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018115
Daniel Veillard3d97e662004-11-04 10:49:00 +000018116 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18117 for (n_size = 0;n_size < gen_nb_unsigned_int;n_size++) {
18118 mem_base = xmlMemBlocks();
18119 buf = gen_xmlBufferPtr(n_buf, 0);
18120 size = gen_unsigned_int(n_size, 1);
18121
18122 ret_val = xmlBufferResize(buf, size);
18123 desret_int(ret_val);
18124 call_tests++;
18125 des_xmlBufferPtr(n_buf, buf, 0);
18126 des_unsigned_int(n_size, size, 1);
18127 xmlResetLastError();
18128 if (mem_base != xmlMemBlocks()) {
18129 printf("Leak of %d blocks found in xmlBufferResize",
18130 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018131 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018132 printf(" %d", n_buf);
18133 printf(" %d", n_size);
18134 printf("\n");
18135 }
18136 }
18137 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018138 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018139
Daniel Veillard42595322004-11-08 10:52:06 +000018140 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018141}
18142
18143
18144static int
18145test_xmlBufferSetAllocationScheme(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018146 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018147
Daniel Veillard57b25162004-11-06 14:50:18 +000018148 int mem_base;
18149 xmlBufferPtr buf; /* the buffer to tune */
18150 int n_buf;
18151 xmlBufferAllocationScheme scheme; /* allocation scheme to use */
18152 int n_scheme;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018153
Daniel Veillard57b25162004-11-06 14:50:18 +000018154 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18155 for (n_scheme = 0;n_scheme < gen_nb_xmlBufferAllocationScheme;n_scheme++) {
18156 mem_base = xmlMemBlocks();
18157 buf = gen_xmlBufferPtr(n_buf, 0);
18158 scheme = gen_xmlBufferAllocationScheme(n_scheme, 1);
18159
18160 xmlBufferSetAllocationScheme(buf, scheme);
18161 call_tests++;
18162 des_xmlBufferPtr(n_buf, buf, 0);
18163 des_xmlBufferAllocationScheme(n_scheme, scheme, 1);
18164 xmlResetLastError();
18165 if (mem_base != xmlMemBlocks()) {
18166 printf("Leak of %d blocks found in xmlBufferSetAllocationScheme",
18167 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018168 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000018169 printf(" %d", n_buf);
18170 printf(" %d", n_scheme);
18171 printf("\n");
18172 }
18173 }
18174 }
Daniel Veillard57b25162004-11-06 14:50:18 +000018175 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018176
Daniel Veillard42595322004-11-08 10:52:06 +000018177 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018178}
18179
18180
18181static int
18182test_xmlBufferShrink(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018183 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018184
Daniel Veillard3d97e662004-11-04 10:49:00 +000018185 int mem_base;
18186 int ret_val;
18187 xmlBufferPtr buf; /* the buffer to dump */
18188 int n_buf;
18189 unsigned int len; /* the number of xmlChar to remove */
18190 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018191
Daniel Veillard3d97e662004-11-04 10:49:00 +000018192 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18193 for (n_len = 0;n_len < gen_nb_unsigned_int;n_len++) {
18194 mem_base = xmlMemBlocks();
18195 buf = gen_xmlBufferPtr(n_buf, 0);
18196 len = gen_unsigned_int(n_len, 1);
18197
18198 ret_val = xmlBufferShrink(buf, len);
18199 desret_int(ret_val);
18200 call_tests++;
18201 des_xmlBufferPtr(n_buf, buf, 0);
18202 des_unsigned_int(n_len, len, 1);
18203 xmlResetLastError();
18204 if (mem_base != xmlMemBlocks()) {
18205 printf("Leak of %d blocks found in xmlBufferShrink",
18206 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018207 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018208 printf(" %d", n_buf);
18209 printf(" %d", n_len);
18210 printf("\n");
18211 }
18212 }
18213 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018214 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018215
Daniel Veillard42595322004-11-08 10:52:06 +000018216 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018217}
18218
18219
18220static int
18221test_xmlBufferWriteCHAR(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018222 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018223
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018224 int mem_base;
18225 xmlBufferPtr buf; /* the XML buffer */
18226 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018227 xmlChar * string; /* the string to add */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018228 int n_string;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018229
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018230 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18231 for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) {
18232 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018233 buf = gen_xmlBufferPtr(n_buf, 0);
18234 string = gen_const_xmlChar_ptr(n_string, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018235
William M. Brackf13f77f2004-11-12 16:03:48 +000018236 xmlBufferWriteCHAR(buf, (const xmlChar *)string);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018237 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018238 des_xmlBufferPtr(n_buf, buf, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000018239 des_const_xmlChar_ptr(n_string, (const xmlChar *)string, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018240 xmlResetLastError();
18241 if (mem_base != xmlMemBlocks()) {
18242 printf("Leak of %d blocks found in xmlBufferWriteCHAR",
18243 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018244 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018245 printf(" %d", n_buf);
18246 printf(" %d", n_string);
18247 printf("\n");
18248 }
18249 }
18250 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018251 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018252
Daniel Veillard42595322004-11-08 10:52:06 +000018253 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018254}
18255
18256
18257static int
18258test_xmlBufferWriteChar(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018259 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018260
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018261 int mem_base;
18262 xmlBufferPtr buf; /* the XML buffer output */
18263 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018264 char * string; /* the string to add */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018265 int n_string;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018266
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018267 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18268 for (n_string = 0;n_string < gen_nb_const_char_ptr;n_string++) {
18269 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018270 buf = gen_xmlBufferPtr(n_buf, 0);
18271 string = gen_const_char_ptr(n_string, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018272
William M. Brackf13f77f2004-11-12 16:03:48 +000018273 xmlBufferWriteChar(buf, (const char *)string);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018274 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018275 des_xmlBufferPtr(n_buf, buf, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000018276 des_const_char_ptr(n_string, (const char *)string, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018277 xmlResetLastError();
18278 if (mem_base != xmlMemBlocks()) {
18279 printf("Leak of %d blocks found in xmlBufferWriteChar",
18280 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018281 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018282 printf(" %d", n_buf);
18283 printf(" %d", n_string);
18284 printf("\n");
18285 }
18286 }
18287 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018288 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018289
Daniel Veillard42595322004-11-08 10:52:06 +000018290 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018291}
18292
18293
18294static int
18295test_xmlBufferWriteQuotedString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018296 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018297
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018298 int mem_base;
18299 xmlBufferPtr buf; /* the XML buffer output */
18300 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018301 xmlChar * string; /* the string to add */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018302 int n_string;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018303
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018304 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18305 for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) {
18306 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018307 buf = gen_xmlBufferPtr(n_buf, 0);
18308 string = gen_const_xmlChar_ptr(n_string, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018309
William M. Brackf13f77f2004-11-12 16:03:48 +000018310 xmlBufferWriteQuotedString(buf, (const xmlChar *)string);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018311 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018312 des_xmlBufferPtr(n_buf, buf, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000018313 des_const_xmlChar_ptr(n_string, (const xmlChar *)string, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018314 xmlResetLastError();
18315 if (mem_base != xmlMemBlocks()) {
18316 printf("Leak of %d blocks found in xmlBufferWriteQuotedString",
18317 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018318 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018319 printf(" %d", n_buf);
18320 printf(" %d", n_string);
18321 printf("\n");
18322 }
18323 }
18324 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018325 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018326
Daniel Veillard42595322004-11-08 10:52:06 +000018327 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018328}
18329
18330
18331static int
18332test_xmlBuildQName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018333 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018334
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018335 int mem_base;
18336 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018337 xmlChar * ncname; /* the Name */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018338 int n_ncname;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018339 xmlChar * prefix; /* the prefix */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018340 int n_prefix;
18341 xmlChar * memory; /* preallocated memory */
18342 int n_memory;
18343 int len; /* preallocated memory length */
18344 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018345
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018346 for (n_ncname = 0;n_ncname < gen_nb_const_xmlChar_ptr;n_ncname++) {
18347 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
18348 for (n_memory = 0;n_memory < gen_nb_xmlChar_ptr;n_memory++) {
18349 for (n_len = 0;n_len < gen_nb_int;n_len++) {
18350 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018351 ncname = gen_const_xmlChar_ptr(n_ncname, 0);
18352 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
18353 memory = gen_xmlChar_ptr(n_memory, 2);
18354 len = gen_int(n_len, 3);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018355
William M. Brackf13f77f2004-11-12 16:03:48 +000018356 ret_val = xmlBuildQName((const xmlChar *)ncname, (const xmlChar *)prefix, memory, len);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018357 if ((ret_val != NULL) && (ret_val != ncname) &&
18358 (ret_val != prefix) && (ret_val != memory))
18359 xmlFree(ret_val);
18360 ret_val = NULL;
18361 desret_xmlChar_ptr(ret_val);
18362 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000018363 des_const_xmlChar_ptr(n_ncname, (const xmlChar *)ncname, 0);
18364 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000018365 des_xmlChar_ptr(n_memory, memory, 2);
18366 des_int(n_len, len, 3);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018367 xmlResetLastError();
18368 if (mem_base != xmlMemBlocks()) {
18369 printf("Leak of %d blocks found in xmlBuildQName",
18370 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018371 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018372 printf(" %d", n_ncname);
18373 printf(" %d", n_prefix);
18374 printf(" %d", n_memory);
18375 printf(" %d", n_len);
18376 printf("\n");
18377 }
18378 }
18379 }
18380 }
18381 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018382 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018383
Daniel Veillard42595322004-11-08 10:52:06 +000018384 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018385}
18386
18387
18388static int
18389test_xmlCopyDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018390 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018391
William M. Brack21e4ef22005-01-02 09:53:13 +000018392#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000018393 int mem_base;
18394 xmlDocPtr ret_val;
18395 xmlDocPtr doc; /* the document */
18396 int n_doc;
18397 int recursive; /* if not zero do a recursive copy. */
18398 int n_recursive;
18399
18400 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
18401 for (n_recursive = 0;n_recursive < gen_nb_int;n_recursive++) {
18402 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018403 doc = gen_xmlDocPtr(n_doc, 0);
18404 recursive = gen_int(n_recursive, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018405
18406 ret_val = xmlCopyDoc(doc, recursive);
18407 desret_xmlDocPtr(ret_val);
18408 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018409 des_xmlDocPtr(n_doc, doc, 0);
18410 des_int(n_recursive, recursive, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018411 xmlResetLastError();
18412 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000018413 printf("Leak of %d blocks found in xmlCopyDoc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000018414 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018415 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000018416 printf(" %d", n_doc);
18417 printf(" %d", n_recursive);
18418 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000018419 }
18420 }
18421 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018422 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018423#endif
18424
Daniel Veillard42595322004-11-08 10:52:06 +000018425 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018426}
18427
18428
18429static int
18430test_xmlCopyDtd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018431 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018432
William M. Brack21e4ef22005-01-02 09:53:13 +000018433#if defined(LIBXML_TREE_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000018434 int mem_base;
18435 xmlDtdPtr ret_val;
18436 xmlDtdPtr dtd; /* the dtd */
18437 int n_dtd;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018438
Daniel Veillard27f20102004-11-05 11:50:11 +000018439 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
18440 mem_base = xmlMemBlocks();
18441 dtd = gen_xmlDtdPtr(n_dtd, 0);
18442
18443 ret_val = xmlCopyDtd(dtd);
18444 desret_xmlDtdPtr(ret_val);
18445 call_tests++;
18446 des_xmlDtdPtr(n_dtd, dtd, 0);
18447 xmlResetLastError();
18448 if (mem_base != xmlMemBlocks()) {
18449 printf("Leak of %d blocks found in xmlCopyDtd",
18450 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018451 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000018452 printf(" %d", n_dtd);
18453 printf("\n");
18454 }
18455 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018456 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000018457#endif
18458
Daniel Veillard42595322004-11-08 10:52:06 +000018459 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018460}
18461
18462
18463static int
18464test_xmlCopyNamespace(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018465 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018466
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018467 int mem_base;
18468 xmlNsPtr ret_val;
18469 xmlNsPtr cur; /* the namespace */
18470 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018471
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018472 for (n_cur = 0;n_cur < gen_nb_xmlNsPtr;n_cur++) {
18473 mem_base = xmlMemBlocks();
18474 cur = gen_xmlNsPtr(n_cur, 0);
18475
18476 ret_val = xmlCopyNamespace(cur);
18477 if (ret_val != NULL) xmlFreeNs(ret_val);
18478 desret_xmlNsPtr(ret_val);
18479 call_tests++;
18480 des_xmlNsPtr(n_cur, cur, 0);
18481 xmlResetLastError();
18482 if (mem_base != xmlMemBlocks()) {
18483 printf("Leak of %d blocks found in xmlCopyNamespace",
18484 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018485 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018486 printf(" %d", n_cur);
18487 printf("\n");
18488 }
18489 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018490 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018491
Daniel Veillard42595322004-11-08 10:52:06 +000018492 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018493}
18494
18495
18496static int
18497test_xmlCopyNamespaceList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018498 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018499
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018500 int mem_base;
18501 xmlNsPtr ret_val;
18502 xmlNsPtr cur; /* the first namespace */
18503 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018504
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018505 for (n_cur = 0;n_cur < gen_nb_xmlNsPtr;n_cur++) {
18506 mem_base = xmlMemBlocks();
18507 cur = gen_xmlNsPtr(n_cur, 0);
18508
18509 ret_val = xmlCopyNamespaceList(cur);
18510 if (ret_val != NULL) xmlFreeNsList(ret_val);
18511 desret_xmlNsPtr(ret_val);
18512 call_tests++;
18513 des_xmlNsPtr(n_cur, cur, 0);
18514 xmlResetLastError();
18515 if (mem_base != xmlMemBlocks()) {
18516 printf("Leak of %d blocks found in xmlCopyNamespaceList",
18517 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018518 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018519 printf(" %d", n_cur);
18520 printf("\n");
18521 }
18522 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018523 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018524
Daniel Veillard42595322004-11-08 10:52:06 +000018525 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018526}
18527
18528
18529static int
18530test_xmlCopyNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018531 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018532
Daniel Veillardce682bc2004-11-05 17:22:25 +000018533 int mem_base;
18534 xmlNodePtr ret_val;
18535 xmlNodePtr node; /* the node */
18536 int n_node;
18537 int extended; /* if 1 do a recursive copy (properties, namespaces and children when applicable) if 2 copy properties and namespaces (when applicable) */
18538 int n_extended;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018539
Daniel Veillardce682bc2004-11-05 17:22:25 +000018540 for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) {
18541 for (n_extended = 0;n_extended < gen_nb_int;n_extended++) {
18542 mem_base = xmlMemBlocks();
18543 node = gen_const_xmlNodePtr(n_node, 0);
18544 extended = gen_int(n_extended, 1);
18545
William M. Brackf13f77f2004-11-12 16:03:48 +000018546 ret_val = xmlCopyNode((const xmlNodePtr)node, extended);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018547 desret_xmlNodePtr(ret_val);
18548 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000018549 des_const_xmlNodePtr(n_node, (const xmlNodePtr)node, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018550 des_int(n_extended, extended, 1);
18551 xmlResetLastError();
18552 if (mem_base != xmlMemBlocks()) {
18553 printf("Leak of %d blocks found in xmlCopyNode",
18554 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018555 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018556 printf(" %d", n_node);
18557 printf(" %d", n_extended);
18558 printf("\n");
18559 }
18560 }
18561 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000018562 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018563
Daniel Veillard42595322004-11-08 10:52:06 +000018564 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018565}
18566
18567
18568static int
18569test_xmlCopyNodeList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018570 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018571
Daniel Veillardce682bc2004-11-05 17:22:25 +000018572 int mem_base;
18573 xmlNodePtr ret_val;
18574 xmlNodePtr node; /* the first node in the list. */
18575 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018576
Daniel Veillardce682bc2004-11-05 17:22:25 +000018577 for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) {
18578 mem_base = xmlMemBlocks();
18579 node = gen_const_xmlNodePtr(n_node, 0);
18580
William M. Brackf13f77f2004-11-12 16:03:48 +000018581 ret_val = xmlCopyNodeList((const xmlNodePtr)node);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018582 desret_xmlNodePtr(ret_val);
18583 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000018584 des_const_xmlNodePtr(n_node, (const xmlNodePtr)node, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018585 xmlResetLastError();
18586 if (mem_base != xmlMemBlocks()) {
18587 printf("Leak of %d blocks found in xmlCopyNodeList",
18588 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018589 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018590 printf(" %d", n_node);
18591 printf("\n");
18592 }
18593 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000018594 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018595
Daniel Veillard42595322004-11-08 10:52:06 +000018596 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018597}
18598
18599
18600static int
18601test_xmlCopyProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018602 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018603
Daniel Veillard57b25162004-11-06 14:50:18 +000018604 int mem_base;
18605 xmlAttrPtr ret_val;
18606 xmlNodePtr target; /* the element where the attribute will be grafted */
18607 int n_target;
18608 xmlAttrPtr cur; /* the attribute */
18609 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018610
Daniel Veillard57b25162004-11-06 14:50:18 +000018611 for (n_target = 0;n_target < gen_nb_xmlNodePtr;n_target++) {
18612 for (n_cur = 0;n_cur < gen_nb_xmlAttrPtr;n_cur++) {
18613 mem_base = xmlMemBlocks();
18614 target = gen_xmlNodePtr(n_target, 0);
18615 cur = gen_xmlAttrPtr(n_cur, 1);
18616
18617 ret_val = xmlCopyProp(target, cur);
18618 desret_xmlAttrPtr(ret_val);
18619 call_tests++;
18620 des_xmlNodePtr(n_target, target, 0);
18621 des_xmlAttrPtr(n_cur, cur, 1);
18622 xmlResetLastError();
18623 if (mem_base != xmlMemBlocks()) {
18624 printf("Leak of %d blocks found in xmlCopyProp",
18625 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018626 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000018627 printf(" %d", n_target);
18628 printf(" %d", n_cur);
18629 printf("\n");
18630 }
18631 }
18632 }
Daniel Veillard57b25162004-11-06 14:50:18 +000018633 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018634
Daniel Veillard42595322004-11-08 10:52:06 +000018635 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018636}
18637
18638
18639static int
18640test_xmlCopyPropList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018641 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018642
Daniel Veillard57b25162004-11-06 14:50:18 +000018643 int mem_base;
18644 xmlAttrPtr ret_val;
18645 xmlNodePtr target; /* the element where the attributes will be grafted */
18646 int n_target;
18647 xmlAttrPtr cur; /* the first attribute */
18648 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018649
Daniel Veillard57b25162004-11-06 14:50:18 +000018650 for (n_target = 0;n_target < gen_nb_xmlNodePtr;n_target++) {
18651 for (n_cur = 0;n_cur < gen_nb_xmlAttrPtr;n_cur++) {
18652 mem_base = xmlMemBlocks();
18653 target = gen_xmlNodePtr(n_target, 0);
18654 cur = gen_xmlAttrPtr(n_cur, 1);
18655
18656 ret_val = xmlCopyPropList(target, cur);
18657 desret_xmlAttrPtr(ret_val);
18658 call_tests++;
18659 des_xmlNodePtr(n_target, target, 0);
18660 des_xmlAttrPtr(n_cur, cur, 1);
18661 xmlResetLastError();
18662 if (mem_base != xmlMemBlocks()) {
18663 printf("Leak of %d blocks found in xmlCopyPropList",
18664 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018665 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000018666 printf(" %d", n_target);
18667 printf(" %d", n_cur);
18668 printf("\n");
18669 }
18670 }
18671 }
Daniel Veillard57b25162004-11-06 14:50:18 +000018672 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018673
Daniel Veillard42595322004-11-08 10:52:06 +000018674 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018675}
18676
18677
18678static int
18679test_xmlCreateIntSubset(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018680 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018681
Daniel Veillard34099b42004-11-04 17:34:35 +000018682 int mem_base;
18683 xmlDtdPtr ret_val;
18684 xmlDocPtr doc; /* the document pointer */
18685 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018686 xmlChar * name; /* the DTD name */
Daniel Veillard34099b42004-11-04 17:34:35 +000018687 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018688 xmlChar * ExternalID; /* the external (PUBLIC) ID */
Daniel Veillard34099b42004-11-04 17:34:35 +000018689 int n_ExternalID;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018690 xmlChar * SystemID; /* the system ID */
Daniel Veillard34099b42004-11-04 17:34:35 +000018691 int n_SystemID;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018692
Daniel Veillard34099b42004-11-04 17:34:35 +000018693 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
18694 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
18695 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
18696 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
18697 mem_base = xmlMemBlocks();
18698 doc = gen_xmlDocPtr(n_doc, 0);
18699 name = gen_const_xmlChar_ptr(n_name, 1);
18700 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 2);
18701 SystemID = gen_const_xmlChar_ptr(n_SystemID, 3);
18702
William M. Brackf13f77f2004-11-12 16:03:48 +000018703 ret_val = xmlCreateIntSubset(doc, (const xmlChar *)name, (const xmlChar *)ExternalID, (const xmlChar *)SystemID);
Daniel Veillard34099b42004-11-04 17:34:35 +000018704 desret_xmlDtdPtr(ret_val);
18705 call_tests++;
18706 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000018707 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
18708 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 2);
18709 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 3);
Daniel Veillard34099b42004-11-04 17:34:35 +000018710 xmlResetLastError();
18711 if (mem_base != xmlMemBlocks()) {
18712 printf("Leak of %d blocks found in xmlCreateIntSubset",
18713 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018714 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000018715 printf(" %d", n_doc);
18716 printf(" %d", n_name);
18717 printf(" %d", n_ExternalID);
18718 printf(" %d", n_SystemID);
18719 printf("\n");
18720 }
18721 }
18722 }
18723 }
18724 }
Daniel Veillard34099b42004-11-04 17:34:35 +000018725 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018726
Daniel Veillard42595322004-11-08 10:52:06 +000018727 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018728}
18729
18730
18731static int
18732test_xmlDocCopyNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018733 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018734
Daniel Veillardce682bc2004-11-05 17:22:25 +000018735 int mem_base;
18736 xmlNodePtr ret_val;
18737 xmlNodePtr node; /* the node */
18738 int n_node;
18739 xmlDocPtr doc; /* the document */
18740 int n_doc;
18741 int extended; /* if 1 do a recursive copy (properties, namespaces and children when applicable) if 2 copy properties and namespaces (when applicable) */
18742 int n_extended;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018743
Daniel Veillardce682bc2004-11-05 17:22:25 +000018744 for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) {
18745 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
18746 for (n_extended = 0;n_extended < gen_nb_int;n_extended++) {
18747 mem_base = xmlMemBlocks();
18748 node = gen_const_xmlNodePtr(n_node, 0);
18749 doc = gen_xmlDocPtr(n_doc, 1);
18750 extended = gen_int(n_extended, 2);
18751
William M. Brackf13f77f2004-11-12 16:03:48 +000018752 ret_val = xmlDocCopyNode((const xmlNodePtr)node, doc, extended);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018753 desret_xmlNodePtr(ret_val);
18754 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000018755 des_const_xmlNodePtr(n_node, (const xmlNodePtr)node, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018756 des_xmlDocPtr(n_doc, doc, 1);
18757 des_int(n_extended, extended, 2);
18758 xmlResetLastError();
18759 if (mem_base != xmlMemBlocks()) {
18760 printf("Leak of %d blocks found in xmlDocCopyNode",
18761 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018762 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018763 printf(" %d", n_node);
18764 printf(" %d", n_doc);
18765 printf(" %d", n_extended);
18766 printf("\n");
18767 }
18768 }
18769 }
18770 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000018771 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018772
Daniel Veillard42595322004-11-08 10:52:06 +000018773 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018774}
18775
18776
18777static int
18778test_xmlDocCopyNodeList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018779 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018780
Daniel Veillardce682bc2004-11-05 17:22:25 +000018781 int mem_base;
18782 xmlNodePtr ret_val;
18783 xmlDocPtr doc; /* the target document */
18784 int n_doc;
18785 xmlNodePtr node; /* the first node in the list. */
18786 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018787
Daniel Veillardce682bc2004-11-05 17:22:25 +000018788 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
18789 for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) {
18790 mem_base = xmlMemBlocks();
18791 doc = gen_xmlDocPtr(n_doc, 0);
18792 node = gen_const_xmlNodePtr(n_node, 1);
18793
William M. Brackf13f77f2004-11-12 16:03:48 +000018794 ret_val = xmlDocCopyNodeList(doc, (const xmlNodePtr)node);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018795 desret_xmlNodePtr(ret_val);
18796 call_tests++;
18797 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000018798 des_const_xmlNodePtr(n_node, (const xmlNodePtr)node, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018799 xmlResetLastError();
18800 if (mem_base != xmlMemBlocks()) {
18801 printf("Leak of %d blocks found in xmlDocCopyNodeList",
18802 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018803 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018804 printf(" %d", n_doc);
18805 printf(" %d", n_node);
18806 printf("\n");
18807 }
18808 }
18809 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000018810 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018811
Daniel Veillard42595322004-11-08 10:52:06 +000018812 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018813}
18814
18815
18816static int
18817test_xmlDocDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018818 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018819
William M. Brack21e4ef22005-01-02 09:53:13 +000018820#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000018821 int mem_base;
18822 int ret_val;
18823 FILE * f; /* the FILE* */
18824 int n_f;
18825 xmlDocPtr cur; /* the document */
18826 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018827
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000018828 for (n_f = 0;n_f < gen_nb_FILE_ptr;n_f++) {
18829 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
18830 mem_base = xmlMemBlocks();
18831 f = gen_FILE_ptr(n_f, 0);
18832 cur = gen_xmlDocPtr(n_cur, 1);
18833
18834 ret_val = xmlDocDump(f, cur);
18835 desret_int(ret_val);
18836 call_tests++;
18837 des_FILE_ptr(n_f, f, 0);
18838 des_xmlDocPtr(n_cur, cur, 1);
18839 xmlResetLastError();
18840 if (mem_base != xmlMemBlocks()) {
18841 printf("Leak of %d blocks found in xmlDocDump",
18842 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018843 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000018844 printf(" %d", n_f);
18845 printf(" %d", n_cur);
18846 printf("\n");
18847 }
18848 }
18849 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018850 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000018851#endif
18852
Daniel Veillard42595322004-11-08 10:52:06 +000018853 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018854}
18855
18856
18857static int
18858test_xmlDocDumpFormatMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018859 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018860
William M. Brack21e4ef22005-01-02 09:53:13 +000018861#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018862 int mem_base;
18863 xmlDocPtr cur; /* the document */
18864 int n_cur;
18865 xmlChar ** mem; /* OUT: the memory pointer */
18866 int n_mem;
18867 int * size; /* OUT: the memory length */
18868 int n_size;
18869 int format; /* should formatting spaces been added */
18870 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018871
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018872 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
18873 for (n_mem = 0;n_mem < gen_nb_xmlChar_ptr_ptr;n_mem++) {
18874 for (n_size = 0;n_size < gen_nb_int_ptr;n_size++) {
18875 for (n_format = 0;n_format < gen_nb_int;n_format++) {
18876 mem_base = xmlMemBlocks();
18877 cur = gen_xmlDocPtr(n_cur, 0);
18878 mem = gen_xmlChar_ptr_ptr(n_mem, 1);
18879 size = gen_int_ptr(n_size, 2);
18880 format = gen_int(n_format, 3);
18881
18882 xmlDocDumpFormatMemory(cur, mem, size, format);
18883 call_tests++;
18884 des_xmlDocPtr(n_cur, cur, 0);
18885 des_xmlChar_ptr_ptr(n_mem, mem, 1);
18886 des_int_ptr(n_size, size, 2);
18887 des_int(n_format, format, 3);
18888 xmlResetLastError();
18889 if (mem_base != xmlMemBlocks()) {
18890 printf("Leak of %d blocks found in xmlDocDumpFormatMemory",
18891 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018892 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018893 printf(" %d", n_cur);
18894 printf(" %d", n_mem);
18895 printf(" %d", n_size);
18896 printf(" %d", n_format);
18897 printf("\n");
18898 }
18899 }
18900 }
18901 }
18902 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018903 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018904#endif
18905
Daniel Veillard42595322004-11-08 10:52:06 +000018906 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018907}
18908
18909
18910static int
18911test_xmlDocDumpFormatMemoryEnc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018912 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018913
William M. Brack21e4ef22005-01-02 09:53:13 +000018914#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018915 int mem_base;
18916 xmlDocPtr out_doc; /* Document to generate XML text from */
18917 int n_out_doc;
18918 xmlChar ** doc_txt_ptr; /* Memory pointer for allocated XML text */
18919 int n_doc_txt_ptr;
18920 int * doc_txt_len; /* Length of the generated XML text */
18921 int n_doc_txt_len;
18922 char * txt_encoding; /* Character encoding to use when generating XML text */
18923 int n_txt_encoding;
18924 int format; /* should formatting spaces been added */
18925 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018926
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018927 for (n_out_doc = 0;n_out_doc < gen_nb_xmlDocPtr;n_out_doc++) {
18928 for (n_doc_txt_ptr = 0;n_doc_txt_ptr < gen_nb_xmlChar_ptr_ptr;n_doc_txt_ptr++) {
18929 for (n_doc_txt_len = 0;n_doc_txt_len < gen_nb_int_ptr;n_doc_txt_len++) {
18930 for (n_txt_encoding = 0;n_txt_encoding < gen_nb_const_char_ptr;n_txt_encoding++) {
18931 for (n_format = 0;n_format < gen_nb_int;n_format++) {
18932 mem_base = xmlMemBlocks();
18933 out_doc = gen_xmlDocPtr(n_out_doc, 0);
18934 doc_txt_ptr = gen_xmlChar_ptr_ptr(n_doc_txt_ptr, 1);
18935 doc_txt_len = gen_int_ptr(n_doc_txt_len, 2);
18936 txt_encoding = gen_const_char_ptr(n_txt_encoding, 3);
18937 format = gen_int(n_format, 4);
18938
William M. Brackf13f77f2004-11-12 16:03:48 +000018939 xmlDocDumpFormatMemoryEnc(out_doc, doc_txt_ptr, doc_txt_len, (const char *)txt_encoding, format);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018940 call_tests++;
18941 des_xmlDocPtr(n_out_doc, out_doc, 0);
18942 des_xmlChar_ptr_ptr(n_doc_txt_ptr, doc_txt_ptr, 1);
18943 des_int_ptr(n_doc_txt_len, doc_txt_len, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000018944 des_const_char_ptr(n_txt_encoding, (const char *)txt_encoding, 3);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018945 des_int(n_format, format, 4);
18946 xmlResetLastError();
18947 if (mem_base != xmlMemBlocks()) {
18948 printf("Leak of %d blocks found in xmlDocDumpFormatMemoryEnc",
18949 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018950 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018951 printf(" %d", n_out_doc);
18952 printf(" %d", n_doc_txt_ptr);
18953 printf(" %d", n_doc_txt_len);
18954 printf(" %d", n_txt_encoding);
18955 printf(" %d", n_format);
18956 printf("\n");
18957 }
18958 }
18959 }
18960 }
18961 }
18962 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018963 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018964#endif
18965
Daniel Veillard42595322004-11-08 10:52:06 +000018966 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018967}
18968
18969
18970static int
18971test_xmlDocDumpMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018972 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018973
William M. Brack21e4ef22005-01-02 09:53:13 +000018974#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018975 int mem_base;
18976 xmlDocPtr cur; /* the document */
18977 int n_cur;
18978 xmlChar ** mem; /* OUT: the memory pointer */
18979 int n_mem;
18980 int * size; /* OUT: the memory length */
18981 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018982
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018983 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
18984 for (n_mem = 0;n_mem < gen_nb_xmlChar_ptr_ptr;n_mem++) {
18985 for (n_size = 0;n_size < gen_nb_int_ptr;n_size++) {
18986 mem_base = xmlMemBlocks();
18987 cur = gen_xmlDocPtr(n_cur, 0);
18988 mem = gen_xmlChar_ptr_ptr(n_mem, 1);
18989 size = gen_int_ptr(n_size, 2);
18990
18991 xmlDocDumpMemory(cur, mem, size);
18992 call_tests++;
18993 des_xmlDocPtr(n_cur, cur, 0);
18994 des_xmlChar_ptr_ptr(n_mem, mem, 1);
18995 des_int_ptr(n_size, size, 2);
18996 xmlResetLastError();
18997 if (mem_base != xmlMemBlocks()) {
18998 printf("Leak of %d blocks found in xmlDocDumpMemory",
18999 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019000 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019001 printf(" %d", n_cur);
19002 printf(" %d", n_mem);
19003 printf(" %d", n_size);
19004 printf("\n");
19005 }
19006 }
19007 }
19008 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019009 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019010#endif
19011
Daniel Veillard42595322004-11-08 10:52:06 +000019012 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019013}
19014
19015
19016static int
19017test_xmlDocDumpMemoryEnc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019018 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019019
William M. Brack21e4ef22005-01-02 09:53:13 +000019020#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019021 int mem_base;
19022 xmlDocPtr out_doc; /* Document to generate XML text from */
19023 int n_out_doc;
19024 xmlChar ** doc_txt_ptr; /* Memory pointer for allocated XML text */
19025 int n_doc_txt_ptr;
19026 int * doc_txt_len; /* Length of the generated XML text */
19027 int n_doc_txt_len;
19028 char * txt_encoding; /* Character encoding to use when generating XML text */
19029 int n_txt_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019030
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019031 for (n_out_doc = 0;n_out_doc < gen_nb_xmlDocPtr;n_out_doc++) {
19032 for (n_doc_txt_ptr = 0;n_doc_txt_ptr < gen_nb_xmlChar_ptr_ptr;n_doc_txt_ptr++) {
19033 for (n_doc_txt_len = 0;n_doc_txt_len < gen_nb_int_ptr;n_doc_txt_len++) {
19034 for (n_txt_encoding = 0;n_txt_encoding < gen_nb_const_char_ptr;n_txt_encoding++) {
19035 mem_base = xmlMemBlocks();
19036 out_doc = gen_xmlDocPtr(n_out_doc, 0);
19037 doc_txt_ptr = gen_xmlChar_ptr_ptr(n_doc_txt_ptr, 1);
19038 doc_txt_len = gen_int_ptr(n_doc_txt_len, 2);
19039 txt_encoding = gen_const_char_ptr(n_txt_encoding, 3);
19040
William M. Brackf13f77f2004-11-12 16:03:48 +000019041 xmlDocDumpMemoryEnc(out_doc, doc_txt_ptr, doc_txt_len, (const char *)txt_encoding);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019042 call_tests++;
19043 des_xmlDocPtr(n_out_doc, out_doc, 0);
19044 des_xmlChar_ptr_ptr(n_doc_txt_ptr, doc_txt_ptr, 1);
19045 des_int_ptr(n_doc_txt_len, doc_txt_len, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000019046 des_const_char_ptr(n_txt_encoding, (const char *)txt_encoding, 3);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019047 xmlResetLastError();
19048 if (mem_base != xmlMemBlocks()) {
19049 printf("Leak of %d blocks found in xmlDocDumpMemoryEnc",
19050 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019051 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019052 printf(" %d", n_out_doc);
19053 printf(" %d", n_doc_txt_ptr);
19054 printf(" %d", n_doc_txt_len);
19055 printf(" %d", n_txt_encoding);
19056 printf("\n");
19057 }
19058 }
19059 }
19060 }
19061 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019062 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019063#endif
19064
Daniel Veillard42595322004-11-08 10:52:06 +000019065 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019066}
19067
19068
19069static int
19070test_xmlDocFormatDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019071 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019072
William M. Brack21e4ef22005-01-02 09:53:13 +000019073#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019074 int mem_base;
19075 int ret_val;
19076 FILE * f; /* the FILE* */
19077 int n_f;
19078 xmlDocPtr cur; /* the document */
19079 int n_cur;
19080 int format; /* should formatting spaces been added */
19081 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019082
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019083 for (n_f = 0;n_f < gen_nb_FILE_ptr;n_f++) {
19084 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
19085 for (n_format = 0;n_format < gen_nb_int;n_format++) {
19086 mem_base = xmlMemBlocks();
19087 f = gen_FILE_ptr(n_f, 0);
19088 cur = gen_xmlDocPtr(n_cur, 1);
19089 format = gen_int(n_format, 2);
19090
19091 ret_val = xmlDocFormatDump(f, cur, format);
19092 desret_int(ret_val);
19093 call_tests++;
19094 des_FILE_ptr(n_f, f, 0);
19095 des_xmlDocPtr(n_cur, cur, 1);
19096 des_int(n_format, format, 2);
19097 xmlResetLastError();
19098 if (mem_base != xmlMemBlocks()) {
19099 printf("Leak of %d blocks found in xmlDocFormatDump",
19100 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019101 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019102 printf(" %d", n_f);
19103 printf(" %d", n_cur);
19104 printf(" %d", n_format);
19105 printf("\n");
19106 }
19107 }
19108 }
19109 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019110 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019111#endif
19112
Daniel Veillard42595322004-11-08 10:52:06 +000019113 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019114}
19115
19116
19117static int
19118test_xmlDocGetRootElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019119 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019120
19121 int mem_base;
19122 xmlNodePtr ret_val;
19123 xmlDocPtr doc; /* the document */
19124 int n_doc;
19125
19126 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19127 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019128 doc = gen_xmlDocPtr(n_doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019129
19130 ret_val = xmlDocGetRootElement(doc);
19131 desret_xmlNodePtr(ret_val);
19132 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019133 des_xmlDocPtr(n_doc, doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019134 xmlResetLastError();
19135 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019136 printf("Leak of %d blocks found in xmlDocGetRootElement",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019137 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019138 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019139 printf(" %d", n_doc);
19140 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019141 }
19142 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019143 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019144
Daniel Veillard42595322004-11-08 10:52:06 +000019145 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019146}
19147
19148
19149static int
19150test_xmlDocSetRootElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019151 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019152
William M. Brack21e4ef22005-01-02 09:53:13 +000019153#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000019154 int mem_base;
19155 xmlNodePtr ret_val;
19156 xmlDocPtr doc; /* the document */
19157 int n_doc;
19158 xmlNodePtr root; /* the new document root element */
19159 int n_root;
19160
19161 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019162 for (n_root = 0;n_root < gen_nb_xmlNodePtr_in;n_root++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000019163 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019164 doc = gen_xmlDocPtr(n_doc, 0);
19165 root = gen_xmlNodePtr_in(n_root, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019166
19167 ret_val = xmlDocSetRootElement(doc, root);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019168 if (doc == NULL) { xmlFreeNode(root) ; root = NULL ; }
Daniel Veillardd93f6252004-11-02 15:53:51 +000019169 desret_xmlNodePtr(ret_val);
19170 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019171 des_xmlDocPtr(n_doc, doc, 0);
19172 des_xmlNodePtr_in(n_root, root, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019173 xmlResetLastError();
19174 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019175 printf("Leak of %d blocks found in xmlDocSetRootElement",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019176 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019177 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019178 printf(" %d", n_doc);
19179 printf(" %d", n_root);
19180 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019181 }
19182 }
19183 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019184 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019185#endif
19186
Daniel Veillard42595322004-11-08 10:52:06 +000019187 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019188}
19189
19190
19191static int
19192test_xmlElemDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019193 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019194
William M. Brack21e4ef22005-01-02 09:53:13 +000019195#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019196 int mem_base;
19197 FILE * f; /* the FILE * for the output */
19198 int n_f;
19199 xmlDocPtr doc; /* the document */
19200 int n_doc;
19201 xmlNodePtr cur; /* the current node */
19202 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019203
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019204 for (n_f = 0;n_f < gen_nb_FILE_ptr;n_f++) {
19205 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19206 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
19207 mem_base = xmlMemBlocks();
19208 f = gen_FILE_ptr(n_f, 0);
19209 doc = gen_xmlDocPtr(n_doc, 1);
19210 cur = gen_xmlNodePtr(n_cur, 2);
19211
19212 xmlElemDump(f, doc, cur);
19213 call_tests++;
19214 des_FILE_ptr(n_f, f, 0);
19215 des_xmlDocPtr(n_doc, doc, 1);
19216 des_xmlNodePtr(n_cur, cur, 2);
19217 xmlResetLastError();
19218 if (mem_base != xmlMemBlocks()) {
19219 printf("Leak of %d blocks found in xmlElemDump",
19220 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019221 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019222 printf(" %d", n_f);
19223 printf(" %d", n_doc);
19224 printf(" %d", n_cur);
19225 printf("\n");
19226 }
19227 }
19228 }
19229 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019230 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019231#endif
19232
Daniel Veillard42595322004-11-08 10:52:06 +000019233 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019234}
19235
19236
19237static int
19238test_xmlGetBufferAllocationScheme(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019239 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019240
Daniel Veillard57b25162004-11-06 14:50:18 +000019241 int mem_base;
19242 xmlBufferAllocationScheme ret_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019243
Daniel Veillard57b25162004-11-06 14:50:18 +000019244 mem_base = xmlMemBlocks();
19245
19246 ret_val = xmlGetBufferAllocationScheme();
19247 desret_xmlBufferAllocationScheme(ret_val);
19248 call_tests++;
19249 xmlResetLastError();
19250 if (mem_base != xmlMemBlocks()) {
19251 printf("Leak of %d blocks found in xmlGetBufferAllocationScheme",
19252 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019253 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000019254 printf("\n");
19255 }
Daniel Veillard57b25162004-11-06 14:50:18 +000019256 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019257
Daniel Veillard42595322004-11-08 10:52:06 +000019258 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019259}
19260
19261
19262static int
19263test_xmlGetCompressMode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019264 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019265
19266 int mem_base;
19267 int ret_val;
19268
19269 mem_base = xmlMemBlocks();
19270
19271 ret_val = xmlGetCompressMode();
19272 desret_int(ret_val);
19273 call_tests++;
19274 xmlResetLastError();
19275 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019276 printf("Leak of %d blocks found in xmlGetCompressMode",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019277 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019278 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019279 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019280 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019281 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019282
Daniel Veillard42595322004-11-08 10:52:06 +000019283 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019284}
19285
19286
19287static int
19288test_xmlGetDocCompressMode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019289 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019290
19291 int mem_base;
19292 int ret_val;
19293 xmlDocPtr doc; /* the document */
19294 int n_doc;
19295
19296 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19297 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019298 doc = gen_xmlDocPtr(n_doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019299
19300 ret_val = xmlGetDocCompressMode(doc);
19301 desret_int(ret_val);
19302 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019303 des_xmlDocPtr(n_doc, doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019304 xmlResetLastError();
19305 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019306 printf("Leak of %d blocks found in xmlGetDocCompressMode",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019307 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019308 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019309 printf(" %d", n_doc);
19310 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019311 }
19312 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019313 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019314
Daniel Veillard42595322004-11-08 10:52:06 +000019315 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019316}
19317
19318
19319static int
19320test_xmlGetIntSubset(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019321 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019322
Daniel Veillard34099b42004-11-04 17:34:35 +000019323 int mem_base;
19324 xmlDtdPtr ret_val;
19325 xmlDocPtr doc; /* the document pointer */
19326 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019327
Daniel Veillard34099b42004-11-04 17:34:35 +000019328 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19329 mem_base = xmlMemBlocks();
19330 doc = gen_xmlDocPtr(n_doc, 0);
19331
19332 ret_val = xmlGetIntSubset(doc);
19333 desret_xmlDtdPtr(ret_val);
19334 call_tests++;
19335 des_xmlDocPtr(n_doc, doc, 0);
19336 xmlResetLastError();
19337 if (mem_base != xmlMemBlocks()) {
19338 printf("Leak of %d blocks found in xmlGetIntSubset",
19339 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019340 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000019341 printf(" %d", n_doc);
19342 printf("\n");
19343 }
19344 }
Daniel Veillard34099b42004-11-04 17:34:35 +000019345 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019346
Daniel Veillard42595322004-11-08 10:52:06 +000019347 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019348}
19349
19350
19351static int
19352test_xmlGetLastChild(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019353 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019354
19355 int mem_base;
19356 xmlNodePtr ret_val;
19357 xmlNodePtr parent; /* the parent node */
19358 int n_parent;
19359
19360 for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) {
19361 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019362 parent = gen_xmlNodePtr(n_parent, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019363
19364 ret_val = xmlGetLastChild(parent);
19365 desret_xmlNodePtr(ret_val);
19366 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019367 des_xmlNodePtr(n_parent, parent, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019368 xmlResetLastError();
19369 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019370 printf("Leak of %d blocks found in xmlGetLastChild",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019371 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019372 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019373 printf(" %d", n_parent);
19374 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019375 }
19376 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019377 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019378
Daniel Veillard42595322004-11-08 10:52:06 +000019379 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019380}
19381
19382
19383static int
19384test_xmlGetLineNo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019385 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019386
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019387 int mem_base;
19388 long ret_val;
19389 xmlNodePtr node; /* valid node */
19390 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019391
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019392 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19393 mem_base = xmlMemBlocks();
19394 node = gen_xmlNodePtr(n_node, 0);
19395
19396 ret_val = xmlGetLineNo(node);
19397 desret_long(ret_val);
19398 call_tests++;
19399 des_xmlNodePtr(n_node, node, 0);
19400 xmlResetLastError();
19401 if (mem_base != xmlMemBlocks()) {
19402 printf("Leak of %d blocks found in xmlGetLineNo",
19403 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019404 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019405 printf(" %d", n_node);
19406 printf("\n");
19407 }
19408 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019409 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019410
Daniel Veillard42595322004-11-08 10:52:06 +000019411 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019412}
19413
19414
19415static int
19416test_xmlGetNoNsProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019417 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019418
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019419 int mem_base;
19420 xmlChar * ret_val;
19421 xmlNodePtr node; /* the node */
19422 int n_node;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019423 xmlChar * name; /* the attribute name */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019424 int n_name;
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 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19428 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019429 node = gen_xmlNodePtr(n_node, 0);
19430 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019431
William M. Brackf13f77f2004-11-12 16:03:48 +000019432 ret_val = xmlGetNoNsProp(node, (const xmlChar *)name);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019433 desret_xmlChar_ptr(ret_val);
19434 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019435 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000019436 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019437 xmlResetLastError();
19438 if (mem_base != xmlMemBlocks()) {
19439 printf("Leak of %d blocks found in xmlGetNoNsProp",
19440 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019441 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019442 printf(" %d", n_node);
19443 printf(" %d", n_name);
19444 printf("\n");
19445 }
19446 }
19447 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019448 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019449
Daniel Veillard42595322004-11-08 10:52:06 +000019450 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019451}
19452
19453
19454static int
19455test_xmlGetNodePath(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019456 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019457
William M. Brack21e4ef22005-01-02 09:53:13 +000019458#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_DEBUG_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019459 int mem_base;
19460 xmlChar * ret_val;
19461 xmlNodePtr node; /* a node */
19462 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019463
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019464 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19465 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019466 node = gen_xmlNodePtr(n_node, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019467
19468 ret_val = xmlGetNodePath(node);
19469 desret_xmlChar_ptr(ret_val);
19470 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019471 des_xmlNodePtr(n_node, node, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019472 xmlResetLastError();
19473 if (mem_base != xmlMemBlocks()) {
19474 printf("Leak of %d blocks found in xmlGetNodePath",
19475 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019476 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019477 printf(" %d", n_node);
19478 printf("\n");
19479 }
19480 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019481 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019482#endif
19483
Daniel Veillard42595322004-11-08 10:52:06 +000019484 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019485}
19486
19487
19488static int
19489test_xmlGetNsList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019490 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019491
19492
19493 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000019494 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019495}
19496
19497
19498static int
19499test_xmlGetNsProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019500 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019501
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019502 int mem_base;
19503 xmlChar * ret_val;
19504 xmlNodePtr node; /* the node */
19505 int n_node;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019506 xmlChar * name; /* the attribute name */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019507 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019508 xmlChar * nameSpace; /* the URI of the namespace */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019509 int n_nameSpace;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019510
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019511 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19512 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19513 for (n_nameSpace = 0;n_nameSpace < gen_nb_const_xmlChar_ptr;n_nameSpace++) {
19514 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019515 node = gen_xmlNodePtr(n_node, 0);
19516 name = gen_const_xmlChar_ptr(n_name, 1);
19517 nameSpace = gen_const_xmlChar_ptr(n_nameSpace, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019518
William M. Brackf13f77f2004-11-12 16:03:48 +000019519 ret_val = xmlGetNsProp(node, (const xmlChar *)name, (const xmlChar *)nameSpace);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019520 desret_xmlChar_ptr(ret_val);
19521 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019522 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000019523 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
19524 des_const_xmlChar_ptr(n_nameSpace, (const xmlChar *)nameSpace, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019525 xmlResetLastError();
19526 if (mem_base != xmlMemBlocks()) {
19527 printf("Leak of %d blocks found in xmlGetNsProp",
19528 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019529 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019530 printf(" %d", n_node);
19531 printf(" %d", n_name);
19532 printf(" %d", n_nameSpace);
19533 printf("\n");
19534 }
19535 }
19536 }
19537 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019538 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019539
Daniel Veillard42595322004-11-08 10:52:06 +000019540 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019541}
19542
19543
19544static int
19545test_xmlGetProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019546 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019547
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019548 int mem_base;
19549 xmlChar * ret_val;
19550 xmlNodePtr node; /* the node */
19551 int n_node;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019552 xmlChar * name; /* the attribute name */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019553 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019554
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019555 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19556 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19557 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019558 node = gen_xmlNodePtr(n_node, 0);
19559 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019560
William M. Brackf13f77f2004-11-12 16:03:48 +000019561 ret_val = xmlGetProp(node, (const xmlChar *)name);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019562 desret_xmlChar_ptr(ret_val);
19563 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019564 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000019565 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019566 xmlResetLastError();
19567 if (mem_base != xmlMemBlocks()) {
19568 printf("Leak of %d blocks found in xmlGetProp",
19569 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019570 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019571 printf(" %d", n_node);
19572 printf(" %d", n_name);
19573 printf("\n");
19574 }
19575 }
19576 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019577 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019578
Daniel Veillard42595322004-11-08 10:52:06 +000019579 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019580}
19581
19582
19583static int
19584test_xmlHasNsProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019585 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019586
Daniel Veillard57b25162004-11-06 14:50:18 +000019587 int mem_base;
19588 xmlAttrPtr ret_val;
19589 xmlNodePtr node; /* the node */
19590 int n_node;
19591 xmlChar * name; /* the attribute name */
19592 int n_name;
19593 xmlChar * nameSpace; /* the URI of the namespace */
19594 int n_nameSpace;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019595
Daniel Veillard57b25162004-11-06 14:50:18 +000019596 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19597 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19598 for (n_nameSpace = 0;n_nameSpace < gen_nb_const_xmlChar_ptr;n_nameSpace++) {
19599 mem_base = xmlMemBlocks();
19600 node = gen_xmlNodePtr(n_node, 0);
19601 name = gen_const_xmlChar_ptr(n_name, 1);
19602 nameSpace = gen_const_xmlChar_ptr(n_nameSpace, 2);
19603
William M. Brackf13f77f2004-11-12 16:03:48 +000019604 ret_val = xmlHasNsProp(node, (const xmlChar *)name, (const xmlChar *)nameSpace);
Daniel Veillard57b25162004-11-06 14:50:18 +000019605 desret_xmlAttrPtr(ret_val);
19606 call_tests++;
19607 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000019608 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
19609 des_const_xmlChar_ptr(n_nameSpace, (const xmlChar *)nameSpace, 2);
Daniel Veillard57b25162004-11-06 14:50:18 +000019610 xmlResetLastError();
19611 if (mem_base != xmlMemBlocks()) {
19612 printf("Leak of %d blocks found in xmlHasNsProp",
19613 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019614 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000019615 printf(" %d", n_node);
19616 printf(" %d", n_name);
19617 printf(" %d", n_nameSpace);
19618 printf("\n");
19619 }
19620 }
19621 }
19622 }
Daniel Veillard57b25162004-11-06 14:50:18 +000019623 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019624
Daniel Veillard42595322004-11-08 10:52:06 +000019625 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019626}
19627
19628
19629static int
19630test_xmlHasProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019631 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019632
Daniel Veillard57b25162004-11-06 14:50:18 +000019633 int mem_base;
19634 xmlAttrPtr ret_val;
19635 xmlNodePtr node; /* the node */
19636 int n_node;
19637 xmlChar * name; /* the attribute name */
19638 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019639
Daniel Veillard57b25162004-11-06 14:50:18 +000019640 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19641 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19642 mem_base = xmlMemBlocks();
19643 node = gen_xmlNodePtr(n_node, 0);
19644 name = gen_const_xmlChar_ptr(n_name, 1);
19645
William M. Brackf13f77f2004-11-12 16:03:48 +000019646 ret_val = xmlHasProp(node, (const xmlChar *)name);
Daniel Veillard57b25162004-11-06 14:50:18 +000019647 desret_xmlAttrPtr(ret_val);
19648 call_tests++;
19649 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000019650 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard57b25162004-11-06 14:50:18 +000019651 xmlResetLastError();
19652 if (mem_base != xmlMemBlocks()) {
19653 printf("Leak of %d blocks found in xmlHasProp",
19654 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019655 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000019656 printf(" %d", n_node);
19657 printf(" %d", n_name);
19658 printf("\n");
19659 }
19660 }
19661 }
Daniel Veillard57b25162004-11-06 14:50:18 +000019662 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019663
Daniel Veillard42595322004-11-08 10:52:06 +000019664 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019665}
19666
19667
19668static int
19669test_xmlIsBlankNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019670 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019671
19672 int mem_base;
19673 int ret_val;
19674 xmlNodePtr node; /* the node */
19675 int n_node;
19676
19677 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19678 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019679 node = gen_xmlNodePtr(n_node, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019680
19681 ret_val = xmlIsBlankNode(node);
19682 desret_int(ret_val);
19683 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019684 des_xmlNodePtr(n_node, node, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019685 xmlResetLastError();
19686 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019687 printf("Leak of %d blocks found in xmlIsBlankNode",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019688 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019689 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019690 printf(" %d", n_node);
19691 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019692 }
19693 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019694 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019695
Daniel Veillard42595322004-11-08 10:52:06 +000019696 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019697}
19698
19699
19700static int
19701test_xmlIsXHTML(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019702 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019703
19704 int mem_base;
19705 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019706 xmlChar * systemID; /* the system identifier */
Daniel Veillardd93f6252004-11-02 15:53:51 +000019707 int n_systemID;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019708 xmlChar * publicID; /* the public identifier */
Daniel Veillardd93f6252004-11-02 15:53:51 +000019709 int n_publicID;
19710
19711 for (n_systemID = 0;n_systemID < gen_nb_const_xmlChar_ptr;n_systemID++) {
19712 for (n_publicID = 0;n_publicID < gen_nb_const_xmlChar_ptr;n_publicID++) {
19713 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019714 systemID = gen_const_xmlChar_ptr(n_systemID, 0);
19715 publicID = gen_const_xmlChar_ptr(n_publicID, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019716
William M. Brackf13f77f2004-11-12 16:03:48 +000019717 ret_val = xmlIsXHTML((const xmlChar *)systemID, (const xmlChar *)publicID);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019718 desret_int(ret_val);
19719 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000019720 des_const_xmlChar_ptr(n_systemID, (const xmlChar *)systemID, 0);
19721 des_const_xmlChar_ptr(n_publicID, (const xmlChar *)publicID, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019722 xmlResetLastError();
19723 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019724 printf("Leak of %d blocks found in xmlIsXHTML",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019725 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019726 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019727 printf(" %d", n_systemID);
19728 printf(" %d", n_publicID);
19729 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019730 }
19731 }
19732 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019733 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019734
Daniel Veillard42595322004-11-08 10:52:06 +000019735 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019736}
19737
19738
19739static int
19740test_xmlNewCDataBlock(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019741 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019742
19743 int mem_base;
19744 xmlNodePtr ret_val;
19745 xmlDocPtr doc; /* the document */
19746 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019747 xmlChar * content; /* the CDATA block content content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000019748 int n_content;
19749 int len; /* the length of the block */
19750 int n_len;
19751
19752 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19753 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
19754 for (n_len = 0;n_len < gen_nb_int;n_len++) {
19755 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019756 doc = gen_xmlDocPtr(n_doc, 0);
19757 content = gen_const_xmlChar_ptr(n_content, 1);
19758 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019759
William M. Brackf13f77f2004-11-12 16:03:48 +000019760 ret_val = xmlNewCDataBlock(doc, (const xmlChar *)content, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019761 desret_xmlNodePtr(ret_val);
19762 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019763 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000019764 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000019765 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019766 xmlResetLastError();
19767 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019768 printf("Leak of %d blocks found in xmlNewCDataBlock",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019769 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019770 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019771 printf(" %d", n_doc);
19772 printf(" %d", n_content);
19773 printf(" %d", n_len);
19774 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019775 }
19776 }
19777 }
19778 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019779 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019780
Daniel Veillard42595322004-11-08 10:52:06 +000019781 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019782}
19783
19784
19785static int
19786test_xmlNewCharRef(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019787 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019788
19789 int mem_base;
19790 xmlNodePtr ret_val;
19791 xmlDocPtr doc; /* the document */
19792 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019793 xmlChar * name; /* the char ref string, starting with # or "&# ... ;" */
Daniel Veillardd93f6252004-11-02 15:53:51 +000019794 int n_name;
19795
19796 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19797 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19798 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019799 doc = gen_xmlDocPtr(n_doc, 0);
19800 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019801
William M. Brackf13f77f2004-11-12 16:03:48 +000019802 ret_val = xmlNewCharRef(doc, (const xmlChar *)name);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019803 desret_xmlNodePtr(ret_val);
19804 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019805 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000019806 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019807 xmlResetLastError();
19808 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019809 printf("Leak of %d blocks found in xmlNewCharRef",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019810 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019811 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019812 printf(" %d", n_doc);
19813 printf(" %d", n_name);
19814 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019815 }
19816 }
19817 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019818 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019819
Daniel Veillard42595322004-11-08 10:52:06 +000019820 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019821}
19822
19823
19824static int
19825test_xmlNewChild(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019826 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019827
William M. Brack21e4ef22005-01-02 09:53:13 +000019828#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000019829#ifdef LIBXML_TREE_ENABLED
Daniel Veillard27f20102004-11-05 11:50:11 +000019830 int mem_base;
19831 xmlNodePtr ret_val;
19832 xmlNodePtr parent; /* the parent node */
19833 int n_parent;
19834 xmlNsPtr ns; /* a namespace if any */
19835 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019836 xmlChar * name; /* the name of the child */
Daniel Veillard27f20102004-11-05 11:50:11 +000019837 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019838 xmlChar * content; /* the XML content of the child if any. */
Daniel Veillard27f20102004-11-05 11:50:11 +000019839 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019840
Daniel Veillard27f20102004-11-05 11:50:11 +000019841 for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) {
19842 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
19843 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19844 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
19845 mem_base = xmlMemBlocks();
19846 parent = gen_xmlNodePtr(n_parent, 0);
19847 ns = gen_xmlNsPtr(n_ns, 1);
19848 name = gen_const_xmlChar_ptr(n_name, 2);
19849 content = gen_const_xmlChar_ptr(n_content, 3);
19850
William M. Brackf13f77f2004-11-12 16:03:48 +000019851 ret_val = xmlNewChild(parent, ns, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillard27f20102004-11-05 11:50:11 +000019852 desret_xmlNodePtr(ret_val);
19853 call_tests++;
19854 des_xmlNodePtr(n_parent, parent, 0);
19855 des_xmlNsPtr(n_ns, ns, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000019856 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
19857 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 3);
Daniel Veillard27f20102004-11-05 11:50:11 +000019858 xmlResetLastError();
19859 if (mem_base != xmlMemBlocks()) {
19860 printf("Leak of %d blocks found in xmlNewChild",
19861 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019862 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000019863 printf(" %d", n_parent);
19864 printf(" %d", n_ns);
19865 printf(" %d", n_name);
19866 printf(" %d", n_content);
19867 printf("\n");
19868 }
19869 }
19870 }
19871 }
19872 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019873 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000019874#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000019875#endif
Daniel Veillard27f20102004-11-05 11:50:11 +000019876
Daniel Veillard42595322004-11-08 10:52:06 +000019877 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019878}
19879
19880
19881static int
19882test_xmlNewComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019883 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019884
19885 int mem_base;
19886 xmlNodePtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019887 xmlChar * content; /* the comment content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000019888 int n_content;
19889
19890 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
19891 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019892 content = gen_const_xmlChar_ptr(n_content, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019893
William M. Brackf13f77f2004-11-12 16:03:48 +000019894 ret_val = xmlNewComment((const xmlChar *)content);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019895 desret_xmlNodePtr(ret_val);
19896 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000019897 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019898 xmlResetLastError();
19899 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019900 printf("Leak of %d blocks found in xmlNewComment",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019901 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019902 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019903 printf(" %d", n_content);
19904 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019905 }
19906 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019907 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019908
Daniel Veillard42595322004-11-08 10:52:06 +000019909 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019910}
19911
19912
19913static int
19914test_xmlNewDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019915 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019916
19917 int mem_base;
19918 xmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019919 xmlChar * version; /* xmlChar string giving the version of XML "1.0" */
Daniel Veillardd93f6252004-11-02 15:53:51 +000019920 int n_version;
19921
19922 for (n_version = 0;n_version < gen_nb_const_xmlChar_ptr;n_version++) {
19923 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019924 version = gen_const_xmlChar_ptr(n_version, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019925
William M. Brackf13f77f2004-11-12 16:03:48 +000019926 ret_val = xmlNewDoc((const xmlChar *)version);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019927 desret_xmlDocPtr(ret_val);
19928 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000019929 des_const_xmlChar_ptr(n_version, (const xmlChar *)version, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019930 xmlResetLastError();
19931 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019932 printf("Leak of %d blocks found in xmlNewDoc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019933 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019934 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019935 printf(" %d", n_version);
19936 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019937 }
19938 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019939 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019940
Daniel Veillard42595322004-11-08 10:52:06 +000019941 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019942}
19943
19944
19945static int
19946test_xmlNewDocComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019947 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019948
19949 int mem_base;
19950 xmlNodePtr ret_val;
19951 xmlDocPtr doc; /* the document */
19952 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019953 xmlChar * content; /* the comment content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000019954 int n_content;
19955
19956 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19957 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
19958 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019959 doc = gen_xmlDocPtr(n_doc, 0);
19960 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019961
William M. Brackf13f77f2004-11-12 16:03:48 +000019962 ret_val = xmlNewDocComment(doc, (const xmlChar *)content);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019963 desret_xmlNodePtr(ret_val);
19964 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019965 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000019966 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019967 xmlResetLastError();
19968 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019969 printf("Leak of %d blocks found in xmlNewDocComment",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019970 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019971 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019972 printf(" %d", n_doc);
19973 printf(" %d", n_content);
19974 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019975 }
19976 }
19977 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019978 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019979
Daniel Veillard42595322004-11-08 10:52:06 +000019980 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019981}
19982
19983
19984static int
19985test_xmlNewDocFragment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019986 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019987
William M. Brack21e4ef22005-01-02 09:53:13 +000019988#if defined(LIBXML_TREE_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000019989 int mem_base;
19990 xmlNodePtr ret_val;
19991 xmlDocPtr doc; /* the document owning the fragment */
19992 int n_doc;
19993
19994 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19995 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019996 doc = gen_xmlDocPtr(n_doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019997
19998 ret_val = xmlNewDocFragment(doc);
19999 desret_xmlNodePtr(ret_val);
20000 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020001 des_xmlDocPtr(n_doc, doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020002 xmlResetLastError();
20003 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020004 printf("Leak of %d blocks found in xmlNewDocFragment",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020005 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020006 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020007 printf(" %d", n_doc);
20008 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020009 }
20010 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020011 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020012#endif
20013
Daniel Veillard42595322004-11-08 10:52:06 +000020014 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020015}
20016
20017
20018static int
20019test_xmlNewDocNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020020 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020021
Daniel Veillard27f20102004-11-05 11:50:11 +000020022 int mem_base;
20023 xmlNodePtr ret_val;
20024 xmlDocPtr doc; /* the document */
20025 int n_doc;
20026 xmlNsPtr ns; /* namespace if any */
20027 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020028 xmlChar * name; /* the node name */
Daniel Veillard27f20102004-11-05 11:50:11 +000020029 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020030 xmlChar * content; /* the XML text content if any */
Daniel Veillard27f20102004-11-05 11:50:11 +000020031 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020032
Daniel Veillard27f20102004-11-05 11:50:11 +000020033 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20034 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20035 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20036 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20037 mem_base = xmlMemBlocks();
20038 doc = gen_xmlDocPtr(n_doc, 0);
20039 ns = gen_xmlNsPtr(n_ns, 1);
20040 name = gen_const_xmlChar_ptr(n_name, 2);
20041 content = gen_const_xmlChar_ptr(n_content, 3);
20042
William M. Brackf13f77f2004-11-12 16:03:48 +000020043 ret_val = xmlNewDocNode(doc, ns, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillard27f20102004-11-05 11:50:11 +000020044 desret_xmlNodePtr(ret_val);
20045 call_tests++;
20046 des_xmlDocPtr(n_doc, doc, 0);
20047 des_xmlNsPtr(n_ns, ns, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000020048 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
20049 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 3);
Daniel Veillard27f20102004-11-05 11:50:11 +000020050 xmlResetLastError();
20051 if (mem_base != xmlMemBlocks()) {
20052 printf("Leak of %d blocks found in xmlNewDocNode",
20053 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020054 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000020055 printf(" %d", n_doc);
20056 printf(" %d", n_ns);
20057 printf(" %d", n_name);
20058 printf(" %d", n_content);
20059 printf("\n");
20060 }
20061 }
20062 }
20063 }
20064 }
Daniel Veillard27f20102004-11-05 11:50:11 +000020065 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020066
Daniel Veillard42595322004-11-08 10:52:06 +000020067 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020068}
20069
20070
20071static int
20072test_xmlNewDocNodeEatName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020073 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020074
Daniel Veillard27f20102004-11-05 11:50:11 +000020075 int mem_base;
20076 xmlNodePtr ret_val;
20077 xmlDocPtr doc; /* the document */
20078 int n_doc;
20079 xmlNsPtr ns; /* namespace if any */
20080 int n_ns;
20081 xmlChar * name; /* the node name */
20082 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020083 xmlChar * content; /* the XML text content if any */
Daniel Veillard27f20102004-11-05 11:50:11 +000020084 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020085
Daniel Veillard27f20102004-11-05 11:50:11 +000020086 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20087 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20088 for (n_name = 0;n_name < gen_nb_eaten_name;n_name++) {
20089 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20090 mem_base = xmlMemBlocks();
20091 doc = gen_xmlDocPtr(n_doc, 0);
20092 ns = gen_xmlNsPtr(n_ns, 1);
20093 name = gen_eaten_name(n_name, 2);
20094 content = gen_const_xmlChar_ptr(n_content, 3);
20095
William M. Brackf13f77f2004-11-12 16:03:48 +000020096 ret_val = xmlNewDocNodeEatName(doc, ns, name, (const xmlChar *)content);
Daniel Veillard27f20102004-11-05 11:50:11 +000020097 desret_xmlNodePtr(ret_val);
20098 call_tests++;
20099 des_xmlDocPtr(n_doc, doc, 0);
20100 des_xmlNsPtr(n_ns, ns, 1);
20101 des_eaten_name(n_name, name, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000020102 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 3);
Daniel Veillard27f20102004-11-05 11:50:11 +000020103 xmlResetLastError();
20104 if (mem_base != xmlMemBlocks()) {
20105 printf("Leak of %d blocks found in xmlNewDocNodeEatName",
20106 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020107 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000020108 printf(" %d", n_doc);
20109 printf(" %d", n_ns);
20110 printf(" %d", n_name);
20111 printf(" %d", n_content);
20112 printf("\n");
20113 }
20114 }
20115 }
20116 }
20117 }
Daniel Veillard27f20102004-11-05 11:50:11 +000020118 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020119
Daniel Veillard42595322004-11-08 10:52:06 +000020120 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020121}
20122
20123
20124static int
20125test_xmlNewDocPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020126 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020127
20128 int mem_base;
20129 xmlNodePtr ret_val;
20130 xmlDocPtr doc; /* the target document */
20131 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020132 xmlChar * name; /* the processing instruction name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020133 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020134 xmlChar * content; /* the PI content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020135 int n_content;
20136
20137 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20138 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20139 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20140 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020141 doc = gen_xmlDocPtr(n_doc, 0);
20142 name = gen_const_xmlChar_ptr(n_name, 1);
20143 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020144
William M. Brackf13f77f2004-11-12 16:03:48 +000020145 ret_val = xmlNewDocPI(doc, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020146 desret_xmlNodePtr(ret_val);
20147 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020148 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020149 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
20150 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020151 xmlResetLastError();
20152 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020153 printf("Leak of %d blocks found in xmlNewDocPI",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020154 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020155 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020156 printf(" %d", n_doc);
20157 printf(" %d", n_name);
20158 printf(" %d", n_content);
20159 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020160 }
20161 }
20162 }
20163 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020164 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020165
Daniel Veillard42595322004-11-08 10:52:06 +000020166 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020167}
20168
20169
20170static int
20171test_xmlNewDocProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020172 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020173
Daniel Veillard57b25162004-11-06 14:50:18 +000020174 int mem_base;
20175 xmlAttrPtr ret_val;
20176 xmlDocPtr doc; /* the document */
20177 int n_doc;
20178 xmlChar * name; /* the name of the attribute */
20179 int n_name;
20180 xmlChar * value; /* the value of the attribute */
20181 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020182
Daniel Veillard57b25162004-11-06 14:50:18 +000020183 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20184 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20185 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
20186 mem_base = xmlMemBlocks();
20187 doc = gen_xmlDocPtr(n_doc, 0);
20188 name = gen_const_xmlChar_ptr(n_name, 1);
20189 value = gen_const_xmlChar_ptr(n_value, 2);
20190
William M. Brackf13f77f2004-11-12 16:03:48 +000020191 ret_val = xmlNewDocProp(doc, (const xmlChar *)name, (const xmlChar *)value);
Daniel Veillard57b25162004-11-06 14:50:18 +000020192 desret_xmlAttrPtr(ret_val);
20193 call_tests++;
20194 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020195 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
20196 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 2);
Daniel Veillard57b25162004-11-06 14:50:18 +000020197 xmlResetLastError();
20198 if (mem_base != xmlMemBlocks()) {
20199 printf("Leak of %d blocks found in xmlNewDocProp",
20200 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020201 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000020202 printf(" %d", n_doc);
20203 printf(" %d", n_name);
20204 printf(" %d", n_value);
20205 printf("\n");
20206 }
20207 }
20208 }
20209 }
Daniel Veillard57b25162004-11-06 14:50:18 +000020210 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020211
Daniel Veillard42595322004-11-08 10:52:06 +000020212 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020213}
20214
20215
20216static int
20217test_xmlNewDocRawNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020218 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020219
William M. Brack21e4ef22005-01-02 09:53:13 +000020220#if defined(LIBXML_TREE_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000020221#ifdef LIBXML_TREE_ENABLED
Daniel Veillard27f20102004-11-05 11:50:11 +000020222 int mem_base;
20223 xmlNodePtr ret_val;
20224 xmlDocPtr doc; /* the document */
20225 int n_doc;
20226 xmlNsPtr ns; /* namespace if any */
20227 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020228 xmlChar * name; /* the node name */
Daniel Veillard27f20102004-11-05 11:50:11 +000020229 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020230 xmlChar * content; /* the text content if any */
Daniel Veillard27f20102004-11-05 11:50:11 +000020231 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020232
Daniel Veillard27f20102004-11-05 11:50:11 +000020233 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20234 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20235 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20236 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20237 mem_base = xmlMemBlocks();
20238 doc = gen_xmlDocPtr(n_doc, 0);
20239 ns = gen_xmlNsPtr(n_ns, 1);
20240 name = gen_const_xmlChar_ptr(n_name, 2);
20241 content = gen_const_xmlChar_ptr(n_content, 3);
20242
William M. Brackf13f77f2004-11-12 16:03:48 +000020243 ret_val = xmlNewDocRawNode(doc, ns, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillard27f20102004-11-05 11:50:11 +000020244 desret_xmlNodePtr(ret_val);
20245 call_tests++;
20246 des_xmlDocPtr(n_doc, doc, 0);
20247 des_xmlNsPtr(n_ns, ns, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000020248 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
20249 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 3);
Daniel Veillard27f20102004-11-05 11:50:11 +000020250 xmlResetLastError();
20251 if (mem_base != xmlMemBlocks()) {
20252 printf("Leak of %d blocks found in xmlNewDocRawNode",
20253 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020254 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000020255 printf(" %d", n_doc);
20256 printf(" %d", n_ns);
20257 printf(" %d", n_name);
20258 printf(" %d", n_content);
20259 printf("\n");
20260 }
20261 }
20262 }
20263 }
20264 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020265 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000020266#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000020267#endif
Daniel Veillard27f20102004-11-05 11:50:11 +000020268
Daniel Veillard42595322004-11-08 10:52:06 +000020269 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020270}
20271
20272
20273static int
20274test_xmlNewDocText(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020275 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020276
20277 int mem_base;
20278 xmlNodePtr ret_val;
20279 xmlDocPtr doc; /* the document */
20280 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020281 xmlChar * content; /* the text content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020282 int n_content;
20283
20284 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20285 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
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);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020289
William M. Brackf13f77f2004-11-12 16:03:48 +000020290 ret_val = xmlNewDocText(doc, (const xmlChar *)content);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020291 desret_xmlNodePtr(ret_val);
20292 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020293 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020294 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020295 xmlResetLastError();
20296 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020297 printf("Leak of %d blocks found in xmlNewDocText",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020298 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020299 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020300 printf(" %d", n_doc);
20301 printf(" %d", n_content);
20302 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020303 }
20304 }
20305 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020306 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020307
Daniel Veillard42595322004-11-08 10:52:06 +000020308 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020309}
20310
20311
20312static int
20313test_xmlNewDocTextLen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020314 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020315
20316 int mem_base;
20317 xmlNodePtr ret_val;
20318 xmlDocPtr doc; /* the document */
20319 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020320 xmlChar * content; /* the text content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020321 int n_content;
20322 int len; /* the text len. */
20323 int n_len;
20324
20325 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20326 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20327 for (n_len = 0;n_len < gen_nb_int;n_len++) {
20328 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020329 doc = gen_xmlDocPtr(n_doc, 0);
20330 content = gen_const_xmlChar_ptr(n_content, 1);
20331 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020332
William M. Brackf13f77f2004-11-12 16:03:48 +000020333 ret_val = xmlNewDocTextLen(doc, (const xmlChar *)content, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020334 desret_xmlNodePtr(ret_val);
20335 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020336 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020337 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000020338 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020339 xmlResetLastError();
20340 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020341 printf("Leak of %d blocks found in xmlNewDocTextLen",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020342 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020343 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020344 printf(" %d", n_doc);
20345 printf(" %d", n_content);
20346 printf(" %d", n_len);
20347 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020348 }
20349 }
20350 }
20351 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020352 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020353
Daniel Veillard42595322004-11-08 10:52:06 +000020354 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020355}
20356
20357
20358static int
20359test_xmlNewDtd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020360 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020361
Daniel Veillard34099b42004-11-04 17:34:35 +000020362 int mem_base;
20363 xmlDtdPtr ret_val;
20364 xmlDocPtr doc; /* the document pointer */
20365 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020366 xmlChar * name; /* the DTD name */
Daniel Veillard34099b42004-11-04 17:34:35 +000020367 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020368 xmlChar * ExternalID; /* the external ID */
Daniel Veillard34099b42004-11-04 17:34:35 +000020369 int n_ExternalID;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020370 xmlChar * SystemID; /* the system ID */
Daniel Veillard34099b42004-11-04 17:34:35 +000020371 int n_SystemID;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020372
Daniel Veillard34099b42004-11-04 17:34:35 +000020373 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20374 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20375 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
20376 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
20377 mem_base = xmlMemBlocks();
20378 doc = gen_xmlDocPtr(n_doc, 0);
20379 name = gen_const_xmlChar_ptr(n_name, 1);
20380 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 2);
20381 SystemID = gen_const_xmlChar_ptr(n_SystemID, 3);
20382
William M. Brackf13f77f2004-11-12 16:03:48 +000020383 ret_val = xmlNewDtd(doc, (const xmlChar *)name, (const xmlChar *)ExternalID, (const xmlChar *)SystemID);
Daniel Veillard34099b42004-11-04 17:34:35 +000020384 desret_xmlDtdPtr(ret_val);
20385 call_tests++;
20386 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020387 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
20388 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 2);
20389 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 3);
Daniel Veillard34099b42004-11-04 17:34:35 +000020390 xmlResetLastError();
20391 if (mem_base != xmlMemBlocks()) {
20392 printf("Leak of %d blocks found in xmlNewDtd",
20393 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020394 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000020395 printf(" %d", n_doc);
20396 printf(" %d", n_name);
20397 printf(" %d", n_ExternalID);
20398 printf(" %d", n_SystemID);
20399 printf("\n");
20400 }
20401 }
20402 }
20403 }
20404 }
Daniel Veillard34099b42004-11-04 17:34:35 +000020405 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020406
Daniel Veillard42595322004-11-08 10:52:06 +000020407 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020408}
20409
20410
20411static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000020412test_xmlNewNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020413 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020414
Daniel Veillard27f20102004-11-05 11:50:11 +000020415 int mem_base;
20416 xmlNodePtr ret_val;
20417 xmlNsPtr ns; /* namespace if any */
20418 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020419 xmlChar * name; /* the node name */
Daniel Veillard27f20102004-11-05 11:50:11 +000020420 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020421
Daniel Veillard27f20102004-11-05 11:50:11 +000020422 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20423 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20424 mem_base = xmlMemBlocks();
20425 ns = gen_xmlNsPtr(n_ns, 0);
20426 name = gen_const_xmlChar_ptr(n_name, 1);
20427
William M. Brackf13f77f2004-11-12 16:03:48 +000020428 ret_val = xmlNewNode(ns, (const xmlChar *)name);
Daniel Veillard27f20102004-11-05 11:50:11 +000020429 desret_xmlNodePtr(ret_val);
20430 call_tests++;
20431 des_xmlNsPtr(n_ns, ns, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020432 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard27f20102004-11-05 11:50:11 +000020433 xmlResetLastError();
20434 if (mem_base != xmlMemBlocks()) {
20435 printf("Leak of %d blocks found in xmlNewNode",
20436 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020437 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000020438 printf(" %d", n_ns);
20439 printf(" %d", n_name);
20440 printf("\n");
20441 }
20442 }
20443 }
Daniel Veillard27f20102004-11-05 11:50:11 +000020444 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020445
Daniel Veillard42595322004-11-08 10:52:06 +000020446 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020447}
20448
20449
20450static int
20451test_xmlNewNodeEatName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020452 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020453
Daniel Veillard27f20102004-11-05 11:50:11 +000020454 int mem_base;
20455 xmlNodePtr ret_val;
20456 xmlNsPtr ns; /* namespace if any */
20457 int n_ns;
20458 xmlChar * name; /* the node name */
20459 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020460
Daniel Veillard27f20102004-11-05 11:50:11 +000020461 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20462 for (n_name = 0;n_name < gen_nb_eaten_name;n_name++) {
20463 mem_base = xmlMemBlocks();
20464 ns = gen_xmlNsPtr(n_ns, 0);
20465 name = gen_eaten_name(n_name, 1);
20466
20467 ret_val = xmlNewNodeEatName(ns, name);
20468 desret_xmlNodePtr(ret_val);
20469 call_tests++;
20470 des_xmlNsPtr(n_ns, ns, 0);
20471 des_eaten_name(n_name, name, 1);
20472 xmlResetLastError();
20473 if (mem_base != xmlMemBlocks()) {
20474 printf("Leak of %d blocks found in xmlNewNodeEatName",
20475 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020476 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000020477 printf(" %d", n_ns);
20478 printf(" %d", n_name);
20479 printf("\n");
20480 }
20481 }
20482 }
Daniel Veillard27f20102004-11-05 11:50:11 +000020483 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020484
Daniel Veillard42595322004-11-08 10:52:06 +000020485 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020486}
20487
20488
20489static int
20490test_xmlNewNs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020491 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020492
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000020493 int mem_base;
20494 xmlNsPtr ret_val;
20495 xmlNodePtr node; /* the element carrying the namespace */
20496 int n_node;
20497 xmlChar * href; /* the URI associated */
20498 int n_href;
20499 xmlChar * prefix; /* the prefix for the namespace */
20500 int n_prefix;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020501
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000020502 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
20503 for (n_href = 0;n_href < gen_nb_const_xmlChar_ptr;n_href++) {
20504 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
20505 mem_base = xmlMemBlocks();
20506 node = gen_xmlNodePtr(n_node, 0);
20507 href = gen_const_xmlChar_ptr(n_href, 1);
20508 prefix = gen_const_xmlChar_ptr(n_prefix, 2);
20509
William M. Brackf13f77f2004-11-12 16:03:48 +000020510 ret_val = xmlNewNs(node, (const xmlChar *)href, (const xmlChar *)prefix);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000020511 if ((node == NULL) && (ret_val != NULL)) xmlFreeNs(ret_val);
20512 desret_xmlNsPtr(ret_val);
20513 call_tests++;
20514 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020515 des_const_xmlChar_ptr(n_href, (const xmlChar *)href, 1);
20516 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 2);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000020517 xmlResetLastError();
20518 if (mem_base != xmlMemBlocks()) {
20519 printf("Leak of %d blocks found in xmlNewNs",
20520 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020521 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000020522 printf(" %d", n_node);
20523 printf(" %d", n_href);
20524 printf(" %d", n_prefix);
20525 printf("\n");
20526 }
20527 }
20528 }
20529 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000020530 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020531
Daniel Veillard42595322004-11-08 10:52:06 +000020532 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020533}
20534
20535
20536static int
20537test_xmlNewNsProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020538 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020539
Daniel Veillard57b25162004-11-06 14:50:18 +000020540 int mem_base;
20541 xmlAttrPtr ret_val;
20542 xmlNodePtr node; /* the holding node */
20543 int n_node;
20544 xmlNsPtr ns; /* the namespace */
20545 int n_ns;
20546 xmlChar * name; /* the name of the attribute */
20547 int n_name;
20548 xmlChar * value; /* the value of the attribute */
20549 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020550
Daniel Veillard57b25162004-11-06 14:50:18 +000020551 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
20552 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20553 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20554 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
20555 mem_base = xmlMemBlocks();
20556 node = gen_xmlNodePtr(n_node, 0);
20557 ns = gen_xmlNsPtr(n_ns, 1);
20558 name = gen_const_xmlChar_ptr(n_name, 2);
20559 value = gen_const_xmlChar_ptr(n_value, 3);
20560
William M. Brackf13f77f2004-11-12 16:03:48 +000020561 ret_val = xmlNewNsProp(node, ns, (const xmlChar *)name, (const xmlChar *)value);
Daniel Veillard57b25162004-11-06 14:50:18 +000020562 desret_xmlAttrPtr(ret_val);
20563 call_tests++;
20564 des_xmlNodePtr(n_node, node, 0);
20565 des_xmlNsPtr(n_ns, ns, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000020566 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
20567 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 3);
Daniel Veillard57b25162004-11-06 14:50:18 +000020568 xmlResetLastError();
20569 if (mem_base != xmlMemBlocks()) {
20570 printf("Leak of %d blocks found in xmlNewNsProp",
20571 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020572 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000020573 printf(" %d", n_node);
20574 printf(" %d", n_ns);
20575 printf(" %d", n_name);
20576 printf(" %d", n_value);
20577 printf("\n");
20578 }
20579 }
20580 }
20581 }
20582 }
Daniel Veillard57b25162004-11-06 14:50:18 +000020583 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020584
Daniel Veillard42595322004-11-08 10:52:06 +000020585 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020586}
20587
20588
20589static int
20590test_xmlNewNsPropEatName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020591 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020592
Daniel Veillard57b25162004-11-06 14:50:18 +000020593 int mem_base;
20594 xmlAttrPtr ret_val;
20595 xmlNodePtr node; /* the holding node */
20596 int n_node;
20597 xmlNsPtr ns; /* the namespace */
20598 int n_ns;
20599 xmlChar * name; /* the name of the attribute */
20600 int n_name;
20601 xmlChar * value; /* the value of the attribute */
20602 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020603
Daniel Veillard57b25162004-11-06 14:50:18 +000020604 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
20605 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20606 for (n_name = 0;n_name < gen_nb_eaten_name;n_name++) {
20607 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
20608 mem_base = xmlMemBlocks();
20609 node = gen_xmlNodePtr(n_node, 0);
20610 ns = gen_xmlNsPtr(n_ns, 1);
20611 name = gen_eaten_name(n_name, 2);
20612 value = gen_const_xmlChar_ptr(n_value, 3);
20613
William M. Brackf13f77f2004-11-12 16:03:48 +000020614 ret_val = xmlNewNsPropEatName(node, ns, name, (const xmlChar *)value);
Daniel Veillard57b25162004-11-06 14:50:18 +000020615 desret_xmlAttrPtr(ret_val);
20616 call_tests++;
20617 des_xmlNodePtr(n_node, node, 0);
20618 des_xmlNsPtr(n_ns, ns, 1);
20619 des_eaten_name(n_name, name, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000020620 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 3);
Daniel Veillard57b25162004-11-06 14:50:18 +000020621 xmlResetLastError();
20622 if (mem_base != xmlMemBlocks()) {
20623 printf("Leak of %d blocks found in xmlNewNsPropEatName",
20624 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020625 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000020626 printf(" %d", n_node);
20627 printf(" %d", n_ns);
20628 printf(" %d", n_name);
20629 printf(" %d", n_value);
20630 printf("\n");
20631 }
20632 }
20633 }
20634 }
20635 }
Daniel Veillard57b25162004-11-06 14:50:18 +000020636 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020637
Daniel Veillard42595322004-11-08 10:52:06 +000020638 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020639}
20640
20641
20642static int
20643test_xmlNewPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020644 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020645
20646 int mem_base;
20647 xmlNodePtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020648 xmlChar * name; /* the processing instruction name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020649 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020650 xmlChar * content; /* the PI content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020651 int n_content;
20652
20653 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20654 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20655 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020656 name = gen_const_xmlChar_ptr(n_name, 0);
20657 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020658
William M. Brackf13f77f2004-11-12 16:03:48 +000020659 ret_val = xmlNewPI((const xmlChar *)name, (const xmlChar *)content);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020660 desret_xmlNodePtr(ret_val);
20661 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000020662 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
20663 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020664 xmlResetLastError();
20665 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020666 printf("Leak of %d blocks found in xmlNewPI",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020667 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020668 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020669 printf(" %d", n_name);
20670 printf(" %d", n_content);
20671 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020672 }
20673 }
20674 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020675 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020676
Daniel Veillard42595322004-11-08 10:52:06 +000020677 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020678}
20679
20680
20681static int
20682test_xmlNewProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020683 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020684
William M. Brack21e4ef22005-01-02 09:53:13 +000020685#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000020686#ifdef LIBXML_TREE_ENABLED
Daniel Veillard57b25162004-11-06 14:50:18 +000020687 int mem_base;
20688 xmlAttrPtr ret_val;
20689 xmlNodePtr node; /* the holding node */
20690 int n_node;
20691 xmlChar * name; /* the name of the attribute */
20692 int n_name;
20693 xmlChar * value; /* the value of the attribute */
20694 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020695
Daniel Veillard57b25162004-11-06 14:50:18 +000020696 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
20697 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20698 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
20699 mem_base = xmlMemBlocks();
20700 node = gen_xmlNodePtr(n_node, 0);
20701 name = gen_const_xmlChar_ptr(n_name, 1);
20702 value = gen_const_xmlChar_ptr(n_value, 2);
20703
William M. Brackf13f77f2004-11-12 16:03:48 +000020704 ret_val = xmlNewProp(node, (const xmlChar *)name, (const xmlChar *)value);
Daniel Veillard57b25162004-11-06 14:50:18 +000020705 desret_xmlAttrPtr(ret_val);
20706 call_tests++;
20707 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020708 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
20709 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 2);
Daniel Veillard57b25162004-11-06 14:50:18 +000020710 xmlResetLastError();
20711 if (mem_base != xmlMemBlocks()) {
20712 printf("Leak of %d blocks found in xmlNewProp",
20713 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020714 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000020715 printf(" %d", n_node);
20716 printf(" %d", n_name);
20717 printf(" %d", n_value);
20718 printf("\n");
20719 }
20720 }
20721 }
20722 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020723 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000020724#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000020725#endif
Daniel Veillard57b25162004-11-06 14:50:18 +000020726
Daniel Veillard42595322004-11-08 10:52:06 +000020727 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020728}
20729
20730
20731static int
20732test_xmlNewReference(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020733 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020734
20735 int mem_base;
20736 xmlNodePtr ret_val;
20737 xmlDocPtr doc; /* the document */
20738 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020739 xmlChar * name; /* the reference name, or the reference string with & and ; */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020740 int n_name;
20741
20742 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20743 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20744 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020745 doc = gen_xmlDocPtr(n_doc, 0);
20746 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020747
William M. Brackf13f77f2004-11-12 16:03:48 +000020748 ret_val = xmlNewReference(doc, (const xmlChar *)name);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020749 desret_xmlNodePtr(ret_val);
20750 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020751 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020752 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020753 xmlResetLastError();
20754 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020755 printf("Leak of %d blocks found in xmlNewReference",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020756 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020757 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020758 printf(" %d", n_doc);
20759 printf(" %d", n_name);
20760 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020761 }
20762 }
20763 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020764 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020765
Daniel Veillard42595322004-11-08 10:52:06 +000020766 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020767}
20768
20769
20770static int
20771test_xmlNewText(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020772 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020773
20774 int mem_base;
20775 xmlNodePtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020776 xmlChar * content; /* the text content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020777 int n_content;
20778
20779 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20780 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020781 content = gen_const_xmlChar_ptr(n_content, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020782
William M. Brackf13f77f2004-11-12 16:03:48 +000020783 ret_val = xmlNewText((const xmlChar *)content);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020784 desret_xmlNodePtr(ret_val);
20785 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000020786 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020787 xmlResetLastError();
20788 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020789 printf("Leak of %d blocks found in xmlNewText",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020790 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020791 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020792 printf(" %d", n_content);
20793 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020794 }
20795 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020796 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020797
Daniel Veillard42595322004-11-08 10:52:06 +000020798 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020799}
20800
20801
20802static int
20803test_xmlNewTextChild(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020804 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020805
William M. Brack21e4ef22005-01-02 09:53:13 +000020806#if defined(LIBXML_TREE_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000020807#ifdef LIBXML_TREE_ENABLED
Daniel Veillard27f20102004-11-05 11:50:11 +000020808 int mem_base;
20809 xmlNodePtr ret_val;
20810 xmlNodePtr parent; /* the parent node */
20811 int n_parent;
20812 xmlNsPtr ns; /* a namespace if any */
20813 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020814 xmlChar * name; /* the name of the child */
Daniel Veillard27f20102004-11-05 11:50:11 +000020815 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020816 xmlChar * content; /* the text content of the child if any. */
Daniel Veillard27f20102004-11-05 11:50:11 +000020817 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020818
Daniel Veillard27f20102004-11-05 11:50:11 +000020819 for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) {
20820 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20821 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20822 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20823 mem_base = xmlMemBlocks();
20824 parent = gen_xmlNodePtr(n_parent, 0);
20825 ns = gen_xmlNsPtr(n_ns, 1);
20826 name = gen_const_xmlChar_ptr(n_name, 2);
20827 content = gen_const_xmlChar_ptr(n_content, 3);
20828
William M. Brackf13f77f2004-11-12 16:03:48 +000020829 ret_val = xmlNewTextChild(parent, ns, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillard27f20102004-11-05 11:50:11 +000020830 desret_xmlNodePtr(ret_val);
20831 call_tests++;
20832 des_xmlNodePtr(n_parent, parent, 0);
20833 des_xmlNsPtr(n_ns, ns, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000020834 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
20835 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 3);
Daniel Veillard27f20102004-11-05 11:50:11 +000020836 xmlResetLastError();
20837 if (mem_base != xmlMemBlocks()) {
20838 printf("Leak of %d blocks found in xmlNewTextChild",
20839 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020840 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000020841 printf(" %d", n_parent);
20842 printf(" %d", n_ns);
20843 printf(" %d", n_name);
20844 printf(" %d", n_content);
20845 printf("\n");
20846 }
20847 }
20848 }
20849 }
20850 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020851 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000020852#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000020853#endif
Daniel Veillard27f20102004-11-05 11:50:11 +000020854
Daniel Veillard42595322004-11-08 10:52:06 +000020855 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020856}
20857
20858
20859static int
20860test_xmlNewTextLen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020861 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020862
20863 int mem_base;
20864 xmlNodePtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020865 xmlChar * content; /* the text content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020866 int n_content;
20867 int len; /* the text len. */
20868 int n_len;
20869
20870 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20871 for (n_len = 0;n_len < gen_nb_int;n_len++) {
20872 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020873 content = gen_const_xmlChar_ptr(n_content, 0);
20874 len = gen_int(n_len, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020875
William M. Brackf13f77f2004-11-12 16:03:48 +000020876 ret_val = xmlNewTextLen((const xmlChar *)content, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020877 desret_xmlNodePtr(ret_val);
20878 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000020879 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000020880 des_int(n_len, len, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020881 xmlResetLastError();
20882 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020883 printf("Leak of %d blocks found in xmlNewTextLen",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020884 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020885 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020886 printf(" %d", n_content);
20887 printf(" %d", n_len);
20888 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020889 }
20890 }
20891 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020892 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020893
Daniel Veillard42595322004-11-08 10:52:06 +000020894 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020895}
20896
20897
20898static int
20899test_xmlNodeAddContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020900 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020901
20902 int mem_base;
20903 xmlNodePtr cur; /* the node being modified */
20904 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020905 xmlChar * content; /* extra content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020906 int n_content;
20907
20908 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
20909 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20910 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020911 cur = gen_xmlNodePtr(n_cur, 0);
20912 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020913
William M. Brackf13f77f2004-11-12 16:03:48 +000020914 xmlNodeAddContent(cur, (const xmlChar *)content);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020915 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020916 des_xmlNodePtr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020917 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020918 xmlResetLastError();
20919 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020920 printf("Leak of %d blocks found in xmlNodeAddContent",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020921 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020922 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020923 printf(" %d", n_cur);
20924 printf(" %d", n_content);
20925 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020926 }
20927 }
20928 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020929 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020930
Daniel Veillard42595322004-11-08 10:52:06 +000020931 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020932}
20933
20934
20935static int
20936test_xmlNodeAddContentLen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020937 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020938
20939 int mem_base;
20940 xmlNodePtr cur; /* the node being modified */
20941 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020942 xmlChar * content; /* extra content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020943 int n_content;
20944 int len; /* the size of @content */
20945 int n_len;
20946
20947 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
20948 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20949 for (n_len = 0;n_len < gen_nb_int;n_len++) {
20950 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020951 cur = gen_xmlNodePtr(n_cur, 0);
20952 content = gen_const_xmlChar_ptr(n_content, 1);
20953 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020954
William M. Brackf13f77f2004-11-12 16:03:48 +000020955 xmlNodeAddContentLen(cur, (const xmlChar *)content, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020956 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020957 des_xmlNodePtr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020958 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000020959 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020960 xmlResetLastError();
20961 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020962 printf("Leak of %d blocks found in xmlNodeAddContentLen",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020963 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020964 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020965 printf(" %d", n_cur);
20966 printf(" %d", n_content);
20967 printf(" %d", n_len);
20968 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020969 }
20970 }
20971 }
20972 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020973 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020974
Daniel Veillard42595322004-11-08 10:52:06 +000020975 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020976}
20977
20978
20979static int
20980test_xmlNodeBufGetContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020981 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020982
Daniel Veillardd005b9e2004-11-03 17:07:05 +000020983 int mem_base;
20984 int ret_val;
20985 xmlBufferPtr buffer; /* a buffer */
20986 int n_buffer;
20987 xmlNodePtr cur; /* the node being read */
20988 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020989
Daniel Veillardd005b9e2004-11-03 17:07:05 +000020990 for (n_buffer = 0;n_buffer < gen_nb_xmlBufferPtr;n_buffer++) {
20991 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
20992 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020993 buffer = gen_xmlBufferPtr(n_buffer, 0);
20994 cur = gen_xmlNodePtr(n_cur, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000020995
20996 ret_val = xmlNodeBufGetContent(buffer, cur);
20997 desret_int(ret_val);
20998 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020999 des_xmlBufferPtr(n_buffer, buffer, 0);
21000 des_xmlNodePtr(n_cur, cur, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021001 xmlResetLastError();
21002 if (mem_base != xmlMemBlocks()) {
21003 printf("Leak of %d blocks found in xmlNodeBufGetContent",
21004 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021005 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021006 printf(" %d", n_buffer);
21007 printf(" %d", n_cur);
21008 printf("\n");
21009 }
21010 }
21011 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021012 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021013
Daniel Veillard42595322004-11-08 10:52:06 +000021014 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021015}
21016
21017
21018static int
21019test_xmlNodeDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021020 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021021
William M. Brack21e4ef22005-01-02 09:53:13 +000021022#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021023 int mem_base;
21024 int ret_val;
21025 xmlBufferPtr buf; /* the XML buffer output */
21026 int n_buf;
21027 xmlDocPtr doc; /* the document */
21028 int n_doc;
21029 xmlNodePtr cur; /* the current node */
21030 int n_cur;
21031 int level; /* the imbrication level for indenting */
21032 int n_level;
21033 int format; /* is formatting allowed */
21034 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021035
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021036 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
21037 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21038 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21039 for (n_level = 0;n_level < gen_nb_int;n_level++) {
21040 for (n_format = 0;n_format < gen_nb_int;n_format++) {
21041 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021042 buf = gen_xmlBufferPtr(n_buf, 0);
21043 doc = gen_xmlDocPtr(n_doc, 1);
21044 cur = gen_xmlNodePtr(n_cur, 2);
21045 level = gen_int(n_level, 3);
21046 format = gen_int(n_format, 4);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021047
21048 ret_val = xmlNodeDump(buf, doc, cur, level, format);
21049 desret_int(ret_val);
21050 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021051 des_xmlBufferPtr(n_buf, buf, 0);
21052 des_xmlDocPtr(n_doc, doc, 1);
21053 des_xmlNodePtr(n_cur, cur, 2);
21054 des_int(n_level, level, 3);
21055 des_int(n_format, format, 4);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021056 xmlResetLastError();
21057 if (mem_base != xmlMemBlocks()) {
21058 printf("Leak of %d blocks found in xmlNodeDump",
21059 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021060 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021061 printf(" %d", n_buf);
21062 printf(" %d", n_doc);
21063 printf(" %d", n_cur);
21064 printf(" %d", n_level);
21065 printf(" %d", n_format);
21066 printf("\n");
21067 }
21068 }
21069 }
21070 }
21071 }
21072 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021073 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021074#endif
21075
Daniel Veillard42595322004-11-08 10:52:06 +000021076 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021077}
21078
21079
21080static int
21081test_xmlNodeDumpOutput(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021082 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021083
William M. Brack21e4ef22005-01-02 09:53:13 +000021084#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000021085 int mem_base;
21086 xmlOutputBufferPtr buf; /* the XML buffer output */
21087 int n_buf;
21088 xmlDocPtr doc; /* the document */
21089 int n_doc;
21090 xmlNodePtr cur; /* the current node */
21091 int n_cur;
21092 int level; /* the imbrication level for indenting */
21093 int n_level;
21094 int format; /* is formatting allowed */
21095 int n_format;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021096 char * encoding; /* an optional encoding string */
Daniel Veillard3d97e662004-11-04 10:49:00 +000021097 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021098
Daniel Veillard3d97e662004-11-04 10:49:00 +000021099 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
21100 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21101 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21102 for (n_level = 0;n_level < gen_nb_int;n_level++) {
21103 for (n_format = 0;n_format < gen_nb_int;n_format++) {
21104 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
21105 mem_base = xmlMemBlocks();
21106 buf = gen_xmlOutputBufferPtr(n_buf, 0);
21107 doc = gen_xmlDocPtr(n_doc, 1);
21108 cur = gen_xmlNodePtr(n_cur, 2);
21109 level = gen_int(n_level, 3);
21110 format = gen_int(n_format, 4);
21111 encoding = gen_const_char_ptr(n_encoding, 5);
21112
William M. Brackf13f77f2004-11-12 16:03:48 +000021113 xmlNodeDumpOutput(buf, doc, cur, level, format, (const char *)encoding);
Daniel Veillard3d97e662004-11-04 10:49:00 +000021114 call_tests++;
21115 des_xmlOutputBufferPtr(n_buf, buf, 0);
21116 des_xmlDocPtr(n_doc, doc, 1);
21117 des_xmlNodePtr(n_cur, cur, 2);
21118 des_int(n_level, level, 3);
21119 des_int(n_format, format, 4);
William M. Brackf13f77f2004-11-12 16:03:48 +000021120 des_const_char_ptr(n_encoding, (const char *)encoding, 5);
Daniel Veillard3d97e662004-11-04 10:49:00 +000021121 xmlResetLastError();
21122 if (mem_base != xmlMemBlocks()) {
21123 printf("Leak of %d blocks found in xmlNodeDumpOutput",
21124 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021125 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021126 printf(" %d", n_buf);
21127 printf(" %d", n_doc);
21128 printf(" %d", n_cur);
21129 printf(" %d", n_level);
21130 printf(" %d", n_format);
21131 printf(" %d", n_encoding);
21132 printf("\n");
21133 }
21134 }
21135 }
21136 }
21137 }
21138 }
21139 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021140 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021141#endif
21142
Daniel Veillard42595322004-11-08 10:52:06 +000021143 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021144}
21145
21146
21147static int
21148test_xmlNodeGetBase(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021149 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021150
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021151 int mem_base;
21152 xmlChar * ret_val;
21153 xmlDocPtr doc; /* the document the node pertains to */
21154 int n_doc;
21155 xmlNodePtr cur; /* the node being checked */
21156 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021157
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021158 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21159 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21160 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021161 doc = gen_xmlDocPtr(n_doc, 0);
21162 cur = gen_xmlNodePtr(n_cur, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021163
21164 ret_val = xmlNodeGetBase(doc, cur);
21165 desret_xmlChar_ptr(ret_val);
21166 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021167 des_xmlDocPtr(n_doc, doc, 0);
21168 des_xmlNodePtr(n_cur, cur, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021169 xmlResetLastError();
21170 if (mem_base != xmlMemBlocks()) {
21171 printf("Leak of %d blocks found in xmlNodeGetBase",
21172 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021173 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021174 printf(" %d", n_doc);
21175 printf(" %d", n_cur);
21176 printf("\n");
21177 }
21178 }
21179 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021180 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021181
Daniel Veillard42595322004-11-08 10:52:06 +000021182 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021183}
21184
21185
21186static int
21187test_xmlNodeGetContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021188 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021189
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021190 int mem_base;
21191 xmlChar * ret_val;
21192 xmlNodePtr cur; /* the node being read */
21193 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021194
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021195 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21196 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021197 cur = gen_xmlNodePtr(n_cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021198
21199 ret_val = xmlNodeGetContent(cur);
21200 desret_xmlChar_ptr(ret_val);
21201 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021202 des_xmlNodePtr(n_cur, cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021203 xmlResetLastError();
21204 if (mem_base != xmlMemBlocks()) {
21205 printf("Leak of %d blocks found in xmlNodeGetContent",
21206 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021207 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021208 printf(" %d", n_cur);
21209 printf("\n");
21210 }
21211 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021212 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021213
Daniel Veillard42595322004-11-08 10:52:06 +000021214 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021215}
21216
21217
21218static int
21219test_xmlNodeGetLang(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021220 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021221
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021222 int mem_base;
21223 xmlChar * ret_val;
21224 xmlNodePtr cur; /* the node being checked */
21225 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021226
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021227 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21228 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021229 cur = gen_xmlNodePtr(n_cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021230
21231 ret_val = xmlNodeGetLang(cur);
21232 desret_xmlChar_ptr(ret_val);
21233 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021234 des_xmlNodePtr(n_cur, cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021235 xmlResetLastError();
21236 if (mem_base != xmlMemBlocks()) {
21237 printf("Leak of %d blocks found in xmlNodeGetLang",
21238 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021239 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021240 printf(" %d", n_cur);
21241 printf("\n");
21242 }
21243 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021244 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021245
Daniel Veillard42595322004-11-08 10:52:06 +000021246 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021247}
21248
21249
21250static int
21251test_xmlNodeGetSpacePreserve(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021252 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021253
21254 int mem_base;
21255 int ret_val;
21256 xmlNodePtr cur; /* the node being checked */
21257 int n_cur;
21258
21259 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21260 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021261 cur = gen_xmlNodePtr(n_cur, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021262
21263 ret_val = xmlNodeGetSpacePreserve(cur);
21264 desret_int(ret_val);
21265 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021266 des_xmlNodePtr(n_cur, cur, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021267 xmlResetLastError();
21268 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021269 printf("Leak of %d blocks found in xmlNodeGetSpacePreserve",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021270 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021271 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021272 printf(" %d", n_cur);
21273 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021274 }
21275 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021276 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021277
Daniel Veillard42595322004-11-08 10:52:06 +000021278 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021279}
21280
21281
21282static int
21283test_xmlNodeIsText(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021284 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021285
21286 int mem_base;
21287 int ret_val;
21288 xmlNodePtr node; /* the node */
21289 int n_node;
21290
21291 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
21292 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021293 node = gen_xmlNodePtr(n_node, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021294
21295 ret_val = xmlNodeIsText(node);
21296 desret_int(ret_val);
21297 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021298 des_xmlNodePtr(n_node, node, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021299 xmlResetLastError();
21300 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021301 printf("Leak of %d blocks found in xmlNodeIsText",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021302 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021303 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021304 printf(" %d", n_node);
21305 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021306 }
21307 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021308 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021309
Daniel Veillard42595322004-11-08 10:52:06 +000021310 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021311}
21312
21313
21314static int
21315test_xmlNodeListGetRawString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021316 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021317
William M. Brack21e4ef22005-01-02 09:53:13 +000021318#if defined(LIBXML_TREE_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021319 int mem_base;
21320 xmlChar * ret_val;
21321 xmlDocPtr doc; /* the document */
21322 int n_doc;
21323 xmlNodePtr list; /* a Node list */
21324 int n_list;
21325 int inLine; /* should we replace entity contents or show their external form */
21326 int n_inLine;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021327
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021328 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21329 for (n_list = 0;n_list < gen_nb_xmlNodePtr;n_list++) {
21330 for (n_inLine = 0;n_inLine < gen_nb_int;n_inLine++) {
21331 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021332 doc = gen_xmlDocPtr(n_doc, 0);
21333 list = gen_xmlNodePtr(n_list, 1);
21334 inLine = gen_int(n_inLine, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021335
21336 ret_val = xmlNodeListGetRawString(doc, list, inLine);
21337 desret_xmlChar_ptr(ret_val);
21338 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021339 des_xmlDocPtr(n_doc, doc, 0);
21340 des_xmlNodePtr(n_list, list, 1);
21341 des_int(n_inLine, inLine, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021342 xmlResetLastError();
21343 if (mem_base != xmlMemBlocks()) {
21344 printf("Leak of %d blocks found in xmlNodeListGetRawString",
21345 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021346 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021347 printf(" %d", n_doc);
21348 printf(" %d", n_list);
21349 printf(" %d", n_inLine);
21350 printf("\n");
21351 }
21352 }
21353 }
21354 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021355 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021356#endif
21357
Daniel Veillard42595322004-11-08 10:52:06 +000021358 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021359}
21360
21361
21362static int
21363test_xmlNodeListGetString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021364 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021365
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021366 int mem_base;
21367 xmlChar * ret_val;
21368 xmlDocPtr doc; /* the document */
21369 int n_doc;
21370 xmlNodePtr list; /* a Node list */
21371 int n_list;
21372 int inLine; /* should we replace entity contents or show their external form */
21373 int n_inLine;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021374
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021375 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21376 for (n_list = 0;n_list < gen_nb_xmlNodePtr;n_list++) {
21377 for (n_inLine = 0;n_inLine < gen_nb_int;n_inLine++) {
21378 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021379 doc = gen_xmlDocPtr(n_doc, 0);
21380 list = gen_xmlNodePtr(n_list, 1);
21381 inLine = gen_int(n_inLine, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021382
21383 ret_val = xmlNodeListGetString(doc, list, inLine);
21384 desret_xmlChar_ptr(ret_val);
21385 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021386 des_xmlDocPtr(n_doc, doc, 0);
21387 des_xmlNodePtr(n_list, list, 1);
21388 des_int(n_inLine, inLine, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021389 xmlResetLastError();
21390 if (mem_base != xmlMemBlocks()) {
21391 printf("Leak of %d blocks found in xmlNodeListGetString",
21392 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021393 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021394 printf(" %d", n_doc);
21395 printf(" %d", n_list);
21396 printf(" %d", n_inLine);
21397 printf("\n");
21398 }
21399 }
21400 }
21401 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021402 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021403
Daniel Veillard42595322004-11-08 10:52:06 +000021404 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021405}
21406
21407
21408static int
21409test_xmlNodeSetBase(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021410 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021411
William M. Brack21e4ef22005-01-02 09:53:13 +000021412#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000021413 int mem_base;
21414 xmlNodePtr cur; /* the node being changed */
21415 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021416 xmlChar * uri; /* the new base URI */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021417 int n_uri;
21418
21419 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21420 for (n_uri = 0;n_uri < gen_nb_const_xmlChar_ptr;n_uri++) {
21421 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021422 cur = gen_xmlNodePtr(n_cur, 0);
21423 uri = gen_const_xmlChar_ptr(n_uri, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021424
William M. Brackf13f77f2004-11-12 16:03:48 +000021425 xmlNodeSetBase(cur, (const xmlChar *)uri);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021426 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021427 des_xmlNodePtr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000021428 des_const_xmlChar_ptr(n_uri, (const xmlChar *)uri, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021429 xmlResetLastError();
21430 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021431 printf("Leak of %d blocks found in xmlNodeSetBase",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021432 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021433 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021434 printf(" %d", n_cur);
21435 printf(" %d", n_uri);
21436 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021437 }
21438 }
21439 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021440 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021441#endif
21442
Daniel Veillard42595322004-11-08 10:52:06 +000021443 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021444}
21445
21446
21447static int
21448test_xmlNodeSetContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021449 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021450
21451 int mem_base;
21452 xmlNodePtr cur; /* the node being modified */
21453 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021454 xmlChar * content; /* the new value of the content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021455 int n_content;
21456
21457 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21458 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
21459 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021460 cur = gen_xmlNodePtr(n_cur, 0);
21461 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021462
William M. Brackf13f77f2004-11-12 16:03:48 +000021463 xmlNodeSetContent(cur, (const xmlChar *)content);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021464 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021465 des_xmlNodePtr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000021466 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021467 xmlResetLastError();
21468 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021469 printf("Leak of %d blocks found in xmlNodeSetContent",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021470 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021471 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021472 printf(" %d", n_cur);
21473 printf(" %d", n_content);
21474 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021475 }
21476 }
21477 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021478 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021479
Daniel Veillard42595322004-11-08 10:52:06 +000021480 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021481}
21482
21483
21484static int
21485test_xmlNodeSetContentLen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021486 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021487
William M. Brack21e4ef22005-01-02 09:53:13 +000021488#if defined(LIBXML_TREE_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000021489 int mem_base;
21490 xmlNodePtr cur; /* the node being modified */
21491 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021492 xmlChar * content; /* the new value of the content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021493 int n_content;
21494 int len; /* the size of @content */
21495 int n_len;
21496
21497 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21498 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
21499 for (n_len = 0;n_len < gen_nb_int;n_len++) {
21500 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021501 cur = gen_xmlNodePtr(n_cur, 0);
21502 content = gen_const_xmlChar_ptr(n_content, 1);
21503 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021504
William M. Brackf13f77f2004-11-12 16:03:48 +000021505 xmlNodeSetContentLen(cur, (const xmlChar *)content, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021506 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021507 des_xmlNodePtr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000021508 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000021509 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021510 xmlResetLastError();
21511 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021512 printf("Leak of %d blocks found in xmlNodeSetContentLen",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021513 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021514 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021515 printf(" %d", n_cur);
21516 printf(" %d", n_content);
21517 printf(" %d", n_len);
21518 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021519 }
21520 }
21521 }
21522 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021523 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021524#endif
21525
Daniel Veillard42595322004-11-08 10:52:06 +000021526 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021527}
21528
21529
21530static int
21531test_xmlNodeSetLang(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021532 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021533
William M. Brack21e4ef22005-01-02 09:53:13 +000021534#if defined(LIBXML_TREE_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000021535 int mem_base;
21536 xmlNodePtr cur; /* the node being changed */
21537 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021538 xmlChar * lang; /* the language description */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021539 int n_lang;
21540
21541 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21542 for (n_lang = 0;n_lang < gen_nb_const_xmlChar_ptr;n_lang++) {
21543 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021544 cur = gen_xmlNodePtr(n_cur, 0);
21545 lang = gen_const_xmlChar_ptr(n_lang, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021546
William M. Brackf13f77f2004-11-12 16:03:48 +000021547 xmlNodeSetLang(cur, (const xmlChar *)lang);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021548 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021549 des_xmlNodePtr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000021550 des_const_xmlChar_ptr(n_lang, (const xmlChar *)lang, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021551 xmlResetLastError();
21552 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021553 printf("Leak of %d blocks found in xmlNodeSetLang",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021554 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021555 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021556 printf(" %d", n_cur);
21557 printf(" %d", n_lang);
21558 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021559 }
21560 }
21561 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021562 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021563#endif
21564
Daniel Veillard42595322004-11-08 10:52:06 +000021565 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021566}
21567
21568
21569static int
21570test_xmlNodeSetName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021571 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021572
William M. Brack21e4ef22005-01-02 09:53:13 +000021573#if defined(LIBXML_TREE_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000021574 int mem_base;
21575 xmlNodePtr cur; /* the node being changed */
21576 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021577 xmlChar * name; /* the new tag name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021578 int n_name;
21579
21580 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21581 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
21582 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021583 cur = gen_xmlNodePtr(n_cur, 0);
21584 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021585
William M. Brackf13f77f2004-11-12 16:03:48 +000021586 xmlNodeSetName(cur, (const xmlChar *)name);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021587 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021588 des_xmlNodePtr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000021589 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021590 xmlResetLastError();
21591 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021592 printf("Leak of %d blocks found in xmlNodeSetName",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021593 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021594 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021595 printf(" %d", n_cur);
21596 printf(" %d", n_name);
21597 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021598 }
21599 }
21600 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021601 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021602#endif
21603
Daniel Veillard42595322004-11-08 10:52:06 +000021604 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021605}
21606
21607
21608static int
21609test_xmlNodeSetSpacePreserve(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021610 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021611
William M. Brack21e4ef22005-01-02 09:53:13 +000021612#if defined(LIBXML_TREE_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000021613 int mem_base;
21614 xmlNodePtr cur; /* the node being changed */
21615 int n_cur;
21616 int val; /* the xml:space value ("0": default, 1: "preserve") */
21617 int n_val;
21618
21619 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21620 for (n_val = 0;n_val < gen_nb_int;n_val++) {
21621 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021622 cur = gen_xmlNodePtr(n_cur, 0);
21623 val = gen_int(n_val, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021624
21625 xmlNodeSetSpacePreserve(cur, val);
21626 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021627 des_xmlNodePtr(n_cur, cur, 0);
21628 des_int(n_val, val, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021629 xmlResetLastError();
21630 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021631 printf("Leak of %d blocks found in xmlNodeSetSpacePreserve",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021632 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021633 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021634 printf(" %d", n_cur);
21635 printf(" %d", n_val);
21636 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021637 }
21638 }
21639 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021640 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021641#endif
21642
Daniel Veillard42595322004-11-08 10:52:06 +000021643 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021644}
21645
21646
21647static int
21648test_xmlReconciliateNs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021649 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021650
William M. Brack21e4ef22005-01-02 09:53:13 +000021651#if defined(LIBXML_TREE_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000021652#ifdef LIBXML_TREE_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000021653 int mem_base;
21654 int ret_val;
21655 xmlDocPtr doc; /* the document */
21656 int n_doc;
21657 xmlNodePtr tree; /* a node defining the subtree to reconciliate */
21658 int n_tree;
21659
21660 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21661 for (n_tree = 0;n_tree < gen_nb_xmlNodePtr;n_tree++) {
21662 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021663 doc = gen_xmlDocPtr(n_doc, 0);
21664 tree = gen_xmlNodePtr(n_tree, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021665
21666 ret_val = xmlReconciliateNs(doc, tree);
21667 desret_int(ret_val);
21668 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021669 des_xmlDocPtr(n_doc, doc, 0);
21670 des_xmlNodePtr(n_tree, tree, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021671 xmlResetLastError();
21672 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021673 printf("Leak of %d blocks found in xmlReconciliateNs",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021674 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021675 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021676 printf(" %d", n_doc);
21677 printf(" %d", n_tree);
21678 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021679 }
21680 }
21681 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021682 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000021683#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000021684#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000021685
Daniel Veillard42595322004-11-08 10:52:06 +000021686 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021687}
21688
21689
21690static int
21691test_xmlRemoveProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021692 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021693
William M. Brack21e4ef22005-01-02 09:53:13 +000021694#if defined(LIBXML_TREE_ENABLED)
Daniel Veillardce244ad2004-11-05 10:03:46 +000021695 int mem_base;
21696 int ret_val;
21697 xmlAttrPtr cur; /* an attribute */
21698 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021699
Daniel Veillardce244ad2004-11-05 10:03:46 +000021700 for (n_cur = 0;n_cur < gen_nb_xmlAttrPtr;n_cur++) {
21701 mem_base = xmlMemBlocks();
21702 cur = gen_xmlAttrPtr(n_cur, 0);
21703
21704 ret_val = xmlRemoveProp(cur);
21705 cur = NULL;
21706 desret_int(ret_val);
21707 call_tests++;
21708 des_xmlAttrPtr(n_cur, cur, 0);
21709 xmlResetLastError();
21710 if (mem_base != xmlMemBlocks()) {
21711 printf("Leak of %d blocks found in xmlRemoveProp",
21712 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021713 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000021714 printf(" %d", n_cur);
21715 printf("\n");
21716 }
21717 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021718 function_tests++;
Daniel Veillardce244ad2004-11-05 10:03:46 +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_xmlReplaceNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021727 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021728
William M. Brack21e4ef22005-01-02 09:53:13 +000021729#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000021730 int mem_base;
21731 xmlNodePtr ret_val;
21732 xmlNodePtr old; /* the old node */
21733 int n_old;
21734 xmlNodePtr cur; /* the node */
21735 int n_cur;
21736
21737 for (n_old = 0;n_old < gen_nb_xmlNodePtr;n_old++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021738 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr_in;n_cur++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000021739 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021740 old = gen_xmlNodePtr(n_old, 0);
21741 cur = gen_xmlNodePtr_in(n_cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021742
21743 ret_val = xmlReplaceNode(old, cur);
Daniel Veillardce244ad2004-11-05 10:03:46 +000021744 if (cur != NULL) {
21745 xmlUnlinkNode(cur);
Daniel Veillarda03e3652004-11-02 18:45:30 +000021746 xmlFreeNode(cur) ; cur = NULL ; }
Daniel Veillardce244ad2004-11-05 10:03:46 +000021747 if (old != NULL) {
21748 xmlUnlinkNode(old);
21749 xmlFreeNode(old) ; old = NULL ; }
21750 ret_val = NULL;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021751 desret_xmlNodePtr(ret_val);
21752 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021753 des_xmlNodePtr(n_old, old, 0);
21754 des_xmlNodePtr_in(n_cur, cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021755 xmlResetLastError();
21756 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021757 printf("Leak of %d blocks found in xmlReplaceNode",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021758 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021759 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021760 printf(" %d", n_old);
21761 printf(" %d", n_cur);
21762 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021763 }
21764 }
21765 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021766 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021767#endif
21768
Daniel Veillard42595322004-11-08 10:52:06 +000021769 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021770}
21771
21772
21773static int
21774test_xmlSaveFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021775 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021776
William M. Brack21e4ef22005-01-02 09:53:13 +000021777#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000021778 int mem_base;
21779 int ret_val;
21780 const char * filename; /* the filename (or URL) */
21781 int n_filename;
21782 xmlDocPtr cur; /* the document */
21783 int n_cur;
21784
21785 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
21786 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
21787 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021788 filename = gen_fileoutput(n_filename, 0);
21789 cur = gen_xmlDocPtr(n_cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021790
21791 ret_val = xmlSaveFile(filename, cur);
21792 desret_int(ret_val);
21793 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021794 des_fileoutput(n_filename, filename, 0);
21795 des_xmlDocPtr(n_cur, cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021796 xmlResetLastError();
21797 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021798 printf("Leak of %d blocks found in xmlSaveFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021799 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021800 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021801 printf(" %d", n_filename);
21802 printf(" %d", n_cur);
21803 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021804 }
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_xmlSaveFileEnc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021816 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021817
William M. Brack21e4ef22005-01-02 09:53:13 +000021818#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000021819 int mem_base;
21820 int ret_val;
21821 const char * filename; /* the filename (or URL) */
21822 int n_filename;
21823 xmlDocPtr cur; /* the document */
21824 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021825 char * encoding; /* the name of an encoding (or NULL) */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021826 int n_encoding;
21827
21828 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
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();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021832 filename = gen_fileoutput(n_filename, 0);
21833 cur = gen_xmlDocPtr(n_cur, 1);
21834 encoding = gen_const_char_ptr(n_encoding, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021835
William M. Brackf13f77f2004-11-12 16:03:48 +000021836 ret_val = xmlSaveFileEnc(filename, cur, (const char *)encoding);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021837 desret_int(ret_val);
21838 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021839 des_fileoutput(n_filename, filename, 0);
21840 des_xmlDocPtr(n_cur, cur, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000021841 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021842 xmlResetLastError();
21843 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021844 printf("Leak of %d blocks found in xmlSaveFileEnc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021845 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021846 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021847 printf(" %d", n_filename);
21848 printf(" %d", n_cur);
21849 printf(" %d", n_encoding);
21850 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021851 }
21852 }
21853 }
21854 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021855 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021856#endif
21857
Daniel Veillard42595322004-11-08 10:52:06 +000021858 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021859}
21860
21861
21862static int
21863test_xmlSaveFileTo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021864 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021865
William M. Brack21e4ef22005-01-02 09:53:13 +000021866#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000021867 int mem_base;
21868 int ret_val;
21869 xmlOutputBufferPtr buf; /* an output I/O buffer */
21870 int n_buf;
21871 xmlDocPtr cur; /* the document */
21872 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021873 char * encoding; /* the encoding if any assuming the I/O layer handles the trancoding */
Daniel Veillard3d97e662004-11-04 10:49:00 +000021874 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021875
Daniel Veillard3d97e662004-11-04 10:49:00 +000021876 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
21877 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
21878 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
21879 mem_base = xmlMemBlocks();
21880 buf = gen_xmlOutputBufferPtr(n_buf, 0);
21881 cur = gen_xmlDocPtr(n_cur, 1);
21882 encoding = gen_const_char_ptr(n_encoding, 2);
21883
William M. Brackf13f77f2004-11-12 16:03:48 +000021884 ret_val = xmlSaveFileTo(buf, cur, (const char *)encoding);
Daniel Veillard3d97e662004-11-04 10:49:00 +000021885 buf = NULL;
21886 desret_int(ret_val);
21887 call_tests++;
21888 des_xmlOutputBufferPtr(n_buf, buf, 0);
21889 des_xmlDocPtr(n_cur, cur, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000021890 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +000021891 xmlResetLastError();
21892 if (mem_base != xmlMemBlocks()) {
21893 printf("Leak of %d blocks found in xmlSaveFileTo",
21894 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021895 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021896 printf(" %d", n_buf);
21897 printf(" %d", n_cur);
21898 printf(" %d", n_encoding);
21899 printf("\n");
21900 }
21901 }
21902 }
21903 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021904 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +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_xmlSaveFormatFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021913 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021914
William M. Brack21e4ef22005-01-02 09:53:13 +000021915#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000021916 int mem_base;
21917 int ret_val;
21918 const char * filename; /* the filename (or URL) */
21919 int n_filename;
21920 xmlDocPtr cur; /* the document */
21921 int n_cur;
21922 int format; /* should formatting spaces been added */
21923 int n_format;
21924
21925 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
21926 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
21927 for (n_format = 0;n_format < gen_nb_int;n_format++) {
21928 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021929 filename = gen_fileoutput(n_filename, 0);
21930 cur = gen_xmlDocPtr(n_cur, 1);
21931 format = gen_int(n_format, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021932
21933 ret_val = xmlSaveFormatFile(filename, cur, format);
21934 desret_int(ret_val);
21935 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021936 des_fileoutput(n_filename, filename, 0);
21937 des_xmlDocPtr(n_cur, cur, 1);
21938 des_int(n_format, format, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021939 xmlResetLastError();
21940 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021941 printf("Leak of %d blocks found in xmlSaveFormatFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021942 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021943 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021944 printf(" %d", n_filename);
21945 printf(" %d", n_cur);
21946 printf(" %d", n_format);
21947 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021948 }
21949 }
21950 }
21951 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021952 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021953#endif
21954
Daniel Veillard42595322004-11-08 10:52:06 +000021955 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021956}
21957
21958
21959static int
21960test_xmlSaveFormatFileEnc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021961 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021962
William M. Brack21e4ef22005-01-02 09:53:13 +000021963#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000021964 int mem_base;
21965 int ret_val;
21966 const char * filename; /* the filename or URL to output */
21967 int n_filename;
21968 xmlDocPtr cur; /* the document being saved */
21969 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021970 char * encoding; /* the name of the encoding to use or NULL. */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021971 int n_encoding;
21972 int format; /* should formatting spaces be added. */
21973 int n_format;
21974
21975 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
21976 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
21977 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
21978 for (n_format = 0;n_format < gen_nb_int;n_format++) {
21979 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021980 filename = gen_fileoutput(n_filename, 0);
21981 cur = gen_xmlDocPtr(n_cur, 1);
21982 encoding = gen_const_char_ptr(n_encoding, 2);
21983 format = gen_int(n_format, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021984
William M. Brackf13f77f2004-11-12 16:03:48 +000021985 ret_val = xmlSaveFormatFileEnc(filename, cur, (const char *)encoding, format);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021986 desret_int(ret_val);
21987 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021988 des_fileoutput(n_filename, filename, 0);
21989 des_xmlDocPtr(n_cur, cur, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000021990 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +000021991 des_int(n_format, format, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021992 xmlResetLastError();
21993 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021994 printf("Leak of %d blocks found in xmlSaveFormatFileEnc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021995 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021996 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021997 printf(" %d", n_filename);
21998 printf(" %d", n_cur);
21999 printf(" %d", n_encoding);
22000 printf(" %d", n_format);
22001 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022002 }
22003 }
22004 }
22005 }
22006 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022007 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022008#endif
22009
Daniel Veillard42595322004-11-08 10:52:06 +000022010 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022011}
22012
22013
22014static int
22015test_xmlSaveFormatFileTo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022016 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022017
William M. Brack21e4ef22005-01-02 09:53:13 +000022018#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000022019 int mem_base;
22020 int ret_val;
22021 xmlOutputBufferPtr buf; /* an output I/O buffer */
22022 int n_buf;
22023 xmlDocPtr cur; /* the document */
22024 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022025 char * encoding; /* the encoding if any assuming the I/O layer handles the trancoding */
Daniel Veillard3d97e662004-11-04 10:49:00 +000022026 int n_encoding;
22027 int format; /* should formatting spaces been added */
22028 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022029
Daniel Veillard3d97e662004-11-04 10:49:00 +000022030 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
22031 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
22032 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
22033 for (n_format = 0;n_format < gen_nb_int;n_format++) {
22034 mem_base = xmlMemBlocks();
22035 buf = gen_xmlOutputBufferPtr(n_buf, 0);
22036 cur = gen_xmlDocPtr(n_cur, 1);
22037 encoding = gen_const_char_ptr(n_encoding, 2);
22038 format = gen_int(n_format, 3);
22039
William M. Brackf13f77f2004-11-12 16:03:48 +000022040 ret_val = xmlSaveFormatFileTo(buf, cur, (const char *)encoding, format);
Daniel Veillard3d97e662004-11-04 10:49:00 +000022041 buf = NULL;
22042 desret_int(ret_val);
22043 call_tests++;
22044 des_xmlOutputBufferPtr(n_buf, buf, 0);
22045 des_xmlDocPtr(n_cur, cur, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000022046 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +000022047 des_int(n_format, format, 3);
22048 xmlResetLastError();
22049 if (mem_base != xmlMemBlocks()) {
22050 printf("Leak of %d blocks found in xmlSaveFormatFileTo",
22051 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022052 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022053 printf(" %d", n_buf);
22054 printf(" %d", n_cur);
22055 printf(" %d", n_encoding);
22056 printf(" %d", n_format);
22057 printf("\n");
22058 }
22059 }
22060 }
22061 }
22062 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022063 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022064#endif
22065
Daniel Veillard42595322004-11-08 10:52:06 +000022066 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022067}
22068
22069
22070static int
22071test_xmlSearchNs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022072 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022073
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022074 int mem_base;
22075 xmlNsPtr ret_val;
22076 xmlDocPtr doc; /* the document */
22077 int n_doc;
22078 xmlNodePtr node; /* the current node */
22079 int n_node;
22080 xmlChar * nameSpace; /* the namespace prefix */
22081 int n_nameSpace;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022082
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022083 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
22084 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22085 for (n_nameSpace = 0;n_nameSpace < gen_nb_const_xmlChar_ptr;n_nameSpace++) {
22086 mem_base = xmlMemBlocks();
22087 doc = gen_xmlDocPtr(n_doc, 0);
22088 node = gen_xmlNodePtr(n_node, 1);
22089 nameSpace = gen_const_xmlChar_ptr(n_nameSpace, 2);
22090
William M. Brackf13f77f2004-11-12 16:03:48 +000022091 ret_val = xmlSearchNs(doc, node, (const xmlChar *)nameSpace);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022092 desret_xmlNsPtr(ret_val);
22093 call_tests++;
22094 des_xmlDocPtr(n_doc, doc, 0);
22095 des_xmlNodePtr(n_node, node, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000022096 des_const_xmlChar_ptr(n_nameSpace, (const xmlChar *)nameSpace, 2);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022097 xmlResetLastError();
22098 if (mem_base != xmlMemBlocks()) {
22099 printf("Leak of %d blocks found in xmlSearchNs",
22100 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022101 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022102 printf(" %d", n_doc);
22103 printf(" %d", n_node);
22104 printf(" %d", n_nameSpace);
22105 printf("\n");
22106 }
22107 }
22108 }
22109 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022110 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022111
Daniel Veillard42595322004-11-08 10:52:06 +000022112 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022113}
22114
22115
22116static int
22117test_xmlSearchNsByHref(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022118 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022119
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022120 int mem_base;
22121 xmlNsPtr ret_val;
22122 xmlDocPtr doc; /* the document */
22123 int n_doc;
22124 xmlNodePtr node; /* the current node */
22125 int n_node;
22126 xmlChar * href; /* the namespace value */
22127 int n_href;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022128
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022129 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
22130 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22131 for (n_href = 0;n_href < gen_nb_const_xmlChar_ptr;n_href++) {
22132 mem_base = xmlMemBlocks();
22133 doc = gen_xmlDocPtr(n_doc, 0);
22134 node = gen_xmlNodePtr(n_node, 1);
22135 href = gen_const_xmlChar_ptr(n_href, 2);
22136
William M. Brackf13f77f2004-11-12 16:03:48 +000022137 ret_val = xmlSearchNsByHref(doc, node, (const xmlChar *)href);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022138 desret_xmlNsPtr(ret_val);
22139 call_tests++;
22140 des_xmlDocPtr(n_doc, doc, 0);
22141 des_xmlNodePtr(n_node, node, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000022142 des_const_xmlChar_ptr(n_href, (const xmlChar *)href, 2);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022143 xmlResetLastError();
22144 if (mem_base != xmlMemBlocks()) {
22145 printf("Leak of %d blocks found in xmlSearchNsByHref",
22146 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022147 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022148 printf(" %d", n_doc);
22149 printf(" %d", n_node);
22150 printf(" %d", n_href);
22151 printf("\n");
22152 }
22153 }
22154 }
22155 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022156 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022157
Daniel Veillard42595322004-11-08 10:52:06 +000022158 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022159}
22160
22161
22162static int
22163test_xmlSetBufferAllocationScheme(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022164 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022165
Daniel Veillard57b25162004-11-06 14:50:18 +000022166 int mem_base;
22167 xmlBufferAllocationScheme scheme; /* allocation method to use */
22168 int n_scheme;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022169
Daniel Veillard57b25162004-11-06 14:50:18 +000022170 for (n_scheme = 0;n_scheme < gen_nb_xmlBufferAllocationScheme;n_scheme++) {
22171 mem_base = xmlMemBlocks();
22172 scheme = gen_xmlBufferAllocationScheme(n_scheme, 0);
22173
22174 xmlSetBufferAllocationScheme(scheme);
22175 call_tests++;
22176 des_xmlBufferAllocationScheme(n_scheme, scheme, 0);
22177 xmlResetLastError();
22178 if (mem_base != xmlMemBlocks()) {
22179 printf("Leak of %d blocks found in xmlSetBufferAllocationScheme",
22180 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022181 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000022182 printf(" %d", n_scheme);
22183 printf("\n");
22184 }
22185 }
Daniel Veillard57b25162004-11-06 14:50:18 +000022186 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022187
Daniel Veillard42595322004-11-08 10:52:06 +000022188 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022189}
22190
22191
22192static int
22193test_xmlSetCompressMode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022194 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022195
22196 int mem_base;
22197 int mode; /* the compression ratio */
22198 int n_mode;
22199
22200 for (n_mode = 0;n_mode < gen_nb_int;n_mode++) {
22201 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022202 mode = gen_int(n_mode, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022203
22204 xmlSetCompressMode(mode);
22205 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022206 des_int(n_mode, mode, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022207 xmlResetLastError();
22208 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022209 printf("Leak of %d blocks found in xmlSetCompressMode",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022210 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022211 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022212 printf(" %d", n_mode);
22213 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022214 }
22215 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000022216 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022217
Daniel Veillard42595322004-11-08 10:52:06 +000022218 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022219}
22220
22221
22222static int
22223test_xmlSetDocCompressMode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022224 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022225
22226 int mem_base;
22227 xmlDocPtr doc; /* the document */
22228 int n_doc;
22229 int mode; /* the compression ratio */
22230 int n_mode;
22231
22232 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
22233 for (n_mode = 0;n_mode < gen_nb_int;n_mode++) {
22234 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022235 doc = gen_xmlDocPtr(n_doc, 0);
22236 mode = gen_int(n_mode, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022237
22238 xmlSetDocCompressMode(doc, mode);
22239 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022240 des_xmlDocPtr(n_doc, doc, 0);
22241 des_int(n_mode, mode, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022242 xmlResetLastError();
22243 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022244 printf("Leak of %d blocks found in xmlSetDocCompressMode",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022245 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022246 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022247 printf(" %d", n_doc);
22248 printf(" %d", n_mode);
22249 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022250 }
22251 }
22252 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000022253 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022254
Daniel Veillard42595322004-11-08 10:52:06 +000022255 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022256}
22257
22258
22259static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000022260test_xmlSetNs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022261 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022262
Daniel Veillard27f20102004-11-05 11:50:11 +000022263 int mem_base;
22264 xmlNodePtr node; /* a node in the document */
22265 int n_node;
22266 xmlNsPtr ns; /* a namespace pointer */
22267 int n_ns;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022268
Daniel Veillard27f20102004-11-05 11:50:11 +000022269 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22270 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
22271 mem_base = xmlMemBlocks();
22272 node = gen_xmlNodePtr(n_node, 0);
22273 ns = gen_xmlNsPtr(n_ns, 1);
22274
22275 xmlSetNs(node, ns);
22276 call_tests++;
22277 des_xmlNodePtr(n_node, node, 0);
22278 des_xmlNsPtr(n_ns, ns, 1);
22279 xmlResetLastError();
22280 if (mem_base != xmlMemBlocks()) {
22281 printf("Leak of %d blocks found in xmlSetNs",
22282 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022283 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000022284 printf(" %d", n_node);
22285 printf(" %d", n_ns);
22286 printf("\n");
22287 }
22288 }
22289 }
Daniel Veillard27f20102004-11-05 11:50:11 +000022290 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022291
Daniel Veillard42595322004-11-08 10:52:06 +000022292 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022293}
22294
22295
22296static int
22297test_xmlSetNsProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022298 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022299
William M. Brack21e4ef22005-01-02 09:53:13 +000022300#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED)
Daniel Veillard57b25162004-11-06 14:50:18 +000022301 int mem_base;
22302 xmlAttrPtr ret_val;
22303 xmlNodePtr node; /* the node */
22304 int n_node;
22305 xmlNsPtr ns; /* the namespace definition */
22306 int n_ns;
22307 xmlChar * name; /* the attribute name */
22308 int n_name;
22309 xmlChar * value; /* the attribute value */
22310 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022311
Daniel Veillard57b25162004-11-06 14:50:18 +000022312 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22313 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
22314 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
22315 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22316 mem_base = xmlMemBlocks();
22317 node = gen_xmlNodePtr(n_node, 0);
22318 ns = gen_xmlNsPtr(n_ns, 1);
22319 name = gen_const_xmlChar_ptr(n_name, 2);
22320 value = gen_const_xmlChar_ptr(n_value, 3);
22321
William M. Brackf13f77f2004-11-12 16:03:48 +000022322 ret_val = xmlSetNsProp(node, ns, (const xmlChar *)name, (const xmlChar *)value);
Daniel Veillard57b25162004-11-06 14:50:18 +000022323 desret_xmlAttrPtr(ret_val);
22324 call_tests++;
22325 des_xmlNodePtr(n_node, node, 0);
22326 des_xmlNsPtr(n_ns, ns, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000022327 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
22328 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 3);
Daniel Veillard57b25162004-11-06 14:50:18 +000022329 xmlResetLastError();
22330 if (mem_base != xmlMemBlocks()) {
22331 printf("Leak of %d blocks found in xmlSetNsProp",
22332 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022333 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000022334 printf(" %d", n_node);
22335 printf(" %d", n_ns);
22336 printf(" %d", n_name);
22337 printf(" %d", n_value);
22338 printf("\n");
22339 }
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
22352test_xmlSetProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022353 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022354
William M. Brack21e4ef22005-01-02 09:53:13 +000022355#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED)
Daniel Veillard57b25162004-11-06 14:50:18 +000022356 int mem_base;
22357 xmlAttrPtr ret_val;
22358 xmlNodePtr node; /* the node */
22359 int n_node;
22360 xmlChar * name; /* the attribute name */
22361 int n_name;
22362 xmlChar * value; /* the attribute value */
22363 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022364
Daniel Veillard57b25162004-11-06 14:50:18 +000022365 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22366 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
22367 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22368 mem_base = xmlMemBlocks();
22369 node = gen_xmlNodePtr(n_node, 0);
22370 name = gen_const_xmlChar_ptr(n_name, 1);
22371 value = gen_const_xmlChar_ptr(n_value, 2);
22372
William M. Brackf13f77f2004-11-12 16:03:48 +000022373 ret_val = xmlSetProp(node, (const xmlChar *)name, (const xmlChar *)value);
Daniel Veillard57b25162004-11-06 14:50:18 +000022374 desret_xmlAttrPtr(ret_val);
22375 call_tests++;
22376 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000022377 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
22378 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 2);
Daniel Veillard57b25162004-11-06 14:50:18 +000022379 xmlResetLastError();
22380 if (mem_base != xmlMemBlocks()) {
22381 printf("Leak of %d blocks found in xmlSetProp",
22382 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022383 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000022384 printf(" %d", n_node);
22385 printf(" %d", n_name);
22386 printf(" %d", n_value);
22387 printf("\n");
22388 }
22389 }
22390 }
22391 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022392 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +000022393#endif
22394
Daniel Veillard42595322004-11-08 10:52:06 +000022395 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022396}
22397
22398
22399static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000022400test_xmlSplitQName2(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022401 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022402
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022403 int mem_base;
22404 xmlChar * ret_val;
22405 xmlChar * name; /* the full QName */
22406 int n_name;
22407 xmlChar ** prefix; /* a xmlChar ** */
22408 int n_prefix;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022409
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022410 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
22411 for (n_prefix = 0;n_prefix < gen_nb_xmlChar_ptr_ptr;n_prefix++) {
22412 mem_base = xmlMemBlocks();
22413 name = gen_const_xmlChar_ptr(n_name, 0);
22414 prefix = gen_xmlChar_ptr_ptr(n_prefix, 1);
22415
William M. Brackf13f77f2004-11-12 16:03:48 +000022416 ret_val = xmlSplitQName2((const xmlChar *)name, prefix);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022417 desret_xmlChar_ptr(ret_val);
22418 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000022419 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022420 des_xmlChar_ptr_ptr(n_prefix, prefix, 1);
22421 xmlResetLastError();
22422 if (mem_base != xmlMemBlocks()) {
22423 printf("Leak of %d blocks found in xmlSplitQName2",
22424 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022425 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022426 printf(" %d", n_name);
22427 printf(" %d", n_prefix);
22428 printf("\n");
22429 }
22430 }
22431 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022432 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022433
Daniel Veillard42595322004-11-08 10:52:06 +000022434 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022435}
22436
22437
22438static int
22439test_xmlSplitQName3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022440 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022441
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000022442 int mem_base;
22443 const xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022444 xmlChar * name; /* the full QName */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000022445 int n_name;
22446 int * len; /* an int * */
22447 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022448
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000022449 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
22450 for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
22451 mem_base = xmlMemBlocks();
22452 name = gen_const_xmlChar_ptr(n_name, 0);
22453 len = gen_int_ptr(n_len, 1);
22454
William M. Brackf13f77f2004-11-12 16:03:48 +000022455 ret_val = xmlSplitQName3((const xmlChar *)name, len);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000022456 desret_const_xmlChar_ptr(ret_val);
22457 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000022458 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000022459 des_int_ptr(n_len, len, 1);
22460 xmlResetLastError();
22461 if (mem_base != xmlMemBlocks()) {
22462 printf("Leak of %d blocks found in xmlSplitQName3",
22463 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022464 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000022465 printf(" %d", n_name);
22466 printf(" %d", n_len);
22467 printf("\n");
22468 }
22469 }
22470 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000022471 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022472
Daniel Veillard42595322004-11-08 10:52:06 +000022473 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022474}
22475
22476
22477static int
22478test_xmlStringGetNodeList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022479 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022480
22481 int mem_base;
22482 xmlNodePtr ret_val;
22483 xmlDocPtr doc; /* the document */
22484 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022485 xmlChar * value; /* the value of the attribute */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022486 int n_value;
22487
22488 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
22489 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22490 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022491 doc = gen_xmlDocPtr(n_doc, 0);
22492 value = gen_const_xmlChar_ptr(n_value, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022493
William M. Brackf13f77f2004-11-12 16:03:48 +000022494 ret_val = xmlStringGetNodeList(doc, (const xmlChar *)value);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022495 desret_xmlNodePtr(ret_val);
22496 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022497 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000022498 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022499 xmlResetLastError();
22500 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022501 printf("Leak of %d blocks found in xmlStringGetNodeList",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022502 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022503 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022504 printf(" %d", n_doc);
22505 printf(" %d", n_value);
22506 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022507 }
22508 }
22509 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000022510 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022511
Daniel Veillard42595322004-11-08 10:52:06 +000022512 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022513}
22514
22515
22516static int
22517test_xmlStringLenGetNodeList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022518 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022519
22520 int mem_base;
22521 xmlNodePtr ret_val;
22522 xmlDocPtr doc; /* the document */
22523 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022524 xmlChar * value; /* the value of the text */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022525 int n_value;
22526 int len; /* the length of the string value */
22527 int n_len;
22528
22529 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
22530 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22531 for (n_len = 0;n_len < gen_nb_int;n_len++) {
22532 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022533 doc = gen_xmlDocPtr(n_doc, 0);
22534 value = gen_const_xmlChar_ptr(n_value, 1);
22535 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022536
William M. Brackf13f77f2004-11-12 16:03:48 +000022537 ret_val = xmlStringLenGetNodeList(doc, (const xmlChar *)value, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022538 desret_xmlNodePtr(ret_val);
22539 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022540 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000022541 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000022542 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022543 xmlResetLastError();
22544 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022545 printf("Leak of %d blocks found in xmlStringLenGetNodeList",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022546 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022547 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022548 printf(" %d", n_doc);
22549 printf(" %d", n_value);
22550 printf(" %d", n_len);
22551 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022552 }
22553 }
22554 }
22555 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000022556 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022557
Daniel Veillard42595322004-11-08 10:52:06 +000022558 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022559}
22560
22561
22562static int
22563test_xmlTextConcat(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022564 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022565
22566 int mem_base;
22567 int ret_val;
22568 xmlNodePtr node; /* the node */
22569 int n_node;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022570 xmlChar * content; /* the content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022571 int n_content;
22572 int len; /* @content length */
22573 int n_len;
22574
22575 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22576 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
22577 for (n_len = 0;n_len < gen_nb_int;n_len++) {
22578 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022579 node = gen_xmlNodePtr(n_node, 0);
22580 content = gen_const_xmlChar_ptr(n_content, 1);
22581 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022582
William M. Brackf13f77f2004-11-12 16:03:48 +000022583 ret_val = xmlTextConcat(node, (const xmlChar *)content, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022584 desret_int(ret_val);
22585 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022586 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000022587 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000022588 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022589 xmlResetLastError();
22590 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022591 printf("Leak of %d blocks found in xmlTextConcat",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022592 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022593 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022594 printf(" %d", n_node);
22595 printf(" %d", n_content);
22596 printf(" %d", n_len);
22597 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022598 }
22599 }
22600 }
22601 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000022602 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022603
Daniel Veillard42595322004-11-08 10:52:06 +000022604 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022605}
22606
22607
22608static int
22609test_xmlTextMerge(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022610 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022611
22612 int mem_base;
22613 xmlNodePtr ret_val;
22614 xmlNodePtr first; /* the first text node */
22615 int n_first;
22616 xmlNodePtr second; /* the second text node being merged */
22617 int n_second;
22618
Daniel Veillarda03e3652004-11-02 18:45:30 +000022619 for (n_first = 0;n_first < gen_nb_xmlNodePtr_in;n_first++) {
22620 for (n_second = 0;n_second < gen_nb_xmlNodePtr_in;n_second++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000022621 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022622 first = gen_xmlNodePtr_in(n_first, 0);
22623 second = gen_xmlNodePtr_in(n_second, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022624
22625 ret_val = xmlTextMerge(first, second);
Daniel Veillarda03e3652004-11-02 18:45:30 +000022626 if ((first != NULL) && (first->type != XML_TEXT_NODE)) {
Daniel Veillardce244ad2004-11-05 10:03:46 +000022627 xmlUnlinkNode(second);
Daniel Veillarda03e3652004-11-02 18:45:30 +000022628 xmlFreeNode(second) ; second = NULL ; }
Daniel Veillard8a32fe42004-11-02 22:10:16 +000022629 desret_xmlNodePtr(ret_val);
22630 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022631 des_xmlNodePtr_in(n_first, first, 0);
22632 des_xmlNodePtr_in(n_second, second, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022633 xmlResetLastError();
22634 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022635 printf("Leak of %d blocks found in xmlTextMerge",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022636 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022637 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022638 printf(" %d", n_first);
22639 printf(" %d", n_second);
22640 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022641 }
22642 }
22643 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000022644 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022645
Daniel Veillard42595322004-11-08 10:52:06 +000022646 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022647}
22648
22649
22650static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000022651test_xmlUnsetNsProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022652 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022653
William M. Brack21e4ef22005-01-02 09:53:13 +000022654#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000022655 int mem_base;
22656 int ret_val;
22657 xmlNodePtr node; /* the node */
22658 int n_node;
22659 xmlNsPtr ns; /* the namespace definition */
22660 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022661 xmlChar * name; /* the attribute name */
Daniel Veillard27f20102004-11-05 11:50:11 +000022662 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022663
Daniel Veillard27f20102004-11-05 11:50:11 +000022664 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22665 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
22666 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
22667 mem_base = xmlMemBlocks();
22668 node = gen_xmlNodePtr(n_node, 0);
22669 ns = gen_xmlNsPtr(n_ns, 1);
22670 name = gen_const_xmlChar_ptr(n_name, 2);
22671
William M. Brackf13f77f2004-11-12 16:03:48 +000022672 ret_val = xmlUnsetNsProp(node, ns, (const xmlChar *)name);
Daniel Veillard27f20102004-11-05 11:50:11 +000022673 desret_int(ret_val);
22674 call_tests++;
22675 des_xmlNodePtr(n_node, node, 0);
22676 des_xmlNsPtr(n_ns, ns, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000022677 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
Daniel Veillard27f20102004-11-05 11:50:11 +000022678 xmlResetLastError();
22679 if (mem_base != xmlMemBlocks()) {
22680 printf("Leak of %d blocks found in xmlUnsetNsProp",
22681 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022682 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000022683 printf(" %d", n_node);
22684 printf(" %d", n_ns);
22685 printf(" %d", n_name);
22686 printf("\n");
22687 }
22688 }
22689 }
22690 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022691 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000022692#endif
22693
Daniel Veillard42595322004-11-08 10:52:06 +000022694 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022695}
22696
22697
22698static int
22699test_xmlUnsetProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022700 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022701
William M. Brack21e4ef22005-01-02 09:53:13 +000022702#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000022703 int mem_base;
22704 int ret_val;
22705 xmlNodePtr node; /* the node */
22706 int n_node;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022707 xmlChar * name; /* the attribute name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022708 int n_name;
22709
22710 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22711 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
22712 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022713 node = gen_xmlNodePtr(n_node, 0);
22714 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022715
William M. Brackf13f77f2004-11-12 16:03:48 +000022716 ret_val = xmlUnsetProp(node, (const xmlChar *)name);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022717 desret_int(ret_val);
22718 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022719 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000022720 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022721 xmlResetLastError();
22722 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022723 printf("Leak of %d blocks found in xmlUnsetProp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022724 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022725 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022726 printf(" %d", n_node);
22727 printf(" %d", n_name);
22728 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022729 }
22730 }
22731 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022732 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022733#endif
22734
Daniel Veillard42595322004-11-08 10:52:06 +000022735 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022736}
22737
22738
22739static int
22740test_xmlValidateNCName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022741 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022742
William M. Brack21e4ef22005-01-02 09:53:13 +000022743#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000022744#ifdef LIBXML_TREE_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000022745 int mem_base;
22746 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022747 xmlChar * value; /* the value to check */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022748 int n_value;
22749 int space; /* allow spaces in front and end of the string */
22750 int n_space;
22751
22752 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22753 for (n_space = 0;n_space < gen_nb_int;n_space++) {
22754 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022755 value = gen_const_xmlChar_ptr(n_value, 0);
22756 space = gen_int(n_space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022757
William M. Brackf13f77f2004-11-12 16:03:48 +000022758 ret_val = xmlValidateNCName((const xmlChar *)value, space);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022759 desret_int(ret_val);
22760 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000022761 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000022762 des_int(n_space, space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022763 xmlResetLastError();
22764 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022765 printf("Leak of %d blocks found in xmlValidateNCName",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022766 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022767 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022768 printf(" %d", n_value);
22769 printf(" %d", n_space);
22770 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022771 }
22772 }
22773 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022774 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000022775#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000022776#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000022777
Daniel Veillard42595322004-11-08 10:52:06 +000022778 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022779}
22780
22781
22782static int
22783test_xmlValidateNMToken(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022784 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022785
William M. Brack21e4ef22005-01-02 09:53:13 +000022786#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000022787#ifdef LIBXML_TREE_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000022788 int mem_base;
22789 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022790 xmlChar * value; /* the value to check */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022791 int n_value;
22792 int space; /* allow spaces in front and end of the string */
22793 int n_space;
22794
22795 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22796 for (n_space = 0;n_space < gen_nb_int;n_space++) {
22797 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022798 value = gen_const_xmlChar_ptr(n_value, 0);
22799 space = gen_int(n_space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022800
William M. Brackf13f77f2004-11-12 16:03:48 +000022801 ret_val = xmlValidateNMToken((const xmlChar *)value, space);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022802 desret_int(ret_val);
22803 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000022804 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000022805 des_int(n_space, space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022806 xmlResetLastError();
22807 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022808 printf("Leak of %d blocks found in xmlValidateNMToken",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022809 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022810 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022811 printf(" %d", n_value);
22812 printf(" %d", n_space);
22813 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022814 }
22815 }
22816 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022817 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000022818#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000022819#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000022820
Daniel Veillard42595322004-11-08 10:52:06 +000022821 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022822}
22823
22824
22825static int
22826test_xmlValidateName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022827 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022828
William M. Brack21e4ef22005-01-02 09:53:13 +000022829#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000022830#ifdef LIBXML_TREE_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000022831 int mem_base;
22832 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022833 xmlChar * value; /* the value to check */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022834 int n_value;
22835 int space; /* allow spaces in front and end of the string */
22836 int n_space;
22837
22838 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22839 for (n_space = 0;n_space < gen_nb_int;n_space++) {
22840 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022841 value = gen_const_xmlChar_ptr(n_value, 0);
22842 space = gen_int(n_space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022843
William M. Brackf13f77f2004-11-12 16:03:48 +000022844 ret_val = xmlValidateName((const xmlChar *)value, space);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022845 desret_int(ret_val);
22846 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000022847 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000022848 des_int(n_space, space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022849 xmlResetLastError();
22850 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022851 printf("Leak of %d blocks found in xmlValidateName",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022852 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022853 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022854 printf(" %d", n_value);
22855 printf(" %d", n_space);
22856 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022857 }
22858 }
22859 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022860 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000022861#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000022862#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000022863
Daniel Veillard42595322004-11-08 10:52:06 +000022864 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022865}
22866
22867
22868static int
22869test_xmlValidateQName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022870 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022871
William M. Brack21e4ef22005-01-02 09:53:13 +000022872#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000022873#ifdef LIBXML_TREE_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000022874 int mem_base;
22875 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022876 xmlChar * value; /* the value to check */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022877 int n_value;
22878 int space; /* allow spaces in front and end of the string */
22879 int n_space;
22880
22881 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22882 for (n_space = 0;n_space < gen_nb_int;n_space++) {
22883 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022884 value = gen_const_xmlChar_ptr(n_value, 0);
22885 space = gen_int(n_space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022886
William M. Brackf13f77f2004-11-12 16:03:48 +000022887 ret_val = xmlValidateQName((const xmlChar *)value, space);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022888 desret_int(ret_val);
22889 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000022890 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000022891 des_int(n_space, space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022892 xmlResetLastError();
22893 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022894 printf("Leak of %d blocks found in xmlValidateQName",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022895 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022896 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022897 printf(" %d", n_value);
22898 printf(" %d", n_space);
22899 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022900 }
22901 }
22902 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022903 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000022904#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000022905#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000022906
Daniel Veillard42595322004-11-08 10:52:06 +000022907 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022908}
22909
22910static int
22911test_tree(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022912 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022913
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022914 if (quiet == 0) printf("Testing tree : 129 of 146 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000022915 test_ret += test_xmlAddChild();
22916 test_ret += test_xmlAddChildList();
22917 test_ret += test_xmlAddNextSibling();
22918 test_ret += test_xmlAddPrevSibling();
22919 test_ret += test_xmlAddSibling();
22920 test_ret += test_xmlAttrSerializeTxtContent();
22921 test_ret += test_xmlBufferAdd();
22922 test_ret += test_xmlBufferAddHead();
22923 test_ret += test_xmlBufferCCat();
22924 test_ret += test_xmlBufferCat();
22925 test_ret += test_xmlBufferContent();
22926 test_ret += test_xmlBufferCreate();
22927 test_ret += test_xmlBufferCreateSize();
22928 test_ret += test_xmlBufferCreateStatic();
22929 test_ret += test_xmlBufferEmpty();
22930 test_ret += test_xmlBufferGrow();
22931 test_ret += test_xmlBufferLength();
22932 test_ret += test_xmlBufferResize();
22933 test_ret += test_xmlBufferSetAllocationScheme();
22934 test_ret += test_xmlBufferShrink();
22935 test_ret += test_xmlBufferWriteCHAR();
22936 test_ret += test_xmlBufferWriteChar();
22937 test_ret += test_xmlBufferWriteQuotedString();
22938 test_ret += test_xmlBuildQName();
22939 test_ret += test_xmlCopyDoc();
22940 test_ret += test_xmlCopyDtd();
22941 test_ret += test_xmlCopyNamespace();
22942 test_ret += test_xmlCopyNamespaceList();
22943 test_ret += test_xmlCopyNode();
22944 test_ret += test_xmlCopyNodeList();
22945 test_ret += test_xmlCopyProp();
22946 test_ret += test_xmlCopyPropList();
22947 test_ret += test_xmlCreateIntSubset();
22948 test_ret += test_xmlDocCopyNode();
22949 test_ret += test_xmlDocCopyNodeList();
22950 test_ret += test_xmlDocDump();
22951 test_ret += test_xmlDocDumpFormatMemory();
22952 test_ret += test_xmlDocDumpFormatMemoryEnc();
22953 test_ret += test_xmlDocDumpMemory();
22954 test_ret += test_xmlDocDumpMemoryEnc();
22955 test_ret += test_xmlDocFormatDump();
22956 test_ret += test_xmlDocGetRootElement();
22957 test_ret += test_xmlDocSetRootElement();
22958 test_ret += test_xmlElemDump();
22959 test_ret += test_xmlGetBufferAllocationScheme();
22960 test_ret += test_xmlGetCompressMode();
22961 test_ret += test_xmlGetDocCompressMode();
22962 test_ret += test_xmlGetIntSubset();
22963 test_ret += test_xmlGetLastChild();
22964 test_ret += test_xmlGetLineNo();
22965 test_ret += test_xmlGetNoNsProp();
22966 test_ret += test_xmlGetNodePath();
22967 test_ret += test_xmlGetNsList();
22968 test_ret += test_xmlGetNsProp();
22969 test_ret += test_xmlGetProp();
22970 test_ret += test_xmlHasNsProp();
22971 test_ret += test_xmlHasProp();
22972 test_ret += test_xmlIsBlankNode();
22973 test_ret += test_xmlIsXHTML();
22974 test_ret += test_xmlNewCDataBlock();
22975 test_ret += test_xmlNewCharRef();
22976 test_ret += test_xmlNewChild();
22977 test_ret += test_xmlNewComment();
22978 test_ret += test_xmlNewDoc();
22979 test_ret += test_xmlNewDocComment();
22980 test_ret += test_xmlNewDocFragment();
22981 test_ret += test_xmlNewDocNode();
22982 test_ret += test_xmlNewDocNodeEatName();
22983 test_ret += test_xmlNewDocPI();
22984 test_ret += test_xmlNewDocProp();
22985 test_ret += test_xmlNewDocRawNode();
22986 test_ret += test_xmlNewDocText();
22987 test_ret += test_xmlNewDocTextLen();
22988 test_ret += test_xmlNewDtd();
22989 test_ret += test_xmlNewNode();
22990 test_ret += test_xmlNewNodeEatName();
22991 test_ret += test_xmlNewNs();
22992 test_ret += test_xmlNewNsProp();
22993 test_ret += test_xmlNewNsPropEatName();
22994 test_ret += test_xmlNewPI();
22995 test_ret += test_xmlNewProp();
22996 test_ret += test_xmlNewReference();
22997 test_ret += test_xmlNewText();
22998 test_ret += test_xmlNewTextChild();
22999 test_ret += test_xmlNewTextLen();
23000 test_ret += test_xmlNodeAddContent();
23001 test_ret += test_xmlNodeAddContentLen();
23002 test_ret += test_xmlNodeBufGetContent();
23003 test_ret += test_xmlNodeDump();
23004 test_ret += test_xmlNodeDumpOutput();
23005 test_ret += test_xmlNodeGetBase();
23006 test_ret += test_xmlNodeGetContent();
23007 test_ret += test_xmlNodeGetLang();
23008 test_ret += test_xmlNodeGetSpacePreserve();
23009 test_ret += test_xmlNodeIsText();
23010 test_ret += test_xmlNodeListGetRawString();
23011 test_ret += test_xmlNodeListGetString();
23012 test_ret += test_xmlNodeSetBase();
23013 test_ret += test_xmlNodeSetContent();
23014 test_ret += test_xmlNodeSetContentLen();
23015 test_ret += test_xmlNodeSetLang();
23016 test_ret += test_xmlNodeSetName();
23017 test_ret += test_xmlNodeSetSpacePreserve();
23018 test_ret += test_xmlReconciliateNs();
23019 test_ret += test_xmlRemoveProp();
23020 test_ret += test_xmlReplaceNode();
23021 test_ret += test_xmlSaveFile();
23022 test_ret += test_xmlSaveFileEnc();
23023 test_ret += test_xmlSaveFileTo();
23024 test_ret += test_xmlSaveFormatFile();
23025 test_ret += test_xmlSaveFormatFileEnc();
23026 test_ret += test_xmlSaveFormatFileTo();
23027 test_ret += test_xmlSearchNs();
23028 test_ret += test_xmlSearchNsByHref();
23029 test_ret += test_xmlSetBufferAllocationScheme();
23030 test_ret += test_xmlSetCompressMode();
23031 test_ret += test_xmlSetDocCompressMode();
23032 test_ret += test_xmlSetNs();
23033 test_ret += test_xmlSetNsProp();
23034 test_ret += test_xmlSetProp();
23035 test_ret += test_xmlSplitQName2();
23036 test_ret += test_xmlSplitQName3();
23037 test_ret += test_xmlStringGetNodeList();
23038 test_ret += test_xmlStringLenGetNodeList();
23039 test_ret += test_xmlTextConcat();
23040 test_ret += test_xmlTextMerge();
23041 test_ret += test_xmlUnsetNsProp();
23042 test_ret += test_xmlUnsetProp();
23043 test_ret += test_xmlValidateNCName();
23044 test_ret += test_xmlValidateNMToken();
23045 test_ret += test_xmlValidateName();
23046 test_ret += test_xmlValidateQName();
Daniel Veillardd93f6252004-11-02 15:53:51 +000023047
Daniel Veillard42595322004-11-08 10:52:06 +000023048 if (test_ret != 0)
23049 printf("Module tree: %d errors\n", test_ret);
23050 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023051}
23052
23053static int
23054test_xmlBuildRelativeURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023055 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023056
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023057 int mem_base;
23058 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023059 xmlChar * URI; /* the URI reference under consideration */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023060 int n_URI;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023061 xmlChar * base; /* the base value */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023062 int n_base;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023063
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023064 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
23065 for (n_base = 0;n_base < gen_nb_const_xmlChar_ptr;n_base++) {
23066 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000023067 URI = gen_const_xmlChar_ptr(n_URI, 0);
23068 base = gen_const_xmlChar_ptr(n_base, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023069
William M. Brackf13f77f2004-11-12 16:03:48 +000023070 ret_val = xmlBuildRelativeURI((const xmlChar *)URI, (const xmlChar *)base);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023071 desret_xmlChar_ptr(ret_val);
23072 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000023073 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 0);
23074 des_const_xmlChar_ptr(n_base, (const xmlChar *)base, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023075 xmlResetLastError();
23076 if (mem_base != xmlMemBlocks()) {
23077 printf("Leak of %d blocks found in xmlBuildRelativeURI",
23078 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023079 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023080 printf(" %d", n_URI);
23081 printf(" %d", n_base);
23082 printf("\n");
23083 }
23084 }
23085 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000023086 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023087
Daniel Veillard42595322004-11-08 10:52:06 +000023088 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023089}
23090
23091
23092static int
23093test_xmlBuildURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023094 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023095
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023096 int mem_base;
23097 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023098 xmlChar * URI; /* the URI instance found in the document */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023099 int n_URI;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023100 xmlChar * base; /* the base value */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023101 int n_base;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023102
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023103 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
23104 for (n_base = 0;n_base < gen_nb_const_xmlChar_ptr;n_base++) {
23105 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000023106 URI = gen_const_xmlChar_ptr(n_URI, 0);
23107 base = gen_const_xmlChar_ptr(n_base, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023108
William M. Brackf13f77f2004-11-12 16:03:48 +000023109 ret_val = xmlBuildURI((const xmlChar *)URI, (const xmlChar *)base);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023110 desret_xmlChar_ptr(ret_val);
23111 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000023112 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 0);
23113 des_const_xmlChar_ptr(n_base, (const xmlChar *)base, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023114 xmlResetLastError();
23115 if (mem_base != xmlMemBlocks()) {
23116 printf("Leak of %d blocks found in xmlBuildURI",
23117 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023118 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023119 printf(" %d", n_URI);
23120 printf(" %d", n_base);
23121 printf("\n");
23122 }
23123 }
23124 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000023125 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023126
Daniel Veillard42595322004-11-08 10:52:06 +000023127 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023128}
23129
23130
23131static int
23132test_xmlCanonicPath(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023133 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023134
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023135 int mem_base;
23136 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023137 xmlChar * path; /* the resource locator in a filesystem notation */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023138 int n_path;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023139
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023140 for (n_path = 0;n_path < gen_nb_const_xmlChar_ptr;n_path++) {
23141 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000023142 path = gen_const_xmlChar_ptr(n_path, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023143
William M. Brackf13f77f2004-11-12 16:03:48 +000023144 ret_val = xmlCanonicPath((const xmlChar *)path);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023145 desret_xmlChar_ptr(ret_val);
23146 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000023147 des_const_xmlChar_ptr(n_path, (const xmlChar *)path, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023148 xmlResetLastError();
23149 if (mem_base != xmlMemBlocks()) {
23150 printf("Leak of %d blocks found in xmlCanonicPath",
23151 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023152 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023153 printf(" %d", n_path);
23154 printf("\n");
23155 }
23156 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000023157 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023158
Daniel Veillard42595322004-11-08 10:52:06 +000023159 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023160}
23161
23162
23163static int
23164test_xmlCreateURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023165 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023166
23167
23168 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023169 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023170}
23171
23172
23173static int
23174test_xmlNormalizeURIPath(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023175 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023176
Daniel Veillardce682bc2004-11-05 17:22:25 +000023177 int mem_base;
23178 int ret_val;
23179 char * path; /* pointer to the path string */
23180 int n_path;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023181
Daniel Veillardce682bc2004-11-05 17:22:25 +000023182 for (n_path = 0;n_path < gen_nb_char_ptr;n_path++) {
23183 mem_base = xmlMemBlocks();
23184 path = gen_char_ptr(n_path, 0);
23185
23186 ret_val = xmlNormalizeURIPath(path);
23187 desret_int(ret_val);
23188 call_tests++;
23189 des_char_ptr(n_path, path, 0);
23190 xmlResetLastError();
23191 if (mem_base != xmlMemBlocks()) {
23192 printf("Leak of %d blocks found in xmlNormalizeURIPath",
23193 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023194 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023195 printf(" %d", n_path);
23196 printf("\n");
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_xmlParseURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023207 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023208
23209
23210 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023211 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023212}
23213
23214
Daniel Veillardce682bc2004-11-05 17:22:25 +000023215#define gen_nb_xmlURIPtr 1
23216static xmlURIPtr gen_xmlURIPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23217 return(NULL);
23218}
23219static void des_xmlURIPtr(int no ATTRIBUTE_UNUSED, xmlURIPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23220}
23221
Daniel Veillardd93f6252004-11-02 15:53:51 +000023222static int
23223test_xmlParseURIReference(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023224 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023225
Daniel Veillardce682bc2004-11-05 17:22:25 +000023226 int mem_base;
23227 int ret_val;
23228 xmlURIPtr uri; /* pointer to an URI structure */
23229 int n_uri;
23230 char * str; /* the string to analyze */
23231 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023232
Daniel Veillardce682bc2004-11-05 17:22:25 +000023233 for (n_uri = 0;n_uri < gen_nb_xmlURIPtr;n_uri++) {
23234 for (n_str = 0;n_str < gen_nb_const_char_ptr;n_str++) {
23235 mem_base = xmlMemBlocks();
23236 uri = gen_xmlURIPtr(n_uri, 0);
23237 str = gen_const_char_ptr(n_str, 1);
23238
William M. Brackf13f77f2004-11-12 16:03:48 +000023239 ret_val = xmlParseURIReference(uri, (const char *)str);
Daniel Veillardce682bc2004-11-05 17:22:25 +000023240 desret_int(ret_val);
23241 call_tests++;
23242 des_xmlURIPtr(n_uri, uri, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000023243 des_const_char_ptr(n_str, (const char *)str, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000023244 xmlResetLastError();
23245 if (mem_base != xmlMemBlocks()) {
23246 printf("Leak of %d blocks found in xmlParseURIReference",
23247 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023248 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023249 printf(" %d", n_uri);
23250 printf(" %d", n_str);
23251 printf("\n");
23252 }
23253 }
23254 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000023255 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023256
Daniel Veillard42595322004-11-08 10:52:06 +000023257 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023258}
23259
23260
23261static int
23262test_xmlPrintURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023263 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023264
Daniel Veillardce682bc2004-11-05 17:22:25 +000023265 int mem_base;
23266 FILE * stream; /* a FILE* for the output */
23267 int n_stream;
23268 xmlURIPtr uri; /* pointer to an xmlURI */
23269 int n_uri;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023270
Daniel Veillardce682bc2004-11-05 17:22:25 +000023271 for (n_stream = 0;n_stream < gen_nb_FILE_ptr;n_stream++) {
23272 for (n_uri = 0;n_uri < gen_nb_xmlURIPtr;n_uri++) {
23273 mem_base = xmlMemBlocks();
23274 stream = gen_FILE_ptr(n_stream, 0);
23275 uri = gen_xmlURIPtr(n_uri, 1);
23276
23277 xmlPrintURI(stream, uri);
23278 call_tests++;
23279 des_FILE_ptr(n_stream, stream, 0);
23280 des_xmlURIPtr(n_uri, uri, 1);
23281 xmlResetLastError();
23282 if (mem_base != xmlMemBlocks()) {
23283 printf("Leak of %d blocks found in xmlPrintURI",
23284 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023285 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023286 printf(" %d", n_stream);
23287 printf(" %d", n_uri);
23288 printf("\n");
23289 }
23290 }
23291 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000023292 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023293
Daniel Veillard42595322004-11-08 10:52:06 +000023294 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023295}
23296
23297
23298static int
23299test_xmlSaveUri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023300 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023301
Daniel Veillardce682bc2004-11-05 17:22:25 +000023302 int mem_base;
23303 xmlChar * ret_val;
23304 xmlURIPtr uri; /* pointer to an xmlURI */
23305 int n_uri;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023306
Daniel Veillardce682bc2004-11-05 17:22:25 +000023307 for (n_uri = 0;n_uri < gen_nb_xmlURIPtr;n_uri++) {
23308 mem_base = xmlMemBlocks();
23309 uri = gen_xmlURIPtr(n_uri, 0);
23310
23311 ret_val = xmlSaveUri(uri);
23312 desret_xmlChar_ptr(ret_val);
23313 call_tests++;
23314 des_xmlURIPtr(n_uri, uri, 0);
23315 xmlResetLastError();
23316 if (mem_base != xmlMemBlocks()) {
23317 printf("Leak of %d blocks found in xmlSaveUri",
23318 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023319 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023320 printf(" %d", n_uri);
23321 printf("\n");
23322 }
23323 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000023324 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023325
Daniel Veillard42595322004-11-08 10:52:06 +000023326 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023327}
23328
23329
23330static int
23331test_xmlURIEscape(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023332 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023333
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023334 int mem_base;
23335 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023336 xmlChar * str; /* the string of the URI to escape */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023337 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023338
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023339 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
23340 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000023341 str = gen_const_xmlChar_ptr(n_str, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023342
William M. Brackf13f77f2004-11-12 16:03:48 +000023343 ret_val = xmlURIEscape((const xmlChar *)str);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023344 desret_xmlChar_ptr(ret_val);
23345 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000023346 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023347 xmlResetLastError();
23348 if (mem_base != xmlMemBlocks()) {
23349 printf("Leak of %d blocks found in xmlURIEscape",
23350 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023351 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023352 printf(" %d", n_str);
23353 printf("\n");
23354 }
23355 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000023356 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023357
Daniel Veillard42595322004-11-08 10:52:06 +000023358 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023359}
23360
23361
23362static int
23363test_xmlURIEscapeStr(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023364 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023365
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023366 int mem_base;
23367 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023368 xmlChar * str; /* string to escape */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023369 int n_str;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023370 xmlChar * list; /* exception list string of chars not to escape */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023371 int n_list;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023372
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023373 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
23374 for (n_list = 0;n_list < gen_nb_const_xmlChar_ptr;n_list++) {
23375 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000023376 str = gen_const_xmlChar_ptr(n_str, 0);
23377 list = gen_const_xmlChar_ptr(n_list, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023378
William M. Brackf13f77f2004-11-12 16:03:48 +000023379 ret_val = xmlURIEscapeStr((const xmlChar *)str, (const xmlChar *)list);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023380 desret_xmlChar_ptr(ret_val);
23381 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000023382 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
23383 des_const_xmlChar_ptr(n_list, (const xmlChar *)list, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023384 xmlResetLastError();
23385 if (mem_base != xmlMemBlocks()) {
23386 printf("Leak of %d blocks found in xmlURIEscapeStr",
23387 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023388 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023389 printf(" %d", n_str);
23390 printf(" %d", n_list);
23391 printf("\n");
23392 }
23393 }
23394 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000023395 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023396
Daniel Veillard42595322004-11-08 10:52:06 +000023397 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023398}
23399
23400
23401static int
23402test_xmlURIUnescapeString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023403 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023404
23405
23406 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023407 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023408}
23409
23410static int
23411test_uri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023412 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023413
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023414 if (quiet == 0) printf("Testing uri : 9 of 13 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000023415 test_ret += test_xmlBuildRelativeURI();
23416 test_ret += test_xmlBuildURI();
23417 test_ret += test_xmlCanonicPath();
23418 test_ret += test_xmlCreateURI();
23419 test_ret += test_xmlNormalizeURIPath();
23420 test_ret += test_xmlParseURI();
23421 test_ret += test_xmlParseURIReference();
23422 test_ret += test_xmlPrintURI();
23423 test_ret += test_xmlSaveUri();
23424 test_ret += test_xmlURIEscape();
23425 test_ret += test_xmlURIEscapeStr();
23426 test_ret += test_xmlURIUnescapeString();
Daniel Veillardd93f6252004-11-02 15:53:51 +000023427
Daniel Veillard42595322004-11-08 10:52:06 +000023428 if (test_ret != 0)
23429 printf("Module uri: %d errors\n", test_ret);
23430 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023431}
23432
23433static int
23434test_xmlAddAttributeDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023435 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023436
Daniel Veillard42595322004-11-08 10:52:06 +000023437 int mem_base;
23438 xmlAttributePtr ret_val;
23439 xmlValidCtxtPtr ctxt; /* the validation context */
23440 int n_ctxt;
23441 xmlDtdPtr dtd; /* pointer to the DTD */
23442 int n_dtd;
23443 xmlChar * elem; /* the element name */
23444 int n_elem;
23445 xmlChar * name; /* the attribute name */
23446 int n_name;
23447 xmlChar * ns; /* the attribute namespace prefix */
23448 int n_ns;
23449 xmlAttributeType type; /* the attribute type */
23450 int n_type;
23451 xmlAttributeDefault def; /* the attribute default type */
23452 int n_def;
23453 xmlChar * defaultValue; /* the attribute default value */
23454 int n_defaultValue;
23455 xmlEnumerationPtr tree; /* if it's an enumeration, the associated list */
23456 int n_tree;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023457
Daniel Veillard42595322004-11-08 10:52:06 +000023458 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
23459 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
23460 for (n_elem = 0;n_elem < gen_nb_const_xmlChar_ptr;n_elem++) {
23461 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
23462 for (n_ns = 0;n_ns < gen_nb_const_xmlChar_ptr;n_ns++) {
23463 for (n_type = 0;n_type < gen_nb_xmlAttributeType;n_type++) {
23464 for (n_def = 0;n_def < gen_nb_xmlAttributeDefault;n_def++) {
23465 for (n_defaultValue = 0;n_defaultValue < gen_nb_const_xmlChar_ptr;n_defaultValue++) {
23466 for (n_tree = 0;n_tree < gen_nb_xmlEnumerationPtr;n_tree++) {
23467 mem_base = xmlMemBlocks();
23468 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
23469 dtd = gen_xmlDtdPtr(n_dtd, 1);
23470 elem = gen_const_xmlChar_ptr(n_elem, 2);
23471 name = gen_const_xmlChar_ptr(n_name, 3);
23472 ns = gen_const_xmlChar_ptr(n_ns, 4);
23473 type = gen_xmlAttributeType(n_type, 5);
23474 def = gen_xmlAttributeDefault(n_def, 6);
23475 defaultValue = gen_const_xmlChar_ptr(n_defaultValue, 7);
23476 tree = gen_xmlEnumerationPtr(n_tree, 8);
23477
William M. Brackf13f77f2004-11-12 16:03:48 +000023478 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 +000023479 desret_xmlAttributePtr(ret_val);
23480 call_tests++;
23481 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
23482 des_xmlDtdPtr(n_dtd, dtd, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000023483 des_const_xmlChar_ptr(n_elem, (const xmlChar *)elem, 2);
23484 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 3);
23485 des_const_xmlChar_ptr(n_ns, (const xmlChar *)ns, 4);
Daniel Veillard42595322004-11-08 10:52:06 +000023486 des_xmlAttributeType(n_type, type, 5);
23487 des_xmlAttributeDefault(n_def, def, 6);
William M. Brackf13f77f2004-11-12 16:03:48 +000023488 des_const_xmlChar_ptr(n_defaultValue, (const xmlChar *)defaultValue, 7);
Daniel Veillard42595322004-11-08 10:52:06 +000023489 des_xmlEnumerationPtr(n_tree, tree, 8);
23490 xmlResetLastError();
23491 if (mem_base != xmlMemBlocks()) {
23492 printf("Leak of %d blocks found in xmlAddAttributeDecl",
23493 xmlMemBlocks() - mem_base);
23494 test_ret++;
23495 printf(" %d", n_ctxt);
23496 printf(" %d", n_dtd);
23497 printf(" %d", n_elem);
23498 printf(" %d", n_name);
23499 printf(" %d", n_ns);
23500 printf(" %d", n_type);
23501 printf(" %d", n_def);
23502 printf(" %d", n_defaultValue);
23503 printf(" %d", n_tree);
23504 printf("\n");
23505 }
23506 }
23507 }
23508 }
23509 }
23510 }
23511 }
23512 }
23513 }
23514 }
Daniel Veillard42595322004-11-08 10:52:06 +000023515 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023516
Daniel Veillard42595322004-11-08 10:52:06 +000023517 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023518}
23519
23520
23521static int
23522test_xmlAddElementDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023523 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023524
Daniel Veillard42595322004-11-08 10:52:06 +000023525 int mem_base;
23526 xmlElementPtr ret_val;
23527 xmlValidCtxtPtr ctxt; /* the validation context */
23528 int n_ctxt;
23529 xmlDtdPtr dtd; /* pointer to the DTD */
23530 int n_dtd;
23531 xmlChar * name; /* the entity name */
23532 int n_name;
23533 xmlElementTypeVal type; /* the element type */
23534 int n_type;
23535 xmlElementContentPtr content; /* the element content tree or NULL */
23536 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023537
Daniel Veillard42595322004-11-08 10:52:06 +000023538 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
23539 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
23540 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
23541 for (n_type = 0;n_type < gen_nb_xmlElementTypeVal;n_type++) {
23542 for (n_content = 0;n_content < gen_nb_xmlElementContentPtr;n_content++) {
23543 mem_base = xmlMemBlocks();
23544 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
23545 dtd = gen_xmlDtdPtr(n_dtd, 1);
23546 name = gen_const_xmlChar_ptr(n_name, 2);
23547 type = gen_xmlElementTypeVal(n_type, 3);
23548 content = gen_xmlElementContentPtr(n_content, 4);
23549
William M. Brackf13f77f2004-11-12 16:03:48 +000023550 ret_val = xmlAddElementDecl(ctxt, dtd, (const xmlChar *)name, type, content);
Daniel Veillard42595322004-11-08 10:52:06 +000023551 desret_xmlElementPtr(ret_val);
23552 call_tests++;
23553 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
23554 des_xmlDtdPtr(n_dtd, dtd, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000023555 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
Daniel Veillard42595322004-11-08 10:52:06 +000023556 des_xmlElementTypeVal(n_type, type, 3);
23557 des_xmlElementContentPtr(n_content, content, 4);
23558 xmlResetLastError();
23559 if (mem_base != xmlMemBlocks()) {
23560 printf("Leak of %d blocks found in xmlAddElementDecl",
23561 xmlMemBlocks() - mem_base);
23562 test_ret++;
23563 printf(" %d", n_ctxt);
23564 printf(" %d", n_dtd);
23565 printf(" %d", n_name);
23566 printf(" %d", n_type);
23567 printf(" %d", n_content);
23568 printf("\n");
23569 }
23570 }
23571 }
23572 }
23573 }
23574 }
Daniel Veillard42595322004-11-08 10:52:06 +000023575 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023576
Daniel Veillard42595322004-11-08 10:52:06 +000023577 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023578}
23579
23580
23581static int
23582test_xmlAddID(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023583 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023584
23585
23586 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023587 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023588}
23589
23590
23591static int
23592test_xmlAddNotationDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023593 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023594
23595
23596 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023597 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023598}
23599
23600
23601static int
23602test_xmlAddRef(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023603 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023604
23605
23606 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023607 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023608}
23609
23610
Daniel Veillardce682bc2004-11-05 17:22:25 +000023611#define gen_nb_xmlAttributeTablePtr 1
23612static xmlAttributeTablePtr gen_xmlAttributeTablePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23613 return(NULL);
23614}
23615static void des_xmlAttributeTablePtr(int no ATTRIBUTE_UNUSED, xmlAttributeTablePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23616}
23617
Daniel Veillardd93f6252004-11-02 15:53:51 +000023618static int
23619test_xmlCopyAttributeTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023620 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023621
23622
23623 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023624 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023625}
23626
23627
23628static int
Daniel Veillard2ae13382005-01-25 23:45:06 +000023629test_xmlCopyDocElementContent(void) {
23630 int test_ret = 0;
23631
23632 int mem_base;
23633 xmlElementContentPtr ret_val;
23634 xmlDocPtr doc; /* the document owning the element declaration */
23635 int n_doc;
23636 xmlElementContentPtr cur; /* An element content pointer. */
23637 int n_cur;
23638
23639 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
23640 for (n_cur = 0;n_cur < gen_nb_xmlElementContentPtr;n_cur++) {
23641 mem_base = xmlMemBlocks();
23642 doc = gen_xmlDocPtr(n_doc, 0);
23643 cur = gen_xmlElementContentPtr(n_cur, 1);
23644
23645 ret_val = xmlCopyDocElementContent(doc, cur);
23646 desret_xmlElementContentPtr(ret_val);
23647 call_tests++;
23648 des_xmlDocPtr(n_doc, doc, 0);
23649 des_xmlElementContentPtr(n_cur, cur, 1);
23650 xmlResetLastError();
23651 if (mem_base != xmlMemBlocks()) {
23652 printf("Leak of %d blocks found in xmlCopyDocElementContent",
23653 xmlMemBlocks() - mem_base);
23654 test_ret++;
23655 printf(" %d", n_doc);
23656 printf(" %d", n_cur);
23657 printf("\n");
23658 }
23659 }
23660 }
23661 function_tests++;
23662
23663 return(test_ret);
23664}
23665
23666
23667static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000023668test_xmlCopyElementContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023669 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023670
William M. Brack094dd862004-11-14 14:28:34 +000023671 int mem_base;
23672 xmlElementContentPtr ret_val;
23673 xmlElementContentPtr cur; /* An element content pointer. */
23674 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023675
William M. Brack094dd862004-11-14 14:28:34 +000023676 for (n_cur = 0;n_cur < gen_nb_xmlElementContentPtr;n_cur++) {
23677 mem_base = xmlMemBlocks();
23678 cur = gen_xmlElementContentPtr(n_cur, 0);
23679
23680 ret_val = xmlCopyElementContent(cur);
23681 desret_xmlElementContentPtr(ret_val);
23682 call_tests++;
23683 des_xmlElementContentPtr(n_cur, cur, 0);
23684 xmlResetLastError();
23685 if (mem_base != xmlMemBlocks()) {
23686 printf("Leak of %d blocks found in xmlCopyElementContent",
23687 xmlMemBlocks() - mem_base);
23688 test_ret++;
23689 printf(" %d", n_cur);
23690 printf("\n");
23691 }
23692 }
23693 function_tests++;
23694
Daniel Veillard42595322004-11-08 10:52:06 +000023695 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023696}
23697
23698
Daniel Veillardce682bc2004-11-05 17:22:25 +000023699#define gen_nb_xmlElementTablePtr 1
23700static xmlElementTablePtr gen_xmlElementTablePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23701 return(NULL);
23702}
23703static void des_xmlElementTablePtr(int no ATTRIBUTE_UNUSED, xmlElementTablePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23704}
23705
Daniel Veillardd93f6252004-11-02 15:53:51 +000023706static int
23707test_xmlCopyElementTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023708 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023709
23710
23711 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023712 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023713}
23714
23715
23716static int
23717test_xmlCopyEnumeration(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023718 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023719
23720
23721 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023722 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023723}
23724
23725
Daniel Veillardce682bc2004-11-05 17:22:25 +000023726#define gen_nb_xmlNotationTablePtr 1
23727static xmlNotationTablePtr gen_xmlNotationTablePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23728 return(NULL);
23729}
23730static void des_xmlNotationTablePtr(int no ATTRIBUTE_UNUSED, xmlNotationTablePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23731}
23732
Daniel Veillardd93f6252004-11-02 15:53:51 +000023733static int
23734test_xmlCopyNotationTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023735 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023736
23737
23738 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023739 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023740}
23741
23742
23743static int
23744test_xmlCreateEnumeration(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023745 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023746
23747
23748 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023749 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023750}
23751
23752
Daniel Veillardce682bc2004-11-05 17:22:25 +000023753#define gen_nb_xmlAttributePtr 1
23754static xmlAttributePtr gen_xmlAttributePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23755 return(NULL);
23756}
23757static void des_xmlAttributePtr(int no ATTRIBUTE_UNUSED, xmlAttributePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23758}
23759
Daniel Veillardd93f6252004-11-02 15:53:51 +000023760static int
23761test_xmlDumpAttributeDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023762 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023763
William M. Brack21e4ef22005-01-02 09:53:13 +000023764#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000023765 int mem_base;
23766 xmlBufferPtr buf; /* the XML buffer output */
23767 int n_buf;
23768 xmlAttributePtr attr; /* An attribute declaration */
23769 int n_attr;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023770
Daniel Veillardce682bc2004-11-05 17:22:25 +000023771 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
23772 for (n_attr = 0;n_attr < gen_nb_xmlAttributePtr;n_attr++) {
23773 mem_base = xmlMemBlocks();
23774 buf = gen_xmlBufferPtr(n_buf, 0);
23775 attr = gen_xmlAttributePtr(n_attr, 1);
23776
23777 xmlDumpAttributeDecl(buf, attr);
23778 call_tests++;
23779 des_xmlBufferPtr(n_buf, buf, 0);
23780 des_xmlAttributePtr(n_attr, attr, 1);
23781 xmlResetLastError();
23782 if (mem_base != xmlMemBlocks()) {
23783 printf("Leak of %d blocks found in xmlDumpAttributeDecl",
23784 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023785 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023786 printf(" %d", n_buf);
23787 printf(" %d", n_attr);
23788 printf("\n");
23789 }
23790 }
23791 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023792 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023793#endif
23794
Daniel Veillard42595322004-11-08 10:52:06 +000023795 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023796}
23797
23798
23799static int
23800test_xmlDumpAttributeTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023801 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023802
William M. Brack21e4ef22005-01-02 09:53:13 +000023803#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000023804 int mem_base;
23805 xmlBufferPtr buf; /* the XML buffer output */
23806 int n_buf;
23807 xmlAttributeTablePtr table; /* An attribute table */
23808 int n_table;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023809
Daniel Veillardce682bc2004-11-05 17:22:25 +000023810 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
23811 for (n_table = 0;n_table < gen_nb_xmlAttributeTablePtr;n_table++) {
23812 mem_base = xmlMemBlocks();
23813 buf = gen_xmlBufferPtr(n_buf, 0);
23814 table = gen_xmlAttributeTablePtr(n_table, 1);
23815
23816 xmlDumpAttributeTable(buf, table);
23817 call_tests++;
23818 des_xmlBufferPtr(n_buf, buf, 0);
23819 des_xmlAttributeTablePtr(n_table, table, 1);
23820 xmlResetLastError();
23821 if (mem_base != xmlMemBlocks()) {
23822 printf("Leak of %d blocks found in xmlDumpAttributeTable",
23823 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023824 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023825 printf(" %d", n_buf);
23826 printf(" %d", n_table);
23827 printf("\n");
23828 }
23829 }
23830 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023831 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023832#endif
23833
Daniel Veillard42595322004-11-08 10:52:06 +000023834 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023835}
23836
23837
Daniel Veillardce682bc2004-11-05 17:22:25 +000023838#define gen_nb_xmlElementPtr 1
23839static xmlElementPtr gen_xmlElementPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23840 return(NULL);
23841}
23842static void des_xmlElementPtr(int no ATTRIBUTE_UNUSED, xmlElementPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23843}
23844
Daniel Veillardd93f6252004-11-02 15:53:51 +000023845static int
23846test_xmlDumpElementDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023847 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023848
William M. Brack21e4ef22005-01-02 09:53:13 +000023849#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000023850 int mem_base;
23851 xmlBufferPtr buf; /* the XML buffer output */
23852 int n_buf;
23853 xmlElementPtr elem; /* An element table */
23854 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023855
Daniel Veillardce682bc2004-11-05 17:22:25 +000023856 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
23857 for (n_elem = 0;n_elem < gen_nb_xmlElementPtr;n_elem++) {
23858 mem_base = xmlMemBlocks();
23859 buf = gen_xmlBufferPtr(n_buf, 0);
23860 elem = gen_xmlElementPtr(n_elem, 1);
23861
23862 xmlDumpElementDecl(buf, elem);
23863 call_tests++;
23864 des_xmlBufferPtr(n_buf, buf, 0);
23865 des_xmlElementPtr(n_elem, elem, 1);
23866 xmlResetLastError();
23867 if (mem_base != xmlMemBlocks()) {
23868 printf("Leak of %d blocks found in xmlDumpElementDecl",
23869 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023870 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023871 printf(" %d", n_buf);
23872 printf(" %d", n_elem);
23873 printf("\n");
23874 }
23875 }
23876 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023877 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023878#endif
23879
Daniel Veillard42595322004-11-08 10:52:06 +000023880 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023881}
23882
23883
23884static int
23885test_xmlDumpElementTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023886 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023887
William M. Brack21e4ef22005-01-02 09:53:13 +000023888#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000023889 int mem_base;
23890 xmlBufferPtr buf; /* the XML buffer output */
23891 int n_buf;
23892 xmlElementTablePtr table; /* An element table */
23893 int n_table;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023894
Daniel Veillardce682bc2004-11-05 17:22:25 +000023895 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
23896 for (n_table = 0;n_table < gen_nb_xmlElementTablePtr;n_table++) {
23897 mem_base = xmlMemBlocks();
23898 buf = gen_xmlBufferPtr(n_buf, 0);
23899 table = gen_xmlElementTablePtr(n_table, 1);
23900
23901 xmlDumpElementTable(buf, table);
23902 call_tests++;
23903 des_xmlBufferPtr(n_buf, buf, 0);
23904 des_xmlElementTablePtr(n_table, table, 1);
23905 xmlResetLastError();
23906 if (mem_base != xmlMemBlocks()) {
23907 printf("Leak of %d blocks found in xmlDumpElementTable",
23908 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023909 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023910 printf(" %d", n_buf);
23911 printf(" %d", n_table);
23912 printf("\n");
23913 }
23914 }
23915 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023916 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023917#endif
23918
Daniel Veillard42595322004-11-08 10:52:06 +000023919 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023920}
23921
23922
Daniel Veillardce682bc2004-11-05 17:22:25 +000023923#define gen_nb_xmlNotationPtr 1
23924static xmlNotationPtr gen_xmlNotationPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23925 return(NULL);
23926}
23927static void des_xmlNotationPtr(int no ATTRIBUTE_UNUSED, xmlNotationPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23928}
23929
Daniel Veillardd93f6252004-11-02 15:53:51 +000023930static int
23931test_xmlDumpNotationDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023932 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023933
William M. Brack21e4ef22005-01-02 09:53:13 +000023934#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000023935 int mem_base;
23936 xmlBufferPtr buf; /* the XML buffer output */
23937 int n_buf;
23938 xmlNotationPtr nota; /* A notation declaration */
23939 int n_nota;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023940
Daniel Veillardce682bc2004-11-05 17:22:25 +000023941 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
23942 for (n_nota = 0;n_nota < gen_nb_xmlNotationPtr;n_nota++) {
23943 mem_base = xmlMemBlocks();
23944 buf = gen_xmlBufferPtr(n_buf, 0);
23945 nota = gen_xmlNotationPtr(n_nota, 1);
23946
23947 xmlDumpNotationDecl(buf, nota);
23948 call_tests++;
23949 des_xmlBufferPtr(n_buf, buf, 0);
23950 des_xmlNotationPtr(n_nota, nota, 1);
23951 xmlResetLastError();
23952 if (mem_base != xmlMemBlocks()) {
23953 printf("Leak of %d blocks found in xmlDumpNotationDecl",
23954 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023955 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023956 printf(" %d", n_buf);
23957 printf(" %d", n_nota);
23958 printf("\n");
23959 }
23960 }
23961 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023962 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023963#endif
23964
Daniel Veillard42595322004-11-08 10:52:06 +000023965 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023966}
23967
23968
23969static int
23970test_xmlDumpNotationTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023971 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023972
William M. Brack21e4ef22005-01-02 09:53:13 +000023973#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000023974 int mem_base;
23975 xmlBufferPtr buf; /* the XML buffer output */
23976 int n_buf;
23977 xmlNotationTablePtr table; /* A notation table */
23978 int n_table;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023979
Daniel Veillardce682bc2004-11-05 17:22:25 +000023980 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
23981 for (n_table = 0;n_table < gen_nb_xmlNotationTablePtr;n_table++) {
23982 mem_base = xmlMemBlocks();
23983 buf = gen_xmlBufferPtr(n_buf, 0);
23984 table = gen_xmlNotationTablePtr(n_table, 1);
23985
23986 xmlDumpNotationTable(buf, table);
23987 call_tests++;
23988 des_xmlBufferPtr(n_buf, buf, 0);
23989 des_xmlNotationTablePtr(n_table, table, 1);
23990 xmlResetLastError();
23991 if (mem_base != xmlMemBlocks()) {
23992 printf("Leak of %d blocks found in xmlDumpNotationTable",
23993 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023994 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023995 printf(" %d", n_buf);
23996 printf(" %d", n_table);
23997 printf("\n");
23998 }
23999 }
24000 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024001 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024002#endif
24003
Daniel Veillard42595322004-11-08 10:52:06 +000024004 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024005}
24006
24007
24008static int
24009test_xmlGetDtdAttrDesc(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;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024020
Daniel Veillard42595322004-11-08 10:52:06 +000024021 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
24022 for (n_elem = 0;n_elem < gen_nb_const_xmlChar_ptr;n_elem++) {
24023 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24024 mem_base = xmlMemBlocks();
24025 dtd = gen_xmlDtdPtr(n_dtd, 0);
24026 elem = gen_const_xmlChar_ptr(n_elem, 1);
24027 name = gen_const_xmlChar_ptr(n_name, 2);
24028
William M. Brackf13f77f2004-11-12 16:03:48 +000024029 ret_val = xmlGetDtdAttrDesc(dtd, (const xmlChar *)elem, (const xmlChar *)name);
Daniel Veillard42595322004-11-08 10:52:06 +000024030 desret_xmlAttributePtr(ret_val);
24031 call_tests++;
24032 des_xmlDtdPtr(n_dtd, dtd, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000024033 des_const_xmlChar_ptr(n_elem, (const xmlChar *)elem, 1);
24034 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
Daniel Veillard42595322004-11-08 10:52:06 +000024035 xmlResetLastError();
24036 if (mem_base != xmlMemBlocks()) {
24037 printf("Leak of %d blocks found in xmlGetDtdAttrDesc",
24038 xmlMemBlocks() - mem_base);
24039 test_ret++;
24040 printf(" %d", n_dtd);
24041 printf(" %d", n_elem);
24042 printf(" %d", n_name);
24043 printf("\n");
24044 }
24045 }
24046 }
24047 }
Daniel Veillard42595322004-11-08 10:52:06 +000024048 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024049
Daniel Veillard42595322004-11-08 10:52:06 +000024050 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024051}
24052
24053
24054static int
24055test_xmlGetDtdElementDesc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024056 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024057
Daniel Veillard42595322004-11-08 10:52:06 +000024058 int mem_base;
24059 xmlElementPtr ret_val;
24060 xmlDtdPtr dtd; /* a pointer to the DtD to search */
24061 int n_dtd;
24062 xmlChar * name; /* the element name */
24063 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024064
Daniel Veillard42595322004-11-08 10:52:06 +000024065 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
24066 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24067 mem_base = xmlMemBlocks();
24068 dtd = gen_xmlDtdPtr(n_dtd, 0);
24069 name = gen_const_xmlChar_ptr(n_name, 1);
24070
William M. Brackf13f77f2004-11-12 16:03:48 +000024071 ret_val = xmlGetDtdElementDesc(dtd, (const xmlChar *)name);
Daniel Veillard42595322004-11-08 10:52:06 +000024072 desret_xmlElementPtr(ret_val);
24073 call_tests++;
24074 des_xmlDtdPtr(n_dtd, dtd, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000024075 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard42595322004-11-08 10:52:06 +000024076 xmlResetLastError();
24077 if (mem_base != xmlMemBlocks()) {
24078 printf("Leak of %d blocks found in xmlGetDtdElementDesc",
24079 xmlMemBlocks() - mem_base);
24080 test_ret++;
24081 printf(" %d", n_dtd);
24082 printf(" %d", n_name);
24083 printf("\n");
24084 }
24085 }
24086 }
Daniel Veillard42595322004-11-08 10:52:06 +000024087 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024088
Daniel Veillard42595322004-11-08 10:52:06 +000024089 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024090}
24091
24092
24093static int
24094test_xmlGetDtdNotationDesc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024095 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024096
24097
24098 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000024099 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024100}
24101
24102
24103static int
24104test_xmlGetDtdQAttrDesc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024105 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024106
Daniel Veillard42595322004-11-08 10:52:06 +000024107 int mem_base;
24108 xmlAttributePtr ret_val;
24109 xmlDtdPtr dtd; /* a pointer to the DtD to search */
24110 int n_dtd;
24111 xmlChar * elem; /* the element name */
24112 int n_elem;
24113 xmlChar * name; /* the attribute name */
24114 int n_name;
24115 xmlChar * prefix; /* the attribute namespace prefix */
24116 int n_prefix;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024117
Daniel Veillard42595322004-11-08 10:52:06 +000024118 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
24119 for (n_elem = 0;n_elem < gen_nb_const_xmlChar_ptr;n_elem++) {
24120 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24121 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
24122 mem_base = xmlMemBlocks();
24123 dtd = gen_xmlDtdPtr(n_dtd, 0);
24124 elem = gen_const_xmlChar_ptr(n_elem, 1);
24125 name = gen_const_xmlChar_ptr(n_name, 2);
24126 prefix = gen_const_xmlChar_ptr(n_prefix, 3);
24127
William M. Brackf13f77f2004-11-12 16:03:48 +000024128 ret_val = xmlGetDtdQAttrDesc(dtd, (const xmlChar *)elem, (const xmlChar *)name, (const xmlChar *)prefix);
Daniel Veillard42595322004-11-08 10:52:06 +000024129 desret_xmlAttributePtr(ret_val);
24130 call_tests++;
24131 des_xmlDtdPtr(n_dtd, dtd, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000024132 des_const_xmlChar_ptr(n_elem, (const xmlChar *)elem, 1);
24133 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
24134 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 3);
Daniel Veillard42595322004-11-08 10:52:06 +000024135 xmlResetLastError();
24136 if (mem_base != xmlMemBlocks()) {
24137 printf("Leak of %d blocks found in xmlGetDtdQAttrDesc",
24138 xmlMemBlocks() - mem_base);
24139 test_ret++;
24140 printf(" %d", n_dtd);
24141 printf(" %d", n_elem);
24142 printf(" %d", n_name);
24143 printf(" %d", n_prefix);
24144 printf("\n");
24145 }
24146 }
24147 }
24148 }
24149 }
Daniel Veillard42595322004-11-08 10:52:06 +000024150 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024151
Daniel Veillard42595322004-11-08 10:52:06 +000024152 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024153}
24154
24155
24156static int
24157test_xmlGetDtdQElementDesc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024158 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024159
Daniel Veillard42595322004-11-08 10:52:06 +000024160 int mem_base;
24161 xmlElementPtr ret_val;
24162 xmlDtdPtr dtd; /* a pointer to the DtD to search */
24163 int n_dtd;
24164 xmlChar * name; /* the element name */
24165 int n_name;
24166 xmlChar * prefix; /* the element namespace prefix */
24167 int n_prefix;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024168
Daniel Veillard42595322004-11-08 10:52:06 +000024169 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
24170 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24171 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
24172 mem_base = xmlMemBlocks();
24173 dtd = gen_xmlDtdPtr(n_dtd, 0);
24174 name = gen_const_xmlChar_ptr(n_name, 1);
24175 prefix = gen_const_xmlChar_ptr(n_prefix, 2);
24176
William M. Brackf13f77f2004-11-12 16:03:48 +000024177 ret_val = xmlGetDtdQElementDesc(dtd, (const xmlChar *)name, (const xmlChar *)prefix);
Daniel Veillard42595322004-11-08 10:52:06 +000024178 desret_xmlElementPtr(ret_val);
24179 call_tests++;
24180 des_xmlDtdPtr(n_dtd, dtd, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000024181 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
24182 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 2);
Daniel Veillard42595322004-11-08 10:52:06 +000024183 xmlResetLastError();
24184 if (mem_base != xmlMemBlocks()) {
24185 printf("Leak of %d blocks found in xmlGetDtdQElementDesc",
24186 xmlMemBlocks() - mem_base);
24187 test_ret++;
24188 printf(" %d", n_dtd);
24189 printf(" %d", n_name);
24190 printf(" %d", n_prefix);
24191 printf("\n");
24192 }
24193 }
24194 }
24195 }
Daniel Veillard42595322004-11-08 10:52:06 +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_xmlGetID(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024204 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024205
Daniel Veillard57b25162004-11-06 14:50:18 +000024206 int mem_base;
24207 xmlAttrPtr ret_val;
24208 xmlDocPtr doc; /* pointer to the document */
24209 int n_doc;
24210 xmlChar * ID; /* the ID value */
24211 int n_ID;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024212
Daniel Veillard57b25162004-11-06 14:50:18 +000024213 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24214 for (n_ID = 0;n_ID < gen_nb_const_xmlChar_ptr;n_ID++) {
24215 mem_base = xmlMemBlocks();
24216 doc = gen_xmlDocPtr(n_doc, 0);
24217 ID = gen_const_xmlChar_ptr(n_ID, 1);
24218
William M. Brackf13f77f2004-11-12 16:03:48 +000024219 ret_val = xmlGetID(doc, (const xmlChar *)ID);
Daniel Veillard57b25162004-11-06 14:50:18 +000024220 desret_xmlAttrPtr(ret_val);
24221 call_tests++;
24222 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000024223 des_const_xmlChar_ptr(n_ID, (const xmlChar *)ID, 1);
Daniel Veillard57b25162004-11-06 14:50:18 +000024224 xmlResetLastError();
24225 if (mem_base != xmlMemBlocks()) {
24226 printf("Leak of %d blocks found in xmlGetID",
24227 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024228 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000024229 printf(" %d", n_doc);
24230 printf(" %d", n_ID);
24231 printf("\n");
24232 }
24233 }
24234 }
Daniel Veillard57b25162004-11-06 14:50:18 +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_xmlGetRefs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024243 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024244
24245
24246 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000024247 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024248}
24249
24250
24251static int
24252test_xmlIsID(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024253 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024254
Daniel Veillardce244ad2004-11-05 10:03:46 +000024255 int mem_base;
24256 int ret_val;
24257 xmlDocPtr doc; /* the document */
24258 int n_doc;
24259 xmlNodePtr elem; /* the element carrying the attribute */
24260 int n_elem;
24261 xmlAttrPtr attr; /* the attribute */
24262 int n_attr;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024263
Daniel Veillardce244ad2004-11-05 10:03:46 +000024264 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24265 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
24266 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
24267 mem_base = xmlMemBlocks();
24268 doc = gen_xmlDocPtr(n_doc, 0);
24269 elem = gen_xmlNodePtr(n_elem, 1);
24270 attr = gen_xmlAttrPtr(n_attr, 2);
24271
24272 ret_val = xmlIsID(doc, elem, attr);
24273 desret_int(ret_val);
24274 call_tests++;
24275 des_xmlDocPtr(n_doc, doc, 0);
24276 des_xmlNodePtr(n_elem, elem, 1);
24277 des_xmlAttrPtr(n_attr, attr, 2);
24278 xmlResetLastError();
24279 if (mem_base != xmlMemBlocks()) {
24280 printf("Leak of %d blocks found in xmlIsID",
24281 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024282 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000024283 printf(" %d", n_doc);
24284 printf(" %d", n_elem);
24285 printf(" %d", n_attr);
24286 printf("\n");
24287 }
24288 }
24289 }
24290 }
Daniel Veillardce244ad2004-11-05 10:03:46 +000024291 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024292
Daniel Veillard42595322004-11-08 10:52:06 +000024293 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024294}
24295
24296
24297static int
24298test_xmlIsMixedElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024299 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024300
24301 int mem_base;
24302 int ret_val;
24303 xmlDocPtr doc; /* the document */
24304 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024305 xmlChar * name; /* the element name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000024306 int n_name;
24307
24308 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24309 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24310 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000024311 doc = gen_xmlDocPtr(n_doc, 0);
24312 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024313
William M. Brackf13f77f2004-11-12 16:03:48 +000024314 ret_val = xmlIsMixedElement(doc, (const xmlChar *)name);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024315 desret_int(ret_val);
24316 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000024317 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000024318 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024319 xmlResetLastError();
24320 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000024321 printf("Leak of %d blocks found in xmlIsMixedElement",
Daniel Veillardd93f6252004-11-02 15:53:51 +000024322 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024323 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000024324 printf(" %d", n_doc);
24325 printf(" %d", n_name);
24326 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000024327 }
24328 }
24329 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000024330 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024331
Daniel Veillard42595322004-11-08 10:52:06 +000024332 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024333}
24334
24335
24336static int
24337test_xmlIsRef(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 xmlNodePtr elem; /* the element carrying the attribute */
24345 int n_elem;
24346 xmlAttrPtr attr; /* the attribute */
24347 int n_attr;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024348
Daniel Veillardce244ad2004-11-05 10:03:46 +000024349 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24350 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
24351 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
24352 mem_base = xmlMemBlocks();
24353 doc = gen_xmlDocPtr(n_doc, 0);
24354 elem = gen_xmlNodePtr(n_elem, 1);
24355 attr = gen_xmlAttrPtr(n_attr, 2);
24356
24357 ret_val = xmlIsRef(doc, elem, attr);
24358 desret_int(ret_val);
24359 call_tests++;
24360 des_xmlDocPtr(n_doc, doc, 0);
24361 des_xmlNodePtr(n_elem, elem, 1);
24362 des_xmlAttrPtr(n_attr, attr, 2);
24363 xmlResetLastError();
24364 if (mem_base != xmlMemBlocks()) {
24365 printf("Leak of %d blocks found in xmlIsRef",
24366 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024367 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000024368 printf(" %d", n_doc);
24369 printf(" %d", n_elem);
24370 printf(" %d", n_attr);
24371 printf("\n");
24372 }
24373 }
24374 }
24375 }
Daniel Veillardce244ad2004-11-05 10:03:46 +000024376 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024377
Daniel Veillard42595322004-11-08 10:52:06 +000024378 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024379}
24380
24381
24382static int
Daniel Veillard2ae13382005-01-25 23:45:06 +000024383test_xmlNewDocElementContent(void) {
24384 int test_ret = 0;
24385
24386 int mem_base;
24387 xmlElementContentPtr ret_val;
24388 xmlDocPtr doc; /* the document */
24389 int n_doc;
24390 xmlChar * name; /* the subelement name or NULL */
24391 int n_name;
24392 xmlElementContentType type; /* the type of element content decl */
24393 int n_type;
24394
24395 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24396 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24397 for (n_type = 0;n_type < gen_nb_xmlElementContentType;n_type++) {
24398 mem_base = xmlMemBlocks();
24399 doc = gen_xmlDocPtr(n_doc, 0);
24400 name = gen_const_xmlChar_ptr(n_name, 1);
24401 type = gen_xmlElementContentType(n_type, 2);
24402
24403 ret_val = xmlNewDocElementContent(doc, (const xmlChar *)name, type);
Daniel Veillardc394f732005-01-26 00:04:52 +000024404 xmlFreeDocElementContent(doc, ret_val); ret_val = NULL;
Daniel Veillard2ae13382005-01-25 23:45:06 +000024405 desret_xmlElementContentPtr(ret_val);
24406 call_tests++;
24407 des_xmlDocPtr(n_doc, doc, 0);
24408 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
24409 des_xmlElementContentType(n_type, type, 2);
24410 xmlResetLastError();
24411 if (mem_base != xmlMemBlocks()) {
24412 printf("Leak of %d blocks found in xmlNewDocElementContent",
24413 xmlMemBlocks() - mem_base);
24414 test_ret++;
24415 printf(" %d", n_doc);
24416 printf(" %d", n_name);
24417 printf(" %d", n_type);
24418 printf("\n");
24419 }
24420 }
24421 }
24422 }
24423 function_tests++;
24424
24425 return(test_ret);
24426}
24427
24428
24429static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000024430test_xmlNewElementContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024431 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024432
William M. Brack094dd862004-11-14 14:28:34 +000024433 int mem_base;
24434 xmlElementContentPtr ret_val;
24435 xmlChar * name; /* the subelement name or NULL */
24436 int n_name;
24437 xmlElementContentType type; /* the type of element content decl */
24438 int n_type;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024439
William M. Brack094dd862004-11-14 14:28:34 +000024440 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24441 for (n_type = 0;n_type < gen_nb_xmlElementContentType;n_type++) {
24442 mem_base = xmlMemBlocks();
24443 name = gen_const_xmlChar_ptr(n_name, 0);
24444 type = gen_xmlElementContentType(n_type, 1);
24445
24446 ret_val = xmlNewElementContent((const xmlChar *)name, type);
24447 desret_xmlElementContentPtr(ret_val);
24448 call_tests++;
24449 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
24450 des_xmlElementContentType(n_type, type, 1);
24451 xmlResetLastError();
24452 if (mem_base != xmlMemBlocks()) {
24453 printf("Leak of %d blocks found in xmlNewElementContent",
24454 xmlMemBlocks() - mem_base);
24455 test_ret++;
24456 printf(" %d", n_name);
24457 printf(" %d", n_type);
24458 printf("\n");
24459 }
24460 }
24461 }
24462 function_tests++;
24463
Daniel Veillard42595322004-11-08 10:52:06 +000024464 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024465}
24466
24467
24468static int
24469test_xmlNewValidCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024470 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024471
24472
24473 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000024474 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024475}
24476
24477
24478static int
24479test_xmlRemoveID(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024480 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024481
Daniel Veillardce244ad2004-11-05 10:03:46 +000024482 int mem_base;
24483 int ret_val;
24484 xmlDocPtr doc; /* the document */
24485 int n_doc;
24486 xmlAttrPtr attr; /* the attribute */
24487 int n_attr;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024488
Daniel Veillardce244ad2004-11-05 10:03:46 +000024489 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24490 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
24491 mem_base = xmlMemBlocks();
24492 doc = gen_xmlDocPtr(n_doc, 0);
24493 attr = gen_xmlAttrPtr(n_attr, 1);
24494
24495 ret_val = xmlRemoveID(doc, attr);
24496 desret_int(ret_val);
24497 call_tests++;
24498 des_xmlDocPtr(n_doc, doc, 0);
24499 des_xmlAttrPtr(n_attr, attr, 1);
24500 xmlResetLastError();
24501 if (mem_base != xmlMemBlocks()) {
24502 printf("Leak of %d blocks found in xmlRemoveID",
24503 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024504 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000024505 printf(" %d", n_doc);
24506 printf(" %d", n_attr);
24507 printf("\n");
24508 }
24509 }
24510 }
Daniel Veillardce244ad2004-11-05 10:03:46 +000024511 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024512
Daniel Veillard42595322004-11-08 10:52:06 +000024513 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024514}
24515
24516
24517static int
24518test_xmlRemoveRef(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024519 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024520
Daniel Veillardce244ad2004-11-05 10:03:46 +000024521 int mem_base;
24522 int ret_val;
24523 xmlDocPtr doc; /* the document */
24524 int n_doc;
24525 xmlAttrPtr attr; /* the attribute */
24526 int n_attr;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024527
Daniel Veillardce244ad2004-11-05 10:03:46 +000024528 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24529 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
24530 mem_base = xmlMemBlocks();
24531 doc = gen_xmlDocPtr(n_doc, 0);
24532 attr = gen_xmlAttrPtr(n_attr, 1);
24533
24534 ret_val = xmlRemoveRef(doc, attr);
24535 desret_int(ret_val);
24536 call_tests++;
24537 des_xmlDocPtr(n_doc, doc, 0);
24538 des_xmlAttrPtr(n_attr, attr, 1);
24539 xmlResetLastError();
24540 if (mem_base != xmlMemBlocks()) {
24541 printf("Leak of %d blocks found in xmlRemoveRef",
24542 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024543 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000024544 printf(" %d", n_doc);
24545 printf(" %d", n_attr);
24546 printf("\n");
24547 }
24548 }
24549 }
Daniel Veillardce244ad2004-11-05 10:03:46 +000024550 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024551
Daniel Veillard42595322004-11-08 10:52:06 +000024552 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024553}
24554
24555
24556static int
24557test_xmlSnprintfElementContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024558 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024559
Daniel Veillardce682bc2004-11-05 17:22:25 +000024560 int mem_base;
24561 char * buf; /* an output buffer */
24562 int n_buf;
24563 int size; /* the buffer size */
24564 int n_size;
24565 xmlElementContentPtr content; /* An element table */
24566 int n_content;
24567 int glob; /* 1 if one must print the englobing parenthesis, 0 otherwise */
24568 int n_glob;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024569
Daniel Veillardce682bc2004-11-05 17:22:25 +000024570 for (n_buf = 0;n_buf < gen_nb_char_ptr;n_buf++) {
24571 for (n_size = 0;n_size < gen_nb_int;n_size++) {
24572 for (n_content = 0;n_content < gen_nb_xmlElementContentPtr;n_content++) {
24573 for (n_glob = 0;n_glob < gen_nb_int;n_glob++) {
24574 mem_base = xmlMemBlocks();
24575 buf = gen_char_ptr(n_buf, 0);
24576 size = gen_int(n_size, 1);
24577 content = gen_xmlElementContentPtr(n_content, 2);
24578 glob = gen_int(n_glob, 3);
24579
24580 xmlSnprintfElementContent(buf, size, content, glob);
24581 call_tests++;
24582 des_char_ptr(n_buf, buf, 0);
24583 des_int(n_size, size, 1);
24584 des_xmlElementContentPtr(n_content, content, 2);
24585 des_int(n_glob, glob, 3);
24586 xmlResetLastError();
24587 if (mem_base != xmlMemBlocks()) {
24588 printf("Leak of %d blocks found in xmlSnprintfElementContent",
24589 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024590 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024591 printf(" %d", n_buf);
24592 printf(" %d", n_size);
24593 printf(" %d", n_content);
24594 printf(" %d", n_glob);
24595 printf("\n");
24596 }
24597 }
24598 }
24599 }
24600 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000024601 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024602
Daniel Veillard42595322004-11-08 10:52:06 +000024603 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024604}
24605
24606
24607static int
24608test_xmlSprintfElementContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024609 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024610
William M. Brack21e4ef22005-01-02 09:53:13 +000024611#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000024612#ifdef LIBXML_OUTPUT_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000024613 int mem_base;
24614 char * buf; /* an output buffer */
24615 int n_buf;
24616 xmlElementContentPtr content; /* An element table */
24617 int n_content;
24618 int glob; /* 1 if one must print the englobing parenthesis, 0 otherwise */
24619 int n_glob;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024620
Daniel Veillardce682bc2004-11-05 17:22:25 +000024621 for (n_buf = 0;n_buf < gen_nb_char_ptr;n_buf++) {
24622 for (n_content = 0;n_content < gen_nb_xmlElementContentPtr;n_content++) {
24623 for (n_glob = 0;n_glob < gen_nb_int;n_glob++) {
24624 mem_base = xmlMemBlocks();
24625 buf = gen_char_ptr(n_buf, 0);
24626 content = gen_xmlElementContentPtr(n_content, 1);
24627 glob = gen_int(n_glob, 2);
24628
24629 xmlSprintfElementContent(buf, content, glob);
24630 call_tests++;
24631 des_char_ptr(n_buf, buf, 0);
24632 des_xmlElementContentPtr(n_content, content, 1);
24633 des_int(n_glob, glob, 2);
24634 xmlResetLastError();
24635 if (mem_base != xmlMemBlocks()) {
24636 printf("Leak of %d blocks found in xmlSprintfElementContent",
24637 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024638 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024639 printf(" %d", n_buf);
24640 printf(" %d", n_content);
24641 printf(" %d", n_glob);
24642 printf("\n");
24643 }
24644 }
24645 }
24646 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024647 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000024648#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000024649#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +000024650
Daniel Veillard42595322004-11-08 10:52:06 +000024651 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024652}
24653
24654
24655static int
24656test_xmlValidBuildContentModel(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024657 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024658
William M. Brack21e4ef22005-01-02 09:53:13 +000024659#if defined(LIBXML_VALID_ENABLED) && defined(LIBXML_REGEXP_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000024660 int mem_base;
24661 int ret_val;
24662 xmlValidCtxtPtr ctxt; /* a validation context */
24663 int n_ctxt;
24664 xmlElementPtr elem; /* an element declaration node */
24665 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024666
Daniel Veillardce682bc2004-11-05 17:22:25 +000024667 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
24668 for (n_elem = 0;n_elem < gen_nb_xmlElementPtr;n_elem++) {
24669 mem_base = xmlMemBlocks();
24670 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
24671 elem = gen_xmlElementPtr(n_elem, 1);
24672
24673 ret_val = xmlValidBuildContentModel(ctxt, elem);
24674 desret_int(ret_val);
24675 call_tests++;
24676 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
24677 des_xmlElementPtr(n_elem, elem, 1);
24678 xmlResetLastError();
24679 if (mem_base != xmlMemBlocks()) {
24680 printf("Leak of %d blocks found in xmlValidBuildContentModel",
24681 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024682 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024683 printf(" %d", n_ctxt);
24684 printf(" %d", n_elem);
24685 printf("\n");
24686 }
24687 }
24688 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024689 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024690#endif
24691
Daniel Veillard42595322004-11-08 10:52:06 +000024692 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024693}
24694
24695
24696static int
24697test_xmlValidCtxtNormalizeAttributeValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024698 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024699
William M. Brack21e4ef22005-01-02 09:53:13 +000024700#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024701 int mem_base;
24702 xmlChar * ret_val;
24703 xmlValidCtxtPtr ctxt; /* the validation context or NULL */
24704 int n_ctxt;
24705 xmlDocPtr doc; /* the document */
24706 int n_doc;
24707 xmlNodePtr elem; /* the parent */
24708 int n_elem;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024709 xmlChar * name; /* the attribute name */
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024710 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024711 xmlChar * value; /* the attribute value */
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024712 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024713
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024714 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
24715 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24716 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
24717 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24718 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
24719 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000024720 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
24721 doc = gen_xmlDocPtr(n_doc, 1);
24722 elem = gen_xmlNodePtr(n_elem, 2);
24723 name = gen_const_xmlChar_ptr(n_name, 3);
24724 value = gen_const_xmlChar_ptr(n_value, 4);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024725
William M. Brackf13f77f2004-11-12 16:03:48 +000024726 ret_val = xmlValidCtxtNormalizeAttributeValue(ctxt, doc, elem, (const xmlChar *)name, (const xmlChar *)value);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024727 desret_xmlChar_ptr(ret_val);
24728 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000024729 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
24730 des_xmlDocPtr(n_doc, doc, 1);
24731 des_xmlNodePtr(n_elem, elem, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000024732 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 3);
24733 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 4);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024734 xmlResetLastError();
24735 if (mem_base != xmlMemBlocks()) {
24736 printf("Leak of %d blocks found in xmlValidCtxtNormalizeAttributeValue",
24737 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024738 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024739 printf(" %d", n_ctxt);
24740 printf(" %d", n_doc);
24741 printf(" %d", n_elem);
24742 printf(" %d", n_name);
24743 printf(" %d", n_value);
24744 printf("\n");
24745 }
24746 }
24747 }
24748 }
24749 }
24750 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024751 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024752#endif
24753
Daniel Veillard42595322004-11-08 10:52:06 +000024754 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024755}
24756
24757
Daniel Veillardce682bc2004-11-05 17:22:25 +000024758#define gen_nb_xmlElementContent_ptr 1
24759static xmlElementContent * gen_xmlElementContent_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
24760 return(NULL);
24761}
24762static void des_xmlElementContent_ptr(int no ATTRIBUTE_UNUSED, xmlElementContent * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
24763}
24764
Daniel Veillardd93f6252004-11-02 15:53:51 +000024765static int
24766test_xmlValidGetPotentialChildren(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024767 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024768
William M. Brack21e4ef22005-01-02 09:53:13 +000024769#if defined(LIBXML_VALID_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000024770#ifdef LIBXML_VALID_ENABLED
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024771 int mem_base;
24772 int ret_val;
24773 xmlElementContent * ctree; /* an element content tree */
24774 int n_ctree;
24775 xmlChar ** list; /* an array to store the list of child names */
24776 int n_list;
24777 int * len; /* a pointer to the number of element in the list */
24778 int n_len;
24779 int max; /* the size of the array */
24780 int n_max;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024781
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024782 for (n_ctree = 0;n_ctree < gen_nb_xmlElementContent_ptr;n_ctree++) {
24783 for (n_list = 0;n_list < gen_nb_const_xmlChar_ptr_ptr;n_list++) {
24784 for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
24785 for (n_max = 0;n_max < gen_nb_int;n_max++) {
24786 mem_base = xmlMemBlocks();
24787 ctree = gen_xmlElementContent_ptr(n_ctree, 0);
24788 list = gen_const_xmlChar_ptr_ptr(n_list, 1);
24789 len = gen_int_ptr(n_len, 2);
24790 max = gen_int(n_max, 3);
24791
William M. Brackf13f77f2004-11-12 16:03:48 +000024792 ret_val = xmlValidGetPotentialChildren(ctree, (const xmlChar **)list, len, max);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024793 desret_int(ret_val);
24794 call_tests++;
24795 des_xmlElementContent_ptr(n_ctree, ctree, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000024796 des_const_xmlChar_ptr_ptr(n_list, (const xmlChar **)list, 1);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024797 des_int_ptr(n_len, len, 2);
24798 des_int(n_max, max, 3);
24799 xmlResetLastError();
24800 if (mem_base != xmlMemBlocks()) {
24801 printf("Leak of %d blocks found in xmlValidGetPotentialChildren",
24802 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024803 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024804 printf(" %d", n_ctree);
24805 printf(" %d", n_list);
24806 printf(" %d", n_len);
24807 printf(" %d", n_max);
24808 printf("\n");
24809 }
24810 }
24811 }
24812 }
24813 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024814 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000024815#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000024816#endif
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024817
Daniel Veillard42595322004-11-08 10:52:06 +000024818 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024819}
24820
24821
24822static int
24823test_xmlValidGetValidElements(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024824 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024825
William M. Brack21e4ef22005-01-02 09:53:13 +000024826#if defined(LIBXML_VALID_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000024827#ifdef LIBXML_VALID_ENABLED
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024828 int mem_base;
24829 int ret_val;
24830 xmlNode * prev; /* an element to insert after */
24831 int n_prev;
24832 xmlNode * next; /* an element to insert next */
24833 int n_next;
24834 xmlChar ** names; /* an array to store the list of child names */
24835 int n_names;
24836 int max; /* the size of the array */
24837 int n_max;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024838
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024839 for (n_prev = 0;n_prev < gen_nb_xmlNodePtr;n_prev++) {
24840 for (n_next = 0;n_next < gen_nb_xmlNodePtr;n_next++) {
24841 for (n_names = 0;n_names < gen_nb_const_xmlChar_ptr_ptr;n_names++) {
24842 for (n_max = 0;n_max < gen_nb_int;n_max++) {
24843 mem_base = xmlMemBlocks();
24844 prev = gen_xmlNodePtr(n_prev, 0);
24845 next = gen_xmlNodePtr(n_next, 1);
24846 names = gen_const_xmlChar_ptr_ptr(n_names, 2);
24847 max = gen_int(n_max, 3);
24848
William M. Brackf13f77f2004-11-12 16:03:48 +000024849 ret_val = xmlValidGetValidElements(prev, next, (const xmlChar **)names, max);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024850 desret_int(ret_val);
24851 call_tests++;
24852 des_xmlNodePtr(n_prev, prev, 0);
24853 des_xmlNodePtr(n_next, next, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000024854 des_const_xmlChar_ptr_ptr(n_names, (const xmlChar **)names, 2);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024855 des_int(n_max, max, 3);
24856 xmlResetLastError();
24857 if (mem_base != xmlMemBlocks()) {
24858 printf("Leak of %d blocks found in xmlValidGetValidElements",
24859 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024860 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024861 printf(" %d", n_prev);
24862 printf(" %d", n_next);
24863 printf(" %d", n_names);
24864 printf(" %d", n_max);
24865 printf("\n");
24866 }
24867 }
24868 }
24869 }
24870 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024871 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000024872#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000024873#endif
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024874
Daniel Veillard42595322004-11-08 10:52:06 +000024875 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024876}
24877
24878
24879static int
24880test_xmlValidNormalizeAttributeValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024881 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024882
William M. Brack21e4ef22005-01-02 09:53:13 +000024883#if defined(LIBXML_VALID_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +000024884 int mem_base;
24885 xmlChar * ret_val;
24886 xmlDocPtr doc; /* the document */
24887 int n_doc;
24888 xmlNodePtr elem; /* the parent */
24889 int n_elem;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024890 xmlChar * name; /* the attribute name */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000024891 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024892 xmlChar * value; /* the attribute value */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000024893 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024894
Daniel Veillard8a32fe42004-11-02 22:10:16 +000024895 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24896 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
24897 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24898 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
24899 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000024900 doc = gen_xmlDocPtr(n_doc, 0);
24901 elem = gen_xmlNodePtr(n_elem, 1);
24902 name = gen_const_xmlChar_ptr(n_name, 2);
24903 value = gen_const_xmlChar_ptr(n_value, 3);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000024904
William M. Brackf13f77f2004-11-12 16:03:48 +000024905 ret_val = xmlValidNormalizeAttributeValue(doc, elem, (const xmlChar *)name, (const xmlChar *)value);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000024906 desret_xmlChar_ptr(ret_val);
24907 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000024908 des_xmlDocPtr(n_doc, doc, 0);
24909 des_xmlNodePtr(n_elem, elem, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000024910 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
24911 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 3);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000024912 xmlResetLastError();
24913 if (mem_base != xmlMemBlocks()) {
24914 printf("Leak of %d blocks found in xmlValidNormalizeAttributeValue",
24915 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024916 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000024917 printf(" %d", n_doc);
24918 printf(" %d", n_elem);
24919 printf(" %d", n_name);
24920 printf(" %d", n_value);
24921 printf("\n");
24922 }
24923 }
24924 }
24925 }
24926 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024927 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000024928#endif
24929
Daniel Veillard42595322004-11-08 10:52:06 +000024930 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024931}
24932
24933
24934static int
24935test_xmlValidateAttributeDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024936 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024937
William M. Brack21e4ef22005-01-02 09:53:13 +000024938#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000024939 int mem_base;
24940 int ret_val;
24941 xmlValidCtxtPtr ctxt; /* the validation context */
24942 int n_ctxt;
24943 xmlDocPtr doc; /* a document instance */
24944 int n_doc;
24945 xmlAttributePtr attr; /* an attribute definition */
24946 int n_attr;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024947
Daniel Veillardce682bc2004-11-05 17:22:25 +000024948 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
24949 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24950 for (n_attr = 0;n_attr < gen_nb_xmlAttributePtr;n_attr++) {
24951 mem_base = xmlMemBlocks();
24952 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
24953 doc = gen_xmlDocPtr(n_doc, 1);
24954 attr = gen_xmlAttributePtr(n_attr, 2);
24955
24956 ret_val = xmlValidateAttributeDecl(ctxt, doc, attr);
24957 desret_int(ret_val);
24958 call_tests++;
24959 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
24960 des_xmlDocPtr(n_doc, doc, 1);
24961 des_xmlAttributePtr(n_attr, attr, 2);
24962 xmlResetLastError();
24963 if (mem_base != xmlMemBlocks()) {
24964 printf("Leak of %d blocks found in xmlValidateAttributeDecl",
24965 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024966 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024967 printf(" %d", n_ctxt);
24968 printf(" %d", n_doc);
24969 printf(" %d", n_attr);
24970 printf("\n");
24971 }
24972 }
24973 }
24974 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024975 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024976#endif
24977
Daniel Veillard42595322004-11-08 10:52:06 +000024978 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024979}
24980
24981
24982static int
24983test_xmlValidateAttributeValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024984 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024985
William M. Brack21e4ef22005-01-02 09:53:13 +000024986#if defined(LIBXML_VALID_ENABLED)
Daniel Veillard57b25162004-11-06 14:50:18 +000024987 int mem_base;
24988 int ret_val;
24989 xmlAttributeType type; /* an attribute type */
24990 int n_type;
24991 xmlChar * value; /* an attribute value */
24992 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024993
Daniel Veillard57b25162004-11-06 14:50:18 +000024994 for (n_type = 0;n_type < gen_nb_xmlAttributeType;n_type++) {
24995 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
24996 mem_base = xmlMemBlocks();
24997 type = gen_xmlAttributeType(n_type, 0);
24998 value = gen_const_xmlChar_ptr(n_value, 1);
24999
William M. Brackf13f77f2004-11-12 16:03:48 +000025000 ret_val = xmlValidateAttributeValue(type, (const xmlChar *)value);
Daniel Veillard57b25162004-11-06 14:50:18 +000025001 desret_int(ret_val);
25002 call_tests++;
25003 des_xmlAttributeType(n_type, type, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000025004 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillard57b25162004-11-06 14:50:18 +000025005 xmlResetLastError();
25006 if (mem_base != xmlMemBlocks()) {
25007 printf("Leak of %d blocks found in xmlValidateAttributeValue",
25008 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025009 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000025010 printf(" %d", n_type);
25011 printf(" %d", n_value);
25012 printf("\n");
25013 }
25014 }
25015 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025016 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +000025017#endif
25018
Daniel Veillard42595322004-11-08 10:52:06 +000025019 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025020}
25021
25022
25023static int
25024test_xmlValidateDocument(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025025 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025026
William M. Brack21e4ef22005-01-02 09:53:13 +000025027#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025028 int mem_base;
25029 int ret_val;
25030 xmlValidCtxtPtr ctxt; /* the validation context */
25031 int n_ctxt;
25032 xmlDocPtr doc; /* a document instance */
25033 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025034
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025035 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25036 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25037 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025038 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25039 doc = gen_xmlDocPtr(n_doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025040
25041 ret_val = xmlValidateDocument(ctxt, doc);
25042 desret_int(ret_val);
25043 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025044 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25045 des_xmlDocPtr(n_doc, doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025046 xmlResetLastError();
25047 if (mem_base != xmlMemBlocks()) {
25048 printf("Leak of %d blocks found in xmlValidateDocument",
25049 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025050 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025051 printf(" %d", n_ctxt);
25052 printf(" %d", n_doc);
25053 printf("\n");
25054 }
25055 }
25056 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025057 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025058#endif
25059
Daniel Veillard42595322004-11-08 10:52:06 +000025060 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025061}
25062
25063
25064static int
25065test_xmlValidateDocumentFinal(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025066 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025067
William M. Brack21e4ef22005-01-02 09:53:13 +000025068#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025069 int mem_base;
25070 int ret_val;
25071 xmlValidCtxtPtr ctxt; /* the validation context */
25072 int n_ctxt;
25073 xmlDocPtr doc; /* a document instance */
25074 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025075
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025076 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25077 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25078 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025079 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25080 doc = gen_xmlDocPtr(n_doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025081
25082 ret_val = xmlValidateDocumentFinal(ctxt, doc);
25083 desret_int(ret_val);
25084 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025085 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25086 des_xmlDocPtr(n_doc, doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025087 xmlResetLastError();
25088 if (mem_base != xmlMemBlocks()) {
25089 printf("Leak of %d blocks found in xmlValidateDocumentFinal",
25090 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025091 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025092 printf(" %d", n_ctxt);
25093 printf(" %d", n_doc);
25094 printf("\n");
25095 }
25096 }
25097 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025098 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025099#endif
25100
Daniel Veillard42595322004-11-08 10:52:06 +000025101 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025102}
25103
25104
25105static int
25106test_xmlValidateDtd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025107 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025108
William M. Brack21e4ef22005-01-02 09:53:13 +000025109#if defined(LIBXML_VALID_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000025110 int mem_base;
25111 int ret_val;
25112 xmlValidCtxtPtr ctxt; /* the validation context */
25113 int n_ctxt;
25114 xmlDocPtr doc; /* a document instance */
25115 int n_doc;
25116 xmlDtdPtr dtd; /* a dtd instance */
25117 int n_dtd;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025118
Daniel Veillard27f20102004-11-05 11:50:11 +000025119 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25120 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25121 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
25122 mem_base = xmlMemBlocks();
25123 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25124 doc = gen_xmlDocPtr(n_doc, 1);
25125 dtd = gen_xmlDtdPtr(n_dtd, 2);
25126
25127 ret_val = xmlValidateDtd(ctxt, doc, dtd);
25128 desret_int(ret_val);
25129 call_tests++;
25130 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25131 des_xmlDocPtr(n_doc, doc, 1);
25132 des_xmlDtdPtr(n_dtd, dtd, 2);
25133 xmlResetLastError();
25134 if (mem_base != xmlMemBlocks()) {
25135 printf("Leak of %d blocks found in xmlValidateDtd",
25136 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025137 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000025138 printf(" %d", n_ctxt);
25139 printf(" %d", n_doc);
25140 printf(" %d", n_dtd);
25141 printf("\n");
25142 }
25143 }
25144 }
25145 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025146 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000025147#endif
25148
Daniel Veillard42595322004-11-08 10:52:06 +000025149 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025150}
25151
25152
25153static int
25154test_xmlValidateDtdFinal(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025155 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025156
William M. Brack21e4ef22005-01-02 09:53:13 +000025157#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025158 int mem_base;
25159 int ret_val;
25160 xmlValidCtxtPtr ctxt; /* the validation context */
25161 int n_ctxt;
25162 xmlDocPtr doc; /* a document instance */
25163 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025164
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025165 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25166 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25167 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025168 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25169 doc = gen_xmlDocPtr(n_doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025170
25171 ret_val = xmlValidateDtdFinal(ctxt, doc);
25172 desret_int(ret_val);
25173 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025174 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25175 des_xmlDocPtr(n_doc, doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025176 xmlResetLastError();
25177 if (mem_base != xmlMemBlocks()) {
25178 printf("Leak of %d blocks found in xmlValidateDtdFinal",
25179 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025180 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025181 printf(" %d", n_ctxt);
25182 printf(" %d", n_doc);
25183 printf("\n");
25184 }
25185 }
25186 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025187 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025188#endif
25189
Daniel Veillard42595322004-11-08 10:52:06 +000025190 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025191}
25192
25193
25194static int
25195test_xmlValidateElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025196 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025197
William M. Brack21e4ef22005-01-02 09:53:13 +000025198#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025199 int mem_base;
25200 int ret_val;
25201 xmlValidCtxtPtr ctxt; /* the validation context */
25202 int n_ctxt;
25203 xmlDocPtr doc; /* a document instance */
25204 int n_doc;
25205 xmlNodePtr elem; /* an element instance */
25206 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025207
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025208 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25209 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25210 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
25211 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025212 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25213 doc = gen_xmlDocPtr(n_doc, 1);
25214 elem = gen_xmlNodePtr(n_elem, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025215
25216 ret_val = xmlValidateElement(ctxt, doc, elem);
25217 desret_int(ret_val);
25218 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025219 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25220 des_xmlDocPtr(n_doc, doc, 1);
25221 des_xmlNodePtr(n_elem, elem, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025222 xmlResetLastError();
25223 if (mem_base != xmlMemBlocks()) {
25224 printf("Leak of %d blocks found in xmlValidateElement",
25225 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025226 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025227 printf(" %d", n_ctxt);
25228 printf(" %d", n_doc);
25229 printf(" %d", n_elem);
25230 printf("\n");
25231 }
25232 }
25233 }
25234 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025235 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025236#endif
25237
Daniel Veillard42595322004-11-08 10:52:06 +000025238 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025239}
25240
25241
25242static int
25243test_xmlValidateElementDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025244 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025245
William M. Brack21e4ef22005-01-02 09:53:13 +000025246#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000025247 int mem_base;
25248 int ret_val;
25249 xmlValidCtxtPtr ctxt; /* the validation context */
25250 int n_ctxt;
25251 xmlDocPtr doc; /* a document instance */
25252 int n_doc;
25253 xmlElementPtr elem; /* an element definition */
25254 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025255
Daniel Veillardce682bc2004-11-05 17:22:25 +000025256 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25257 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25258 for (n_elem = 0;n_elem < gen_nb_xmlElementPtr;n_elem++) {
25259 mem_base = xmlMemBlocks();
25260 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25261 doc = gen_xmlDocPtr(n_doc, 1);
25262 elem = gen_xmlElementPtr(n_elem, 2);
25263
25264 ret_val = xmlValidateElementDecl(ctxt, doc, elem);
25265 desret_int(ret_val);
25266 call_tests++;
25267 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25268 des_xmlDocPtr(n_doc, doc, 1);
25269 des_xmlElementPtr(n_elem, elem, 2);
25270 xmlResetLastError();
25271 if (mem_base != xmlMemBlocks()) {
25272 printf("Leak of %d blocks found in xmlValidateElementDecl",
25273 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025274 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025275 printf(" %d", n_ctxt);
25276 printf(" %d", n_doc);
25277 printf(" %d", n_elem);
25278 printf("\n");
25279 }
25280 }
25281 }
25282 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025283 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025284#endif
25285
Daniel Veillard42595322004-11-08 10:52:06 +000025286 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025287}
25288
25289
25290static int
25291test_xmlValidateNameValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025292 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025293
William M. Brack21e4ef22005-01-02 09:53:13 +000025294#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000025295 int mem_base;
25296 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025297 xmlChar * value; /* an Name value */
Daniel Veillardd93f6252004-11-02 15:53:51 +000025298 int n_value;
25299
25300 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25301 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025302 value = gen_const_xmlChar_ptr(n_value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025303
William M. Brackf13f77f2004-11-12 16:03:48 +000025304 ret_val = xmlValidateNameValue((const xmlChar *)value);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025305 desret_int(ret_val);
25306 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000025307 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025308 xmlResetLastError();
25309 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000025310 printf("Leak of %d blocks found in xmlValidateNameValue",
Daniel Veillardd93f6252004-11-02 15:53:51 +000025311 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025312 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000025313 printf(" %d", n_value);
25314 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000025315 }
25316 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025317 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025318#endif
25319
Daniel Veillard42595322004-11-08 10:52:06 +000025320 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025321}
25322
25323
25324static int
25325test_xmlValidateNamesValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025326 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025327
William M. Brack21e4ef22005-01-02 09:53:13 +000025328#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000025329 int mem_base;
25330 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025331 xmlChar * value; /* an Names value */
Daniel Veillardd93f6252004-11-02 15:53:51 +000025332 int n_value;
25333
25334 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25335 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025336 value = gen_const_xmlChar_ptr(n_value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025337
William M. Brackf13f77f2004-11-12 16:03:48 +000025338 ret_val = xmlValidateNamesValue((const xmlChar *)value);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025339 desret_int(ret_val);
25340 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000025341 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025342 xmlResetLastError();
25343 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000025344 printf("Leak of %d blocks found in xmlValidateNamesValue",
Daniel Veillardd93f6252004-11-02 15:53:51 +000025345 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025346 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000025347 printf(" %d", n_value);
25348 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000025349 }
25350 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025351 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025352#endif
25353
Daniel Veillard42595322004-11-08 10:52:06 +000025354 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025355}
25356
25357
25358static int
25359test_xmlValidateNmtokenValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025360 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025361
William M. Brack21e4ef22005-01-02 09:53:13 +000025362#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000025363 int mem_base;
25364 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025365 xmlChar * value; /* an Nmtoken value */
Daniel Veillardd93f6252004-11-02 15:53:51 +000025366 int n_value;
25367
25368 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25369 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025370 value = gen_const_xmlChar_ptr(n_value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025371
William M. Brackf13f77f2004-11-12 16:03:48 +000025372 ret_val = xmlValidateNmtokenValue((const xmlChar *)value);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025373 desret_int(ret_val);
25374 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000025375 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025376 xmlResetLastError();
25377 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000025378 printf("Leak of %d blocks found in xmlValidateNmtokenValue",
Daniel Veillardd93f6252004-11-02 15:53:51 +000025379 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025380 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000025381 printf(" %d", n_value);
25382 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000025383 }
25384 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025385 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025386#endif
25387
Daniel Veillard42595322004-11-08 10:52:06 +000025388 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025389}
25390
25391
25392static int
25393test_xmlValidateNmtokensValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025394 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025395
William M. Brack21e4ef22005-01-02 09:53:13 +000025396#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000025397 int mem_base;
25398 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025399 xmlChar * value; /* an Nmtokens value */
Daniel Veillardd93f6252004-11-02 15:53:51 +000025400 int n_value;
25401
25402 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25403 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025404 value = gen_const_xmlChar_ptr(n_value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025405
William M. Brackf13f77f2004-11-12 16:03:48 +000025406 ret_val = xmlValidateNmtokensValue((const xmlChar *)value);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025407 desret_int(ret_val);
25408 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000025409 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025410 xmlResetLastError();
25411 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000025412 printf("Leak of %d blocks found in xmlValidateNmtokensValue",
Daniel Veillardd93f6252004-11-02 15:53:51 +000025413 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025414 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000025415 printf(" %d", n_value);
25416 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000025417 }
25418 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025419 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025420#endif
25421
Daniel Veillard42595322004-11-08 10:52:06 +000025422 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025423}
25424
25425
25426static int
25427test_xmlValidateNotationDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025428 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025429
William M. Brack21e4ef22005-01-02 09:53:13 +000025430#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000025431 int mem_base;
25432 int ret_val;
25433 xmlValidCtxtPtr ctxt; /* the validation context */
25434 int n_ctxt;
25435 xmlDocPtr doc; /* a document instance */
25436 int n_doc;
25437 xmlNotationPtr nota; /* a notation definition */
25438 int n_nota;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025439
Daniel Veillardce682bc2004-11-05 17:22:25 +000025440 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25441 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25442 for (n_nota = 0;n_nota < gen_nb_xmlNotationPtr;n_nota++) {
25443 mem_base = xmlMemBlocks();
25444 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25445 doc = gen_xmlDocPtr(n_doc, 1);
25446 nota = gen_xmlNotationPtr(n_nota, 2);
25447
25448 ret_val = xmlValidateNotationDecl(ctxt, doc, nota);
25449 desret_int(ret_val);
25450 call_tests++;
25451 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25452 des_xmlDocPtr(n_doc, doc, 1);
25453 des_xmlNotationPtr(n_nota, nota, 2);
25454 xmlResetLastError();
25455 if (mem_base != xmlMemBlocks()) {
25456 printf("Leak of %d blocks found in xmlValidateNotationDecl",
25457 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025458 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025459 printf(" %d", n_ctxt);
25460 printf(" %d", n_doc);
25461 printf(" %d", n_nota);
25462 printf("\n");
25463 }
25464 }
25465 }
25466 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025467 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025468#endif
25469
Daniel Veillard42595322004-11-08 10:52:06 +000025470 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025471}
25472
25473
25474static int
25475test_xmlValidateNotationUse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025476 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025477
William M. Brack21e4ef22005-01-02 09:53:13 +000025478#if defined(LIBXML_VALID_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025479 int mem_base;
25480 int ret_val;
25481 xmlValidCtxtPtr ctxt; /* the validation context */
25482 int n_ctxt;
25483 xmlDocPtr doc; /* the document */
25484 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025485 xmlChar * notationName; /* the notation name to check */
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025486 int n_notationName;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025487
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025488 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25489 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25490 for (n_notationName = 0;n_notationName < gen_nb_const_xmlChar_ptr;n_notationName++) {
25491 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025492 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25493 doc = gen_xmlDocPtr(n_doc, 1);
25494 notationName = gen_const_xmlChar_ptr(n_notationName, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025495
William M. Brackf13f77f2004-11-12 16:03:48 +000025496 ret_val = xmlValidateNotationUse(ctxt, doc, (const xmlChar *)notationName);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025497 desret_int(ret_val);
25498 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025499 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25500 des_xmlDocPtr(n_doc, doc, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000025501 des_const_xmlChar_ptr(n_notationName, (const xmlChar *)notationName, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025502 xmlResetLastError();
25503 if (mem_base != xmlMemBlocks()) {
25504 printf("Leak of %d blocks found in xmlValidateNotationUse",
25505 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025506 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025507 printf(" %d", n_ctxt);
25508 printf(" %d", n_doc);
25509 printf(" %d", n_notationName);
25510 printf("\n");
25511 }
25512 }
25513 }
25514 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025515 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025516#endif
25517
Daniel Veillard42595322004-11-08 10:52:06 +000025518 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025519}
25520
25521
25522static int
25523test_xmlValidateOneAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025524 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025525
William M. Brack21e4ef22005-01-02 09:53:13 +000025526#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardce244ad2004-11-05 10:03:46 +000025527 int mem_base;
25528 int ret_val;
25529 xmlValidCtxtPtr ctxt; /* the validation context */
25530 int n_ctxt;
25531 xmlDocPtr doc; /* a document instance */
25532 int n_doc;
25533 xmlNodePtr elem; /* an element instance */
25534 int n_elem;
25535 xmlAttrPtr attr; /* an attribute instance */
25536 int n_attr;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025537 xmlChar * value; /* the attribute value (without entities processing) */
Daniel Veillardce244ad2004-11-05 10:03:46 +000025538 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025539
Daniel Veillardce244ad2004-11-05 10:03:46 +000025540 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25541 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25542 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
25543 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
25544 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25545 mem_base = xmlMemBlocks();
25546 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25547 doc = gen_xmlDocPtr(n_doc, 1);
25548 elem = gen_xmlNodePtr(n_elem, 2);
25549 attr = gen_xmlAttrPtr(n_attr, 3);
25550 value = gen_const_xmlChar_ptr(n_value, 4);
25551
William M. Brackf13f77f2004-11-12 16:03:48 +000025552 ret_val = xmlValidateOneAttribute(ctxt, doc, elem, attr, (const xmlChar *)value);
Daniel Veillardce244ad2004-11-05 10:03:46 +000025553 desret_int(ret_val);
25554 call_tests++;
25555 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25556 des_xmlDocPtr(n_doc, doc, 1);
25557 des_xmlNodePtr(n_elem, elem, 2);
25558 des_xmlAttrPtr(n_attr, attr, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +000025559 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 4);
Daniel Veillardce244ad2004-11-05 10:03:46 +000025560 xmlResetLastError();
25561 if (mem_base != xmlMemBlocks()) {
25562 printf("Leak of %d blocks found in xmlValidateOneAttribute",
25563 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025564 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000025565 printf(" %d", n_ctxt);
25566 printf(" %d", n_doc);
25567 printf(" %d", n_elem);
25568 printf(" %d", n_attr);
25569 printf(" %d", n_value);
25570 printf("\n");
25571 }
25572 }
25573 }
25574 }
25575 }
25576 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025577 function_tests++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000025578#endif
25579
Daniel Veillard42595322004-11-08 10:52:06 +000025580 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025581}
25582
25583
25584static int
25585test_xmlValidateOneElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025586 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025587
William M. Brack21e4ef22005-01-02 09:53:13 +000025588#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025589 int mem_base;
25590 int ret_val;
25591 xmlValidCtxtPtr ctxt; /* the validation context */
25592 int n_ctxt;
25593 xmlDocPtr doc; /* a document instance */
25594 int n_doc;
25595 xmlNodePtr elem; /* an element instance */
25596 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025597
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025598 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25599 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25600 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
25601 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025602 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25603 doc = gen_xmlDocPtr(n_doc, 1);
25604 elem = gen_xmlNodePtr(n_elem, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025605
25606 ret_val = xmlValidateOneElement(ctxt, doc, elem);
25607 desret_int(ret_val);
25608 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025609 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25610 des_xmlDocPtr(n_doc, doc, 1);
25611 des_xmlNodePtr(n_elem, elem, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025612 xmlResetLastError();
25613 if (mem_base != xmlMemBlocks()) {
25614 printf("Leak of %d blocks found in xmlValidateOneElement",
25615 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025616 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025617 printf(" %d", n_ctxt);
25618 printf(" %d", n_doc);
25619 printf(" %d", n_elem);
25620 printf("\n");
25621 }
25622 }
25623 }
25624 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025625 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025626#endif
25627
Daniel Veillard42595322004-11-08 10:52:06 +000025628 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025629}
25630
25631
25632static int
25633test_xmlValidateOneNamespace(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025634 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025635
William M. Brack21e4ef22005-01-02 09:53:13 +000025636#if defined(LIBXML_VALID_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000025637 int mem_base;
25638 int ret_val;
25639 xmlValidCtxtPtr ctxt; /* the validation context */
25640 int n_ctxt;
25641 xmlDocPtr doc; /* a document instance */
25642 int n_doc;
25643 xmlNodePtr elem; /* an element instance */
25644 int n_elem;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025645 xmlChar * prefix; /* the namespace prefix */
Daniel Veillard27f20102004-11-05 11:50:11 +000025646 int n_prefix;
25647 xmlNsPtr ns; /* an namespace declaration instance */
25648 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025649 xmlChar * value; /* the attribute value (without entities processing) */
Daniel Veillard27f20102004-11-05 11:50:11 +000025650 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025651
Daniel Veillard27f20102004-11-05 11:50:11 +000025652 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25653 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25654 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
25655 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
25656 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
25657 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25658 mem_base = xmlMemBlocks();
25659 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25660 doc = gen_xmlDocPtr(n_doc, 1);
25661 elem = gen_xmlNodePtr(n_elem, 2);
25662 prefix = gen_const_xmlChar_ptr(n_prefix, 3);
25663 ns = gen_xmlNsPtr(n_ns, 4);
25664 value = gen_const_xmlChar_ptr(n_value, 5);
25665
William M. Brackf13f77f2004-11-12 16:03:48 +000025666 ret_val = xmlValidateOneNamespace(ctxt, doc, elem, (const xmlChar *)prefix, ns, (const xmlChar *)value);
Daniel Veillard27f20102004-11-05 11:50:11 +000025667 desret_int(ret_val);
25668 call_tests++;
25669 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25670 des_xmlDocPtr(n_doc, doc, 1);
25671 des_xmlNodePtr(n_elem, elem, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000025672 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 3);
Daniel Veillard27f20102004-11-05 11:50:11 +000025673 des_xmlNsPtr(n_ns, ns, 4);
William M. Brackf13f77f2004-11-12 16:03:48 +000025674 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 5);
Daniel Veillard27f20102004-11-05 11:50:11 +000025675 xmlResetLastError();
25676 if (mem_base != xmlMemBlocks()) {
25677 printf("Leak of %d blocks found in xmlValidateOneNamespace",
25678 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025679 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000025680 printf(" %d", n_ctxt);
25681 printf(" %d", n_doc);
25682 printf(" %d", n_elem);
25683 printf(" %d", n_prefix);
25684 printf(" %d", n_ns);
25685 printf(" %d", n_value);
25686 printf("\n");
25687 }
25688 }
25689 }
25690 }
25691 }
25692 }
25693 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025694 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000025695#endif
25696
Daniel Veillard42595322004-11-08 10:52:06 +000025697 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025698}
25699
25700
25701static int
25702test_xmlValidatePopElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025703 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025704
William M. Brack21e4ef22005-01-02 09:53:13 +000025705#if defined(LIBXML_VALID_ENABLED) && defined(LIBXML_REGEXP_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025706 int mem_base;
25707 int ret_val;
25708 xmlValidCtxtPtr ctxt; /* the validation context */
25709 int n_ctxt;
25710 xmlDocPtr doc; /* a document instance */
25711 int n_doc;
25712 xmlNodePtr elem; /* an element instance */
25713 int n_elem;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025714 xmlChar * qname; /* the qualified name as appearing in the serialization */
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025715 int n_qname;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025716
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025717 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25718 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25719 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
25720 for (n_qname = 0;n_qname < gen_nb_const_xmlChar_ptr;n_qname++) {
25721 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025722 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25723 doc = gen_xmlDocPtr(n_doc, 1);
25724 elem = gen_xmlNodePtr(n_elem, 2);
25725 qname = gen_const_xmlChar_ptr(n_qname, 3);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025726
William M. Brackf13f77f2004-11-12 16:03:48 +000025727 ret_val = xmlValidatePopElement(ctxt, doc, elem, (const xmlChar *)qname);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025728 desret_int(ret_val);
25729 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025730 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25731 des_xmlDocPtr(n_doc, doc, 1);
25732 des_xmlNodePtr(n_elem, elem, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000025733 des_const_xmlChar_ptr(n_qname, (const xmlChar *)qname, 3);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025734 xmlResetLastError();
25735 if (mem_base != xmlMemBlocks()) {
25736 printf("Leak of %d blocks found in xmlValidatePopElement",
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(" %d", n_elem);
25742 printf(" %d", n_qname);
25743 printf("\n");
25744 }
25745 }
25746 }
25747 }
25748 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025749 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025750#endif
25751
Daniel Veillard42595322004-11-08 10:52:06 +000025752 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025753}
25754
25755
25756static int
25757test_xmlValidatePushCData(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025758 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025759
William M. Brack21e4ef22005-01-02 09:53:13 +000025760#if defined(LIBXML_VALID_ENABLED) && defined(LIBXML_REGEXP_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025761 int mem_base;
25762 int ret_val;
25763 xmlValidCtxtPtr ctxt; /* the validation context */
25764 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025765 xmlChar * data; /* some character data read */
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025766 int n_data;
25767 int len; /* the lenght of the data */
25768 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025769
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025770 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25771 for (n_data = 0;n_data < gen_nb_const_xmlChar_ptr;n_data++) {
25772 for (n_len = 0;n_len < gen_nb_int;n_len++) {
25773 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025774 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25775 data = gen_const_xmlChar_ptr(n_data, 1);
25776 len = gen_int(n_len, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025777
William M. Brackf13f77f2004-11-12 16:03:48 +000025778 ret_val = xmlValidatePushCData(ctxt, (const xmlChar *)data, len);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025779 desret_int(ret_val);
25780 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025781 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000025782 des_const_xmlChar_ptr(n_data, (const xmlChar *)data, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000025783 des_int(n_len, len, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025784 xmlResetLastError();
25785 if (mem_base != xmlMemBlocks()) {
25786 printf("Leak of %d blocks found in xmlValidatePushCData",
25787 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025788 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025789 printf(" %d", n_ctxt);
25790 printf(" %d", n_data);
25791 printf(" %d", n_len);
25792 printf("\n");
25793 }
25794 }
25795 }
25796 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025797 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025798#endif
25799
Daniel Veillard42595322004-11-08 10:52:06 +000025800 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025801}
25802
25803
25804static int
25805test_xmlValidatePushElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025806 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025807
William M. Brack21e4ef22005-01-02 09:53:13 +000025808#if defined(LIBXML_VALID_ENABLED) && defined(LIBXML_REGEXP_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025809 int mem_base;
25810 int ret_val;
25811 xmlValidCtxtPtr ctxt; /* the validation context */
25812 int n_ctxt;
25813 xmlDocPtr doc; /* a document instance */
25814 int n_doc;
25815 xmlNodePtr elem; /* an element instance */
25816 int n_elem;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025817 xmlChar * qname; /* the qualified name as appearing in the serialization */
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025818 int n_qname;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025819
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025820 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25821 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25822 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
25823 for (n_qname = 0;n_qname < gen_nb_const_xmlChar_ptr;n_qname++) {
25824 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025825 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25826 doc = gen_xmlDocPtr(n_doc, 1);
25827 elem = gen_xmlNodePtr(n_elem, 2);
25828 qname = gen_const_xmlChar_ptr(n_qname, 3);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025829
William M. Brackf13f77f2004-11-12 16:03:48 +000025830 ret_val = xmlValidatePushElement(ctxt, doc, elem, (const xmlChar *)qname);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025831 desret_int(ret_val);
25832 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025833 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25834 des_xmlDocPtr(n_doc, doc, 1);
25835 des_xmlNodePtr(n_elem, elem, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000025836 des_const_xmlChar_ptr(n_qname, (const xmlChar *)qname, 3);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025837 xmlResetLastError();
25838 if (mem_base != xmlMemBlocks()) {
25839 printf("Leak of %d blocks found in xmlValidatePushElement",
25840 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025841 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025842 printf(" %d", n_ctxt);
25843 printf(" %d", n_doc);
25844 printf(" %d", n_elem);
25845 printf(" %d", n_qname);
25846 printf("\n");
25847 }
25848 }
25849 }
25850 }
25851 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025852 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025853#endif
25854
Daniel Veillard42595322004-11-08 10:52:06 +000025855 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025856}
25857
25858
25859static int
25860test_xmlValidateRoot(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025861 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025862
William M. Brack21e4ef22005-01-02 09:53:13 +000025863#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025864 int mem_base;
25865 int ret_val;
25866 xmlValidCtxtPtr ctxt; /* the validation context */
25867 int n_ctxt;
25868 xmlDocPtr doc; /* a document instance */
25869 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025870
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025871 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25872 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25873 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025874 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25875 doc = gen_xmlDocPtr(n_doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025876
25877 ret_val = xmlValidateRoot(ctxt, doc);
25878 desret_int(ret_val);
25879 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025880 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25881 des_xmlDocPtr(n_doc, doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025882 xmlResetLastError();
25883 if (mem_base != xmlMemBlocks()) {
25884 printf("Leak of %d blocks found in xmlValidateRoot",
25885 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025886 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025887 printf(" %d", n_ctxt);
25888 printf(" %d", n_doc);
25889 printf("\n");
25890 }
25891 }
25892 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025893 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025894#endif
25895
Daniel Veillard42595322004-11-08 10:52:06 +000025896 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025897}
25898
25899static int
25900test_valid(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025901 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025902
Daniel Veillard2ae13382005-01-25 23:45:06 +000025903 if (quiet == 0) printf("Testing valid : 50 of 70 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000025904 test_ret += test_xmlAddAttributeDecl();
25905 test_ret += test_xmlAddElementDecl();
25906 test_ret += test_xmlAddID();
25907 test_ret += test_xmlAddNotationDecl();
25908 test_ret += test_xmlAddRef();
25909 test_ret += test_xmlCopyAttributeTable();
Daniel Veillard2ae13382005-01-25 23:45:06 +000025910 test_ret += test_xmlCopyDocElementContent();
Daniel Veillard42595322004-11-08 10:52:06 +000025911 test_ret += test_xmlCopyElementContent();
25912 test_ret += test_xmlCopyElementTable();
25913 test_ret += test_xmlCopyEnumeration();
25914 test_ret += test_xmlCopyNotationTable();
25915 test_ret += test_xmlCreateEnumeration();
25916 test_ret += test_xmlDumpAttributeDecl();
25917 test_ret += test_xmlDumpAttributeTable();
25918 test_ret += test_xmlDumpElementDecl();
25919 test_ret += test_xmlDumpElementTable();
25920 test_ret += test_xmlDumpNotationDecl();
25921 test_ret += test_xmlDumpNotationTable();
25922 test_ret += test_xmlGetDtdAttrDesc();
25923 test_ret += test_xmlGetDtdElementDesc();
25924 test_ret += test_xmlGetDtdNotationDesc();
25925 test_ret += test_xmlGetDtdQAttrDesc();
25926 test_ret += test_xmlGetDtdQElementDesc();
25927 test_ret += test_xmlGetID();
25928 test_ret += test_xmlGetRefs();
25929 test_ret += test_xmlIsID();
25930 test_ret += test_xmlIsMixedElement();
25931 test_ret += test_xmlIsRef();
Daniel Veillard2ae13382005-01-25 23:45:06 +000025932 test_ret += test_xmlNewDocElementContent();
Daniel Veillard42595322004-11-08 10:52:06 +000025933 test_ret += test_xmlNewElementContent();
25934 test_ret += test_xmlNewValidCtxt();
25935 test_ret += test_xmlRemoveID();
25936 test_ret += test_xmlRemoveRef();
25937 test_ret += test_xmlSnprintfElementContent();
25938 test_ret += test_xmlSprintfElementContent();
25939 test_ret += test_xmlValidBuildContentModel();
25940 test_ret += test_xmlValidCtxtNormalizeAttributeValue();
25941 test_ret += test_xmlValidGetPotentialChildren();
25942 test_ret += test_xmlValidGetValidElements();
25943 test_ret += test_xmlValidNormalizeAttributeValue();
25944 test_ret += test_xmlValidateAttributeDecl();
25945 test_ret += test_xmlValidateAttributeValue();
25946 test_ret += test_xmlValidateDocument();
25947 test_ret += test_xmlValidateDocumentFinal();
25948 test_ret += test_xmlValidateDtd();
25949 test_ret += test_xmlValidateDtdFinal();
25950 test_ret += test_xmlValidateElement();
25951 test_ret += test_xmlValidateElementDecl();
25952 test_ret += test_xmlValidateNameValue();
25953 test_ret += test_xmlValidateNamesValue();
25954 test_ret += test_xmlValidateNmtokenValue();
25955 test_ret += test_xmlValidateNmtokensValue();
25956 test_ret += test_xmlValidateNotationDecl();
25957 test_ret += test_xmlValidateNotationUse();
25958 test_ret += test_xmlValidateOneAttribute();
25959 test_ret += test_xmlValidateOneElement();
25960 test_ret += test_xmlValidateOneNamespace();
25961 test_ret += test_xmlValidatePopElement();
25962 test_ret += test_xmlValidatePushCData();
25963 test_ret += test_xmlValidatePushElement();
25964 test_ret += test_xmlValidateRoot();
Daniel Veillardd93f6252004-11-02 15:53:51 +000025965
Daniel Veillard42595322004-11-08 10:52:06 +000025966 if (test_ret != 0)
25967 printf("Module valid: %d errors\n", test_ret);
25968 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025969}
25970
25971static int
25972test_xmlXIncludeNewContext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025973 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025974
25975
25976 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000025977 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025978}
25979
25980
25981static int
25982test_xmlXIncludeProcess(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025983 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025984
William M. Brack21e4ef22005-01-02 09:53:13 +000025985#if defined(LIBXML_XINCLUDE_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000025986 int mem_base;
25987 int ret_val;
25988 xmlDocPtr doc; /* an XML document */
25989 int n_doc;
25990
25991 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25992 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025993 doc = gen_xmlDocPtr(n_doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025994
25995 ret_val = xmlXIncludeProcess(doc);
25996 desret_int(ret_val);
25997 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025998 des_xmlDocPtr(n_doc, doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025999 xmlResetLastError();
26000 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026001 printf("Leak of %d blocks found in xmlXIncludeProcess",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026002 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026003 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026004 printf(" %d", n_doc);
26005 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026006 }
26007 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026008 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026009#endif
26010
Daniel Veillard42595322004-11-08 10:52:06 +000026011 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026012}
26013
26014
26015static int
26016test_xmlXIncludeProcessFlags(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026017 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026018
William M. Brack21e4ef22005-01-02 09:53:13 +000026019#if defined(LIBXML_XINCLUDE_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000026020 int mem_base;
26021 int ret_val;
26022 xmlDocPtr doc; /* an XML document */
26023 int n_doc;
26024 int flags; /* a set of xmlParserOption used for parsing XML includes */
26025 int n_flags;
26026
26027 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
26028 for (n_flags = 0;n_flags < gen_nb_int;n_flags++) {
26029 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026030 doc = gen_xmlDocPtr(n_doc, 0);
26031 flags = gen_int(n_flags, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026032
26033 ret_val = xmlXIncludeProcessFlags(doc, flags);
26034 desret_int(ret_val);
26035 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026036 des_xmlDocPtr(n_doc, doc, 0);
26037 des_int(n_flags, flags, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026038 xmlResetLastError();
26039 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026040 printf("Leak of %d blocks found in xmlXIncludeProcessFlags",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026041 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026042 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026043 printf(" %d", n_doc);
26044 printf(" %d", n_flags);
26045 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026046 }
26047 }
26048 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026049 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026050#endif
26051
Daniel Veillard42595322004-11-08 10:52:06 +000026052 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026053}
26054
Daniel Veillarda521d282004-11-09 14:59:59 +000026055#ifdef LIBXML_XINCLUDE_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000026056
Daniel Veillardce682bc2004-11-05 17:22:25 +000026057#define gen_nb_xmlXIncludeCtxtPtr 1
26058static xmlXIncludeCtxtPtr gen_xmlXIncludeCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
26059 return(NULL);
26060}
26061static void des_xmlXIncludeCtxtPtr(int no ATTRIBUTE_UNUSED, xmlXIncludeCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
26062}
Daniel Veillarda521d282004-11-09 14:59:59 +000026063#endif
26064
Daniel Veillardce682bc2004-11-05 17:22:25 +000026065
Daniel Veillardd93f6252004-11-02 15:53:51 +000026066static int
26067test_xmlXIncludeProcessNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026068 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026069
William M. Brack21e4ef22005-01-02 09:53:13 +000026070#if defined(LIBXML_XINCLUDE_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000026071 int mem_base;
26072 int ret_val;
26073 xmlXIncludeCtxtPtr ctxt; /* an existing XInclude context */
26074 int n_ctxt;
26075 xmlNodePtr node; /* a node in an XML document */
26076 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026077
Daniel Veillardce682bc2004-11-05 17:22:25 +000026078 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXIncludeCtxtPtr;n_ctxt++) {
26079 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
26080 mem_base = xmlMemBlocks();
26081 ctxt = gen_xmlXIncludeCtxtPtr(n_ctxt, 0);
26082 node = gen_xmlNodePtr(n_node, 1);
26083
26084 ret_val = xmlXIncludeProcessNode(ctxt, node);
26085 desret_int(ret_val);
26086 call_tests++;
26087 des_xmlXIncludeCtxtPtr(n_ctxt, ctxt, 0);
26088 des_xmlNodePtr(n_node, node, 1);
26089 xmlResetLastError();
26090 if (mem_base != xmlMemBlocks()) {
26091 printf("Leak of %d blocks found in xmlXIncludeProcessNode",
26092 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026093 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026094 printf(" %d", n_ctxt);
26095 printf(" %d", n_node);
26096 printf("\n");
26097 }
26098 }
26099 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026100 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026101#endif
26102
Daniel Veillard42595322004-11-08 10:52:06 +000026103 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026104}
26105
26106
26107static int
26108test_xmlXIncludeProcessTree(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026109 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026110
William M. Brack21e4ef22005-01-02 09:53:13 +000026111#if defined(LIBXML_XINCLUDE_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000026112 int mem_base;
26113 int ret_val;
26114 xmlNodePtr tree; /* a node in an XML document */
26115 int n_tree;
26116
26117 for (n_tree = 0;n_tree < gen_nb_xmlNodePtr;n_tree++) {
26118 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026119 tree = gen_xmlNodePtr(n_tree, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026120
26121 ret_val = xmlXIncludeProcessTree(tree);
26122 desret_int(ret_val);
26123 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026124 des_xmlNodePtr(n_tree, tree, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026125 xmlResetLastError();
26126 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026127 printf("Leak of %d blocks found in xmlXIncludeProcessTree",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026128 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026129 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026130 printf(" %d", n_tree);
26131 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026132 }
26133 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026134 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026135#endif
26136
Daniel Veillard42595322004-11-08 10:52:06 +000026137 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026138}
26139
26140
26141static int
26142test_xmlXIncludeProcessTreeFlags(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026143 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026144
William M. Brack21e4ef22005-01-02 09:53:13 +000026145#if defined(LIBXML_XINCLUDE_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000026146 int mem_base;
26147 int ret_val;
26148 xmlNodePtr tree; /* a node in an XML document */
26149 int n_tree;
26150 int flags; /* a set of xmlParserOption used for parsing XML includes */
26151 int n_flags;
26152
26153 for (n_tree = 0;n_tree < gen_nb_xmlNodePtr;n_tree++) {
26154 for (n_flags = 0;n_flags < gen_nb_int;n_flags++) {
26155 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026156 tree = gen_xmlNodePtr(n_tree, 0);
26157 flags = gen_int(n_flags, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026158
26159 ret_val = xmlXIncludeProcessTreeFlags(tree, flags);
26160 desret_int(ret_val);
26161 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026162 des_xmlNodePtr(n_tree, tree, 0);
26163 des_int(n_flags, flags, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026164 xmlResetLastError();
26165 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026166 printf("Leak of %d blocks found in xmlXIncludeProcessTreeFlags",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026167 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026168 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026169 printf(" %d", n_tree);
26170 printf(" %d", n_flags);
26171 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026172 }
26173 }
26174 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026175 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026176#endif
26177
Daniel Veillard42595322004-11-08 10:52:06 +000026178 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026179}
26180
26181
26182static int
26183test_xmlXIncludeSetFlags(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026184 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026185
William M. Brack21e4ef22005-01-02 09:53:13 +000026186#if defined(LIBXML_XINCLUDE_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000026187 int mem_base;
26188 int ret_val;
26189 xmlXIncludeCtxtPtr ctxt; /* an XInclude processing context */
26190 int n_ctxt;
26191 int flags; /* a set of xmlParserOption used for parsing XML includes */
26192 int n_flags;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026193
Daniel Veillardce682bc2004-11-05 17:22:25 +000026194 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXIncludeCtxtPtr;n_ctxt++) {
26195 for (n_flags = 0;n_flags < gen_nb_int;n_flags++) {
26196 mem_base = xmlMemBlocks();
26197 ctxt = gen_xmlXIncludeCtxtPtr(n_ctxt, 0);
26198 flags = gen_int(n_flags, 1);
26199
26200 ret_val = xmlXIncludeSetFlags(ctxt, flags);
26201 desret_int(ret_val);
26202 call_tests++;
26203 des_xmlXIncludeCtxtPtr(n_ctxt, ctxt, 0);
26204 des_int(n_flags, flags, 1);
26205 xmlResetLastError();
26206 if (mem_base != xmlMemBlocks()) {
26207 printf("Leak of %d blocks found in xmlXIncludeSetFlags",
26208 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026209 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026210 printf(" %d", n_ctxt);
26211 printf(" %d", n_flags);
26212 printf("\n");
26213 }
26214 }
26215 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026216 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026217#endif
26218
Daniel Veillard42595322004-11-08 10:52:06 +000026219 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026220}
26221
26222static int
26223test_xinclude(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026224 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026225
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026226 if (quiet == 0) printf("Testing xinclude : 6 of 8 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000026227 test_ret += test_xmlXIncludeNewContext();
26228 test_ret += test_xmlXIncludeProcess();
26229 test_ret += test_xmlXIncludeProcessFlags();
26230 test_ret += test_xmlXIncludeProcessNode();
26231 test_ret += test_xmlXIncludeProcessTree();
26232 test_ret += test_xmlXIncludeProcessTreeFlags();
26233 test_ret += test_xmlXIncludeSetFlags();
Daniel Veillardd93f6252004-11-02 15:53:51 +000026234
Daniel Veillard42595322004-11-08 10:52:06 +000026235 if (test_ret != 0)
26236 printf("Module xinclude: %d errors\n", test_ret);
26237 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026238}
26239
26240static int
26241test_xmlAllocOutputBuffer(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026242 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026243
William M. Brack21e4ef22005-01-02 09:53:13 +000026244#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d95c732004-11-06 22:25:14 +000026245 int mem_base;
26246 xmlOutputBufferPtr ret_val;
26247 xmlCharEncodingHandlerPtr encoder; /* the encoding converter or NULL */
26248 int n_encoder;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026249
Daniel Veillard3d95c732004-11-06 22:25:14 +000026250 for (n_encoder = 0;n_encoder < gen_nb_xmlCharEncodingHandlerPtr;n_encoder++) {
26251 mem_base = xmlMemBlocks();
26252 encoder = gen_xmlCharEncodingHandlerPtr(n_encoder, 0);
26253
26254 ret_val = xmlAllocOutputBuffer(encoder);
26255 desret_xmlOutputBufferPtr(ret_val);
26256 call_tests++;
26257 des_xmlCharEncodingHandlerPtr(n_encoder, encoder, 0);
26258 xmlResetLastError();
26259 if (mem_base != xmlMemBlocks()) {
26260 printf("Leak of %d blocks found in xmlAllocOutputBuffer",
26261 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026262 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000026263 printf(" %d", n_encoder);
26264 printf("\n");
26265 }
26266 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026267 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000026268#endif
26269
Daniel Veillard42595322004-11-08 10:52:06 +000026270 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026271}
26272
26273
26274static int
26275test_xmlAllocParserInputBuffer(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026276 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026277
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000026278 int mem_base;
26279 xmlParserInputBufferPtr ret_val;
26280 xmlCharEncoding enc; /* the charset encoding if known */
26281 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026282
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000026283 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
26284 mem_base = xmlMemBlocks();
26285 enc = gen_xmlCharEncoding(n_enc, 0);
26286
26287 ret_val = xmlAllocParserInputBuffer(enc);
26288 desret_xmlParserInputBufferPtr(ret_val);
26289 call_tests++;
26290 des_xmlCharEncoding(n_enc, enc, 0);
26291 xmlResetLastError();
26292 if (mem_base != xmlMemBlocks()) {
26293 printf("Leak of %d blocks found in xmlAllocParserInputBuffer",
26294 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026295 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000026296 printf(" %d", n_enc);
26297 printf("\n");
26298 }
26299 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000026300 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026301
Daniel Veillard42595322004-11-08 10:52:06 +000026302 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026303}
26304
26305
26306static int
26307test_xmlCheckFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026308 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026309
26310 int mem_base;
26311 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026312 char * path; /* the path to check */
Daniel Veillardd93f6252004-11-02 15:53:51 +000026313 int n_path;
26314
26315 for (n_path = 0;n_path < gen_nb_const_char_ptr;n_path++) {
26316 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026317 path = gen_const_char_ptr(n_path, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026318
William M. Brackf13f77f2004-11-12 16:03:48 +000026319 ret_val = xmlCheckFilename((const char *)path);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026320 desret_int(ret_val);
26321 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000026322 des_const_char_ptr(n_path, (const char *)path, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026323 xmlResetLastError();
26324 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026325 printf("Leak of %d blocks found in xmlCheckFilename",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026326 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026327 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026328 printf(" %d", n_path);
26329 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026330 }
26331 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000026332 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026333
Daniel Veillard42595322004-11-08 10:52:06 +000026334 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026335}
26336
26337
26338static int
26339test_xmlCheckHTTPInput(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026340 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026341
Daniel Veillard42595322004-11-08 10:52:06 +000026342 int mem_base;
26343 xmlParserInputPtr ret_val;
26344 xmlParserCtxtPtr ctxt; /* an XML parser context */
26345 int n_ctxt;
26346 xmlParserInputPtr ret; /* an XML parser input */
26347 int n_ret;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026348
Daniel Veillard42595322004-11-08 10:52:06 +000026349 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
26350 for (n_ret = 0;n_ret < gen_nb_xmlParserInputPtr;n_ret++) {
26351 mem_base = xmlMemBlocks();
26352 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
26353 ret = gen_xmlParserInputPtr(n_ret, 1);
26354
26355 ret_val = xmlCheckHTTPInput(ctxt, ret);
26356 desret_xmlParserInputPtr(ret_val);
26357 call_tests++;
26358 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
26359 des_xmlParserInputPtr(n_ret, ret, 1);
26360 xmlResetLastError();
26361 if (mem_base != xmlMemBlocks()) {
26362 printf("Leak of %d blocks found in xmlCheckHTTPInput",
26363 xmlMemBlocks() - mem_base);
26364 test_ret++;
26365 printf(" %d", n_ctxt);
26366 printf(" %d", n_ret);
26367 printf("\n");
26368 }
26369 }
26370 }
Daniel Veillard42595322004-11-08 10:52:06 +000026371 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026372
Daniel Veillard42595322004-11-08 10:52:06 +000026373 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026374}
26375
26376
26377static int
26378test_xmlCleanupInputCallbacks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026379 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026380
26381 int mem_base;
26382
26383 mem_base = xmlMemBlocks();
26384
26385 xmlCleanupInputCallbacks();
26386 call_tests++;
26387 xmlResetLastError();
26388 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026389 printf("Leak of %d blocks found in xmlCleanupInputCallbacks",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026390 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026391 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026392 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026393 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000026394 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026395
Daniel Veillard42595322004-11-08 10:52:06 +000026396 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026397}
26398
26399
26400static int
26401test_xmlCleanupOutputCallbacks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026402 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026403
William M. Brack21e4ef22005-01-02 09:53:13 +000026404#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000026405 int mem_base;
26406
26407 mem_base = xmlMemBlocks();
26408
26409 xmlCleanupOutputCallbacks();
26410 call_tests++;
26411 xmlResetLastError();
26412 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026413 printf("Leak of %d blocks found in xmlCleanupOutputCallbacks",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026414 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026415 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026416 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026417 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026418 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026419#endif
26420
Daniel Veillard42595322004-11-08 10:52:06 +000026421 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026422}
26423
26424
26425static int
26426test_xmlFileClose(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026427 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026428
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026429 int mem_base;
26430 int ret_val;
26431 void * context; /* the I/O context */
26432 int n_context;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026433
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026434 for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
26435 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026436 context = gen_void_ptr(n_context, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026437
26438 ret_val = xmlFileClose(context);
26439 desret_int(ret_val);
26440 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026441 des_void_ptr(n_context, context, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026442 xmlResetLastError();
26443 if (mem_base != xmlMemBlocks()) {
26444 printf("Leak of %d blocks found in xmlFileClose",
26445 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026446 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026447 printf(" %d", n_context);
26448 printf("\n");
26449 }
26450 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000026451 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026452
Daniel Veillard42595322004-11-08 10:52:06 +000026453 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026454}
26455
26456
26457static int
26458test_xmlFileMatch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026459 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026460
26461 int mem_base;
26462 int ret_val;
26463 const char * filename; /* the URI for matching */
26464 int n_filename;
26465
26466 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
26467 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026468 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026469
26470 ret_val = xmlFileMatch(filename);
26471 desret_int(ret_val);
26472 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026473 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026474 xmlResetLastError();
26475 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026476 printf("Leak of %d blocks found in xmlFileMatch",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026477 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026478 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026479 printf(" %d", n_filename);
26480 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026481 }
26482 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000026483 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026484
Daniel Veillard42595322004-11-08 10:52:06 +000026485 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026486}
26487
26488
26489static int
26490test_xmlFileOpen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026491 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026492
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026493 int mem_base;
26494 void * ret_val;
26495 const char * filename; /* the URI for matching */
26496 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026497
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026498 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
26499 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026500 filename = gen_filepath(n_filename, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026501
26502 ret_val = xmlFileOpen(filename);
26503 desret_void_ptr(ret_val);
26504 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026505 des_filepath(n_filename, filename, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026506 xmlResetLastError();
26507 if (mem_base != xmlMemBlocks()) {
26508 printf("Leak of %d blocks found in xmlFileOpen",
26509 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026510 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026511 printf(" %d", n_filename);
26512 printf("\n");
26513 }
26514 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000026515 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026516
Daniel Veillard42595322004-11-08 10:52:06 +000026517 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026518}
26519
26520
26521static int
26522test_xmlFileRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026523 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026524
Daniel Veillardce682bc2004-11-05 17:22:25 +000026525 int mem_base;
26526 int ret_val;
26527 void * context; /* the I/O context */
26528 int n_context;
26529 char * buffer; /* where to drop data */
26530 int n_buffer;
26531 int len; /* number of bytes to write */
26532 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026533
Daniel Veillardce682bc2004-11-05 17:22:25 +000026534 for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
26535 for (n_buffer = 0;n_buffer < gen_nb_char_ptr;n_buffer++) {
26536 for (n_len = 0;n_len < gen_nb_int;n_len++) {
26537 mem_base = xmlMemBlocks();
26538 context = gen_void_ptr(n_context, 0);
26539 buffer = gen_char_ptr(n_buffer, 1);
26540 len = gen_int(n_len, 2);
26541
26542 ret_val = xmlFileRead(context, buffer, len);
26543 desret_int(ret_val);
26544 call_tests++;
26545 des_void_ptr(n_context, context, 0);
26546 des_char_ptr(n_buffer, buffer, 1);
26547 des_int(n_len, len, 2);
26548 xmlResetLastError();
26549 if (mem_base != xmlMemBlocks()) {
26550 printf("Leak of %d blocks found in xmlFileRead",
26551 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026552 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026553 printf(" %d", n_context);
26554 printf(" %d", n_buffer);
26555 printf(" %d", n_len);
26556 printf("\n");
26557 }
26558 }
26559 }
26560 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000026561 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026562
Daniel Veillard42595322004-11-08 10:52:06 +000026563 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026564}
26565
26566
26567static int
26568test_xmlIOFTPClose(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026569 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026570
William M. Brack21e4ef22005-01-02 09:53:13 +000026571#if defined(LIBXML_FTP_ENABLED)
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026572 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 = xmlIOFTPClose(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 xmlIOFTPClose",
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_xmlIOFTPMatch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026603 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026604
William M. Brack21e4ef22005-01-02 09:53:13 +000026605#if defined(LIBXML_FTP_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000026606 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 = xmlIOFTPMatch(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 xmlIOFTPMatch",
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_xmlIOFTPOpen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026637 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026638
William M. Brack21e4ef22005-01-02 09:53:13 +000026639#if defined(LIBXML_FTP_ENABLED)
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026640 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 = xmlIOFTPOpen(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 xmlIOFTPOpen",
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_xmlIOFTPRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026671 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026672
William M. Brack21e4ef22005-01-02 09:53:13 +000026673#if defined(LIBXML_FTP_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000026674 int mem_base;
26675 int ret_val;
26676 void * context; /* the I/O context */
26677 int n_context;
26678 char * buffer; /* where to drop data */
26679 int n_buffer;
26680 int len; /* number of bytes to write */
26681 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026682
Daniel Veillardce682bc2004-11-05 17:22:25 +000026683 for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
26684 for (n_buffer = 0;n_buffer < gen_nb_char_ptr;n_buffer++) {
26685 for (n_len = 0;n_len < gen_nb_int;n_len++) {
26686 mem_base = xmlMemBlocks();
26687 context = gen_void_ptr(n_context, 0);
26688 buffer = gen_char_ptr(n_buffer, 1);
26689 len = gen_int(n_len, 2);
26690
26691 ret_val = xmlIOFTPRead(context, buffer, len);
26692 desret_int(ret_val);
26693 call_tests++;
26694 des_void_ptr(n_context, context, 0);
26695 des_char_ptr(n_buffer, buffer, 1);
26696 des_int(n_len, len, 2);
26697 xmlResetLastError();
26698 if (mem_base != xmlMemBlocks()) {
26699 printf("Leak of %d blocks found in xmlIOFTPRead",
26700 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026701 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026702 printf(" %d", n_context);
26703 printf(" %d", n_buffer);
26704 printf(" %d", n_len);
26705 printf("\n");
26706 }
26707 }
26708 }
26709 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026710 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026711#endif
26712
Daniel Veillard42595322004-11-08 10:52:06 +000026713 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026714}
26715
26716
26717static int
26718test_xmlIOHTTPClose(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026719 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026720
William M. Brack21e4ef22005-01-02 09:53:13 +000026721#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026722 int mem_base;
26723 int ret_val;
26724 void * context; /* the I/O context */
26725 int n_context;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026726
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026727 for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
26728 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026729 context = gen_void_ptr(n_context, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026730
26731 ret_val = xmlIOHTTPClose(context);
26732 desret_int(ret_val);
26733 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026734 des_void_ptr(n_context, context, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026735 xmlResetLastError();
26736 if (mem_base != xmlMemBlocks()) {
26737 printf("Leak of %d blocks found in xmlIOHTTPClose",
26738 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026739 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026740 printf(" %d", n_context);
26741 printf("\n");
26742 }
26743 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026744 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026745#endif
26746
Daniel Veillard42595322004-11-08 10:52:06 +000026747 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026748}
26749
26750
26751static int
26752test_xmlIOHTTPMatch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026753 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026754
William M. Brack21e4ef22005-01-02 09:53:13 +000026755#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000026756 int mem_base;
26757 int ret_val;
26758 const char * filename; /* the URI for matching */
26759 int n_filename;
26760
26761 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
26762 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026763 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026764
26765 ret_val = xmlIOHTTPMatch(filename);
26766 desret_int(ret_val);
26767 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026768 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026769 xmlResetLastError();
26770 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026771 printf("Leak of %d blocks found in xmlIOHTTPMatch",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026772 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026773 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026774 printf(" %d", n_filename);
26775 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026776 }
26777 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026778 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026779#endif
26780
Daniel Veillard42595322004-11-08 10:52:06 +000026781 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026782}
26783
26784
26785static int
26786test_xmlIOHTTPOpen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026787 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026788
William M. Brack21e4ef22005-01-02 09:53:13 +000026789#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026790 int mem_base;
26791 void * ret_val;
26792 const char * filename; /* the URI for matching */
26793 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026794
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026795 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
26796 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026797 filename = gen_filepath(n_filename, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026798
26799 ret_val = xmlIOHTTPOpen(filename);
26800 desret_void_ptr(ret_val);
26801 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026802 des_filepath(n_filename, filename, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026803 xmlResetLastError();
26804 if (mem_base != xmlMemBlocks()) {
26805 printf("Leak of %d blocks found in xmlIOHTTPOpen",
26806 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026807 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026808 printf(" %d", n_filename);
26809 printf("\n");
26810 }
26811 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026812 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026813#endif
26814
Daniel Veillard42595322004-11-08 10:52:06 +000026815 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026816}
26817
26818
26819static int
26820test_xmlIOHTTPOpenW(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026821 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026822
26823
26824 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000026825 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026826}
26827
26828
26829static int
26830test_xmlIOHTTPRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026831 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026832
William M. Brack21e4ef22005-01-02 09:53:13 +000026833#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000026834 int mem_base;
26835 int ret_val;
26836 void * context; /* the I/O context */
26837 int n_context;
26838 char * buffer; /* where to drop data */
26839 int n_buffer;
26840 int len; /* number of bytes to write */
26841 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026842
Daniel Veillardce682bc2004-11-05 17:22:25 +000026843 for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
26844 for (n_buffer = 0;n_buffer < gen_nb_char_ptr;n_buffer++) {
26845 for (n_len = 0;n_len < gen_nb_int;n_len++) {
26846 mem_base = xmlMemBlocks();
26847 context = gen_void_ptr(n_context, 0);
26848 buffer = gen_char_ptr(n_buffer, 1);
26849 len = gen_int(n_len, 2);
26850
26851 ret_val = xmlIOHTTPRead(context, buffer, len);
26852 desret_int(ret_val);
26853 call_tests++;
26854 des_void_ptr(n_context, context, 0);
26855 des_char_ptr(n_buffer, buffer, 1);
26856 des_int(n_len, len, 2);
26857 xmlResetLastError();
26858 if (mem_base != xmlMemBlocks()) {
26859 printf("Leak of %d blocks found in xmlIOHTTPRead",
26860 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026861 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026862 printf(" %d", n_context);
26863 printf(" %d", n_buffer);
26864 printf(" %d", n_len);
26865 printf("\n");
26866 }
26867 }
26868 }
26869 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026870 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026871#endif
26872
Daniel Veillard42595322004-11-08 10:52:06 +000026873 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026874}
26875
26876
26877static int
26878test_xmlNoNetExternalEntityLoader(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026879 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026880
Daniel Veillard42595322004-11-08 10:52:06 +000026881 int mem_base;
26882 xmlParserInputPtr ret_val;
26883 const char * URL; /* the URL for the entity to load */
26884 int n_URL;
26885 char * ID; /* the System ID for the entity to load */
26886 int n_ID;
26887 xmlParserCtxtPtr ctxt; /* the context in which the entity is called or NULL */
26888 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026889
Daniel Veillard42595322004-11-08 10:52:06 +000026890 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
26891 for (n_ID = 0;n_ID < gen_nb_const_char_ptr;n_ID++) {
26892 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
26893 mem_base = xmlMemBlocks();
26894 URL = gen_filepath(n_URL, 0);
26895 ID = gen_const_char_ptr(n_ID, 1);
26896 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 2);
26897
William M. Brackf13f77f2004-11-12 16:03:48 +000026898 ret_val = xmlNoNetExternalEntityLoader(URL, (const char *)ID, ctxt);
Daniel Veillard42595322004-11-08 10:52:06 +000026899 desret_xmlParserInputPtr(ret_val);
26900 call_tests++;
26901 des_filepath(n_URL, URL, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000026902 des_const_char_ptr(n_ID, (const char *)ID, 1);
Daniel Veillard42595322004-11-08 10:52:06 +000026903 des_xmlParserCtxtPtr(n_ctxt, ctxt, 2);
26904 xmlResetLastError();
26905 if (mem_base != xmlMemBlocks()) {
26906 printf("Leak of %d blocks found in xmlNoNetExternalEntityLoader",
26907 xmlMemBlocks() - mem_base);
26908 test_ret++;
26909 printf(" %d", n_URL);
26910 printf(" %d", n_ID);
26911 printf(" %d", n_ctxt);
26912 printf("\n");
26913 }
26914 }
26915 }
26916 }
Daniel Veillard42595322004-11-08 10:52:06 +000026917 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026918
Daniel Veillard42595322004-11-08 10:52:06 +000026919 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026920}
26921
26922
26923static int
26924test_xmlNormalizeWindowsPath(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026925 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026926
Daniel Veillard8a32fe42004-11-02 22:10:16 +000026927 int mem_base;
26928 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026929 xmlChar * path; /* the input file path */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000026930 int n_path;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026931
Daniel Veillard8a32fe42004-11-02 22:10:16 +000026932 for (n_path = 0;n_path < gen_nb_const_xmlChar_ptr;n_path++) {
26933 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026934 path = gen_const_xmlChar_ptr(n_path, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000026935
William M. Brackf13f77f2004-11-12 16:03:48 +000026936 ret_val = xmlNormalizeWindowsPath((const xmlChar *)path);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000026937 desret_xmlChar_ptr(ret_val);
26938 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000026939 des_const_xmlChar_ptr(n_path, (const xmlChar *)path, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000026940 xmlResetLastError();
26941 if (mem_base != xmlMemBlocks()) {
26942 printf("Leak of %d blocks found in xmlNormalizeWindowsPath",
26943 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026944 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000026945 printf(" %d", n_path);
26946 printf("\n");
26947 }
26948 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000026949 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026950
Daniel Veillard42595322004-11-08 10:52:06 +000026951 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026952}
26953
26954
26955static int
26956test_xmlOutputBufferCreateFd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026957 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026958
William M. Brack21e4ef22005-01-02 09:53:13 +000026959#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d95c732004-11-06 22:25:14 +000026960 int mem_base;
26961 xmlOutputBufferPtr ret_val;
26962 int fd; /* a file descriptor number */
26963 int n_fd;
26964 xmlCharEncodingHandlerPtr encoder; /* the encoding converter or NULL */
26965 int n_encoder;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026966
Daniel Veillard3d95c732004-11-06 22:25:14 +000026967 for (n_fd = 0;n_fd < gen_nb_int;n_fd++) {
26968 for (n_encoder = 0;n_encoder < gen_nb_xmlCharEncodingHandlerPtr;n_encoder++) {
26969 mem_base = xmlMemBlocks();
26970 fd = gen_int(n_fd, 0);
26971 encoder = gen_xmlCharEncodingHandlerPtr(n_encoder, 1);
26972
26973 ret_val = xmlOutputBufferCreateFd(fd, encoder);
26974 desret_xmlOutputBufferPtr(ret_val);
26975 call_tests++;
26976 des_int(n_fd, fd, 0);
26977 des_xmlCharEncodingHandlerPtr(n_encoder, encoder, 1);
26978 xmlResetLastError();
26979 if (mem_base != xmlMemBlocks()) {
26980 printf("Leak of %d blocks found in xmlOutputBufferCreateFd",
26981 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026982 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000026983 printf(" %d", n_fd);
26984 printf(" %d", n_encoder);
26985 printf("\n");
26986 }
26987 }
26988 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026989 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000026990#endif
26991
Daniel Veillard42595322004-11-08 10:52:06 +000026992 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026993}
26994
26995
26996static int
26997test_xmlOutputBufferCreateFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026998 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026999
William M. Brack21e4ef22005-01-02 09:53:13 +000027000#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d95c732004-11-06 22:25:14 +000027001 int mem_base;
27002 xmlOutputBufferPtr ret_val;
27003 FILE * file; /* a FILE* */
27004 int n_file;
27005 xmlCharEncodingHandlerPtr encoder; /* the encoding converter or NULL */
27006 int n_encoder;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027007
Daniel Veillard3d95c732004-11-06 22:25:14 +000027008 for (n_file = 0;n_file < gen_nb_FILE_ptr;n_file++) {
27009 for (n_encoder = 0;n_encoder < gen_nb_xmlCharEncodingHandlerPtr;n_encoder++) {
27010 mem_base = xmlMemBlocks();
27011 file = gen_FILE_ptr(n_file, 0);
27012 encoder = gen_xmlCharEncodingHandlerPtr(n_encoder, 1);
27013
27014 ret_val = xmlOutputBufferCreateFile(file, encoder);
27015 desret_xmlOutputBufferPtr(ret_val);
27016 call_tests++;
27017 des_FILE_ptr(n_file, file, 0);
27018 des_xmlCharEncodingHandlerPtr(n_encoder, encoder, 1);
27019 xmlResetLastError();
27020 if (mem_base != xmlMemBlocks()) {
27021 printf("Leak of %d blocks found in xmlOutputBufferCreateFile",
27022 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027023 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000027024 printf(" %d", n_file);
27025 printf(" %d", n_encoder);
27026 printf("\n");
27027 }
27028 }
27029 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027030 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000027031#endif
27032
Daniel Veillard42595322004-11-08 10:52:06 +000027033 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027034}
27035
27036
27037static int
27038test_xmlOutputBufferCreateFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027039 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027040
William M. Brack21e4ef22005-01-02 09:53:13 +000027041#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d95c732004-11-06 22:25:14 +000027042 int mem_base;
27043 xmlOutputBufferPtr ret_val;
27044 const char * URI; /* a C string containing the URI or filename */
27045 int n_URI;
27046 xmlCharEncodingHandlerPtr encoder; /* the encoding converter or NULL */
27047 int n_encoder;
27048 int compression; /* the compression ration (0 none, 9 max). */
27049 int n_compression;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027050
Daniel Veillard42595322004-11-08 10:52:06 +000027051 for (n_URI = 0;n_URI < gen_nb_fileoutput;n_URI++) {
Daniel Veillard3d95c732004-11-06 22:25:14 +000027052 for (n_encoder = 0;n_encoder < gen_nb_xmlCharEncodingHandlerPtr;n_encoder++) {
27053 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
27054 mem_base = xmlMemBlocks();
Daniel Veillard42595322004-11-08 10:52:06 +000027055 URI = gen_fileoutput(n_URI, 0);
Daniel Veillard3d95c732004-11-06 22:25:14 +000027056 encoder = gen_xmlCharEncodingHandlerPtr(n_encoder, 1);
27057 compression = gen_int(n_compression, 2);
27058
27059 ret_val = xmlOutputBufferCreateFilename(URI, encoder, compression);
27060 desret_xmlOutputBufferPtr(ret_val);
27061 call_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000027062 des_fileoutput(n_URI, URI, 0);
Daniel Veillard3d95c732004-11-06 22:25:14 +000027063 des_xmlCharEncodingHandlerPtr(n_encoder, encoder, 1);
27064 des_int(n_compression, compression, 2);
27065 xmlResetLastError();
27066 if (mem_base != xmlMemBlocks()) {
27067 printf("Leak of %d blocks found in xmlOutputBufferCreateFilename",
27068 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027069 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000027070 printf(" %d", n_URI);
27071 printf(" %d", n_encoder);
27072 printf(" %d", n_compression);
27073 printf("\n");
27074 }
27075 }
27076 }
27077 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027078 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000027079#endif
27080
Daniel Veillard42595322004-11-08 10:52:06 +000027081 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027082}
27083
27084
27085static int
27086test_xmlOutputBufferFlush(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027087 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027088
William M. Brack21e4ef22005-01-02 09:53:13 +000027089#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000027090 int mem_base;
27091 int ret_val;
27092 xmlOutputBufferPtr out; /* a buffered output */
27093 int n_out;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027094
Daniel Veillard3d97e662004-11-04 10:49:00 +000027095 for (n_out = 0;n_out < gen_nb_xmlOutputBufferPtr;n_out++) {
27096 mem_base = xmlMemBlocks();
27097 out = gen_xmlOutputBufferPtr(n_out, 0);
27098
27099 ret_val = xmlOutputBufferFlush(out);
27100 desret_int(ret_val);
27101 call_tests++;
27102 des_xmlOutputBufferPtr(n_out, out, 0);
27103 xmlResetLastError();
27104 if (mem_base != xmlMemBlocks()) {
27105 printf("Leak of %d blocks found in xmlOutputBufferFlush",
27106 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027107 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000027108 printf(" %d", n_out);
27109 printf("\n");
27110 }
27111 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027112 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000027113#endif
27114
Daniel Veillard42595322004-11-08 10:52:06 +000027115 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027116}
27117
27118
27119static int
27120test_xmlOutputBufferWrite(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027121 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027122
William M. Brack21e4ef22005-01-02 09:53:13 +000027123#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000027124 int mem_base;
27125 int ret_val;
27126 xmlOutputBufferPtr out; /* a buffered parser output */
27127 int n_out;
27128 int len; /* the size in bytes of the array. */
27129 int n_len;
Daniel Veillardce682bc2004-11-05 17:22:25 +000027130 char * buf; /* an char array */
Daniel Veillard3d97e662004-11-04 10:49:00 +000027131 int n_buf;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027132
Daniel Veillard3d97e662004-11-04 10:49:00 +000027133 for (n_out = 0;n_out < gen_nb_xmlOutputBufferPtr;n_out++) {
27134 for (n_len = 0;n_len < gen_nb_int;n_len++) {
27135 for (n_buf = 0;n_buf < gen_nb_const_char_ptr;n_buf++) {
27136 mem_base = xmlMemBlocks();
27137 out = gen_xmlOutputBufferPtr(n_out, 0);
27138 len = gen_int(n_len, 1);
27139 buf = gen_const_char_ptr(n_buf, 2);
27140
William M. Brackf13f77f2004-11-12 16:03:48 +000027141 ret_val = xmlOutputBufferWrite(out, len, (const char *)buf);
Daniel Veillard3d97e662004-11-04 10:49:00 +000027142 desret_int(ret_val);
27143 call_tests++;
27144 des_xmlOutputBufferPtr(n_out, out, 0);
27145 des_int(n_len, len, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000027146 des_const_char_ptr(n_buf, (const char *)buf, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +000027147 xmlResetLastError();
27148 if (mem_base != xmlMemBlocks()) {
27149 printf("Leak of %d blocks found in xmlOutputBufferWrite",
27150 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027151 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000027152 printf(" %d", n_out);
27153 printf(" %d", n_len);
27154 printf(" %d", n_buf);
27155 printf("\n");
27156 }
27157 }
27158 }
27159 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027160 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000027161#endif
27162
Daniel Veillard42595322004-11-08 10:52:06 +000027163 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027164}
27165
27166
27167static int
27168test_xmlOutputBufferWriteEscape(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027169 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027170
27171
27172 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000027173 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027174}
27175
27176
27177static int
27178test_xmlOutputBufferWriteString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027179 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027180
William M. Brack21e4ef22005-01-02 09:53:13 +000027181#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000027182 int mem_base;
27183 int ret_val;
27184 xmlOutputBufferPtr out; /* a buffered parser output */
27185 int n_out;
Daniel Veillardce682bc2004-11-05 17:22:25 +000027186 char * str; /* a zero terminated C string */
Daniel Veillard3d97e662004-11-04 10:49:00 +000027187 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027188
Daniel Veillard3d97e662004-11-04 10:49:00 +000027189 for (n_out = 0;n_out < gen_nb_xmlOutputBufferPtr;n_out++) {
27190 for (n_str = 0;n_str < gen_nb_const_char_ptr;n_str++) {
27191 mem_base = xmlMemBlocks();
27192 out = gen_xmlOutputBufferPtr(n_out, 0);
27193 str = gen_const_char_ptr(n_str, 1);
27194
William M. Brackf13f77f2004-11-12 16:03:48 +000027195 ret_val = xmlOutputBufferWriteString(out, (const char *)str);
Daniel Veillard3d97e662004-11-04 10:49:00 +000027196 desret_int(ret_val);
27197 call_tests++;
27198 des_xmlOutputBufferPtr(n_out, out, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000027199 des_const_char_ptr(n_str, (const char *)str, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000027200 xmlResetLastError();
27201 if (mem_base != xmlMemBlocks()) {
27202 printf("Leak of %d blocks found in xmlOutputBufferWriteString",
27203 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027204 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000027205 printf(" %d", n_out);
27206 printf(" %d", n_str);
27207 printf("\n");
27208 }
27209 }
27210 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027211 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000027212#endif
27213
Daniel Veillard42595322004-11-08 10:52:06 +000027214 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027215}
27216
27217
27218static int
27219test_xmlParserGetDirectory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027220 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027221
27222
27223 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000027224 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027225}
27226
27227
27228static int
27229test_xmlParserInputBufferCreateFd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027230 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027231
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027232 int mem_base;
27233 xmlParserInputBufferPtr ret_val;
27234 int fd; /* a file descriptor number */
27235 int n_fd;
27236 xmlCharEncoding enc; /* the charset encoding if known */
27237 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027238
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027239 for (n_fd = 0;n_fd < gen_nb_int;n_fd++) {
27240 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
27241 mem_base = xmlMemBlocks();
27242 fd = gen_int(n_fd, 0);
27243 enc = gen_xmlCharEncoding(n_enc, 1);
27244 if (fd >= 0) fd = -1;
27245
27246 ret_val = xmlParserInputBufferCreateFd(fd, enc);
27247 desret_xmlParserInputBufferPtr(ret_val);
27248 call_tests++;
27249 des_int(n_fd, fd, 0);
27250 des_xmlCharEncoding(n_enc, enc, 1);
27251 xmlResetLastError();
27252 if (mem_base != xmlMemBlocks()) {
27253 printf("Leak of %d blocks found in xmlParserInputBufferCreateFd",
27254 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027255 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027256 printf(" %d", n_fd);
27257 printf(" %d", n_enc);
27258 printf("\n");
27259 }
27260 }
27261 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027262 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027263
Daniel Veillard42595322004-11-08 10:52:06 +000027264 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027265}
27266
27267
27268static int
27269test_xmlParserInputBufferCreateFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027270 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027271
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027272 int mem_base;
27273 xmlParserInputBufferPtr ret_val;
27274 FILE * file; /* a FILE* */
27275 int n_file;
27276 xmlCharEncoding enc; /* the charset encoding if known */
27277 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027278
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027279 for (n_file = 0;n_file < gen_nb_FILE_ptr;n_file++) {
27280 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
27281 mem_base = xmlMemBlocks();
27282 file = gen_FILE_ptr(n_file, 0);
27283 enc = gen_xmlCharEncoding(n_enc, 1);
27284
27285 ret_val = xmlParserInputBufferCreateFile(file, enc);
27286 desret_xmlParserInputBufferPtr(ret_val);
27287 call_tests++;
27288 des_FILE_ptr(n_file, file, 0);
27289 des_xmlCharEncoding(n_enc, enc, 1);
27290 xmlResetLastError();
27291 if (mem_base != xmlMemBlocks()) {
27292 printf("Leak of %d blocks found in xmlParserInputBufferCreateFile",
27293 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027294 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027295 printf(" %d", n_file);
27296 printf(" %d", n_enc);
27297 printf("\n");
27298 }
27299 }
27300 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027301 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027302
Daniel Veillard42595322004-11-08 10:52:06 +000027303 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027304}
27305
27306
27307static int
27308test_xmlParserInputBufferCreateFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027309 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027310
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027311 int mem_base;
27312 xmlParserInputBufferPtr ret_val;
27313 const char * URI; /* a C string containing the URI or filename */
27314 int n_URI;
27315 xmlCharEncoding enc; /* the charset encoding if known */
27316 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027317
Daniel Veillard42595322004-11-08 10:52:06 +000027318 for (n_URI = 0;n_URI < gen_nb_fileoutput;n_URI++) {
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027319 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
27320 mem_base = xmlMemBlocks();
Daniel Veillard42595322004-11-08 10:52:06 +000027321 URI = gen_fileoutput(n_URI, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027322 enc = gen_xmlCharEncoding(n_enc, 1);
27323
27324 ret_val = xmlParserInputBufferCreateFilename(URI, enc);
27325 desret_xmlParserInputBufferPtr(ret_val);
27326 call_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000027327 des_fileoutput(n_URI, URI, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027328 des_xmlCharEncoding(n_enc, enc, 1);
27329 xmlResetLastError();
27330 if (mem_base != xmlMemBlocks()) {
27331 printf("Leak of %d blocks found in xmlParserInputBufferCreateFilename",
27332 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027333 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027334 printf(" %d", n_URI);
27335 printf(" %d", n_enc);
27336 printf("\n");
27337 }
27338 }
27339 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027340 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027341
Daniel Veillard42595322004-11-08 10:52:06 +000027342 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027343}
27344
27345
27346static int
27347test_xmlParserInputBufferCreateMem(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027348 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027349
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027350 int mem_base;
27351 xmlParserInputBufferPtr ret_val;
27352 char * mem; /* the memory input */
27353 int n_mem;
27354 int size; /* the length of the memory block */
27355 int n_size;
27356 xmlCharEncoding enc; /* the charset encoding if known */
27357 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027358
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027359 for (n_mem = 0;n_mem < gen_nb_const_char_ptr;n_mem++) {
27360 for (n_size = 0;n_size < gen_nb_int;n_size++) {
27361 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
27362 mem_base = xmlMemBlocks();
27363 mem = gen_const_char_ptr(n_mem, 0);
27364 size = gen_int(n_size, 1);
27365 enc = gen_xmlCharEncoding(n_enc, 2);
27366
William M. Brackf13f77f2004-11-12 16:03:48 +000027367 ret_val = xmlParserInputBufferCreateMem((const char *)mem, size, enc);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027368 desret_xmlParserInputBufferPtr(ret_val);
27369 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000027370 des_const_char_ptr(n_mem, (const char *)mem, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027371 des_int(n_size, size, 1);
27372 des_xmlCharEncoding(n_enc, enc, 2);
27373 xmlResetLastError();
27374 if (mem_base != xmlMemBlocks()) {
27375 printf("Leak of %d blocks found in xmlParserInputBufferCreateMem",
27376 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027377 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027378 printf(" %d", n_mem);
27379 printf(" %d", n_size);
27380 printf(" %d", n_enc);
27381 printf("\n");
27382 }
27383 }
27384 }
27385 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027386 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027387
Daniel Veillard42595322004-11-08 10:52:06 +000027388 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027389}
27390
27391
27392static int
27393test_xmlParserInputBufferCreateStatic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027394 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027395
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027396 int mem_base;
27397 xmlParserInputBufferPtr ret_val;
27398 char * mem; /* the memory input */
27399 int n_mem;
27400 int size; /* the length of the memory block */
27401 int n_size;
27402 xmlCharEncoding enc; /* the charset encoding if known */
27403 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027404
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027405 for (n_mem = 0;n_mem < gen_nb_const_char_ptr;n_mem++) {
27406 for (n_size = 0;n_size < gen_nb_int;n_size++) {
27407 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
27408 mem_base = xmlMemBlocks();
27409 mem = gen_const_char_ptr(n_mem, 0);
27410 size = gen_int(n_size, 1);
27411 enc = gen_xmlCharEncoding(n_enc, 2);
27412
William M. Brackf13f77f2004-11-12 16:03:48 +000027413 ret_val = xmlParserInputBufferCreateStatic((const char *)mem, size, enc);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027414 desret_xmlParserInputBufferPtr(ret_val);
27415 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000027416 des_const_char_ptr(n_mem, (const char *)mem, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027417 des_int(n_size, size, 1);
27418 des_xmlCharEncoding(n_enc, enc, 2);
27419 xmlResetLastError();
27420 if (mem_base != xmlMemBlocks()) {
27421 printf("Leak of %d blocks found in xmlParserInputBufferCreateStatic",
27422 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027423 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027424 printf(" %d", n_mem);
27425 printf(" %d", n_size);
27426 printf(" %d", n_enc);
27427 printf("\n");
27428 }
27429 }
27430 }
27431 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027432 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027433
Daniel Veillard42595322004-11-08 10:52:06 +000027434 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027435}
27436
27437
27438static int
27439test_xmlParserInputBufferGrow(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027440 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027441
Daniel Veillard34099b42004-11-04 17:34:35 +000027442 int mem_base;
27443 int ret_val;
27444 xmlParserInputBufferPtr in; /* a buffered parser input */
27445 int n_in;
27446 int len; /* indicative value of the amount of chars to read */
27447 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027448
Daniel Veillard34099b42004-11-04 17:34:35 +000027449 for (n_in = 0;n_in < gen_nb_xmlParserInputBufferPtr;n_in++) {
27450 for (n_len = 0;n_len < gen_nb_int;n_len++) {
27451 mem_base = xmlMemBlocks();
27452 in = gen_xmlParserInputBufferPtr(n_in, 0);
27453 len = gen_int(n_len, 1);
27454
27455 ret_val = xmlParserInputBufferGrow(in, len);
27456 desret_int(ret_val);
27457 call_tests++;
27458 des_xmlParserInputBufferPtr(n_in, in, 0);
27459 des_int(n_len, len, 1);
27460 xmlResetLastError();
27461 if (mem_base != xmlMemBlocks()) {
27462 printf("Leak of %d blocks found in xmlParserInputBufferGrow",
27463 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027464 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000027465 printf(" %d", n_in);
27466 printf(" %d", n_len);
27467 printf("\n");
27468 }
27469 }
27470 }
Daniel Veillard34099b42004-11-04 17:34:35 +000027471 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027472
Daniel Veillard42595322004-11-08 10:52:06 +000027473 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027474}
27475
27476
27477static int
27478test_xmlParserInputBufferPush(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027479 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027480
Daniel Veillard34099b42004-11-04 17:34:35 +000027481 int mem_base;
27482 int ret_val;
27483 xmlParserInputBufferPtr in; /* a buffered parser input */
27484 int n_in;
27485 int len; /* the size in bytes of the array. */
27486 int n_len;
Daniel Veillardce682bc2004-11-05 17:22:25 +000027487 char * buf; /* an char array */
Daniel Veillard34099b42004-11-04 17:34:35 +000027488 int n_buf;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027489
Daniel Veillard34099b42004-11-04 17:34:35 +000027490 for (n_in = 0;n_in < gen_nb_xmlParserInputBufferPtr;n_in++) {
27491 for (n_len = 0;n_len < gen_nb_int;n_len++) {
27492 for (n_buf = 0;n_buf < gen_nb_const_char_ptr;n_buf++) {
27493 mem_base = xmlMemBlocks();
27494 in = gen_xmlParserInputBufferPtr(n_in, 0);
27495 len = gen_int(n_len, 1);
27496 buf = gen_const_char_ptr(n_buf, 2);
27497
William M. Brackf13f77f2004-11-12 16:03:48 +000027498 ret_val = xmlParserInputBufferPush(in, len, (const char *)buf);
Daniel Veillard34099b42004-11-04 17:34:35 +000027499 desret_int(ret_val);
27500 call_tests++;
27501 des_xmlParserInputBufferPtr(n_in, in, 0);
27502 des_int(n_len, len, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000027503 des_const_char_ptr(n_buf, (const char *)buf, 2);
Daniel Veillard34099b42004-11-04 17:34:35 +000027504 xmlResetLastError();
27505 if (mem_base != xmlMemBlocks()) {
27506 printf("Leak of %d blocks found in xmlParserInputBufferPush",
27507 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027508 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000027509 printf(" %d", n_in);
27510 printf(" %d", n_len);
27511 printf(" %d", n_buf);
27512 printf("\n");
27513 }
27514 }
27515 }
27516 }
Daniel Veillard34099b42004-11-04 17:34:35 +000027517 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027518
Daniel Veillard42595322004-11-08 10:52:06 +000027519 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027520}
27521
27522
27523static int
27524test_xmlParserInputBufferRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027525 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027526
Daniel Veillard34099b42004-11-04 17:34:35 +000027527 int mem_base;
27528 int ret_val;
27529 xmlParserInputBufferPtr in; /* a buffered parser input */
27530 int n_in;
27531 int len; /* indicative value of the amount of chars to read */
27532 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027533
Daniel Veillard34099b42004-11-04 17:34:35 +000027534 for (n_in = 0;n_in < gen_nb_xmlParserInputBufferPtr;n_in++) {
27535 for (n_len = 0;n_len < gen_nb_int;n_len++) {
27536 mem_base = xmlMemBlocks();
27537 in = gen_xmlParserInputBufferPtr(n_in, 0);
27538 len = gen_int(n_len, 1);
27539
27540 ret_val = xmlParserInputBufferRead(in, len);
27541 desret_int(ret_val);
27542 call_tests++;
27543 des_xmlParserInputBufferPtr(n_in, in, 0);
27544 des_int(n_len, len, 1);
27545 xmlResetLastError();
27546 if (mem_base != xmlMemBlocks()) {
27547 printf("Leak of %d blocks found in xmlParserInputBufferRead",
27548 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027549 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000027550 printf(" %d", n_in);
27551 printf(" %d", n_len);
27552 printf("\n");
27553 }
27554 }
27555 }
Daniel Veillard34099b42004-11-04 17:34:35 +000027556 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027557
Daniel Veillard42595322004-11-08 10:52:06 +000027558 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027559}
27560
27561
27562static int
27563test_xmlPopInputCallbacks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027564 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027565
27566 int mem_base;
27567 int ret_val;
27568
27569 mem_base = xmlMemBlocks();
27570
27571 ret_val = xmlPopInputCallbacks();
27572 desret_int(ret_val);
27573 call_tests++;
27574 xmlResetLastError();
27575 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000027576 printf("Leak of %d blocks found in xmlPopInputCallbacks",
Daniel Veillardd93f6252004-11-02 15:53:51 +000027577 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027578 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000027579 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000027580 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000027581 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027582
Daniel Veillard42595322004-11-08 10:52:06 +000027583 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027584}
27585
27586
27587static int
27588test_xmlRegisterDefaultInputCallbacks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027589 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027590
27591 int mem_base;
27592
27593 mem_base = xmlMemBlocks();
27594
27595 xmlRegisterDefaultInputCallbacks();
27596 call_tests++;
27597 xmlResetLastError();
27598 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000027599 printf("Leak of %d blocks found in xmlRegisterDefaultInputCallbacks",
Daniel Veillardd93f6252004-11-02 15:53:51 +000027600 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027601 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000027602 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000027603 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000027604 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027605
Daniel Veillard42595322004-11-08 10:52:06 +000027606 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027607}
27608
27609
27610static int
27611test_xmlRegisterDefaultOutputCallbacks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027612 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027613
William M. Brack21e4ef22005-01-02 09:53:13 +000027614#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000027615 int mem_base;
27616
27617 mem_base = xmlMemBlocks();
27618
27619 xmlRegisterDefaultOutputCallbacks();
27620 call_tests++;
27621 xmlResetLastError();
27622 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000027623 printf("Leak of %d blocks found in xmlRegisterDefaultOutputCallbacks",
Daniel Veillardd93f6252004-11-02 15:53:51 +000027624 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027625 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000027626 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000027627 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027628 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027629#endif
27630
Daniel Veillard42595322004-11-08 10:52:06 +000027631 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027632}
27633
27634
27635static int
27636test_xmlRegisterHTTPPostCallbacks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027637 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027638
William M. Brack21e4ef22005-01-02 09:53:13 +000027639#if defined(LIBXML_OUTPUT_ENABLED) && defined(LIBXML_HTTP_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000027640 int mem_base;
27641
27642 mem_base = xmlMemBlocks();
27643
27644 xmlRegisterHTTPPostCallbacks();
27645 call_tests++;
27646 xmlResetLastError();
27647 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000027648 printf("Leak of %d blocks found in xmlRegisterHTTPPostCallbacks",
Daniel Veillardd93f6252004-11-02 15:53:51 +000027649 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027650 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000027651 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000027652 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027653 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027654#endif
27655
Daniel Veillard42595322004-11-08 10:52:06 +000027656 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027657}
27658
27659static int
27660test_xmlIO(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027661 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027662
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027663 if (quiet == 0) printf("Testing xmlIO : 38 of 47 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000027664 test_ret += test_xmlAllocOutputBuffer();
27665 test_ret += test_xmlAllocParserInputBuffer();
27666 test_ret += test_xmlCheckFilename();
27667 test_ret += test_xmlCheckHTTPInput();
27668 test_ret += test_xmlCleanupInputCallbacks();
27669 test_ret += test_xmlCleanupOutputCallbacks();
27670 test_ret += test_xmlFileClose();
27671 test_ret += test_xmlFileMatch();
27672 test_ret += test_xmlFileOpen();
27673 test_ret += test_xmlFileRead();
27674 test_ret += test_xmlIOFTPClose();
27675 test_ret += test_xmlIOFTPMatch();
27676 test_ret += test_xmlIOFTPOpen();
27677 test_ret += test_xmlIOFTPRead();
27678 test_ret += test_xmlIOHTTPClose();
27679 test_ret += test_xmlIOHTTPMatch();
27680 test_ret += test_xmlIOHTTPOpen();
27681 test_ret += test_xmlIOHTTPOpenW();
27682 test_ret += test_xmlIOHTTPRead();
27683 test_ret += test_xmlNoNetExternalEntityLoader();
27684 test_ret += test_xmlNormalizeWindowsPath();
27685 test_ret += test_xmlOutputBufferCreateFd();
27686 test_ret += test_xmlOutputBufferCreateFile();
27687 test_ret += test_xmlOutputBufferCreateFilename();
27688 test_ret += test_xmlOutputBufferFlush();
27689 test_ret += test_xmlOutputBufferWrite();
27690 test_ret += test_xmlOutputBufferWriteEscape();
27691 test_ret += test_xmlOutputBufferWriteString();
27692 test_ret += test_xmlParserGetDirectory();
27693 test_ret += test_xmlParserInputBufferCreateFd();
27694 test_ret += test_xmlParserInputBufferCreateFile();
27695 test_ret += test_xmlParserInputBufferCreateFilename();
27696 test_ret += test_xmlParserInputBufferCreateMem();
27697 test_ret += test_xmlParserInputBufferCreateStatic();
27698 test_ret += test_xmlParserInputBufferGrow();
27699 test_ret += test_xmlParserInputBufferPush();
27700 test_ret += test_xmlParserInputBufferRead();
27701 test_ret += test_xmlPopInputCallbacks();
27702 test_ret += test_xmlRegisterDefaultInputCallbacks();
27703 test_ret += test_xmlRegisterDefaultOutputCallbacks();
27704 test_ret += test_xmlRegisterHTTPPostCallbacks();
Daniel Veillardd93f6252004-11-02 15:53:51 +000027705
Daniel Veillard42595322004-11-08 10:52:06 +000027706 if (test_ret != 0)
27707 printf("Module xmlIO: %d errors\n", test_ret);
27708 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027709}
Daniel Veillarda521d282004-11-09 14:59:59 +000027710#ifdef LIBXML_AUTOMATA_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000027711
Daniel Veillarda82b1822004-11-08 16:24:57 +000027712#define gen_nb_xmlAutomataPtr 1
27713static xmlAutomataPtr gen_xmlAutomataPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
27714 return(NULL);
27715}
27716static void des_xmlAutomataPtr(int no ATTRIBUTE_UNUSED, xmlAutomataPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
27717}
Daniel Veillarda521d282004-11-09 14:59:59 +000027718#endif
27719
Daniel Veillarda82b1822004-11-08 16:24:57 +000027720
27721static int
27722test_xmlAutomataCompile(void) {
27723 int test_ret = 0;
27724
27725
27726 /* missing type support */
27727 return(test_ret);
27728}
27729
27730
27731static int
27732test_xmlAutomataGetInitState(void) {
27733 int test_ret = 0;
27734
27735
27736 /* missing type support */
27737 return(test_ret);
27738}
27739
27740
27741static int
27742test_xmlAutomataIsDeterminist(void) {
27743 int test_ret = 0;
27744
William M. Brack21e4ef22005-01-02 09:53:13 +000027745#if defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_AUTOMATA_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000027746 int mem_base;
27747 int ret_val;
27748 xmlAutomataPtr am; /* an automata */
27749 int n_am;
27750
27751 for (n_am = 0;n_am < gen_nb_xmlAutomataPtr;n_am++) {
27752 mem_base = xmlMemBlocks();
27753 am = gen_xmlAutomataPtr(n_am, 0);
27754
27755 ret_val = xmlAutomataIsDeterminist(am);
27756 desret_int(ret_val);
27757 call_tests++;
27758 des_xmlAutomataPtr(n_am, am, 0);
27759 xmlResetLastError();
27760 if (mem_base != xmlMemBlocks()) {
27761 printf("Leak of %d blocks found in xmlAutomataIsDeterminist",
27762 xmlMemBlocks() - mem_base);
27763 test_ret++;
27764 printf(" %d", n_am);
27765 printf("\n");
27766 }
27767 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027768 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000027769#endif
27770
Daniel Veillarda82b1822004-11-08 16:24:57 +000027771 return(test_ret);
27772}
27773
Daniel Veillarda521d282004-11-09 14:59:59 +000027774#ifdef LIBXML_AUTOMATA_ENABLED
Daniel Veillarda82b1822004-11-08 16:24:57 +000027775
27776#define gen_nb_xmlAutomataStatePtr 1
27777static xmlAutomataStatePtr gen_xmlAutomataStatePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
27778 return(NULL);
27779}
27780static void des_xmlAutomataStatePtr(int no ATTRIBUTE_UNUSED, xmlAutomataStatePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
27781}
Daniel Veillarda521d282004-11-09 14:59:59 +000027782#endif
27783
Daniel Veillarda82b1822004-11-08 16:24:57 +000027784
27785static int
27786test_xmlAutomataNewAllTrans(void) {
27787 int test_ret = 0;
27788
27789
27790 /* missing type support */
27791 return(test_ret);
27792}
27793
27794
27795static int
27796test_xmlAutomataNewCountTrans(void) {
27797 int test_ret = 0;
27798
27799
27800 /* missing type support */
27801 return(test_ret);
27802}
27803
27804
27805static int
27806test_xmlAutomataNewCountTrans2(void) {
27807 int test_ret = 0;
27808
27809
27810 /* missing type support */
27811 return(test_ret);
27812}
27813
27814
27815static int
27816test_xmlAutomataNewCountedTrans(void) {
27817 int test_ret = 0;
27818
27819
27820 /* missing type support */
27821 return(test_ret);
27822}
27823
27824
27825static int
27826test_xmlAutomataNewCounter(void) {
27827 int test_ret = 0;
27828
William M. Brack21e4ef22005-01-02 09:53:13 +000027829#if defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_AUTOMATA_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000027830 int mem_base;
27831 int ret_val;
27832 xmlAutomataPtr am; /* an automata */
27833 int n_am;
27834 int min; /* the minimal value on the counter */
27835 int n_min;
27836 int max; /* the maximal value on the counter */
27837 int n_max;
27838
27839 for (n_am = 0;n_am < gen_nb_xmlAutomataPtr;n_am++) {
27840 for (n_min = 0;n_min < gen_nb_int;n_min++) {
27841 for (n_max = 0;n_max < gen_nb_int;n_max++) {
27842 mem_base = xmlMemBlocks();
27843 am = gen_xmlAutomataPtr(n_am, 0);
27844 min = gen_int(n_min, 1);
27845 max = gen_int(n_max, 2);
27846
27847 ret_val = xmlAutomataNewCounter(am, min, max);
27848 desret_int(ret_val);
27849 call_tests++;
27850 des_xmlAutomataPtr(n_am, am, 0);
27851 des_int(n_min, min, 1);
27852 des_int(n_max, max, 2);
27853 xmlResetLastError();
27854 if (mem_base != xmlMemBlocks()) {
27855 printf("Leak of %d blocks found in xmlAutomataNewCounter",
27856 xmlMemBlocks() - mem_base);
27857 test_ret++;
27858 printf(" %d", n_am);
27859 printf(" %d", n_min);
27860 printf(" %d", n_max);
27861 printf("\n");
27862 }
27863 }
27864 }
27865 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027866 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000027867#endif
27868
Daniel Veillarda82b1822004-11-08 16:24:57 +000027869 return(test_ret);
27870}
27871
27872
27873static int
27874test_xmlAutomataNewCounterTrans(void) {
27875 int test_ret = 0;
27876
27877
27878 /* missing type support */
27879 return(test_ret);
27880}
27881
27882
27883static int
27884test_xmlAutomataNewEpsilon(void) {
27885 int test_ret = 0;
27886
27887
27888 /* missing type support */
27889 return(test_ret);
27890}
27891
27892
27893static int
27894test_xmlAutomataNewOnceTrans(void) {
27895 int test_ret = 0;
27896
27897
27898 /* missing type support */
27899 return(test_ret);
27900}
27901
27902
27903static int
27904test_xmlAutomataNewOnceTrans2(void) {
27905 int test_ret = 0;
27906
27907
27908 /* missing type support */
27909 return(test_ret);
27910}
27911
27912
27913static int
27914test_xmlAutomataNewState(void) {
27915 int test_ret = 0;
27916
27917
27918 /* missing type support */
27919 return(test_ret);
27920}
27921
27922
27923static int
27924test_xmlAutomataNewTransition(void) {
27925 int test_ret = 0;
27926
27927
27928 /* missing type support */
27929 return(test_ret);
27930}
27931
27932
27933static int
27934test_xmlAutomataNewTransition2(void) {
27935 int test_ret = 0;
27936
27937
27938 /* missing type support */
27939 return(test_ret);
27940}
27941
27942
27943static int
27944test_xmlAutomataSetFinalState(void) {
27945 int test_ret = 0;
27946
William M. Brack21e4ef22005-01-02 09:53:13 +000027947#if defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_AUTOMATA_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000027948 int mem_base;
27949 int ret_val;
27950 xmlAutomataPtr am; /* an automata */
27951 int n_am;
27952 xmlAutomataStatePtr state; /* a state in this automata */
27953 int n_state;
27954
27955 for (n_am = 0;n_am < gen_nb_xmlAutomataPtr;n_am++) {
27956 for (n_state = 0;n_state < gen_nb_xmlAutomataStatePtr;n_state++) {
27957 mem_base = xmlMemBlocks();
27958 am = gen_xmlAutomataPtr(n_am, 0);
27959 state = gen_xmlAutomataStatePtr(n_state, 1);
27960
27961 ret_val = xmlAutomataSetFinalState(am, state);
27962 desret_int(ret_val);
27963 call_tests++;
27964 des_xmlAutomataPtr(n_am, am, 0);
27965 des_xmlAutomataStatePtr(n_state, state, 1);
27966 xmlResetLastError();
27967 if (mem_base != xmlMemBlocks()) {
27968 printf("Leak of %d blocks found in xmlAutomataSetFinalState",
27969 xmlMemBlocks() - mem_base);
27970 test_ret++;
27971 printf(" %d", n_am);
27972 printf(" %d", n_state);
27973 printf("\n");
27974 }
27975 }
27976 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027977 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000027978#endif
27979
Daniel Veillarda82b1822004-11-08 16:24:57 +000027980 return(test_ret);
27981}
27982
27983
27984static int
27985test_xmlNewAutomata(void) {
27986 int test_ret = 0;
27987
27988
27989 /* missing type support */
27990 return(test_ret);
27991}
27992
27993static int
27994test_xmlautomata(void) {
27995 int test_ret = 0;
27996
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027997 if (quiet == 0) printf("Testing xmlautomata : 3 of 18 functions ...\n");
Daniel Veillarda82b1822004-11-08 16:24:57 +000027998 test_ret += test_xmlAutomataCompile();
27999 test_ret += test_xmlAutomataGetInitState();
28000 test_ret += test_xmlAutomataIsDeterminist();
28001 test_ret += test_xmlAutomataNewAllTrans();
28002 test_ret += test_xmlAutomataNewCountTrans();
28003 test_ret += test_xmlAutomataNewCountTrans2();
28004 test_ret += test_xmlAutomataNewCountedTrans();
28005 test_ret += test_xmlAutomataNewCounter();
28006 test_ret += test_xmlAutomataNewCounterTrans();
28007 test_ret += test_xmlAutomataNewEpsilon();
28008 test_ret += test_xmlAutomataNewOnceTrans();
28009 test_ret += test_xmlAutomataNewOnceTrans2();
28010 test_ret += test_xmlAutomataNewState();
28011 test_ret += test_xmlAutomataNewTransition();
28012 test_ret += test_xmlAutomataNewTransition2();
28013 test_ret += test_xmlAutomataSetFinalState();
28014 test_ret += test_xmlNewAutomata();
28015
28016 if (test_ret != 0)
28017 printf("Module xmlautomata: %d errors\n", test_ret);
28018 return(test_ret);
28019}
28020
Daniel Veillardce682bc2004-11-05 17:22:25 +000028021#define gen_nb_xmlGenericErrorFunc_ptr 1
28022static xmlGenericErrorFunc * gen_xmlGenericErrorFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
28023 return(NULL);
28024}
28025static void des_xmlGenericErrorFunc_ptr(int no ATTRIBUTE_UNUSED, xmlGenericErrorFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
28026}
28027
Daniel Veillardd93f6252004-11-02 15:53:51 +000028028static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000028029test_initGenericErrorDefaultFunc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028030 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028031
Daniel Veillardce682bc2004-11-05 17:22:25 +000028032 int mem_base;
28033 xmlGenericErrorFunc * handler; /* the handler */
28034 int n_handler;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028035
Daniel Veillardce682bc2004-11-05 17:22:25 +000028036 for (n_handler = 0;n_handler < gen_nb_xmlGenericErrorFunc_ptr;n_handler++) {
28037 mem_base = xmlMemBlocks();
28038 handler = gen_xmlGenericErrorFunc_ptr(n_handler, 0);
28039
28040 initGenericErrorDefaultFunc(handler);
28041 call_tests++;
28042 des_xmlGenericErrorFunc_ptr(n_handler, handler, 0);
28043 xmlResetLastError();
28044 if (mem_base != xmlMemBlocks()) {
28045 printf("Leak of %d blocks found in initGenericErrorDefaultFunc",
28046 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028047 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028048 printf(" %d", n_handler);
28049 printf("\n");
28050 }
28051 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000028052 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028053
Daniel Veillard42595322004-11-08 10:52:06 +000028054 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028055}
28056
28057
Daniel Veillardce682bc2004-11-05 17:22:25 +000028058#define gen_nb_xmlErrorPtr 1
28059static xmlErrorPtr gen_xmlErrorPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
28060 return(NULL);
28061}
28062static void des_xmlErrorPtr(int no ATTRIBUTE_UNUSED, xmlErrorPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
28063}
28064
Daniel Veillardd93f6252004-11-02 15:53:51 +000028065static int
28066test_xmlCopyError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028067 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028068
Daniel Veillardce682bc2004-11-05 17:22:25 +000028069 int mem_base;
28070 int ret_val;
28071 xmlErrorPtr from; /* a source error */
28072 int n_from;
28073 xmlErrorPtr to; /* a target error */
28074 int n_to;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028075
Daniel Veillardce682bc2004-11-05 17:22:25 +000028076 for (n_from = 0;n_from < gen_nb_xmlErrorPtr;n_from++) {
28077 for (n_to = 0;n_to < gen_nb_xmlErrorPtr;n_to++) {
28078 mem_base = xmlMemBlocks();
28079 from = gen_xmlErrorPtr(n_from, 0);
28080 to = gen_xmlErrorPtr(n_to, 1);
28081
28082 ret_val = xmlCopyError(from, to);
28083 desret_int(ret_val);
28084 call_tests++;
28085 des_xmlErrorPtr(n_from, from, 0);
28086 des_xmlErrorPtr(n_to, to, 1);
28087 xmlResetLastError();
28088 if (mem_base != xmlMemBlocks()) {
28089 printf("Leak of %d blocks found in xmlCopyError",
28090 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028091 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028092 printf(" %d", n_from);
28093 printf(" %d", n_to);
28094 printf("\n");
28095 }
28096 }
28097 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000028098 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028099
Daniel Veillard42595322004-11-08 10:52:06 +000028100 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028101}
28102
28103
28104static int
28105test_xmlCtxtGetLastError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028106 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028107
28108
28109 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028110 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028111}
28112
28113
28114static int
28115test_xmlCtxtResetLastError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028116 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028117
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000028118 int mem_base;
28119 void * ctx; /* an XML parser context */
28120 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028121
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000028122 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
28123 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028124 ctx = gen_void_ptr(n_ctx, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000028125
28126 xmlCtxtResetLastError(ctx);
28127 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028128 des_void_ptr(n_ctx, ctx, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000028129 xmlResetLastError();
28130 if (mem_base != xmlMemBlocks()) {
28131 printf("Leak of %d blocks found in xmlCtxtResetLastError",
28132 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028133 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000028134 printf(" %d", n_ctx);
28135 printf("\n");
28136 }
28137 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000028138 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028139
Daniel Veillard42595322004-11-08 10:52:06 +000028140 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028141}
28142
28143
28144static int
28145test_xmlGetLastError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028146 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028147
28148
28149 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028150 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028151}
28152
28153
28154static int
28155test_xmlParserError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028156 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028157
28158
28159 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028160 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028161}
28162
28163
28164static int
28165test_xmlParserPrintFileContext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028166 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028167
Daniel Veillardce682bc2004-11-05 17:22:25 +000028168 int mem_base;
28169 xmlParserInputPtr input; /* an xmlParserInputPtr input */
28170 int n_input;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028171
Daniel Veillardce682bc2004-11-05 17:22:25 +000028172 for (n_input = 0;n_input < gen_nb_xmlParserInputPtr;n_input++) {
28173 mem_base = xmlMemBlocks();
28174 input = gen_xmlParserInputPtr(n_input, 0);
28175
28176 xmlParserPrintFileContext(input);
28177 call_tests++;
28178 des_xmlParserInputPtr(n_input, input, 0);
28179 xmlResetLastError();
28180 if (mem_base != xmlMemBlocks()) {
28181 printf("Leak of %d blocks found in xmlParserPrintFileContext",
28182 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028183 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028184 printf(" %d", n_input);
28185 printf("\n");
28186 }
28187 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000028188 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028189
Daniel Veillard42595322004-11-08 10:52:06 +000028190 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028191}
28192
28193
28194static int
28195test_xmlParserPrintFileInfo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028196 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028197
Daniel Veillardce682bc2004-11-05 17:22:25 +000028198 int mem_base;
28199 xmlParserInputPtr input; /* an xmlParserInputPtr input */
28200 int n_input;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028201
Daniel Veillardce682bc2004-11-05 17:22:25 +000028202 for (n_input = 0;n_input < gen_nb_xmlParserInputPtr;n_input++) {
28203 mem_base = xmlMemBlocks();
28204 input = gen_xmlParserInputPtr(n_input, 0);
28205
28206 xmlParserPrintFileInfo(input);
28207 call_tests++;
28208 des_xmlParserInputPtr(n_input, input, 0);
28209 xmlResetLastError();
28210 if (mem_base != xmlMemBlocks()) {
28211 printf("Leak of %d blocks found in xmlParserPrintFileInfo",
28212 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028213 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028214 printf(" %d", n_input);
28215 printf("\n");
28216 }
28217 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000028218 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028219
Daniel Veillard42595322004-11-08 10:52:06 +000028220 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028221}
28222
28223
28224static int
28225test_xmlParserValidityError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028226 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028227
28228
28229 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028230 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028231}
28232
28233
28234static int
28235test_xmlParserValidityWarning(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028236 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028237
28238
28239 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028240 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028241}
28242
28243
28244static int
28245test_xmlParserWarning(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028246 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028247
28248
28249 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028250 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028251}
28252
28253
28254static int
28255test_xmlResetError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028256 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028257
Daniel Veillardce682bc2004-11-05 17:22:25 +000028258 int mem_base;
28259 xmlErrorPtr err; /* pointer to the error. */
28260 int n_err;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028261
Daniel Veillardce682bc2004-11-05 17:22:25 +000028262 for (n_err = 0;n_err < gen_nb_xmlErrorPtr;n_err++) {
28263 mem_base = xmlMemBlocks();
28264 err = gen_xmlErrorPtr(n_err, 0);
28265
28266 xmlResetError(err);
28267 call_tests++;
28268 des_xmlErrorPtr(n_err, err, 0);
28269 xmlResetLastError();
28270 if (mem_base != xmlMemBlocks()) {
28271 printf("Leak of %d blocks found in xmlResetError",
28272 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028273 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028274 printf(" %d", n_err);
28275 printf("\n");
28276 }
28277 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000028278 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028279
Daniel Veillard42595322004-11-08 10:52:06 +000028280 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028281}
28282
28283
28284static int
28285test_xmlResetLastError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028286 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028287
28288
28289
28290 xmlResetLastError();
28291 call_tests++;
28292 xmlResetLastError();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028293 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028294
Daniel Veillard42595322004-11-08 10:52:06 +000028295 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028296}
28297
28298
28299static int
28300test_xmlSetGenericErrorFunc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028301 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028302
28303
28304 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028305 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028306}
28307
28308
28309static int
28310test_xmlSetStructuredErrorFunc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028311 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028312
28313
28314 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028315 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028316}
28317
28318static int
28319test_xmlerror(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028320 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028321
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028322 if (quiet == 0) printf("Testing xmlerror : 7 of 15 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000028323 test_ret += test_initGenericErrorDefaultFunc();
28324 test_ret += test_xmlCopyError();
28325 test_ret += test_xmlCtxtGetLastError();
28326 test_ret += test_xmlCtxtResetLastError();
28327 test_ret += test_xmlGetLastError();
28328 test_ret += test_xmlParserError();
28329 test_ret += test_xmlParserPrintFileContext();
28330 test_ret += test_xmlParserPrintFileInfo();
28331 test_ret += test_xmlParserValidityError();
28332 test_ret += test_xmlParserValidityWarning();
28333 test_ret += test_xmlParserWarning();
28334 test_ret += test_xmlResetError();
28335 test_ret += test_xmlResetLastError();
28336 test_ret += test_xmlSetGenericErrorFunc();
28337 test_ret += test_xmlSetStructuredErrorFunc();
Daniel Veillardd93f6252004-11-02 15:53:51 +000028338
Daniel Veillard42595322004-11-08 10:52:06 +000028339 if (test_ret != 0)
28340 printf("Module xmlerror: %d errors\n", test_ret);
28341 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028342}
Daniel Veillardfc0b6f62005-01-09 17:48:02 +000028343#ifdef LIBXML_MODULES_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000028344
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000028345#define gen_nb_xmlModulePtr 1
28346static xmlModulePtr gen_xmlModulePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
28347 return(NULL);
28348}
28349static void des_xmlModulePtr(int no ATTRIBUTE_UNUSED, xmlModulePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
28350}
Daniel Veillardfc0b6f62005-01-09 17:48:02 +000028351#endif
28352
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000028353
28354static int
28355test_xmlModuleClose(void) {
28356 int test_ret = 0;
28357
28358#if defined(LIBXML_MODULES_ENABLED)
28359 int mem_base;
28360 int ret_val;
28361 xmlModulePtr module; /* the module handle */
28362 int n_module;
28363
28364 for (n_module = 0;n_module < gen_nb_xmlModulePtr;n_module++) {
28365 mem_base = xmlMemBlocks();
28366 module = gen_xmlModulePtr(n_module, 0);
28367
28368 ret_val = xmlModuleClose(module);
28369 desret_int(ret_val);
28370 call_tests++;
28371 des_xmlModulePtr(n_module, module, 0);
28372 xmlResetLastError();
28373 if (mem_base != xmlMemBlocks()) {
28374 printf("Leak of %d blocks found in xmlModuleClose",
28375 xmlMemBlocks() - mem_base);
28376 test_ret++;
28377 printf(" %d", n_module);
28378 printf("\n");
28379 }
28380 }
28381 function_tests++;
28382#endif
28383
28384 return(test_ret);
28385}
28386
28387
28388static int
28389test_xmlModuleOpen(void) {
28390 int test_ret = 0;
28391
28392
28393 /* missing type support */
28394 return(test_ret);
28395}
28396
28397
28398static int
28399test_xmlModuleSymbol(void) {
28400 int test_ret = 0;
28401
28402#if defined(LIBXML_MODULES_ENABLED)
28403 int mem_base;
Daniel Veillardbe076e92005-01-04 20:18:14 +000028404 int ret_val;
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000028405 xmlModulePtr module; /* the module */
28406 int n_module;
28407 char * name; /* the name of the symbol */
28408 int n_name;
Daniel Veillardbe076e92005-01-04 20:18:14 +000028409 void ** symbol; /* the resulting symbol address */
28410 int n_symbol;
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000028411
28412 for (n_module = 0;n_module < gen_nb_xmlModulePtr;n_module++) {
28413 for (n_name = 0;n_name < gen_nb_const_char_ptr;n_name++) {
Daniel Veillardbe076e92005-01-04 20:18:14 +000028414 for (n_symbol = 0;n_symbol < gen_nb_void_ptr_ptr;n_symbol++) {
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000028415 mem_base = xmlMemBlocks();
28416 module = gen_xmlModulePtr(n_module, 0);
28417 name = gen_const_char_ptr(n_name, 1);
Daniel Veillardbe076e92005-01-04 20:18:14 +000028418 symbol = gen_void_ptr_ptr(n_symbol, 2);
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000028419
Daniel Veillardbe076e92005-01-04 20:18:14 +000028420 ret_val = xmlModuleSymbol(module, (const char *)name, symbol);
28421 desret_int(ret_val);
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000028422 call_tests++;
28423 des_xmlModulePtr(n_module, module, 0);
28424 des_const_char_ptr(n_name, (const char *)name, 1);
Daniel Veillardbe076e92005-01-04 20:18:14 +000028425 des_void_ptr_ptr(n_symbol, symbol, 2);
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000028426 xmlResetLastError();
28427 if (mem_base != xmlMemBlocks()) {
28428 printf("Leak of %d blocks found in xmlModuleSymbol",
28429 xmlMemBlocks() - mem_base);
28430 test_ret++;
28431 printf(" %d", n_module);
28432 printf(" %d", n_name);
Daniel Veillardbe076e92005-01-04 20:18:14 +000028433 printf(" %d", n_symbol);
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000028434 printf("\n");
28435 }
28436 }
28437 }
Daniel Veillardbe076e92005-01-04 20:18:14 +000028438 }
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000028439 function_tests++;
28440#endif
28441
28442 return(test_ret);
28443}
28444
28445static int
28446test_xmlmodule(void) {
28447 int test_ret = 0;
28448
28449 if (quiet == 0) printf("Testing xmlmodule : 2 of 4 functions ...\n");
28450 test_ret += test_xmlModuleClose();
28451 test_ret += test_xmlModuleOpen();
28452 test_ret += test_xmlModuleSymbol();
28453
28454 if (test_ret != 0)
28455 printf("Module xmlmodule: %d errors\n", test_ret);
28456 return(test_ret);
28457}
28458
Daniel Veillardd93f6252004-11-02 15:53:51 +000028459static int
28460test_xmlNewTextReader(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028461 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028462
William M. Brack21e4ef22005-01-02 09:53:13 +000028463#if defined(LIBXML_READER_ENABLED)
Daniel Veillard34099b42004-11-04 17:34:35 +000028464 int mem_base;
28465 xmlTextReaderPtr ret_val;
28466 xmlParserInputBufferPtr input; /* the xmlParserInputBufferPtr used to read data */
28467 int n_input;
28468 const char * URI; /* the URI information for the source if available */
28469 int n_URI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028470
Daniel Veillard34099b42004-11-04 17:34:35 +000028471 for (n_input = 0;n_input < gen_nb_xmlParserInputBufferPtr;n_input++) {
28472 for (n_URI = 0;n_URI < gen_nb_filepath;n_URI++) {
28473 mem_base = xmlMemBlocks();
28474 input = gen_xmlParserInputBufferPtr(n_input, 0);
28475 URI = gen_filepath(n_URI, 1);
28476
28477 ret_val = xmlNewTextReader(input, URI);
28478 desret_xmlTextReaderPtr(ret_val);
28479 call_tests++;
28480 des_xmlParserInputBufferPtr(n_input, input, 0);
28481 des_filepath(n_URI, URI, 1);
28482 xmlResetLastError();
28483 if (mem_base != xmlMemBlocks()) {
28484 printf("Leak of %d blocks found in xmlNewTextReader",
28485 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028486 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000028487 printf(" %d", n_input);
28488 printf(" %d", n_URI);
28489 printf("\n");
28490 }
28491 }
28492 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028493 function_tests++;
Daniel Veillard34099b42004-11-04 17:34:35 +000028494#endif
28495
Daniel Veillard42595322004-11-08 10:52:06 +000028496 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028497}
28498
28499
28500static int
28501test_xmlNewTextReaderFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028502 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028503
William M. Brack21e4ef22005-01-02 09:53:13 +000028504#if defined(LIBXML_READER_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028505 int mem_base;
28506 xmlTextReaderPtr ret_val;
28507 const char * URI; /* the URI of the resource to process */
28508 int n_URI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028509
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028510 for (n_URI = 0;n_URI < gen_nb_filepath;n_URI++) {
28511 mem_base = xmlMemBlocks();
28512 URI = gen_filepath(n_URI, 0);
28513
28514 ret_val = xmlNewTextReaderFilename(URI);
28515 desret_xmlTextReaderPtr(ret_val);
28516 call_tests++;
28517 des_filepath(n_URI, URI, 0);
28518 xmlResetLastError();
28519 if (mem_base != xmlMemBlocks()) {
28520 printf("Leak of %d blocks found in xmlNewTextReaderFilename",
28521 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028522 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028523 printf(" %d", n_URI);
28524 printf("\n");
28525 }
28526 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028527 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028528#endif
28529
Daniel Veillard42595322004-11-08 10:52:06 +000028530 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028531}
28532
28533
28534static int
28535test_xmlReaderForDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028536 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028537
William M. Brack21e4ef22005-01-02 09:53:13 +000028538#if defined(LIBXML_READER_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028539 int mem_base;
28540 xmlTextReaderPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028541 xmlChar * cur; /* a pointer to a zero terminated string */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028542 int n_cur;
28543 const char * URL; /* the base URL to use for the document */
28544 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028545 char * encoding; /* the document encoding, or NULL */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028546 int n_encoding;
28547 int options; /* a combination of xmlParserOption */
28548 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028549
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028550 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
28551 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
28552 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000028553 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028554 mem_base = xmlMemBlocks();
28555 cur = gen_const_xmlChar_ptr(n_cur, 0);
28556 URL = gen_filepath(n_URL, 1);
28557 encoding = gen_const_char_ptr(n_encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000028558 options = gen_parseroptions(n_options, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028559
William M. Brackf13f77f2004-11-12 16:03:48 +000028560 ret_val = xmlReaderForDoc((const xmlChar *)cur, URL, (const char *)encoding, options);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028561 desret_xmlTextReaderPtr(ret_val);
28562 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000028563 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 0);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028564 des_filepath(n_URL, URL, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000028565 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000028566 des_parseroptions(n_options, options, 3);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028567 xmlResetLastError();
28568 if (mem_base != xmlMemBlocks()) {
28569 printf("Leak of %d blocks found in xmlReaderForDoc",
28570 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028571 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028572 printf(" %d", n_cur);
28573 printf(" %d", n_URL);
28574 printf(" %d", n_encoding);
28575 printf(" %d", n_options);
28576 printf("\n");
28577 }
28578 }
28579 }
28580 }
28581 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028582 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028583#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000028584
Daniel Veillard42595322004-11-08 10:52:06 +000028585 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028586}
28587
28588
28589static int
28590test_xmlReaderForFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028591 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028592
William M. Brack21e4ef22005-01-02 09:53:13 +000028593#if defined(LIBXML_READER_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028594 int mem_base;
28595 xmlTextReaderPtr ret_val;
28596 const char * filename; /* a file or URL */
28597 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028598 char * encoding; /* the document encoding, or NULL */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028599 int n_encoding;
28600 int options; /* a combination of xmlParserOption */
28601 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028602
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028603 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
28604 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000028605 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028606 mem_base = xmlMemBlocks();
28607 filename = gen_filepath(n_filename, 0);
28608 encoding = gen_const_char_ptr(n_encoding, 1);
Daniel Veillard6128c012004-11-08 17:16:15 +000028609 options = gen_parseroptions(n_options, 2);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028610
William M. Brackf13f77f2004-11-12 16:03:48 +000028611 ret_val = xmlReaderForFile(filename, (const char *)encoding, options);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028612 desret_xmlTextReaderPtr(ret_val);
28613 call_tests++;
28614 des_filepath(n_filename, filename, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000028615 des_const_char_ptr(n_encoding, (const char *)encoding, 1);
Daniel Veillard6128c012004-11-08 17:16:15 +000028616 des_parseroptions(n_options, options, 2);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028617 xmlResetLastError();
28618 if (mem_base != xmlMemBlocks()) {
28619 printf("Leak of %d blocks found in xmlReaderForFile",
28620 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028621 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028622 printf(" %d", n_filename);
28623 printf(" %d", n_encoding);
28624 printf(" %d", n_options);
28625 printf("\n");
28626 }
28627 }
28628 }
28629 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028630 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028631#endif
28632
Daniel Veillard42595322004-11-08 10:52:06 +000028633 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028634}
28635
28636
28637static int
28638test_xmlReaderForMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028639 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028640
William M. Brack21e4ef22005-01-02 09:53:13 +000028641#if defined(LIBXML_READER_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028642 int mem_base;
28643 xmlTextReaderPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028644 char * buffer; /* a pointer to a char array */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028645 int n_buffer;
28646 int size; /* the size of the array */
28647 int n_size;
28648 const char * URL; /* the base URL to use for the document */
28649 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028650 char * encoding; /* the document encoding, or NULL */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028651 int n_encoding;
28652 int options; /* a combination of xmlParserOption */
28653 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028654
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028655 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
28656 for (n_size = 0;n_size < gen_nb_int;n_size++) {
28657 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
28658 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000028659 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028660 mem_base = xmlMemBlocks();
28661 buffer = gen_const_char_ptr(n_buffer, 0);
28662 size = gen_int(n_size, 1);
28663 URL = gen_filepath(n_URL, 2);
28664 encoding = gen_const_char_ptr(n_encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000028665 options = gen_parseroptions(n_options, 4);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028666
William M. Brackf13f77f2004-11-12 16:03:48 +000028667 ret_val = xmlReaderForMemory((const char *)buffer, size, URL, (const char *)encoding, options);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028668 desret_xmlTextReaderPtr(ret_val);
28669 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000028670 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028671 des_int(n_size, size, 1);
28672 des_filepath(n_URL, URL, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000028673 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000028674 des_parseroptions(n_options, options, 4);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028675 xmlResetLastError();
28676 if (mem_base != xmlMemBlocks()) {
28677 printf("Leak of %d blocks found in xmlReaderForMemory",
28678 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028679 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028680 printf(" %d", n_buffer);
28681 printf(" %d", n_size);
28682 printf(" %d", n_URL);
28683 printf(" %d", n_encoding);
28684 printf(" %d", n_options);
28685 printf("\n");
28686 }
28687 }
28688 }
28689 }
28690 }
28691 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028692 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028693#endif
28694
Daniel Veillard42595322004-11-08 10:52:06 +000028695 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028696}
28697
28698
28699static int
28700test_xmlReaderNewDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028701 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028702
William M. Brack21e4ef22005-01-02 09:53:13 +000028703#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028704 int mem_base;
28705 int ret_val;
28706 xmlTextReaderPtr reader; /* an XML reader */
28707 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028708 xmlChar * cur; /* a pointer to a zero terminated string */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028709 int n_cur;
28710 const char * URL; /* the base URL to use for the document */
28711 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028712 char * encoding; /* the document encoding, or NULL */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028713 int n_encoding;
28714 int options; /* a combination of xmlParserOption */
28715 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028716
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028717 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28718 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
28719 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
28720 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000028721 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028722 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028723 reader = gen_xmlTextReaderPtr(n_reader, 0);
28724 cur = gen_const_xmlChar_ptr(n_cur, 1);
28725 URL = gen_filepath(n_URL, 2);
28726 encoding = gen_const_char_ptr(n_encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000028727 options = gen_parseroptions(n_options, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028728
William M. Brackf13f77f2004-11-12 16:03:48 +000028729 ret_val = xmlReaderNewDoc(reader, (const xmlChar *)cur, URL, (const char *)encoding, options);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028730 desret_int(ret_val);
28731 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028732 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000028733 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000028734 des_filepath(n_URL, URL, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000028735 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000028736 des_parseroptions(n_options, options, 4);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028737 xmlResetLastError();
28738 if (mem_base != xmlMemBlocks()) {
28739 printf("Leak of %d blocks found in xmlReaderNewDoc",
28740 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028741 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028742 printf(" %d", n_reader);
28743 printf(" %d", n_cur);
28744 printf(" %d", n_URL);
28745 printf(" %d", n_encoding);
28746 printf(" %d", n_options);
28747 printf("\n");
28748 }
28749 }
28750 }
28751 }
28752 }
28753 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028754 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028755#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000028756
Daniel Veillard42595322004-11-08 10:52:06 +000028757 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028758}
28759
28760
28761static int
28762test_xmlReaderNewFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028763 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028764
William M. Brack21e4ef22005-01-02 09:53:13 +000028765#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028766 int mem_base;
28767 int ret_val;
28768 xmlTextReaderPtr reader; /* an XML reader */
28769 int n_reader;
28770 const char * filename; /* a file or URL */
28771 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028772 char * encoding; /* the document encoding, or NULL */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028773 int n_encoding;
28774 int options; /* a combination of xmlParserOption */
28775 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028776
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028777 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28778 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
28779 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000028780 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028781 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028782 reader = gen_xmlTextReaderPtr(n_reader, 0);
28783 filename = gen_filepath(n_filename, 1);
28784 encoding = gen_const_char_ptr(n_encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000028785 options = gen_parseroptions(n_options, 3);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028786
William M. Brackf13f77f2004-11-12 16:03:48 +000028787 ret_val = xmlReaderNewFile(reader, filename, (const char *)encoding, options);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028788 desret_int(ret_val);
28789 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028790 des_xmlTextReaderPtr(n_reader, reader, 0);
28791 des_filepath(n_filename, filename, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000028792 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000028793 des_parseroptions(n_options, options, 3);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028794 xmlResetLastError();
28795 if (mem_base != xmlMemBlocks()) {
28796 printf("Leak of %d blocks found in xmlReaderNewFile",
28797 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028798 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028799 printf(" %d", n_reader);
28800 printf(" %d", n_filename);
28801 printf(" %d", n_encoding);
28802 printf(" %d", n_options);
28803 printf("\n");
28804 }
28805 }
28806 }
28807 }
28808 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028809 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028810#endif
28811
Daniel Veillard42595322004-11-08 10:52:06 +000028812 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028813}
28814
28815
28816static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000028817test_xmlReaderNewMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028818 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028819
William M. Brack21e4ef22005-01-02 09:53:13 +000028820#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028821 int mem_base;
28822 int ret_val;
28823 xmlTextReaderPtr reader; /* an XML reader */
28824 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028825 char * buffer; /* a pointer to a char array */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028826 int n_buffer;
28827 int size; /* the size of the array */
28828 int n_size;
28829 const char * URL; /* the base URL to use for the document */
28830 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028831 char * encoding; /* the document encoding, or NULL */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028832 int n_encoding;
28833 int options; /* a combination of xmlParserOption */
28834 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028835
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028836 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28837 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
28838 for (n_size = 0;n_size < gen_nb_int;n_size++) {
28839 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
28840 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000028841 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028842 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028843 reader = gen_xmlTextReaderPtr(n_reader, 0);
28844 buffer = gen_const_char_ptr(n_buffer, 1);
28845 size = gen_int(n_size, 2);
28846 URL = gen_filepath(n_URL, 3);
28847 encoding = gen_const_char_ptr(n_encoding, 4);
Daniel Veillard6128c012004-11-08 17:16:15 +000028848 options = gen_parseroptions(n_options, 5);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028849
William M. Brackf13f77f2004-11-12 16:03:48 +000028850 ret_val = xmlReaderNewMemory(reader, (const char *)buffer, size, URL, (const char *)encoding, options);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028851 desret_int(ret_val);
28852 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028853 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000028854 des_const_char_ptr(n_buffer, (const char *)buffer, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000028855 des_int(n_size, size, 2);
28856 des_filepath(n_URL, URL, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +000028857 des_const_char_ptr(n_encoding, (const char *)encoding, 4);
Daniel Veillard6128c012004-11-08 17:16:15 +000028858 des_parseroptions(n_options, options, 5);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028859 xmlResetLastError();
28860 if (mem_base != xmlMemBlocks()) {
28861 printf("Leak of %d blocks found in xmlReaderNewMemory",
28862 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028863 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028864 printf(" %d", n_reader);
28865 printf(" %d", n_buffer);
28866 printf(" %d", n_size);
28867 printf(" %d", n_URL);
28868 printf(" %d", n_encoding);
28869 printf(" %d", n_options);
28870 printf("\n");
28871 }
28872 }
28873 }
28874 }
28875 }
28876 }
28877 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028878 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028879#endif
28880
Daniel Veillard42595322004-11-08 10:52:06 +000028881 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028882}
28883
28884
28885static int
28886test_xmlReaderNewWalker(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028887 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028888
William M. Brack21e4ef22005-01-02 09:53:13 +000028889#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028890 int mem_base;
28891 int ret_val;
28892 xmlTextReaderPtr reader; /* an XML reader */
28893 int n_reader;
28894 xmlDocPtr doc; /* a preparsed document */
28895 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028896
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028897 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28898 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
28899 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028900 reader = gen_xmlTextReaderPtr(n_reader, 0);
28901 doc = gen_xmlDocPtr(n_doc, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028902
28903 ret_val = xmlReaderNewWalker(reader, doc);
28904 desret_int(ret_val);
28905 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028906 des_xmlTextReaderPtr(n_reader, reader, 0);
28907 des_xmlDocPtr(n_doc, doc, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028908 xmlResetLastError();
28909 if (mem_base != xmlMemBlocks()) {
28910 printf("Leak of %d blocks found in xmlReaderNewWalker",
28911 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028912 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028913 printf(" %d", n_reader);
28914 printf(" %d", n_doc);
28915 printf("\n");
28916 }
28917 }
28918 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028919 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028920#endif
28921
Daniel Veillard42595322004-11-08 10:52:06 +000028922 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028923}
28924
28925
28926static int
28927test_xmlReaderWalker(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028928 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028929
William M. Brack21e4ef22005-01-02 09:53:13 +000028930#if defined(LIBXML_READER_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028931 int mem_base;
28932 xmlTextReaderPtr ret_val;
28933 xmlDocPtr doc; /* a preparsed document */
28934 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028935
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028936 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
28937 mem_base = xmlMemBlocks();
28938 doc = gen_xmlDocPtr(n_doc, 0);
28939
28940 ret_val = xmlReaderWalker(doc);
28941 desret_xmlTextReaderPtr(ret_val);
28942 call_tests++;
28943 des_xmlDocPtr(n_doc, doc, 0);
28944 xmlResetLastError();
28945 if (mem_base != xmlMemBlocks()) {
28946 printf("Leak of %d blocks found in xmlReaderWalker",
28947 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028948 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028949 printf(" %d", n_doc);
28950 printf("\n");
28951 }
28952 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028953 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028954#endif
28955
Daniel Veillard42595322004-11-08 10:52:06 +000028956 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028957}
28958
28959
28960static int
28961test_xmlTextReaderAttributeCount(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028962 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028963
William M. Brack21e4ef22005-01-02 09:53:13 +000028964#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028965 int mem_base;
28966 int ret_val;
28967 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
28968 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028969
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028970 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28971 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028972 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028973
28974 ret_val = xmlTextReaderAttributeCount(reader);
28975 desret_int(ret_val);
28976 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028977 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028978 xmlResetLastError();
28979 if (mem_base != xmlMemBlocks()) {
28980 printf("Leak of %d blocks found in xmlTextReaderAttributeCount",
28981 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028982 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028983 printf(" %d", n_reader);
28984 printf("\n");
28985 }
28986 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028987 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028988#endif
28989
Daniel Veillard42595322004-11-08 10:52:06 +000028990 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028991}
28992
28993
28994static int
28995test_xmlTextReaderBaseUri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028996 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028997
William M. Brack21e4ef22005-01-02 09:53:13 +000028998#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028999 int mem_base;
29000 xmlChar * ret_val;
29001 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29002 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029003
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029004 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29005 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029006 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029007
29008 ret_val = xmlTextReaderBaseUri(reader);
29009 desret_xmlChar_ptr(ret_val);
29010 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029011 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029012 xmlResetLastError();
29013 if (mem_base != xmlMemBlocks()) {
29014 printf("Leak of %d blocks found in xmlTextReaderBaseUri",
29015 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029016 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029017 printf(" %d", n_reader);
29018 printf("\n");
29019 }
29020 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029021 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029022#endif
29023
Daniel Veillard42595322004-11-08 10:52:06 +000029024 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029025}
29026
29027
29028static int
29029test_xmlTextReaderClose(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029030 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029031
William M. Brack21e4ef22005-01-02 09:53:13 +000029032#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029033 int mem_base;
29034 int ret_val;
29035 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29036 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029037
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029038 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29039 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029040 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029041
29042 ret_val = xmlTextReaderClose(reader);
29043 desret_int(ret_val);
29044 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029045 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029046 xmlResetLastError();
29047 if (mem_base != xmlMemBlocks()) {
29048 printf("Leak of %d blocks found in xmlTextReaderClose",
29049 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029050 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029051 printf(" %d", n_reader);
29052 printf("\n");
29053 }
29054 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029055 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029056#endif
29057
Daniel Veillard42595322004-11-08 10:52:06 +000029058 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029059}
29060
29061
29062static int
29063test_xmlTextReaderConstBaseUri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029064 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029065
William M. Brack21e4ef22005-01-02 09:53:13 +000029066#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029067 int mem_base;
29068 const xmlChar * ret_val;
29069 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29070 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029071
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029072 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29073 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029074 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029075
29076 ret_val = xmlTextReaderConstBaseUri(reader);
29077 desret_const_xmlChar_ptr(ret_val);
29078 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029079 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029080 xmlResetLastError();
29081 if (mem_base != xmlMemBlocks()) {
29082 printf("Leak of %d blocks found in xmlTextReaderConstBaseUri",
29083 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029084 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029085 printf(" %d", n_reader);
29086 printf("\n");
29087 }
29088 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029089 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029090#endif
29091
Daniel Veillard42595322004-11-08 10:52:06 +000029092 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029093}
29094
29095
29096static int
29097test_xmlTextReaderConstEncoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029098 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029099
William M. Brack21e4ef22005-01-02 09:53:13 +000029100#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029101 int mem_base;
29102 const xmlChar * ret_val;
29103 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29104 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029105
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029106 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29107 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029108 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029109
29110 ret_val = xmlTextReaderConstEncoding(reader);
29111 desret_const_xmlChar_ptr(ret_val);
29112 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029113 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029114 xmlResetLastError();
29115 if (mem_base != xmlMemBlocks()) {
29116 printf("Leak of %d blocks found in xmlTextReaderConstEncoding",
29117 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029118 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029119 printf(" %d", n_reader);
29120 printf("\n");
29121 }
29122 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029123 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029124#endif
29125
Daniel Veillard42595322004-11-08 10:52:06 +000029126 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029127}
29128
29129
29130static int
29131test_xmlTextReaderConstLocalName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029132 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029133
William M. Brack21e4ef22005-01-02 09:53:13 +000029134#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029135 int mem_base;
29136 const xmlChar * ret_val;
29137 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29138 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029139
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029140 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29141 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029142 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029143
29144 ret_val = xmlTextReaderConstLocalName(reader);
29145 desret_const_xmlChar_ptr(ret_val);
29146 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029147 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029148 xmlResetLastError();
29149 if (mem_base != xmlMemBlocks()) {
29150 printf("Leak of %d blocks found in xmlTextReaderConstLocalName",
29151 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029152 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029153 printf(" %d", n_reader);
29154 printf("\n");
29155 }
29156 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029157 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029158#endif
29159
Daniel Veillard42595322004-11-08 10:52:06 +000029160 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029161}
29162
29163
29164static int
29165test_xmlTextReaderConstName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029166 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029167
William M. Brack21e4ef22005-01-02 09:53:13 +000029168#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029169 int mem_base;
29170 const xmlChar * ret_val;
29171 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29172 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029173
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029174 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29175 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029176 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029177
29178 ret_val = xmlTextReaderConstName(reader);
29179 desret_const_xmlChar_ptr(ret_val);
29180 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029181 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029182 xmlResetLastError();
29183 if (mem_base != xmlMemBlocks()) {
29184 printf("Leak of %d blocks found in xmlTextReaderConstName",
29185 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029186 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029187 printf(" %d", n_reader);
29188 printf("\n");
29189 }
29190 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029191 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029192#endif
29193
Daniel Veillard42595322004-11-08 10:52:06 +000029194 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029195}
29196
29197
29198static int
29199test_xmlTextReaderConstNamespaceUri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029200 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029201
William M. Brack21e4ef22005-01-02 09:53:13 +000029202#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029203 int mem_base;
29204 const xmlChar * ret_val;
29205 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29206 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029207
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029208 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29209 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029210 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029211
29212 ret_val = xmlTextReaderConstNamespaceUri(reader);
29213 desret_const_xmlChar_ptr(ret_val);
29214 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029215 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029216 xmlResetLastError();
29217 if (mem_base != xmlMemBlocks()) {
29218 printf("Leak of %d blocks found in xmlTextReaderConstNamespaceUri",
29219 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029220 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029221 printf(" %d", n_reader);
29222 printf("\n");
29223 }
29224 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029225 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029226#endif
29227
Daniel Veillard42595322004-11-08 10:52:06 +000029228 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029229}
29230
29231
29232static int
29233test_xmlTextReaderConstPrefix(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029234 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029235
William M. Brack21e4ef22005-01-02 09:53:13 +000029236#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029237 int mem_base;
29238 const xmlChar * ret_val;
29239 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29240 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029241
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029242 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29243 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029244 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029245
29246 ret_val = xmlTextReaderConstPrefix(reader);
29247 desret_const_xmlChar_ptr(ret_val);
29248 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029249 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029250 xmlResetLastError();
29251 if (mem_base != xmlMemBlocks()) {
29252 printf("Leak of %d blocks found in xmlTextReaderConstPrefix",
29253 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029254 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029255 printf(" %d", n_reader);
29256 printf("\n");
29257 }
29258 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029259 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029260#endif
29261
Daniel Veillard42595322004-11-08 10:52:06 +000029262 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029263}
29264
29265
29266static int
29267test_xmlTextReaderConstString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029268 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029269
William M. Brack21e4ef22005-01-02 09:53:13 +000029270#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029271 int mem_base;
29272 const xmlChar * ret_val;
29273 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29274 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000029275 xmlChar * str; /* the string to intern. */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029276 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029277
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029278 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29279 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
29280 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029281 reader = gen_xmlTextReaderPtr(n_reader, 0);
29282 str = gen_const_xmlChar_ptr(n_str, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029283
William M. Brackf13f77f2004-11-12 16:03:48 +000029284 ret_val = xmlTextReaderConstString(reader, (const xmlChar *)str);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029285 desret_const_xmlChar_ptr(ret_val);
29286 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029287 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000029288 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029289 xmlResetLastError();
29290 if (mem_base != xmlMemBlocks()) {
29291 printf("Leak of %d blocks found in xmlTextReaderConstString",
29292 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029293 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029294 printf(" %d", n_reader);
29295 printf(" %d", n_str);
29296 printf("\n");
29297 }
29298 }
29299 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029300 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029301#endif
29302
Daniel Veillard42595322004-11-08 10:52:06 +000029303 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029304}
29305
29306
29307static int
29308test_xmlTextReaderConstValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029309 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029310
William M. Brack21e4ef22005-01-02 09:53:13 +000029311#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029312 int mem_base;
29313 const xmlChar * ret_val;
29314 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29315 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029316
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029317 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29318 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029319 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029320
29321 ret_val = xmlTextReaderConstValue(reader);
29322 desret_const_xmlChar_ptr(ret_val);
29323 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029324 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029325 xmlResetLastError();
29326 if (mem_base != xmlMemBlocks()) {
29327 printf("Leak of %d blocks found in xmlTextReaderConstValue",
29328 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029329 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029330 printf(" %d", n_reader);
29331 printf("\n");
29332 }
29333 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029334 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029335#endif
29336
Daniel Veillard42595322004-11-08 10:52:06 +000029337 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029338}
29339
29340
29341static int
29342test_xmlTextReaderConstXmlLang(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029343 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029344
William M. Brack21e4ef22005-01-02 09:53:13 +000029345#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029346 int mem_base;
29347 const xmlChar * ret_val;
29348 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29349 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029350
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029351 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29352 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029353 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029354
29355 ret_val = xmlTextReaderConstXmlLang(reader);
29356 desret_const_xmlChar_ptr(ret_val);
29357 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029358 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029359 xmlResetLastError();
29360 if (mem_base != xmlMemBlocks()) {
29361 printf("Leak of %d blocks found in xmlTextReaderConstXmlLang",
29362 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029363 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029364 printf(" %d", n_reader);
29365 printf("\n");
29366 }
29367 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029368 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029369#endif
29370
Daniel Veillard42595322004-11-08 10:52:06 +000029371 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029372}
29373
29374
29375static int
29376test_xmlTextReaderConstXmlVersion(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029377 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029378
William M. Brack21e4ef22005-01-02 09:53:13 +000029379#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029380 int mem_base;
29381 const xmlChar * ret_val;
29382 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29383 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029384
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029385 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29386 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029387 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029388
29389 ret_val = xmlTextReaderConstXmlVersion(reader);
29390 desret_const_xmlChar_ptr(ret_val);
29391 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029392 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029393 xmlResetLastError();
29394 if (mem_base != xmlMemBlocks()) {
29395 printf("Leak of %d blocks found in xmlTextReaderConstXmlVersion",
29396 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029397 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029398 printf(" %d", n_reader);
29399 printf("\n");
29400 }
29401 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029402 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029403#endif
29404
Daniel Veillard42595322004-11-08 10:52:06 +000029405 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029406}
29407
29408
29409static int
29410test_xmlTextReaderCurrentDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029411 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029412
William M. Brack21e4ef22005-01-02 09:53:13 +000029413#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029414 int mem_base;
29415 xmlDocPtr ret_val;
29416 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29417 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029418
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029419 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29420 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029421 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029422
29423 ret_val = xmlTextReaderCurrentDoc(reader);
29424 desret_xmlDocPtr(ret_val);
29425 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029426 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029427 xmlResetLastError();
29428 if (mem_base != xmlMemBlocks()) {
29429 printf("Leak of %d blocks found in xmlTextReaderCurrentDoc",
29430 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029431 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029432 printf(" %d", n_reader);
29433 printf("\n");
29434 }
29435 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029436 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029437#endif
29438
Daniel Veillard42595322004-11-08 10:52:06 +000029439 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029440}
29441
29442
29443static int
29444test_xmlTextReaderCurrentNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029445 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029446
William M. Brack21e4ef22005-01-02 09:53:13 +000029447#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029448 int mem_base;
29449 xmlNodePtr ret_val;
29450 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29451 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029452
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029453 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29454 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029455 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029456
29457 ret_val = xmlTextReaderCurrentNode(reader);
29458 desret_xmlNodePtr(ret_val);
29459 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029460 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029461 xmlResetLastError();
29462 if (mem_base != xmlMemBlocks()) {
29463 printf("Leak of %d blocks found in xmlTextReaderCurrentNode",
29464 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029465 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029466 printf(" %d", n_reader);
29467 printf("\n");
29468 }
29469 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029470 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029471#endif
29472
Daniel Veillard42595322004-11-08 10:52:06 +000029473 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029474}
29475
29476
29477static int
29478test_xmlTextReaderDepth(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029479 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029480
William M. Brack21e4ef22005-01-02 09:53:13 +000029481#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029482 int mem_base;
29483 int ret_val;
29484 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29485 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029486
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029487 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29488 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029489 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029490
29491 ret_val = xmlTextReaderDepth(reader);
29492 desret_int(ret_val);
29493 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029494 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029495 xmlResetLastError();
29496 if (mem_base != xmlMemBlocks()) {
29497 printf("Leak of %d blocks found in xmlTextReaderDepth",
29498 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029499 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029500 printf(" %d", n_reader);
29501 printf("\n");
29502 }
29503 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029504 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029505#endif
29506
Daniel Veillard42595322004-11-08 10:52:06 +000029507 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029508}
29509
29510
29511static int
29512test_xmlTextReaderExpand(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029513 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029514
William M. Brack21e4ef22005-01-02 09:53:13 +000029515#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029516 int mem_base;
29517 xmlNodePtr ret_val;
29518 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29519 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029520
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029521 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29522 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029523 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029524
29525 ret_val = xmlTextReaderExpand(reader);
29526 desret_xmlNodePtr(ret_val);
29527 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029528 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029529 xmlResetLastError();
29530 if (mem_base != xmlMemBlocks()) {
29531 printf("Leak of %d blocks found in xmlTextReaderExpand",
29532 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029533 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029534 printf(" %d", n_reader);
29535 printf("\n");
29536 }
29537 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029538 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029539#endif
29540
Daniel Veillard42595322004-11-08 10:52:06 +000029541 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029542}
29543
29544
29545static int
29546test_xmlTextReaderGetAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029547 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029548
William M. Brack21e4ef22005-01-02 09:53:13 +000029549#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029550 int mem_base;
29551 xmlChar * ret_val;
29552 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29553 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000029554 xmlChar * name; /* the qualified name of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029555 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029556
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029557 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29558 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
29559 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029560 reader = gen_xmlTextReaderPtr(n_reader, 0);
29561 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029562
William M. Brackf13f77f2004-11-12 16:03:48 +000029563 ret_val = xmlTextReaderGetAttribute(reader, (const xmlChar *)name);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029564 desret_xmlChar_ptr(ret_val);
29565 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029566 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000029567 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029568 xmlResetLastError();
29569 if (mem_base != xmlMemBlocks()) {
29570 printf("Leak of %d blocks found in xmlTextReaderGetAttribute",
29571 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029572 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029573 printf(" %d", n_reader);
29574 printf(" %d", n_name);
29575 printf("\n");
29576 }
29577 }
29578 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029579 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029580#endif
29581
Daniel Veillard42595322004-11-08 10:52:06 +000029582 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029583}
29584
29585
29586static int
29587test_xmlTextReaderGetAttributeNo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029588 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029589
William M. Brack21e4ef22005-01-02 09:53:13 +000029590#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029591 int mem_base;
29592 xmlChar * ret_val;
29593 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29594 int n_reader;
29595 int no; /* the zero-based index of the attribute relative to the containing element */
29596 int n_no;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029597
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029598 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29599 for (n_no = 0;n_no < gen_nb_int;n_no++) {
29600 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029601 reader = gen_xmlTextReaderPtr(n_reader, 0);
29602 no = gen_int(n_no, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029603
29604 ret_val = xmlTextReaderGetAttributeNo(reader, no);
29605 desret_xmlChar_ptr(ret_val);
29606 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029607 des_xmlTextReaderPtr(n_reader, reader, 0);
29608 des_int(n_no, no, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029609 xmlResetLastError();
29610 if (mem_base != xmlMemBlocks()) {
29611 printf("Leak of %d blocks found in xmlTextReaderGetAttributeNo",
29612 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029613 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029614 printf(" %d", n_reader);
29615 printf(" %d", n_no);
29616 printf("\n");
29617 }
29618 }
29619 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029620 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029621#endif
29622
Daniel Veillard42595322004-11-08 10:52:06 +000029623 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029624}
29625
29626
29627static int
29628test_xmlTextReaderGetAttributeNs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029629 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029630
William M. Brack21e4ef22005-01-02 09:53:13 +000029631#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029632 int mem_base;
29633 xmlChar * ret_val;
29634 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29635 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000029636 xmlChar * localName; /* the local name of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029637 int n_localName;
Daniel Veillardce682bc2004-11-05 17:22:25 +000029638 xmlChar * namespaceURI; /* the namespace URI of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029639 int n_namespaceURI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029640
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029641 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29642 for (n_localName = 0;n_localName < gen_nb_const_xmlChar_ptr;n_localName++) {
29643 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
29644 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029645 reader = gen_xmlTextReaderPtr(n_reader, 0);
29646 localName = gen_const_xmlChar_ptr(n_localName, 1);
29647 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029648
William M. Brackf13f77f2004-11-12 16:03:48 +000029649 ret_val = xmlTextReaderGetAttributeNs(reader, (const xmlChar *)localName, (const xmlChar *)namespaceURI);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029650 desret_xmlChar_ptr(ret_val);
29651 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029652 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000029653 des_const_xmlChar_ptr(n_localName, (const xmlChar *)localName, 1);
29654 des_const_xmlChar_ptr(n_namespaceURI, (const xmlChar *)namespaceURI, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029655 xmlResetLastError();
29656 if (mem_base != xmlMemBlocks()) {
29657 printf("Leak of %d blocks found in xmlTextReaderGetAttributeNs",
29658 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029659 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029660 printf(" %d", n_reader);
29661 printf(" %d", n_localName);
29662 printf(" %d", n_namespaceURI);
29663 printf("\n");
29664 }
29665 }
29666 }
29667 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029668 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029669#endif
29670
Daniel Veillard42595322004-11-08 10:52:06 +000029671 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029672}
29673
Daniel Veillarda521d282004-11-09 14:59:59 +000029674#ifdef LIBXML_READER_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000029675
Daniel Veillardce682bc2004-11-05 17:22:25 +000029676#define gen_nb_xmlTextReaderErrorFunc_ptr 1
29677static xmlTextReaderErrorFunc * gen_xmlTextReaderErrorFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
29678 return(NULL);
29679}
29680static void des_xmlTextReaderErrorFunc_ptr(int no ATTRIBUTE_UNUSED, xmlTextReaderErrorFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
29681}
Daniel Veillarda521d282004-11-09 14:59:59 +000029682#endif
29683
Daniel Veillardce682bc2004-11-05 17:22:25 +000029684
Daniel Veillardd93f6252004-11-02 15:53:51 +000029685static int
29686test_xmlTextReaderGetErrorHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029687 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029688
William M. Brack21e4ef22005-01-02 09:53:13 +000029689#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029690 int mem_base;
29691 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29692 int n_reader;
29693 xmlTextReaderErrorFunc * f; /* the callback function or NULL is no callback has been registered */
29694 int n_f;
29695 void ** arg; /* a user argument */
29696 int n_arg;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029697
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029698 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29699 for (n_f = 0;n_f < gen_nb_xmlTextReaderErrorFunc_ptr;n_f++) {
29700 for (n_arg = 0;n_arg < gen_nb_void_ptr_ptr;n_arg++) {
29701 mem_base = xmlMemBlocks();
29702 reader = gen_xmlTextReaderPtr(n_reader, 0);
29703 f = gen_xmlTextReaderErrorFunc_ptr(n_f, 1);
29704 arg = gen_void_ptr_ptr(n_arg, 2);
29705
29706 xmlTextReaderGetErrorHandler(reader, f, arg);
29707 call_tests++;
29708 des_xmlTextReaderPtr(n_reader, reader, 0);
29709 des_xmlTextReaderErrorFunc_ptr(n_f, f, 1);
29710 des_void_ptr_ptr(n_arg, arg, 2);
29711 xmlResetLastError();
29712 if (mem_base != xmlMemBlocks()) {
29713 printf("Leak of %d blocks found in xmlTextReaderGetErrorHandler",
29714 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029715 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029716 printf(" %d", n_reader);
29717 printf(" %d", n_f);
29718 printf(" %d", n_arg);
29719 printf("\n");
29720 }
29721 }
29722 }
29723 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029724 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029725#endif
29726
Daniel Veillard42595322004-11-08 10:52:06 +000029727 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029728}
29729
29730
29731static int
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000029732test_xmlTextReaderGetParserColumnNumber(void) {
29733 int test_ret = 0;
29734
29735#if defined(LIBXML_READER_ENABLED)
29736 int mem_base;
29737 int ret_val;
29738 xmlTextReaderPtr reader; /* the user data (XML reader context) */
29739 int n_reader;
29740
29741 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29742 mem_base = xmlMemBlocks();
29743 reader = gen_xmlTextReaderPtr(n_reader, 0);
29744
29745 ret_val = xmlTextReaderGetParserColumnNumber(reader);
29746 desret_int(ret_val);
29747 call_tests++;
29748 des_xmlTextReaderPtr(n_reader, reader, 0);
29749 xmlResetLastError();
29750 if (mem_base != xmlMemBlocks()) {
29751 printf("Leak of %d blocks found in xmlTextReaderGetParserColumnNumber",
29752 xmlMemBlocks() - mem_base);
29753 test_ret++;
29754 printf(" %d", n_reader);
29755 printf("\n");
29756 }
29757 }
29758 function_tests++;
29759#endif
29760
29761 return(test_ret);
29762}
29763
29764
29765static int
29766test_xmlTextReaderGetParserLineNumber(void) {
29767 int test_ret = 0;
29768
29769#if defined(LIBXML_READER_ENABLED)
29770 int mem_base;
29771 int ret_val;
29772 xmlTextReaderPtr reader; /* the user data (XML reader context) */
29773 int n_reader;
29774
29775 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29776 mem_base = xmlMemBlocks();
29777 reader = gen_xmlTextReaderPtr(n_reader, 0);
29778
29779 ret_val = xmlTextReaderGetParserLineNumber(reader);
29780 desret_int(ret_val);
29781 call_tests++;
29782 des_xmlTextReaderPtr(n_reader, reader, 0);
29783 xmlResetLastError();
29784 if (mem_base != xmlMemBlocks()) {
29785 printf("Leak of %d blocks found in xmlTextReaderGetParserLineNumber",
29786 xmlMemBlocks() - mem_base);
29787 test_ret++;
29788 printf(" %d", n_reader);
29789 printf("\n");
29790 }
29791 }
29792 function_tests++;
29793#endif
29794
29795 return(test_ret);
29796}
29797
29798
29799static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000029800test_xmlTextReaderGetParserProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029801 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029802
William M. Brack21e4ef22005-01-02 09:53:13 +000029803#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029804 int mem_base;
29805 int ret_val;
29806 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29807 int n_reader;
29808 int prop; /* the xmlParserProperties to get */
29809 int n_prop;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029810
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029811 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29812 for (n_prop = 0;n_prop < gen_nb_int;n_prop++) {
29813 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029814 reader = gen_xmlTextReaderPtr(n_reader, 0);
29815 prop = gen_int(n_prop, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029816
29817 ret_val = xmlTextReaderGetParserProp(reader, prop);
29818 desret_int(ret_val);
29819 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029820 des_xmlTextReaderPtr(n_reader, reader, 0);
29821 des_int(n_prop, prop, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029822 xmlResetLastError();
29823 if (mem_base != xmlMemBlocks()) {
29824 printf("Leak of %d blocks found in xmlTextReaderGetParserProp",
29825 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029826 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029827 printf(" %d", n_reader);
29828 printf(" %d", n_prop);
29829 printf("\n");
29830 }
29831 }
29832 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029833 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029834#endif
29835
Daniel Veillard42595322004-11-08 10:52:06 +000029836 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029837}
29838
29839
29840static int
29841test_xmlTextReaderGetRemainder(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029842 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029843
William M. Brack21e4ef22005-01-02 09:53:13 +000029844#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029845 int mem_base;
29846 xmlParserInputBufferPtr ret_val;
29847 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29848 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029849
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029850 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29851 mem_base = xmlMemBlocks();
29852 reader = gen_xmlTextReaderPtr(n_reader, 0);
29853
29854 ret_val = xmlTextReaderGetRemainder(reader);
29855 desret_xmlParserInputBufferPtr(ret_val);
29856 call_tests++;
29857 des_xmlTextReaderPtr(n_reader, reader, 0);
29858 xmlResetLastError();
29859 if (mem_base != xmlMemBlocks()) {
29860 printf("Leak of %d blocks found in xmlTextReaderGetRemainder",
29861 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029862 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029863 printf(" %d", n_reader);
29864 printf("\n");
29865 }
29866 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029867 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029868#endif
29869
Daniel Veillard42595322004-11-08 10:52:06 +000029870 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029871}
29872
29873
29874static int
29875test_xmlTextReaderHasAttributes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029876 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029877
William M. Brack21e4ef22005-01-02 09:53:13 +000029878#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029879 int mem_base;
29880 int ret_val;
29881 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29882 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029883
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029884 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29885 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029886 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029887
29888 ret_val = xmlTextReaderHasAttributes(reader);
29889 desret_int(ret_val);
29890 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029891 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029892 xmlResetLastError();
29893 if (mem_base != xmlMemBlocks()) {
29894 printf("Leak of %d blocks found in xmlTextReaderHasAttributes",
29895 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029896 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029897 printf(" %d", n_reader);
29898 printf("\n");
29899 }
29900 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029901 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029902#endif
29903
Daniel Veillard42595322004-11-08 10:52:06 +000029904 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029905}
29906
29907
29908static int
29909test_xmlTextReaderHasValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029910 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029911
William M. Brack21e4ef22005-01-02 09:53:13 +000029912#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029913 int mem_base;
29914 int ret_val;
29915 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29916 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029917
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029918 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29919 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029920 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029921
29922 ret_val = xmlTextReaderHasValue(reader);
29923 desret_int(ret_val);
29924 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029925 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029926 xmlResetLastError();
29927 if (mem_base != xmlMemBlocks()) {
29928 printf("Leak of %d blocks found in xmlTextReaderHasValue",
29929 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029930 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029931 printf(" %d", n_reader);
29932 printf("\n");
29933 }
29934 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029935 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029936#endif
29937
Daniel Veillard42595322004-11-08 10:52:06 +000029938 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029939}
29940
29941
29942static int
29943test_xmlTextReaderIsDefault(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029944 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029945
William M. Brack21e4ef22005-01-02 09:53:13 +000029946#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029947 int mem_base;
29948 int ret_val;
29949 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29950 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029951
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029952 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29953 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029954 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029955
29956 ret_val = xmlTextReaderIsDefault(reader);
29957 desret_int(ret_val);
29958 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029959 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029960 xmlResetLastError();
29961 if (mem_base != xmlMemBlocks()) {
29962 printf("Leak of %d blocks found in xmlTextReaderIsDefault",
29963 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029964 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029965 printf(" %d", n_reader);
29966 printf("\n");
29967 }
29968 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029969 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029970#endif
29971
Daniel Veillard42595322004-11-08 10:52:06 +000029972 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029973}
29974
29975
29976static int
29977test_xmlTextReaderIsEmptyElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029978 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029979
William M. Brack21e4ef22005-01-02 09:53:13 +000029980#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029981 int mem_base;
29982 int ret_val;
29983 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29984 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029985
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029986 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29987 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029988 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029989
29990 ret_val = xmlTextReaderIsEmptyElement(reader);
29991 desret_int(ret_val);
29992 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029993 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029994 xmlResetLastError();
29995 if (mem_base != xmlMemBlocks()) {
29996 printf("Leak of %d blocks found in xmlTextReaderIsEmptyElement",
29997 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029998 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029999 printf(" %d", n_reader);
30000 printf("\n");
30001 }
30002 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030003 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030004#endif
30005
Daniel Veillard42595322004-11-08 10:52:06 +000030006 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030007}
30008
30009
30010static int
30011test_xmlTextReaderIsNamespaceDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030012 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030013
William M. Brack21e4ef22005-01-02 09:53:13 +000030014#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030015 int mem_base;
30016 int ret_val;
30017 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30018 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030019
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030020 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30021 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030022 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030023
30024 ret_val = xmlTextReaderIsNamespaceDecl(reader);
30025 desret_int(ret_val);
30026 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030027 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030028 xmlResetLastError();
30029 if (mem_base != xmlMemBlocks()) {
30030 printf("Leak of %d blocks found in xmlTextReaderIsNamespaceDecl",
30031 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030032 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030033 printf(" %d", n_reader);
30034 printf("\n");
30035 }
30036 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030037 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030038#endif
30039
Daniel Veillard42595322004-11-08 10:52:06 +000030040 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030041}
30042
30043
30044static int
30045test_xmlTextReaderIsValid(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030046 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030047
William M. Brack21e4ef22005-01-02 09:53:13 +000030048#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030049 int mem_base;
30050 int ret_val;
30051 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30052 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030053
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030054 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30055 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030056 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030057
30058 ret_val = xmlTextReaderIsValid(reader);
30059 desret_int(ret_val);
30060 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030061 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030062 xmlResetLastError();
30063 if (mem_base != xmlMemBlocks()) {
30064 printf("Leak of %d blocks found in xmlTextReaderIsValid",
30065 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030066 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030067 printf(" %d", n_reader);
30068 printf("\n");
30069 }
30070 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030071 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030072#endif
30073
Daniel Veillard42595322004-11-08 10:52:06 +000030074 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030075}
30076
30077
30078static int
30079test_xmlTextReaderLocalName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030080 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030081
William M. Brack21e4ef22005-01-02 09:53:13 +000030082#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030083 int mem_base;
30084 xmlChar * ret_val;
30085 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30086 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030087
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030088 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30089 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030090 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030091
30092 ret_val = xmlTextReaderLocalName(reader);
30093 desret_xmlChar_ptr(ret_val);
30094 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030095 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030096 xmlResetLastError();
30097 if (mem_base != xmlMemBlocks()) {
30098 printf("Leak of %d blocks found in xmlTextReaderLocalName",
30099 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030100 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030101 printf(" %d", n_reader);
30102 printf("\n");
30103 }
30104 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030105 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030106#endif
30107
Daniel Veillard42595322004-11-08 10:52:06 +000030108 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030109}
30110
Daniel Veillarda521d282004-11-09 14:59:59 +000030111#ifdef LIBXML_READER_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000030112
Daniel Veillardce682bc2004-11-05 17:22:25 +000030113#define gen_nb_xmlTextReaderLocatorPtr 1
30114static xmlTextReaderLocatorPtr gen_xmlTextReaderLocatorPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
30115 return(NULL);
30116}
30117static void des_xmlTextReaderLocatorPtr(int no ATTRIBUTE_UNUSED, xmlTextReaderLocatorPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
30118}
Daniel Veillarda521d282004-11-09 14:59:59 +000030119#endif
30120
Daniel Veillardce682bc2004-11-05 17:22:25 +000030121
Daniel Veillardd93f6252004-11-02 15:53:51 +000030122static int
30123test_xmlTextReaderLocatorBaseURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030124 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030125
William M. Brack21e4ef22005-01-02 09:53:13 +000030126#if defined(LIBXML_READER_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000030127 int mem_base;
30128 xmlChar * ret_val;
30129 xmlTextReaderLocatorPtr locator; /* the xmlTextReaderLocatorPtr used */
30130 int n_locator;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030131
Daniel Veillardce682bc2004-11-05 17:22:25 +000030132 for (n_locator = 0;n_locator < gen_nb_xmlTextReaderLocatorPtr;n_locator++) {
30133 mem_base = xmlMemBlocks();
30134 locator = gen_xmlTextReaderLocatorPtr(n_locator, 0);
30135
30136 ret_val = xmlTextReaderLocatorBaseURI(locator);
30137 desret_xmlChar_ptr(ret_val);
30138 call_tests++;
30139 des_xmlTextReaderLocatorPtr(n_locator, locator, 0);
30140 xmlResetLastError();
30141 if (mem_base != xmlMemBlocks()) {
30142 printf("Leak of %d blocks found in xmlTextReaderLocatorBaseURI",
30143 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030144 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030145 printf(" %d", n_locator);
30146 printf("\n");
30147 }
30148 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030149 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030150#endif
30151
Daniel Veillard42595322004-11-08 10:52:06 +000030152 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030153}
30154
30155
30156static int
30157test_xmlTextReaderLocatorLineNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030158 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030159
William M. Brack21e4ef22005-01-02 09:53:13 +000030160#if defined(LIBXML_READER_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000030161 int mem_base;
30162 int ret_val;
30163 xmlTextReaderLocatorPtr locator; /* the xmlTextReaderLocatorPtr used */
30164 int n_locator;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030165
Daniel Veillardce682bc2004-11-05 17:22:25 +000030166 for (n_locator = 0;n_locator < gen_nb_xmlTextReaderLocatorPtr;n_locator++) {
30167 mem_base = xmlMemBlocks();
30168 locator = gen_xmlTextReaderLocatorPtr(n_locator, 0);
30169
30170 ret_val = xmlTextReaderLocatorLineNumber(locator);
30171 desret_int(ret_val);
30172 call_tests++;
30173 des_xmlTextReaderLocatorPtr(n_locator, locator, 0);
30174 xmlResetLastError();
30175 if (mem_base != xmlMemBlocks()) {
30176 printf("Leak of %d blocks found in xmlTextReaderLocatorLineNumber",
30177 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030178 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030179 printf(" %d", n_locator);
30180 printf("\n");
30181 }
30182 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030183 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030184#endif
30185
Daniel Veillard42595322004-11-08 10:52:06 +000030186 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030187}
30188
30189
30190static int
30191test_xmlTextReaderLookupNamespace(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030192 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030193
William M. Brack21e4ef22005-01-02 09:53:13 +000030194#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030195 int mem_base;
30196 xmlChar * ret_val;
30197 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30198 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030199 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 +000030200 int n_prefix;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030201
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030202 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30203 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
30204 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030205 reader = gen_xmlTextReaderPtr(n_reader, 0);
30206 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030207
William M. Brackf13f77f2004-11-12 16:03:48 +000030208 ret_val = xmlTextReaderLookupNamespace(reader, (const xmlChar *)prefix);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030209 desret_xmlChar_ptr(ret_val);
30210 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030211 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000030212 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030213 xmlResetLastError();
30214 if (mem_base != xmlMemBlocks()) {
30215 printf("Leak of %d blocks found in xmlTextReaderLookupNamespace",
30216 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030217 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030218 printf(" %d", n_reader);
30219 printf(" %d", n_prefix);
30220 printf("\n");
30221 }
30222 }
30223 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030224 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030225#endif
30226
Daniel Veillard42595322004-11-08 10:52:06 +000030227 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030228}
30229
30230
30231static int
30232test_xmlTextReaderMoveToAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030233 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030234
William M. Brack21e4ef22005-01-02 09:53:13 +000030235#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030236 int mem_base;
30237 int ret_val;
30238 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30239 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030240 xmlChar * name; /* the qualified name of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030241 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030242
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030243 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30244 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
30245 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030246 reader = gen_xmlTextReaderPtr(n_reader, 0);
30247 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030248
William M. Brackf13f77f2004-11-12 16:03:48 +000030249 ret_val = xmlTextReaderMoveToAttribute(reader, (const xmlChar *)name);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030250 desret_int(ret_val);
30251 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030252 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000030253 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030254 xmlResetLastError();
30255 if (mem_base != xmlMemBlocks()) {
30256 printf("Leak of %d blocks found in xmlTextReaderMoveToAttribute",
30257 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030258 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030259 printf(" %d", n_reader);
30260 printf(" %d", n_name);
30261 printf("\n");
30262 }
30263 }
30264 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030265 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030266#endif
30267
Daniel Veillard42595322004-11-08 10:52:06 +000030268 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030269}
30270
30271
30272static int
30273test_xmlTextReaderMoveToAttributeNo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030274 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030275
William M. Brack21e4ef22005-01-02 09:53:13 +000030276#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030277 int mem_base;
30278 int ret_val;
30279 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30280 int n_reader;
30281 int no; /* the zero-based index of the attribute relative to the containing element. */
30282 int n_no;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030283
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030284 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30285 for (n_no = 0;n_no < gen_nb_int;n_no++) {
30286 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030287 reader = gen_xmlTextReaderPtr(n_reader, 0);
30288 no = gen_int(n_no, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030289
30290 ret_val = xmlTextReaderMoveToAttributeNo(reader, no);
30291 desret_int(ret_val);
30292 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030293 des_xmlTextReaderPtr(n_reader, reader, 0);
30294 des_int(n_no, no, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030295 xmlResetLastError();
30296 if (mem_base != xmlMemBlocks()) {
30297 printf("Leak of %d blocks found in xmlTextReaderMoveToAttributeNo",
30298 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030299 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030300 printf(" %d", n_reader);
30301 printf(" %d", n_no);
30302 printf("\n");
30303 }
30304 }
30305 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030306 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030307#endif
30308
Daniel Veillard42595322004-11-08 10:52:06 +000030309 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030310}
30311
30312
30313static int
30314test_xmlTextReaderMoveToAttributeNs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030315 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030316
William M. Brack21e4ef22005-01-02 09:53:13 +000030317#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030318 int mem_base;
30319 int ret_val;
30320 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30321 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030322 xmlChar * localName; /* the local name of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030323 int n_localName;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030324 xmlChar * namespaceURI; /* the namespace URI of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030325 int n_namespaceURI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030326
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030327 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30328 for (n_localName = 0;n_localName < gen_nb_const_xmlChar_ptr;n_localName++) {
30329 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
30330 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030331 reader = gen_xmlTextReaderPtr(n_reader, 0);
30332 localName = gen_const_xmlChar_ptr(n_localName, 1);
30333 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030334
William M. Brackf13f77f2004-11-12 16:03:48 +000030335 ret_val = xmlTextReaderMoveToAttributeNs(reader, (const xmlChar *)localName, (const xmlChar *)namespaceURI);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030336 desret_int(ret_val);
30337 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030338 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000030339 des_const_xmlChar_ptr(n_localName, (const xmlChar *)localName, 1);
30340 des_const_xmlChar_ptr(n_namespaceURI, (const xmlChar *)namespaceURI, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030341 xmlResetLastError();
30342 if (mem_base != xmlMemBlocks()) {
30343 printf("Leak of %d blocks found in xmlTextReaderMoveToAttributeNs",
30344 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030345 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030346 printf(" %d", n_reader);
30347 printf(" %d", n_localName);
30348 printf(" %d", n_namespaceURI);
30349 printf("\n");
30350 }
30351 }
30352 }
30353 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030354 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030355#endif
30356
Daniel Veillard42595322004-11-08 10:52:06 +000030357 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030358}
30359
30360
30361static int
30362test_xmlTextReaderMoveToElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030363 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030364
William M. Brack21e4ef22005-01-02 09:53:13 +000030365#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030366 int mem_base;
30367 int ret_val;
30368 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30369 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030370
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030371 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30372 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030373 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030374
30375 ret_val = xmlTextReaderMoveToElement(reader);
30376 desret_int(ret_val);
30377 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030378 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030379 xmlResetLastError();
30380 if (mem_base != xmlMemBlocks()) {
30381 printf("Leak of %d blocks found in xmlTextReaderMoveToElement",
30382 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030383 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030384 printf(" %d", n_reader);
30385 printf("\n");
30386 }
30387 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030388 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030389#endif
30390
Daniel Veillard42595322004-11-08 10:52:06 +000030391 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030392}
30393
30394
30395static int
30396test_xmlTextReaderMoveToFirstAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030397 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030398
William M. Brack21e4ef22005-01-02 09:53:13 +000030399#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030400 int mem_base;
30401 int ret_val;
30402 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30403 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030404
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030405 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30406 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030407 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030408
30409 ret_val = xmlTextReaderMoveToFirstAttribute(reader);
30410 desret_int(ret_val);
30411 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030412 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030413 xmlResetLastError();
30414 if (mem_base != xmlMemBlocks()) {
30415 printf("Leak of %d blocks found in xmlTextReaderMoveToFirstAttribute",
30416 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030417 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030418 printf(" %d", n_reader);
30419 printf("\n");
30420 }
30421 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030422 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030423#endif
30424
Daniel Veillard42595322004-11-08 10:52:06 +000030425 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030426}
30427
30428
30429static int
30430test_xmlTextReaderMoveToNextAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030431 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030432
William M. Brack21e4ef22005-01-02 09:53:13 +000030433#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030434 int mem_base;
30435 int ret_val;
30436 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30437 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030438
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030439 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30440 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030441 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030442
30443 ret_val = xmlTextReaderMoveToNextAttribute(reader);
30444 desret_int(ret_val);
30445 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030446 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030447 xmlResetLastError();
30448 if (mem_base != xmlMemBlocks()) {
30449 printf("Leak of %d blocks found in xmlTextReaderMoveToNextAttribute",
30450 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030451 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030452 printf(" %d", n_reader);
30453 printf("\n");
30454 }
30455 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030456 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030457#endif
30458
Daniel Veillard42595322004-11-08 10:52:06 +000030459 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030460}
30461
30462
30463static int
30464test_xmlTextReaderName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030465 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030466
William M. Brack21e4ef22005-01-02 09:53:13 +000030467#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030468 int mem_base;
30469 xmlChar * ret_val;
30470 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30471 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030472
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030473 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30474 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030475 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030476
30477 ret_val = xmlTextReaderName(reader);
30478 desret_xmlChar_ptr(ret_val);
30479 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030480 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030481 xmlResetLastError();
30482 if (mem_base != xmlMemBlocks()) {
30483 printf("Leak of %d blocks found in xmlTextReaderName",
30484 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030485 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030486 printf(" %d", n_reader);
30487 printf("\n");
30488 }
30489 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030490 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030491#endif
30492
Daniel Veillard42595322004-11-08 10:52:06 +000030493 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030494}
30495
30496
30497static int
30498test_xmlTextReaderNamespaceUri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030499 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030500
William M. Brack21e4ef22005-01-02 09:53:13 +000030501#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030502 int mem_base;
30503 xmlChar * ret_val;
30504 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30505 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030506
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030507 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30508 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030509 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030510
30511 ret_val = xmlTextReaderNamespaceUri(reader);
30512 desret_xmlChar_ptr(ret_val);
30513 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030514 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030515 xmlResetLastError();
30516 if (mem_base != xmlMemBlocks()) {
30517 printf("Leak of %d blocks found in xmlTextReaderNamespaceUri",
30518 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030519 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030520 printf(" %d", n_reader);
30521 printf("\n");
30522 }
30523 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030524 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030525#endif
30526
Daniel Veillard42595322004-11-08 10:52:06 +000030527 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030528}
30529
30530
30531static int
30532test_xmlTextReaderNext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030533 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030534
William M. Brack21e4ef22005-01-02 09:53:13 +000030535#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030536 int mem_base;
30537 int ret_val;
30538 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30539 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030540
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030541 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30542 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030543 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030544
30545 ret_val = xmlTextReaderNext(reader);
30546 desret_int(ret_val);
30547 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030548 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030549 xmlResetLastError();
30550 if (mem_base != xmlMemBlocks()) {
30551 printf("Leak of %d blocks found in xmlTextReaderNext",
30552 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030553 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030554 printf(" %d", n_reader);
30555 printf("\n");
30556 }
30557 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030558 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030559#endif
30560
Daniel Veillard42595322004-11-08 10:52:06 +000030561 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030562}
30563
30564
30565static int
30566test_xmlTextReaderNextSibling(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030567 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030568
William M. Brack21e4ef22005-01-02 09:53:13 +000030569#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030570 int mem_base;
30571 int ret_val;
30572 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30573 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030574
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030575 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30576 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030577 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030578
30579 ret_val = xmlTextReaderNextSibling(reader);
30580 desret_int(ret_val);
30581 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030582 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030583 xmlResetLastError();
30584 if (mem_base != xmlMemBlocks()) {
30585 printf("Leak of %d blocks found in xmlTextReaderNextSibling",
30586 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030587 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030588 printf(" %d", n_reader);
30589 printf("\n");
30590 }
30591 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030592 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030593#endif
30594
Daniel Veillard42595322004-11-08 10:52:06 +000030595 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030596}
30597
30598
30599static int
30600test_xmlTextReaderNodeType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030601 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030602
William M. Brack21e4ef22005-01-02 09:53:13 +000030603#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030604 int mem_base;
30605 int ret_val;
30606 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30607 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030608
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030609 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30610 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030611 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030612
30613 ret_val = xmlTextReaderNodeType(reader);
30614 desret_int(ret_val);
30615 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030616 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030617 xmlResetLastError();
30618 if (mem_base != xmlMemBlocks()) {
30619 printf("Leak of %d blocks found in xmlTextReaderNodeType",
30620 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030621 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030622 printf(" %d", n_reader);
30623 printf("\n");
30624 }
30625 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030626 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030627#endif
30628
Daniel Veillard42595322004-11-08 10:52:06 +000030629 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030630}
30631
30632
30633static int
30634test_xmlTextReaderNormalization(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030635 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030636
William M. Brack21e4ef22005-01-02 09:53:13 +000030637#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030638 int mem_base;
30639 int ret_val;
30640 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30641 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030642
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030643 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30644 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030645 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030646
30647 ret_val = xmlTextReaderNormalization(reader);
30648 desret_int(ret_val);
30649 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030650 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030651 xmlResetLastError();
30652 if (mem_base != xmlMemBlocks()) {
30653 printf("Leak of %d blocks found in xmlTextReaderNormalization",
30654 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030655 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030656 printf(" %d", n_reader);
30657 printf("\n");
30658 }
30659 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030660 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030661#endif
30662
Daniel Veillard42595322004-11-08 10:52:06 +000030663 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030664}
30665
30666
30667static int
30668test_xmlTextReaderPrefix(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030669 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030670
William M. Brack21e4ef22005-01-02 09:53:13 +000030671#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030672 int mem_base;
30673 xmlChar * ret_val;
30674 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30675 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030676
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030677 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30678 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030679 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030680
30681 ret_val = xmlTextReaderPrefix(reader);
30682 desret_xmlChar_ptr(ret_val);
30683 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030684 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030685 xmlResetLastError();
30686 if (mem_base != xmlMemBlocks()) {
30687 printf("Leak of %d blocks found in xmlTextReaderPrefix",
30688 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030689 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030690 printf(" %d", n_reader);
30691 printf("\n");
30692 }
30693 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030694 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030695#endif
30696
Daniel Veillard42595322004-11-08 10:52:06 +000030697 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030698}
30699
30700
30701static int
30702test_xmlTextReaderPreserve(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030703 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030704
William M. Brack21e4ef22005-01-02 09:53:13 +000030705#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030706 int mem_base;
30707 xmlNodePtr ret_val;
30708 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30709 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030710
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030711 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30712 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030713 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030714
30715 ret_val = xmlTextReaderPreserve(reader);
30716 desret_xmlNodePtr(ret_val);
30717 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030718 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030719 xmlResetLastError();
30720 if (mem_base != xmlMemBlocks()) {
30721 printf("Leak of %d blocks found in xmlTextReaderPreserve",
30722 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030723 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030724 printf(" %d", n_reader);
30725 printf("\n");
30726 }
30727 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030728 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030729#endif
30730
Daniel Veillard42595322004-11-08 10:52:06 +000030731 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030732}
30733
30734
30735static int
30736test_xmlTextReaderPreservePattern(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030737 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030738
William M. Brack21e4ef22005-01-02 09:53:13 +000030739#if defined(LIBXML_READER_ENABLED) && defined(LIBXML_PATTERN_ENABLED)
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030740#ifdef LIBXML_PATTERN_ENABLED
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030741 int mem_base;
30742 int ret_val;
30743 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30744 int n_reader;
30745 xmlChar * pattern; /* an XPath subset pattern */
30746 int n_pattern;
30747 xmlChar ** namespaces; /* the prefix definitions, array of [URI, prefix] or NULL */
30748 int n_namespaces;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030749
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030750 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30751 for (n_pattern = 0;n_pattern < gen_nb_const_xmlChar_ptr;n_pattern++) {
30752 for (n_namespaces = 0;n_namespaces < gen_nb_const_xmlChar_ptr_ptr;n_namespaces++) {
30753 mem_base = xmlMemBlocks();
30754 reader = gen_xmlTextReaderPtr(n_reader, 0);
30755 pattern = gen_const_xmlChar_ptr(n_pattern, 1);
30756 namespaces = gen_const_xmlChar_ptr_ptr(n_namespaces, 2);
30757
William M. Brackf13f77f2004-11-12 16:03:48 +000030758 ret_val = xmlTextReaderPreservePattern(reader, (const xmlChar *)pattern, (const xmlChar **)namespaces);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030759 desret_int(ret_val);
30760 call_tests++;
30761 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000030762 des_const_xmlChar_ptr(n_pattern, (const xmlChar *)pattern, 1);
30763 des_const_xmlChar_ptr_ptr(n_namespaces, (const xmlChar **)namespaces, 2);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030764 xmlResetLastError();
30765 if (mem_base != xmlMemBlocks()) {
30766 printf("Leak of %d blocks found in xmlTextReaderPreservePattern",
30767 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030768 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030769 printf(" %d", n_reader);
30770 printf(" %d", n_pattern);
30771 printf(" %d", n_namespaces);
30772 printf("\n");
30773 }
30774 }
30775 }
30776 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030777 function_tests++;
30778#endif
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030779#endif
30780
Daniel Veillard42595322004-11-08 10:52:06 +000030781 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030782}
30783
30784
30785static int
30786test_xmlTextReaderQuoteChar(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030787 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030788
William M. Brack21e4ef22005-01-02 09:53:13 +000030789#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030790 int mem_base;
30791 int ret_val;
30792 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30793 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030794
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030795 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30796 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030797 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030798
30799 ret_val = xmlTextReaderQuoteChar(reader);
30800 desret_int(ret_val);
30801 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030802 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030803 xmlResetLastError();
30804 if (mem_base != xmlMemBlocks()) {
30805 printf("Leak of %d blocks found in xmlTextReaderQuoteChar",
30806 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030807 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030808 printf(" %d", n_reader);
30809 printf("\n");
30810 }
30811 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030812 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030813#endif
30814
Daniel Veillard42595322004-11-08 10:52:06 +000030815 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030816}
30817
30818
30819static int
30820test_xmlTextReaderRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030821 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030822
William M. Brack21e4ef22005-01-02 09:53:13 +000030823#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030824 int mem_base;
30825 int ret_val;
30826 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30827 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030828
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030829 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30830 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030831 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030832
30833 ret_val = xmlTextReaderRead(reader);
30834 desret_int(ret_val);
30835 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030836 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030837 xmlResetLastError();
30838 if (mem_base != xmlMemBlocks()) {
30839 printf("Leak of %d blocks found in xmlTextReaderRead",
30840 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030841 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030842 printf(" %d", n_reader);
30843 printf("\n");
30844 }
30845 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030846 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030847#endif
30848
Daniel Veillard42595322004-11-08 10:52:06 +000030849 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030850}
30851
30852
30853static int
30854test_xmlTextReaderReadAttributeValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030855 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030856
William M. Brack21e4ef22005-01-02 09:53:13 +000030857#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030858 int mem_base;
30859 int ret_val;
30860 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30861 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030862
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030863 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30864 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030865 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030866
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030867 ret_val = xmlTextReaderReadAttributeValue(reader);
30868 desret_int(ret_val);
30869 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030870 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030871 xmlResetLastError();
30872 if (mem_base != xmlMemBlocks()) {
30873 printf("Leak of %d blocks found in xmlTextReaderReadAttributeValue",
30874 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030875 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030876 printf(" %d", n_reader);
30877 printf("\n");
30878 }
30879 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030880 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030881#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000030882
Daniel Veillard42595322004-11-08 10:52:06 +000030883 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030884}
30885
30886
30887static int
30888test_xmlTextReaderReadState(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030889 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030890
William M. Brack21e4ef22005-01-02 09:53:13 +000030891#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030892 int mem_base;
30893 int ret_val;
30894 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30895 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030896
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030897 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30898 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030899 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030900
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030901 ret_val = xmlTextReaderReadState(reader);
30902 desret_int(ret_val);
30903 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030904 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030905 xmlResetLastError();
30906 if (mem_base != xmlMemBlocks()) {
30907 printf("Leak of %d blocks found in xmlTextReaderReadState",
30908 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030909 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030910 printf(" %d", n_reader);
30911 printf("\n");
30912 }
30913 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030914 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030915#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000030916
Daniel Veillard42595322004-11-08 10:52:06 +000030917 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030918}
30919
30920
30921static int
30922test_xmlTextReaderRelaxNGSetSchema(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030923 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030924
William M. Brack21e4ef22005-01-02 09:53:13 +000030925#if defined(LIBXML_READER_ENABLED) && defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000030926 int mem_base;
30927 int ret_val;
30928 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30929 int n_reader;
30930 xmlRelaxNGPtr schema; /* a precompiled RelaxNG schema */
30931 int n_schema;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030932
Daniel Veillardce682bc2004-11-05 17:22:25 +000030933 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30934 for (n_schema = 0;n_schema < gen_nb_xmlRelaxNGPtr;n_schema++) {
30935 mem_base = xmlMemBlocks();
30936 reader = gen_xmlTextReaderPtr(n_reader, 0);
30937 schema = gen_xmlRelaxNGPtr(n_schema, 1);
30938
30939 ret_val = xmlTextReaderRelaxNGSetSchema(reader, schema);
30940 desret_int(ret_val);
30941 call_tests++;
30942 des_xmlTextReaderPtr(n_reader, reader, 0);
30943 des_xmlRelaxNGPtr(n_schema, schema, 1);
30944 xmlResetLastError();
30945 if (mem_base != xmlMemBlocks()) {
30946 printf("Leak of %d blocks found in xmlTextReaderRelaxNGSetSchema",
30947 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030948 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030949 printf(" %d", n_reader);
30950 printf(" %d", n_schema);
30951 printf("\n");
30952 }
30953 }
30954 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030955 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030956#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +000030957
Daniel Veillard42595322004-11-08 10:52:06 +000030958 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030959}
30960
30961
30962static int
30963test_xmlTextReaderRelaxNGValidate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030964 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030965
William M. Brack21e4ef22005-01-02 09:53:13 +000030966#if defined(LIBXML_READER_ENABLED) && defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030967 int mem_base;
30968 int ret_val;
30969 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30970 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030971 char * rng; /* the path to a RelaxNG schema or NULL */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030972 int n_rng;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030973
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030974 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30975 for (n_rng = 0;n_rng < gen_nb_const_char_ptr;n_rng++) {
30976 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030977 reader = gen_xmlTextReaderPtr(n_reader, 0);
30978 rng = gen_const_char_ptr(n_rng, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030979
William M. Brackf13f77f2004-11-12 16:03:48 +000030980 ret_val = xmlTextReaderRelaxNGValidate(reader, (const char *)rng);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030981 desret_int(ret_val);
30982 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030983 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000030984 des_const_char_ptr(n_rng, (const char *)rng, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030985 xmlResetLastError();
30986 if (mem_base != xmlMemBlocks()) {
30987 printf("Leak of %d blocks found in xmlTextReaderRelaxNGValidate",
30988 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030989 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030990 printf(" %d", n_reader);
30991 printf(" %d", n_rng);
30992 printf("\n");
30993 }
30994 }
30995 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030996 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030997#endif
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030998
Daniel Veillard42595322004-11-08 10:52:06 +000030999 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031000}
31001
31002
31003static int
31004test_xmlTextReaderSetErrorHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031005 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031006
31007
31008 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031009 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031010}
31011
31012
31013static int
31014test_xmlTextReaderSetParserProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031015 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031016
William M. Brack21e4ef22005-01-02 09:53:13 +000031017#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031018 int mem_base;
31019 int ret_val;
31020 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
31021 int n_reader;
31022 int prop; /* the xmlParserProperties to set */
31023 int n_prop;
31024 int value; /* usually 0 or 1 to (de)activate it */
31025 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031026
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031027 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
31028 for (n_prop = 0;n_prop < gen_nb_int;n_prop++) {
31029 for (n_value = 0;n_value < gen_nb_int;n_value++) {
31030 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000031031 reader = gen_xmlTextReaderPtr(n_reader, 0);
31032 prop = gen_int(n_prop, 1);
31033 value = gen_int(n_value, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031034
31035 ret_val = xmlTextReaderSetParserProp(reader, prop, value);
31036 desret_int(ret_val);
31037 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000031038 des_xmlTextReaderPtr(n_reader, reader, 0);
31039 des_int(n_prop, prop, 1);
31040 des_int(n_value, value, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031041 xmlResetLastError();
31042 if (mem_base != xmlMemBlocks()) {
31043 printf("Leak of %d blocks found in xmlTextReaderSetParserProp",
31044 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031045 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031046 printf(" %d", n_reader);
31047 printf(" %d", n_prop);
31048 printf(" %d", n_value);
31049 printf("\n");
31050 }
31051 }
31052 }
31053 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031054 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031055#endif
31056
Daniel Veillard42595322004-11-08 10:52:06 +000031057 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031058}
31059
31060
31061static int
31062test_xmlTextReaderSetStructuredErrorHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031063 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031064
31065
31066 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031067 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031068}
31069
31070
31071static int
31072test_xmlTextReaderStandalone(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031073 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031074
William M. Brack21e4ef22005-01-02 09:53:13 +000031075#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031076 int mem_base;
31077 int ret_val;
31078 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
31079 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031080
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031081 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
31082 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000031083 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031084
31085 ret_val = xmlTextReaderStandalone(reader);
31086 desret_int(ret_val);
31087 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000031088 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031089 xmlResetLastError();
31090 if (mem_base != xmlMemBlocks()) {
31091 printf("Leak of %d blocks found in xmlTextReaderStandalone",
31092 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031093 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031094 printf(" %d", n_reader);
31095 printf("\n");
31096 }
31097 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031098 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031099#endif
31100
Daniel Veillard42595322004-11-08 10:52:06 +000031101 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031102}
31103
31104
31105static int
31106test_xmlTextReaderValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031107 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031108
William M. Brack21e4ef22005-01-02 09:53:13 +000031109#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031110 int mem_base;
31111 xmlChar * ret_val;
31112 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
31113 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031114
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031115 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
31116 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000031117 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031118
31119 ret_val = xmlTextReaderValue(reader);
31120 desret_xmlChar_ptr(ret_val);
31121 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000031122 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031123 xmlResetLastError();
31124 if (mem_base != xmlMemBlocks()) {
31125 printf("Leak of %d blocks found in xmlTextReaderValue",
31126 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031127 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031128 printf(" %d", n_reader);
31129 printf("\n");
31130 }
31131 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031132 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031133#endif
31134
Daniel Veillard42595322004-11-08 10:52:06 +000031135 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031136}
31137
31138
31139static int
31140test_xmlTextReaderXmlLang(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031141 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031142
William M. Brack21e4ef22005-01-02 09:53:13 +000031143#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031144 int mem_base;
31145 xmlChar * ret_val;
31146 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
31147 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031148
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031149 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
31150 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000031151 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031152
31153 ret_val = xmlTextReaderXmlLang(reader);
31154 desret_xmlChar_ptr(ret_val);
31155 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000031156 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031157 xmlResetLastError();
31158 if (mem_base != xmlMemBlocks()) {
31159 printf("Leak of %d blocks found in xmlTextReaderXmlLang",
31160 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031161 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031162 printf(" %d", n_reader);
31163 printf("\n");
31164 }
31165 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031166 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031167#endif
31168
Daniel Veillard42595322004-11-08 10:52:06 +000031169 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031170}
31171
31172static int
31173test_xmlreader(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031174 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031175
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000031176 if (quiet == 0) printf("Testing xmlreader : 70 of 80 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000031177 test_ret += test_xmlNewTextReader();
31178 test_ret += test_xmlNewTextReaderFilename();
31179 test_ret += test_xmlReaderForDoc();
31180 test_ret += test_xmlReaderForFile();
31181 test_ret += test_xmlReaderForMemory();
31182 test_ret += test_xmlReaderNewDoc();
31183 test_ret += test_xmlReaderNewFile();
31184 test_ret += test_xmlReaderNewMemory();
31185 test_ret += test_xmlReaderNewWalker();
31186 test_ret += test_xmlReaderWalker();
31187 test_ret += test_xmlTextReaderAttributeCount();
31188 test_ret += test_xmlTextReaderBaseUri();
31189 test_ret += test_xmlTextReaderClose();
31190 test_ret += test_xmlTextReaderConstBaseUri();
31191 test_ret += test_xmlTextReaderConstEncoding();
31192 test_ret += test_xmlTextReaderConstLocalName();
31193 test_ret += test_xmlTextReaderConstName();
31194 test_ret += test_xmlTextReaderConstNamespaceUri();
31195 test_ret += test_xmlTextReaderConstPrefix();
31196 test_ret += test_xmlTextReaderConstString();
31197 test_ret += test_xmlTextReaderConstValue();
31198 test_ret += test_xmlTextReaderConstXmlLang();
31199 test_ret += test_xmlTextReaderConstXmlVersion();
31200 test_ret += test_xmlTextReaderCurrentDoc();
31201 test_ret += test_xmlTextReaderCurrentNode();
31202 test_ret += test_xmlTextReaderDepth();
31203 test_ret += test_xmlTextReaderExpand();
31204 test_ret += test_xmlTextReaderGetAttribute();
31205 test_ret += test_xmlTextReaderGetAttributeNo();
31206 test_ret += test_xmlTextReaderGetAttributeNs();
31207 test_ret += test_xmlTextReaderGetErrorHandler();
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000031208 test_ret += test_xmlTextReaderGetParserColumnNumber();
31209 test_ret += test_xmlTextReaderGetParserLineNumber();
Daniel Veillard42595322004-11-08 10:52:06 +000031210 test_ret += test_xmlTextReaderGetParserProp();
31211 test_ret += test_xmlTextReaderGetRemainder();
31212 test_ret += test_xmlTextReaderHasAttributes();
31213 test_ret += test_xmlTextReaderHasValue();
31214 test_ret += test_xmlTextReaderIsDefault();
31215 test_ret += test_xmlTextReaderIsEmptyElement();
31216 test_ret += test_xmlTextReaderIsNamespaceDecl();
31217 test_ret += test_xmlTextReaderIsValid();
31218 test_ret += test_xmlTextReaderLocalName();
31219 test_ret += test_xmlTextReaderLocatorBaseURI();
31220 test_ret += test_xmlTextReaderLocatorLineNumber();
31221 test_ret += test_xmlTextReaderLookupNamespace();
31222 test_ret += test_xmlTextReaderMoveToAttribute();
31223 test_ret += test_xmlTextReaderMoveToAttributeNo();
31224 test_ret += test_xmlTextReaderMoveToAttributeNs();
31225 test_ret += test_xmlTextReaderMoveToElement();
31226 test_ret += test_xmlTextReaderMoveToFirstAttribute();
31227 test_ret += test_xmlTextReaderMoveToNextAttribute();
31228 test_ret += test_xmlTextReaderName();
31229 test_ret += test_xmlTextReaderNamespaceUri();
31230 test_ret += test_xmlTextReaderNext();
31231 test_ret += test_xmlTextReaderNextSibling();
31232 test_ret += test_xmlTextReaderNodeType();
31233 test_ret += test_xmlTextReaderNormalization();
31234 test_ret += test_xmlTextReaderPrefix();
31235 test_ret += test_xmlTextReaderPreserve();
31236 test_ret += test_xmlTextReaderPreservePattern();
31237 test_ret += test_xmlTextReaderQuoteChar();
31238 test_ret += test_xmlTextReaderRead();
31239 test_ret += test_xmlTextReaderReadAttributeValue();
31240 test_ret += test_xmlTextReaderReadState();
31241 test_ret += test_xmlTextReaderRelaxNGSetSchema();
31242 test_ret += test_xmlTextReaderRelaxNGValidate();
31243 test_ret += test_xmlTextReaderSetErrorHandler();
31244 test_ret += test_xmlTextReaderSetParserProp();
31245 test_ret += test_xmlTextReaderSetStructuredErrorHandler();
31246 test_ret += test_xmlTextReaderStandalone();
31247 test_ret += test_xmlTextReaderValue();
31248 test_ret += test_xmlTextReaderXmlLang();
Daniel Veillardd93f6252004-11-02 15:53:51 +000031249
Daniel Veillard42595322004-11-08 10:52:06 +000031250 if (test_ret != 0)
31251 printf("Module xmlreader: %d errors\n", test_ret);
31252 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031253}
Daniel Veillarda521d282004-11-09 14:59:59 +000031254#ifdef LIBXML_REGEXP_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000031255
Daniel Veillarda82b1822004-11-08 16:24:57 +000031256#define gen_nb_xmlRegExecCtxtPtr 1
31257static xmlRegExecCtxtPtr gen_xmlRegExecCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31258 return(NULL);
31259}
31260static void des_xmlRegExecCtxtPtr(int no ATTRIBUTE_UNUSED, xmlRegExecCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31261}
Daniel Veillarda521d282004-11-09 14:59:59 +000031262#endif
31263
Daniel Veillarda82b1822004-11-08 16:24:57 +000031264
31265static int
Daniel Veillardf47d2e32005-01-12 14:16:08 +000031266test_xmlRegExecErrInfo(void) {
31267 int test_ret = 0;
31268
31269#if defined(LIBXML_REGEXP_ENABLED)
31270 int mem_base;
31271 int ret_val;
31272 xmlRegExecCtxtPtr exec; /* a regexp execution context generating an error */
31273 int n_exec;
31274 xmlChar ** string; /* return value for the error string */
31275 int n_string;
31276 int * nbval; /* pointer to the number of accepted values IN/OUT */
31277 int n_nbval;
31278 int * nbneg; /* return number of negative transitions */
31279 int n_nbneg;
31280 xmlChar ** values; /* pointer to the array of acceptable values */
31281 int n_values;
31282 int * terminal; /* return value if this was a terminal state */
31283 int n_terminal;
31284
31285 for (n_exec = 0;n_exec < gen_nb_xmlRegExecCtxtPtr;n_exec++) {
31286 for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr_ptr;n_string++) {
31287 for (n_nbval = 0;n_nbval < gen_nb_int_ptr;n_nbval++) {
31288 for (n_nbneg = 0;n_nbneg < gen_nb_int_ptr;n_nbneg++) {
31289 for (n_values = 0;n_values < gen_nb_xmlChar_ptr_ptr;n_values++) {
31290 for (n_terminal = 0;n_terminal < gen_nb_int_ptr;n_terminal++) {
31291 mem_base = xmlMemBlocks();
31292 exec = gen_xmlRegExecCtxtPtr(n_exec, 0);
31293 string = gen_const_xmlChar_ptr_ptr(n_string, 1);
31294 nbval = gen_int_ptr(n_nbval, 2);
31295 nbneg = gen_int_ptr(n_nbneg, 3);
31296 values = gen_xmlChar_ptr_ptr(n_values, 4);
31297 terminal = gen_int_ptr(n_terminal, 5);
31298
31299 ret_val = xmlRegExecErrInfo(exec, (const xmlChar **)string, nbval, nbneg, values, terminal);
31300 desret_int(ret_val);
31301 call_tests++;
31302 des_xmlRegExecCtxtPtr(n_exec, exec, 0);
31303 des_const_xmlChar_ptr_ptr(n_string, (const xmlChar **)string, 1);
31304 des_int_ptr(n_nbval, nbval, 2);
31305 des_int_ptr(n_nbneg, nbneg, 3);
31306 des_xmlChar_ptr_ptr(n_values, values, 4);
31307 des_int_ptr(n_terminal, terminal, 5);
31308 xmlResetLastError();
31309 if (mem_base != xmlMemBlocks()) {
31310 printf("Leak of %d blocks found in xmlRegExecErrInfo",
31311 xmlMemBlocks() - mem_base);
31312 test_ret++;
31313 printf(" %d", n_exec);
31314 printf(" %d", n_string);
31315 printf(" %d", n_nbval);
31316 printf(" %d", n_nbneg);
31317 printf(" %d", n_values);
31318 printf(" %d", n_terminal);
31319 printf("\n");
31320 }
31321 }
31322 }
31323 }
31324 }
31325 }
31326 }
31327 function_tests++;
31328#endif
31329
31330 return(test_ret);
31331}
31332
31333
31334static int
31335test_xmlRegExecNextValues(void) {
31336 int test_ret = 0;
31337
31338#if defined(LIBXML_REGEXP_ENABLED)
31339 int mem_base;
31340 int ret_val;
31341 xmlRegExecCtxtPtr exec; /* a regexp execution context */
31342 int n_exec;
31343 int * nbval; /* pointer to the number of accepted values IN/OUT */
31344 int n_nbval;
31345 int * nbneg; /* return number of negative transitions */
31346 int n_nbneg;
31347 xmlChar ** values; /* pointer to the array of acceptable values */
31348 int n_values;
31349 int * terminal; /* return value if this was a terminal state */
31350 int n_terminal;
31351
31352 for (n_exec = 0;n_exec < gen_nb_xmlRegExecCtxtPtr;n_exec++) {
31353 for (n_nbval = 0;n_nbval < gen_nb_int_ptr;n_nbval++) {
31354 for (n_nbneg = 0;n_nbneg < gen_nb_int_ptr;n_nbneg++) {
31355 for (n_values = 0;n_values < gen_nb_xmlChar_ptr_ptr;n_values++) {
31356 for (n_terminal = 0;n_terminal < gen_nb_int_ptr;n_terminal++) {
31357 mem_base = xmlMemBlocks();
31358 exec = gen_xmlRegExecCtxtPtr(n_exec, 0);
31359 nbval = gen_int_ptr(n_nbval, 1);
31360 nbneg = gen_int_ptr(n_nbneg, 2);
31361 values = gen_xmlChar_ptr_ptr(n_values, 3);
31362 terminal = gen_int_ptr(n_terminal, 4);
31363
31364 ret_val = xmlRegExecNextValues(exec, nbval, nbneg, values, terminal);
31365 desret_int(ret_val);
31366 call_tests++;
31367 des_xmlRegExecCtxtPtr(n_exec, exec, 0);
31368 des_int_ptr(n_nbval, nbval, 1);
31369 des_int_ptr(n_nbneg, nbneg, 2);
31370 des_xmlChar_ptr_ptr(n_values, values, 3);
31371 des_int_ptr(n_terminal, terminal, 4);
31372 xmlResetLastError();
31373 if (mem_base != xmlMemBlocks()) {
31374 printf("Leak of %d blocks found in xmlRegExecNextValues",
31375 xmlMemBlocks() - mem_base);
31376 test_ret++;
31377 printf(" %d", n_exec);
31378 printf(" %d", n_nbval);
31379 printf(" %d", n_nbneg);
31380 printf(" %d", n_values);
31381 printf(" %d", n_terminal);
31382 printf("\n");
31383 }
31384 }
31385 }
31386 }
31387 }
31388 }
31389 function_tests++;
31390#endif
31391
31392 return(test_ret);
31393}
31394
31395
31396static int
Daniel Veillarda82b1822004-11-08 16:24:57 +000031397test_xmlRegExecPushString(void) {
31398 int test_ret = 0;
31399
William M. Brack21e4ef22005-01-02 09:53:13 +000031400#if defined(LIBXML_REGEXP_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000031401 int mem_base;
31402 int ret_val;
31403 xmlRegExecCtxtPtr exec; /* a regexp execution context or NULL to indicate the end */
31404 int n_exec;
31405 xmlChar * value; /* a string token input */
31406 int n_value;
31407 void * data; /* data associated to the token to reuse in callbacks */
31408 int n_data;
31409
31410 for (n_exec = 0;n_exec < gen_nb_xmlRegExecCtxtPtr;n_exec++) {
31411 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
31412 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
31413 mem_base = xmlMemBlocks();
31414 exec = gen_xmlRegExecCtxtPtr(n_exec, 0);
31415 value = gen_const_xmlChar_ptr(n_value, 1);
31416 data = gen_userdata(n_data, 2);
31417
William M. Brackf13f77f2004-11-12 16:03:48 +000031418 ret_val = xmlRegExecPushString(exec, (const xmlChar *)value, data);
Daniel Veillarda82b1822004-11-08 16:24:57 +000031419 desret_int(ret_val);
31420 call_tests++;
31421 des_xmlRegExecCtxtPtr(n_exec, exec, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000031422 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillarda82b1822004-11-08 16:24:57 +000031423 des_userdata(n_data, data, 2);
31424 xmlResetLastError();
31425 if (mem_base != xmlMemBlocks()) {
31426 printf("Leak of %d blocks found in xmlRegExecPushString",
31427 xmlMemBlocks() - mem_base);
31428 test_ret++;
31429 printf(" %d", n_exec);
31430 printf(" %d", n_value);
31431 printf(" %d", n_data);
31432 printf("\n");
31433 }
31434 }
31435 }
31436 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031437 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000031438#endif
31439
Daniel Veillarda82b1822004-11-08 16:24:57 +000031440 return(test_ret);
31441}
31442
31443
31444static int
31445test_xmlRegExecPushString2(void) {
31446 int test_ret = 0;
31447
William M. Brack21e4ef22005-01-02 09:53:13 +000031448#if defined(LIBXML_REGEXP_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000031449 int mem_base;
31450 int ret_val;
31451 xmlRegExecCtxtPtr exec; /* a regexp execution context or NULL to indicate the end */
31452 int n_exec;
31453 xmlChar * value; /* the first string token input */
31454 int n_value;
31455 xmlChar * value2; /* the second string token input */
31456 int n_value2;
31457 void * data; /* data associated to the token to reuse in callbacks */
31458 int n_data;
31459
31460 for (n_exec = 0;n_exec < gen_nb_xmlRegExecCtxtPtr;n_exec++) {
31461 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
31462 for (n_value2 = 0;n_value2 < gen_nb_const_xmlChar_ptr;n_value2++) {
31463 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
31464 mem_base = xmlMemBlocks();
31465 exec = gen_xmlRegExecCtxtPtr(n_exec, 0);
31466 value = gen_const_xmlChar_ptr(n_value, 1);
31467 value2 = gen_const_xmlChar_ptr(n_value2, 2);
31468 data = gen_userdata(n_data, 3);
31469
William M. Brackf13f77f2004-11-12 16:03:48 +000031470 ret_val = xmlRegExecPushString2(exec, (const xmlChar *)value, (const xmlChar *)value2, data);
Daniel Veillarda82b1822004-11-08 16:24:57 +000031471 desret_int(ret_val);
31472 call_tests++;
31473 des_xmlRegExecCtxtPtr(n_exec, exec, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000031474 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
31475 des_const_xmlChar_ptr(n_value2, (const xmlChar *)value2, 2);
Daniel Veillarda82b1822004-11-08 16:24:57 +000031476 des_userdata(n_data, data, 3);
31477 xmlResetLastError();
31478 if (mem_base != xmlMemBlocks()) {
31479 printf("Leak of %d blocks found in xmlRegExecPushString2",
31480 xmlMemBlocks() - mem_base);
31481 test_ret++;
31482 printf(" %d", n_exec);
31483 printf(" %d", n_value);
31484 printf(" %d", n_value2);
31485 printf(" %d", n_data);
31486 printf("\n");
31487 }
31488 }
31489 }
31490 }
31491 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031492 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000031493#endif
31494
Daniel Veillarda82b1822004-11-08 16:24:57 +000031495 return(test_ret);
31496}
31497
Daniel Veillarda521d282004-11-09 14:59:59 +000031498#ifdef LIBXML_REGEXP_ENABLED
Daniel Veillarda82b1822004-11-08 16:24:57 +000031499
31500#define gen_nb_xmlRegexpPtr 1
31501static xmlRegexpPtr gen_xmlRegexpPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31502 return(NULL);
31503}
31504static void des_xmlRegexpPtr(int no ATTRIBUTE_UNUSED, xmlRegexpPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31505}
Daniel Veillarda521d282004-11-09 14:59:59 +000031506#endif
31507
Daniel Veillarda82b1822004-11-08 16:24:57 +000031508
31509static int
31510test_xmlRegNewExecCtxt(void) {
31511 int test_ret = 0;
31512
31513
31514 /* missing type support */
31515 return(test_ret);
31516}
31517
31518
31519static int
31520test_xmlRegexpCompile(void) {
31521 int test_ret = 0;
31522
31523
31524 /* missing type support */
31525 return(test_ret);
31526}
31527
31528
31529static int
31530test_xmlRegexpExec(void) {
31531 int test_ret = 0;
31532
William M. Brack21e4ef22005-01-02 09:53:13 +000031533#if defined(LIBXML_REGEXP_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000031534 int mem_base;
31535 int ret_val;
31536 xmlRegexpPtr comp; /* the compiled regular expression */
31537 int n_comp;
31538 xmlChar * content; /* the value to check against the regular expression */
31539 int n_content;
31540
31541 for (n_comp = 0;n_comp < gen_nb_xmlRegexpPtr;n_comp++) {
31542 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
31543 mem_base = xmlMemBlocks();
31544 comp = gen_xmlRegexpPtr(n_comp, 0);
31545 content = gen_const_xmlChar_ptr(n_content, 1);
31546
William M. Brackf13f77f2004-11-12 16:03:48 +000031547 ret_val = xmlRegexpExec(comp, (const xmlChar *)content);
Daniel Veillarda82b1822004-11-08 16:24:57 +000031548 desret_int(ret_val);
31549 call_tests++;
31550 des_xmlRegexpPtr(n_comp, comp, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000031551 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillarda82b1822004-11-08 16:24:57 +000031552 xmlResetLastError();
31553 if (mem_base != xmlMemBlocks()) {
31554 printf("Leak of %d blocks found in xmlRegexpExec",
31555 xmlMemBlocks() - mem_base);
31556 test_ret++;
31557 printf(" %d", n_comp);
31558 printf(" %d", n_content);
31559 printf("\n");
31560 }
31561 }
31562 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031563 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000031564#endif
31565
Daniel Veillarda82b1822004-11-08 16:24:57 +000031566 return(test_ret);
31567}
31568
31569
31570static int
31571test_xmlRegexpIsDeterminist(void) {
31572 int test_ret = 0;
31573
William M. Brack21e4ef22005-01-02 09:53:13 +000031574#if defined(LIBXML_REGEXP_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000031575 int mem_base;
31576 int ret_val;
31577 xmlRegexpPtr comp; /* the compiled regular expression */
31578 int n_comp;
31579
31580 for (n_comp = 0;n_comp < gen_nb_xmlRegexpPtr;n_comp++) {
31581 mem_base = xmlMemBlocks();
31582 comp = gen_xmlRegexpPtr(n_comp, 0);
31583
31584 ret_val = xmlRegexpIsDeterminist(comp);
31585 desret_int(ret_val);
31586 call_tests++;
31587 des_xmlRegexpPtr(n_comp, comp, 0);
31588 xmlResetLastError();
31589 if (mem_base != xmlMemBlocks()) {
31590 printf("Leak of %d blocks found in xmlRegexpIsDeterminist",
31591 xmlMemBlocks() - mem_base);
31592 test_ret++;
31593 printf(" %d", n_comp);
31594 printf("\n");
31595 }
31596 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031597 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000031598#endif
31599
Daniel Veillarda82b1822004-11-08 16:24:57 +000031600 return(test_ret);
31601}
31602
31603
31604static int
31605test_xmlRegexpPrint(void) {
31606 int test_ret = 0;
31607
William M. Brack21e4ef22005-01-02 09:53:13 +000031608#if defined(LIBXML_REGEXP_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000031609 int mem_base;
31610 FILE * output; /* the file for the output debug */
31611 int n_output;
31612 xmlRegexpPtr regexp; /* the compiled regexp */
31613 int n_regexp;
31614
31615 for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
31616 for (n_regexp = 0;n_regexp < gen_nb_xmlRegexpPtr;n_regexp++) {
31617 mem_base = xmlMemBlocks();
31618 output = gen_FILE_ptr(n_output, 0);
31619 regexp = gen_xmlRegexpPtr(n_regexp, 1);
31620
31621 xmlRegexpPrint(output, regexp);
31622 call_tests++;
31623 des_FILE_ptr(n_output, output, 0);
31624 des_xmlRegexpPtr(n_regexp, regexp, 1);
31625 xmlResetLastError();
31626 if (mem_base != xmlMemBlocks()) {
31627 printf("Leak of %d blocks found in xmlRegexpPrint",
31628 xmlMemBlocks() - mem_base);
31629 test_ret++;
31630 printf(" %d", n_output);
31631 printf(" %d", n_regexp);
31632 printf("\n");
31633 }
31634 }
31635 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031636 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000031637#endif
31638
Daniel Veillarda82b1822004-11-08 16:24:57 +000031639 return(test_ret);
31640}
31641
31642static int
31643test_xmlregexp(void) {
31644 int test_ret = 0;
31645
Daniel Veillardf47d2e32005-01-12 14:16:08 +000031646 if (quiet == 0) printf("Testing xmlregexp : 7 of 11 functions ...\n");
31647 test_ret += test_xmlRegExecErrInfo();
31648 test_ret += test_xmlRegExecNextValues();
Daniel Veillarda82b1822004-11-08 16:24:57 +000031649 test_ret += test_xmlRegExecPushString();
31650 test_ret += test_xmlRegExecPushString2();
31651 test_ret += test_xmlRegNewExecCtxt();
31652 test_ret += test_xmlRegexpCompile();
31653 test_ret += test_xmlRegexpExec();
31654 test_ret += test_xmlRegexpIsDeterminist();
31655 test_ret += test_xmlRegexpPrint();
31656
31657 if (test_ret != 0)
31658 printf("Module xmlregexp: %d errors\n", test_ret);
31659 return(test_ret);
31660}
Daniel Veillarda521d282004-11-09 14:59:59 +000031661#ifdef LIBXML_OUTPUT_ENABLED
Daniel Veillarda82b1822004-11-08 16:24:57 +000031662
Daniel Veillardce682bc2004-11-05 17:22:25 +000031663#define gen_nb_xmlSaveCtxtPtr 1
31664static xmlSaveCtxtPtr gen_xmlSaveCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31665 return(NULL);
31666}
31667static void des_xmlSaveCtxtPtr(int no ATTRIBUTE_UNUSED, xmlSaveCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31668}
Daniel Veillarda521d282004-11-09 14:59:59 +000031669#endif
31670
Daniel Veillardce682bc2004-11-05 17:22:25 +000031671
Daniel Veillardd93f6252004-11-02 15:53:51 +000031672static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000031673test_xmlSaveClose(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031674 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031675
William M. Brack21e4ef22005-01-02 09:53:13 +000031676#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000031677 int mem_base;
31678 int ret_val;
31679 xmlSaveCtxtPtr ctxt; /* a document saving context */
31680 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031681
Daniel Veillardce682bc2004-11-05 17:22:25 +000031682 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSaveCtxtPtr;n_ctxt++) {
31683 mem_base = xmlMemBlocks();
31684 ctxt = gen_xmlSaveCtxtPtr(n_ctxt, 0);
31685
31686 ret_val = xmlSaveClose(ctxt);
31687 desret_int(ret_val);
31688 call_tests++;
31689 des_xmlSaveCtxtPtr(n_ctxt, ctxt, 0);
31690 xmlResetLastError();
31691 if (mem_base != xmlMemBlocks()) {
31692 printf("Leak of %d blocks found in xmlSaveClose",
31693 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031694 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031695 printf(" %d", n_ctxt);
31696 printf("\n");
31697 }
31698 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031699 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031700#endif
31701
Daniel Veillard42595322004-11-08 10:52:06 +000031702 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031703}
31704
31705
31706static int
31707test_xmlSaveDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031708 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031709
William M. Brack21e4ef22005-01-02 09:53:13 +000031710#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000031711 int mem_base;
31712 long ret_val;
31713 xmlSaveCtxtPtr ctxt; /* a document saving context */
31714 int n_ctxt;
31715 xmlDocPtr doc; /* a document */
31716 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031717
Daniel Veillardce682bc2004-11-05 17:22:25 +000031718 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSaveCtxtPtr;n_ctxt++) {
31719 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
31720 mem_base = xmlMemBlocks();
31721 ctxt = gen_xmlSaveCtxtPtr(n_ctxt, 0);
31722 doc = gen_xmlDocPtr(n_doc, 1);
31723
31724 ret_val = xmlSaveDoc(ctxt, doc);
31725 desret_long(ret_val);
31726 call_tests++;
31727 des_xmlSaveCtxtPtr(n_ctxt, ctxt, 0);
31728 des_xmlDocPtr(n_doc, doc, 1);
31729 xmlResetLastError();
31730 if (mem_base != xmlMemBlocks()) {
31731 printf("Leak of %d blocks found in xmlSaveDoc",
31732 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031733 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031734 printf(" %d", n_ctxt);
31735 printf(" %d", n_doc);
31736 printf("\n");
31737 }
31738 }
31739 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031740 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031741#endif
31742
Daniel Veillard42595322004-11-08 10:52:06 +000031743 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031744}
31745
31746
31747static int
31748test_xmlSaveFlush(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031749 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031750
William M. Brack21e4ef22005-01-02 09:53:13 +000031751#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000031752 int mem_base;
31753 int ret_val;
31754 xmlSaveCtxtPtr ctxt; /* a document saving context */
31755 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031756
Daniel Veillardce682bc2004-11-05 17:22:25 +000031757 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSaveCtxtPtr;n_ctxt++) {
31758 mem_base = xmlMemBlocks();
31759 ctxt = gen_xmlSaveCtxtPtr(n_ctxt, 0);
31760
31761 ret_val = xmlSaveFlush(ctxt);
31762 desret_int(ret_val);
31763 call_tests++;
31764 des_xmlSaveCtxtPtr(n_ctxt, ctxt, 0);
31765 xmlResetLastError();
31766 if (mem_base != xmlMemBlocks()) {
31767 printf("Leak of %d blocks found in xmlSaveFlush",
31768 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031769 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031770 printf(" %d", n_ctxt);
31771 printf("\n");
31772 }
31773 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031774 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031775#endif
31776
Daniel Veillard42595322004-11-08 10:52:06 +000031777 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031778}
31779
31780
31781static int
31782test_xmlSaveSetAttrEscape(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031783 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031784
31785
31786 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031787 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031788}
31789
31790
31791static int
31792test_xmlSaveSetEscape(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031793 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031794
31795
31796 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031797 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031798}
31799
31800
31801static int
31802test_xmlSaveToFd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031803 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031804
31805
31806 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031807 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031808}
31809
31810
31811static int
31812test_xmlSaveToFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031813 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031814
31815
31816 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031817 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031818}
31819
31820
31821static int
31822test_xmlSaveTree(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031823 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031824
William M. Brack21e4ef22005-01-02 09:53:13 +000031825#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000031826 int mem_base;
31827 long ret_val;
31828 xmlSaveCtxtPtr ctxt; /* a document saving context */
31829 int n_ctxt;
31830 xmlNodePtr node; /* a document */
31831 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031832
Daniel Veillardce682bc2004-11-05 17:22:25 +000031833 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSaveCtxtPtr;n_ctxt++) {
31834 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
31835 mem_base = xmlMemBlocks();
31836 ctxt = gen_xmlSaveCtxtPtr(n_ctxt, 0);
31837 node = gen_xmlNodePtr(n_node, 1);
31838
31839 ret_val = xmlSaveTree(ctxt, node);
31840 desret_long(ret_val);
31841 call_tests++;
31842 des_xmlSaveCtxtPtr(n_ctxt, ctxt, 0);
31843 des_xmlNodePtr(n_node, node, 1);
31844 xmlResetLastError();
31845 if (mem_base != xmlMemBlocks()) {
31846 printf("Leak of %d blocks found in xmlSaveTree",
31847 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031848 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031849 printf(" %d", n_ctxt);
31850 printf(" %d", n_node);
31851 printf("\n");
31852 }
31853 }
31854 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031855 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031856#endif
31857
Daniel Veillard42595322004-11-08 10:52:06 +000031858 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031859}
31860
31861static int
31862test_xmlsave(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031863 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031864
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031865 if (quiet == 0) printf("Testing xmlsave : 4 of 9 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000031866 test_ret += test_xmlSaveClose();
31867 test_ret += test_xmlSaveDoc();
31868 test_ret += test_xmlSaveFlush();
31869 test_ret += test_xmlSaveSetAttrEscape();
31870 test_ret += test_xmlSaveSetEscape();
31871 test_ret += test_xmlSaveToFd();
31872 test_ret += test_xmlSaveToFilename();
31873 test_ret += test_xmlSaveTree();
Daniel Veillardd93f6252004-11-02 15:53:51 +000031874
Daniel Veillard42595322004-11-08 10:52:06 +000031875 if (test_ret != 0)
31876 printf("Module xmlsave: %d errors\n", test_ret);
31877 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031878}
Daniel Veillarda521d282004-11-09 14:59:59 +000031879#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000031880
Daniel Veillardce682bc2004-11-05 17:22:25 +000031881#define gen_nb_xmlSchemaPtr 1
31882static xmlSchemaPtr gen_xmlSchemaPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31883 return(NULL);
31884}
31885static void des_xmlSchemaPtr(int no ATTRIBUTE_UNUSED, xmlSchemaPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31886}
Daniel Veillarda521d282004-11-09 14:59:59 +000031887#endif
31888
Daniel Veillardce682bc2004-11-05 17:22:25 +000031889
Daniel Veillardd93f6252004-11-02 15:53:51 +000031890static int
31891test_xmlSchemaDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031892 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031893
William M. Brack21e4ef22005-01-02 09:53:13 +000031894#if defined(LIBXML_SCHEMAS_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000031895 int mem_base;
31896 FILE * output; /* the file output */
31897 int n_output;
31898 xmlSchemaPtr schema; /* a schema structure */
31899 int n_schema;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031900
Daniel Veillardce682bc2004-11-05 17:22:25 +000031901 for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
31902 for (n_schema = 0;n_schema < gen_nb_xmlSchemaPtr;n_schema++) {
31903 mem_base = xmlMemBlocks();
31904 output = gen_FILE_ptr(n_output, 0);
31905 schema = gen_xmlSchemaPtr(n_schema, 1);
31906
31907 xmlSchemaDump(output, schema);
31908 call_tests++;
31909 des_FILE_ptr(n_output, output, 0);
31910 des_xmlSchemaPtr(n_schema, schema, 1);
31911 xmlResetLastError();
31912 if (mem_base != xmlMemBlocks()) {
31913 printf("Leak of %d blocks found in xmlSchemaDump",
31914 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031915 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031916 printf(" %d", n_output);
31917 printf(" %d", n_schema);
31918 printf("\n");
31919 }
31920 }
31921 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031922 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031923#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +000031924
Daniel Veillard42595322004-11-08 10:52:06 +000031925 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031926}
31927
Daniel Veillarda521d282004-11-09 14:59:59 +000031928#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000031929
Daniel Veillardce682bc2004-11-05 17:22:25 +000031930#define gen_nb_xmlSchemaParserCtxtPtr 1
31931static xmlSchemaParserCtxtPtr gen_xmlSchemaParserCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31932 return(NULL);
31933}
31934static void des_xmlSchemaParserCtxtPtr(int no ATTRIBUTE_UNUSED, xmlSchemaParserCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31935}
Daniel Veillarda521d282004-11-09 14:59:59 +000031936#endif
31937
31938#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000031939
31940#define gen_nb_xmlSchemaValidityErrorFunc_ptr 1
31941static xmlSchemaValidityErrorFunc * gen_xmlSchemaValidityErrorFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31942 return(NULL);
31943}
31944static void des_xmlSchemaValidityErrorFunc_ptr(int no ATTRIBUTE_UNUSED, xmlSchemaValidityErrorFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31945}
Daniel Veillarda521d282004-11-09 14:59:59 +000031946#endif
31947
31948#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000031949
31950#define gen_nb_xmlSchemaValidityWarningFunc_ptr 1
31951static xmlSchemaValidityWarningFunc * gen_xmlSchemaValidityWarningFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31952 return(NULL);
31953}
31954static void des_xmlSchemaValidityWarningFunc_ptr(int no ATTRIBUTE_UNUSED, xmlSchemaValidityWarningFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31955}
Daniel Veillarda521d282004-11-09 14:59:59 +000031956#endif
31957
Daniel Veillardce682bc2004-11-05 17:22:25 +000031958
Daniel Veillardd93f6252004-11-02 15:53:51 +000031959static int
31960test_xmlSchemaGetParserErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031961 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031962
William M. Brack21e4ef22005-01-02 09:53:13 +000031963#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000031964 int mem_base;
31965 int ret_val;
31966 xmlSchemaParserCtxtPtr ctxt; /* a XMl-Schema parser context */
31967 int n_ctxt;
31968 xmlSchemaValidityErrorFunc * err; /* the error callback result */
31969 int n_err;
31970 xmlSchemaValidityWarningFunc * warn; /* the warning callback result */
31971 int n_warn;
31972 void ** ctx; /* contextual data for the callbacks result */
31973 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031974
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000031975 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaParserCtxtPtr;n_ctxt++) {
31976 for (n_err = 0;n_err < gen_nb_xmlSchemaValidityErrorFunc_ptr;n_err++) {
31977 for (n_warn = 0;n_warn < gen_nb_xmlSchemaValidityWarningFunc_ptr;n_warn++) {
31978 for (n_ctx = 0;n_ctx < gen_nb_void_ptr_ptr;n_ctx++) {
31979 mem_base = xmlMemBlocks();
31980 ctxt = gen_xmlSchemaParserCtxtPtr(n_ctxt, 0);
31981 err = gen_xmlSchemaValidityErrorFunc_ptr(n_err, 1);
31982 warn = gen_xmlSchemaValidityWarningFunc_ptr(n_warn, 2);
31983 ctx = gen_void_ptr_ptr(n_ctx, 3);
31984
31985 ret_val = xmlSchemaGetParserErrors(ctxt, err, warn, ctx);
31986 desret_int(ret_val);
31987 call_tests++;
31988 des_xmlSchemaParserCtxtPtr(n_ctxt, ctxt, 0);
31989 des_xmlSchemaValidityErrorFunc_ptr(n_err, err, 1);
31990 des_xmlSchemaValidityWarningFunc_ptr(n_warn, warn, 2);
31991 des_void_ptr_ptr(n_ctx, ctx, 3);
31992 xmlResetLastError();
31993 if (mem_base != xmlMemBlocks()) {
31994 printf("Leak of %d blocks found in xmlSchemaGetParserErrors",
31995 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031996 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000031997 printf(" %d", n_ctxt);
31998 printf(" %d", n_err);
31999 printf(" %d", n_warn);
32000 printf(" %d", n_ctx);
32001 printf("\n");
32002 }
32003 }
32004 }
32005 }
32006 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032007 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000032008#endif
32009
Daniel Veillard42595322004-11-08 10:52:06 +000032010 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032011}
32012
Daniel Veillarda521d282004-11-09 14:59:59 +000032013#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000032014
Daniel Veillardce682bc2004-11-05 17:22:25 +000032015#define gen_nb_xmlSchemaValidCtxtPtr 1
32016static xmlSchemaValidCtxtPtr gen_xmlSchemaValidCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32017 return(NULL);
32018}
32019static void des_xmlSchemaValidCtxtPtr(int no ATTRIBUTE_UNUSED, xmlSchemaValidCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32020}
Daniel Veillarda521d282004-11-09 14:59:59 +000032021#endif
32022
Daniel Veillardce682bc2004-11-05 17:22:25 +000032023
Daniel Veillardd93f6252004-11-02 15:53:51 +000032024static int
32025test_xmlSchemaGetValidErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032026 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032027
William M. Brack21e4ef22005-01-02 09:53:13 +000032028#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000032029 int mem_base;
32030 int ret_val;
32031 xmlSchemaValidCtxtPtr ctxt; /* a XML-Schema validation context */
32032 int n_ctxt;
32033 xmlSchemaValidityErrorFunc * err; /* the error function result */
32034 int n_err;
32035 xmlSchemaValidityWarningFunc * warn; /* the warning function result */
32036 int n_warn;
32037 void ** ctx; /* the functions context result */
32038 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032039
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000032040 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
32041 for (n_err = 0;n_err < gen_nb_xmlSchemaValidityErrorFunc_ptr;n_err++) {
32042 for (n_warn = 0;n_warn < gen_nb_xmlSchemaValidityWarningFunc_ptr;n_warn++) {
32043 for (n_ctx = 0;n_ctx < gen_nb_void_ptr_ptr;n_ctx++) {
32044 mem_base = xmlMemBlocks();
32045 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
32046 err = gen_xmlSchemaValidityErrorFunc_ptr(n_err, 1);
32047 warn = gen_xmlSchemaValidityWarningFunc_ptr(n_warn, 2);
32048 ctx = gen_void_ptr_ptr(n_ctx, 3);
32049
32050 ret_val = xmlSchemaGetValidErrors(ctxt, err, warn, ctx);
32051 desret_int(ret_val);
32052 call_tests++;
32053 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
32054 des_xmlSchemaValidityErrorFunc_ptr(n_err, err, 1);
32055 des_xmlSchemaValidityWarningFunc_ptr(n_warn, warn, 2);
32056 des_void_ptr_ptr(n_ctx, ctx, 3);
32057 xmlResetLastError();
32058 if (mem_base != xmlMemBlocks()) {
32059 printf("Leak of %d blocks found in xmlSchemaGetValidErrors",
32060 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032061 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000032062 printf(" %d", n_ctxt);
32063 printf(" %d", n_err);
32064 printf(" %d", n_warn);
32065 printf(" %d", n_ctx);
32066 printf("\n");
32067 }
32068 }
32069 }
32070 }
32071 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032072 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000032073#endif
32074
Daniel Veillard42595322004-11-08 10:52:06 +000032075 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032076}
32077
32078
32079static int
32080test_xmlSchemaNewDocParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032081 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032082
William M. Brack21e4ef22005-01-02 09:53:13 +000032083#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +000032084 int mem_base;
32085 xmlSchemaParserCtxtPtr ret_val;
32086 xmlDocPtr doc; /* a preparsed document tree */
32087 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032088
Daniel Veillard42595322004-11-08 10:52:06 +000032089 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
32090 mem_base = xmlMemBlocks();
32091 doc = gen_xmlDocPtr(n_doc, 0);
32092
32093 ret_val = xmlSchemaNewDocParserCtxt(doc);
32094 desret_xmlSchemaParserCtxtPtr(ret_val);
32095 call_tests++;
32096 des_xmlDocPtr(n_doc, doc, 0);
32097 xmlResetLastError();
32098 if (mem_base != xmlMemBlocks()) {
32099 printf("Leak of %d blocks found in xmlSchemaNewDocParserCtxt",
32100 xmlMemBlocks() - mem_base);
32101 test_ret++;
32102 printf(" %d", n_doc);
32103 printf("\n");
32104 }
32105 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032106 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032107#endif
32108
Daniel Veillard42595322004-11-08 10:52:06 +000032109 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032110}
32111
32112
32113static int
32114test_xmlSchemaNewMemParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032115 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032116
William M. Brack21e4ef22005-01-02 09:53:13 +000032117#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +000032118 int mem_base;
32119 xmlSchemaParserCtxtPtr ret_val;
32120 char * buffer; /* a pointer to a char array containing the schemas */
32121 int n_buffer;
32122 int size; /* the size of the array */
32123 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032124
Daniel Veillard42595322004-11-08 10:52:06 +000032125 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
32126 for (n_size = 0;n_size < gen_nb_int;n_size++) {
32127 mem_base = xmlMemBlocks();
32128 buffer = gen_const_char_ptr(n_buffer, 0);
32129 size = gen_int(n_size, 1);
32130
William M. Brackf13f77f2004-11-12 16:03:48 +000032131 ret_val = xmlSchemaNewMemParserCtxt((const char *)buffer, size);
Daniel Veillard42595322004-11-08 10:52:06 +000032132 desret_xmlSchemaParserCtxtPtr(ret_val);
32133 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000032134 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard42595322004-11-08 10:52:06 +000032135 des_int(n_size, size, 1);
32136 xmlResetLastError();
32137 if (mem_base != xmlMemBlocks()) {
32138 printf("Leak of %d blocks found in xmlSchemaNewMemParserCtxt",
32139 xmlMemBlocks() - mem_base);
32140 test_ret++;
32141 printf(" %d", n_buffer);
32142 printf(" %d", n_size);
32143 printf("\n");
32144 }
32145 }
32146 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032147 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032148#endif
32149
Daniel Veillard42595322004-11-08 10:52:06 +000032150 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032151}
32152
32153
32154static int
32155test_xmlSchemaNewParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032156 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032157
William M. Brack21e4ef22005-01-02 09:53:13 +000032158#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +000032159 int mem_base;
32160 xmlSchemaParserCtxtPtr ret_val;
32161 char * URL; /* the location of the schema */
32162 int n_URL;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032163
Daniel Veillard42595322004-11-08 10:52:06 +000032164 for (n_URL = 0;n_URL < gen_nb_const_char_ptr;n_URL++) {
32165 mem_base = xmlMemBlocks();
32166 URL = gen_const_char_ptr(n_URL, 0);
32167
William M. Brackf13f77f2004-11-12 16:03:48 +000032168 ret_val = xmlSchemaNewParserCtxt((const char *)URL);
Daniel Veillard42595322004-11-08 10:52:06 +000032169 desret_xmlSchemaParserCtxtPtr(ret_val);
32170 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000032171 des_const_char_ptr(n_URL, (const char *)URL, 0);
Daniel Veillard42595322004-11-08 10:52:06 +000032172 xmlResetLastError();
32173 if (mem_base != xmlMemBlocks()) {
32174 printf("Leak of %d blocks found in xmlSchemaNewParserCtxt",
32175 xmlMemBlocks() - mem_base);
32176 test_ret++;
32177 printf(" %d", n_URL);
32178 printf("\n");
32179 }
32180 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032181 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032182#endif
32183
Daniel Veillard42595322004-11-08 10:52:06 +000032184 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032185}
32186
32187
32188static int
32189test_xmlSchemaNewValidCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032190 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032191
32192
32193 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000032194 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032195}
32196
32197
32198static int
32199test_xmlSchemaParse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032200 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032201
32202
32203 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000032204 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032205}
32206
32207
32208static int
32209test_xmlSchemaSetParserErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032210 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032211
32212
32213 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000032214 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032215}
32216
32217
32218static int
32219test_xmlSchemaSetValidErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032220 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032221
32222
32223 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000032224 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032225}
32226
32227
32228static int
32229test_xmlSchemaSetValidOptions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032230 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032231
William M. Brack21e4ef22005-01-02 09:53:13 +000032232#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032233 int mem_base;
32234 int ret_val;
32235 xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */
32236 int n_ctxt;
32237 int options; /* a combination of xmlSchemaValidOption */
32238 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032239
Daniel Veillardce682bc2004-11-05 17:22:25 +000032240 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
32241 for (n_options = 0;n_options < gen_nb_int;n_options++) {
32242 mem_base = xmlMemBlocks();
32243 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
32244 options = gen_int(n_options, 1);
32245
32246 ret_val = xmlSchemaSetValidOptions(ctxt, options);
32247 desret_int(ret_val);
32248 call_tests++;
32249 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
32250 des_int(n_options, options, 1);
32251 xmlResetLastError();
32252 if (mem_base != xmlMemBlocks()) {
32253 printf("Leak of %d blocks found in xmlSchemaSetValidOptions",
32254 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032255 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032256 printf(" %d", n_ctxt);
32257 printf(" %d", n_options);
32258 printf("\n");
32259 }
32260 }
32261 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032262 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032263#endif
32264
Daniel Veillard42595322004-11-08 10:52:06 +000032265 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032266}
32267
32268
32269static int
32270test_xmlSchemaValidCtxtGetOptions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032271 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032272
William M. Brack21e4ef22005-01-02 09:53:13 +000032273#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032274 int mem_base;
32275 int ret_val;
32276 xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */
32277 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032278
Daniel Veillardce682bc2004-11-05 17:22:25 +000032279 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
32280 mem_base = xmlMemBlocks();
32281 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
32282
32283 ret_val = xmlSchemaValidCtxtGetOptions(ctxt);
32284 desret_int(ret_val);
32285 call_tests++;
32286 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
32287 xmlResetLastError();
32288 if (mem_base != xmlMemBlocks()) {
32289 printf("Leak of %d blocks found in xmlSchemaValidCtxtGetOptions",
32290 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032291 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032292 printf(" %d", n_ctxt);
32293 printf("\n");
32294 }
32295 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032296 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032297#endif
32298
Daniel Veillard42595322004-11-08 10:52:06 +000032299 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032300}
32301
32302
32303static int
32304test_xmlSchemaValidateDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032305 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032306
William M. Brack21e4ef22005-01-02 09:53:13 +000032307#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032308 int mem_base;
32309 int ret_val;
32310 xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */
32311 int n_ctxt;
32312 xmlDocPtr doc; /* a parsed document tree */
32313 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032314
Daniel Veillardce682bc2004-11-05 17:22:25 +000032315 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
32316 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
32317 mem_base = xmlMemBlocks();
32318 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
32319 doc = gen_xmlDocPtr(n_doc, 1);
32320
32321 ret_val = xmlSchemaValidateDoc(ctxt, doc);
32322 desret_int(ret_val);
32323 call_tests++;
32324 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
32325 des_xmlDocPtr(n_doc, doc, 1);
32326 xmlResetLastError();
32327 if (mem_base != xmlMemBlocks()) {
32328 printf("Leak of %d blocks found in xmlSchemaValidateDoc",
32329 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032330 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032331 printf(" %d", n_ctxt);
32332 printf(" %d", n_doc);
32333 printf("\n");
32334 }
32335 }
32336 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032337 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032338#endif
32339
Daniel Veillard42595322004-11-08 10:52:06 +000032340 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032341}
32342
32343
32344static int
32345test_xmlSchemaValidateOneElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032346 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032347
William M. Brack21e4ef22005-01-02 09:53:13 +000032348#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032349 int mem_base;
32350 int ret_val;
32351 xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */
32352 int n_ctxt;
32353 xmlNodePtr elem; /* an element node */
32354 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032355
Daniel Veillardce682bc2004-11-05 17:22:25 +000032356 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
32357 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
32358 mem_base = xmlMemBlocks();
32359 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
32360 elem = gen_xmlNodePtr(n_elem, 1);
32361
32362 ret_val = xmlSchemaValidateOneElement(ctxt, elem);
32363 desret_int(ret_val);
32364 call_tests++;
32365 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
32366 des_xmlNodePtr(n_elem, elem, 1);
32367 xmlResetLastError();
32368 if (mem_base != xmlMemBlocks()) {
32369 printf("Leak of %d blocks found in xmlSchemaValidateOneElement",
32370 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032371 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032372 printf(" %d", n_ctxt);
32373 printf(" %d", n_elem);
32374 printf("\n");
32375 }
32376 }
32377 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032378 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032379#endif
32380
Daniel Veillard42595322004-11-08 10:52:06 +000032381 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032382}
32383
32384
32385static int
32386test_xmlSchemaValidateStream(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032387 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032388
William M. Brack21e4ef22005-01-02 09:53:13 +000032389#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032390 int mem_base;
32391 int ret_val;
32392 xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */
32393 int n_ctxt;
32394 xmlParserInputBufferPtr input; /* the input to use for reading the data */
32395 int n_input;
32396 xmlCharEncoding enc; /* an optional encoding information */
32397 int n_enc;
32398 xmlSAXHandlerPtr sax; /* a SAX handler for the resulting events */
32399 int n_sax;
32400 void * user_data; /* the context to provide to the SAX handler. */
32401 int n_user_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032402
Daniel Veillardce682bc2004-11-05 17:22:25 +000032403 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
32404 for (n_input = 0;n_input < gen_nb_xmlParserInputBufferPtr;n_input++) {
32405 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
32406 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
32407 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
32408 mem_base = xmlMemBlocks();
32409 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
32410 input = gen_xmlParserInputBufferPtr(n_input, 1);
32411 enc = gen_xmlCharEncoding(n_enc, 2);
32412 sax = gen_xmlSAXHandlerPtr(n_sax, 3);
32413 user_data = gen_userdata(n_user_data, 4);
32414
32415 ret_val = xmlSchemaValidateStream(ctxt, input, enc, sax, user_data);
32416 desret_int(ret_val);
32417 call_tests++;
32418 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
32419 des_xmlParserInputBufferPtr(n_input, input, 1);
32420 des_xmlCharEncoding(n_enc, enc, 2);
32421 des_xmlSAXHandlerPtr(n_sax, sax, 3);
32422 des_userdata(n_user_data, user_data, 4);
32423 xmlResetLastError();
32424 if (mem_base != xmlMemBlocks()) {
32425 printf("Leak of %d blocks found in xmlSchemaValidateStream",
32426 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032427 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032428 printf(" %d", n_ctxt);
32429 printf(" %d", n_input);
32430 printf(" %d", n_enc);
32431 printf(" %d", n_sax);
32432 printf(" %d", n_user_data);
32433 printf("\n");
32434 }
32435 }
32436 }
32437 }
32438 }
32439 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032440 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032441#endif
32442
Daniel Veillard42595322004-11-08 10:52:06 +000032443 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032444}
32445
32446static int
32447test_xmlschemas(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032448 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032449
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032450 if (quiet == 0) printf("Testing xmlschemas : 11 of 18 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000032451 test_ret += test_xmlSchemaDump();
32452 test_ret += test_xmlSchemaGetParserErrors();
32453 test_ret += test_xmlSchemaGetValidErrors();
32454 test_ret += test_xmlSchemaNewDocParserCtxt();
32455 test_ret += test_xmlSchemaNewMemParserCtxt();
32456 test_ret += test_xmlSchemaNewParserCtxt();
32457 test_ret += test_xmlSchemaNewValidCtxt();
32458 test_ret += test_xmlSchemaParse();
32459 test_ret += test_xmlSchemaSetParserErrors();
32460 test_ret += test_xmlSchemaSetValidErrors();
32461 test_ret += test_xmlSchemaSetValidOptions();
32462 test_ret += test_xmlSchemaValidCtxtGetOptions();
32463 test_ret += test_xmlSchemaValidateDoc();
32464 test_ret += test_xmlSchemaValidateOneElement();
32465 test_ret += test_xmlSchemaValidateStream();
Daniel Veillardd93f6252004-11-02 15:53:51 +000032466
Daniel Veillard42595322004-11-08 10:52:06 +000032467 if (test_ret != 0)
32468 printf("Module xmlschemas: %d errors\n", test_ret);
32469 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032470}
Daniel Veillarda521d282004-11-09 14:59:59 +000032471#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000032472
Daniel Veillardce682bc2004-11-05 17:22:25 +000032473#define gen_nb_xmlSchemaFacetPtr 1
32474static xmlSchemaFacetPtr gen_xmlSchemaFacetPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32475 return(NULL);
32476}
32477static void des_xmlSchemaFacetPtr(int no ATTRIBUTE_UNUSED, xmlSchemaFacetPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32478}
Daniel Veillarda521d282004-11-09 14:59:59 +000032479#endif
32480
32481#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000032482
32483#define gen_nb_xmlSchemaTypePtr 1
32484static xmlSchemaTypePtr gen_xmlSchemaTypePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32485 return(NULL);
32486}
32487static void des_xmlSchemaTypePtr(int no ATTRIBUTE_UNUSED, xmlSchemaTypePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32488}
Daniel Veillarda521d282004-11-09 14:59:59 +000032489#endif
32490
Daniel Veillardce682bc2004-11-05 17:22:25 +000032491
Daniel Veillardd93f6252004-11-02 15:53:51 +000032492static int
32493test_xmlSchemaCheckFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032494 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032495
William M. Brack21e4ef22005-01-02 09:53:13 +000032496#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032497 int mem_base;
32498 int ret_val;
32499 xmlSchemaFacetPtr facet; /* the facet */
32500 int n_facet;
32501 xmlSchemaTypePtr typeDecl; /* the schema type definition */
32502 int n_typeDecl;
32503 xmlSchemaParserCtxtPtr ctxt; /* the schema parser context or NULL */
32504 int n_ctxt;
32505 xmlChar * name; /* name of the type */
32506 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032507
Daniel Veillardce682bc2004-11-05 17:22:25 +000032508 for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) {
32509 for (n_typeDecl = 0;n_typeDecl < gen_nb_xmlSchemaTypePtr;n_typeDecl++) {
32510 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaParserCtxtPtr;n_ctxt++) {
32511 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
32512 mem_base = xmlMemBlocks();
32513 facet = gen_xmlSchemaFacetPtr(n_facet, 0);
32514 typeDecl = gen_xmlSchemaTypePtr(n_typeDecl, 1);
32515 ctxt = gen_xmlSchemaParserCtxtPtr(n_ctxt, 2);
32516 name = gen_const_xmlChar_ptr(n_name, 3);
32517
William M. Brackf13f77f2004-11-12 16:03:48 +000032518 ret_val = xmlSchemaCheckFacet(facet, typeDecl, ctxt, (const xmlChar *)name);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032519 desret_int(ret_val);
32520 call_tests++;
32521 des_xmlSchemaFacetPtr(n_facet, facet, 0);
32522 des_xmlSchemaTypePtr(n_typeDecl, typeDecl, 1);
32523 des_xmlSchemaParserCtxtPtr(n_ctxt, ctxt, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000032524 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 3);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032525 xmlResetLastError();
32526 if (mem_base != xmlMemBlocks()) {
32527 printf("Leak of %d blocks found in xmlSchemaCheckFacet",
32528 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032529 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032530 printf(" %d", n_facet);
32531 printf(" %d", n_typeDecl);
32532 printf(" %d", n_ctxt);
32533 printf(" %d", n_name);
32534 printf("\n");
32535 }
32536 }
32537 }
32538 }
32539 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032540 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032541#endif
32542
Daniel Veillard42595322004-11-08 10:52:06 +000032543 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032544}
32545
32546
32547static int
32548test_xmlSchemaCleanupTypes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032549 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032550
William M. Brack21e4ef22005-01-02 09:53:13 +000032551#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000032552 int mem_base;
32553
32554 mem_base = xmlMemBlocks();
32555
32556 xmlSchemaCleanupTypes();
32557 call_tests++;
32558 xmlResetLastError();
32559 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000032560 printf("Leak of %d blocks found in xmlSchemaCleanupTypes",
Daniel Veillardd93f6252004-11-02 15:53:51 +000032561 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032562 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000032563 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000032564 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032565 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +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_xmlSchemaCollapseString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032574 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032575
William M. Brack21e4ef22005-01-02 09:53:13 +000032576#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032577 int mem_base;
32578 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032579 xmlChar * value; /* a value */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032580 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032581
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032582 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
32583 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000032584 value = gen_const_xmlChar_ptr(n_value, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032585
William M. Brackf13f77f2004-11-12 16:03:48 +000032586 ret_val = xmlSchemaCollapseString((const xmlChar *)value);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032587 desret_xmlChar_ptr(ret_val);
32588 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000032589 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032590 xmlResetLastError();
32591 if (mem_base != xmlMemBlocks()) {
32592 printf("Leak of %d blocks found in xmlSchemaCollapseString",
32593 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032594 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032595 printf(" %d", n_value);
32596 printf("\n");
32597 }
32598 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032599 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032600#endif
32601
Daniel Veillard42595322004-11-08 10:52:06 +000032602 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032603}
32604
Daniel Veillarda521d282004-11-09 14:59:59 +000032605#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000032606
Daniel Veillardce682bc2004-11-05 17:22:25 +000032607#define gen_nb_xmlSchemaValPtr 1
32608static xmlSchemaValPtr gen_xmlSchemaValPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32609 return(NULL);
32610}
32611static void des_xmlSchemaValPtr(int no ATTRIBUTE_UNUSED, xmlSchemaValPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32612}
Daniel Veillarda521d282004-11-09 14:59:59 +000032613#endif
32614
Daniel Veillardce682bc2004-11-05 17:22:25 +000032615
Daniel Veillardd93f6252004-11-02 15:53:51 +000032616static int
32617test_xmlSchemaCompareValues(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032618 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032619
William M. Brack21e4ef22005-01-02 09:53:13 +000032620#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032621 int mem_base;
32622 int ret_val;
32623 xmlSchemaValPtr x; /* a first value */
32624 int n_x;
32625 xmlSchemaValPtr y; /* a second value */
32626 int n_y;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032627
Daniel Veillardce682bc2004-11-05 17:22:25 +000032628 for (n_x = 0;n_x < gen_nb_xmlSchemaValPtr;n_x++) {
32629 for (n_y = 0;n_y < gen_nb_xmlSchemaValPtr;n_y++) {
32630 mem_base = xmlMemBlocks();
32631 x = gen_xmlSchemaValPtr(n_x, 0);
32632 y = gen_xmlSchemaValPtr(n_y, 1);
32633
32634 ret_val = xmlSchemaCompareValues(x, y);
32635 desret_int(ret_val);
32636 call_tests++;
32637 des_xmlSchemaValPtr(n_x, x, 0);
32638 des_xmlSchemaValPtr(n_y, y, 1);
32639 xmlResetLastError();
32640 if (mem_base != xmlMemBlocks()) {
32641 printf("Leak of %d blocks found in xmlSchemaCompareValues",
32642 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032643 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032644 printf(" %d", n_x);
32645 printf(" %d", n_y);
32646 printf("\n");
32647 }
32648 }
32649 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032650 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032651#endif
32652
Daniel Veillard42595322004-11-08 10:52:06 +000032653 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032654}
32655
32656
32657static int
32658test_xmlSchemaGetBuiltInListSimpleTypeItemType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032659 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032660
William M. Brack21e4ef22005-01-02 09:53:13 +000032661#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +000032662 int mem_base;
32663 xmlSchemaTypePtr ret_val;
32664 xmlSchemaTypePtr type; /* the built-in simple type. */
32665 int n_type;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032666
Daniel Veillard42595322004-11-08 10:52:06 +000032667 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
32668 mem_base = xmlMemBlocks();
32669 type = gen_xmlSchemaTypePtr(n_type, 0);
32670
32671 ret_val = xmlSchemaGetBuiltInListSimpleTypeItemType(type);
32672 desret_xmlSchemaTypePtr(ret_val);
32673 call_tests++;
32674 des_xmlSchemaTypePtr(n_type, type, 0);
32675 xmlResetLastError();
32676 if (mem_base != xmlMemBlocks()) {
32677 printf("Leak of %d blocks found in xmlSchemaGetBuiltInListSimpleTypeItemType",
32678 xmlMemBlocks() - mem_base);
32679 test_ret++;
32680 printf(" %d", n_type);
32681 printf("\n");
32682 }
32683 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032684 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032685#endif
32686
Daniel Veillard42595322004-11-08 10:52:06 +000032687 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032688}
32689
32690
32691static int
32692test_xmlSchemaGetBuiltInType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032693 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032694
William M. Brack21e4ef22005-01-02 09:53:13 +000032695#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +000032696 xmlSchemaTypePtr ret_val;
32697 xmlSchemaValType type; /* the type of the built in type */
32698 int n_type;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032699
Daniel Veillard42595322004-11-08 10:52:06 +000032700 for (n_type = 0;n_type < gen_nb_xmlSchemaValType;n_type++) {
32701 type = gen_xmlSchemaValType(n_type, 0);
32702
32703 ret_val = xmlSchemaGetBuiltInType(type);
32704 desret_xmlSchemaTypePtr(ret_val);
32705 call_tests++;
32706 des_xmlSchemaValType(n_type, type, 0);
32707 xmlResetLastError();
32708 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032709 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032710#endif
32711
Daniel Veillard42595322004-11-08 10:52:06 +000032712 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032713}
32714
32715
32716static int
32717test_xmlSchemaGetFacetValueAsULong(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032718 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032719
William M. Brack21e4ef22005-01-02 09:53:13 +000032720#if defined(LIBXML_SCHEMAS_ENABLED)
William M. Brack094dd862004-11-14 14:28:34 +000032721 int mem_base;
32722 unsigned long ret_val;
32723 xmlSchemaFacetPtr facet; /* an schemas type facet */
32724 int n_facet;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032725
William M. Brack094dd862004-11-14 14:28:34 +000032726 for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) {
32727 mem_base = xmlMemBlocks();
32728 facet = gen_xmlSchemaFacetPtr(n_facet, 0);
32729
32730 ret_val = xmlSchemaGetFacetValueAsULong(facet);
32731 desret_unsigned_long(ret_val);
32732 call_tests++;
32733 des_xmlSchemaFacetPtr(n_facet, facet, 0);
32734 xmlResetLastError();
32735 if (mem_base != xmlMemBlocks()) {
32736 printf("Leak of %d blocks found in xmlSchemaGetFacetValueAsULong",
32737 xmlMemBlocks() - mem_base);
32738 test_ret++;
32739 printf(" %d", n_facet);
32740 printf("\n");
32741 }
32742 }
32743 function_tests++;
32744#endif
32745
Daniel Veillard42595322004-11-08 10:52:06 +000032746 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032747}
32748
32749
32750static int
32751test_xmlSchemaGetPredefinedType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032752 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032753
William M. Brack21e4ef22005-01-02 09:53:13 +000032754#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +000032755 int mem_base;
32756 xmlSchemaTypePtr ret_val;
32757 xmlChar * name; /* the type name */
32758 int n_name;
32759 xmlChar * ns; /* the URI of the namespace usually "http://www.w3.org/2001/XMLSchema" */
32760 int n_ns;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032761
Daniel Veillard42595322004-11-08 10:52:06 +000032762 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
32763 for (n_ns = 0;n_ns < gen_nb_const_xmlChar_ptr;n_ns++) {
32764 mem_base = xmlMemBlocks();
32765 name = gen_const_xmlChar_ptr(n_name, 0);
32766 ns = gen_const_xmlChar_ptr(n_ns, 1);
32767
William M. Brackf13f77f2004-11-12 16:03:48 +000032768 ret_val = xmlSchemaGetPredefinedType((const xmlChar *)name, (const xmlChar *)ns);
Daniel Veillard42595322004-11-08 10:52:06 +000032769 desret_xmlSchemaTypePtr(ret_val);
32770 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000032771 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
32772 des_const_xmlChar_ptr(n_ns, (const xmlChar *)ns, 1);
Daniel Veillard42595322004-11-08 10:52:06 +000032773 xmlResetLastError();
32774 if (mem_base != xmlMemBlocks()) {
32775 printf("Leak of %d blocks found in xmlSchemaGetPredefinedType",
32776 xmlMemBlocks() - mem_base);
32777 test_ret++;
32778 printf(" %d", n_name);
32779 printf(" %d", n_ns);
32780 printf("\n");
32781 }
32782 }
32783 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032784 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032785#endif
32786
Daniel Veillard42595322004-11-08 10:52:06 +000032787 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032788}
32789
32790
32791static int
32792test_xmlSchemaInitTypes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032793 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032794
William M. Brack21e4ef22005-01-02 09:53:13 +000032795#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000032796
32797
32798 xmlSchemaInitTypes();
32799 call_tests++;
32800 xmlResetLastError();
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032801 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032802#endif
32803
Daniel Veillard42595322004-11-08 10:52:06 +000032804 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032805}
32806
32807
32808static int
32809test_xmlSchemaIsBuiltInTypeFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032810 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032811
William M. Brack21e4ef22005-01-02 09:53:13 +000032812#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032813 int mem_base;
32814 int ret_val;
32815 xmlSchemaTypePtr type; /* the built-in type */
32816 int n_type;
32817 int facetType; /* the facet type */
32818 int n_facetType;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032819
Daniel Veillardce682bc2004-11-05 17:22:25 +000032820 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
32821 for (n_facetType = 0;n_facetType < gen_nb_int;n_facetType++) {
32822 mem_base = xmlMemBlocks();
32823 type = gen_xmlSchemaTypePtr(n_type, 0);
32824 facetType = gen_int(n_facetType, 1);
32825
32826 ret_val = xmlSchemaIsBuiltInTypeFacet(type, facetType);
32827 desret_int(ret_val);
32828 call_tests++;
32829 des_xmlSchemaTypePtr(n_type, type, 0);
32830 des_int(n_facetType, facetType, 1);
32831 xmlResetLastError();
32832 if (mem_base != xmlMemBlocks()) {
32833 printf("Leak of %d blocks found in xmlSchemaIsBuiltInTypeFacet",
32834 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032835 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032836 printf(" %d", n_type);
32837 printf(" %d", n_facetType);
32838 printf("\n");
32839 }
32840 }
32841 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032842 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032843#endif
32844
Daniel Veillard42595322004-11-08 10:52:06 +000032845 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032846}
32847
32848
32849static int
32850test_xmlSchemaNewFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032851 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032852
32853
32854 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000032855 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032856}
32857
Daniel Veillarda521d282004-11-09 14:59:59 +000032858#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000032859
Daniel Veillardce682bc2004-11-05 17:22:25 +000032860#define gen_nb_xmlSchemaValPtr_ptr 1
32861static xmlSchemaValPtr * gen_xmlSchemaValPtr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32862 return(NULL);
32863}
32864static void des_xmlSchemaValPtr_ptr(int no ATTRIBUTE_UNUSED, xmlSchemaValPtr * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32865}
Daniel Veillarda521d282004-11-09 14:59:59 +000032866#endif
32867
Daniel Veillardce682bc2004-11-05 17:22:25 +000032868
Daniel Veillardd93f6252004-11-02 15:53:51 +000032869static int
32870test_xmlSchemaValPredefTypeNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032871 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032872
William M. Brack21e4ef22005-01-02 09:53:13 +000032873#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032874 int mem_base;
32875 int ret_val;
32876 xmlSchemaTypePtr type; /* the predefined type */
32877 int n_type;
32878 xmlChar * value; /* the value to check */
32879 int n_value;
32880 xmlSchemaValPtr * val; /* the return computed value */
32881 int n_val;
32882 xmlNodePtr node; /* the node containing the value */
32883 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032884
Daniel Veillardce682bc2004-11-05 17:22:25 +000032885 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
32886 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
32887 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr_ptr;n_val++) {
32888 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
32889 mem_base = xmlMemBlocks();
32890 type = gen_xmlSchemaTypePtr(n_type, 0);
32891 value = gen_const_xmlChar_ptr(n_value, 1);
32892 val = gen_xmlSchemaValPtr_ptr(n_val, 2);
32893 node = gen_xmlNodePtr(n_node, 3);
32894
William M. Brackf13f77f2004-11-12 16:03:48 +000032895 ret_val = xmlSchemaValPredefTypeNode(type, (const xmlChar *)value, val, node);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032896 desret_int(ret_val);
32897 call_tests++;
32898 des_xmlSchemaTypePtr(n_type, type, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000032899 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032900 des_xmlSchemaValPtr_ptr(n_val, val, 2);
32901 des_xmlNodePtr(n_node, node, 3);
32902 xmlResetLastError();
32903 if (mem_base != xmlMemBlocks()) {
32904 printf("Leak of %d blocks found in xmlSchemaValPredefTypeNode",
32905 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032906 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032907 printf(" %d", n_type);
32908 printf(" %d", n_value);
32909 printf(" %d", n_val);
32910 printf(" %d", n_node);
32911 printf("\n");
32912 }
32913 }
32914 }
32915 }
32916 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032917 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032918#endif
32919
Daniel Veillard42595322004-11-08 10:52:06 +000032920 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032921}
32922
32923
32924static int
32925test_xmlSchemaValPredefTypeNodeNoNorm(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032926 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032927
William M. Brack21e4ef22005-01-02 09:53:13 +000032928#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032929 int mem_base;
32930 int ret_val;
32931 xmlSchemaTypePtr type; /* the predefined type */
32932 int n_type;
32933 xmlChar * value; /* the value to check */
32934 int n_value;
32935 xmlSchemaValPtr * val; /* the return computed value */
32936 int n_val;
32937 xmlNodePtr node; /* the node containing the value */
32938 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032939
Daniel Veillardce682bc2004-11-05 17:22:25 +000032940 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
32941 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
32942 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr_ptr;n_val++) {
32943 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
32944 mem_base = xmlMemBlocks();
32945 type = gen_xmlSchemaTypePtr(n_type, 0);
32946 value = gen_const_xmlChar_ptr(n_value, 1);
32947 val = gen_xmlSchemaValPtr_ptr(n_val, 2);
32948 node = gen_xmlNodePtr(n_node, 3);
32949
William M. Brackf13f77f2004-11-12 16:03:48 +000032950 ret_val = xmlSchemaValPredefTypeNodeNoNorm(type, (const xmlChar *)value, val, node);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032951 desret_int(ret_val);
32952 call_tests++;
32953 des_xmlSchemaTypePtr(n_type, type, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000032954 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032955 des_xmlSchemaValPtr_ptr(n_val, val, 2);
32956 des_xmlNodePtr(n_node, node, 3);
32957 xmlResetLastError();
32958 if (mem_base != xmlMemBlocks()) {
32959 printf("Leak of %d blocks found in xmlSchemaValPredefTypeNodeNoNorm",
32960 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032961 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032962 printf(" %d", n_type);
32963 printf(" %d", n_value);
32964 printf(" %d", n_val);
32965 printf(" %d", n_node);
32966 printf("\n");
32967 }
32968 }
32969 }
32970 }
32971 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032972 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032973#endif
32974
Daniel Veillard42595322004-11-08 10:52:06 +000032975 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032976}
32977
32978
32979static int
32980test_xmlSchemaValidateFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032981 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032982
William M. Brack21e4ef22005-01-02 09:53:13 +000032983#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032984 int mem_base;
32985 int ret_val;
32986 xmlSchemaTypePtr base; /* the base type */
32987 int n_base;
32988 xmlSchemaFacetPtr facet; /* the facet to check */
32989 int n_facet;
32990 xmlChar * value; /* the lexical repr of the value to validate */
32991 int n_value;
32992 xmlSchemaValPtr val; /* the precomputed value */
32993 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032994
Daniel Veillardce682bc2004-11-05 17:22:25 +000032995 for (n_base = 0;n_base < gen_nb_xmlSchemaTypePtr;n_base++) {
32996 for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) {
32997 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
32998 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr;n_val++) {
32999 mem_base = xmlMemBlocks();
33000 base = gen_xmlSchemaTypePtr(n_base, 0);
33001 facet = gen_xmlSchemaFacetPtr(n_facet, 1);
33002 value = gen_const_xmlChar_ptr(n_value, 2);
33003 val = gen_xmlSchemaValPtr(n_val, 3);
33004
William M. Brackf13f77f2004-11-12 16:03:48 +000033005 ret_val = xmlSchemaValidateFacet(base, facet, (const xmlChar *)value, val);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033006 desret_int(ret_val);
33007 call_tests++;
33008 des_xmlSchemaTypePtr(n_base, base, 0);
33009 des_xmlSchemaFacetPtr(n_facet, facet, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000033010 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033011 des_xmlSchemaValPtr(n_val, val, 3);
33012 xmlResetLastError();
33013 if (mem_base != xmlMemBlocks()) {
33014 printf("Leak of %d blocks found in xmlSchemaValidateFacet",
33015 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033016 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033017 printf(" %d", n_base);
33018 printf(" %d", n_facet);
33019 printf(" %d", n_value);
33020 printf(" %d", n_val);
33021 printf("\n");
33022 }
33023 }
33024 }
33025 }
33026 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033027 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033028#endif
33029
Daniel Veillard42595322004-11-08 10:52:06 +000033030 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033031}
33032
33033
33034static int
33035test_xmlSchemaValidateLengthFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033036 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033037
William M. Brack21e4ef22005-01-02 09:53:13 +000033038#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000033039 int mem_base;
33040 int ret_val;
33041 xmlSchemaTypePtr type; /* the built-in type */
33042 int n_type;
33043 xmlSchemaFacetPtr facet; /* the facet to check */
33044 int n_facet;
33045 xmlChar * value; /* the lexical repr. of the value to be validated */
33046 int n_value;
33047 xmlSchemaValPtr val; /* the precomputed value */
33048 int n_val;
33049 unsigned long * length; /* the actual length of the value */
33050 int n_length;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033051
Daniel Veillardce682bc2004-11-05 17:22:25 +000033052 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
33053 for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) {
33054 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
33055 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr;n_val++) {
33056 for (n_length = 0;n_length < gen_nb_unsigned_long_ptr;n_length++) {
33057 mem_base = xmlMemBlocks();
33058 type = gen_xmlSchemaTypePtr(n_type, 0);
33059 facet = gen_xmlSchemaFacetPtr(n_facet, 1);
33060 value = gen_const_xmlChar_ptr(n_value, 2);
33061 val = gen_xmlSchemaValPtr(n_val, 3);
33062 length = gen_unsigned_long_ptr(n_length, 4);
33063
William M. Brackf13f77f2004-11-12 16:03:48 +000033064 ret_val = xmlSchemaValidateLengthFacet(type, facet, (const xmlChar *)value, val, length);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033065 desret_int(ret_val);
33066 call_tests++;
33067 des_xmlSchemaTypePtr(n_type, type, 0);
33068 des_xmlSchemaFacetPtr(n_facet, facet, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000033069 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033070 des_xmlSchemaValPtr(n_val, val, 3);
33071 des_unsigned_long_ptr(n_length, length, 4);
33072 xmlResetLastError();
33073 if (mem_base != xmlMemBlocks()) {
33074 printf("Leak of %d blocks found in xmlSchemaValidateLengthFacet",
33075 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033076 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033077 printf(" %d", n_type);
33078 printf(" %d", n_facet);
33079 printf(" %d", n_value);
33080 printf(" %d", n_val);
33081 printf(" %d", n_length);
33082 printf("\n");
33083 }
33084 }
33085 }
33086 }
33087 }
33088 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033089 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033090#endif
33091
Daniel Veillard42595322004-11-08 10:52:06 +000033092 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033093}
33094
33095
33096static int
33097test_xmlSchemaValidateListSimpleTypeFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033098 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033099
William M. Brack21e4ef22005-01-02 09:53:13 +000033100#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000033101 int mem_base;
33102 int ret_val;
33103 xmlSchemaFacetPtr facet; /* the facet to check */
33104 int n_facet;
33105 xmlChar * value; /* the lexical repr of the value to validate */
33106 int n_value;
33107 unsigned long actualLen; /* the number of list items */
33108 int n_actualLen;
33109 unsigned long * expectedLen; /* the resulting expected number of list items */
33110 int n_expectedLen;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033111
Daniel Veillardce682bc2004-11-05 17:22:25 +000033112 for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) {
33113 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
33114 for (n_actualLen = 0;n_actualLen < gen_nb_unsigned_long;n_actualLen++) {
33115 for (n_expectedLen = 0;n_expectedLen < gen_nb_unsigned_long_ptr;n_expectedLen++) {
33116 mem_base = xmlMemBlocks();
33117 facet = gen_xmlSchemaFacetPtr(n_facet, 0);
33118 value = gen_const_xmlChar_ptr(n_value, 1);
33119 actualLen = gen_unsigned_long(n_actualLen, 2);
33120 expectedLen = gen_unsigned_long_ptr(n_expectedLen, 3);
33121
William M. Brackf13f77f2004-11-12 16:03:48 +000033122 ret_val = xmlSchemaValidateListSimpleTypeFacet(facet, (const xmlChar *)value, actualLen, expectedLen);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033123 desret_int(ret_val);
33124 call_tests++;
33125 des_xmlSchemaFacetPtr(n_facet, facet, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000033126 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033127 des_unsigned_long(n_actualLen, actualLen, 2);
33128 des_unsigned_long_ptr(n_expectedLen, expectedLen, 3);
33129 xmlResetLastError();
33130 if (mem_base != xmlMemBlocks()) {
33131 printf("Leak of %d blocks found in xmlSchemaValidateListSimpleTypeFacet",
33132 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033133 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033134 printf(" %d", n_facet);
33135 printf(" %d", n_value);
33136 printf(" %d", n_actualLen);
33137 printf(" %d", n_expectedLen);
33138 printf("\n");
33139 }
33140 }
33141 }
33142 }
33143 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033144 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033145#endif
33146
Daniel Veillard42595322004-11-08 10:52:06 +000033147 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033148}
33149
33150
33151static int
33152test_xmlSchemaValidatePredefinedType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033153 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033154
William M. Brack21e4ef22005-01-02 09:53:13 +000033155#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000033156 int mem_base;
33157 int ret_val;
33158 xmlSchemaTypePtr type; /* the predefined type */
33159 int n_type;
33160 xmlChar * value; /* the value to check */
33161 int n_value;
33162 xmlSchemaValPtr * val; /* the return computed value */
33163 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033164
Daniel Veillardce682bc2004-11-05 17:22:25 +000033165 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
33166 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
33167 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr_ptr;n_val++) {
33168 mem_base = xmlMemBlocks();
33169 type = gen_xmlSchemaTypePtr(n_type, 0);
33170 value = gen_const_xmlChar_ptr(n_value, 1);
33171 val = gen_xmlSchemaValPtr_ptr(n_val, 2);
33172
William M. Brackf13f77f2004-11-12 16:03:48 +000033173 ret_val = xmlSchemaValidatePredefinedType(type, (const xmlChar *)value, val);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033174 desret_int(ret_val);
33175 call_tests++;
33176 des_xmlSchemaTypePtr(n_type, type, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000033177 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033178 des_xmlSchemaValPtr_ptr(n_val, val, 2);
33179 xmlResetLastError();
33180 if (mem_base != xmlMemBlocks()) {
33181 printf("Leak of %d blocks found in xmlSchemaValidatePredefinedType",
33182 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033183 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033184 printf(" %d", n_type);
33185 printf(" %d", n_value);
33186 printf(" %d", n_val);
33187 printf("\n");
33188 }
33189 }
33190 }
33191 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033192 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033193#endif
33194
Daniel Veillard42595322004-11-08 10:52:06 +000033195 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033196}
33197
Daniel Veillard91b955c2004-12-10 10:26:42 +000033198
33199static int
33200test_xmlSchemaWhiteSpaceReplace(void) {
33201 int test_ret = 0;
33202
William M. Brack21e4ef22005-01-02 09:53:13 +000033203#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard91b955c2004-12-10 10:26:42 +000033204 int mem_base;
33205 xmlChar * ret_val;
33206 xmlChar * value; /* a value */
33207 int n_value;
33208
33209 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
33210 mem_base = xmlMemBlocks();
33211 value = gen_const_xmlChar_ptr(n_value, 0);
33212
33213 ret_val = xmlSchemaWhiteSpaceReplace((const xmlChar *)value);
33214 desret_xmlChar_ptr(ret_val);
33215 call_tests++;
33216 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
33217 xmlResetLastError();
33218 if (mem_base != xmlMemBlocks()) {
33219 printf("Leak of %d blocks found in xmlSchemaWhiteSpaceReplace",
33220 xmlMemBlocks() - mem_base);
33221 test_ret++;
33222 printf(" %d", n_value);
33223 printf("\n");
33224 }
33225 }
33226 function_tests++;
33227#endif
33228
33229 return(test_ret);
33230}
33231
Daniel Veillardd93f6252004-11-02 15:53:51 +000033232static int
33233test_xmlschemastypes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033234 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033235
Daniel Veillard91b955c2004-12-10 10:26:42 +000033236 if (quiet == 0) printf("Testing xmlschemastypes : 17 of 20 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000033237 test_ret += test_xmlSchemaCheckFacet();
33238 test_ret += test_xmlSchemaCleanupTypes();
33239 test_ret += test_xmlSchemaCollapseString();
33240 test_ret += test_xmlSchemaCompareValues();
33241 test_ret += test_xmlSchemaGetBuiltInListSimpleTypeItemType();
33242 test_ret += test_xmlSchemaGetBuiltInType();
33243 test_ret += test_xmlSchemaGetFacetValueAsULong();
33244 test_ret += test_xmlSchemaGetPredefinedType();
33245 test_ret += test_xmlSchemaInitTypes();
33246 test_ret += test_xmlSchemaIsBuiltInTypeFacet();
33247 test_ret += test_xmlSchemaNewFacet();
33248 test_ret += test_xmlSchemaValPredefTypeNode();
33249 test_ret += test_xmlSchemaValPredefTypeNodeNoNorm();
33250 test_ret += test_xmlSchemaValidateFacet();
33251 test_ret += test_xmlSchemaValidateLengthFacet();
33252 test_ret += test_xmlSchemaValidateListSimpleTypeFacet();
33253 test_ret += test_xmlSchemaValidatePredefinedType();
Daniel Veillard91b955c2004-12-10 10:26:42 +000033254 test_ret += test_xmlSchemaWhiteSpaceReplace();
Daniel Veillardd93f6252004-11-02 15:53:51 +000033255
Daniel Veillard42595322004-11-08 10:52:06 +000033256 if (test_ret != 0)
33257 printf("Module xmlschemastypes: %d errors\n", test_ret);
33258 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033259}
33260
33261static int
33262test_xmlCharStrdup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033263 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033264
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033265 int mem_base;
33266 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033267 char * cur; /* the input char * */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033268 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033269
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033270 for (n_cur = 0;n_cur < gen_nb_const_char_ptr;n_cur++) {
33271 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033272 cur = gen_const_char_ptr(n_cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033273
William M. Brackf13f77f2004-11-12 16:03:48 +000033274 ret_val = xmlCharStrdup((const char *)cur);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033275 desret_xmlChar_ptr(ret_val);
33276 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033277 des_const_char_ptr(n_cur, (const char *)cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033278 xmlResetLastError();
33279 if (mem_base != xmlMemBlocks()) {
33280 printf("Leak of %d blocks found in xmlCharStrdup",
33281 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033282 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033283 printf(" %d", n_cur);
33284 printf("\n");
33285 }
33286 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033287 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033288
Daniel Veillard42595322004-11-08 10:52:06 +000033289 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033290}
33291
33292
33293static int
33294test_xmlCharStrndup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033295 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033296
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033297 int mem_base;
33298 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033299 char * cur; /* the input char * */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033300 int n_cur;
33301 int len; /* the len of @cur */
33302 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033303
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033304 for (n_cur = 0;n_cur < gen_nb_const_char_ptr;n_cur++) {
33305 for (n_len = 0;n_len < gen_nb_int;n_len++) {
33306 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033307 cur = gen_const_char_ptr(n_cur, 0);
33308 len = gen_int(n_len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033309
William M. Brackf13f77f2004-11-12 16:03:48 +000033310 ret_val = xmlCharStrndup((const char *)cur, len);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033311 desret_xmlChar_ptr(ret_val);
33312 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033313 des_const_char_ptr(n_cur, (const char *)cur, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000033314 des_int(n_len, len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033315 xmlResetLastError();
33316 if (mem_base != xmlMemBlocks()) {
33317 printf("Leak of %d blocks found in xmlCharStrndup",
33318 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033319 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033320 printf(" %d", n_cur);
33321 printf(" %d", n_len);
33322 printf("\n");
33323 }
33324 }
33325 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033326 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033327
Daniel Veillard42595322004-11-08 10:52:06 +000033328 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033329}
33330
33331
33332static int
33333test_xmlCheckUTF8(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033334 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033335
Daniel Veillardce682bc2004-11-05 17:22:25 +000033336 int mem_base;
33337 int ret_val;
33338 unsigned char * utf; /* Pointer to putative UTF-8 encoded string. */
33339 int n_utf;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033340
Daniel Veillardce682bc2004-11-05 17:22:25 +000033341 for (n_utf = 0;n_utf < gen_nb_const_unsigned_char_ptr;n_utf++) {
33342 mem_base = xmlMemBlocks();
33343 utf = gen_const_unsigned_char_ptr(n_utf, 0);
33344
William M. Brackf13f77f2004-11-12 16:03:48 +000033345 ret_val = xmlCheckUTF8((const unsigned char *)utf);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033346 desret_int(ret_val);
33347 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033348 des_const_unsigned_char_ptr(n_utf, (const unsigned char *)utf, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033349 xmlResetLastError();
33350 if (mem_base != xmlMemBlocks()) {
33351 printf("Leak of %d blocks found in xmlCheckUTF8",
33352 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033353 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033354 printf(" %d", n_utf);
33355 printf("\n");
33356 }
33357 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000033358 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033359
Daniel Veillard42595322004-11-08 10:52:06 +000033360 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033361}
33362
33363
33364static int
33365test_xmlGetUTF8Char(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033366 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033367
Daniel Veillardce682bc2004-11-05 17:22:25 +000033368 int mem_base;
33369 int ret_val;
33370 unsigned char * utf; /* a sequence of UTF-8 encoded bytes */
33371 int n_utf;
33372 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. */
33373 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033374
Daniel Veillardce682bc2004-11-05 17:22:25 +000033375 for (n_utf = 0;n_utf < gen_nb_const_unsigned_char_ptr;n_utf++) {
33376 for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
33377 mem_base = xmlMemBlocks();
33378 utf = gen_const_unsigned_char_ptr(n_utf, 0);
33379 len = gen_int_ptr(n_len, 1);
33380
William M. Brackf13f77f2004-11-12 16:03:48 +000033381 ret_val = xmlGetUTF8Char((const unsigned char *)utf, len);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033382 desret_int(ret_val);
33383 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033384 des_const_unsigned_char_ptr(n_utf, (const unsigned char *)utf, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033385 des_int_ptr(n_len, len, 1);
33386 xmlResetLastError();
33387 if (mem_base != xmlMemBlocks()) {
33388 printf("Leak of %d blocks found in xmlGetUTF8Char",
33389 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033390 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033391 printf(" %d", n_utf);
33392 printf(" %d", n_len);
33393 printf("\n");
33394 }
33395 }
33396 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000033397 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033398
Daniel Veillard42595322004-11-08 10:52:06 +000033399 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033400}
33401
33402
33403static int
33404test_xmlStrEqual(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033405 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033406
33407 int mem_base;
33408 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033409 xmlChar * str1; /* the first xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033410 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033411 xmlChar * str2; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033412 int n_str2;
33413
33414 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
33415 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
33416 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033417 str1 = gen_const_xmlChar_ptr(n_str1, 0);
33418 str2 = gen_const_xmlChar_ptr(n_str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033419
William M. Brackf13f77f2004-11-12 16:03:48 +000033420 ret_val = xmlStrEqual((const xmlChar *)str1, (const xmlChar *)str2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033421 desret_int(ret_val);
33422 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033423 des_const_xmlChar_ptr(n_str1, (const xmlChar *)str1, 0);
33424 des_const_xmlChar_ptr(n_str2, (const xmlChar *)str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033425 xmlResetLastError();
33426 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033427 printf("Leak of %d blocks found in xmlStrEqual",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033428 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033429 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033430 printf(" %d", n_str1);
33431 printf(" %d", n_str2);
33432 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033433 }
33434 }
33435 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033436 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033437
Daniel Veillard42595322004-11-08 10:52:06 +000033438 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033439}
33440
33441
33442static int
33443test_xmlStrPrintf(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033444 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033445
33446
33447 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000033448 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033449}
33450
33451
33452static int
33453test_xmlStrQEqual(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033454 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033455
33456 int mem_base;
33457 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033458 xmlChar * pref; /* the prefix of the QName */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033459 int n_pref;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033460 xmlChar * name; /* the localname of the QName */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033461 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033462 xmlChar * str; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033463 int n_str;
33464
33465 for (n_pref = 0;n_pref < gen_nb_const_xmlChar_ptr;n_pref++) {
33466 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
33467 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
33468 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033469 pref = gen_const_xmlChar_ptr(n_pref, 0);
33470 name = gen_const_xmlChar_ptr(n_name, 1);
33471 str = gen_const_xmlChar_ptr(n_str, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033472
William M. Brackf13f77f2004-11-12 16:03:48 +000033473 ret_val = xmlStrQEqual((const xmlChar *)pref, (const xmlChar *)name, (const xmlChar *)str);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033474 desret_int(ret_val);
33475 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033476 des_const_xmlChar_ptr(n_pref, (const xmlChar *)pref, 0);
33477 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
33478 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033479 xmlResetLastError();
33480 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033481 printf("Leak of %d blocks found in xmlStrQEqual",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033482 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033483 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033484 printf(" %d", n_pref);
33485 printf(" %d", n_name);
33486 printf(" %d", n_str);
33487 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033488 }
33489 }
33490 }
33491 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033492 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033493
Daniel Veillard42595322004-11-08 10:52:06 +000033494 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033495}
33496
33497
33498static int
33499test_xmlStrVPrintf(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033500 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033501
33502
33503 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000033504 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033505}
33506
33507
33508static int
33509test_xmlStrcasecmp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033510 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033511
33512 int mem_base;
33513 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033514 xmlChar * str1; /* the first xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033515 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033516 xmlChar * str2; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033517 int n_str2;
33518
33519 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
33520 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
33521 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033522 str1 = gen_const_xmlChar_ptr(n_str1, 0);
33523 str2 = gen_const_xmlChar_ptr(n_str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033524
William M. Brackf13f77f2004-11-12 16:03:48 +000033525 ret_val = xmlStrcasecmp((const xmlChar *)str1, (const xmlChar *)str2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033526 desret_int(ret_val);
33527 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033528 des_const_xmlChar_ptr(n_str1, (const xmlChar *)str1, 0);
33529 des_const_xmlChar_ptr(n_str2, (const xmlChar *)str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033530 xmlResetLastError();
33531 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033532 printf("Leak of %d blocks found in xmlStrcasecmp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033533 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033534 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033535 printf(" %d", n_str1);
33536 printf(" %d", n_str2);
33537 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033538 }
33539 }
33540 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033541 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033542
Daniel Veillard42595322004-11-08 10:52:06 +000033543 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033544}
33545
33546
33547static int
33548test_xmlStrcasestr(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033549 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033550
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033551 int mem_base;
33552 const xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033553 xmlChar * str; /* the xmlChar * array (haystack) */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033554 int n_str;
33555 xmlChar * val; /* the xmlChar to search (needle) */
33556 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033557
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033558 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
33559 for (n_val = 0;n_val < gen_nb_xmlChar_ptr;n_val++) {
33560 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033561 str = gen_const_xmlChar_ptr(n_str, 0);
33562 val = gen_xmlChar_ptr(n_val, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033563
William M. Brackf13f77f2004-11-12 16:03:48 +000033564 ret_val = xmlStrcasestr((const xmlChar *)str, val);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033565 desret_const_xmlChar_ptr(ret_val);
33566 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033567 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000033568 des_xmlChar_ptr(n_val, val, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033569 xmlResetLastError();
33570 if (mem_base != xmlMemBlocks()) {
33571 printf("Leak of %d blocks found in xmlStrcasestr",
33572 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033573 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033574 printf(" %d", n_str);
33575 printf(" %d", n_val);
33576 printf("\n");
33577 }
33578 }
33579 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033580 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033581
Daniel Veillard42595322004-11-08 10:52:06 +000033582 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033583}
33584
33585
33586static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000033587test_xmlStrchr(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033588 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033589
Daniel Veillardf2a36f92004-11-08 17:55:01 +000033590 int mem_base;
33591 const xmlChar * ret_val;
33592 xmlChar * str; /* the xmlChar * array */
33593 int n_str;
33594 xmlChar val; /* the xmlChar to search */
33595 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033596
Daniel Veillardf2a36f92004-11-08 17:55:01 +000033597 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
33598 for (n_val = 0;n_val < gen_nb_xmlChar;n_val++) {
33599 mem_base = xmlMemBlocks();
33600 str = gen_const_xmlChar_ptr(n_str, 0);
33601 val = gen_xmlChar(n_val, 1);
33602
William M. Brackf13f77f2004-11-12 16:03:48 +000033603 ret_val = xmlStrchr((const xmlChar *)str, val);
Daniel Veillardf2a36f92004-11-08 17:55:01 +000033604 desret_const_xmlChar_ptr(ret_val);
33605 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033606 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillardf2a36f92004-11-08 17:55:01 +000033607 des_xmlChar(n_val, val, 1);
33608 xmlResetLastError();
33609 if (mem_base != xmlMemBlocks()) {
33610 printf("Leak of %d blocks found in xmlStrchr",
33611 xmlMemBlocks() - mem_base);
33612 test_ret++;
33613 printf(" %d", n_str);
33614 printf(" %d", n_val);
33615 printf("\n");
33616 }
33617 }
33618 }
Daniel Veillardf2a36f92004-11-08 17:55:01 +000033619 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033620
Daniel Veillard42595322004-11-08 10:52:06 +000033621 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033622}
33623
33624
33625static int
33626test_xmlStrcmp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033627 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033628
33629 int mem_base;
33630 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033631 xmlChar * str1; /* the first xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033632 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033633 xmlChar * str2; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033634 int n_str2;
33635
33636 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
33637 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
33638 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033639 str1 = gen_const_xmlChar_ptr(n_str1, 0);
33640 str2 = gen_const_xmlChar_ptr(n_str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033641
William M. Brackf13f77f2004-11-12 16:03:48 +000033642 ret_val = xmlStrcmp((const xmlChar *)str1, (const xmlChar *)str2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033643 desret_int(ret_val);
33644 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033645 des_const_xmlChar_ptr(n_str1, (const xmlChar *)str1, 0);
33646 des_const_xmlChar_ptr(n_str2, (const xmlChar *)str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033647 xmlResetLastError();
33648 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033649 printf("Leak of %d blocks found in xmlStrcmp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033650 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033651 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033652 printf(" %d", n_str1);
33653 printf(" %d", n_str2);
33654 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033655 }
33656 }
33657 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033658 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033659
Daniel Veillard42595322004-11-08 10:52:06 +000033660 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033661}
33662
33663
33664static int
33665test_xmlStrdup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033666 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033667
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033668 int mem_base;
33669 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033670 xmlChar * cur; /* the input xmlChar * */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033671 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033672
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033673 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
33674 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033675 cur = gen_const_xmlChar_ptr(n_cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033676
William M. Brackf13f77f2004-11-12 16:03:48 +000033677 ret_val = xmlStrdup((const xmlChar *)cur);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033678 desret_xmlChar_ptr(ret_val);
33679 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033680 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033681 xmlResetLastError();
33682 if (mem_base != xmlMemBlocks()) {
33683 printf("Leak of %d blocks found in xmlStrdup",
33684 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033685 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033686 printf(" %d", n_cur);
33687 printf("\n");
33688 }
33689 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033690 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033691
Daniel Veillard42595322004-11-08 10:52:06 +000033692 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033693}
33694
33695
33696static int
33697test_xmlStrlen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033698 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033699
33700 int mem_base;
33701 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033702 xmlChar * str; /* the xmlChar * array */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033703 int n_str;
33704
33705 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
33706 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033707 str = gen_const_xmlChar_ptr(n_str, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033708
William M. Brackf13f77f2004-11-12 16:03:48 +000033709 ret_val = xmlStrlen((const xmlChar *)str);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033710 desret_int(ret_val);
33711 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033712 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033713 xmlResetLastError();
33714 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033715 printf("Leak of %d blocks found in xmlStrlen",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033716 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033717 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033718 printf(" %d", n_str);
33719 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033720 }
33721 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033722 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033723
Daniel Veillard42595322004-11-08 10:52:06 +000033724 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033725}
33726
33727
33728static int
33729test_xmlStrncasecmp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033730 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033731
33732 int mem_base;
33733 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033734 xmlChar * str1; /* the first xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033735 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033736 xmlChar * str2; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033737 int n_str2;
33738 int len; /* the max comparison length */
33739 int n_len;
33740
33741 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
33742 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
33743 for (n_len = 0;n_len < gen_nb_int;n_len++) {
33744 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033745 str1 = gen_const_xmlChar_ptr(n_str1, 0);
33746 str2 = gen_const_xmlChar_ptr(n_str2, 1);
33747 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033748
William M. Brackf13f77f2004-11-12 16:03:48 +000033749 ret_val = xmlStrncasecmp((const xmlChar *)str1, (const xmlChar *)str2, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033750 desret_int(ret_val);
33751 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033752 des_const_xmlChar_ptr(n_str1, (const xmlChar *)str1, 0);
33753 des_const_xmlChar_ptr(n_str2, (const xmlChar *)str2, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000033754 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033755 xmlResetLastError();
33756 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033757 printf("Leak of %d blocks found in xmlStrncasecmp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033758 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033759 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033760 printf(" %d", n_str1);
33761 printf(" %d", n_str2);
33762 printf(" %d", n_len);
33763 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033764 }
33765 }
33766 }
33767 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033768 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033769
Daniel Veillard42595322004-11-08 10:52:06 +000033770 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033771}
33772
33773
33774static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000033775test_xmlStrncatNew(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033776 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033777
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033778 int mem_base;
33779 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033780 xmlChar * str1; /* first xmlChar string */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033781 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033782 xmlChar * str2; /* second xmlChar string */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033783 int n_str2;
33784 int len; /* the len of @str2 */
33785 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033786
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033787 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
33788 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
33789 for (n_len = 0;n_len < gen_nb_int;n_len++) {
33790 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033791 str1 = gen_const_xmlChar_ptr(n_str1, 0);
33792 str2 = gen_const_xmlChar_ptr(n_str2, 1);
33793 len = gen_int(n_len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033794
William M. Brackf13f77f2004-11-12 16:03:48 +000033795 ret_val = xmlStrncatNew((const xmlChar *)str1, (const xmlChar *)str2, len);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033796 desret_xmlChar_ptr(ret_val);
33797 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033798 des_const_xmlChar_ptr(n_str1, (const xmlChar *)str1, 0);
33799 des_const_xmlChar_ptr(n_str2, (const xmlChar *)str2, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000033800 des_int(n_len, len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033801 xmlResetLastError();
33802 if (mem_base != xmlMemBlocks()) {
33803 printf("Leak of %d blocks found in xmlStrncatNew",
33804 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033805 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033806 printf(" %d", n_str1);
33807 printf(" %d", n_str2);
33808 printf(" %d", n_len);
33809 printf("\n");
33810 }
33811 }
33812 }
33813 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033814 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033815
Daniel Veillard42595322004-11-08 10:52:06 +000033816 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033817}
33818
33819
33820static int
33821test_xmlStrncmp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033822 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033823
33824 int mem_base;
33825 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033826 xmlChar * str1; /* the first xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033827 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033828 xmlChar * str2; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033829 int n_str2;
33830 int len; /* the max comparison length */
33831 int n_len;
33832
33833 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
33834 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
33835 for (n_len = 0;n_len < gen_nb_int;n_len++) {
33836 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033837 str1 = gen_const_xmlChar_ptr(n_str1, 0);
33838 str2 = gen_const_xmlChar_ptr(n_str2, 1);
33839 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033840
William M. Brackf13f77f2004-11-12 16:03:48 +000033841 ret_val = xmlStrncmp((const xmlChar *)str1, (const xmlChar *)str2, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033842 desret_int(ret_val);
33843 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033844 des_const_xmlChar_ptr(n_str1, (const xmlChar *)str1, 0);
33845 des_const_xmlChar_ptr(n_str2, (const xmlChar *)str2, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000033846 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033847 xmlResetLastError();
33848 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033849 printf("Leak of %d blocks found in xmlStrncmp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033850 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033851 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033852 printf(" %d", n_str1);
33853 printf(" %d", n_str2);
33854 printf(" %d", n_len);
33855 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033856 }
33857 }
33858 }
33859 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033860 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033861
Daniel Veillard42595322004-11-08 10:52:06 +000033862 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033863}
33864
33865
33866static int
33867test_xmlStrndup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033868 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033869
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033870 int mem_base;
33871 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033872 xmlChar * cur; /* the input xmlChar * */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033873 int n_cur;
33874 int len; /* the len of @cur */
33875 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033876
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033877 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
33878 for (n_len = 0;n_len < gen_nb_int;n_len++) {
33879 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033880 cur = gen_const_xmlChar_ptr(n_cur, 0);
33881 len = gen_int(n_len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033882
William M. Brackf13f77f2004-11-12 16:03:48 +000033883 ret_val = xmlStrndup((const xmlChar *)cur, len);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033884 desret_xmlChar_ptr(ret_val);
33885 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033886 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000033887 des_int(n_len, len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033888 xmlResetLastError();
33889 if (mem_base != xmlMemBlocks()) {
33890 printf("Leak of %d blocks found in xmlStrndup",
33891 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033892 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033893 printf(" %d", n_cur);
33894 printf(" %d", n_len);
33895 printf("\n");
33896 }
33897 }
33898 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033899 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033900
Daniel Veillard42595322004-11-08 10:52:06 +000033901 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033902}
33903
33904
33905static int
33906test_xmlStrstr(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033907 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033908
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033909 int mem_base;
33910 const xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033911 xmlChar * str; /* the xmlChar * array (haystack) */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033912 int n_str;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033913 xmlChar * val; /* the xmlChar to search (needle) */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033914 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033915
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033916 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
33917 for (n_val = 0;n_val < gen_nb_const_xmlChar_ptr;n_val++) {
33918 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033919 str = gen_const_xmlChar_ptr(n_str, 0);
33920 val = gen_const_xmlChar_ptr(n_val, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033921
William M. Brackf13f77f2004-11-12 16:03:48 +000033922 ret_val = xmlStrstr((const xmlChar *)str, (const xmlChar *)val);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033923 desret_const_xmlChar_ptr(ret_val);
33924 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033925 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
33926 des_const_xmlChar_ptr(n_val, (const xmlChar *)val, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033927 xmlResetLastError();
33928 if (mem_base != xmlMemBlocks()) {
33929 printf("Leak of %d blocks found in xmlStrstr",
33930 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033931 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033932 printf(" %d", n_str);
33933 printf(" %d", n_val);
33934 printf("\n");
33935 }
33936 }
33937 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033938 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033939
Daniel Veillard42595322004-11-08 10:52:06 +000033940 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033941}
33942
33943
33944static int
33945test_xmlStrsub(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033946 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033947
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033948 int mem_base;
33949 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033950 xmlChar * str; /* the xmlChar * array (haystack) */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033951 int n_str;
33952 int start; /* the index of the first char (zero based) */
33953 int n_start;
33954 int len; /* the length of the substring */
33955 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033956
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033957 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
33958 for (n_start = 0;n_start < gen_nb_int;n_start++) {
33959 for (n_len = 0;n_len < gen_nb_int;n_len++) {
33960 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033961 str = gen_const_xmlChar_ptr(n_str, 0);
33962 start = gen_int(n_start, 1);
33963 len = gen_int(n_len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033964
William M. Brackf13f77f2004-11-12 16:03:48 +000033965 ret_val = xmlStrsub((const xmlChar *)str, start, len);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033966 desret_xmlChar_ptr(ret_val);
33967 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033968 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000033969 des_int(n_start, start, 1);
33970 des_int(n_len, len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033971 xmlResetLastError();
33972 if (mem_base != xmlMemBlocks()) {
33973 printf("Leak of %d blocks found in xmlStrsub",
33974 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033975 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033976 printf(" %d", n_str);
33977 printf(" %d", n_start);
33978 printf(" %d", n_len);
33979 printf("\n");
33980 }
33981 }
33982 }
33983 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033984 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033985
Daniel Veillard42595322004-11-08 10:52:06 +000033986 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033987}
33988
33989
33990static int
33991test_xmlUTF8Charcmp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033992 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033993
33994 int mem_base;
33995 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033996 xmlChar * utf1; /* pointer to first UTF8 char */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033997 int n_utf1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033998 xmlChar * utf2; /* pointer to second UTF8 char */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033999 int n_utf2;
34000
34001 for (n_utf1 = 0;n_utf1 < gen_nb_const_xmlChar_ptr;n_utf1++) {
34002 for (n_utf2 = 0;n_utf2 < gen_nb_const_xmlChar_ptr;n_utf2++) {
34003 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034004 utf1 = gen_const_xmlChar_ptr(n_utf1, 0);
34005 utf2 = gen_const_xmlChar_ptr(n_utf2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034006
William M. Brackf13f77f2004-11-12 16:03:48 +000034007 ret_val = xmlUTF8Charcmp((const xmlChar *)utf1, (const xmlChar *)utf2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034008 desret_int(ret_val);
34009 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034010 des_const_xmlChar_ptr(n_utf1, (const xmlChar *)utf1, 0);
34011 des_const_xmlChar_ptr(n_utf2, (const xmlChar *)utf2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034012 xmlResetLastError();
34013 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000034014 printf("Leak of %d blocks found in xmlUTF8Charcmp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000034015 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034016 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000034017 printf(" %d", n_utf1);
34018 printf(" %d", n_utf2);
34019 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000034020 }
34021 }
34022 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000034023 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034024
Daniel Veillard42595322004-11-08 10:52:06 +000034025 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034026}
34027
34028
34029static int
34030test_xmlUTF8Size(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034031 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034032
34033 int mem_base;
34034 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034035 xmlChar * utf; /* pointer to the UTF8 character */
Daniel Veillardd93f6252004-11-02 15:53:51 +000034036 int n_utf;
34037
34038 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
34039 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034040 utf = gen_const_xmlChar_ptr(n_utf, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034041
William M. Brackf13f77f2004-11-12 16:03:48 +000034042 ret_val = xmlUTF8Size((const xmlChar *)utf);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034043 desret_int(ret_val);
34044 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034045 des_const_xmlChar_ptr(n_utf, (const xmlChar *)utf, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034046 xmlResetLastError();
34047 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000034048 printf("Leak of %d blocks found in xmlUTF8Size",
Daniel Veillardd93f6252004-11-02 15:53:51 +000034049 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034050 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000034051 printf(" %d", n_utf);
34052 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000034053 }
34054 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000034055 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034056
Daniel Veillard42595322004-11-08 10:52:06 +000034057 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034058}
34059
34060
34061static int
34062test_xmlUTF8Strlen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034063 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034064
34065 int mem_base;
34066 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034067 xmlChar * utf; /* a sequence of UTF-8 encoded bytes */
Daniel Veillardd93f6252004-11-02 15:53:51 +000034068 int n_utf;
34069
34070 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
34071 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034072 utf = gen_const_xmlChar_ptr(n_utf, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034073
William M. Brackf13f77f2004-11-12 16:03:48 +000034074 ret_val = xmlUTF8Strlen((const xmlChar *)utf);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034075 desret_int(ret_val);
34076 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034077 des_const_xmlChar_ptr(n_utf, (const xmlChar *)utf, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034078 xmlResetLastError();
34079 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000034080 printf("Leak of %d blocks found in xmlUTF8Strlen",
Daniel Veillardd93f6252004-11-02 15:53:51 +000034081 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034082 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000034083 printf(" %d", n_utf);
34084 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000034085 }
34086 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000034087 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034088
Daniel Veillard42595322004-11-08 10:52:06 +000034089 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034090}
34091
34092
34093static int
34094test_xmlUTF8Strloc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034095 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034096
34097 int mem_base;
34098 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034099 xmlChar * utf; /* the input UTF8 * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000034100 int n_utf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034101 xmlChar * utfchar; /* the UTF8 character to be found */
Daniel Veillardd93f6252004-11-02 15:53:51 +000034102 int n_utfchar;
34103
34104 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
34105 for (n_utfchar = 0;n_utfchar < gen_nb_const_xmlChar_ptr;n_utfchar++) {
34106 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034107 utf = gen_const_xmlChar_ptr(n_utf, 0);
34108 utfchar = gen_const_xmlChar_ptr(n_utfchar, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034109
William M. Brackf13f77f2004-11-12 16:03:48 +000034110 ret_val = xmlUTF8Strloc((const xmlChar *)utf, (const xmlChar *)utfchar);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034111 desret_int(ret_val);
34112 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034113 des_const_xmlChar_ptr(n_utf, (const xmlChar *)utf, 0);
34114 des_const_xmlChar_ptr(n_utfchar, (const xmlChar *)utfchar, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034115 xmlResetLastError();
34116 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000034117 printf("Leak of %d blocks found in xmlUTF8Strloc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000034118 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034119 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000034120 printf(" %d", n_utf);
34121 printf(" %d", n_utfchar);
34122 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000034123 }
34124 }
34125 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000034126 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034127
Daniel Veillard42595322004-11-08 10:52:06 +000034128 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034129}
34130
34131
34132static int
34133test_xmlUTF8Strndup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034134 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034135
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034136 int mem_base;
34137 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034138 xmlChar * utf; /* the input UTF8 * */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034139 int n_utf;
34140 int len; /* the len of @utf (in chars) */
34141 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034142
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034143 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
34144 for (n_len = 0;n_len < gen_nb_int;n_len++) {
34145 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034146 utf = gen_const_xmlChar_ptr(n_utf, 0);
34147 len = gen_int(n_len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034148
William M. Brackf13f77f2004-11-12 16:03:48 +000034149 ret_val = xmlUTF8Strndup((const xmlChar *)utf, len);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034150 desret_xmlChar_ptr(ret_val);
34151 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034152 des_const_xmlChar_ptr(n_utf, (const xmlChar *)utf, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000034153 des_int(n_len, len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034154 xmlResetLastError();
34155 if (mem_base != xmlMemBlocks()) {
34156 printf("Leak of %d blocks found in xmlUTF8Strndup",
34157 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034158 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034159 printf(" %d", n_utf);
34160 printf(" %d", n_len);
34161 printf("\n");
34162 }
34163 }
34164 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000034165 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034166
Daniel Veillard42595322004-11-08 10:52:06 +000034167 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034168}
34169
34170
34171static int
34172test_xmlUTF8Strpos(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034173 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034174
Daniel Veillardd005b9e2004-11-03 17:07:05 +000034175 int mem_base;
34176 const xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034177 xmlChar * utf; /* the input UTF8 * */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000034178 int n_utf;
34179 int pos; /* the position of the desired UTF8 char (in chars) */
34180 int n_pos;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034181
Daniel Veillardd005b9e2004-11-03 17:07:05 +000034182 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
34183 for (n_pos = 0;n_pos < gen_nb_int;n_pos++) {
34184 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034185 utf = gen_const_xmlChar_ptr(n_utf, 0);
34186 pos = gen_int(n_pos, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000034187
William M. Brackf13f77f2004-11-12 16:03:48 +000034188 ret_val = xmlUTF8Strpos((const xmlChar *)utf, pos);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000034189 desret_const_xmlChar_ptr(ret_val);
34190 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034191 des_const_xmlChar_ptr(n_utf, (const xmlChar *)utf, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000034192 des_int(n_pos, pos, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000034193 xmlResetLastError();
34194 if (mem_base != xmlMemBlocks()) {
34195 printf("Leak of %d blocks found in xmlUTF8Strpos",
34196 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034197 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000034198 printf(" %d", n_utf);
34199 printf(" %d", n_pos);
34200 printf("\n");
34201 }
34202 }
34203 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000034204 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034205
Daniel Veillard42595322004-11-08 10:52:06 +000034206 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034207}
34208
34209
34210static int
34211test_xmlUTF8Strsize(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034212 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034213
34214 int mem_base;
34215 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034216 xmlChar * utf; /* a sequence of UTF-8 encoded bytes */
Daniel Veillardd93f6252004-11-02 15:53:51 +000034217 int n_utf;
34218 int len; /* the number of characters in the array */
34219 int n_len;
34220
34221 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
34222 for (n_len = 0;n_len < gen_nb_int;n_len++) {
34223 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034224 utf = gen_const_xmlChar_ptr(n_utf, 0);
34225 len = gen_int(n_len, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034226
William M. Brackf13f77f2004-11-12 16:03:48 +000034227 ret_val = xmlUTF8Strsize((const xmlChar *)utf, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034228 desret_int(ret_val);
34229 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034230 des_const_xmlChar_ptr(n_utf, (const xmlChar *)utf, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000034231 des_int(n_len, len, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034232 xmlResetLastError();
34233 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000034234 printf("Leak of %d blocks found in xmlUTF8Strsize",
Daniel Veillardd93f6252004-11-02 15:53:51 +000034235 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034236 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000034237 printf(" %d", n_utf);
34238 printf(" %d", n_len);
34239 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000034240 }
34241 }
34242 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000034243 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034244
Daniel Veillard42595322004-11-08 10:52:06 +000034245 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034246}
34247
34248
34249static int
34250test_xmlUTF8Strsub(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034251 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034252
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034253 int mem_base;
34254 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034255 xmlChar * utf; /* a sequence of UTF-8 encoded bytes */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034256 int n_utf;
34257 int start; /* relative pos of first char */
34258 int n_start;
34259 int len; /* total number to copy */
34260 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034261
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034262 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
34263 for (n_start = 0;n_start < gen_nb_int;n_start++) {
34264 for (n_len = 0;n_len < gen_nb_int;n_len++) {
34265 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034266 utf = gen_const_xmlChar_ptr(n_utf, 0);
34267 start = gen_int(n_start, 1);
34268 len = gen_int(n_len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034269
William M. Brackf13f77f2004-11-12 16:03:48 +000034270 ret_val = xmlUTF8Strsub((const xmlChar *)utf, start, len);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034271 desret_xmlChar_ptr(ret_val);
34272 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034273 des_const_xmlChar_ptr(n_utf, (const xmlChar *)utf, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000034274 des_int(n_start, start, 1);
34275 des_int(n_len, len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034276 xmlResetLastError();
34277 if (mem_base != xmlMemBlocks()) {
34278 printf("Leak of %d blocks found in xmlUTF8Strsub",
34279 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034280 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034281 printf(" %d", n_utf);
34282 printf(" %d", n_start);
34283 printf(" %d", n_len);
34284 printf("\n");
34285 }
34286 }
34287 }
34288 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000034289 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034290
Daniel Veillard42595322004-11-08 10:52:06 +000034291 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034292}
34293
34294static int
34295test_xmlstring(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034296 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034297
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034298 if (quiet == 0) printf("Testing xmlstring : 26 of 30 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000034299 test_ret += test_xmlCharStrdup();
34300 test_ret += test_xmlCharStrndup();
34301 test_ret += test_xmlCheckUTF8();
34302 test_ret += test_xmlGetUTF8Char();
34303 test_ret += test_xmlStrEqual();
34304 test_ret += test_xmlStrPrintf();
34305 test_ret += test_xmlStrQEqual();
34306 test_ret += test_xmlStrVPrintf();
34307 test_ret += test_xmlStrcasecmp();
34308 test_ret += test_xmlStrcasestr();
34309 test_ret += test_xmlStrchr();
34310 test_ret += test_xmlStrcmp();
34311 test_ret += test_xmlStrdup();
34312 test_ret += test_xmlStrlen();
34313 test_ret += test_xmlStrncasecmp();
34314 test_ret += test_xmlStrncatNew();
34315 test_ret += test_xmlStrncmp();
34316 test_ret += test_xmlStrndup();
34317 test_ret += test_xmlStrstr();
34318 test_ret += test_xmlStrsub();
34319 test_ret += test_xmlUTF8Charcmp();
34320 test_ret += test_xmlUTF8Size();
34321 test_ret += test_xmlUTF8Strlen();
34322 test_ret += test_xmlUTF8Strloc();
34323 test_ret += test_xmlUTF8Strndup();
34324 test_ret += test_xmlUTF8Strpos();
34325 test_ret += test_xmlUTF8Strsize();
34326 test_ret += test_xmlUTF8Strsub();
Daniel Veillardd93f6252004-11-02 15:53:51 +000034327
Daniel Veillard42595322004-11-08 10:52:06 +000034328 if (test_ret != 0)
34329 printf("Module xmlstring: %d errors\n", test_ret);
34330 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034331}
34332
34333static int
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034334test_xmlUCSIsAegeanNumbers(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034335 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034336
William M. Brack21e4ef22005-01-02 09:53:13 +000034337#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034338 int mem_base;
34339 int ret_val;
34340 int code; /* UCS code point */
34341 int n_code;
34342
34343 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34344 mem_base = xmlMemBlocks();
34345 code = gen_int(n_code, 0);
34346
34347 ret_val = xmlUCSIsAegeanNumbers(code);
34348 desret_int(ret_val);
34349 call_tests++;
34350 des_int(n_code, code, 0);
34351 xmlResetLastError();
34352 if (mem_base != xmlMemBlocks()) {
34353 printf("Leak of %d blocks found in xmlUCSIsAegeanNumbers",
34354 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034355 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034356 printf(" %d", n_code);
34357 printf("\n");
34358 }
34359 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034360 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034361#endif
34362
Daniel Veillard42595322004-11-08 10:52:06 +000034363 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034364}
34365
34366
34367static int
34368test_xmlUCSIsAlphabeticPresentationForms(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034369 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034370
William M. Brack21e4ef22005-01-02 09:53:13 +000034371#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034372 int mem_base;
34373 int ret_val;
34374 int code; /* UCS code point */
34375 int n_code;
34376
34377 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34378 mem_base = xmlMemBlocks();
34379 code = gen_int(n_code, 0);
34380
34381 ret_val = xmlUCSIsAlphabeticPresentationForms(code);
34382 desret_int(ret_val);
34383 call_tests++;
34384 des_int(n_code, code, 0);
34385 xmlResetLastError();
34386 if (mem_base != xmlMemBlocks()) {
34387 printf("Leak of %d blocks found in xmlUCSIsAlphabeticPresentationForms",
34388 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034389 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034390 printf(" %d", n_code);
34391 printf("\n");
34392 }
34393 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034394 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034395#endif
34396
Daniel Veillard42595322004-11-08 10:52:06 +000034397 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034398}
34399
34400
34401static int
34402test_xmlUCSIsArabic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034403 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034404
William M. Brack21e4ef22005-01-02 09:53:13 +000034405#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034406 int mem_base;
34407 int ret_val;
34408 int code; /* UCS code point */
34409 int n_code;
34410
34411 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34412 mem_base = xmlMemBlocks();
34413 code = gen_int(n_code, 0);
34414
34415 ret_val = xmlUCSIsArabic(code);
34416 desret_int(ret_val);
34417 call_tests++;
34418 des_int(n_code, code, 0);
34419 xmlResetLastError();
34420 if (mem_base != xmlMemBlocks()) {
34421 printf("Leak of %d blocks found in xmlUCSIsArabic",
34422 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034423 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034424 printf(" %d", n_code);
34425 printf("\n");
34426 }
34427 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034428 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034429#endif
34430
Daniel Veillard42595322004-11-08 10:52:06 +000034431 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034432}
34433
34434
34435static int
34436test_xmlUCSIsArabicPresentationFormsA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034437 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034438
William M. Brack21e4ef22005-01-02 09:53:13 +000034439#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034440 int mem_base;
34441 int ret_val;
34442 int code; /* UCS code point */
34443 int n_code;
34444
34445 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34446 mem_base = xmlMemBlocks();
34447 code = gen_int(n_code, 0);
34448
34449 ret_val = xmlUCSIsArabicPresentationFormsA(code);
34450 desret_int(ret_val);
34451 call_tests++;
34452 des_int(n_code, code, 0);
34453 xmlResetLastError();
34454 if (mem_base != xmlMemBlocks()) {
34455 printf("Leak of %d blocks found in xmlUCSIsArabicPresentationFormsA",
34456 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034457 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034458 printf(" %d", n_code);
34459 printf("\n");
34460 }
34461 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034462 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034463#endif
34464
Daniel Veillard42595322004-11-08 10:52:06 +000034465 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034466}
34467
34468
34469static int
34470test_xmlUCSIsArabicPresentationFormsB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034471 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034472
William M. Brack21e4ef22005-01-02 09:53:13 +000034473#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034474 int mem_base;
34475 int ret_val;
34476 int code; /* UCS code point */
34477 int n_code;
34478
34479 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34480 mem_base = xmlMemBlocks();
34481 code = gen_int(n_code, 0);
34482
34483 ret_val = xmlUCSIsArabicPresentationFormsB(code);
34484 desret_int(ret_val);
34485 call_tests++;
34486 des_int(n_code, code, 0);
34487 xmlResetLastError();
34488 if (mem_base != xmlMemBlocks()) {
34489 printf("Leak of %d blocks found in xmlUCSIsArabicPresentationFormsB",
34490 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034491 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034492 printf(" %d", n_code);
34493 printf("\n");
34494 }
34495 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034496 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034497#endif
34498
Daniel Veillard42595322004-11-08 10:52:06 +000034499 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034500}
34501
34502
34503static int
34504test_xmlUCSIsArmenian(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034505 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034506
William M. Brack21e4ef22005-01-02 09:53:13 +000034507#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034508 int mem_base;
34509 int ret_val;
34510 int code; /* UCS code point */
34511 int n_code;
34512
34513 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34514 mem_base = xmlMemBlocks();
34515 code = gen_int(n_code, 0);
34516
34517 ret_val = xmlUCSIsArmenian(code);
34518 desret_int(ret_val);
34519 call_tests++;
34520 des_int(n_code, code, 0);
34521 xmlResetLastError();
34522 if (mem_base != xmlMemBlocks()) {
34523 printf("Leak of %d blocks found in xmlUCSIsArmenian",
34524 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034525 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034526 printf(" %d", n_code);
34527 printf("\n");
34528 }
34529 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034530 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034531#endif
34532
Daniel Veillard42595322004-11-08 10:52:06 +000034533 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034534}
34535
34536
34537static int
34538test_xmlUCSIsArrows(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034539 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034540
William M. Brack21e4ef22005-01-02 09:53:13 +000034541#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034542 int mem_base;
34543 int ret_val;
34544 int code; /* UCS code point */
34545 int n_code;
34546
34547 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34548 mem_base = xmlMemBlocks();
34549 code = gen_int(n_code, 0);
34550
34551 ret_val = xmlUCSIsArrows(code);
34552 desret_int(ret_val);
34553 call_tests++;
34554 des_int(n_code, code, 0);
34555 xmlResetLastError();
34556 if (mem_base != xmlMemBlocks()) {
34557 printf("Leak of %d blocks found in xmlUCSIsArrows",
34558 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034559 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034560 printf(" %d", n_code);
34561 printf("\n");
34562 }
34563 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034564 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034565#endif
34566
Daniel Veillard42595322004-11-08 10:52:06 +000034567 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034568}
34569
34570
34571static int
34572test_xmlUCSIsBasicLatin(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034573 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034574
William M. Brack21e4ef22005-01-02 09:53:13 +000034575#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034576 int mem_base;
34577 int ret_val;
34578 int code; /* UCS code point */
34579 int n_code;
34580
34581 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34582 mem_base = xmlMemBlocks();
34583 code = gen_int(n_code, 0);
34584
34585 ret_val = xmlUCSIsBasicLatin(code);
34586 desret_int(ret_val);
34587 call_tests++;
34588 des_int(n_code, code, 0);
34589 xmlResetLastError();
34590 if (mem_base != xmlMemBlocks()) {
34591 printf("Leak of %d blocks found in xmlUCSIsBasicLatin",
34592 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034593 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034594 printf(" %d", n_code);
34595 printf("\n");
34596 }
34597 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034598 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034599#endif
34600
Daniel Veillard42595322004-11-08 10:52:06 +000034601 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034602}
34603
34604
34605static int
34606test_xmlUCSIsBengali(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034607 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034608
William M. Brack21e4ef22005-01-02 09:53:13 +000034609#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034610 int mem_base;
34611 int ret_val;
34612 int code; /* UCS code point */
34613 int n_code;
34614
34615 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34616 mem_base = xmlMemBlocks();
34617 code = gen_int(n_code, 0);
34618
34619 ret_val = xmlUCSIsBengali(code);
34620 desret_int(ret_val);
34621 call_tests++;
34622 des_int(n_code, code, 0);
34623 xmlResetLastError();
34624 if (mem_base != xmlMemBlocks()) {
34625 printf("Leak of %d blocks found in xmlUCSIsBengali",
34626 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034627 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034628 printf(" %d", n_code);
34629 printf("\n");
34630 }
34631 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034632 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034633#endif
34634
Daniel Veillard42595322004-11-08 10:52:06 +000034635 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034636}
34637
34638
34639static int
34640test_xmlUCSIsBlock(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034641 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034642
William M. Brack21e4ef22005-01-02 09:53:13 +000034643#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034644 int mem_base;
34645 int ret_val;
34646 int code; /* UCS code point */
34647 int n_code;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034648 char * block; /* UCS block name */
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034649 int n_block;
34650
34651 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34652 for (n_block = 0;n_block < gen_nb_const_char_ptr;n_block++) {
34653 mem_base = xmlMemBlocks();
34654 code = gen_int(n_code, 0);
34655 block = gen_const_char_ptr(n_block, 1);
34656
William M. Brackf13f77f2004-11-12 16:03:48 +000034657 ret_val = xmlUCSIsBlock(code, (const char *)block);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034658 desret_int(ret_val);
34659 call_tests++;
34660 des_int(n_code, code, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000034661 des_const_char_ptr(n_block, (const char *)block, 1);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034662 xmlResetLastError();
34663 if (mem_base != xmlMemBlocks()) {
34664 printf("Leak of %d blocks found in xmlUCSIsBlock",
34665 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034666 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034667 printf(" %d", n_code);
34668 printf(" %d", n_block);
34669 printf("\n");
34670 }
34671 }
34672 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034673 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034674#endif
34675
Daniel Veillard42595322004-11-08 10:52:06 +000034676 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034677}
34678
34679
34680static int
34681test_xmlUCSIsBlockElements(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034682 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034683
William M. Brack21e4ef22005-01-02 09:53:13 +000034684#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034685 int mem_base;
34686 int ret_val;
34687 int code; /* UCS code point */
34688 int n_code;
34689
34690 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34691 mem_base = xmlMemBlocks();
34692 code = gen_int(n_code, 0);
34693
34694 ret_val = xmlUCSIsBlockElements(code);
34695 desret_int(ret_val);
34696 call_tests++;
34697 des_int(n_code, code, 0);
34698 xmlResetLastError();
34699 if (mem_base != xmlMemBlocks()) {
34700 printf("Leak of %d blocks found in xmlUCSIsBlockElements",
34701 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034702 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034703 printf(" %d", n_code);
34704 printf("\n");
34705 }
34706 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034707 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034708#endif
34709
Daniel Veillard42595322004-11-08 10:52:06 +000034710 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034711}
34712
34713
34714static int
34715test_xmlUCSIsBopomofo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034716 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034717
William M. Brack21e4ef22005-01-02 09:53:13 +000034718#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034719 int mem_base;
34720 int ret_val;
34721 int code; /* UCS code point */
34722 int n_code;
34723
34724 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34725 mem_base = xmlMemBlocks();
34726 code = gen_int(n_code, 0);
34727
34728 ret_val = xmlUCSIsBopomofo(code);
34729 desret_int(ret_val);
34730 call_tests++;
34731 des_int(n_code, code, 0);
34732 xmlResetLastError();
34733 if (mem_base != xmlMemBlocks()) {
34734 printf("Leak of %d blocks found in xmlUCSIsBopomofo",
34735 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034736 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034737 printf(" %d", n_code);
34738 printf("\n");
34739 }
34740 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034741 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034742#endif
34743
Daniel Veillard42595322004-11-08 10:52:06 +000034744 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034745}
34746
34747
34748static int
34749test_xmlUCSIsBopomofoExtended(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034750 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034751
William M. Brack21e4ef22005-01-02 09:53:13 +000034752#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034753 int mem_base;
34754 int ret_val;
34755 int code; /* UCS code point */
34756 int n_code;
34757
34758 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34759 mem_base = xmlMemBlocks();
34760 code = gen_int(n_code, 0);
34761
34762 ret_val = xmlUCSIsBopomofoExtended(code);
34763 desret_int(ret_val);
34764 call_tests++;
34765 des_int(n_code, code, 0);
34766 xmlResetLastError();
34767 if (mem_base != xmlMemBlocks()) {
34768 printf("Leak of %d blocks found in xmlUCSIsBopomofoExtended",
34769 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034770 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034771 printf(" %d", n_code);
34772 printf("\n");
34773 }
34774 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034775 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034776#endif
34777
Daniel Veillard42595322004-11-08 10:52:06 +000034778 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034779}
34780
34781
34782static int
34783test_xmlUCSIsBoxDrawing(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034784 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034785
William M. Brack21e4ef22005-01-02 09:53:13 +000034786#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034787 int mem_base;
34788 int ret_val;
34789 int code; /* UCS code point */
34790 int n_code;
34791
34792 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34793 mem_base = xmlMemBlocks();
34794 code = gen_int(n_code, 0);
34795
34796 ret_val = xmlUCSIsBoxDrawing(code);
34797 desret_int(ret_val);
34798 call_tests++;
34799 des_int(n_code, code, 0);
34800 xmlResetLastError();
34801 if (mem_base != xmlMemBlocks()) {
34802 printf("Leak of %d blocks found in xmlUCSIsBoxDrawing",
34803 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034804 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034805 printf(" %d", n_code);
34806 printf("\n");
34807 }
34808 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034809 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034810#endif
34811
Daniel Veillard42595322004-11-08 10:52:06 +000034812 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034813}
34814
34815
34816static int
34817test_xmlUCSIsBraillePatterns(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034818 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034819
William M. Brack21e4ef22005-01-02 09:53:13 +000034820#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034821 int mem_base;
34822 int ret_val;
34823 int code; /* UCS code point */
34824 int n_code;
34825
34826 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34827 mem_base = xmlMemBlocks();
34828 code = gen_int(n_code, 0);
34829
34830 ret_val = xmlUCSIsBraillePatterns(code);
34831 desret_int(ret_val);
34832 call_tests++;
34833 des_int(n_code, code, 0);
34834 xmlResetLastError();
34835 if (mem_base != xmlMemBlocks()) {
34836 printf("Leak of %d blocks found in xmlUCSIsBraillePatterns",
34837 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034838 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034839 printf(" %d", n_code);
34840 printf("\n");
34841 }
34842 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034843 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034844#endif
34845
Daniel Veillard42595322004-11-08 10:52:06 +000034846 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034847}
34848
34849
34850static int
34851test_xmlUCSIsBuhid(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034852 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034853
William M. Brack21e4ef22005-01-02 09:53:13 +000034854#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034855 int mem_base;
34856 int ret_val;
34857 int code; /* UCS code point */
34858 int n_code;
34859
34860 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34861 mem_base = xmlMemBlocks();
34862 code = gen_int(n_code, 0);
34863
34864 ret_val = xmlUCSIsBuhid(code);
34865 desret_int(ret_val);
34866 call_tests++;
34867 des_int(n_code, code, 0);
34868 xmlResetLastError();
34869 if (mem_base != xmlMemBlocks()) {
34870 printf("Leak of %d blocks found in xmlUCSIsBuhid",
34871 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034872 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034873 printf(" %d", n_code);
34874 printf("\n");
34875 }
34876 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034877 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034878#endif
34879
Daniel Veillard42595322004-11-08 10:52:06 +000034880 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034881}
34882
34883
34884static int
34885test_xmlUCSIsByzantineMusicalSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034886 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034887
William M. Brack21e4ef22005-01-02 09:53:13 +000034888#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034889 int mem_base;
34890 int ret_val;
34891 int code; /* UCS code point */
34892 int n_code;
34893
34894 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34895 mem_base = xmlMemBlocks();
34896 code = gen_int(n_code, 0);
34897
34898 ret_val = xmlUCSIsByzantineMusicalSymbols(code);
34899 desret_int(ret_val);
34900 call_tests++;
34901 des_int(n_code, code, 0);
34902 xmlResetLastError();
34903 if (mem_base != xmlMemBlocks()) {
34904 printf("Leak of %d blocks found in xmlUCSIsByzantineMusicalSymbols",
34905 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034906 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034907 printf(" %d", n_code);
34908 printf("\n");
34909 }
34910 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034911 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034912#endif
34913
Daniel Veillard42595322004-11-08 10:52:06 +000034914 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034915}
34916
34917
34918static int
34919test_xmlUCSIsCJKCompatibility(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034920 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034921
William M. Brack21e4ef22005-01-02 09:53:13 +000034922#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034923 int mem_base;
34924 int ret_val;
34925 int code; /* UCS code point */
34926 int n_code;
34927
34928 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34929 mem_base = xmlMemBlocks();
34930 code = gen_int(n_code, 0);
34931
34932 ret_val = xmlUCSIsCJKCompatibility(code);
34933 desret_int(ret_val);
34934 call_tests++;
34935 des_int(n_code, code, 0);
34936 xmlResetLastError();
34937 if (mem_base != xmlMemBlocks()) {
34938 printf("Leak of %d blocks found in xmlUCSIsCJKCompatibility",
34939 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034940 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034941 printf(" %d", n_code);
34942 printf("\n");
34943 }
34944 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034945 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034946#endif
34947
Daniel Veillard42595322004-11-08 10:52:06 +000034948 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034949}
34950
34951
34952static int
34953test_xmlUCSIsCJKCompatibilityForms(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034954 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034955
William M. Brack21e4ef22005-01-02 09:53:13 +000034956#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034957 int mem_base;
34958 int ret_val;
34959 int code; /* UCS code point */
34960 int n_code;
34961
34962 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34963 mem_base = xmlMemBlocks();
34964 code = gen_int(n_code, 0);
34965
34966 ret_val = xmlUCSIsCJKCompatibilityForms(code);
34967 desret_int(ret_val);
34968 call_tests++;
34969 des_int(n_code, code, 0);
34970 xmlResetLastError();
34971 if (mem_base != xmlMemBlocks()) {
34972 printf("Leak of %d blocks found in xmlUCSIsCJKCompatibilityForms",
34973 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034974 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034975 printf(" %d", n_code);
34976 printf("\n");
34977 }
34978 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034979 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034980#endif
34981
Daniel Veillard42595322004-11-08 10:52:06 +000034982 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034983}
34984
34985
34986static int
34987test_xmlUCSIsCJKCompatibilityIdeographs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034988 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034989
William M. Brack21e4ef22005-01-02 09:53:13 +000034990#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034991 int mem_base;
34992 int ret_val;
34993 int code; /* UCS code point */
34994 int n_code;
34995
34996 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34997 mem_base = xmlMemBlocks();
34998 code = gen_int(n_code, 0);
34999
35000 ret_val = xmlUCSIsCJKCompatibilityIdeographs(code);
35001 desret_int(ret_val);
35002 call_tests++;
35003 des_int(n_code, code, 0);
35004 xmlResetLastError();
35005 if (mem_base != xmlMemBlocks()) {
35006 printf("Leak of %d blocks found in xmlUCSIsCJKCompatibilityIdeographs",
35007 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035008 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035009 printf(" %d", n_code);
35010 printf("\n");
35011 }
35012 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035013 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035014#endif
35015
Daniel Veillard42595322004-11-08 10:52:06 +000035016 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035017}
35018
35019
35020static int
35021test_xmlUCSIsCJKCompatibilityIdeographsSupplement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035022 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035023
William M. Brack21e4ef22005-01-02 09:53:13 +000035024#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035025 int mem_base;
35026 int ret_val;
35027 int code; /* UCS code point */
35028 int n_code;
35029
35030 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35031 mem_base = xmlMemBlocks();
35032 code = gen_int(n_code, 0);
35033
35034 ret_val = xmlUCSIsCJKCompatibilityIdeographsSupplement(code);
35035 desret_int(ret_val);
35036 call_tests++;
35037 des_int(n_code, code, 0);
35038 xmlResetLastError();
35039 if (mem_base != xmlMemBlocks()) {
35040 printf("Leak of %d blocks found in xmlUCSIsCJKCompatibilityIdeographsSupplement",
35041 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035042 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035043 printf(" %d", n_code);
35044 printf("\n");
35045 }
35046 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035047 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035048#endif
35049
Daniel Veillard42595322004-11-08 10:52:06 +000035050 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035051}
35052
35053
35054static int
35055test_xmlUCSIsCJKRadicalsSupplement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035056 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035057
William M. Brack21e4ef22005-01-02 09:53:13 +000035058#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035059 int mem_base;
35060 int ret_val;
35061 int code; /* UCS code point */
35062 int n_code;
35063
35064 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35065 mem_base = xmlMemBlocks();
35066 code = gen_int(n_code, 0);
35067
35068 ret_val = xmlUCSIsCJKRadicalsSupplement(code);
35069 desret_int(ret_val);
35070 call_tests++;
35071 des_int(n_code, code, 0);
35072 xmlResetLastError();
35073 if (mem_base != xmlMemBlocks()) {
35074 printf("Leak of %d blocks found in xmlUCSIsCJKRadicalsSupplement",
35075 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035076 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035077 printf(" %d", n_code);
35078 printf("\n");
35079 }
35080 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035081 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035082#endif
35083
Daniel Veillard42595322004-11-08 10:52:06 +000035084 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035085}
35086
35087
35088static int
35089test_xmlUCSIsCJKSymbolsandPunctuation(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035090 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035091
William M. Brack21e4ef22005-01-02 09:53:13 +000035092#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035093 int mem_base;
35094 int ret_val;
35095 int code; /* UCS code point */
35096 int n_code;
35097
35098 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35099 mem_base = xmlMemBlocks();
35100 code = gen_int(n_code, 0);
35101
35102 ret_val = xmlUCSIsCJKSymbolsandPunctuation(code);
35103 desret_int(ret_val);
35104 call_tests++;
35105 des_int(n_code, code, 0);
35106 xmlResetLastError();
35107 if (mem_base != xmlMemBlocks()) {
35108 printf("Leak of %d blocks found in xmlUCSIsCJKSymbolsandPunctuation",
35109 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035110 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035111 printf(" %d", n_code);
35112 printf("\n");
35113 }
35114 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035115 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035116#endif
35117
Daniel Veillard42595322004-11-08 10:52:06 +000035118 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035119}
35120
35121
35122static int
35123test_xmlUCSIsCJKUnifiedIdeographs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035124 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035125
William M. Brack21e4ef22005-01-02 09:53:13 +000035126#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035127 int mem_base;
35128 int ret_val;
35129 int code; /* UCS code point */
35130 int n_code;
35131
35132 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35133 mem_base = xmlMemBlocks();
35134 code = gen_int(n_code, 0);
35135
35136 ret_val = xmlUCSIsCJKUnifiedIdeographs(code);
35137 desret_int(ret_val);
35138 call_tests++;
35139 des_int(n_code, code, 0);
35140 xmlResetLastError();
35141 if (mem_base != xmlMemBlocks()) {
35142 printf("Leak of %d blocks found in xmlUCSIsCJKUnifiedIdeographs",
35143 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035144 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035145 printf(" %d", n_code);
35146 printf("\n");
35147 }
35148 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035149 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035150#endif
35151
Daniel Veillard42595322004-11-08 10:52:06 +000035152 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035153}
35154
35155
35156static int
35157test_xmlUCSIsCJKUnifiedIdeographsExtensionA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035158 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035159
William M. Brack21e4ef22005-01-02 09:53:13 +000035160#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035161 int mem_base;
35162 int ret_val;
35163 int code; /* UCS code point */
35164 int n_code;
35165
35166 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35167 mem_base = xmlMemBlocks();
35168 code = gen_int(n_code, 0);
35169
35170 ret_val = xmlUCSIsCJKUnifiedIdeographsExtensionA(code);
35171 desret_int(ret_val);
35172 call_tests++;
35173 des_int(n_code, code, 0);
35174 xmlResetLastError();
35175 if (mem_base != xmlMemBlocks()) {
35176 printf("Leak of %d blocks found in xmlUCSIsCJKUnifiedIdeographsExtensionA",
35177 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035178 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035179 printf(" %d", n_code);
35180 printf("\n");
35181 }
35182 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035183 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035184#endif
35185
Daniel Veillard42595322004-11-08 10:52:06 +000035186 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035187}
35188
35189
35190static int
35191test_xmlUCSIsCJKUnifiedIdeographsExtensionB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035192 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035193
William M. Brack21e4ef22005-01-02 09:53:13 +000035194#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035195 int mem_base;
35196 int ret_val;
35197 int code; /* UCS code point */
35198 int n_code;
35199
35200 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35201 mem_base = xmlMemBlocks();
35202 code = gen_int(n_code, 0);
35203
35204 ret_val = xmlUCSIsCJKUnifiedIdeographsExtensionB(code);
35205 desret_int(ret_val);
35206 call_tests++;
35207 des_int(n_code, code, 0);
35208 xmlResetLastError();
35209 if (mem_base != xmlMemBlocks()) {
35210 printf("Leak of %d blocks found in xmlUCSIsCJKUnifiedIdeographsExtensionB",
35211 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035212 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035213 printf(" %d", n_code);
35214 printf("\n");
35215 }
35216 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035217 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035218#endif
35219
Daniel Veillard42595322004-11-08 10:52:06 +000035220 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035221}
35222
35223
35224static int
35225test_xmlUCSIsCat(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035226 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035227
William M. Brack21e4ef22005-01-02 09:53:13 +000035228#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035229 int mem_base;
35230 int ret_val;
35231 int code; /* UCS code point */
35232 int n_code;
Daniel Veillardce682bc2004-11-05 17:22:25 +000035233 char * cat; /* UCS Category name */
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035234 int n_cat;
35235
35236 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35237 for (n_cat = 0;n_cat < gen_nb_const_char_ptr;n_cat++) {
35238 mem_base = xmlMemBlocks();
35239 code = gen_int(n_code, 0);
35240 cat = gen_const_char_ptr(n_cat, 1);
35241
William M. Brackf13f77f2004-11-12 16:03:48 +000035242 ret_val = xmlUCSIsCat(code, (const char *)cat);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035243 desret_int(ret_val);
35244 call_tests++;
35245 des_int(n_code, code, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000035246 des_const_char_ptr(n_cat, (const char *)cat, 1);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035247 xmlResetLastError();
35248 if (mem_base != xmlMemBlocks()) {
35249 printf("Leak of %d blocks found in xmlUCSIsCat",
35250 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035251 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035252 printf(" %d", n_code);
35253 printf(" %d", n_cat);
35254 printf("\n");
35255 }
35256 }
35257 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035258 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035259#endif
35260
Daniel Veillard42595322004-11-08 10:52:06 +000035261 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035262}
35263
35264
35265static int
35266test_xmlUCSIsCatC(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035267 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035268
William M. Brack21e4ef22005-01-02 09:53:13 +000035269#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035270 int mem_base;
35271 int ret_val;
35272 int code; /* UCS code point */
35273 int n_code;
35274
35275 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35276 mem_base = xmlMemBlocks();
35277 code = gen_int(n_code, 0);
35278
35279 ret_val = xmlUCSIsCatC(code);
35280 desret_int(ret_val);
35281 call_tests++;
35282 des_int(n_code, code, 0);
35283 xmlResetLastError();
35284 if (mem_base != xmlMemBlocks()) {
35285 printf("Leak of %d blocks found in xmlUCSIsCatC",
35286 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035287 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035288 printf(" %d", n_code);
35289 printf("\n");
35290 }
35291 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035292 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035293#endif
35294
Daniel Veillard42595322004-11-08 10:52:06 +000035295 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035296}
35297
35298
35299static int
35300test_xmlUCSIsCatCc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035301 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035302
William M. Brack21e4ef22005-01-02 09:53:13 +000035303#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035304 int mem_base;
35305 int ret_val;
35306 int code; /* UCS code point */
35307 int n_code;
35308
35309 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35310 mem_base = xmlMemBlocks();
35311 code = gen_int(n_code, 0);
35312
35313 ret_val = xmlUCSIsCatCc(code);
35314 desret_int(ret_val);
35315 call_tests++;
35316 des_int(n_code, code, 0);
35317 xmlResetLastError();
35318 if (mem_base != xmlMemBlocks()) {
35319 printf("Leak of %d blocks found in xmlUCSIsCatCc",
35320 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035321 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035322 printf(" %d", n_code);
35323 printf("\n");
35324 }
35325 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035326 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035327#endif
35328
Daniel Veillard42595322004-11-08 10:52:06 +000035329 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035330}
35331
35332
35333static int
35334test_xmlUCSIsCatCf(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035335 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035336
William M. Brack21e4ef22005-01-02 09:53:13 +000035337#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035338 int mem_base;
35339 int ret_val;
35340 int code; /* UCS code point */
35341 int n_code;
35342
35343 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35344 mem_base = xmlMemBlocks();
35345 code = gen_int(n_code, 0);
35346
35347 ret_val = xmlUCSIsCatCf(code);
35348 desret_int(ret_val);
35349 call_tests++;
35350 des_int(n_code, code, 0);
35351 xmlResetLastError();
35352 if (mem_base != xmlMemBlocks()) {
35353 printf("Leak of %d blocks found in xmlUCSIsCatCf",
35354 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035355 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035356 printf(" %d", n_code);
35357 printf("\n");
35358 }
35359 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035360 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035361#endif
35362
Daniel Veillard42595322004-11-08 10:52:06 +000035363 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035364}
35365
35366
35367static int
35368test_xmlUCSIsCatCo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035369 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035370
William M. Brack21e4ef22005-01-02 09:53:13 +000035371#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035372 int mem_base;
35373 int ret_val;
35374 int code; /* UCS code point */
35375 int n_code;
35376
35377 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35378 mem_base = xmlMemBlocks();
35379 code = gen_int(n_code, 0);
35380
35381 ret_val = xmlUCSIsCatCo(code);
35382 desret_int(ret_val);
35383 call_tests++;
35384 des_int(n_code, code, 0);
35385 xmlResetLastError();
35386 if (mem_base != xmlMemBlocks()) {
35387 printf("Leak of %d blocks found in xmlUCSIsCatCo",
35388 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035389 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035390 printf(" %d", n_code);
35391 printf("\n");
35392 }
35393 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035394 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035395#endif
35396
Daniel Veillard42595322004-11-08 10:52:06 +000035397 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035398}
35399
35400
35401static int
35402test_xmlUCSIsCatCs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035403 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035404
William M. Brack21e4ef22005-01-02 09:53:13 +000035405#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035406 int mem_base;
35407 int ret_val;
35408 int code; /* UCS code point */
35409 int n_code;
35410
35411 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35412 mem_base = xmlMemBlocks();
35413 code = gen_int(n_code, 0);
35414
35415 ret_val = xmlUCSIsCatCs(code);
35416 desret_int(ret_val);
35417 call_tests++;
35418 des_int(n_code, code, 0);
35419 xmlResetLastError();
35420 if (mem_base != xmlMemBlocks()) {
35421 printf("Leak of %d blocks found in xmlUCSIsCatCs",
35422 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035423 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035424 printf(" %d", n_code);
35425 printf("\n");
35426 }
35427 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035428 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035429#endif
35430
Daniel Veillard42595322004-11-08 10:52:06 +000035431 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035432}
35433
35434
35435static int
35436test_xmlUCSIsCatL(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035437 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035438
William M. Brack21e4ef22005-01-02 09:53:13 +000035439#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035440 int mem_base;
35441 int ret_val;
35442 int code; /* UCS code point */
35443 int n_code;
35444
35445 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35446 mem_base = xmlMemBlocks();
35447 code = gen_int(n_code, 0);
35448
35449 ret_val = xmlUCSIsCatL(code);
35450 desret_int(ret_val);
35451 call_tests++;
35452 des_int(n_code, code, 0);
35453 xmlResetLastError();
35454 if (mem_base != xmlMemBlocks()) {
35455 printf("Leak of %d blocks found in xmlUCSIsCatL",
35456 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035457 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035458 printf(" %d", n_code);
35459 printf("\n");
35460 }
35461 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035462 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035463#endif
35464
Daniel Veillard42595322004-11-08 10:52:06 +000035465 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035466}
35467
35468
35469static int
35470test_xmlUCSIsCatLl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035471 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035472
William M. Brack21e4ef22005-01-02 09:53:13 +000035473#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035474 int mem_base;
35475 int ret_val;
35476 int code; /* UCS code point */
35477 int n_code;
35478
35479 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35480 mem_base = xmlMemBlocks();
35481 code = gen_int(n_code, 0);
35482
35483 ret_val = xmlUCSIsCatLl(code);
35484 desret_int(ret_val);
35485 call_tests++;
35486 des_int(n_code, code, 0);
35487 xmlResetLastError();
35488 if (mem_base != xmlMemBlocks()) {
35489 printf("Leak of %d blocks found in xmlUCSIsCatLl",
35490 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035491 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035492 printf(" %d", n_code);
35493 printf("\n");
35494 }
35495 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035496 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035497#endif
35498
Daniel Veillard42595322004-11-08 10:52:06 +000035499 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035500}
35501
35502
35503static int
35504test_xmlUCSIsCatLm(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035505 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035506
William M. Brack21e4ef22005-01-02 09:53:13 +000035507#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035508 int mem_base;
35509 int ret_val;
35510 int code; /* UCS code point */
35511 int n_code;
35512
35513 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35514 mem_base = xmlMemBlocks();
35515 code = gen_int(n_code, 0);
35516
35517 ret_val = xmlUCSIsCatLm(code);
35518 desret_int(ret_val);
35519 call_tests++;
35520 des_int(n_code, code, 0);
35521 xmlResetLastError();
35522 if (mem_base != xmlMemBlocks()) {
35523 printf("Leak of %d blocks found in xmlUCSIsCatLm",
35524 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035525 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035526 printf(" %d", n_code);
35527 printf("\n");
35528 }
35529 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035530 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035531#endif
35532
Daniel Veillard42595322004-11-08 10:52:06 +000035533 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035534}
35535
35536
35537static int
35538test_xmlUCSIsCatLo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035539 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035540
William M. Brack21e4ef22005-01-02 09:53:13 +000035541#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035542 int mem_base;
35543 int ret_val;
35544 int code; /* UCS code point */
35545 int n_code;
35546
35547 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35548 mem_base = xmlMemBlocks();
35549 code = gen_int(n_code, 0);
35550
35551 ret_val = xmlUCSIsCatLo(code);
35552 desret_int(ret_val);
35553 call_tests++;
35554 des_int(n_code, code, 0);
35555 xmlResetLastError();
35556 if (mem_base != xmlMemBlocks()) {
35557 printf("Leak of %d blocks found in xmlUCSIsCatLo",
35558 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035559 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035560 printf(" %d", n_code);
35561 printf("\n");
35562 }
35563 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035564 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035565#endif
35566
Daniel Veillard42595322004-11-08 10:52:06 +000035567 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035568}
35569
35570
35571static int
35572test_xmlUCSIsCatLt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035573 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035574
William M. Brack21e4ef22005-01-02 09:53:13 +000035575#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035576 int mem_base;
35577 int ret_val;
35578 int code; /* UCS code point */
35579 int n_code;
35580
35581 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35582 mem_base = xmlMemBlocks();
35583 code = gen_int(n_code, 0);
35584
35585 ret_val = xmlUCSIsCatLt(code);
35586 desret_int(ret_val);
35587 call_tests++;
35588 des_int(n_code, code, 0);
35589 xmlResetLastError();
35590 if (mem_base != xmlMemBlocks()) {
35591 printf("Leak of %d blocks found in xmlUCSIsCatLt",
35592 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035593 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035594 printf(" %d", n_code);
35595 printf("\n");
35596 }
35597 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035598 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035599#endif
35600
Daniel Veillard42595322004-11-08 10:52:06 +000035601 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035602}
35603
35604
35605static int
35606test_xmlUCSIsCatLu(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035607 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035608
William M. Brack21e4ef22005-01-02 09:53:13 +000035609#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035610 int mem_base;
35611 int ret_val;
35612 int code; /* UCS code point */
35613 int n_code;
35614
35615 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35616 mem_base = xmlMemBlocks();
35617 code = gen_int(n_code, 0);
35618
35619 ret_val = xmlUCSIsCatLu(code);
35620 desret_int(ret_val);
35621 call_tests++;
35622 des_int(n_code, code, 0);
35623 xmlResetLastError();
35624 if (mem_base != xmlMemBlocks()) {
35625 printf("Leak of %d blocks found in xmlUCSIsCatLu",
35626 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035627 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035628 printf(" %d", n_code);
35629 printf("\n");
35630 }
35631 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035632 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035633#endif
35634
Daniel Veillard42595322004-11-08 10:52:06 +000035635 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035636}
35637
35638
35639static int
35640test_xmlUCSIsCatM(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035641 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035642
William M. Brack21e4ef22005-01-02 09:53:13 +000035643#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035644 int mem_base;
35645 int ret_val;
35646 int code; /* UCS code point */
35647 int n_code;
35648
35649 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35650 mem_base = xmlMemBlocks();
35651 code = gen_int(n_code, 0);
35652
35653 ret_val = xmlUCSIsCatM(code);
35654 desret_int(ret_val);
35655 call_tests++;
35656 des_int(n_code, code, 0);
35657 xmlResetLastError();
35658 if (mem_base != xmlMemBlocks()) {
35659 printf("Leak of %d blocks found in xmlUCSIsCatM",
35660 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035661 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035662 printf(" %d", n_code);
35663 printf("\n");
35664 }
35665 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035666 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035667#endif
35668
Daniel Veillard42595322004-11-08 10:52:06 +000035669 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035670}
35671
35672
35673static int
35674test_xmlUCSIsCatMc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035675 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035676
William M. Brack21e4ef22005-01-02 09:53:13 +000035677#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035678 int mem_base;
35679 int ret_val;
35680 int code; /* UCS code point */
35681 int n_code;
35682
35683 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35684 mem_base = xmlMemBlocks();
35685 code = gen_int(n_code, 0);
35686
35687 ret_val = xmlUCSIsCatMc(code);
35688 desret_int(ret_val);
35689 call_tests++;
35690 des_int(n_code, code, 0);
35691 xmlResetLastError();
35692 if (mem_base != xmlMemBlocks()) {
35693 printf("Leak of %d blocks found in xmlUCSIsCatMc",
35694 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035695 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035696 printf(" %d", n_code);
35697 printf("\n");
35698 }
35699 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035700 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035701#endif
35702
Daniel Veillard42595322004-11-08 10:52:06 +000035703 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035704}
35705
35706
35707static int
35708test_xmlUCSIsCatMe(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035709 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035710
William M. Brack21e4ef22005-01-02 09:53:13 +000035711#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035712 int mem_base;
35713 int ret_val;
35714 int code; /* UCS code point */
35715 int n_code;
35716
35717 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35718 mem_base = xmlMemBlocks();
35719 code = gen_int(n_code, 0);
35720
35721 ret_val = xmlUCSIsCatMe(code);
35722 desret_int(ret_val);
35723 call_tests++;
35724 des_int(n_code, code, 0);
35725 xmlResetLastError();
35726 if (mem_base != xmlMemBlocks()) {
35727 printf("Leak of %d blocks found in xmlUCSIsCatMe",
35728 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035729 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035730 printf(" %d", n_code);
35731 printf("\n");
35732 }
35733 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035734 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035735#endif
35736
Daniel Veillard42595322004-11-08 10:52:06 +000035737 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035738}
35739
35740
35741static int
35742test_xmlUCSIsCatMn(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035743 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035744
William M. Brack21e4ef22005-01-02 09:53:13 +000035745#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035746 int mem_base;
35747 int ret_val;
35748 int code; /* UCS code point */
35749 int n_code;
35750
35751 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35752 mem_base = xmlMemBlocks();
35753 code = gen_int(n_code, 0);
35754
35755 ret_val = xmlUCSIsCatMn(code);
35756 desret_int(ret_val);
35757 call_tests++;
35758 des_int(n_code, code, 0);
35759 xmlResetLastError();
35760 if (mem_base != xmlMemBlocks()) {
35761 printf("Leak of %d blocks found in xmlUCSIsCatMn",
35762 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035763 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035764 printf(" %d", n_code);
35765 printf("\n");
35766 }
35767 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035768 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035769#endif
35770
Daniel Veillard42595322004-11-08 10:52:06 +000035771 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035772}
35773
35774
35775static int
35776test_xmlUCSIsCatN(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035777 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035778
William M. Brack21e4ef22005-01-02 09:53:13 +000035779#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035780 int mem_base;
35781 int ret_val;
35782 int code; /* UCS code point */
35783 int n_code;
35784
35785 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35786 mem_base = xmlMemBlocks();
35787 code = gen_int(n_code, 0);
35788
35789 ret_val = xmlUCSIsCatN(code);
35790 desret_int(ret_val);
35791 call_tests++;
35792 des_int(n_code, code, 0);
35793 xmlResetLastError();
35794 if (mem_base != xmlMemBlocks()) {
35795 printf("Leak of %d blocks found in xmlUCSIsCatN",
35796 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035797 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035798 printf(" %d", n_code);
35799 printf("\n");
35800 }
35801 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035802 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035803#endif
35804
Daniel Veillard42595322004-11-08 10:52:06 +000035805 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035806}
35807
35808
35809static int
35810test_xmlUCSIsCatNd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035811 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035812
William M. Brack21e4ef22005-01-02 09:53:13 +000035813#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035814 int mem_base;
35815 int ret_val;
35816 int code; /* UCS code point */
35817 int n_code;
35818
35819 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35820 mem_base = xmlMemBlocks();
35821 code = gen_int(n_code, 0);
35822
35823 ret_val = xmlUCSIsCatNd(code);
35824 desret_int(ret_val);
35825 call_tests++;
35826 des_int(n_code, code, 0);
35827 xmlResetLastError();
35828 if (mem_base != xmlMemBlocks()) {
35829 printf("Leak of %d blocks found in xmlUCSIsCatNd",
35830 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035831 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035832 printf(" %d", n_code);
35833 printf("\n");
35834 }
35835 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035836 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035837#endif
35838
Daniel Veillard42595322004-11-08 10:52:06 +000035839 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035840}
35841
35842
35843static int
35844test_xmlUCSIsCatNl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035845 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035846
William M. Brack21e4ef22005-01-02 09:53:13 +000035847#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035848 int mem_base;
35849 int ret_val;
35850 int code; /* UCS code point */
35851 int n_code;
35852
35853 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35854 mem_base = xmlMemBlocks();
35855 code = gen_int(n_code, 0);
35856
35857 ret_val = xmlUCSIsCatNl(code);
35858 desret_int(ret_val);
35859 call_tests++;
35860 des_int(n_code, code, 0);
35861 xmlResetLastError();
35862 if (mem_base != xmlMemBlocks()) {
35863 printf("Leak of %d blocks found in xmlUCSIsCatNl",
35864 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035865 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035866 printf(" %d", n_code);
35867 printf("\n");
35868 }
35869 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035870 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035871#endif
35872
Daniel Veillard42595322004-11-08 10:52:06 +000035873 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035874}
35875
35876
35877static int
35878test_xmlUCSIsCatNo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035879 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035880
William M. Brack21e4ef22005-01-02 09:53:13 +000035881#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035882 int mem_base;
35883 int ret_val;
35884 int code; /* UCS code point */
35885 int n_code;
35886
35887 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35888 mem_base = xmlMemBlocks();
35889 code = gen_int(n_code, 0);
35890
35891 ret_val = xmlUCSIsCatNo(code);
35892 desret_int(ret_val);
35893 call_tests++;
35894 des_int(n_code, code, 0);
35895 xmlResetLastError();
35896 if (mem_base != xmlMemBlocks()) {
35897 printf("Leak of %d blocks found in xmlUCSIsCatNo",
35898 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035899 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035900 printf(" %d", n_code);
35901 printf("\n");
35902 }
35903 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035904 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035905#endif
35906
Daniel Veillard42595322004-11-08 10:52:06 +000035907 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035908}
35909
35910
35911static int
35912test_xmlUCSIsCatP(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035913 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035914
William M. Brack21e4ef22005-01-02 09:53:13 +000035915#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035916 int mem_base;
35917 int ret_val;
35918 int code; /* UCS code point */
35919 int n_code;
35920
35921 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35922 mem_base = xmlMemBlocks();
35923 code = gen_int(n_code, 0);
35924
35925 ret_val = xmlUCSIsCatP(code);
35926 desret_int(ret_val);
35927 call_tests++;
35928 des_int(n_code, code, 0);
35929 xmlResetLastError();
35930 if (mem_base != xmlMemBlocks()) {
35931 printf("Leak of %d blocks found in xmlUCSIsCatP",
35932 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035933 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035934 printf(" %d", n_code);
35935 printf("\n");
35936 }
35937 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035938 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035939#endif
35940
Daniel Veillard42595322004-11-08 10:52:06 +000035941 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035942}
35943
35944
35945static int
35946test_xmlUCSIsCatPc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035947 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035948
William M. Brack21e4ef22005-01-02 09:53:13 +000035949#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035950 int mem_base;
35951 int ret_val;
35952 int code; /* UCS code point */
35953 int n_code;
35954
35955 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35956 mem_base = xmlMemBlocks();
35957 code = gen_int(n_code, 0);
35958
35959 ret_val = xmlUCSIsCatPc(code);
35960 desret_int(ret_val);
35961 call_tests++;
35962 des_int(n_code, code, 0);
35963 xmlResetLastError();
35964 if (mem_base != xmlMemBlocks()) {
35965 printf("Leak of %d blocks found in xmlUCSIsCatPc",
35966 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035967 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035968 printf(" %d", n_code);
35969 printf("\n");
35970 }
35971 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035972 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035973#endif
35974
Daniel Veillard42595322004-11-08 10:52:06 +000035975 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035976}
35977
35978
35979static int
35980test_xmlUCSIsCatPd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035981 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035982
William M. Brack21e4ef22005-01-02 09:53:13 +000035983#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035984 int mem_base;
35985 int ret_val;
35986 int code; /* UCS code point */
35987 int n_code;
35988
35989 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35990 mem_base = xmlMemBlocks();
35991 code = gen_int(n_code, 0);
35992
35993 ret_val = xmlUCSIsCatPd(code);
35994 desret_int(ret_val);
35995 call_tests++;
35996 des_int(n_code, code, 0);
35997 xmlResetLastError();
35998 if (mem_base != xmlMemBlocks()) {
35999 printf("Leak of %d blocks found in xmlUCSIsCatPd",
36000 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036001 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036002 printf(" %d", n_code);
36003 printf("\n");
36004 }
36005 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036006 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036007#endif
36008
Daniel Veillard42595322004-11-08 10:52:06 +000036009 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036010}
36011
36012
36013static int
36014test_xmlUCSIsCatPe(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036015 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036016
William M. Brack21e4ef22005-01-02 09:53:13 +000036017#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036018 int mem_base;
36019 int ret_val;
36020 int code; /* UCS code point */
36021 int n_code;
36022
36023 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36024 mem_base = xmlMemBlocks();
36025 code = gen_int(n_code, 0);
36026
36027 ret_val = xmlUCSIsCatPe(code);
36028 desret_int(ret_val);
36029 call_tests++;
36030 des_int(n_code, code, 0);
36031 xmlResetLastError();
36032 if (mem_base != xmlMemBlocks()) {
36033 printf("Leak of %d blocks found in xmlUCSIsCatPe",
36034 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036035 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036036 printf(" %d", n_code);
36037 printf("\n");
36038 }
36039 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036040 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036041#endif
36042
Daniel Veillard42595322004-11-08 10:52:06 +000036043 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036044}
36045
36046
36047static int
36048test_xmlUCSIsCatPf(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036049 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036050
William M. Brack21e4ef22005-01-02 09:53:13 +000036051#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036052 int mem_base;
36053 int ret_val;
36054 int code; /* UCS code point */
36055 int n_code;
36056
36057 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36058 mem_base = xmlMemBlocks();
36059 code = gen_int(n_code, 0);
36060
36061 ret_val = xmlUCSIsCatPf(code);
36062 desret_int(ret_val);
36063 call_tests++;
36064 des_int(n_code, code, 0);
36065 xmlResetLastError();
36066 if (mem_base != xmlMemBlocks()) {
36067 printf("Leak of %d blocks found in xmlUCSIsCatPf",
36068 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036069 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036070 printf(" %d", n_code);
36071 printf("\n");
36072 }
36073 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036074 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036075#endif
36076
Daniel Veillard42595322004-11-08 10:52:06 +000036077 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036078}
36079
36080
36081static int
36082test_xmlUCSIsCatPi(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036083 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036084
William M. Brack21e4ef22005-01-02 09:53:13 +000036085#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036086 int mem_base;
36087 int ret_val;
36088 int code; /* UCS code point */
36089 int n_code;
36090
36091 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36092 mem_base = xmlMemBlocks();
36093 code = gen_int(n_code, 0);
36094
36095 ret_val = xmlUCSIsCatPi(code);
36096 desret_int(ret_val);
36097 call_tests++;
36098 des_int(n_code, code, 0);
36099 xmlResetLastError();
36100 if (mem_base != xmlMemBlocks()) {
36101 printf("Leak of %d blocks found in xmlUCSIsCatPi",
36102 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036103 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036104 printf(" %d", n_code);
36105 printf("\n");
36106 }
36107 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036108 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036109#endif
36110
Daniel Veillard42595322004-11-08 10:52:06 +000036111 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036112}
36113
36114
36115static int
36116test_xmlUCSIsCatPo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036117 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036118
William M. Brack21e4ef22005-01-02 09:53:13 +000036119#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036120 int mem_base;
36121 int ret_val;
36122 int code; /* UCS code point */
36123 int n_code;
36124
36125 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36126 mem_base = xmlMemBlocks();
36127 code = gen_int(n_code, 0);
36128
36129 ret_val = xmlUCSIsCatPo(code);
36130 desret_int(ret_val);
36131 call_tests++;
36132 des_int(n_code, code, 0);
36133 xmlResetLastError();
36134 if (mem_base != xmlMemBlocks()) {
36135 printf("Leak of %d blocks found in xmlUCSIsCatPo",
36136 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036137 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036138 printf(" %d", n_code);
36139 printf("\n");
36140 }
36141 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036142 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036143#endif
36144
Daniel Veillard42595322004-11-08 10:52:06 +000036145 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036146}
36147
36148
36149static int
36150test_xmlUCSIsCatPs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036151 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036152
William M. Brack21e4ef22005-01-02 09:53:13 +000036153#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036154 int mem_base;
36155 int ret_val;
36156 int code; /* UCS code point */
36157 int n_code;
36158
36159 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36160 mem_base = xmlMemBlocks();
36161 code = gen_int(n_code, 0);
36162
36163 ret_val = xmlUCSIsCatPs(code);
36164 desret_int(ret_val);
36165 call_tests++;
36166 des_int(n_code, code, 0);
36167 xmlResetLastError();
36168 if (mem_base != xmlMemBlocks()) {
36169 printf("Leak of %d blocks found in xmlUCSIsCatPs",
36170 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036171 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036172 printf(" %d", n_code);
36173 printf("\n");
36174 }
36175 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036176 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036177#endif
36178
Daniel Veillard42595322004-11-08 10:52:06 +000036179 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036180}
36181
36182
36183static int
36184test_xmlUCSIsCatS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036185 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036186
William M. Brack21e4ef22005-01-02 09:53:13 +000036187#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036188 int mem_base;
36189 int ret_val;
36190 int code; /* UCS code point */
36191 int n_code;
36192
36193 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36194 mem_base = xmlMemBlocks();
36195 code = gen_int(n_code, 0);
36196
36197 ret_val = xmlUCSIsCatS(code);
36198 desret_int(ret_val);
36199 call_tests++;
36200 des_int(n_code, code, 0);
36201 xmlResetLastError();
36202 if (mem_base != xmlMemBlocks()) {
36203 printf("Leak of %d blocks found in xmlUCSIsCatS",
36204 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036205 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036206 printf(" %d", n_code);
36207 printf("\n");
36208 }
36209 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036210 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036211#endif
36212
Daniel Veillard42595322004-11-08 10:52:06 +000036213 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036214}
36215
36216
36217static int
36218test_xmlUCSIsCatSc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036219 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036220
William M. Brack21e4ef22005-01-02 09:53:13 +000036221#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036222 int mem_base;
36223 int ret_val;
36224 int code; /* UCS code point */
36225 int n_code;
36226
36227 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36228 mem_base = xmlMemBlocks();
36229 code = gen_int(n_code, 0);
36230
36231 ret_val = xmlUCSIsCatSc(code);
36232 desret_int(ret_val);
36233 call_tests++;
36234 des_int(n_code, code, 0);
36235 xmlResetLastError();
36236 if (mem_base != xmlMemBlocks()) {
36237 printf("Leak of %d blocks found in xmlUCSIsCatSc",
36238 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036239 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036240 printf(" %d", n_code);
36241 printf("\n");
36242 }
36243 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036244 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036245#endif
36246
Daniel Veillard42595322004-11-08 10:52:06 +000036247 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036248}
36249
36250
36251static int
36252test_xmlUCSIsCatSk(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036253 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036254
William M. Brack21e4ef22005-01-02 09:53:13 +000036255#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036256 int mem_base;
36257 int ret_val;
36258 int code; /* UCS code point */
36259 int n_code;
36260
36261 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36262 mem_base = xmlMemBlocks();
36263 code = gen_int(n_code, 0);
36264
36265 ret_val = xmlUCSIsCatSk(code);
36266 desret_int(ret_val);
36267 call_tests++;
36268 des_int(n_code, code, 0);
36269 xmlResetLastError();
36270 if (mem_base != xmlMemBlocks()) {
36271 printf("Leak of %d blocks found in xmlUCSIsCatSk",
36272 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036273 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036274 printf(" %d", n_code);
36275 printf("\n");
36276 }
36277 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036278 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036279#endif
36280
Daniel Veillard42595322004-11-08 10:52:06 +000036281 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036282}
36283
36284
36285static int
36286test_xmlUCSIsCatSm(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036287 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036288
William M. Brack21e4ef22005-01-02 09:53:13 +000036289#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036290 int mem_base;
36291 int ret_val;
36292 int code; /* UCS code point */
36293 int n_code;
36294
36295 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36296 mem_base = xmlMemBlocks();
36297 code = gen_int(n_code, 0);
36298
36299 ret_val = xmlUCSIsCatSm(code);
36300 desret_int(ret_val);
36301 call_tests++;
36302 des_int(n_code, code, 0);
36303 xmlResetLastError();
36304 if (mem_base != xmlMemBlocks()) {
36305 printf("Leak of %d blocks found in xmlUCSIsCatSm",
36306 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036307 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036308 printf(" %d", n_code);
36309 printf("\n");
36310 }
36311 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036312 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036313#endif
36314
Daniel Veillard42595322004-11-08 10:52:06 +000036315 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036316}
36317
36318
36319static int
36320test_xmlUCSIsCatSo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036321 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036322
William M. Brack21e4ef22005-01-02 09:53:13 +000036323#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036324 int mem_base;
36325 int ret_val;
36326 int code; /* UCS code point */
36327 int n_code;
36328
36329 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36330 mem_base = xmlMemBlocks();
36331 code = gen_int(n_code, 0);
36332
36333 ret_val = xmlUCSIsCatSo(code);
36334 desret_int(ret_val);
36335 call_tests++;
36336 des_int(n_code, code, 0);
36337 xmlResetLastError();
36338 if (mem_base != xmlMemBlocks()) {
36339 printf("Leak of %d blocks found in xmlUCSIsCatSo",
36340 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036341 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036342 printf(" %d", n_code);
36343 printf("\n");
36344 }
36345 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036346 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036347#endif
36348
Daniel Veillard42595322004-11-08 10:52:06 +000036349 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036350}
36351
36352
36353static int
36354test_xmlUCSIsCatZ(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036355 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036356
William M. Brack21e4ef22005-01-02 09:53:13 +000036357#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036358 int mem_base;
36359 int ret_val;
36360 int code; /* UCS code point */
36361 int n_code;
36362
36363 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36364 mem_base = xmlMemBlocks();
36365 code = gen_int(n_code, 0);
36366
36367 ret_val = xmlUCSIsCatZ(code);
36368 desret_int(ret_val);
36369 call_tests++;
36370 des_int(n_code, code, 0);
36371 xmlResetLastError();
36372 if (mem_base != xmlMemBlocks()) {
36373 printf("Leak of %d blocks found in xmlUCSIsCatZ",
36374 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036375 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036376 printf(" %d", n_code);
36377 printf("\n");
36378 }
36379 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036380 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036381#endif
36382
Daniel Veillard42595322004-11-08 10:52:06 +000036383 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036384}
36385
36386
36387static int
36388test_xmlUCSIsCatZl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036389 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036390
William M. Brack21e4ef22005-01-02 09:53:13 +000036391#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036392 int mem_base;
36393 int ret_val;
36394 int code; /* UCS code point */
36395 int n_code;
36396
36397 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36398 mem_base = xmlMemBlocks();
36399 code = gen_int(n_code, 0);
36400
36401 ret_val = xmlUCSIsCatZl(code);
36402 desret_int(ret_val);
36403 call_tests++;
36404 des_int(n_code, code, 0);
36405 xmlResetLastError();
36406 if (mem_base != xmlMemBlocks()) {
36407 printf("Leak of %d blocks found in xmlUCSIsCatZl",
36408 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036409 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036410 printf(" %d", n_code);
36411 printf("\n");
36412 }
36413 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036414 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036415#endif
36416
Daniel Veillard42595322004-11-08 10:52:06 +000036417 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036418}
36419
36420
36421static int
36422test_xmlUCSIsCatZp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036423 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036424
William M. Brack21e4ef22005-01-02 09:53:13 +000036425#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036426 int mem_base;
36427 int ret_val;
36428 int code; /* UCS code point */
36429 int n_code;
36430
36431 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36432 mem_base = xmlMemBlocks();
36433 code = gen_int(n_code, 0);
36434
36435 ret_val = xmlUCSIsCatZp(code);
36436 desret_int(ret_val);
36437 call_tests++;
36438 des_int(n_code, code, 0);
36439 xmlResetLastError();
36440 if (mem_base != xmlMemBlocks()) {
36441 printf("Leak of %d blocks found in xmlUCSIsCatZp",
36442 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036443 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036444 printf(" %d", n_code);
36445 printf("\n");
36446 }
36447 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036448 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036449#endif
36450
Daniel Veillard42595322004-11-08 10:52:06 +000036451 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036452}
36453
36454
36455static int
36456test_xmlUCSIsCatZs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036457 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036458
William M. Brack21e4ef22005-01-02 09:53:13 +000036459#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036460 int mem_base;
36461 int ret_val;
36462 int code; /* UCS code point */
36463 int n_code;
36464
36465 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36466 mem_base = xmlMemBlocks();
36467 code = gen_int(n_code, 0);
36468
36469 ret_val = xmlUCSIsCatZs(code);
36470 desret_int(ret_val);
36471 call_tests++;
36472 des_int(n_code, code, 0);
36473 xmlResetLastError();
36474 if (mem_base != xmlMemBlocks()) {
36475 printf("Leak of %d blocks found in xmlUCSIsCatZs",
36476 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036477 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036478 printf(" %d", n_code);
36479 printf("\n");
36480 }
36481 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036482 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036483#endif
36484
Daniel Veillard42595322004-11-08 10:52:06 +000036485 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036486}
36487
36488
36489static int
36490test_xmlUCSIsCherokee(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036491 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036492
William M. Brack21e4ef22005-01-02 09:53:13 +000036493#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036494 int mem_base;
36495 int ret_val;
36496 int code; /* UCS code point */
36497 int n_code;
36498
36499 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36500 mem_base = xmlMemBlocks();
36501 code = gen_int(n_code, 0);
36502
36503 ret_val = xmlUCSIsCherokee(code);
36504 desret_int(ret_val);
36505 call_tests++;
36506 des_int(n_code, code, 0);
36507 xmlResetLastError();
36508 if (mem_base != xmlMemBlocks()) {
36509 printf("Leak of %d blocks found in xmlUCSIsCherokee",
36510 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036511 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036512 printf(" %d", n_code);
36513 printf("\n");
36514 }
36515 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036516 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036517#endif
36518
Daniel Veillard42595322004-11-08 10:52:06 +000036519 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036520}
36521
36522
36523static int
36524test_xmlUCSIsCombiningDiacriticalMarks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036525 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036526
William M. Brack21e4ef22005-01-02 09:53:13 +000036527#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036528 int mem_base;
36529 int ret_val;
36530 int code; /* UCS code point */
36531 int n_code;
36532
36533 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36534 mem_base = xmlMemBlocks();
36535 code = gen_int(n_code, 0);
36536
36537 ret_val = xmlUCSIsCombiningDiacriticalMarks(code);
36538 desret_int(ret_val);
36539 call_tests++;
36540 des_int(n_code, code, 0);
36541 xmlResetLastError();
36542 if (mem_base != xmlMemBlocks()) {
36543 printf("Leak of %d blocks found in xmlUCSIsCombiningDiacriticalMarks",
36544 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036545 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036546 printf(" %d", n_code);
36547 printf("\n");
36548 }
36549 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036550 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036551#endif
36552
Daniel Veillard42595322004-11-08 10:52:06 +000036553 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036554}
36555
36556
36557static int
36558test_xmlUCSIsCombiningDiacriticalMarksforSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036559 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036560
William M. Brack21e4ef22005-01-02 09:53:13 +000036561#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036562 int mem_base;
36563 int ret_val;
36564 int code; /* UCS code point */
36565 int n_code;
36566
36567 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36568 mem_base = xmlMemBlocks();
36569 code = gen_int(n_code, 0);
36570
36571 ret_val = xmlUCSIsCombiningDiacriticalMarksforSymbols(code);
36572 desret_int(ret_val);
36573 call_tests++;
36574 des_int(n_code, code, 0);
36575 xmlResetLastError();
36576 if (mem_base != xmlMemBlocks()) {
36577 printf("Leak of %d blocks found in xmlUCSIsCombiningDiacriticalMarksforSymbols",
36578 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036579 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036580 printf(" %d", n_code);
36581 printf("\n");
36582 }
36583 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036584 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036585#endif
36586
Daniel Veillard42595322004-11-08 10:52:06 +000036587 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036588}
36589
36590
36591static int
36592test_xmlUCSIsCombiningHalfMarks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036593 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036594
William M. Brack21e4ef22005-01-02 09:53:13 +000036595#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036596 int mem_base;
36597 int ret_val;
36598 int code; /* UCS code point */
36599 int n_code;
36600
36601 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36602 mem_base = xmlMemBlocks();
36603 code = gen_int(n_code, 0);
36604
36605 ret_val = xmlUCSIsCombiningHalfMarks(code);
36606 desret_int(ret_val);
36607 call_tests++;
36608 des_int(n_code, code, 0);
36609 xmlResetLastError();
36610 if (mem_base != xmlMemBlocks()) {
36611 printf("Leak of %d blocks found in xmlUCSIsCombiningHalfMarks",
36612 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036613 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036614 printf(" %d", n_code);
36615 printf("\n");
36616 }
36617 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036618 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036619#endif
36620
Daniel Veillard42595322004-11-08 10:52:06 +000036621 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036622}
36623
36624
36625static int
36626test_xmlUCSIsCombiningMarksforSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036627 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036628
William M. Brack21e4ef22005-01-02 09:53:13 +000036629#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036630 int mem_base;
36631 int ret_val;
36632 int code; /* UCS code point */
36633 int n_code;
36634
36635 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36636 mem_base = xmlMemBlocks();
36637 code = gen_int(n_code, 0);
36638
36639 ret_val = xmlUCSIsCombiningMarksforSymbols(code);
36640 desret_int(ret_val);
36641 call_tests++;
36642 des_int(n_code, code, 0);
36643 xmlResetLastError();
36644 if (mem_base != xmlMemBlocks()) {
36645 printf("Leak of %d blocks found in xmlUCSIsCombiningMarksforSymbols",
36646 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036647 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036648 printf(" %d", n_code);
36649 printf("\n");
36650 }
36651 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036652 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036653#endif
36654
Daniel Veillard42595322004-11-08 10:52:06 +000036655 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036656}
36657
36658
36659static int
36660test_xmlUCSIsControlPictures(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036661 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036662
William M. Brack21e4ef22005-01-02 09:53:13 +000036663#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036664 int mem_base;
36665 int ret_val;
36666 int code; /* UCS code point */
36667 int n_code;
36668
36669 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36670 mem_base = xmlMemBlocks();
36671 code = gen_int(n_code, 0);
36672
36673 ret_val = xmlUCSIsControlPictures(code);
36674 desret_int(ret_val);
36675 call_tests++;
36676 des_int(n_code, code, 0);
36677 xmlResetLastError();
36678 if (mem_base != xmlMemBlocks()) {
36679 printf("Leak of %d blocks found in xmlUCSIsControlPictures",
36680 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036681 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036682 printf(" %d", n_code);
36683 printf("\n");
36684 }
36685 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036686 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036687#endif
36688
Daniel Veillard42595322004-11-08 10:52:06 +000036689 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036690}
36691
36692
36693static int
36694test_xmlUCSIsCurrencySymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036695 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036696
William M. Brack21e4ef22005-01-02 09:53:13 +000036697#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036698 int mem_base;
36699 int ret_val;
36700 int code; /* UCS code point */
36701 int n_code;
36702
36703 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36704 mem_base = xmlMemBlocks();
36705 code = gen_int(n_code, 0);
36706
36707 ret_val = xmlUCSIsCurrencySymbols(code);
36708 desret_int(ret_val);
36709 call_tests++;
36710 des_int(n_code, code, 0);
36711 xmlResetLastError();
36712 if (mem_base != xmlMemBlocks()) {
36713 printf("Leak of %d blocks found in xmlUCSIsCurrencySymbols",
36714 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036715 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036716 printf(" %d", n_code);
36717 printf("\n");
36718 }
36719 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036720 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036721#endif
36722
Daniel Veillard42595322004-11-08 10:52:06 +000036723 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036724}
36725
36726
36727static int
36728test_xmlUCSIsCypriotSyllabary(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036729 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036730
William M. Brack21e4ef22005-01-02 09:53:13 +000036731#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036732 int mem_base;
36733 int ret_val;
36734 int code; /* UCS code point */
36735 int n_code;
36736
36737 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36738 mem_base = xmlMemBlocks();
36739 code = gen_int(n_code, 0);
36740
36741 ret_val = xmlUCSIsCypriotSyllabary(code);
36742 desret_int(ret_val);
36743 call_tests++;
36744 des_int(n_code, code, 0);
36745 xmlResetLastError();
36746 if (mem_base != xmlMemBlocks()) {
36747 printf("Leak of %d blocks found in xmlUCSIsCypriotSyllabary",
36748 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036749 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036750 printf(" %d", n_code);
36751 printf("\n");
36752 }
36753 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036754 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036755#endif
36756
Daniel Veillard42595322004-11-08 10:52:06 +000036757 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036758}
36759
36760
36761static int
36762test_xmlUCSIsCyrillic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036763 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036764
William M. Brack21e4ef22005-01-02 09:53:13 +000036765#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036766 int mem_base;
36767 int ret_val;
36768 int code; /* UCS code point */
36769 int n_code;
36770
36771 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36772 mem_base = xmlMemBlocks();
36773 code = gen_int(n_code, 0);
36774
36775 ret_val = xmlUCSIsCyrillic(code);
36776 desret_int(ret_val);
36777 call_tests++;
36778 des_int(n_code, code, 0);
36779 xmlResetLastError();
36780 if (mem_base != xmlMemBlocks()) {
36781 printf("Leak of %d blocks found in xmlUCSIsCyrillic",
36782 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036783 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036784 printf(" %d", n_code);
36785 printf("\n");
36786 }
36787 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036788 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036789#endif
36790
Daniel Veillard42595322004-11-08 10:52:06 +000036791 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036792}
36793
36794
36795static int
36796test_xmlUCSIsCyrillicSupplement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036797 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036798
William M. Brack21e4ef22005-01-02 09:53:13 +000036799#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036800 int mem_base;
36801 int ret_val;
36802 int code; /* UCS code point */
36803 int n_code;
36804
36805 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36806 mem_base = xmlMemBlocks();
36807 code = gen_int(n_code, 0);
36808
36809 ret_val = xmlUCSIsCyrillicSupplement(code);
36810 desret_int(ret_val);
36811 call_tests++;
36812 des_int(n_code, code, 0);
36813 xmlResetLastError();
36814 if (mem_base != xmlMemBlocks()) {
36815 printf("Leak of %d blocks found in xmlUCSIsCyrillicSupplement",
36816 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036817 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036818 printf(" %d", n_code);
36819 printf("\n");
36820 }
36821 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036822 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036823#endif
36824
Daniel Veillard42595322004-11-08 10:52:06 +000036825 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036826}
36827
36828
36829static int
36830test_xmlUCSIsDeseret(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036831 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036832
William M. Brack21e4ef22005-01-02 09:53:13 +000036833#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036834 int mem_base;
36835 int ret_val;
36836 int code; /* UCS code point */
36837 int n_code;
36838
36839 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36840 mem_base = xmlMemBlocks();
36841 code = gen_int(n_code, 0);
36842
36843 ret_val = xmlUCSIsDeseret(code);
36844 desret_int(ret_val);
36845 call_tests++;
36846 des_int(n_code, code, 0);
36847 xmlResetLastError();
36848 if (mem_base != xmlMemBlocks()) {
36849 printf("Leak of %d blocks found in xmlUCSIsDeseret",
36850 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036851 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036852 printf(" %d", n_code);
36853 printf("\n");
36854 }
36855 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036856 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036857#endif
36858
Daniel Veillard42595322004-11-08 10:52:06 +000036859 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036860}
36861
36862
36863static int
36864test_xmlUCSIsDevanagari(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036865 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036866
William M. Brack21e4ef22005-01-02 09:53:13 +000036867#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036868 int mem_base;
36869 int ret_val;
36870 int code; /* UCS code point */
36871 int n_code;
36872
36873 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36874 mem_base = xmlMemBlocks();
36875 code = gen_int(n_code, 0);
36876
36877 ret_val = xmlUCSIsDevanagari(code);
36878 desret_int(ret_val);
36879 call_tests++;
36880 des_int(n_code, code, 0);
36881 xmlResetLastError();
36882 if (mem_base != xmlMemBlocks()) {
36883 printf("Leak of %d blocks found in xmlUCSIsDevanagari",
36884 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036885 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036886 printf(" %d", n_code);
36887 printf("\n");
36888 }
36889 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036890 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036891#endif
36892
Daniel Veillard42595322004-11-08 10:52:06 +000036893 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036894}
36895
36896
36897static int
36898test_xmlUCSIsDingbats(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036899 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036900
William M. Brack21e4ef22005-01-02 09:53:13 +000036901#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036902 int mem_base;
36903 int ret_val;
36904 int code; /* UCS code point */
36905 int n_code;
36906
36907 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36908 mem_base = xmlMemBlocks();
36909 code = gen_int(n_code, 0);
36910
36911 ret_val = xmlUCSIsDingbats(code);
36912 desret_int(ret_val);
36913 call_tests++;
36914 des_int(n_code, code, 0);
36915 xmlResetLastError();
36916 if (mem_base != xmlMemBlocks()) {
36917 printf("Leak of %d blocks found in xmlUCSIsDingbats",
36918 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036919 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036920 printf(" %d", n_code);
36921 printf("\n");
36922 }
36923 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036924 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036925#endif
36926
Daniel Veillard42595322004-11-08 10:52:06 +000036927 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036928}
36929
36930
36931static int
36932test_xmlUCSIsEnclosedAlphanumerics(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036933 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036934
William M. Brack21e4ef22005-01-02 09:53:13 +000036935#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036936 int mem_base;
36937 int ret_val;
36938 int code; /* UCS code point */
36939 int n_code;
36940
36941 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36942 mem_base = xmlMemBlocks();
36943 code = gen_int(n_code, 0);
36944
36945 ret_val = xmlUCSIsEnclosedAlphanumerics(code);
36946 desret_int(ret_val);
36947 call_tests++;
36948 des_int(n_code, code, 0);
36949 xmlResetLastError();
36950 if (mem_base != xmlMemBlocks()) {
36951 printf("Leak of %d blocks found in xmlUCSIsEnclosedAlphanumerics",
36952 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036953 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036954 printf(" %d", n_code);
36955 printf("\n");
36956 }
36957 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036958 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036959#endif
36960
Daniel Veillard42595322004-11-08 10:52:06 +000036961 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036962}
36963
36964
36965static int
36966test_xmlUCSIsEnclosedCJKLettersandMonths(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036967 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036968
William M. Brack21e4ef22005-01-02 09:53:13 +000036969#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036970 int mem_base;
36971 int ret_val;
36972 int code; /* UCS code point */
36973 int n_code;
36974
36975 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36976 mem_base = xmlMemBlocks();
36977 code = gen_int(n_code, 0);
36978
36979 ret_val = xmlUCSIsEnclosedCJKLettersandMonths(code);
36980 desret_int(ret_val);
36981 call_tests++;
36982 des_int(n_code, code, 0);
36983 xmlResetLastError();
36984 if (mem_base != xmlMemBlocks()) {
36985 printf("Leak of %d blocks found in xmlUCSIsEnclosedCJKLettersandMonths",
36986 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036987 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036988 printf(" %d", n_code);
36989 printf("\n");
36990 }
36991 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036992 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036993#endif
36994
Daniel Veillard42595322004-11-08 10:52:06 +000036995 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036996}
36997
36998
36999static int
37000test_xmlUCSIsEthiopic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037001 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037002
William M. Brack21e4ef22005-01-02 09:53:13 +000037003#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037004 int mem_base;
37005 int ret_val;
37006 int code; /* UCS code point */
37007 int n_code;
37008
37009 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37010 mem_base = xmlMemBlocks();
37011 code = gen_int(n_code, 0);
37012
37013 ret_val = xmlUCSIsEthiopic(code);
37014 desret_int(ret_val);
37015 call_tests++;
37016 des_int(n_code, code, 0);
37017 xmlResetLastError();
37018 if (mem_base != xmlMemBlocks()) {
37019 printf("Leak of %d blocks found in xmlUCSIsEthiopic",
37020 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037021 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037022 printf(" %d", n_code);
37023 printf("\n");
37024 }
37025 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037026 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037027#endif
37028
Daniel Veillard42595322004-11-08 10:52:06 +000037029 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037030}
37031
37032
37033static int
37034test_xmlUCSIsGeneralPunctuation(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037035 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037036
William M. Brack21e4ef22005-01-02 09:53:13 +000037037#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037038 int mem_base;
37039 int ret_val;
37040 int code; /* UCS code point */
37041 int n_code;
37042
37043 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37044 mem_base = xmlMemBlocks();
37045 code = gen_int(n_code, 0);
37046
37047 ret_val = xmlUCSIsGeneralPunctuation(code);
37048 desret_int(ret_val);
37049 call_tests++;
37050 des_int(n_code, code, 0);
37051 xmlResetLastError();
37052 if (mem_base != xmlMemBlocks()) {
37053 printf("Leak of %d blocks found in xmlUCSIsGeneralPunctuation",
37054 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037055 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037056 printf(" %d", n_code);
37057 printf("\n");
37058 }
37059 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037060 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037061#endif
37062
Daniel Veillard42595322004-11-08 10:52:06 +000037063 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037064}
37065
37066
37067static int
37068test_xmlUCSIsGeometricShapes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037069 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037070
William M. Brack21e4ef22005-01-02 09:53:13 +000037071#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037072 int mem_base;
37073 int ret_val;
37074 int code; /* UCS code point */
37075 int n_code;
37076
37077 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37078 mem_base = xmlMemBlocks();
37079 code = gen_int(n_code, 0);
37080
37081 ret_val = xmlUCSIsGeometricShapes(code);
37082 desret_int(ret_val);
37083 call_tests++;
37084 des_int(n_code, code, 0);
37085 xmlResetLastError();
37086 if (mem_base != xmlMemBlocks()) {
37087 printf("Leak of %d blocks found in xmlUCSIsGeometricShapes",
37088 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037089 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037090 printf(" %d", n_code);
37091 printf("\n");
37092 }
37093 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037094 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037095#endif
37096
Daniel Veillard42595322004-11-08 10:52:06 +000037097 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037098}
37099
37100
37101static int
37102test_xmlUCSIsGeorgian(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037103 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037104
William M. Brack21e4ef22005-01-02 09:53:13 +000037105#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037106 int mem_base;
37107 int ret_val;
37108 int code; /* UCS code point */
37109 int n_code;
37110
37111 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37112 mem_base = xmlMemBlocks();
37113 code = gen_int(n_code, 0);
37114
37115 ret_val = xmlUCSIsGeorgian(code);
37116 desret_int(ret_val);
37117 call_tests++;
37118 des_int(n_code, code, 0);
37119 xmlResetLastError();
37120 if (mem_base != xmlMemBlocks()) {
37121 printf("Leak of %d blocks found in xmlUCSIsGeorgian",
37122 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037123 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037124 printf(" %d", n_code);
37125 printf("\n");
37126 }
37127 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037128 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037129#endif
37130
Daniel Veillard42595322004-11-08 10:52:06 +000037131 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037132}
37133
37134
37135static int
37136test_xmlUCSIsGothic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037137 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037138
William M. Brack21e4ef22005-01-02 09:53:13 +000037139#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037140 int mem_base;
37141 int ret_val;
37142 int code; /* UCS code point */
37143 int n_code;
37144
37145 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37146 mem_base = xmlMemBlocks();
37147 code = gen_int(n_code, 0);
37148
37149 ret_val = xmlUCSIsGothic(code);
37150 desret_int(ret_val);
37151 call_tests++;
37152 des_int(n_code, code, 0);
37153 xmlResetLastError();
37154 if (mem_base != xmlMemBlocks()) {
37155 printf("Leak of %d blocks found in xmlUCSIsGothic",
37156 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037157 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037158 printf(" %d", n_code);
37159 printf("\n");
37160 }
37161 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037162 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037163#endif
37164
Daniel Veillard42595322004-11-08 10:52:06 +000037165 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037166}
37167
37168
37169static int
37170test_xmlUCSIsGreek(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037171 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037172
William M. Brack21e4ef22005-01-02 09:53:13 +000037173#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037174 int mem_base;
37175 int ret_val;
37176 int code; /* UCS code point */
37177 int n_code;
37178
37179 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37180 mem_base = xmlMemBlocks();
37181 code = gen_int(n_code, 0);
37182
37183 ret_val = xmlUCSIsGreek(code);
37184 desret_int(ret_val);
37185 call_tests++;
37186 des_int(n_code, code, 0);
37187 xmlResetLastError();
37188 if (mem_base != xmlMemBlocks()) {
37189 printf("Leak of %d blocks found in xmlUCSIsGreek",
37190 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037191 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037192 printf(" %d", n_code);
37193 printf("\n");
37194 }
37195 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037196 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037197#endif
37198
Daniel Veillard42595322004-11-08 10:52:06 +000037199 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037200}
37201
37202
37203static int
37204test_xmlUCSIsGreekExtended(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037205 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037206
William M. Brack21e4ef22005-01-02 09:53:13 +000037207#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037208 int mem_base;
37209 int ret_val;
37210 int code; /* UCS code point */
37211 int n_code;
37212
37213 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37214 mem_base = xmlMemBlocks();
37215 code = gen_int(n_code, 0);
37216
37217 ret_val = xmlUCSIsGreekExtended(code);
37218 desret_int(ret_val);
37219 call_tests++;
37220 des_int(n_code, code, 0);
37221 xmlResetLastError();
37222 if (mem_base != xmlMemBlocks()) {
37223 printf("Leak of %d blocks found in xmlUCSIsGreekExtended",
37224 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037225 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037226 printf(" %d", n_code);
37227 printf("\n");
37228 }
37229 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037230 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037231#endif
37232
Daniel Veillard42595322004-11-08 10:52:06 +000037233 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037234}
37235
37236
37237static int
37238test_xmlUCSIsGreekandCoptic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037239 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037240
William M. Brack21e4ef22005-01-02 09:53:13 +000037241#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037242 int mem_base;
37243 int ret_val;
37244 int code; /* UCS code point */
37245 int n_code;
37246
37247 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37248 mem_base = xmlMemBlocks();
37249 code = gen_int(n_code, 0);
37250
37251 ret_val = xmlUCSIsGreekandCoptic(code);
37252 desret_int(ret_val);
37253 call_tests++;
37254 des_int(n_code, code, 0);
37255 xmlResetLastError();
37256 if (mem_base != xmlMemBlocks()) {
37257 printf("Leak of %d blocks found in xmlUCSIsGreekandCoptic",
37258 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037259 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037260 printf(" %d", n_code);
37261 printf("\n");
37262 }
37263 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037264 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037265#endif
37266
Daniel Veillard42595322004-11-08 10:52:06 +000037267 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037268}
37269
37270
37271static int
37272test_xmlUCSIsGujarati(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037273 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037274
William M. Brack21e4ef22005-01-02 09:53:13 +000037275#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037276 int mem_base;
37277 int ret_val;
37278 int code; /* UCS code point */
37279 int n_code;
37280
37281 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37282 mem_base = xmlMemBlocks();
37283 code = gen_int(n_code, 0);
37284
37285 ret_val = xmlUCSIsGujarati(code);
37286 desret_int(ret_val);
37287 call_tests++;
37288 des_int(n_code, code, 0);
37289 xmlResetLastError();
37290 if (mem_base != xmlMemBlocks()) {
37291 printf("Leak of %d blocks found in xmlUCSIsGujarati",
37292 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037293 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037294 printf(" %d", n_code);
37295 printf("\n");
37296 }
37297 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037298 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037299#endif
37300
Daniel Veillard42595322004-11-08 10:52:06 +000037301 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037302}
37303
37304
37305static int
37306test_xmlUCSIsGurmukhi(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037307 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037308
William M. Brack21e4ef22005-01-02 09:53:13 +000037309#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037310 int mem_base;
37311 int ret_val;
37312 int code; /* UCS code point */
37313 int n_code;
37314
37315 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37316 mem_base = xmlMemBlocks();
37317 code = gen_int(n_code, 0);
37318
37319 ret_val = xmlUCSIsGurmukhi(code);
37320 desret_int(ret_val);
37321 call_tests++;
37322 des_int(n_code, code, 0);
37323 xmlResetLastError();
37324 if (mem_base != xmlMemBlocks()) {
37325 printf("Leak of %d blocks found in xmlUCSIsGurmukhi",
37326 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037327 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037328 printf(" %d", n_code);
37329 printf("\n");
37330 }
37331 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037332 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037333#endif
37334
Daniel Veillard42595322004-11-08 10:52:06 +000037335 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037336}
37337
37338
37339static int
37340test_xmlUCSIsHalfwidthandFullwidthForms(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037341 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037342
William M. Brack21e4ef22005-01-02 09:53:13 +000037343#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037344 int mem_base;
37345 int ret_val;
37346 int code; /* UCS code point */
37347 int n_code;
37348
37349 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37350 mem_base = xmlMemBlocks();
37351 code = gen_int(n_code, 0);
37352
37353 ret_val = xmlUCSIsHalfwidthandFullwidthForms(code);
37354 desret_int(ret_val);
37355 call_tests++;
37356 des_int(n_code, code, 0);
37357 xmlResetLastError();
37358 if (mem_base != xmlMemBlocks()) {
37359 printf("Leak of %d blocks found in xmlUCSIsHalfwidthandFullwidthForms",
37360 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037361 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037362 printf(" %d", n_code);
37363 printf("\n");
37364 }
37365 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037366 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037367#endif
37368
Daniel Veillard42595322004-11-08 10:52:06 +000037369 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037370}
37371
37372
37373static int
37374test_xmlUCSIsHangulCompatibilityJamo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037375 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037376
William M. Brack21e4ef22005-01-02 09:53:13 +000037377#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037378 int mem_base;
37379 int ret_val;
37380 int code; /* UCS code point */
37381 int n_code;
37382
37383 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37384 mem_base = xmlMemBlocks();
37385 code = gen_int(n_code, 0);
37386
37387 ret_val = xmlUCSIsHangulCompatibilityJamo(code);
37388 desret_int(ret_val);
37389 call_tests++;
37390 des_int(n_code, code, 0);
37391 xmlResetLastError();
37392 if (mem_base != xmlMemBlocks()) {
37393 printf("Leak of %d blocks found in xmlUCSIsHangulCompatibilityJamo",
37394 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037395 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037396 printf(" %d", n_code);
37397 printf("\n");
37398 }
37399 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037400 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037401#endif
37402
Daniel Veillard42595322004-11-08 10:52:06 +000037403 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037404}
37405
37406
37407static int
37408test_xmlUCSIsHangulJamo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037409 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037410
William M. Brack21e4ef22005-01-02 09:53:13 +000037411#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037412 int mem_base;
37413 int ret_val;
37414 int code; /* UCS code point */
37415 int n_code;
37416
37417 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37418 mem_base = xmlMemBlocks();
37419 code = gen_int(n_code, 0);
37420
37421 ret_val = xmlUCSIsHangulJamo(code);
37422 desret_int(ret_val);
37423 call_tests++;
37424 des_int(n_code, code, 0);
37425 xmlResetLastError();
37426 if (mem_base != xmlMemBlocks()) {
37427 printf("Leak of %d blocks found in xmlUCSIsHangulJamo",
37428 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037429 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037430 printf(" %d", n_code);
37431 printf("\n");
37432 }
37433 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037434 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037435#endif
37436
Daniel Veillard42595322004-11-08 10:52:06 +000037437 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037438}
37439
37440
37441static int
37442test_xmlUCSIsHangulSyllables(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037443 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037444
William M. Brack21e4ef22005-01-02 09:53:13 +000037445#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037446 int mem_base;
37447 int ret_val;
37448 int code; /* UCS code point */
37449 int n_code;
37450
37451 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37452 mem_base = xmlMemBlocks();
37453 code = gen_int(n_code, 0);
37454
37455 ret_val = xmlUCSIsHangulSyllables(code);
37456 desret_int(ret_val);
37457 call_tests++;
37458 des_int(n_code, code, 0);
37459 xmlResetLastError();
37460 if (mem_base != xmlMemBlocks()) {
37461 printf("Leak of %d blocks found in xmlUCSIsHangulSyllables",
37462 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037463 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037464 printf(" %d", n_code);
37465 printf("\n");
37466 }
37467 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037468 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037469#endif
37470
Daniel Veillard42595322004-11-08 10:52:06 +000037471 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037472}
37473
37474
37475static int
37476test_xmlUCSIsHanunoo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037477 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037478
William M. Brack21e4ef22005-01-02 09:53:13 +000037479#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037480 int mem_base;
37481 int ret_val;
37482 int code; /* UCS code point */
37483 int n_code;
37484
37485 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37486 mem_base = xmlMemBlocks();
37487 code = gen_int(n_code, 0);
37488
37489 ret_val = xmlUCSIsHanunoo(code);
37490 desret_int(ret_val);
37491 call_tests++;
37492 des_int(n_code, code, 0);
37493 xmlResetLastError();
37494 if (mem_base != xmlMemBlocks()) {
37495 printf("Leak of %d blocks found in xmlUCSIsHanunoo",
37496 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037497 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037498 printf(" %d", n_code);
37499 printf("\n");
37500 }
37501 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037502 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037503#endif
37504
Daniel Veillard42595322004-11-08 10:52:06 +000037505 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037506}
37507
37508
37509static int
37510test_xmlUCSIsHebrew(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037511 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037512
William M. Brack21e4ef22005-01-02 09:53:13 +000037513#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037514 int mem_base;
37515 int ret_val;
37516 int code; /* UCS code point */
37517 int n_code;
37518
37519 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37520 mem_base = xmlMemBlocks();
37521 code = gen_int(n_code, 0);
37522
37523 ret_val = xmlUCSIsHebrew(code);
37524 desret_int(ret_val);
37525 call_tests++;
37526 des_int(n_code, code, 0);
37527 xmlResetLastError();
37528 if (mem_base != xmlMemBlocks()) {
37529 printf("Leak of %d blocks found in xmlUCSIsHebrew",
37530 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037531 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037532 printf(" %d", n_code);
37533 printf("\n");
37534 }
37535 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037536 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037537#endif
37538
Daniel Veillard42595322004-11-08 10:52:06 +000037539 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037540}
37541
37542
37543static int
37544test_xmlUCSIsHighPrivateUseSurrogates(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037545 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037546
William M. Brack21e4ef22005-01-02 09:53:13 +000037547#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037548 int mem_base;
37549 int ret_val;
37550 int code; /* UCS code point */
37551 int n_code;
37552
37553 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37554 mem_base = xmlMemBlocks();
37555 code = gen_int(n_code, 0);
37556
37557 ret_val = xmlUCSIsHighPrivateUseSurrogates(code);
37558 desret_int(ret_val);
37559 call_tests++;
37560 des_int(n_code, code, 0);
37561 xmlResetLastError();
37562 if (mem_base != xmlMemBlocks()) {
37563 printf("Leak of %d blocks found in xmlUCSIsHighPrivateUseSurrogates",
37564 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037565 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037566 printf(" %d", n_code);
37567 printf("\n");
37568 }
37569 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037570 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037571#endif
37572
Daniel Veillard42595322004-11-08 10:52:06 +000037573 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037574}
37575
37576
37577static int
37578test_xmlUCSIsHighSurrogates(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037579 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037580
William M. Brack21e4ef22005-01-02 09:53:13 +000037581#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037582 int mem_base;
37583 int ret_val;
37584 int code; /* UCS code point */
37585 int n_code;
37586
37587 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37588 mem_base = xmlMemBlocks();
37589 code = gen_int(n_code, 0);
37590
37591 ret_val = xmlUCSIsHighSurrogates(code);
37592 desret_int(ret_val);
37593 call_tests++;
37594 des_int(n_code, code, 0);
37595 xmlResetLastError();
37596 if (mem_base != xmlMemBlocks()) {
37597 printf("Leak of %d blocks found in xmlUCSIsHighSurrogates",
37598 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037599 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037600 printf(" %d", n_code);
37601 printf("\n");
37602 }
37603 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037604 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037605#endif
37606
Daniel Veillard42595322004-11-08 10:52:06 +000037607 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037608}
37609
37610
37611static int
37612test_xmlUCSIsHiragana(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037613 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037614
William M. Brack21e4ef22005-01-02 09:53:13 +000037615#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037616 int mem_base;
37617 int ret_val;
37618 int code; /* UCS code point */
37619 int n_code;
37620
37621 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37622 mem_base = xmlMemBlocks();
37623 code = gen_int(n_code, 0);
37624
37625 ret_val = xmlUCSIsHiragana(code);
37626 desret_int(ret_val);
37627 call_tests++;
37628 des_int(n_code, code, 0);
37629 xmlResetLastError();
37630 if (mem_base != xmlMemBlocks()) {
37631 printf("Leak of %d blocks found in xmlUCSIsHiragana",
37632 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037633 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037634 printf(" %d", n_code);
37635 printf("\n");
37636 }
37637 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037638 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037639#endif
37640
Daniel Veillard42595322004-11-08 10:52:06 +000037641 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037642}
37643
37644
37645static int
37646test_xmlUCSIsIPAExtensions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037647 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037648
William M. Brack21e4ef22005-01-02 09:53:13 +000037649#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037650 int mem_base;
37651 int ret_val;
37652 int code; /* UCS code point */
37653 int n_code;
37654
37655 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37656 mem_base = xmlMemBlocks();
37657 code = gen_int(n_code, 0);
37658
37659 ret_val = xmlUCSIsIPAExtensions(code);
37660 desret_int(ret_val);
37661 call_tests++;
37662 des_int(n_code, code, 0);
37663 xmlResetLastError();
37664 if (mem_base != xmlMemBlocks()) {
37665 printf("Leak of %d blocks found in xmlUCSIsIPAExtensions",
37666 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037667 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037668 printf(" %d", n_code);
37669 printf("\n");
37670 }
37671 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037672 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037673#endif
37674
Daniel Veillard42595322004-11-08 10:52:06 +000037675 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037676}
37677
37678
37679static int
37680test_xmlUCSIsIdeographicDescriptionCharacters(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037681 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037682
William M. Brack21e4ef22005-01-02 09:53:13 +000037683#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037684 int mem_base;
37685 int ret_val;
37686 int code; /* UCS code point */
37687 int n_code;
37688
37689 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37690 mem_base = xmlMemBlocks();
37691 code = gen_int(n_code, 0);
37692
37693 ret_val = xmlUCSIsIdeographicDescriptionCharacters(code);
37694 desret_int(ret_val);
37695 call_tests++;
37696 des_int(n_code, code, 0);
37697 xmlResetLastError();
37698 if (mem_base != xmlMemBlocks()) {
37699 printf("Leak of %d blocks found in xmlUCSIsIdeographicDescriptionCharacters",
37700 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037701 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037702 printf(" %d", n_code);
37703 printf("\n");
37704 }
37705 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037706 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037707#endif
37708
Daniel Veillard42595322004-11-08 10:52:06 +000037709 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037710}
37711
37712
37713static int
37714test_xmlUCSIsKanbun(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037715 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037716
William M. Brack21e4ef22005-01-02 09:53:13 +000037717#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037718 int mem_base;
37719 int ret_val;
37720 int code; /* UCS code point */
37721 int n_code;
37722
37723 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37724 mem_base = xmlMemBlocks();
37725 code = gen_int(n_code, 0);
37726
37727 ret_val = xmlUCSIsKanbun(code);
37728 desret_int(ret_val);
37729 call_tests++;
37730 des_int(n_code, code, 0);
37731 xmlResetLastError();
37732 if (mem_base != xmlMemBlocks()) {
37733 printf("Leak of %d blocks found in xmlUCSIsKanbun",
37734 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037735 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037736 printf(" %d", n_code);
37737 printf("\n");
37738 }
37739 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037740 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037741#endif
37742
Daniel Veillard42595322004-11-08 10:52:06 +000037743 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037744}
37745
37746
37747static int
37748test_xmlUCSIsKangxiRadicals(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037749 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037750
William M. Brack21e4ef22005-01-02 09:53:13 +000037751#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037752 int mem_base;
37753 int ret_val;
37754 int code; /* UCS code point */
37755 int n_code;
37756
37757 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37758 mem_base = xmlMemBlocks();
37759 code = gen_int(n_code, 0);
37760
37761 ret_val = xmlUCSIsKangxiRadicals(code);
37762 desret_int(ret_val);
37763 call_tests++;
37764 des_int(n_code, code, 0);
37765 xmlResetLastError();
37766 if (mem_base != xmlMemBlocks()) {
37767 printf("Leak of %d blocks found in xmlUCSIsKangxiRadicals",
37768 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037769 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037770 printf(" %d", n_code);
37771 printf("\n");
37772 }
37773 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037774 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037775#endif
37776
Daniel Veillard42595322004-11-08 10:52:06 +000037777 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037778}
37779
37780
37781static int
37782test_xmlUCSIsKannada(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037783 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037784
William M. Brack21e4ef22005-01-02 09:53:13 +000037785#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037786 int mem_base;
37787 int ret_val;
37788 int code; /* UCS code point */
37789 int n_code;
37790
37791 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37792 mem_base = xmlMemBlocks();
37793 code = gen_int(n_code, 0);
37794
37795 ret_val = xmlUCSIsKannada(code);
37796 desret_int(ret_val);
37797 call_tests++;
37798 des_int(n_code, code, 0);
37799 xmlResetLastError();
37800 if (mem_base != xmlMemBlocks()) {
37801 printf("Leak of %d blocks found in xmlUCSIsKannada",
37802 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037803 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037804 printf(" %d", n_code);
37805 printf("\n");
37806 }
37807 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037808 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037809#endif
37810
Daniel Veillard42595322004-11-08 10:52:06 +000037811 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037812}
37813
37814
37815static int
37816test_xmlUCSIsKatakana(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037817 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037818
William M. Brack21e4ef22005-01-02 09:53:13 +000037819#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037820 int mem_base;
37821 int ret_val;
37822 int code; /* UCS code point */
37823 int n_code;
37824
37825 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37826 mem_base = xmlMemBlocks();
37827 code = gen_int(n_code, 0);
37828
37829 ret_val = xmlUCSIsKatakana(code);
37830 desret_int(ret_val);
37831 call_tests++;
37832 des_int(n_code, code, 0);
37833 xmlResetLastError();
37834 if (mem_base != xmlMemBlocks()) {
37835 printf("Leak of %d blocks found in xmlUCSIsKatakana",
37836 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037837 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037838 printf(" %d", n_code);
37839 printf("\n");
37840 }
37841 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037842 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037843#endif
37844
Daniel Veillard42595322004-11-08 10:52:06 +000037845 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037846}
37847
37848
37849static int
37850test_xmlUCSIsKatakanaPhoneticExtensions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037851 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037852
William M. Brack21e4ef22005-01-02 09:53:13 +000037853#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037854 int mem_base;
37855 int ret_val;
37856 int code; /* UCS code point */
37857 int n_code;
37858
37859 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37860 mem_base = xmlMemBlocks();
37861 code = gen_int(n_code, 0);
37862
37863 ret_val = xmlUCSIsKatakanaPhoneticExtensions(code);
37864 desret_int(ret_val);
37865 call_tests++;
37866 des_int(n_code, code, 0);
37867 xmlResetLastError();
37868 if (mem_base != xmlMemBlocks()) {
37869 printf("Leak of %d blocks found in xmlUCSIsKatakanaPhoneticExtensions",
37870 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037871 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037872 printf(" %d", n_code);
37873 printf("\n");
37874 }
37875 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037876 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037877#endif
37878
Daniel Veillard42595322004-11-08 10:52:06 +000037879 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037880}
37881
37882
37883static int
37884test_xmlUCSIsKhmer(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037885 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037886
William M. Brack21e4ef22005-01-02 09:53:13 +000037887#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037888 int mem_base;
37889 int ret_val;
37890 int code; /* UCS code point */
37891 int n_code;
37892
37893 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37894 mem_base = xmlMemBlocks();
37895 code = gen_int(n_code, 0);
37896
37897 ret_val = xmlUCSIsKhmer(code);
37898 desret_int(ret_val);
37899 call_tests++;
37900 des_int(n_code, code, 0);
37901 xmlResetLastError();
37902 if (mem_base != xmlMemBlocks()) {
37903 printf("Leak of %d blocks found in xmlUCSIsKhmer",
37904 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037905 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037906 printf(" %d", n_code);
37907 printf("\n");
37908 }
37909 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037910 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037911#endif
37912
Daniel Veillard42595322004-11-08 10:52:06 +000037913 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037914}
37915
37916
37917static int
37918test_xmlUCSIsKhmerSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037919 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037920
William M. Brack21e4ef22005-01-02 09:53:13 +000037921#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037922 int mem_base;
37923 int ret_val;
37924 int code; /* UCS code point */
37925 int n_code;
37926
37927 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37928 mem_base = xmlMemBlocks();
37929 code = gen_int(n_code, 0);
37930
37931 ret_val = xmlUCSIsKhmerSymbols(code);
37932 desret_int(ret_val);
37933 call_tests++;
37934 des_int(n_code, code, 0);
37935 xmlResetLastError();
37936 if (mem_base != xmlMemBlocks()) {
37937 printf("Leak of %d blocks found in xmlUCSIsKhmerSymbols",
37938 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037939 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037940 printf(" %d", n_code);
37941 printf("\n");
37942 }
37943 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037944 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037945#endif
37946
Daniel Veillard42595322004-11-08 10:52:06 +000037947 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037948}
37949
37950
37951static int
37952test_xmlUCSIsLao(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037953 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037954
William M. Brack21e4ef22005-01-02 09:53:13 +000037955#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037956 int mem_base;
37957 int ret_val;
37958 int code; /* UCS code point */
37959 int n_code;
37960
37961 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37962 mem_base = xmlMemBlocks();
37963 code = gen_int(n_code, 0);
37964
37965 ret_val = xmlUCSIsLao(code);
37966 desret_int(ret_val);
37967 call_tests++;
37968 des_int(n_code, code, 0);
37969 xmlResetLastError();
37970 if (mem_base != xmlMemBlocks()) {
37971 printf("Leak of %d blocks found in xmlUCSIsLao",
37972 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037973 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037974 printf(" %d", n_code);
37975 printf("\n");
37976 }
37977 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037978 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037979#endif
37980
Daniel Veillard42595322004-11-08 10:52:06 +000037981 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037982}
37983
37984
37985static int
37986test_xmlUCSIsLatin1Supplement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037987 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037988
William M. Brack21e4ef22005-01-02 09:53:13 +000037989#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037990 int mem_base;
37991 int ret_val;
37992 int code; /* UCS code point */
37993 int n_code;
37994
37995 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37996 mem_base = xmlMemBlocks();
37997 code = gen_int(n_code, 0);
37998
37999 ret_val = xmlUCSIsLatin1Supplement(code);
38000 desret_int(ret_val);
38001 call_tests++;
38002 des_int(n_code, code, 0);
38003 xmlResetLastError();
38004 if (mem_base != xmlMemBlocks()) {
38005 printf("Leak of %d blocks found in xmlUCSIsLatin1Supplement",
38006 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038007 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038008 printf(" %d", n_code);
38009 printf("\n");
38010 }
38011 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038012 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038013#endif
38014
Daniel Veillard42595322004-11-08 10:52:06 +000038015 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038016}
38017
38018
38019static int
38020test_xmlUCSIsLatinExtendedA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038021 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038022
William M. Brack21e4ef22005-01-02 09:53:13 +000038023#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038024 int mem_base;
38025 int ret_val;
38026 int code; /* UCS code point */
38027 int n_code;
38028
38029 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38030 mem_base = xmlMemBlocks();
38031 code = gen_int(n_code, 0);
38032
38033 ret_val = xmlUCSIsLatinExtendedA(code);
38034 desret_int(ret_val);
38035 call_tests++;
38036 des_int(n_code, code, 0);
38037 xmlResetLastError();
38038 if (mem_base != xmlMemBlocks()) {
38039 printf("Leak of %d blocks found in xmlUCSIsLatinExtendedA",
38040 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038041 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038042 printf(" %d", n_code);
38043 printf("\n");
38044 }
38045 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038046 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038047#endif
38048
Daniel Veillard42595322004-11-08 10:52:06 +000038049 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038050}
38051
38052
38053static int
38054test_xmlUCSIsLatinExtendedAdditional(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038055 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038056
William M. Brack21e4ef22005-01-02 09:53:13 +000038057#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038058 int mem_base;
38059 int ret_val;
38060 int code; /* UCS code point */
38061 int n_code;
38062
38063 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38064 mem_base = xmlMemBlocks();
38065 code = gen_int(n_code, 0);
38066
38067 ret_val = xmlUCSIsLatinExtendedAdditional(code);
38068 desret_int(ret_val);
38069 call_tests++;
38070 des_int(n_code, code, 0);
38071 xmlResetLastError();
38072 if (mem_base != xmlMemBlocks()) {
38073 printf("Leak of %d blocks found in xmlUCSIsLatinExtendedAdditional",
38074 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038075 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038076 printf(" %d", n_code);
38077 printf("\n");
38078 }
38079 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038080 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038081#endif
38082
Daniel Veillard42595322004-11-08 10:52:06 +000038083 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038084}
38085
38086
38087static int
38088test_xmlUCSIsLatinExtendedB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038089 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038090
William M. Brack21e4ef22005-01-02 09:53:13 +000038091#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038092 int mem_base;
38093 int ret_val;
38094 int code; /* UCS code point */
38095 int n_code;
38096
38097 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38098 mem_base = xmlMemBlocks();
38099 code = gen_int(n_code, 0);
38100
38101 ret_val = xmlUCSIsLatinExtendedB(code);
38102 desret_int(ret_val);
38103 call_tests++;
38104 des_int(n_code, code, 0);
38105 xmlResetLastError();
38106 if (mem_base != xmlMemBlocks()) {
38107 printf("Leak of %d blocks found in xmlUCSIsLatinExtendedB",
38108 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038109 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038110 printf(" %d", n_code);
38111 printf("\n");
38112 }
38113 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038114 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038115#endif
38116
Daniel Veillard42595322004-11-08 10:52:06 +000038117 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038118}
38119
38120
38121static int
38122test_xmlUCSIsLetterlikeSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038123 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038124
William M. Brack21e4ef22005-01-02 09:53:13 +000038125#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038126 int mem_base;
38127 int ret_val;
38128 int code; /* UCS code point */
38129 int n_code;
38130
38131 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38132 mem_base = xmlMemBlocks();
38133 code = gen_int(n_code, 0);
38134
38135 ret_val = xmlUCSIsLetterlikeSymbols(code);
38136 desret_int(ret_val);
38137 call_tests++;
38138 des_int(n_code, code, 0);
38139 xmlResetLastError();
38140 if (mem_base != xmlMemBlocks()) {
38141 printf("Leak of %d blocks found in xmlUCSIsLetterlikeSymbols",
38142 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038143 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038144 printf(" %d", n_code);
38145 printf("\n");
38146 }
38147 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038148 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038149#endif
38150
Daniel Veillard42595322004-11-08 10:52:06 +000038151 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038152}
38153
38154
38155static int
38156test_xmlUCSIsLimbu(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038157 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038158
William M. Brack21e4ef22005-01-02 09:53:13 +000038159#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038160 int mem_base;
38161 int ret_val;
38162 int code; /* UCS code point */
38163 int n_code;
38164
38165 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38166 mem_base = xmlMemBlocks();
38167 code = gen_int(n_code, 0);
38168
38169 ret_val = xmlUCSIsLimbu(code);
38170 desret_int(ret_val);
38171 call_tests++;
38172 des_int(n_code, code, 0);
38173 xmlResetLastError();
38174 if (mem_base != xmlMemBlocks()) {
38175 printf("Leak of %d blocks found in xmlUCSIsLimbu",
38176 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038177 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038178 printf(" %d", n_code);
38179 printf("\n");
38180 }
38181 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038182 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038183#endif
38184
Daniel Veillard42595322004-11-08 10:52:06 +000038185 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038186}
38187
38188
38189static int
38190test_xmlUCSIsLinearBIdeograms(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038191 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038192
William M. Brack21e4ef22005-01-02 09:53:13 +000038193#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038194 int mem_base;
38195 int ret_val;
38196 int code; /* UCS code point */
38197 int n_code;
38198
38199 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38200 mem_base = xmlMemBlocks();
38201 code = gen_int(n_code, 0);
38202
38203 ret_val = xmlUCSIsLinearBIdeograms(code);
38204 desret_int(ret_val);
38205 call_tests++;
38206 des_int(n_code, code, 0);
38207 xmlResetLastError();
38208 if (mem_base != xmlMemBlocks()) {
38209 printf("Leak of %d blocks found in xmlUCSIsLinearBIdeograms",
38210 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038211 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038212 printf(" %d", n_code);
38213 printf("\n");
38214 }
38215 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038216 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038217#endif
38218
Daniel Veillard42595322004-11-08 10:52:06 +000038219 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038220}
38221
38222
38223static int
38224test_xmlUCSIsLinearBSyllabary(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038225 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038226
William M. Brack21e4ef22005-01-02 09:53:13 +000038227#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038228 int mem_base;
38229 int ret_val;
38230 int code; /* UCS code point */
38231 int n_code;
38232
38233 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38234 mem_base = xmlMemBlocks();
38235 code = gen_int(n_code, 0);
38236
38237 ret_val = xmlUCSIsLinearBSyllabary(code);
38238 desret_int(ret_val);
38239 call_tests++;
38240 des_int(n_code, code, 0);
38241 xmlResetLastError();
38242 if (mem_base != xmlMemBlocks()) {
38243 printf("Leak of %d blocks found in xmlUCSIsLinearBSyllabary",
38244 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038245 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038246 printf(" %d", n_code);
38247 printf("\n");
38248 }
38249 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038250 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038251#endif
38252
Daniel Veillard42595322004-11-08 10:52:06 +000038253 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038254}
38255
38256
38257static int
38258test_xmlUCSIsLowSurrogates(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038259 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038260
William M. Brack21e4ef22005-01-02 09:53:13 +000038261#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038262 int mem_base;
38263 int ret_val;
38264 int code; /* UCS code point */
38265 int n_code;
38266
38267 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38268 mem_base = xmlMemBlocks();
38269 code = gen_int(n_code, 0);
38270
38271 ret_val = xmlUCSIsLowSurrogates(code);
38272 desret_int(ret_val);
38273 call_tests++;
38274 des_int(n_code, code, 0);
38275 xmlResetLastError();
38276 if (mem_base != xmlMemBlocks()) {
38277 printf("Leak of %d blocks found in xmlUCSIsLowSurrogates",
38278 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038279 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038280 printf(" %d", n_code);
38281 printf("\n");
38282 }
38283 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038284 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038285#endif
38286
Daniel Veillard42595322004-11-08 10:52:06 +000038287 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038288}
38289
38290
38291static int
38292test_xmlUCSIsMalayalam(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038293 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038294
William M. Brack21e4ef22005-01-02 09:53:13 +000038295#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038296 int mem_base;
38297 int ret_val;
38298 int code; /* UCS code point */
38299 int n_code;
38300
38301 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38302 mem_base = xmlMemBlocks();
38303 code = gen_int(n_code, 0);
38304
38305 ret_val = xmlUCSIsMalayalam(code);
38306 desret_int(ret_val);
38307 call_tests++;
38308 des_int(n_code, code, 0);
38309 xmlResetLastError();
38310 if (mem_base != xmlMemBlocks()) {
38311 printf("Leak of %d blocks found in xmlUCSIsMalayalam",
38312 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038313 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038314 printf(" %d", n_code);
38315 printf("\n");
38316 }
38317 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038318 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038319#endif
38320
Daniel Veillard42595322004-11-08 10:52:06 +000038321 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038322}
38323
38324
38325static int
38326test_xmlUCSIsMathematicalAlphanumericSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038327 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038328
William M. Brack21e4ef22005-01-02 09:53:13 +000038329#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038330 int mem_base;
38331 int ret_val;
38332 int code; /* UCS code point */
38333 int n_code;
38334
38335 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38336 mem_base = xmlMemBlocks();
38337 code = gen_int(n_code, 0);
38338
38339 ret_val = xmlUCSIsMathematicalAlphanumericSymbols(code);
38340 desret_int(ret_val);
38341 call_tests++;
38342 des_int(n_code, code, 0);
38343 xmlResetLastError();
38344 if (mem_base != xmlMemBlocks()) {
38345 printf("Leak of %d blocks found in xmlUCSIsMathematicalAlphanumericSymbols",
38346 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038347 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038348 printf(" %d", n_code);
38349 printf("\n");
38350 }
38351 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038352 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038353#endif
38354
Daniel Veillard42595322004-11-08 10:52:06 +000038355 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038356}
38357
38358
38359static int
38360test_xmlUCSIsMathematicalOperators(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038361 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038362
William M. Brack21e4ef22005-01-02 09:53:13 +000038363#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038364 int mem_base;
38365 int ret_val;
38366 int code; /* UCS code point */
38367 int n_code;
38368
38369 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38370 mem_base = xmlMemBlocks();
38371 code = gen_int(n_code, 0);
38372
38373 ret_val = xmlUCSIsMathematicalOperators(code);
38374 desret_int(ret_val);
38375 call_tests++;
38376 des_int(n_code, code, 0);
38377 xmlResetLastError();
38378 if (mem_base != xmlMemBlocks()) {
38379 printf("Leak of %d blocks found in xmlUCSIsMathematicalOperators",
38380 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038381 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038382 printf(" %d", n_code);
38383 printf("\n");
38384 }
38385 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038386 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038387#endif
38388
Daniel Veillard42595322004-11-08 10:52:06 +000038389 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038390}
38391
38392
38393static int
38394test_xmlUCSIsMiscellaneousMathematicalSymbolsA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038395 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038396
William M. Brack21e4ef22005-01-02 09:53:13 +000038397#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038398 int mem_base;
38399 int ret_val;
38400 int code; /* UCS code point */
38401 int n_code;
38402
38403 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38404 mem_base = xmlMemBlocks();
38405 code = gen_int(n_code, 0);
38406
38407 ret_val = xmlUCSIsMiscellaneousMathematicalSymbolsA(code);
38408 desret_int(ret_val);
38409 call_tests++;
38410 des_int(n_code, code, 0);
38411 xmlResetLastError();
38412 if (mem_base != xmlMemBlocks()) {
38413 printf("Leak of %d blocks found in xmlUCSIsMiscellaneousMathematicalSymbolsA",
38414 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038415 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038416 printf(" %d", n_code);
38417 printf("\n");
38418 }
38419 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038420 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038421#endif
38422
Daniel Veillard42595322004-11-08 10:52:06 +000038423 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038424}
38425
38426
38427static int
38428test_xmlUCSIsMiscellaneousMathematicalSymbolsB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038429 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038430
William M. Brack21e4ef22005-01-02 09:53:13 +000038431#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038432 int mem_base;
38433 int ret_val;
38434 int code; /* UCS code point */
38435 int n_code;
38436
38437 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38438 mem_base = xmlMemBlocks();
38439 code = gen_int(n_code, 0);
38440
38441 ret_val = xmlUCSIsMiscellaneousMathematicalSymbolsB(code);
38442 desret_int(ret_val);
38443 call_tests++;
38444 des_int(n_code, code, 0);
38445 xmlResetLastError();
38446 if (mem_base != xmlMemBlocks()) {
38447 printf("Leak of %d blocks found in xmlUCSIsMiscellaneousMathematicalSymbolsB",
38448 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038449 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038450 printf(" %d", n_code);
38451 printf("\n");
38452 }
38453 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038454 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038455#endif
38456
Daniel Veillard42595322004-11-08 10:52:06 +000038457 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038458}
38459
38460
38461static int
38462test_xmlUCSIsMiscellaneousSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038463 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038464
William M. Brack21e4ef22005-01-02 09:53:13 +000038465#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038466 int mem_base;
38467 int ret_val;
38468 int code; /* UCS code point */
38469 int n_code;
38470
38471 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38472 mem_base = xmlMemBlocks();
38473 code = gen_int(n_code, 0);
38474
38475 ret_val = xmlUCSIsMiscellaneousSymbols(code);
38476 desret_int(ret_val);
38477 call_tests++;
38478 des_int(n_code, code, 0);
38479 xmlResetLastError();
38480 if (mem_base != xmlMemBlocks()) {
38481 printf("Leak of %d blocks found in xmlUCSIsMiscellaneousSymbols",
38482 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038483 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038484 printf(" %d", n_code);
38485 printf("\n");
38486 }
38487 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038488 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038489#endif
38490
Daniel Veillard42595322004-11-08 10:52:06 +000038491 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038492}
38493
38494
38495static int
38496test_xmlUCSIsMiscellaneousSymbolsandArrows(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038497 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038498
William M. Brack21e4ef22005-01-02 09:53:13 +000038499#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038500 int mem_base;
38501 int ret_val;
38502 int code; /* UCS code point */
38503 int n_code;
38504
38505 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38506 mem_base = xmlMemBlocks();
38507 code = gen_int(n_code, 0);
38508
38509 ret_val = xmlUCSIsMiscellaneousSymbolsandArrows(code);
38510 desret_int(ret_val);
38511 call_tests++;
38512 des_int(n_code, code, 0);
38513 xmlResetLastError();
38514 if (mem_base != xmlMemBlocks()) {
38515 printf("Leak of %d blocks found in xmlUCSIsMiscellaneousSymbolsandArrows",
38516 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038517 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038518 printf(" %d", n_code);
38519 printf("\n");
38520 }
38521 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038522 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038523#endif
38524
Daniel Veillard42595322004-11-08 10:52:06 +000038525 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038526}
38527
38528
38529static int
38530test_xmlUCSIsMiscellaneousTechnical(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038531 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038532
William M. Brack21e4ef22005-01-02 09:53:13 +000038533#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038534 int mem_base;
38535 int ret_val;
38536 int code; /* UCS code point */
38537 int n_code;
38538
38539 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38540 mem_base = xmlMemBlocks();
38541 code = gen_int(n_code, 0);
38542
38543 ret_val = xmlUCSIsMiscellaneousTechnical(code);
38544 desret_int(ret_val);
38545 call_tests++;
38546 des_int(n_code, code, 0);
38547 xmlResetLastError();
38548 if (mem_base != xmlMemBlocks()) {
38549 printf("Leak of %d blocks found in xmlUCSIsMiscellaneousTechnical",
38550 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038551 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038552 printf(" %d", n_code);
38553 printf("\n");
38554 }
38555 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038556 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038557#endif
38558
Daniel Veillard42595322004-11-08 10:52:06 +000038559 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038560}
38561
38562
38563static int
38564test_xmlUCSIsMongolian(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038565 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038566
William M. Brack21e4ef22005-01-02 09:53:13 +000038567#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038568 int mem_base;
38569 int ret_val;
38570 int code; /* UCS code point */
38571 int n_code;
38572
38573 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38574 mem_base = xmlMemBlocks();
38575 code = gen_int(n_code, 0);
38576
38577 ret_val = xmlUCSIsMongolian(code);
38578 desret_int(ret_val);
38579 call_tests++;
38580 des_int(n_code, code, 0);
38581 xmlResetLastError();
38582 if (mem_base != xmlMemBlocks()) {
38583 printf("Leak of %d blocks found in xmlUCSIsMongolian",
38584 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038585 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038586 printf(" %d", n_code);
38587 printf("\n");
38588 }
38589 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038590 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038591#endif
38592
Daniel Veillard42595322004-11-08 10:52:06 +000038593 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038594}
38595
38596
38597static int
38598test_xmlUCSIsMusicalSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038599 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038600
William M. Brack21e4ef22005-01-02 09:53:13 +000038601#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038602 int mem_base;
38603 int ret_val;
38604 int code; /* UCS code point */
38605 int n_code;
38606
38607 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38608 mem_base = xmlMemBlocks();
38609 code = gen_int(n_code, 0);
38610
38611 ret_val = xmlUCSIsMusicalSymbols(code);
38612 desret_int(ret_val);
38613 call_tests++;
38614 des_int(n_code, code, 0);
38615 xmlResetLastError();
38616 if (mem_base != xmlMemBlocks()) {
38617 printf("Leak of %d blocks found in xmlUCSIsMusicalSymbols",
38618 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038619 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038620 printf(" %d", n_code);
38621 printf("\n");
38622 }
38623 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038624 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038625#endif
38626
Daniel Veillard42595322004-11-08 10:52:06 +000038627 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038628}
38629
38630
38631static int
38632test_xmlUCSIsMyanmar(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038633 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038634
William M. Brack21e4ef22005-01-02 09:53:13 +000038635#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038636 int mem_base;
38637 int ret_val;
38638 int code; /* UCS code point */
38639 int n_code;
38640
38641 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38642 mem_base = xmlMemBlocks();
38643 code = gen_int(n_code, 0);
38644
38645 ret_val = xmlUCSIsMyanmar(code);
38646 desret_int(ret_val);
38647 call_tests++;
38648 des_int(n_code, code, 0);
38649 xmlResetLastError();
38650 if (mem_base != xmlMemBlocks()) {
38651 printf("Leak of %d blocks found in xmlUCSIsMyanmar",
38652 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038653 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038654 printf(" %d", n_code);
38655 printf("\n");
38656 }
38657 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038658 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038659#endif
38660
Daniel Veillard42595322004-11-08 10:52:06 +000038661 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038662}
38663
38664
38665static int
38666test_xmlUCSIsNumberForms(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038667 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038668
William M. Brack21e4ef22005-01-02 09:53:13 +000038669#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038670 int mem_base;
38671 int ret_val;
38672 int code; /* UCS code point */
38673 int n_code;
38674
38675 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38676 mem_base = xmlMemBlocks();
38677 code = gen_int(n_code, 0);
38678
38679 ret_val = xmlUCSIsNumberForms(code);
38680 desret_int(ret_val);
38681 call_tests++;
38682 des_int(n_code, code, 0);
38683 xmlResetLastError();
38684 if (mem_base != xmlMemBlocks()) {
38685 printf("Leak of %d blocks found in xmlUCSIsNumberForms",
38686 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038687 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038688 printf(" %d", n_code);
38689 printf("\n");
38690 }
38691 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038692 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038693#endif
38694
Daniel Veillard42595322004-11-08 10:52:06 +000038695 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038696}
38697
38698
38699static int
38700test_xmlUCSIsOgham(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038701 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038702
William M. Brack21e4ef22005-01-02 09:53:13 +000038703#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038704 int mem_base;
38705 int ret_val;
38706 int code; /* UCS code point */
38707 int n_code;
38708
38709 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38710 mem_base = xmlMemBlocks();
38711 code = gen_int(n_code, 0);
38712
38713 ret_val = xmlUCSIsOgham(code);
38714 desret_int(ret_val);
38715 call_tests++;
38716 des_int(n_code, code, 0);
38717 xmlResetLastError();
38718 if (mem_base != xmlMemBlocks()) {
38719 printf("Leak of %d blocks found in xmlUCSIsOgham",
38720 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038721 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038722 printf(" %d", n_code);
38723 printf("\n");
38724 }
38725 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038726 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038727#endif
38728
Daniel Veillard42595322004-11-08 10:52:06 +000038729 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038730}
38731
38732
38733static int
38734test_xmlUCSIsOldItalic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038735 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038736
William M. Brack21e4ef22005-01-02 09:53:13 +000038737#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038738 int mem_base;
38739 int ret_val;
38740 int code; /* UCS code point */
38741 int n_code;
38742
38743 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38744 mem_base = xmlMemBlocks();
38745 code = gen_int(n_code, 0);
38746
38747 ret_val = xmlUCSIsOldItalic(code);
38748 desret_int(ret_val);
38749 call_tests++;
38750 des_int(n_code, code, 0);
38751 xmlResetLastError();
38752 if (mem_base != xmlMemBlocks()) {
38753 printf("Leak of %d blocks found in xmlUCSIsOldItalic",
38754 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038755 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038756 printf(" %d", n_code);
38757 printf("\n");
38758 }
38759 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038760 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038761#endif
38762
Daniel Veillard42595322004-11-08 10:52:06 +000038763 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038764}
38765
38766
38767static int
38768test_xmlUCSIsOpticalCharacterRecognition(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038769 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038770
William M. Brack21e4ef22005-01-02 09:53:13 +000038771#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038772 int mem_base;
38773 int ret_val;
38774 int code; /* UCS code point */
38775 int n_code;
38776
38777 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38778 mem_base = xmlMemBlocks();
38779 code = gen_int(n_code, 0);
38780
38781 ret_val = xmlUCSIsOpticalCharacterRecognition(code);
38782 desret_int(ret_val);
38783 call_tests++;
38784 des_int(n_code, code, 0);
38785 xmlResetLastError();
38786 if (mem_base != xmlMemBlocks()) {
38787 printf("Leak of %d blocks found in xmlUCSIsOpticalCharacterRecognition",
38788 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038789 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038790 printf(" %d", n_code);
38791 printf("\n");
38792 }
38793 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038794 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038795#endif
38796
Daniel Veillard42595322004-11-08 10:52:06 +000038797 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038798}
38799
38800
38801static int
38802test_xmlUCSIsOriya(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038803 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038804
William M. Brack21e4ef22005-01-02 09:53:13 +000038805#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038806 int mem_base;
38807 int ret_val;
38808 int code; /* UCS code point */
38809 int n_code;
38810
38811 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38812 mem_base = xmlMemBlocks();
38813 code = gen_int(n_code, 0);
38814
38815 ret_val = xmlUCSIsOriya(code);
38816 desret_int(ret_val);
38817 call_tests++;
38818 des_int(n_code, code, 0);
38819 xmlResetLastError();
38820 if (mem_base != xmlMemBlocks()) {
38821 printf("Leak of %d blocks found in xmlUCSIsOriya",
38822 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038823 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038824 printf(" %d", n_code);
38825 printf("\n");
38826 }
38827 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038828 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038829#endif
38830
Daniel Veillard42595322004-11-08 10:52:06 +000038831 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038832}
38833
38834
38835static int
38836test_xmlUCSIsOsmanya(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038837 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038838
William M. Brack21e4ef22005-01-02 09:53:13 +000038839#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038840 int mem_base;
38841 int ret_val;
38842 int code; /* UCS code point */
38843 int n_code;
38844
38845 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38846 mem_base = xmlMemBlocks();
38847 code = gen_int(n_code, 0);
38848
38849 ret_val = xmlUCSIsOsmanya(code);
38850 desret_int(ret_val);
38851 call_tests++;
38852 des_int(n_code, code, 0);
38853 xmlResetLastError();
38854 if (mem_base != xmlMemBlocks()) {
38855 printf("Leak of %d blocks found in xmlUCSIsOsmanya",
38856 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038857 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038858 printf(" %d", n_code);
38859 printf("\n");
38860 }
38861 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038862 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038863#endif
38864
Daniel Veillard42595322004-11-08 10:52:06 +000038865 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038866}
38867
38868
38869static int
38870test_xmlUCSIsPhoneticExtensions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038871 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038872
William M. Brack21e4ef22005-01-02 09:53:13 +000038873#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038874 int mem_base;
38875 int ret_val;
38876 int code; /* UCS code point */
38877 int n_code;
38878
38879 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38880 mem_base = xmlMemBlocks();
38881 code = gen_int(n_code, 0);
38882
38883 ret_val = xmlUCSIsPhoneticExtensions(code);
38884 desret_int(ret_val);
38885 call_tests++;
38886 des_int(n_code, code, 0);
38887 xmlResetLastError();
38888 if (mem_base != xmlMemBlocks()) {
38889 printf("Leak of %d blocks found in xmlUCSIsPhoneticExtensions",
38890 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038891 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038892 printf(" %d", n_code);
38893 printf("\n");
38894 }
38895 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038896 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038897#endif
38898
Daniel Veillard42595322004-11-08 10:52:06 +000038899 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038900}
38901
38902
38903static int
38904test_xmlUCSIsPrivateUse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038905 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038906
William M. Brack21e4ef22005-01-02 09:53:13 +000038907#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038908 int mem_base;
38909 int ret_val;
38910 int code; /* UCS code point */
38911 int n_code;
38912
38913 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38914 mem_base = xmlMemBlocks();
38915 code = gen_int(n_code, 0);
38916
38917 ret_val = xmlUCSIsPrivateUse(code);
38918 desret_int(ret_val);
38919 call_tests++;
38920 des_int(n_code, code, 0);
38921 xmlResetLastError();
38922 if (mem_base != xmlMemBlocks()) {
38923 printf("Leak of %d blocks found in xmlUCSIsPrivateUse",
38924 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038925 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038926 printf(" %d", n_code);
38927 printf("\n");
38928 }
38929 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038930 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038931#endif
38932
Daniel Veillard42595322004-11-08 10:52:06 +000038933 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038934}
38935
38936
38937static int
38938test_xmlUCSIsPrivateUseArea(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038939 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038940
William M. Brack21e4ef22005-01-02 09:53:13 +000038941#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038942 int mem_base;
38943 int ret_val;
38944 int code; /* UCS code point */
38945 int n_code;
38946
38947 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38948 mem_base = xmlMemBlocks();
38949 code = gen_int(n_code, 0);
38950
38951 ret_val = xmlUCSIsPrivateUseArea(code);
38952 desret_int(ret_val);
38953 call_tests++;
38954 des_int(n_code, code, 0);
38955 xmlResetLastError();
38956 if (mem_base != xmlMemBlocks()) {
38957 printf("Leak of %d blocks found in xmlUCSIsPrivateUseArea",
38958 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038959 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038960 printf(" %d", n_code);
38961 printf("\n");
38962 }
38963 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038964 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038965#endif
38966
Daniel Veillard42595322004-11-08 10:52:06 +000038967 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038968}
38969
38970
38971static int
38972test_xmlUCSIsRunic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038973 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038974
William M. Brack21e4ef22005-01-02 09:53:13 +000038975#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038976 int mem_base;
38977 int ret_val;
38978 int code; /* UCS code point */
38979 int n_code;
38980
38981 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38982 mem_base = xmlMemBlocks();
38983 code = gen_int(n_code, 0);
38984
38985 ret_val = xmlUCSIsRunic(code);
38986 desret_int(ret_val);
38987 call_tests++;
38988 des_int(n_code, code, 0);
38989 xmlResetLastError();
38990 if (mem_base != xmlMemBlocks()) {
38991 printf("Leak of %d blocks found in xmlUCSIsRunic",
38992 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038993 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038994 printf(" %d", n_code);
38995 printf("\n");
38996 }
38997 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038998 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038999#endif
39000
Daniel Veillard42595322004-11-08 10:52:06 +000039001 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039002}
39003
39004
39005static int
39006test_xmlUCSIsShavian(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039007 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039008
William M. Brack21e4ef22005-01-02 09:53:13 +000039009#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039010 int mem_base;
39011 int ret_val;
39012 int code; /* UCS code point */
39013 int n_code;
39014
39015 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39016 mem_base = xmlMemBlocks();
39017 code = gen_int(n_code, 0);
39018
39019 ret_val = xmlUCSIsShavian(code);
39020 desret_int(ret_val);
39021 call_tests++;
39022 des_int(n_code, code, 0);
39023 xmlResetLastError();
39024 if (mem_base != xmlMemBlocks()) {
39025 printf("Leak of %d blocks found in xmlUCSIsShavian",
39026 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039027 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039028 printf(" %d", n_code);
39029 printf("\n");
39030 }
39031 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039032 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039033#endif
39034
Daniel Veillard42595322004-11-08 10:52:06 +000039035 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039036}
39037
39038
39039static int
39040test_xmlUCSIsSinhala(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039041 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039042
William M. Brack21e4ef22005-01-02 09:53:13 +000039043#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039044 int mem_base;
39045 int ret_val;
39046 int code; /* UCS code point */
39047 int n_code;
39048
39049 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39050 mem_base = xmlMemBlocks();
39051 code = gen_int(n_code, 0);
39052
39053 ret_val = xmlUCSIsSinhala(code);
39054 desret_int(ret_val);
39055 call_tests++;
39056 des_int(n_code, code, 0);
39057 xmlResetLastError();
39058 if (mem_base != xmlMemBlocks()) {
39059 printf("Leak of %d blocks found in xmlUCSIsSinhala",
39060 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039061 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039062 printf(" %d", n_code);
39063 printf("\n");
39064 }
39065 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039066 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039067#endif
39068
Daniel Veillard42595322004-11-08 10:52:06 +000039069 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039070}
39071
39072
39073static int
39074test_xmlUCSIsSmallFormVariants(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039075 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039076
William M. Brack21e4ef22005-01-02 09:53:13 +000039077#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039078 int mem_base;
39079 int ret_val;
39080 int code; /* UCS code point */
39081 int n_code;
39082
39083 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39084 mem_base = xmlMemBlocks();
39085 code = gen_int(n_code, 0);
39086
39087 ret_val = xmlUCSIsSmallFormVariants(code);
39088 desret_int(ret_val);
39089 call_tests++;
39090 des_int(n_code, code, 0);
39091 xmlResetLastError();
39092 if (mem_base != xmlMemBlocks()) {
39093 printf("Leak of %d blocks found in xmlUCSIsSmallFormVariants",
39094 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039095 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039096 printf(" %d", n_code);
39097 printf("\n");
39098 }
39099 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039100 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039101#endif
39102
Daniel Veillard42595322004-11-08 10:52:06 +000039103 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039104}
39105
39106
39107static int
39108test_xmlUCSIsSpacingModifierLetters(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039109 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039110
William M. Brack21e4ef22005-01-02 09:53:13 +000039111#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039112 int mem_base;
39113 int ret_val;
39114 int code; /* UCS code point */
39115 int n_code;
39116
39117 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39118 mem_base = xmlMemBlocks();
39119 code = gen_int(n_code, 0);
39120
39121 ret_val = xmlUCSIsSpacingModifierLetters(code);
39122 desret_int(ret_val);
39123 call_tests++;
39124 des_int(n_code, code, 0);
39125 xmlResetLastError();
39126 if (mem_base != xmlMemBlocks()) {
39127 printf("Leak of %d blocks found in xmlUCSIsSpacingModifierLetters",
39128 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039129 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039130 printf(" %d", n_code);
39131 printf("\n");
39132 }
39133 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039134 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039135#endif
39136
Daniel Veillard42595322004-11-08 10:52:06 +000039137 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039138}
39139
39140
39141static int
39142test_xmlUCSIsSpecials(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039143 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039144
William M. Brack21e4ef22005-01-02 09:53:13 +000039145#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039146 int mem_base;
39147 int ret_val;
39148 int code; /* UCS code point */
39149 int n_code;
39150
39151 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39152 mem_base = xmlMemBlocks();
39153 code = gen_int(n_code, 0);
39154
39155 ret_val = xmlUCSIsSpecials(code);
39156 desret_int(ret_val);
39157 call_tests++;
39158 des_int(n_code, code, 0);
39159 xmlResetLastError();
39160 if (mem_base != xmlMemBlocks()) {
39161 printf("Leak of %d blocks found in xmlUCSIsSpecials",
39162 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039163 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039164 printf(" %d", n_code);
39165 printf("\n");
39166 }
39167 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039168 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039169#endif
39170
Daniel Veillard42595322004-11-08 10:52:06 +000039171 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039172}
39173
39174
39175static int
39176test_xmlUCSIsSuperscriptsandSubscripts(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039177 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039178
William M. Brack21e4ef22005-01-02 09:53:13 +000039179#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039180 int mem_base;
39181 int ret_val;
39182 int code; /* UCS code point */
39183 int n_code;
39184
39185 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39186 mem_base = xmlMemBlocks();
39187 code = gen_int(n_code, 0);
39188
39189 ret_val = xmlUCSIsSuperscriptsandSubscripts(code);
39190 desret_int(ret_val);
39191 call_tests++;
39192 des_int(n_code, code, 0);
39193 xmlResetLastError();
39194 if (mem_base != xmlMemBlocks()) {
39195 printf("Leak of %d blocks found in xmlUCSIsSuperscriptsandSubscripts",
39196 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039197 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039198 printf(" %d", n_code);
39199 printf("\n");
39200 }
39201 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039202 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039203#endif
39204
Daniel Veillard42595322004-11-08 10:52:06 +000039205 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039206}
39207
39208
39209static int
39210test_xmlUCSIsSupplementalArrowsA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039211 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039212
William M. Brack21e4ef22005-01-02 09:53:13 +000039213#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039214 int mem_base;
39215 int ret_val;
39216 int code; /* UCS code point */
39217 int n_code;
39218
39219 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39220 mem_base = xmlMemBlocks();
39221 code = gen_int(n_code, 0);
39222
39223 ret_val = xmlUCSIsSupplementalArrowsA(code);
39224 desret_int(ret_val);
39225 call_tests++;
39226 des_int(n_code, code, 0);
39227 xmlResetLastError();
39228 if (mem_base != xmlMemBlocks()) {
39229 printf("Leak of %d blocks found in xmlUCSIsSupplementalArrowsA",
39230 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039231 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039232 printf(" %d", n_code);
39233 printf("\n");
39234 }
39235 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039236 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039237#endif
39238
Daniel Veillard42595322004-11-08 10:52:06 +000039239 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039240}
39241
39242
39243static int
39244test_xmlUCSIsSupplementalArrowsB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039245 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039246
William M. Brack21e4ef22005-01-02 09:53:13 +000039247#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039248 int mem_base;
39249 int ret_val;
39250 int code; /* UCS code point */
39251 int n_code;
39252
39253 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39254 mem_base = xmlMemBlocks();
39255 code = gen_int(n_code, 0);
39256
39257 ret_val = xmlUCSIsSupplementalArrowsB(code);
39258 desret_int(ret_val);
39259 call_tests++;
39260 des_int(n_code, code, 0);
39261 xmlResetLastError();
39262 if (mem_base != xmlMemBlocks()) {
39263 printf("Leak of %d blocks found in xmlUCSIsSupplementalArrowsB",
39264 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039265 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039266 printf(" %d", n_code);
39267 printf("\n");
39268 }
39269 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039270 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039271#endif
39272
Daniel Veillard42595322004-11-08 10:52:06 +000039273 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039274}
39275
39276
39277static int
39278test_xmlUCSIsSupplementalMathematicalOperators(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039279 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039280
William M. Brack21e4ef22005-01-02 09:53:13 +000039281#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039282 int mem_base;
39283 int ret_val;
39284 int code; /* UCS code point */
39285 int n_code;
39286
39287 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39288 mem_base = xmlMemBlocks();
39289 code = gen_int(n_code, 0);
39290
39291 ret_val = xmlUCSIsSupplementalMathematicalOperators(code);
39292 desret_int(ret_val);
39293 call_tests++;
39294 des_int(n_code, code, 0);
39295 xmlResetLastError();
39296 if (mem_base != xmlMemBlocks()) {
39297 printf("Leak of %d blocks found in xmlUCSIsSupplementalMathematicalOperators",
39298 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039299 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039300 printf(" %d", n_code);
39301 printf("\n");
39302 }
39303 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039304 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039305#endif
39306
Daniel Veillard42595322004-11-08 10:52:06 +000039307 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039308}
39309
39310
39311static int
39312test_xmlUCSIsSupplementaryPrivateUseAreaA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039313 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039314
William M. Brack21e4ef22005-01-02 09:53:13 +000039315#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039316 int mem_base;
39317 int ret_val;
39318 int code; /* UCS code point */
39319 int n_code;
39320
39321 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39322 mem_base = xmlMemBlocks();
39323 code = gen_int(n_code, 0);
39324
39325 ret_val = xmlUCSIsSupplementaryPrivateUseAreaA(code);
39326 desret_int(ret_val);
39327 call_tests++;
39328 des_int(n_code, code, 0);
39329 xmlResetLastError();
39330 if (mem_base != xmlMemBlocks()) {
39331 printf("Leak of %d blocks found in xmlUCSIsSupplementaryPrivateUseAreaA",
39332 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039333 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039334 printf(" %d", n_code);
39335 printf("\n");
39336 }
39337 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039338 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039339#endif
39340
Daniel Veillard42595322004-11-08 10:52:06 +000039341 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039342}
39343
39344
39345static int
39346test_xmlUCSIsSupplementaryPrivateUseAreaB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039347 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039348
William M. Brack21e4ef22005-01-02 09:53:13 +000039349#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039350 int mem_base;
39351 int ret_val;
39352 int code; /* UCS code point */
39353 int n_code;
39354
39355 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39356 mem_base = xmlMemBlocks();
39357 code = gen_int(n_code, 0);
39358
39359 ret_val = xmlUCSIsSupplementaryPrivateUseAreaB(code);
39360 desret_int(ret_val);
39361 call_tests++;
39362 des_int(n_code, code, 0);
39363 xmlResetLastError();
39364 if (mem_base != xmlMemBlocks()) {
39365 printf("Leak of %d blocks found in xmlUCSIsSupplementaryPrivateUseAreaB",
39366 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039367 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039368 printf(" %d", n_code);
39369 printf("\n");
39370 }
39371 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039372 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039373#endif
39374
Daniel Veillard42595322004-11-08 10:52:06 +000039375 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039376}
39377
39378
39379static int
39380test_xmlUCSIsSyriac(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039381 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039382
William M. Brack21e4ef22005-01-02 09:53:13 +000039383#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039384 int mem_base;
39385 int ret_val;
39386 int code; /* UCS code point */
39387 int n_code;
39388
39389 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39390 mem_base = xmlMemBlocks();
39391 code = gen_int(n_code, 0);
39392
39393 ret_val = xmlUCSIsSyriac(code);
39394 desret_int(ret_val);
39395 call_tests++;
39396 des_int(n_code, code, 0);
39397 xmlResetLastError();
39398 if (mem_base != xmlMemBlocks()) {
39399 printf("Leak of %d blocks found in xmlUCSIsSyriac",
39400 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039401 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039402 printf(" %d", n_code);
39403 printf("\n");
39404 }
39405 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039406 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039407#endif
39408
Daniel Veillard42595322004-11-08 10:52:06 +000039409 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039410}
39411
39412
39413static int
39414test_xmlUCSIsTagalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039415 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039416
William M. Brack21e4ef22005-01-02 09:53:13 +000039417#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039418 int mem_base;
39419 int ret_val;
39420 int code; /* UCS code point */
39421 int n_code;
39422
39423 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39424 mem_base = xmlMemBlocks();
39425 code = gen_int(n_code, 0);
39426
39427 ret_val = xmlUCSIsTagalog(code);
39428 desret_int(ret_val);
39429 call_tests++;
39430 des_int(n_code, code, 0);
39431 xmlResetLastError();
39432 if (mem_base != xmlMemBlocks()) {
39433 printf("Leak of %d blocks found in xmlUCSIsTagalog",
39434 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039435 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039436 printf(" %d", n_code);
39437 printf("\n");
39438 }
39439 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039440 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039441#endif
39442
Daniel Veillard42595322004-11-08 10:52:06 +000039443 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039444}
39445
39446
39447static int
39448test_xmlUCSIsTagbanwa(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039449 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039450
William M. Brack21e4ef22005-01-02 09:53:13 +000039451#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039452 int mem_base;
39453 int ret_val;
39454 int code; /* UCS code point */
39455 int n_code;
39456
39457 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39458 mem_base = xmlMemBlocks();
39459 code = gen_int(n_code, 0);
39460
39461 ret_val = xmlUCSIsTagbanwa(code);
39462 desret_int(ret_val);
39463 call_tests++;
39464 des_int(n_code, code, 0);
39465 xmlResetLastError();
39466 if (mem_base != xmlMemBlocks()) {
39467 printf("Leak of %d blocks found in xmlUCSIsTagbanwa",
39468 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039469 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039470 printf(" %d", n_code);
39471 printf("\n");
39472 }
39473 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039474 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039475#endif
39476
Daniel Veillard42595322004-11-08 10:52:06 +000039477 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039478}
39479
39480
39481static int
39482test_xmlUCSIsTags(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039483 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039484
William M. Brack21e4ef22005-01-02 09:53:13 +000039485#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039486 int mem_base;
39487 int ret_val;
39488 int code; /* UCS code point */
39489 int n_code;
39490
39491 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39492 mem_base = xmlMemBlocks();
39493 code = gen_int(n_code, 0);
39494
39495 ret_val = xmlUCSIsTags(code);
39496 desret_int(ret_val);
39497 call_tests++;
39498 des_int(n_code, code, 0);
39499 xmlResetLastError();
39500 if (mem_base != xmlMemBlocks()) {
39501 printf("Leak of %d blocks found in xmlUCSIsTags",
39502 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039503 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039504 printf(" %d", n_code);
39505 printf("\n");
39506 }
39507 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039508 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039509#endif
39510
Daniel Veillard42595322004-11-08 10:52:06 +000039511 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039512}
39513
39514
39515static int
39516test_xmlUCSIsTaiLe(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039517 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039518
William M. Brack21e4ef22005-01-02 09:53:13 +000039519#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039520 int mem_base;
39521 int ret_val;
39522 int code; /* UCS code point */
39523 int n_code;
39524
39525 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39526 mem_base = xmlMemBlocks();
39527 code = gen_int(n_code, 0);
39528
39529 ret_val = xmlUCSIsTaiLe(code);
39530 desret_int(ret_val);
39531 call_tests++;
39532 des_int(n_code, code, 0);
39533 xmlResetLastError();
39534 if (mem_base != xmlMemBlocks()) {
39535 printf("Leak of %d blocks found in xmlUCSIsTaiLe",
39536 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039537 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039538 printf(" %d", n_code);
39539 printf("\n");
39540 }
39541 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039542 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039543#endif
39544
Daniel Veillard42595322004-11-08 10:52:06 +000039545 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039546}
39547
39548
39549static int
39550test_xmlUCSIsTaiXuanJingSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039551 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039552
William M. Brack21e4ef22005-01-02 09:53:13 +000039553#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039554 int mem_base;
39555 int ret_val;
39556 int code; /* UCS code point */
39557 int n_code;
39558
39559 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39560 mem_base = xmlMemBlocks();
39561 code = gen_int(n_code, 0);
39562
39563 ret_val = xmlUCSIsTaiXuanJingSymbols(code);
39564 desret_int(ret_val);
39565 call_tests++;
39566 des_int(n_code, code, 0);
39567 xmlResetLastError();
39568 if (mem_base != xmlMemBlocks()) {
39569 printf("Leak of %d blocks found in xmlUCSIsTaiXuanJingSymbols",
39570 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039571 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039572 printf(" %d", n_code);
39573 printf("\n");
39574 }
39575 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039576 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039577#endif
39578
Daniel Veillard42595322004-11-08 10:52:06 +000039579 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039580}
39581
39582
39583static int
39584test_xmlUCSIsTamil(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039585 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039586
William M. Brack21e4ef22005-01-02 09:53:13 +000039587#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039588 int mem_base;
39589 int ret_val;
39590 int code; /* UCS code point */
39591 int n_code;
39592
39593 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39594 mem_base = xmlMemBlocks();
39595 code = gen_int(n_code, 0);
39596
39597 ret_val = xmlUCSIsTamil(code);
39598 desret_int(ret_val);
39599 call_tests++;
39600 des_int(n_code, code, 0);
39601 xmlResetLastError();
39602 if (mem_base != xmlMemBlocks()) {
39603 printf("Leak of %d blocks found in xmlUCSIsTamil",
39604 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039605 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039606 printf(" %d", n_code);
39607 printf("\n");
39608 }
39609 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039610 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039611#endif
39612
Daniel Veillard42595322004-11-08 10:52:06 +000039613 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039614}
39615
39616
39617static int
39618test_xmlUCSIsTelugu(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039619 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039620
William M. Brack21e4ef22005-01-02 09:53:13 +000039621#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039622 int mem_base;
39623 int ret_val;
39624 int code; /* UCS code point */
39625 int n_code;
39626
39627 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39628 mem_base = xmlMemBlocks();
39629 code = gen_int(n_code, 0);
39630
39631 ret_val = xmlUCSIsTelugu(code);
39632 desret_int(ret_val);
39633 call_tests++;
39634 des_int(n_code, code, 0);
39635 xmlResetLastError();
39636 if (mem_base != xmlMemBlocks()) {
39637 printf("Leak of %d blocks found in xmlUCSIsTelugu",
39638 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039639 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039640 printf(" %d", n_code);
39641 printf("\n");
39642 }
39643 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039644 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039645#endif
39646
Daniel Veillard42595322004-11-08 10:52:06 +000039647 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039648}
39649
39650
39651static int
39652test_xmlUCSIsThaana(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039653 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039654
William M. Brack21e4ef22005-01-02 09:53:13 +000039655#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039656 int mem_base;
39657 int ret_val;
39658 int code; /* UCS code point */
39659 int n_code;
39660
39661 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39662 mem_base = xmlMemBlocks();
39663 code = gen_int(n_code, 0);
39664
39665 ret_val = xmlUCSIsThaana(code);
39666 desret_int(ret_val);
39667 call_tests++;
39668 des_int(n_code, code, 0);
39669 xmlResetLastError();
39670 if (mem_base != xmlMemBlocks()) {
39671 printf("Leak of %d blocks found in xmlUCSIsThaana",
39672 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039673 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039674 printf(" %d", n_code);
39675 printf("\n");
39676 }
39677 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039678 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039679#endif
39680
Daniel Veillard42595322004-11-08 10:52:06 +000039681 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039682}
39683
39684
39685static int
39686test_xmlUCSIsThai(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039687 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039688
William M. Brack21e4ef22005-01-02 09:53:13 +000039689#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039690 int mem_base;
39691 int ret_val;
39692 int code; /* UCS code point */
39693 int n_code;
39694
39695 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39696 mem_base = xmlMemBlocks();
39697 code = gen_int(n_code, 0);
39698
39699 ret_val = xmlUCSIsThai(code);
39700 desret_int(ret_val);
39701 call_tests++;
39702 des_int(n_code, code, 0);
39703 xmlResetLastError();
39704 if (mem_base != xmlMemBlocks()) {
39705 printf("Leak of %d blocks found in xmlUCSIsThai",
39706 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039707 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039708 printf(" %d", n_code);
39709 printf("\n");
39710 }
39711 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039712 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039713#endif
39714
Daniel Veillard42595322004-11-08 10:52:06 +000039715 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039716}
39717
39718
39719static int
39720test_xmlUCSIsTibetan(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039721 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039722
William M. Brack21e4ef22005-01-02 09:53:13 +000039723#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039724 int mem_base;
39725 int ret_val;
39726 int code; /* UCS code point */
39727 int n_code;
39728
39729 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39730 mem_base = xmlMemBlocks();
39731 code = gen_int(n_code, 0);
39732
39733 ret_val = xmlUCSIsTibetan(code);
39734 desret_int(ret_val);
39735 call_tests++;
39736 des_int(n_code, code, 0);
39737 xmlResetLastError();
39738 if (mem_base != xmlMemBlocks()) {
39739 printf("Leak of %d blocks found in xmlUCSIsTibetan",
39740 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039741 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039742 printf(" %d", n_code);
39743 printf("\n");
39744 }
39745 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039746 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039747#endif
39748
Daniel Veillard42595322004-11-08 10:52:06 +000039749 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039750}
39751
39752
39753static int
39754test_xmlUCSIsUgaritic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039755 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039756
William M. Brack21e4ef22005-01-02 09:53:13 +000039757#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039758 int mem_base;
39759 int ret_val;
39760 int code; /* UCS code point */
39761 int n_code;
39762
39763 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39764 mem_base = xmlMemBlocks();
39765 code = gen_int(n_code, 0);
39766
39767 ret_val = xmlUCSIsUgaritic(code);
39768 desret_int(ret_val);
39769 call_tests++;
39770 des_int(n_code, code, 0);
39771 xmlResetLastError();
39772 if (mem_base != xmlMemBlocks()) {
39773 printf("Leak of %d blocks found in xmlUCSIsUgaritic",
39774 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039775 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039776 printf(" %d", n_code);
39777 printf("\n");
39778 }
39779 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039780 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039781#endif
39782
Daniel Veillard42595322004-11-08 10:52:06 +000039783 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039784}
39785
39786
39787static int
39788test_xmlUCSIsUnifiedCanadianAboriginalSyllabics(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039789 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039790
William M. Brack21e4ef22005-01-02 09:53:13 +000039791#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039792 int mem_base;
39793 int ret_val;
39794 int code; /* UCS code point */
39795 int n_code;
39796
39797 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39798 mem_base = xmlMemBlocks();
39799 code = gen_int(n_code, 0);
39800
39801 ret_val = xmlUCSIsUnifiedCanadianAboriginalSyllabics(code);
39802 desret_int(ret_val);
39803 call_tests++;
39804 des_int(n_code, code, 0);
39805 xmlResetLastError();
39806 if (mem_base != xmlMemBlocks()) {
39807 printf("Leak of %d blocks found in xmlUCSIsUnifiedCanadianAboriginalSyllabics",
39808 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039809 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039810 printf(" %d", n_code);
39811 printf("\n");
39812 }
39813 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039814 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039815#endif
39816
Daniel Veillard42595322004-11-08 10:52:06 +000039817 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039818}
39819
39820
39821static int
39822test_xmlUCSIsVariationSelectors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039823 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039824
William M. Brack21e4ef22005-01-02 09:53:13 +000039825#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039826 int mem_base;
39827 int ret_val;
39828 int code; /* UCS code point */
39829 int n_code;
39830
39831 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39832 mem_base = xmlMemBlocks();
39833 code = gen_int(n_code, 0);
39834
39835 ret_val = xmlUCSIsVariationSelectors(code);
39836 desret_int(ret_val);
39837 call_tests++;
39838 des_int(n_code, code, 0);
39839 xmlResetLastError();
39840 if (mem_base != xmlMemBlocks()) {
39841 printf("Leak of %d blocks found in xmlUCSIsVariationSelectors",
39842 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039843 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039844 printf(" %d", n_code);
39845 printf("\n");
39846 }
39847 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039848 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039849#endif
39850
Daniel Veillard42595322004-11-08 10:52:06 +000039851 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039852}
39853
39854
39855static int
39856test_xmlUCSIsVariationSelectorsSupplement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039857 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039858
William M. Brack21e4ef22005-01-02 09:53:13 +000039859#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039860 int mem_base;
39861 int ret_val;
39862 int code; /* UCS code point */
39863 int n_code;
39864
39865 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39866 mem_base = xmlMemBlocks();
39867 code = gen_int(n_code, 0);
39868
39869 ret_val = xmlUCSIsVariationSelectorsSupplement(code);
39870 desret_int(ret_val);
39871 call_tests++;
39872 des_int(n_code, code, 0);
39873 xmlResetLastError();
39874 if (mem_base != xmlMemBlocks()) {
39875 printf("Leak of %d blocks found in xmlUCSIsVariationSelectorsSupplement",
39876 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039877 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039878 printf(" %d", n_code);
39879 printf("\n");
39880 }
39881 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039882 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039883#endif
39884
Daniel Veillard42595322004-11-08 10:52:06 +000039885 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039886}
39887
39888
39889static int
39890test_xmlUCSIsYiRadicals(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039891 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039892
William M. Brack21e4ef22005-01-02 09:53:13 +000039893#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039894 int mem_base;
39895 int ret_val;
39896 int code; /* UCS code point */
39897 int n_code;
39898
39899 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39900 mem_base = xmlMemBlocks();
39901 code = gen_int(n_code, 0);
39902
39903 ret_val = xmlUCSIsYiRadicals(code);
39904 desret_int(ret_val);
39905 call_tests++;
39906 des_int(n_code, code, 0);
39907 xmlResetLastError();
39908 if (mem_base != xmlMemBlocks()) {
39909 printf("Leak of %d blocks found in xmlUCSIsYiRadicals",
39910 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039911 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039912 printf(" %d", n_code);
39913 printf("\n");
39914 }
39915 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039916 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039917#endif
39918
Daniel Veillard42595322004-11-08 10:52:06 +000039919 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039920}
39921
39922
39923static int
39924test_xmlUCSIsYiSyllables(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039925 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039926
William M. Brack21e4ef22005-01-02 09:53:13 +000039927#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039928 int mem_base;
39929 int ret_val;
39930 int code; /* UCS code point */
39931 int n_code;
39932
39933 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39934 mem_base = xmlMemBlocks();
39935 code = gen_int(n_code, 0);
39936
39937 ret_val = xmlUCSIsYiSyllables(code);
39938 desret_int(ret_val);
39939 call_tests++;
39940 des_int(n_code, code, 0);
39941 xmlResetLastError();
39942 if (mem_base != xmlMemBlocks()) {
39943 printf("Leak of %d blocks found in xmlUCSIsYiSyllables",
39944 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039945 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039946 printf(" %d", n_code);
39947 printf("\n");
39948 }
39949 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039950 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039951#endif
39952
Daniel Veillard42595322004-11-08 10:52:06 +000039953 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039954}
39955
39956
39957static int
39958test_xmlUCSIsYijingHexagramSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039959 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039960
William M. Brack21e4ef22005-01-02 09:53:13 +000039961#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039962 int mem_base;
39963 int ret_val;
39964 int code; /* UCS code point */
39965 int n_code;
39966
39967 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39968 mem_base = xmlMemBlocks();
39969 code = gen_int(n_code, 0);
39970
39971 ret_val = xmlUCSIsYijingHexagramSymbols(code);
39972 desret_int(ret_val);
39973 call_tests++;
39974 des_int(n_code, code, 0);
39975 xmlResetLastError();
39976 if (mem_base != xmlMemBlocks()) {
39977 printf("Leak of %d blocks found in xmlUCSIsYijingHexagramSymbols",
39978 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039979 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039980 printf(" %d", n_code);
39981 printf("\n");
39982 }
39983 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039984 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039985#endif
39986
Daniel Veillard42595322004-11-08 10:52:06 +000039987 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039988}
39989
39990static int
39991test_xmlunicode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039992 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039993
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039994 if (quiet == 0) printf("Testing xmlunicode : 166 of 166 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000039995 test_ret += test_xmlUCSIsAegeanNumbers();
39996 test_ret += test_xmlUCSIsAlphabeticPresentationForms();
39997 test_ret += test_xmlUCSIsArabic();
39998 test_ret += test_xmlUCSIsArabicPresentationFormsA();
39999 test_ret += test_xmlUCSIsArabicPresentationFormsB();
40000 test_ret += test_xmlUCSIsArmenian();
40001 test_ret += test_xmlUCSIsArrows();
40002 test_ret += test_xmlUCSIsBasicLatin();
40003 test_ret += test_xmlUCSIsBengali();
40004 test_ret += test_xmlUCSIsBlock();
40005 test_ret += test_xmlUCSIsBlockElements();
40006 test_ret += test_xmlUCSIsBopomofo();
40007 test_ret += test_xmlUCSIsBopomofoExtended();
40008 test_ret += test_xmlUCSIsBoxDrawing();
40009 test_ret += test_xmlUCSIsBraillePatterns();
40010 test_ret += test_xmlUCSIsBuhid();
40011 test_ret += test_xmlUCSIsByzantineMusicalSymbols();
40012 test_ret += test_xmlUCSIsCJKCompatibility();
40013 test_ret += test_xmlUCSIsCJKCompatibilityForms();
40014 test_ret += test_xmlUCSIsCJKCompatibilityIdeographs();
40015 test_ret += test_xmlUCSIsCJKCompatibilityIdeographsSupplement();
40016 test_ret += test_xmlUCSIsCJKRadicalsSupplement();
40017 test_ret += test_xmlUCSIsCJKSymbolsandPunctuation();
40018 test_ret += test_xmlUCSIsCJKUnifiedIdeographs();
40019 test_ret += test_xmlUCSIsCJKUnifiedIdeographsExtensionA();
40020 test_ret += test_xmlUCSIsCJKUnifiedIdeographsExtensionB();
40021 test_ret += test_xmlUCSIsCat();
40022 test_ret += test_xmlUCSIsCatC();
40023 test_ret += test_xmlUCSIsCatCc();
40024 test_ret += test_xmlUCSIsCatCf();
40025 test_ret += test_xmlUCSIsCatCo();
40026 test_ret += test_xmlUCSIsCatCs();
40027 test_ret += test_xmlUCSIsCatL();
40028 test_ret += test_xmlUCSIsCatLl();
40029 test_ret += test_xmlUCSIsCatLm();
40030 test_ret += test_xmlUCSIsCatLo();
40031 test_ret += test_xmlUCSIsCatLt();
40032 test_ret += test_xmlUCSIsCatLu();
40033 test_ret += test_xmlUCSIsCatM();
40034 test_ret += test_xmlUCSIsCatMc();
40035 test_ret += test_xmlUCSIsCatMe();
40036 test_ret += test_xmlUCSIsCatMn();
40037 test_ret += test_xmlUCSIsCatN();
40038 test_ret += test_xmlUCSIsCatNd();
40039 test_ret += test_xmlUCSIsCatNl();
40040 test_ret += test_xmlUCSIsCatNo();
40041 test_ret += test_xmlUCSIsCatP();
40042 test_ret += test_xmlUCSIsCatPc();
40043 test_ret += test_xmlUCSIsCatPd();
40044 test_ret += test_xmlUCSIsCatPe();
40045 test_ret += test_xmlUCSIsCatPf();
40046 test_ret += test_xmlUCSIsCatPi();
40047 test_ret += test_xmlUCSIsCatPo();
40048 test_ret += test_xmlUCSIsCatPs();
40049 test_ret += test_xmlUCSIsCatS();
40050 test_ret += test_xmlUCSIsCatSc();
40051 test_ret += test_xmlUCSIsCatSk();
40052 test_ret += test_xmlUCSIsCatSm();
40053 test_ret += test_xmlUCSIsCatSo();
40054 test_ret += test_xmlUCSIsCatZ();
40055 test_ret += test_xmlUCSIsCatZl();
40056 test_ret += test_xmlUCSIsCatZp();
40057 test_ret += test_xmlUCSIsCatZs();
40058 test_ret += test_xmlUCSIsCherokee();
40059 test_ret += test_xmlUCSIsCombiningDiacriticalMarks();
40060 test_ret += test_xmlUCSIsCombiningDiacriticalMarksforSymbols();
40061 test_ret += test_xmlUCSIsCombiningHalfMarks();
40062 test_ret += test_xmlUCSIsCombiningMarksforSymbols();
40063 test_ret += test_xmlUCSIsControlPictures();
40064 test_ret += test_xmlUCSIsCurrencySymbols();
40065 test_ret += test_xmlUCSIsCypriotSyllabary();
40066 test_ret += test_xmlUCSIsCyrillic();
40067 test_ret += test_xmlUCSIsCyrillicSupplement();
40068 test_ret += test_xmlUCSIsDeseret();
40069 test_ret += test_xmlUCSIsDevanagari();
40070 test_ret += test_xmlUCSIsDingbats();
40071 test_ret += test_xmlUCSIsEnclosedAlphanumerics();
40072 test_ret += test_xmlUCSIsEnclosedCJKLettersandMonths();
40073 test_ret += test_xmlUCSIsEthiopic();
40074 test_ret += test_xmlUCSIsGeneralPunctuation();
40075 test_ret += test_xmlUCSIsGeometricShapes();
40076 test_ret += test_xmlUCSIsGeorgian();
40077 test_ret += test_xmlUCSIsGothic();
40078 test_ret += test_xmlUCSIsGreek();
40079 test_ret += test_xmlUCSIsGreekExtended();
40080 test_ret += test_xmlUCSIsGreekandCoptic();
40081 test_ret += test_xmlUCSIsGujarati();
40082 test_ret += test_xmlUCSIsGurmukhi();
40083 test_ret += test_xmlUCSIsHalfwidthandFullwidthForms();
40084 test_ret += test_xmlUCSIsHangulCompatibilityJamo();
40085 test_ret += test_xmlUCSIsHangulJamo();
40086 test_ret += test_xmlUCSIsHangulSyllables();
40087 test_ret += test_xmlUCSIsHanunoo();
40088 test_ret += test_xmlUCSIsHebrew();
40089 test_ret += test_xmlUCSIsHighPrivateUseSurrogates();
40090 test_ret += test_xmlUCSIsHighSurrogates();
40091 test_ret += test_xmlUCSIsHiragana();
40092 test_ret += test_xmlUCSIsIPAExtensions();
40093 test_ret += test_xmlUCSIsIdeographicDescriptionCharacters();
40094 test_ret += test_xmlUCSIsKanbun();
40095 test_ret += test_xmlUCSIsKangxiRadicals();
40096 test_ret += test_xmlUCSIsKannada();
40097 test_ret += test_xmlUCSIsKatakana();
40098 test_ret += test_xmlUCSIsKatakanaPhoneticExtensions();
40099 test_ret += test_xmlUCSIsKhmer();
40100 test_ret += test_xmlUCSIsKhmerSymbols();
40101 test_ret += test_xmlUCSIsLao();
40102 test_ret += test_xmlUCSIsLatin1Supplement();
40103 test_ret += test_xmlUCSIsLatinExtendedA();
40104 test_ret += test_xmlUCSIsLatinExtendedAdditional();
40105 test_ret += test_xmlUCSIsLatinExtendedB();
40106 test_ret += test_xmlUCSIsLetterlikeSymbols();
40107 test_ret += test_xmlUCSIsLimbu();
40108 test_ret += test_xmlUCSIsLinearBIdeograms();
40109 test_ret += test_xmlUCSIsLinearBSyllabary();
40110 test_ret += test_xmlUCSIsLowSurrogates();
40111 test_ret += test_xmlUCSIsMalayalam();
40112 test_ret += test_xmlUCSIsMathematicalAlphanumericSymbols();
40113 test_ret += test_xmlUCSIsMathematicalOperators();
40114 test_ret += test_xmlUCSIsMiscellaneousMathematicalSymbolsA();
40115 test_ret += test_xmlUCSIsMiscellaneousMathematicalSymbolsB();
40116 test_ret += test_xmlUCSIsMiscellaneousSymbols();
40117 test_ret += test_xmlUCSIsMiscellaneousSymbolsandArrows();
40118 test_ret += test_xmlUCSIsMiscellaneousTechnical();
40119 test_ret += test_xmlUCSIsMongolian();
40120 test_ret += test_xmlUCSIsMusicalSymbols();
40121 test_ret += test_xmlUCSIsMyanmar();
40122 test_ret += test_xmlUCSIsNumberForms();
40123 test_ret += test_xmlUCSIsOgham();
40124 test_ret += test_xmlUCSIsOldItalic();
40125 test_ret += test_xmlUCSIsOpticalCharacterRecognition();
40126 test_ret += test_xmlUCSIsOriya();
40127 test_ret += test_xmlUCSIsOsmanya();
40128 test_ret += test_xmlUCSIsPhoneticExtensions();
40129 test_ret += test_xmlUCSIsPrivateUse();
40130 test_ret += test_xmlUCSIsPrivateUseArea();
40131 test_ret += test_xmlUCSIsRunic();
40132 test_ret += test_xmlUCSIsShavian();
40133 test_ret += test_xmlUCSIsSinhala();
40134 test_ret += test_xmlUCSIsSmallFormVariants();
40135 test_ret += test_xmlUCSIsSpacingModifierLetters();
40136 test_ret += test_xmlUCSIsSpecials();
40137 test_ret += test_xmlUCSIsSuperscriptsandSubscripts();
40138 test_ret += test_xmlUCSIsSupplementalArrowsA();
40139 test_ret += test_xmlUCSIsSupplementalArrowsB();
40140 test_ret += test_xmlUCSIsSupplementalMathematicalOperators();
40141 test_ret += test_xmlUCSIsSupplementaryPrivateUseAreaA();
40142 test_ret += test_xmlUCSIsSupplementaryPrivateUseAreaB();
40143 test_ret += test_xmlUCSIsSyriac();
40144 test_ret += test_xmlUCSIsTagalog();
40145 test_ret += test_xmlUCSIsTagbanwa();
40146 test_ret += test_xmlUCSIsTags();
40147 test_ret += test_xmlUCSIsTaiLe();
40148 test_ret += test_xmlUCSIsTaiXuanJingSymbols();
40149 test_ret += test_xmlUCSIsTamil();
40150 test_ret += test_xmlUCSIsTelugu();
40151 test_ret += test_xmlUCSIsThaana();
40152 test_ret += test_xmlUCSIsThai();
40153 test_ret += test_xmlUCSIsTibetan();
40154 test_ret += test_xmlUCSIsUgaritic();
40155 test_ret += test_xmlUCSIsUnifiedCanadianAboriginalSyllabics();
40156 test_ret += test_xmlUCSIsVariationSelectors();
40157 test_ret += test_xmlUCSIsVariationSelectorsSupplement();
40158 test_ret += test_xmlUCSIsYiRadicals();
40159 test_ret += test_xmlUCSIsYiSyllables();
40160 test_ret += test_xmlUCSIsYijingHexagramSymbols();
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040161
Daniel Veillard42595322004-11-08 10:52:06 +000040162 if (test_ret != 0)
40163 printf("Module xmlunicode: %d errors\n", test_ret);
40164 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040165}
40166
40167static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000040168test_xmlNewTextWriter(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040169 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040170
William M. Brack21e4ef22005-01-02 09:53:13 +000040171#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040172 int mem_base;
40173 xmlTextWriterPtr ret_val;
40174 xmlOutputBufferPtr out; /* an xmlOutputBufferPtr */
40175 int n_out;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040176
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040177 for (n_out = 0;n_out < gen_nb_xmlOutputBufferPtr;n_out++) {
40178 mem_base = xmlMemBlocks();
40179 out = gen_xmlOutputBufferPtr(n_out, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040180
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040181 ret_val = xmlNewTextWriter(out);
40182 if (ret_val != NULL) out = NULL;
40183 desret_xmlTextWriterPtr(ret_val);
40184 call_tests++;
40185 des_xmlOutputBufferPtr(n_out, out, 0);
40186 xmlResetLastError();
40187 if (mem_base != xmlMemBlocks()) {
40188 printf("Leak of %d blocks found in xmlNewTextWriter",
40189 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040190 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040191 printf(" %d", n_out);
40192 printf("\n");
40193 }
40194 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040195 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040196#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000040197
Daniel Veillard42595322004-11-08 10:52:06 +000040198 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040199}
40200
40201
40202static int
40203test_xmlNewTextWriterFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040204 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040205
William M. Brack21e4ef22005-01-02 09:53:13 +000040206#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040207 int mem_base;
40208 xmlTextWriterPtr ret_val;
40209 const char * uri; /* the URI of the resource for the output */
40210 int n_uri;
40211 int compression; /* compress the output? */
40212 int n_compression;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040213
Daniel Veillard42595322004-11-08 10:52:06 +000040214 for (n_uri = 0;n_uri < gen_nb_fileoutput;n_uri++) {
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040215 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
40216 mem_base = xmlMemBlocks();
Daniel Veillard42595322004-11-08 10:52:06 +000040217 uri = gen_fileoutput(n_uri, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040218 compression = gen_int(n_compression, 1);
40219
40220 ret_val = xmlNewTextWriterFilename(uri, compression);
40221 desret_xmlTextWriterPtr(ret_val);
40222 call_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000040223 des_fileoutput(n_uri, uri, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040224 des_int(n_compression, compression, 1);
40225 xmlResetLastError();
40226 if (mem_base != xmlMemBlocks()) {
40227 printf("Leak of %d blocks found in xmlNewTextWriterFilename",
40228 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040229 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040230 printf(" %d", n_uri);
40231 printf(" %d", n_compression);
40232 printf("\n");
40233 }
40234 }
40235 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040236 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040237#endif
40238
Daniel Veillard42595322004-11-08 10:52:06 +000040239 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040240}
40241
40242
40243static int
40244test_xmlNewTextWriterMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040245 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040246
William M. Brack21e4ef22005-01-02 09:53:13 +000040247#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040248 int mem_base;
40249 xmlTextWriterPtr ret_val;
40250 xmlBufferPtr buf; /* xmlBufferPtr */
40251 int n_buf;
40252 int compression; /* compress the output? */
40253 int n_compression;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040254
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040255 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
40256 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
40257 mem_base = xmlMemBlocks();
40258 buf = gen_xmlBufferPtr(n_buf, 0);
40259 compression = gen_int(n_compression, 1);
40260
40261 ret_val = xmlNewTextWriterMemory(buf, compression);
40262 desret_xmlTextWriterPtr(ret_val);
40263 call_tests++;
40264 des_xmlBufferPtr(n_buf, buf, 0);
40265 des_int(n_compression, compression, 1);
40266 xmlResetLastError();
40267 if (mem_base != xmlMemBlocks()) {
40268 printf("Leak of %d blocks found in xmlNewTextWriterMemory",
40269 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040270 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040271 printf(" %d", n_buf);
40272 printf(" %d", n_compression);
40273 printf("\n");
40274 }
40275 }
40276 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040277 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040278#endif
40279
Daniel Veillard42595322004-11-08 10:52:06 +000040280 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040281}
40282
40283
40284static int
40285test_xmlNewTextWriterPushParser(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040286 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040287
William M. Brack21e4ef22005-01-02 09:53:13 +000040288#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040289 int mem_base;
40290 xmlTextWriterPtr ret_val;
40291 xmlParserCtxtPtr ctxt; /* xmlParserCtxtPtr to hold the new XML document tree */
40292 int n_ctxt;
40293 int compression; /* compress the output? */
40294 int n_compression;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040295
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040296 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
40297 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
40298 mem_base = xmlMemBlocks();
40299 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
40300 compression = gen_int(n_compression, 1);
40301
40302 ret_val = xmlNewTextWriterPushParser(ctxt, compression);
Daniel Veillarda521d282004-11-09 14:59:59 +000040303 if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;} if (ret_val != NULL) ctxt = NULL;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040304 desret_xmlTextWriterPtr(ret_val);
40305 call_tests++;
40306 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
40307 des_int(n_compression, compression, 1);
40308 xmlResetLastError();
40309 if (mem_base != xmlMemBlocks()) {
40310 printf("Leak of %d blocks found in xmlNewTextWriterPushParser",
40311 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040312 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040313 printf(" %d", n_ctxt);
40314 printf(" %d", n_compression);
40315 printf("\n");
40316 }
40317 }
40318 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040319 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040320#endif
40321
Daniel Veillard42595322004-11-08 10:52:06 +000040322 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040323}
40324
40325
40326static int
40327test_xmlNewTextWriterTree(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040328 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040329
William M. Brack21e4ef22005-01-02 09:53:13 +000040330#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040331 int mem_base;
40332 xmlTextWriterPtr ret_val;
40333 xmlDocPtr doc; /* xmlDocPtr */
40334 int n_doc;
40335 xmlNodePtr node; /* xmlNodePtr or NULL for doc->children */
40336 int n_node;
40337 int compression; /* compress the output? */
40338 int n_compression;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040339
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040340 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
40341 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
40342 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
40343 mem_base = xmlMemBlocks();
40344 doc = gen_xmlDocPtr(n_doc, 0);
40345 node = gen_xmlNodePtr(n_node, 1);
40346 compression = gen_int(n_compression, 2);
40347
40348 ret_val = xmlNewTextWriterTree(doc, node, compression);
40349 desret_xmlTextWriterPtr(ret_val);
40350 call_tests++;
40351 des_xmlDocPtr(n_doc, doc, 0);
40352 des_xmlNodePtr(n_node, node, 1);
40353 des_int(n_compression, compression, 2);
40354 xmlResetLastError();
40355 if (mem_base != xmlMemBlocks()) {
40356 printf("Leak of %d blocks found in xmlNewTextWriterTree",
40357 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040358 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040359 printf(" %d", n_doc);
40360 printf(" %d", n_node);
40361 printf(" %d", n_compression);
40362 printf("\n");
40363 }
40364 }
40365 }
40366 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040367 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040368#endif
40369
Daniel Veillard42595322004-11-08 10:52:06 +000040370 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040371}
40372
40373
40374static int
40375test_xmlTextWriterEndAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040376 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040377
William M. Brack21e4ef22005-01-02 09:53:13 +000040378#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040379 int mem_base;
40380 int ret_val;
40381 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40382 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040383
Daniel Veillarde43cc572004-11-03 11:50:29 +000040384 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40385 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040386 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040387
40388 ret_val = xmlTextWriterEndAttribute(writer);
40389 desret_int(ret_val);
40390 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040391 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040392 xmlResetLastError();
40393 if (mem_base != xmlMemBlocks()) {
40394 printf("Leak of %d blocks found in xmlTextWriterEndAttribute",
40395 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040396 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040397 printf(" %d", n_writer);
40398 printf("\n");
40399 }
40400 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040401 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040402#endif
40403
Daniel Veillard42595322004-11-08 10:52:06 +000040404 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040405}
40406
40407
40408static int
40409test_xmlTextWriterEndCDATA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040410 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040411
William M. Brack21e4ef22005-01-02 09:53:13 +000040412#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040413 int mem_base;
40414 int ret_val;
40415 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40416 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040417
Daniel Veillarde43cc572004-11-03 11:50:29 +000040418 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40419 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040420 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040421
40422 ret_val = xmlTextWriterEndCDATA(writer);
40423 desret_int(ret_val);
40424 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040425 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040426 xmlResetLastError();
40427 if (mem_base != xmlMemBlocks()) {
40428 printf("Leak of %d blocks found in xmlTextWriterEndCDATA",
40429 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040430 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040431 printf(" %d", n_writer);
40432 printf("\n");
40433 }
40434 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040435 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040436#endif
40437
Daniel Veillard42595322004-11-08 10:52:06 +000040438 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040439}
40440
40441
40442static int
40443test_xmlTextWriterEndComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040444 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040445
William M. Brack21e4ef22005-01-02 09:53:13 +000040446#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040447 int mem_base;
40448 int ret_val;
40449 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40450 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040451
Daniel Veillarde43cc572004-11-03 11:50:29 +000040452 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40453 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040454 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040455
40456 ret_val = xmlTextWriterEndComment(writer);
40457 desret_int(ret_val);
40458 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040459 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040460 xmlResetLastError();
40461 if (mem_base != xmlMemBlocks()) {
40462 printf("Leak of %d blocks found in xmlTextWriterEndComment",
40463 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040464 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040465 printf(" %d", n_writer);
40466 printf("\n");
40467 }
40468 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040469 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040470#endif
40471
Daniel Veillard42595322004-11-08 10:52:06 +000040472 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040473}
40474
40475
40476static int
40477test_xmlTextWriterEndDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040478 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040479
William M. Brack21e4ef22005-01-02 09:53:13 +000040480#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040481 int mem_base;
40482 int ret_val;
40483 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40484 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040485
Daniel Veillarde43cc572004-11-03 11:50:29 +000040486 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40487 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040488 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040489
40490 ret_val = xmlTextWriterEndDTD(writer);
40491 desret_int(ret_val);
40492 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040493 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040494 xmlResetLastError();
40495 if (mem_base != xmlMemBlocks()) {
40496 printf("Leak of %d blocks found in xmlTextWriterEndDTD",
40497 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040498 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040499 printf(" %d", n_writer);
40500 printf("\n");
40501 }
40502 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040503 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040504#endif
40505
Daniel Veillard42595322004-11-08 10:52:06 +000040506 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040507}
40508
40509
40510static int
40511test_xmlTextWriterEndDTDAttlist(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040512 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040513
William M. Brack21e4ef22005-01-02 09:53:13 +000040514#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040515 int mem_base;
40516 int ret_val;
40517 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40518 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040519
Daniel Veillarde43cc572004-11-03 11:50:29 +000040520 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40521 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040522 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040523
40524 ret_val = xmlTextWriterEndDTDAttlist(writer);
40525 desret_int(ret_val);
40526 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040527 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040528 xmlResetLastError();
40529 if (mem_base != xmlMemBlocks()) {
40530 printf("Leak of %d blocks found in xmlTextWriterEndDTDAttlist",
40531 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040532 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040533 printf(" %d", n_writer);
40534 printf("\n");
40535 }
40536 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040537 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040538#endif
40539
Daniel Veillard42595322004-11-08 10:52:06 +000040540 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040541}
40542
40543
40544static int
40545test_xmlTextWriterEndDTDElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040546 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040547
William M. Brack21e4ef22005-01-02 09:53:13 +000040548#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040549 int mem_base;
40550 int ret_val;
40551 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40552 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040553
Daniel Veillarde43cc572004-11-03 11:50:29 +000040554 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40555 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040556 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040557
40558 ret_val = xmlTextWriterEndDTDElement(writer);
40559 desret_int(ret_val);
40560 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040561 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040562 xmlResetLastError();
40563 if (mem_base != xmlMemBlocks()) {
40564 printf("Leak of %d blocks found in xmlTextWriterEndDTDElement",
40565 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040566 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040567 printf(" %d", n_writer);
40568 printf("\n");
40569 }
40570 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040571 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040572#endif
40573
Daniel Veillard42595322004-11-08 10:52:06 +000040574 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040575}
40576
40577
40578static int
40579test_xmlTextWriterEndDTDEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040580 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040581
William M. Brack21e4ef22005-01-02 09:53:13 +000040582#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040583 int mem_base;
40584 int ret_val;
40585 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40586 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040587
Daniel Veillarde43cc572004-11-03 11:50:29 +000040588 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40589 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040590 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040591
40592 ret_val = xmlTextWriterEndDTDEntity(writer);
40593 desret_int(ret_val);
40594 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040595 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040596 xmlResetLastError();
40597 if (mem_base != xmlMemBlocks()) {
40598 printf("Leak of %d blocks found in xmlTextWriterEndDTDEntity",
40599 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040600 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040601 printf(" %d", n_writer);
40602 printf("\n");
40603 }
40604 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040605 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040606#endif
40607
Daniel Veillard42595322004-11-08 10:52:06 +000040608 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040609}
40610
40611
40612static int
40613test_xmlTextWriterEndDocument(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040614 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040615
William M. Brack21e4ef22005-01-02 09:53:13 +000040616#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040617 int mem_base;
40618 int ret_val;
40619 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40620 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040621
Daniel Veillarde43cc572004-11-03 11:50:29 +000040622 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40623 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040624 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040625
40626 ret_val = xmlTextWriterEndDocument(writer);
40627 desret_int(ret_val);
40628 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040629 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040630 xmlResetLastError();
40631 if (mem_base != xmlMemBlocks()) {
40632 printf("Leak of %d blocks found in xmlTextWriterEndDocument",
40633 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040634 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040635 printf(" %d", n_writer);
40636 printf("\n");
40637 }
40638 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040639 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040640#endif
40641
Daniel Veillard42595322004-11-08 10:52:06 +000040642 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040643}
40644
40645
40646static int
40647test_xmlTextWriterEndElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040648 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040649
William M. Brack21e4ef22005-01-02 09:53:13 +000040650#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040651 int mem_base;
40652 int ret_val;
40653 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40654 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040655
Daniel Veillarde43cc572004-11-03 11:50:29 +000040656 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40657 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040658 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040659
40660 ret_val = xmlTextWriterEndElement(writer);
40661 desret_int(ret_val);
40662 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040663 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040664 xmlResetLastError();
40665 if (mem_base != xmlMemBlocks()) {
40666 printf("Leak of %d blocks found in xmlTextWriterEndElement",
40667 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040668 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040669 printf(" %d", n_writer);
40670 printf("\n");
40671 }
40672 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040673 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040674#endif
40675
Daniel Veillard42595322004-11-08 10:52:06 +000040676 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040677}
40678
40679
40680static int
40681test_xmlTextWriterEndPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040682 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040683
William M. Brack21e4ef22005-01-02 09:53:13 +000040684#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040685 int mem_base;
40686 int ret_val;
40687 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40688 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040689
Daniel Veillarde43cc572004-11-03 11:50:29 +000040690 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40691 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040692 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040693
40694 ret_val = xmlTextWriterEndPI(writer);
40695 desret_int(ret_val);
40696 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040697 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040698 xmlResetLastError();
40699 if (mem_base != xmlMemBlocks()) {
40700 printf("Leak of %d blocks found in xmlTextWriterEndPI",
40701 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040702 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040703 printf(" %d", n_writer);
40704 printf("\n");
40705 }
40706 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040707 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040708#endif
40709
Daniel Veillard42595322004-11-08 10:52:06 +000040710 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040711}
40712
40713
40714static int
40715test_xmlTextWriterFlush(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040716 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040717
William M. Brack21e4ef22005-01-02 09:53:13 +000040718#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040719 int mem_base;
40720 int ret_val;
40721 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40722 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040723
Daniel Veillarde43cc572004-11-03 11:50:29 +000040724 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40725 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040726 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040727
40728 ret_val = xmlTextWriterFlush(writer);
40729 desret_int(ret_val);
40730 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040731 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040732 xmlResetLastError();
40733 if (mem_base != xmlMemBlocks()) {
40734 printf("Leak of %d blocks found in xmlTextWriterFlush",
40735 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040736 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040737 printf(" %d", n_writer);
40738 printf("\n");
40739 }
40740 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040741 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040742#endif
40743
Daniel Veillard42595322004-11-08 10:52:06 +000040744 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040745}
40746
40747
40748static int
40749test_xmlTextWriterFullEndElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040750 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040751
William M. Brack21e4ef22005-01-02 09:53:13 +000040752#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040753 int mem_base;
40754 int ret_val;
40755 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40756 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040757
Daniel Veillarde43cc572004-11-03 11:50:29 +000040758 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40759 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040760 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040761
40762 ret_val = xmlTextWriterFullEndElement(writer);
40763 desret_int(ret_val);
40764 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040765 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040766 xmlResetLastError();
40767 if (mem_base != xmlMemBlocks()) {
40768 printf("Leak of %d blocks found in xmlTextWriterFullEndElement",
40769 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040770 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040771 printf(" %d", n_writer);
40772 printf("\n");
40773 }
40774 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040775 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040776#endif
40777
Daniel Veillard42595322004-11-08 10:52:06 +000040778 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040779}
40780
40781
40782static int
40783test_xmlTextWriterSetIndent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040784 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040785
William M. Brack21e4ef22005-01-02 09:53:13 +000040786#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040787 int mem_base;
40788 int ret_val;
40789 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40790 int n_writer;
40791 int indent; /* do indentation? */
40792 int n_indent;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040793
Daniel Veillarde43cc572004-11-03 11:50:29 +000040794 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40795 for (n_indent = 0;n_indent < gen_nb_int;n_indent++) {
40796 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040797 writer = gen_xmlTextWriterPtr(n_writer, 0);
40798 indent = gen_int(n_indent, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040799
40800 ret_val = xmlTextWriterSetIndent(writer, indent);
40801 desret_int(ret_val);
40802 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040803 des_xmlTextWriterPtr(n_writer, writer, 0);
40804 des_int(n_indent, indent, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040805 xmlResetLastError();
40806 if (mem_base != xmlMemBlocks()) {
40807 printf("Leak of %d blocks found in xmlTextWriterSetIndent",
40808 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040809 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040810 printf(" %d", n_writer);
40811 printf(" %d", n_indent);
40812 printf("\n");
40813 }
40814 }
40815 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040816 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040817#endif
40818
Daniel Veillard42595322004-11-08 10:52:06 +000040819 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040820}
40821
40822
40823static int
40824test_xmlTextWriterSetIndentString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040825 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040826
William M. Brack21e4ef22005-01-02 09:53:13 +000040827#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040828 int mem_base;
40829 int ret_val;
40830 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40831 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040832 xmlChar * str; /* the xmlChar string */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040833 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040834
Daniel Veillarde43cc572004-11-03 11:50:29 +000040835 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40836 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
40837 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040838 writer = gen_xmlTextWriterPtr(n_writer, 0);
40839 str = gen_const_xmlChar_ptr(n_str, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040840
William M. Brackf13f77f2004-11-12 16:03:48 +000040841 ret_val = xmlTextWriterSetIndentString(writer, (const xmlChar *)str);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040842 desret_int(ret_val);
40843 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040844 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000040845 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040846 xmlResetLastError();
40847 if (mem_base != xmlMemBlocks()) {
40848 printf("Leak of %d blocks found in xmlTextWriterSetIndentString",
40849 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040850 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040851 printf(" %d", n_writer);
40852 printf(" %d", n_str);
40853 printf("\n");
40854 }
40855 }
40856 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040857 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040858#endif
40859
Daniel Veillard42595322004-11-08 10:52:06 +000040860 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040861}
40862
40863
40864static int
40865test_xmlTextWriterStartAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040866 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040867
William M. Brack21e4ef22005-01-02 09:53:13 +000040868#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040869 int mem_base;
40870 int ret_val;
40871 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40872 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040873 xmlChar * name; /* element name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040874 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040875
Daniel Veillarde43cc572004-11-03 11:50:29 +000040876 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40877 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
40878 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040879 writer = gen_xmlTextWriterPtr(n_writer, 0);
40880 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040881
William M. Brackf13f77f2004-11-12 16:03:48 +000040882 ret_val = xmlTextWriterStartAttribute(writer, (const xmlChar *)name);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040883 desret_int(ret_val);
40884 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040885 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000040886 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040887 xmlResetLastError();
40888 if (mem_base != xmlMemBlocks()) {
40889 printf("Leak of %d blocks found in xmlTextWriterStartAttribute",
40890 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040891 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040892 printf(" %d", n_writer);
40893 printf(" %d", n_name);
40894 printf("\n");
40895 }
40896 }
40897 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040898 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040899#endif
40900
Daniel Veillard42595322004-11-08 10:52:06 +000040901 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040902}
40903
40904
40905static int
40906test_xmlTextWriterStartAttributeNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040907 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040908
William M. Brack21e4ef22005-01-02 09:53:13 +000040909#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040910 int mem_base;
40911 int ret_val;
40912 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40913 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040914 xmlChar * prefix; /* namespace prefix or NULL */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040915 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040916 xmlChar * name; /* element local name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040917 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040918 xmlChar * namespaceURI; /* namespace URI or NULL */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040919 int n_namespaceURI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040920
Daniel Veillarde43cc572004-11-03 11:50:29 +000040921 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40922 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
40923 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
40924 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
40925 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040926 writer = gen_xmlTextWriterPtr(n_writer, 0);
40927 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
40928 name = gen_const_xmlChar_ptr(n_name, 2);
40929 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040930
William M. Brackf13f77f2004-11-12 16:03:48 +000040931 ret_val = xmlTextWriterStartAttributeNS(writer, (const xmlChar *)prefix, (const xmlChar *)name, (const xmlChar *)namespaceURI);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040932 desret_int(ret_val);
40933 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040934 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000040935 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
40936 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
40937 des_const_xmlChar_ptr(n_namespaceURI, (const xmlChar *)namespaceURI, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040938 xmlResetLastError();
40939 if (mem_base != xmlMemBlocks()) {
40940 printf("Leak of %d blocks found in xmlTextWriterStartAttributeNS",
40941 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040942 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040943 printf(" %d", n_writer);
40944 printf(" %d", n_prefix);
40945 printf(" %d", n_name);
40946 printf(" %d", n_namespaceURI);
40947 printf("\n");
40948 }
40949 }
40950 }
40951 }
40952 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040953 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040954#endif
40955
Daniel Veillard42595322004-11-08 10:52:06 +000040956 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040957}
40958
40959
40960static int
40961test_xmlTextWriterStartCDATA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040962 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040963
William M. Brack21e4ef22005-01-02 09:53:13 +000040964#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040965 int mem_base;
40966 int ret_val;
40967 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40968 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040969
Daniel Veillarde43cc572004-11-03 11:50:29 +000040970 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40971 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040972 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040973
40974 ret_val = xmlTextWriterStartCDATA(writer);
40975 desret_int(ret_val);
40976 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040977 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040978 xmlResetLastError();
40979 if (mem_base != xmlMemBlocks()) {
40980 printf("Leak of %d blocks found in xmlTextWriterStartCDATA",
40981 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040982 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040983 printf(" %d", n_writer);
40984 printf("\n");
40985 }
40986 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040987 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040988#endif
40989
Daniel Veillard42595322004-11-08 10:52:06 +000040990 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040991}
40992
40993
40994static int
40995test_xmlTextWriterStartComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040996 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040997
William M. Brack21e4ef22005-01-02 09:53:13 +000040998#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040999 int mem_base;
41000 int ret_val;
41001 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41002 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041003
Daniel Veillarde43cc572004-11-03 11:50:29 +000041004 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41005 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041006 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041007
41008 ret_val = xmlTextWriterStartComment(writer);
41009 desret_int(ret_val);
41010 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041011 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041012 xmlResetLastError();
41013 if (mem_base != xmlMemBlocks()) {
41014 printf("Leak of %d blocks found in xmlTextWriterStartComment",
41015 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041016 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041017 printf(" %d", n_writer);
41018 printf("\n");
41019 }
41020 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041021 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041022#endif
41023
Daniel Veillard42595322004-11-08 10:52:06 +000041024 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041025}
41026
41027
41028static int
41029test_xmlTextWriterStartDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041030 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041031
William M. Brack21e4ef22005-01-02 09:53:13 +000041032#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041033 int mem_base;
41034 int ret_val;
41035 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41036 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041037 xmlChar * name; /* the name of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041038 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041039 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041040 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041041 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041042 int n_sysid;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041043
Daniel Veillarde43cc572004-11-03 11:50:29 +000041044 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41045 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41046 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
41047 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
41048 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041049 writer = gen_xmlTextWriterPtr(n_writer, 0);
41050 name = gen_const_xmlChar_ptr(n_name, 1);
41051 pubid = gen_const_xmlChar_ptr(n_pubid, 2);
41052 sysid = gen_const_xmlChar_ptr(n_sysid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041053
William M. Brackf13f77f2004-11-12 16:03:48 +000041054 ret_val = xmlTextWriterStartDTD(writer, (const xmlChar *)name, (const xmlChar *)pubid, (const xmlChar *)sysid);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041055 desret_int(ret_val);
41056 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041057 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041058 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
41059 des_const_xmlChar_ptr(n_pubid, (const xmlChar *)pubid, 2);
41060 des_const_xmlChar_ptr(n_sysid, (const xmlChar *)sysid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041061 xmlResetLastError();
41062 if (mem_base != xmlMemBlocks()) {
41063 printf("Leak of %d blocks found in xmlTextWriterStartDTD",
41064 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041065 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041066 printf(" %d", n_writer);
41067 printf(" %d", n_name);
41068 printf(" %d", n_pubid);
41069 printf(" %d", n_sysid);
41070 printf("\n");
41071 }
41072 }
41073 }
41074 }
41075 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041076 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041077#endif
41078
Daniel Veillard42595322004-11-08 10:52:06 +000041079 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041080}
41081
41082
41083static int
41084test_xmlTextWriterStartDTDAttlist(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041085 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041086
William M. Brack21e4ef22005-01-02 09:53:13 +000041087#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041088 int mem_base;
41089 int ret_val;
41090 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41091 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041092 xmlChar * name; /* the name of the DTD ATTLIST */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041093 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041094
Daniel Veillarde43cc572004-11-03 11:50:29 +000041095 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41096 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41097 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041098 writer = gen_xmlTextWriterPtr(n_writer, 0);
41099 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041100
William M. Brackf13f77f2004-11-12 16:03:48 +000041101 ret_val = xmlTextWriterStartDTDAttlist(writer, (const xmlChar *)name);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041102 desret_int(ret_val);
41103 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041104 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041105 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041106 xmlResetLastError();
41107 if (mem_base != xmlMemBlocks()) {
41108 printf("Leak of %d blocks found in xmlTextWriterStartDTDAttlist",
41109 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041110 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041111 printf(" %d", n_writer);
41112 printf(" %d", n_name);
41113 printf("\n");
41114 }
41115 }
41116 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041117 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041118#endif
41119
Daniel Veillard42595322004-11-08 10:52:06 +000041120 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041121}
41122
41123
41124static int
41125test_xmlTextWriterStartDTDElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041126 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041127
William M. Brack21e4ef22005-01-02 09:53:13 +000041128#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041129 int mem_base;
41130 int ret_val;
41131 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41132 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041133 xmlChar * name; /* the name of the DTD element */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041134 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041135
Daniel Veillarde43cc572004-11-03 11:50:29 +000041136 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41137 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41138 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041139 writer = gen_xmlTextWriterPtr(n_writer, 0);
41140 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041141
William M. Brackf13f77f2004-11-12 16:03:48 +000041142 ret_val = xmlTextWriterStartDTDElement(writer, (const xmlChar *)name);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041143 desret_int(ret_val);
41144 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041145 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041146 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041147 xmlResetLastError();
41148 if (mem_base != xmlMemBlocks()) {
41149 printf("Leak of %d blocks found in xmlTextWriterStartDTDElement",
41150 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041151 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041152 printf(" %d", n_writer);
41153 printf(" %d", n_name);
41154 printf("\n");
41155 }
41156 }
41157 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041158 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041159#endif
41160
Daniel Veillard42595322004-11-08 10:52:06 +000041161 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041162}
41163
41164
41165static int
41166test_xmlTextWriterStartDTDEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041167 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041168
William M. Brack21e4ef22005-01-02 09:53:13 +000041169#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041170 int mem_base;
41171 int ret_val;
41172 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41173 int n_writer;
41174 int pe; /* TRUE if this is a parameter entity, FALSE if not */
41175 int n_pe;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041176 xmlChar * name; /* the name of the DTD ATTLIST */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041177 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041178
Daniel Veillarde43cc572004-11-03 11:50:29 +000041179 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41180 for (n_pe = 0;n_pe < gen_nb_int;n_pe++) {
41181 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41182 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041183 writer = gen_xmlTextWriterPtr(n_writer, 0);
41184 pe = gen_int(n_pe, 1);
41185 name = gen_const_xmlChar_ptr(n_name, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041186
William M. Brackf13f77f2004-11-12 16:03:48 +000041187 ret_val = xmlTextWriterStartDTDEntity(writer, pe, (const xmlChar *)name);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041188 desret_int(ret_val);
41189 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041190 des_xmlTextWriterPtr(n_writer, writer, 0);
41191 des_int(n_pe, pe, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000041192 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041193 xmlResetLastError();
41194 if (mem_base != xmlMemBlocks()) {
41195 printf("Leak of %d blocks found in xmlTextWriterStartDTDEntity",
41196 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041197 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041198 printf(" %d", n_writer);
41199 printf(" %d", n_pe);
41200 printf(" %d", n_name);
41201 printf("\n");
41202 }
41203 }
41204 }
41205 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041206 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041207#endif
41208
Daniel Veillard42595322004-11-08 10:52:06 +000041209 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041210}
41211
41212
41213static int
41214test_xmlTextWriterStartDocument(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041215 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041216
William M. Brack21e4ef22005-01-02 09:53:13 +000041217#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041218 int mem_base;
41219 int ret_val;
41220 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41221 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041222 char * version; /* the xml version ("1.0") or NULL for default ("1.0") */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041223 int n_version;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041224 char * encoding; /* the encoding or NULL for default */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041225 int n_encoding;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041226 char * standalone; /* "yes" or "no" or NULL for default */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041227 int n_standalone;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041228
Daniel Veillarde43cc572004-11-03 11:50:29 +000041229 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41230 for (n_version = 0;n_version < gen_nb_const_char_ptr;n_version++) {
41231 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
41232 for (n_standalone = 0;n_standalone < gen_nb_const_char_ptr;n_standalone++) {
41233 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041234 writer = gen_xmlTextWriterPtr(n_writer, 0);
41235 version = gen_const_char_ptr(n_version, 1);
41236 encoding = gen_const_char_ptr(n_encoding, 2);
41237 standalone = gen_const_char_ptr(n_standalone, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041238
William M. Brackf13f77f2004-11-12 16:03:48 +000041239 ret_val = xmlTextWriterStartDocument(writer, (const char *)version, (const char *)encoding, (const char *)standalone);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041240 desret_int(ret_val);
41241 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041242 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041243 des_const_char_ptr(n_version, (const char *)version, 1);
41244 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
41245 des_const_char_ptr(n_standalone, (const char *)standalone, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041246 xmlResetLastError();
41247 if (mem_base != xmlMemBlocks()) {
41248 printf("Leak of %d blocks found in xmlTextWriterStartDocument",
41249 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041250 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041251 printf(" %d", n_writer);
41252 printf(" %d", n_version);
41253 printf(" %d", n_encoding);
41254 printf(" %d", n_standalone);
41255 printf("\n");
41256 }
41257 }
41258 }
41259 }
41260 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041261 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041262#endif
41263
Daniel Veillard42595322004-11-08 10:52:06 +000041264 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041265}
41266
41267
41268static int
41269test_xmlTextWriterStartElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041270 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041271
William M. Brack21e4ef22005-01-02 09:53:13 +000041272#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041273 int mem_base;
41274 int ret_val;
41275 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41276 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041277 xmlChar * name; /* element name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041278 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041279
Daniel Veillarde43cc572004-11-03 11:50:29 +000041280 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41281 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41282 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041283 writer = gen_xmlTextWriterPtr(n_writer, 0);
41284 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041285
William M. Brackf13f77f2004-11-12 16:03:48 +000041286 ret_val = xmlTextWriterStartElement(writer, (const xmlChar *)name);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041287 desret_int(ret_val);
41288 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041289 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041290 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041291 xmlResetLastError();
41292 if (mem_base != xmlMemBlocks()) {
41293 printf("Leak of %d blocks found in xmlTextWriterStartElement",
41294 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041295 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041296 printf(" %d", n_writer);
41297 printf(" %d", n_name);
41298 printf("\n");
41299 }
41300 }
41301 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041302 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041303#endif
41304
Daniel Veillard42595322004-11-08 10:52:06 +000041305 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041306}
41307
41308
41309static int
41310test_xmlTextWriterStartElementNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041311 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041312
William M. Brack21e4ef22005-01-02 09:53:13 +000041313#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041314 int mem_base;
41315 int ret_val;
41316 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41317 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041318 xmlChar * prefix; /* namespace prefix or NULL */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041319 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041320 xmlChar * name; /* element local name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041321 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041322 xmlChar * namespaceURI; /* namespace URI or NULL */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041323 int n_namespaceURI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041324
Daniel Veillarde43cc572004-11-03 11:50:29 +000041325 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41326 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
41327 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41328 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
41329 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041330 writer = gen_xmlTextWriterPtr(n_writer, 0);
41331 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
41332 name = gen_const_xmlChar_ptr(n_name, 2);
41333 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041334
William M. Brackf13f77f2004-11-12 16:03:48 +000041335 ret_val = xmlTextWriterStartElementNS(writer, (const xmlChar *)prefix, (const xmlChar *)name, (const xmlChar *)namespaceURI);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041336 desret_int(ret_val);
41337 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041338 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041339 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
41340 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
41341 des_const_xmlChar_ptr(n_namespaceURI, (const xmlChar *)namespaceURI, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041342 xmlResetLastError();
41343 if (mem_base != xmlMemBlocks()) {
41344 printf("Leak of %d blocks found in xmlTextWriterStartElementNS",
41345 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041346 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041347 printf(" %d", n_writer);
41348 printf(" %d", n_prefix);
41349 printf(" %d", n_name);
41350 printf(" %d", n_namespaceURI);
41351 printf("\n");
41352 }
41353 }
41354 }
41355 }
41356 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041357 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041358#endif
41359
Daniel Veillard42595322004-11-08 10:52:06 +000041360 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041361}
41362
41363
41364static int
41365test_xmlTextWriterStartPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041366 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041367
William M. Brack21e4ef22005-01-02 09:53:13 +000041368#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041369 int mem_base;
41370 int ret_val;
41371 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41372 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041373 xmlChar * target; /* PI target */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041374 int n_target;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041375
Daniel Veillarde43cc572004-11-03 11:50:29 +000041376 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41377 for (n_target = 0;n_target < gen_nb_const_xmlChar_ptr;n_target++) {
41378 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041379 writer = gen_xmlTextWriterPtr(n_writer, 0);
41380 target = gen_const_xmlChar_ptr(n_target, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041381
William M. Brackf13f77f2004-11-12 16:03:48 +000041382 ret_val = xmlTextWriterStartPI(writer, (const xmlChar *)target);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041383 desret_int(ret_val);
41384 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041385 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041386 des_const_xmlChar_ptr(n_target, (const xmlChar *)target, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041387 xmlResetLastError();
41388 if (mem_base != xmlMemBlocks()) {
41389 printf("Leak of %d blocks found in xmlTextWriterStartPI",
41390 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041391 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041392 printf(" %d", n_writer);
41393 printf(" %d", n_target);
41394 printf("\n");
41395 }
41396 }
41397 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041398 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041399#endif
41400
Daniel Veillard42595322004-11-08 10:52:06 +000041401 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041402}
41403
41404
41405static int
41406test_xmlTextWriterWriteAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041407 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041408
William M. Brack21e4ef22005-01-02 09:53:13 +000041409#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041410 int mem_base;
41411 int ret_val;
41412 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41413 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041414 xmlChar * name; /* attribute name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041415 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041416 xmlChar * content; /* attribute content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041417 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041418
Daniel Veillarde43cc572004-11-03 11:50:29 +000041419 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41420 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41421 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41422 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041423 writer = gen_xmlTextWriterPtr(n_writer, 0);
41424 name = gen_const_xmlChar_ptr(n_name, 1);
41425 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041426
William M. Brackf13f77f2004-11-12 16:03:48 +000041427 ret_val = xmlTextWriterWriteAttribute(writer, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041428 desret_int(ret_val);
41429 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041430 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041431 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
41432 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041433 xmlResetLastError();
41434 if (mem_base != xmlMemBlocks()) {
41435 printf("Leak of %d blocks found in xmlTextWriterWriteAttribute",
41436 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041437 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041438 printf(" %d", n_writer);
41439 printf(" %d", n_name);
41440 printf(" %d", n_content);
41441 printf("\n");
41442 }
41443 }
41444 }
41445 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041446 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041447#endif
41448
Daniel Veillard42595322004-11-08 10:52:06 +000041449 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041450}
41451
41452
41453static int
41454test_xmlTextWriterWriteAttributeNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041455 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041456
William M. Brack21e4ef22005-01-02 09:53:13 +000041457#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041458 int mem_base;
41459 int ret_val;
41460 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41461 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041462 xmlChar * prefix; /* namespace prefix */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041463 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041464 xmlChar * name; /* attribute local name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041465 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041466 xmlChar * namespaceURI; /* namespace URI */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041467 int n_namespaceURI;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041468 xmlChar * content; /* attribute content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041469 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041470
Daniel Veillarde43cc572004-11-03 11:50:29 +000041471 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41472 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
41473 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41474 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
41475 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41476 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041477 writer = gen_xmlTextWriterPtr(n_writer, 0);
41478 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
41479 name = gen_const_xmlChar_ptr(n_name, 2);
41480 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 3);
41481 content = gen_const_xmlChar_ptr(n_content, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041482
William M. Brackf13f77f2004-11-12 16:03:48 +000041483 ret_val = xmlTextWriterWriteAttributeNS(writer, (const xmlChar *)prefix, (const xmlChar *)name, (const xmlChar *)namespaceURI, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041484 desret_int(ret_val);
41485 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041486 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041487 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
41488 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
41489 des_const_xmlChar_ptr(n_namespaceURI, (const xmlChar *)namespaceURI, 3);
41490 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041491 xmlResetLastError();
41492 if (mem_base != xmlMemBlocks()) {
41493 printf("Leak of %d blocks found in xmlTextWriterWriteAttributeNS",
41494 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041495 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041496 printf(" %d", n_writer);
41497 printf(" %d", n_prefix);
41498 printf(" %d", n_name);
41499 printf(" %d", n_namespaceURI);
41500 printf(" %d", n_content);
41501 printf("\n");
41502 }
41503 }
41504 }
41505 }
41506 }
41507 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041508 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041509#endif
41510
Daniel Veillard42595322004-11-08 10:52:06 +000041511 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041512}
41513
41514
41515static int
41516test_xmlTextWriterWriteBase64(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041517 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041518
William M. Brack21e4ef22005-01-02 09:53:13 +000041519#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041520 int mem_base;
41521 int ret_val;
41522 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41523 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041524 char * data; /* binary data */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041525 int n_data;
41526 int start; /* the position within the data of the first byte to encode */
41527 int n_start;
41528 int len; /* the number of bytes to encode */
41529 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041530
Daniel Veillarde43cc572004-11-03 11:50:29 +000041531 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41532 for (n_data = 0;n_data < gen_nb_const_char_ptr;n_data++) {
41533 for (n_start = 0;n_start < gen_nb_int;n_start++) {
41534 for (n_len = 0;n_len < gen_nb_int;n_len++) {
41535 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041536 writer = gen_xmlTextWriterPtr(n_writer, 0);
41537 data = gen_const_char_ptr(n_data, 1);
41538 start = gen_int(n_start, 2);
41539 len = gen_int(n_len, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041540
William M. Brackf13f77f2004-11-12 16:03:48 +000041541 ret_val = xmlTextWriterWriteBase64(writer, (const char *)data, start, len);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041542 desret_int(ret_val);
41543 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041544 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041545 des_const_char_ptr(n_data, (const char *)data, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000041546 des_int(n_start, start, 2);
41547 des_int(n_len, len, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041548 xmlResetLastError();
41549 if (mem_base != xmlMemBlocks()) {
41550 printf("Leak of %d blocks found in xmlTextWriterWriteBase64",
41551 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041552 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041553 printf(" %d", n_writer);
41554 printf(" %d", n_data);
41555 printf(" %d", n_start);
41556 printf(" %d", n_len);
41557 printf("\n");
41558 }
41559 }
41560 }
41561 }
41562 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041563 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041564#endif
41565
Daniel Veillard42595322004-11-08 10:52:06 +000041566 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041567}
41568
41569
41570static int
41571test_xmlTextWriterWriteBinHex(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041572 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041573
William M. Brack21e4ef22005-01-02 09:53:13 +000041574#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041575 int mem_base;
41576 int ret_val;
41577 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41578 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041579 char * data; /* binary data */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041580 int n_data;
41581 int start; /* the position within the data of the first byte to encode */
41582 int n_start;
41583 int len; /* the number of bytes to encode */
41584 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041585
Daniel Veillarde43cc572004-11-03 11:50:29 +000041586 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41587 for (n_data = 0;n_data < gen_nb_const_char_ptr;n_data++) {
41588 for (n_start = 0;n_start < gen_nb_int;n_start++) {
41589 for (n_len = 0;n_len < gen_nb_int;n_len++) {
41590 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041591 writer = gen_xmlTextWriterPtr(n_writer, 0);
41592 data = gen_const_char_ptr(n_data, 1);
41593 start = gen_int(n_start, 2);
41594 len = gen_int(n_len, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041595
William M. Brackf13f77f2004-11-12 16:03:48 +000041596 ret_val = xmlTextWriterWriteBinHex(writer, (const char *)data, start, len);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041597 desret_int(ret_val);
41598 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041599 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041600 des_const_char_ptr(n_data, (const char *)data, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000041601 des_int(n_start, start, 2);
41602 des_int(n_len, len, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041603 xmlResetLastError();
41604 if (mem_base != xmlMemBlocks()) {
41605 printf("Leak of %d blocks found in xmlTextWriterWriteBinHex",
41606 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041607 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041608 printf(" %d", n_writer);
41609 printf(" %d", n_data);
41610 printf(" %d", n_start);
41611 printf(" %d", n_len);
41612 printf("\n");
41613 }
41614 }
41615 }
41616 }
41617 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041618 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041619#endif
41620
Daniel Veillard42595322004-11-08 10:52:06 +000041621 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041622}
41623
41624
41625static int
41626test_xmlTextWriterWriteCDATA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041627 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041628
William M. Brack21e4ef22005-01-02 09:53:13 +000041629#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041630 int mem_base;
41631 int ret_val;
41632 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41633 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041634 xmlChar * content; /* CDATA content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041635 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041636
Daniel Veillarde43cc572004-11-03 11:50:29 +000041637 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41638 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41639 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041640 writer = gen_xmlTextWriterPtr(n_writer, 0);
41641 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041642
William M. Brackf13f77f2004-11-12 16:03:48 +000041643 ret_val = xmlTextWriterWriteCDATA(writer, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041644 desret_int(ret_val);
41645 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041646 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041647 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041648 xmlResetLastError();
41649 if (mem_base != xmlMemBlocks()) {
41650 printf("Leak of %d blocks found in xmlTextWriterWriteCDATA",
41651 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041652 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041653 printf(" %d", n_writer);
41654 printf(" %d", n_content);
41655 printf("\n");
41656 }
41657 }
41658 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041659 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041660#endif
41661
Daniel Veillard42595322004-11-08 10:52:06 +000041662 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041663}
41664
41665
41666static int
41667test_xmlTextWriterWriteComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041668 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041669
William M. Brack21e4ef22005-01-02 09:53:13 +000041670#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041671 int mem_base;
41672 int ret_val;
41673 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41674 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041675 xmlChar * content; /* comment string */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041676 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041677
Daniel Veillarde43cc572004-11-03 11:50:29 +000041678 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41679 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41680 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041681 writer = gen_xmlTextWriterPtr(n_writer, 0);
41682 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041683
William M. Brackf13f77f2004-11-12 16:03:48 +000041684 ret_val = xmlTextWriterWriteComment(writer, (const xmlChar *)content);
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_content, (const xmlChar *)content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041689 xmlResetLastError();
41690 if (mem_base != xmlMemBlocks()) {
41691 printf("Leak of %d blocks found in xmlTextWriterWriteComment",
41692 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041693 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041694 printf(" %d", n_writer);
41695 printf(" %d", n_content);
41696 printf("\n");
41697 }
41698 }
41699 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041700 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041701#endif
41702
Daniel Veillard42595322004-11-08 10:52:06 +000041703 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041704}
41705
41706
41707static int
41708test_xmlTextWriterWriteDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041709 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041710
William M. Brack21e4ef22005-01-02 09:53:13 +000041711#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041712 int mem_base;
41713 int ret_val;
41714 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41715 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041716 xmlChar * name; /* the name of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041717 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041718 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041719 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041720 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041721 int n_sysid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041722 xmlChar * subset; /* string content of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041723 int n_subset;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041724
Daniel Veillarde43cc572004-11-03 11:50:29 +000041725 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41726 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41727 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
41728 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
41729 for (n_subset = 0;n_subset < gen_nb_const_xmlChar_ptr;n_subset++) {
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 pubid = gen_const_xmlChar_ptr(n_pubid, 2);
41734 sysid = gen_const_xmlChar_ptr(n_sysid, 3);
41735 subset = gen_const_xmlChar_ptr(n_subset, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041736
William M. Brackf13f77f2004-11-12 16:03:48 +000041737 ret_val = xmlTextWriterWriteDTD(writer, (const xmlChar *)name, (const xmlChar *)pubid, (const xmlChar *)sysid, (const xmlChar *)subset);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041738 desret_int(ret_val);
41739 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041740 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041741 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
41742 des_const_xmlChar_ptr(n_pubid, (const xmlChar *)pubid, 2);
41743 des_const_xmlChar_ptr(n_sysid, (const xmlChar *)sysid, 3);
41744 des_const_xmlChar_ptr(n_subset, (const xmlChar *)subset, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041745 xmlResetLastError();
41746 if (mem_base != xmlMemBlocks()) {
41747 printf("Leak of %d blocks found in xmlTextWriterWriteDTD",
41748 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041749 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041750 printf(" %d", n_writer);
41751 printf(" %d", n_name);
41752 printf(" %d", n_pubid);
41753 printf(" %d", n_sysid);
41754 printf(" %d", n_subset);
41755 printf("\n");
41756 }
41757 }
41758 }
41759 }
41760 }
41761 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041762 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041763#endif
41764
Daniel Veillard42595322004-11-08 10:52:06 +000041765 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041766}
41767
41768
41769static int
41770test_xmlTextWriterWriteDTDAttlist(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041771 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041772
William M. Brack21e4ef22005-01-02 09:53:13 +000041773#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041774 int mem_base;
41775 int ret_val;
41776 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41777 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041778 xmlChar * name; /* the name of the DTD ATTLIST */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041779 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041780 xmlChar * content; /* content of the ATTLIST */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041781 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041782
Daniel Veillarde43cc572004-11-03 11:50:29 +000041783 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41784 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41785 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41786 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041787 writer = gen_xmlTextWriterPtr(n_writer, 0);
41788 name = gen_const_xmlChar_ptr(n_name, 1);
41789 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041790
William M. Brackf13f77f2004-11-12 16:03:48 +000041791 ret_val = xmlTextWriterWriteDTDAttlist(writer, (const xmlChar *)name, (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_name, (const xmlChar *)name, 1);
41796 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041797 xmlResetLastError();
41798 if (mem_base != xmlMemBlocks()) {
41799 printf("Leak of %d blocks found in xmlTextWriterWriteDTDAttlist",
41800 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041801 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041802 printf(" %d", n_writer);
41803 printf(" %d", n_name);
41804 printf(" %d", n_content);
41805 printf("\n");
41806 }
41807 }
41808 }
41809 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041810 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041811#endif
41812
Daniel Veillard42595322004-11-08 10:52:06 +000041813 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041814}
41815
41816
41817static int
41818test_xmlTextWriterWriteDTDElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041819 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041820
William M. Brack21e4ef22005-01-02 09:53:13 +000041821#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041822 int mem_base;
41823 int ret_val;
41824 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41825 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041826 xmlChar * name; /* the name of the DTD element */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041827 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041828 xmlChar * content; /* content of the element */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041829 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041830
Daniel Veillarde43cc572004-11-03 11:50:29 +000041831 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41832 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41833 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41834 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041835 writer = gen_xmlTextWriterPtr(n_writer, 0);
41836 name = gen_const_xmlChar_ptr(n_name, 1);
41837 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041838
William M. Brackf13f77f2004-11-12 16:03:48 +000041839 ret_val = xmlTextWriterWriteDTDElement(writer, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041840 desret_int(ret_val);
41841 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041842 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041843 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
41844 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041845 xmlResetLastError();
41846 if (mem_base != xmlMemBlocks()) {
41847 printf("Leak of %d blocks found in xmlTextWriterWriteDTDElement",
41848 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041849 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041850 printf(" %d", n_writer);
41851 printf(" %d", n_name);
41852 printf(" %d", n_content);
41853 printf("\n");
41854 }
41855 }
41856 }
41857 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041858 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041859#endif
41860
Daniel Veillard42595322004-11-08 10:52:06 +000041861 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041862}
41863
41864
41865static int
41866test_xmlTextWriterWriteDTDEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041867 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041868
William M. Brack21e4ef22005-01-02 09:53:13 +000041869#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041870 int mem_base;
41871 int ret_val;
41872 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41873 int n_writer;
41874 int pe; /* TRUE if this is a parameter entity, FALSE if not */
41875 int n_pe;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041876 xmlChar * name; /* the name of the DTD entity */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041877 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041878 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041879 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041880 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041881 int n_sysid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041882 xmlChar * ndataid; /* the xml notation name. */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041883 int n_ndataid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041884 xmlChar * content; /* content of the entity */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041885 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041886
Daniel Veillarde43cc572004-11-03 11:50:29 +000041887 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41888 for (n_pe = 0;n_pe < gen_nb_int;n_pe++) {
41889 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41890 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
41891 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
41892 for (n_ndataid = 0;n_ndataid < gen_nb_const_xmlChar_ptr;n_ndataid++) {
41893 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41894 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041895 writer = gen_xmlTextWriterPtr(n_writer, 0);
41896 pe = gen_int(n_pe, 1);
41897 name = gen_const_xmlChar_ptr(n_name, 2);
41898 pubid = gen_const_xmlChar_ptr(n_pubid, 3);
41899 sysid = gen_const_xmlChar_ptr(n_sysid, 4);
41900 ndataid = gen_const_xmlChar_ptr(n_ndataid, 5);
41901 content = gen_const_xmlChar_ptr(n_content, 6);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041902
William M. Brackf13f77f2004-11-12 16:03:48 +000041903 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 +000041904 desret_int(ret_val);
41905 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041906 des_xmlTextWriterPtr(n_writer, writer, 0);
41907 des_int(n_pe, pe, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000041908 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
41909 des_const_xmlChar_ptr(n_pubid, (const xmlChar *)pubid, 3);
41910 des_const_xmlChar_ptr(n_sysid, (const xmlChar *)sysid, 4);
41911 des_const_xmlChar_ptr(n_ndataid, (const xmlChar *)ndataid, 5);
41912 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 6);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041913 xmlResetLastError();
41914 if (mem_base != xmlMemBlocks()) {
41915 printf("Leak of %d blocks found in xmlTextWriterWriteDTDEntity",
41916 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041917 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041918 printf(" %d", n_writer);
41919 printf(" %d", n_pe);
41920 printf(" %d", n_name);
41921 printf(" %d", n_pubid);
41922 printf(" %d", n_sysid);
41923 printf(" %d", n_ndataid);
41924 printf(" %d", n_content);
41925 printf("\n");
41926 }
41927 }
41928 }
41929 }
41930 }
41931 }
41932 }
41933 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041934 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041935#endif
41936
Daniel Veillard42595322004-11-08 10:52:06 +000041937 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041938}
41939
41940
41941static int
41942test_xmlTextWriterWriteDTDExternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041943 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041944
William M. Brack21e4ef22005-01-02 09:53:13 +000041945#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041946 int mem_base;
41947 int ret_val;
41948 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41949 int n_writer;
41950 int pe; /* TRUE if this is a parameter entity, FALSE if not */
41951 int n_pe;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041952 xmlChar * name; /* the name of the DTD entity */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041953 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041954 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041955 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041956 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041957 int n_sysid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041958 xmlChar * ndataid; /* the xml notation name. */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041959 int n_ndataid;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041960
Daniel Veillarde43cc572004-11-03 11:50:29 +000041961 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41962 for (n_pe = 0;n_pe < gen_nb_int;n_pe++) {
41963 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41964 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
41965 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
41966 for (n_ndataid = 0;n_ndataid < gen_nb_const_xmlChar_ptr;n_ndataid++) {
41967 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041968 writer = gen_xmlTextWriterPtr(n_writer, 0);
41969 pe = gen_int(n_pe, 1);
41970 name = gen_const_xmlChar_ptr(n_name, 2);
41971 pubid = gen_const_xmlChar_ptr(n_pubid, 3);
41972 sysid = gen_const_xmlChar_ptr(n_sysid, 4);
41973 ndataid = gen_const_xmlChar_ptr(n_ndataid, 5);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041974
William M. Brackf13f77f2004-11-12 16:03:48 +000041975 ret_val = xmlTextWriterWriteDTDExternalEntity(writer, pe, (const xmlChar *)name, (const xmlChar *)pubid, (const xmlChar *)sysid, (const xmlChar *)ndataid);
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);
41979 des_int(n_pe, pe, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000041980 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
41981 des_const_xmlChar_ptr(n_pubid, (const xmlChar *)pubid, 3);
41982 des_const_xmlChar_ptr(n_sysid, (const xmlChar *)sysid, 4);
41983 des_const_xmlChar_ptr(n_ndataid, (const xmlChar *)ndataid, 5);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041984 xmlResetLastError();
41985 if (mem_base != xmlMemBlocks()) {
41986 printf("Leak of %d blocks found in xmlTextWriterWriteDTDExternalEntity",
41987 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041988 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041989 printf(" %d", n_writer);
41990 printf(" %d", n_pe);
41991 printf(" %d", n_name);
41992 printf(" %d", n_pubid);
41993 printf(" %d", n_sysid);
41994 printf(" %d", n_ndataid);
41995 printf("\n");
41996 }
41997 }
41998 }
41999 }
42000 }
42001 }
42002 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042003 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042004#endif
42005
Daniel Veillard42595322004-11-08 10:52:06 +000042006 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042007}
42008
42009
42010static int
42011test_xmlTextWriterWriteDTDExternalEntityContents(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042012 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042013
William M. Brack21e4ef22005-01-02 09:53:13 +000042014#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042015 int mem_base;
42016 int ret_val;
42017 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42018 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042019 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042020 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042021 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042022 int n_sysid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042023 xmlChar * ndataid; /* the xml notation name. */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042024 int n_ndataid;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042025
Daniel Veillarde43cc572004-11-03 11:50:29 +000042026 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42027 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
42028 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
42029 for (n_ndataid = 0;n_ndataid < gen_nb_const_xmlChar_ptr;n_ndataid++) {
42030 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042031 writer = gen_xmlTextWriterPtr(n_writer, 0);
42032 pubid = gen_const_xmlChar_ptr(n_pubid, 1);
42033 sysid = gen_const_xmlChar_ptr(n_sysid, 2);
42034 ndataid = gen_const_xmlChar_ptr(n_ndataid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042035
William M. Brackf13f77f2004-11-12 16:03:48 +000042036 ret_val = xmlTextWriterWriteDTDExternalEntityContents(writer, (const xmlChar *)pubid, (const xmlChar *)sysid, (const xmlChar *)ndataid);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042037 desret_int(ret_val);
42038 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042039 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000042040 des_const_xmlChar_ptr(n_pubid, (const xmlChar *)pubid, 1);
42041 des_const_xmlChar_ptr(n_sysid, (const xmlChar *)sysid, 2);
42042 des_const_xmlChar_ptr(n_ndataid, (const xmlChar *)ndataid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042043 xmlResetLastError();
42044 if (mem_base != xmlMemBlocks()) {
42045 printf("Leak of %d blocks found in xmlTextWriterWriteDTDExternalEntityContents",
42046 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042047 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042048 printf(" %d", n_writer);
42049 printf(" %d", n_pubid);
42050 printf(" %d", n_sysid);
42051 printf(" %d", n_ndataid);
42052 printf("\n");
42053 }
42054 }
42055 }
42056 }
42057 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042058 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042059#endif
42060
Daniel Veillard42595322004-11-08 10:52:06 +000042061 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042062}
42063
42064
42065static int
42066test_xmlTextWriterWriteDTDInternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042067 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042068
William M. Brack21e4ef22005-01-02 09:53:13 +000042069#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042070 int mem_base;
42071 int ret_val;
42072 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42073 int n_writer;
42074 int pe; /* TRUE if this is a parameter entity, FALSE if not */
42075 int n_pe;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042076 xmlChar * name; /* the name of the DTD entity */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042077 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042078 xmlChar * content; /* content of the entity */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042079 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042080
Daniel Veillarde43cc572004-11-03 11:50:29 +000042081 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42082 for (n_pe = 0;n_pe < gen_nb_int;n_pe++) {
42083 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
42084 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
42085 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042086 writer = gen_xmlTextWriterPtr(n_writer, 0);
42087 pe = gen_int(n_pe, 1);
42088 name = gen_const_xmlChar_ptr(n_name, 2);
42089 content = gen_const_xmlChar_ptr(n_content, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042090
William M. Brackf13f77f2004-11-12 16:03:48 +000042091 ret_val = xmlTextWriterWriteDTDInternalEntity(writer, pe, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042092 desret_int(ret_val);
42093 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042094 des_xmlTextWriterPtr(n_writer, writer, 0);
42095 des_int(n_pe, pe, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000042096 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
42097 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042098 xmlResetLastError();
42099 if (mem_base != xmlMemBlocks()) {
42100 printf("Leak of %d blocks found in xmlTextWriterWriteDTDInternalEntity",
42101 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042102 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042103 printf(" %d", n_writer);
42104 printf(" %d", n_pe);
42105 printf(" %d", n_name);
42106 printf(" %d", n_content);
42107 printf("\n");
42108 }
42109 }
42110 }
42111 }
42112 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042113 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042114#endif
42115
Daniel Veillard42595322004-11-08 10:52:06 +000042116 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042117}
42118
42119
42120static int
42121test_xmlTextWriterWriteDTDNotation(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042122 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042123
William M. Brack21e4ef22005-01-02 09:53:13 +000042124#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042125 int mem_base;
42126 int ret_val;
42127 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42128 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042129 xmlChar * name; /* the name of the xml notation */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042130 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042131 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042132 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042133 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042134 int n_sysid;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042135
Daniel Veillarde43cc572004-11-03 11:50:29 +000042136 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42137 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
42138 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
42139 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
42140 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042141 writer = gen_xmlTextWriterPtr(n_writer, 0);
42142 name = gen_const_xmlChar_ptr(n_name, 1);
42143 pubid = gen_const_xmlChar_ptr(n_pubid, 2);
42144 sysid = gen_const_xmlChar_ptr(n_sysid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042145
William M. Brackf13f77f2004-11-12 16:03:48 +000042146 ret_val = xmlTextWriterWriteDTDNotation(writer, (const xmlChar *)name, (const xmlChar *)pubid, (const xmlChar *)sysid);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042147 desret_int(ret_val);
42148 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042149 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000042150 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
42151 des_const_xmlChar_ptr(n_pubid, (const xmlChar *)pubid, 2);
42152 des_const_xmlChar_ptr(n_sysid, (const xmlChar *)sysid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042153 xmlResetLastError();
42154 if (mem_base != xmlMemBlocks()) {
42155 printf("Leak of %d blocks found in xmlTextWriterWriteDTDNotation",
42156 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042157 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042158 printf(" %d", n_writer);
42159 printf(" %d", n_name);
42160 printf(" %d", n_pubid);
42161 printf(" %d", n_sysid);
42162 printf("\n");
42163 }
42164 }
42165 }
42166 }
42167 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042168 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042169#endif
42170
Daniel Veillard42595322004-11-08 10:52:06 +000042171 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042172}
42173
42174
42175static int
42176test_xmlTextWriterWriteElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042177 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042178
William M. Brack21e4ef22005-01-02 09:53:13 +000042179#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042180 int mem_base;
42181 int ret_val;
42182 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42183 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042184 xmlChar * name; /* element name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042185 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042186 xmlChar * content; /* element content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042187 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042188
Daniel Veillarde43cc572004-11-03 11:50:29 +000042189 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42190 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
42191 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
42192 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042193 writer = gen_xmlTextWriterPtr(n_writer, 0);
42194 name = gen_const_xmlChar_ptr(n_name, 1);
42195 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042196
William M. Brackf13f77f2004-11-12 16:03:48 +000042197 ret_val = xmlTextWriterWriteElement(writer, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042198 desret_int(ret_val);
42199 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042200 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000042201 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
42202 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042203 xmlResetLastError();
42204 if (mem_base != xmlMemBlocks()) {
42205 printf("Leak of %d blocks found in xmlTextWriterWriteElement",
42206 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042207 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042208 printf(" %d", n_writer);
42209 printf(" %d", n_name);
42210 printf(" %d", n_content);
42211 printf("\n");
42212 }
42213 }
42214 }
42215 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042216 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042217#endif
42218
Daniel Veillard42595322004-11-08 10:52:06 +000042219 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042220}
42221
42222
42223static int
42224test_xmlTextWriterWriteElementNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042225 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042226
William M. Brack21e4ef22005-01-02 09:53:13 +000042227#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042228 int mem_base;
42229 int ret_val;
42230 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42231 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042232 xmlChar * prefix; /* namespace prefix */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042233 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042234 xmlChar * name; /* element local name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042235 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042236 xmlChar * namespaceURI; /* namespace URI */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042237 int n_namespaceURI;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042238 xmlChar * content; /* element content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042239 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042240
Daniel Veillarde43cc572004-11-03 11:50:29 +000042241 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42242 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
42243 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
42244 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
42245 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
42246 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042247 writer = gen_xmlTextWriterPtr(n_writer, 0);
42248 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
42249 name = gen_const_xmlChar_ptr(n_name, 2);
42250 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 3);
42251 content = gen_const_xmlChar_ptr(n_content, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042252
William M. Brackf13f77f2004-11-12 16:03:48 +000042253 ret_val = xmlTextWriterWriteElementNS(writer, (const xmlChar *)prefix, (const xmlChar *)name, (const xmlChar *)namespaceURI, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042254 desret_int(ret_val);
42255 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042256 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000042257 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
42258 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
42259 des_const_xmlChar_ptr(n_namespaceURI, (const xmlChar *)namespaceURI, 3);
42260 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042261 xmlResetLastError();
42262 if (mem_base != xmlMemBlocks()) {
42263 printf("Leak of %d blocks found in xmlTextWriterWriteElementNS",
42264 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042265 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042266 printf(" %d", n_writer);
42267 printf(" %d", n_prefix);
42268 printf(" %d", n_name);
42269 printf(" %d", n_namespaceURI);
42270 printf(" %d", n_content);
42271 printf("\n");
42272 }
42273 }
42274 }
42275 }
42276 }
42277 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042278 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042279#endif
42280
Daniel Veillard42595322004-11-08 10:52:06 +000042281 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042282}
42283
42284
42285static int
42286test_xmlTextWriterWriteFormatAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042287 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042288
42289
42290 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042291 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042292}
42293
42294
42295static int
42296test_xmlTextWriterWriteFormatAttributeNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042297 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042298
42299
42300 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042301 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042302}
42303
42304
42305static int
42306test_xmlTextWriterWriteFormatCDATA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042307 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042308
42309
42310 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042311 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042312}
42313
42314
42315static int
42316test_xmlTextWriterWriteFormatComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042317 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042318
42319
42320 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042321 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042322}
42323
42324
42325static int
42326test_xmlTextWriterWriteFormatDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042327 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042328
42329
42330 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042331 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042332}
42333
42334
42335static int
42336test_xmlTextWriterWriteFormatDTDAttlist(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042337 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042338
42339
42340 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042341 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042342}
42343
42344
42345static int
42346test_xmlTextWriterWriteFormatDTDElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042347 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042348
42349
42350 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042351 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042352}
42353
42354
42355static int
42356test_xmlTextWriterWriteFormatDTDInternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042357 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042358
42359
42360 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042361 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042362}
42363
42364
42365static int
42366test_xmlTextWriterWriteFormatElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042367 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042368
42369
42370 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042371 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042372}
42373
42374
42375static int
42376test_xmlTextWriterWriteFormatElementNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042377 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042378
42379
42380 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042381 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042382}
42383
42384
42385static int
42386test_xmlTextWriterWriteFormatPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042387 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042388
42389
42390 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042391 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042392}
42393
42394
42395static int
42396test_xmlTextWriterWriteFormatRaw(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042397 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042398
42399
42400 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042401 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042402}
42403
42404
42405static int
42406test_xmlTextWriterWriteFormatString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042407 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042408
42409
42410 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042411 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042412}
42413
42414
42415static int
42416test_xmlTextWriterWritePI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042417 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042418
William M. Brack21e4ef22005-01-02 09:53:13 +000042419#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042420 int mem_base;
42421 int ret_val;
42422 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42423 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042424 xmlChar * target; /* PI target */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042425 int n_target;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042426 xmlChar * content; /* PI content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042427 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042428
Daniel Veillarde43cc572004-11-03 11:50:29 +000042429 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42430 for (n_target = 0;n_target < gen_nb_const_xmlChar_ptr;n_target++) {
42431 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
42432 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042433 writer = gen_xmlTextWriterPtr(n_writer, 0);
42434 target = gen_const_xmlChar_ptr(n_target, 1);
42435 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042436
William M. Brackf13f77f2004-11-12 16:03:48 +000042437 ret_val = xmlTextWriterWritePI(writer, (const xmlChar *)target, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042438 desret_int(ret_val);
42439 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042440 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000042441 des_const_xmlChar_ptr(n_target, (const xmlChar *)target, 1);
42442 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042443 xmlResetLastError();
42444 if (mem_base != xmlMemBlocks()) {
42445 printf("Leak of %d blocks found in xmlTextWriterWritePI",
42446 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042447 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042448 printf(" %d", n_writer);
42449 printf(" %d", n_target);
42450 printf(" %d", n_content);
42451 printf("\n");
42452 }
42453 }
42454 }
42455 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042456 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042457#endif
42458
Daniel Veillard42595322004-11-08 10:52:06 +000042459 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042460}
42461
42462
42463static int
42464test_xmlTextWriterWriteRaw(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042465 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042466
William M. Brack21e4ef22005-01-02 09:53:13 +000042467#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042468 int mem_base;
42469 int ret_val;
42470 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42471 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042472 xmlChar * content; /* text string */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042473 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042474
Daniel Veillarde43cc572004-11-03 11:50:29 +000042475 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42476 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
42477 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042478 writer = gen_xmlTextWriterPtr(n_writer, 0);
42479 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042480
William M. Brackf13f77f2004-11-12 16:03:48 +000042481 ret_val = xmlTextWriterWriteRaw(writer, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042482 desret_int(ret_val);
42483 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042484 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000042485 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042486 xmlResetLastError();
42487 if (mem_base != xmlMemBlocks()) {
42488 printf("Leak of %d blocks found in xmlTextWriterWriteRaw",
42489 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042490 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042491 printf(" %d", n_writer);
42492 printf(" %d", n_content);
42493 printf("\n");
42494 }
42495 }
42496 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042497 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042498#endif
42499
Daniel Veillard42595322004-11-08 10:52:06 +000042500 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042501}
42502
42503
42504static int
42505test_xmlTextWriterWriteRawLen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042506 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042507
William M. Brack21e4ef22005-01-02 09:53:13 +000042508#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042509 int mem_base;
42510 int ret_val;
42511 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42512 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042513 xmlChar * content; /* text string */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042514 int n_content;
42515 int len; /* length of the text string */
42516 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042517
Daniel Veillarde43cc572004-11-03 11:50:29 +000042518 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42519 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
42520 for (n_len = 0;n_len < gen_nb_int;n_len++) {
42521 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042522 writer = gen_xmlTextWriterPtr(n_writer, 0);
42523 content = gen_const_xmlChar_ptr(n_content, 1);
42524 len = gen_int(n_len, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042525
William M. Brackf13f77f2004-11-12 16:03:48 +000042526 ret_val = xmlTextWriterWriteRawLen(writer, (const xmlChar *)content, len);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042527 desret_int(ret_val);
42528 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042529 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000042530 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000042531 des_int(n_len, len, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042532 xmlResetLastError();
42533 if (mem_base != xmlMemBlocks()) {
42534 printf("Leak of %d blocks found in xmlTextWriterWriteRawLen",
42535 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042536 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042537 printf(" %d", n_writer);
42538 printf(" %d", n_content);
42539 printf(" %d", n_len);
42540 printf("\n");
42541 }
42542 }
42543 }
42544 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042545 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +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_xmlTextWriterWriteString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042554 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042555
William M. Brack21e4ef22005-01-02 09:53:13 +000042556#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042557 int mem_base;
42558 int ret_val;
42559 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42560 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042561 xmlChar * content; /* text string */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042562 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042563
Daniel Veillarde43cc572004-11-03 11:50:29 +000042564 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42565 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
42566 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042567 writer = gen_xmlTextWriterPtr(n_writer, 0);
42568 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042569
William M. Brackf13f77f2004-11-12 16:03:48 +000042570 ret_val = xmlTextWriterWriteString(writer, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042571 desret_int(ret_val);
42572 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042573 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000042574 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042575 xmlResetLastError();
42576 if (mem_base != xmlMemBlocks()) {
42577 printf("Leak of %d blocks found in xmlTextWriterWriteString",
42578 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042579 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042580 printf(" %d", n_writer);
42581 printf(" %d", n_content);
42582 printf("\n");
42583 }
42584 }
42585 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042586 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042587#endif
42588
Daniel Veillard42595322004-11-08 10:52:06 +000042589 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042590}
42591
42592
42593static int
42594test_xmlTextWriterWriteVFormatAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042595 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042596
42597
42598 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042599 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042600}
42601
42602
42603static int
42604test_xmlTextWriterWriteVFormatAttributeNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042605 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042606
42607
42608 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042609 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042610}
42611
42612
42613static int
42614test_xmlTextWriterWriteVFormatCDATA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042615 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042616
42617
42618 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042619 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042620}
42621
42622
42623static int
42624test_xmlTextWriterWriteVFormatComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042625 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042626
42627
42628 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042629 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042630}
42631
42632
42633static int
42634test_xmlTextWriterWriteVFormatDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042635 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042636
42637
42638 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042639 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042640}
42641
42642
42643static int
42644test_xmlTextWriterWriteVFormatDTDAttlist(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042645 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042646
42647
42648 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042649 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042650}
42651
42652
42653static int
42654test_xmlTextWriterWriteVFormatDTDElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042655 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042656
42657
42658 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042659 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042660}
42661
42662
42663static int
42664test_xmlTextWriterWriteVFormatDTDInternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042665 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042666
42667
42668 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042669 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042670}
42671
42672
42673static int
42674test_xmlTextWriterWriteVFormatElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042675 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042676
42677
42678 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042679 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042680}
42681
42682
42683static int
42684test_xmlTextWriterWriteVFormatElementNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042685 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042686
42687
42688 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042689 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042690}
42691
42692
42693static int
42694test_xmlTextWriterWriteVFormatPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042695 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042696
42697
42698 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042699 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042700}
42701
42702
42703static int
42704test_xmlTextWriterWriteVFormatRaw(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042705 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042706
42707
42708 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042709 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042710}
42711
42712
42713static int
42714test_xmlTextWriterWriteVFormatString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042715 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042716
42717
42718 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042719 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042720}
42721
42722static int
42723test_xmlwriter(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042724 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042725
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042726 if (quiet == 0) printf("Testing xmlwriter : 51 of 79 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000042727 test_ret += test_xmlNewTextWriter();
42728 test_ret += test_xmlNewTextWriterFilename();
42729 test_ret += test_xmlNewTextWriterMemory();
42730 test_ret += test_xmlNewTextWriterPushParser();
42731 test_ret += test_xmlNewTextWriterTree();
42732 test_ret += test_xmlTextWriterEndAttribute();
42733 test_ret += test_xmlTextWriterEndCDATA();
42734 test_ret += test_xmlTextWriterEndComment();
42735 test_ret += test_xmlTextWriterEndDTD();
42736 test_ret += test_xmlTextWriterEndDTDAttlist();
42737 test_ret += test_xmlTextWriterEndDTDElement();
42738 test_ret += test_xmlTextWriterEndDTDEntity();
42739 test_ret += test_xmlTextWriterEndDocument();
42740 test_ret += test_xmlTextWriterEndElement();
42741 test_ret += test_xmlTextWriterEndPI();
42742 test_ret += test_xmlTextWriterFlush();
42743 test_ret += test_xmlTextWriterFullEndElement();
42744 test_ret += test_xmlTextWriterSetIndent();
42745 test_ret += test_xmlTextWriterSetIndentString();
42746 test_ret += test_xmlTextWriterStartAttribute();
42747 test_ret += test_xmlTextWriterStartAttributeNS();
42748 test_ret += test_xmlTextWriterStartCDATA();
42749 test_ret += test_xmlTextWriterStartComment();
42750 test_ret += test_xmlTextWriterStartDTD();
42751 test_ret += test_xmlTextWriterStartDTDAttlist();
42752 test_ret += test_xmlTextWriterStartDTDElement();
42753 test_ret += test_xmlTextWriterStartDTDEntity();
42754 test_ret += test_xmlTextWriterStartDocument();
42755 test_ret += test_xmlTextWriterStartElement();
42756 test_ret += test_xmlTextWriterStartElementNS();
42757 test_ret += test_xmlTextWriterStartPI();
42758 test_ret += test_xmlTextWriterWriteAttribute();
42759 test_ret += test_xmlTextWriterWriteAttributeNS();
42760 test_ret += test_xmlTextWriterWriteBase64();
42761 test_ret += test_xmlTextWriterWriteBinHex();
42762 test_ret += test_xmlTextWriterWriteCDATA();
42763 test_ret += test_xmlTextWriterWriteComment();
42764 test_ret += test_xmlTextWriterWriteDTD();
42765 test_ret += test_xmlTextWriterWriteDTDAttlist();
42766 test_ret += test_xmlTextWriterWriteDTDElement();
42767 test_ret += test_xmlTextWriterWriteDTDEntity();
42768 test_ret += test_xmlTextWriterWriteDTDExternalEntity();
42769 test_ret += test_xmlTextWriterWriteDTDExternalEntityContents();
42770 test_ret += test_xmlTextWriterWriteDTDInternalEntity();
42771 test_ret += test_xmlTextWriterWriteDTDNotation();
42772 test_ret += test_xmlTextWriterWriteElement();
42773 test_ret += test_xmlTextWriterWriteElementNS();
42774 test_ret += test_xmlTextWriterWriteFormatAttribute();
42775 test_ret += test_xmlTextWriterWriteFormatAttributeNS();
42776 test_ret += test_xmlTextWriterWriteFormatCDATA();
42777 test_ret += test_xmlTextWriterWriteFormatComment();
42778 test_ret += test_xmlTextWriterWriteFormatDTD();
42779 test_ret += test_xmlTextWriterWriteFormatDTDAttlist();
42780 test_ret += test_xmlTextWriterWriteFormatDTDElement();
42781 test_ret += test_xmlTextWriterWriteFormatDTDInternalEntity();
42782 test_ret += test_xmlTextWriterWriteFormatElement();
42783 test_ret += test_xmlTextWriterWriteFormatElementNS();
42784 test_ret += test_xmlTextWriterWriteFormatPI();
42785 test_ret += test_xmlTextWriterWriteFormatRaw();
42786 test_ret += test_xmlTextWriterWriteFormatString();
42787 test_ret += test_xmlTextWriterWritePI();
42788 test_ret += test_xmlTextWriterWriteRaw();
42789 test_ret += test_xmlTextWriterWriteRawLen();
42790 test_ret += test_xmlTextWriterWriteString();
42791 test_ret += test_xmlTextWriterWriteVFormatAttribute();
42792 test_ret += test_xmlTextWriterWriteVFormatAttributeNS();
42793 test_ret += test_xmlTextWriterWriteVFormatCDATA();
42794 test_ret += test_xmlTextWriterWriteVFormatComment();
42795 test_ret += test_xmlTextWriterWriteVFormatDTD();
42796 test_ret += test_xmlTextWriterWriteVFormatDTDAttlist();
42797 test_ret += test_xmlTextWriterWriteVFormatDTDElement();
42798 test_ret += test_xmlTextWriterWriteVFormatDTDInternalEntity();
42799 test_ret += test_xmlTextWriterWriteVFormatElement();
42800 test_ret += test_xmlTextWriterWriteVFormatElementNS();
42801 test_ret += test_xmlTextWriterWriteVFormatPI();
42802 test_ret += test_xmlTextWriterWriteVFormatRaw();
42803 test_ret += test_xmlTextWriterWriteVFormatString();
Daniel Veillardd93f6252004-11-02 15:53:51 +000042804
Daniel Veillard42595322004-11-08 10:52:06 +000042805 if (test_ret != 0)
42806 printf("Module xmlwriter: %d errors\n", test_ret);
42807 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042808}
42809
42810static int
42811test_xmlXPathCastBooleanToNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042812 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042813
William M. Brack21e4ef22005-01-02 09:53:13 +000042814#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042815 int mem_base;
42816 double ret_val;
42817 int val; /* a boolean */
42818 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042819
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042820 for (n_val = 0;n_val < gen_nb_int;n_val++) {
42821 mem_base = xmlMemBlocks();
42822 val = gen_int(n_val, 0);
42823
42824 ret_val = xmlXPathCastBooleanToNumber(val);
42825 desret_double(ret_val);
42826 call_tests++;
42827 des_int(n_val, val, 0);
42828 xmlResetLastError();
42829 if (mem_base != xmlMemBlocks()) {
42830 printf("Leak of %d blocks found in xmlXPathCastBooleanToNumber",
42831 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042832 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042833 printf(" %d", n_val);
42834 printf("\n");
42835 }
42836 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042837 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042838#endif
42839
Daniel Veillard42595322004-11-08 10:52:06 +000042840 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042841}
42842
42843
42844static int
42845test_xmlXPathCastBooleanToString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042846 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042847
William M. Brack21e4ef22005-01-02 09:53:13 +000042848#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042849 int mem_base;
42850 xmlChar * ret_val;
42851 int val; /* a boolean */
42852 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042853
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042854 for (n_val = 0;n_val < gen_nb_int;n_val++) {
42855 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042856 val = gen_int(n_val, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042857
42858 ret_val = xmlXPathCastBooleanToString(val);
42859 desret_xmlChar_ptr(ret_val);
42860 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042861 des_int(n_val, val, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042862 xmlResetLastError();
42863 if (mem_base != xmlMemBlocks()) {
42864 printf("Leak of %d blocks found in xmlXPathCastBooleanToString",
42865 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042866 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042867 printf(" %d", n_val);
42868 printf("\n");
42869 }
42870 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042871 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042872#endif
42873
Daniel Veillard42595322004-11-08 10:52:06 +000042874 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042875}
42876
42877
42878static int
42879test_xmlXPathCastNodeSetToBoolean(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042880 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042881
William M. Brack21e4ef22005-01-02 09:53:13 +000042882#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000042883 int mem_base;
42884 int ret_val;
42885 xmlNodeSetPtr ns; /* a node-set */
42886 int n_ns;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042887
Daniel Veillardce682bc2004-11-05 17:22:25 +000042888 for (n_ns = 0;n_ns < gen_nb_xmlNodeSetPtr;n_ns++) {
42889 mem_base = xmlMemBlocks();
42890 ns = gen_xmlNodeSetPtr(n_ns, 0);
42891
42892 ret_val = xmlXPathCastNodeSetToBoolean(ns);
42893 desret_int(ret_val);
42894 call_tests++;
42895 des_xmlNodeSetPtr(n_ns, ns, 0);
42896 xmlResetLastError();
42897 if (mem_base != xmlMemBlocks()) {
42898 printf("Leak of %d blocks found in xmlXPathCastNodeSetToBoolean",
42899 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042900 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042901 printf(" %d", n_ns);
42902 printf("\n");
42903 }
42904 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042905 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042906#endif
42907
Daniel Veillard42595322004-11-08 10:52:06 +000042908 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042909}
42910
42911
42912static int
42913test_xmlXPathCastNodeSetToNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042914 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042915
William M. Brack21e4ef22005-01-02 09:53:13 +000042916#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000042917 int mem_base;
42918 double ret_val;
42919 xmlNodeSetPtr ns; /* a node-set */
42920 int n_ns;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042921
Daniel Veillardce682bc2004-11-05 17:22:25 +000042922 for (n_ns = 0;n_ns < gen_nb_xmlNodeSetPtr;n_ns++) {
42923 mem_base = xmlMemBlocks();
42924 ns = gen_xmlNodeSetPtr(n_ns, 0);
42925
42926 ret_val = xmlXPathCastNodeSetToNumber(ns);
42927 desret_double(ret_val);
42928 call_tests++;
42929 des_xmlNodeSetPtr(n_ns, ns, 0);
42930 xmlResetLastError();
42931 if (mem_base != xmlMemBlocks()) {
42932 printf("Leak of %d blocks found in xmlXPathCastNodeSetToNumber",
42933 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042934 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042935 printf(" %d", n_ns);
42936 printf("\n");
42937 }
42938 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042939 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042940#endif
42941
Daniel Veillard42595322004-11-08 10:52:06 +000042942 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042943}
42944
42945
42946static int
42947test_xmlXPathCastNodeSetToString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042948 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042949
William M. Brack21e4ef22005-01-02 09:53:13 +000042950#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000042951 int mem_base;
42952 xmlChar * ret_val;
42953 xmlNodeSetPtr ns; /* a node-set */
42954 int n_ns;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042955
Daniel Veillardce682bc2004-11-05 17:22:25 +000042956 for (n_ns = 0;n_ns < gen_nb_xmlNodeSetPtr;n_ns++) {
42957 mem_base = xmlMemBlocks();
42958 ns = gen_xmlNodeSetPtr(n_ns, 0);
42959
42960 ret_val = xmlXPathCastNodeSetToString(ns);
42961 desret_xmlChar_ptr(ret_val);
42962 call_tests++;
42963 des_xmlNodeSetPtr(n_ns, ns, 0);
42964 xmlResetLastError();
42965 if (mem_base != xmlMemBlocks()) {
42966 printf("Leak of %d blocks found in xmlXPathCastNodeSetToString",
42967 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042968 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042969 printf(" %d", n_ns);
42970 printf("\n");
42971 }
42972 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042973 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042974#endif
42975
Daniel Veillard42595322004-11-08 10:52:06 +000042976 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042977}
42978
42979
42980static int
42981test_xmlXPathCastNodeToNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042982 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042983
William M. Brack21e4ef22005-01-02 09:53:13 +000042984#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042985 int mem_base;
42986 double ret_val;
42987 xmlNodePtr node; /* a node */
42988 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042989
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042990 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
42991 mem_base = xmlMemBlocks();
42992 node = gen_xmlNodePtr(n_node, 0);
42993
42994 ret_val = xmlXPathCastNodeToNumber(node);
42995 desret_double(ret_val);
42996 call_tests++;
42997 des_xmlNodePtr(n_node, node, 0);
42998 xmlResetLastError();
42999 if (mem_base != xmlMemBlocks()) {
43000 printf("Leak of %d blocks found in xmlXPathCastNodeToNumber",
43001 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043002 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043003 printf(" %d", n_node);
43004 printf("\n");
43005 }
43006 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043007 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043008#endif
43009
Daniel Veillard42595322004-11-08 10:52:06 +000043010 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043011}
43012
43013
43014static int
43015test_xmlXPathCastNodeToString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043016 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043017
William M. Brack21e4ef22005-01-02 09:53:13 +000043018#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +000043019 int mem_base;
43020 xmlChar * ret_val;
43021 xmlNodePtr node; /* a node */
43022 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043023
Daniel Veillard8a32fe42004-11-02 22:10:16 +000043024 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
43025 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000043026 node = gen_xmlNodePtr(n_node, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000043027
43028 ret_val = xmlXPathCastNodeToString(node);
43029 desret_xmlChar_ptr(ret_val);
43030 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043031 des_xmlNodePtr(n_node, node, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000043032 xmlResetLastError();
43033 if (mem_base != xmlMemBlocks()) {
43034 printf("Leak of %d blocks found in xmlXPathCastNodeToString",
43035 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043036 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000043037 printf(" %d", n_node);
43038 printf("\n");
43039 }
43040 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043041 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000043042#endif
43043
Daniel Veillard42595322004-11-08 10:52:06 +000043044 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043045}
43046
43047
43048static int
43049test_xmlXPathCastNumberToBoolean(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043050 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043051
William M. Brack21e4ef22005-01-02 09:53:13 +000043052#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard3d95c732004-11-06 22:25:14 +000043053 int mem_base;
43054 int ret_val;
43055 double val; /* a number */
43056 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043057
Daniel Veillard3d95c732004-11-06 22:25:14 +000043058 for (n_val = 0;n_val < gen_nb_double;n_val++) {
43059 mem_base = xmlMemBlocks();
43060 val = gen_double(n_val, 0);
43061
43062 ret_val = xmlXPathCastNumberToBoolean(val);
43063 desret_int(ret_val);
43064 call_tests++;
43065 des_double(n_val, val, 0);
43066 xmlResetLastError();
43067 if (mem_base != xmlMemBlocks()) {
43068 printf("Leak of %d blocks found in xmlXPathCastNumberToBoolean",
43069 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043070 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000043071 printf(" %d", n_val);
43072 printf("\n");
43073 }
43074 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043075 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000043076#endif
43077
Daniel Veillard42595322004-11-08 10:52:06 +000043078 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043079}
43080
43081
43082static int
43083test_xmlXPathCastNumberToString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043084 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043085
William M. Brack21e4ef22005-01-02 09:53:13 +000043086#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard3d95c732004-11-06 22:25:14 +000043087 int mem_base;
43088 xmlChar * ret_val;
43089 double val; /* a number */
43090 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043091
Daniel Veillard3d95c732004-11-06 22:25:14 +000043092 for (n_val = 0;n_val < gen_nb_double;n_val++) {
43093 mem_base = xmlMemBlocks();
43094 val = gen_double(n_val, 0);
43095
43096 ret_val = xmlXPathCastNumberToString(val);
43097 desret_xmlChar_ptr(ret_val);
43098 call_tests++;
43099 des_double(n_val, val, 0);
43100 xmlResetLastError();
43101 if (mem_base != xmlMemBlocks()) {
43102 printf("Leak of %d blocks found in xmlXPathCastNumberToString",
43103 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043104 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000043105 printf(" %d", n_val);
43106 printf("\n");
43107 }
43108 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043109 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000043110#endif
43111
Daniel Veillard42595322004-11-08 10:52:06 +000043112 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043113}
43114
43115
43116static int
43117test_xmlXPathCastStringToBoolean(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043118 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043119
William M. Brack21e4ef22005-01-02 09:53:13 +000043120#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000043121 int mem_base;
43122 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043123 xmlChar * val; /* a string */
Daniel Veillardd93f6252004-11-02 15:53:51 +000043124 int n_val;
43125
43126 for (n_val = 0;n_val < gen_nb_const_xmlChar_ptr;n_val++) {
43127 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000043128 val = gen_const_xmlChar_ptr(n_val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043129
William M. Brackf13f77f2004-11-12 16:03:48 +000043130 ret_val = xmlXPathCastStringToBoolean((const xmlChar *)val);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043131 desret_int(ret_val);
43132 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000043133 des_const_xmlChar_ptr(n_val, (const xmlChar *)val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043134 xmlResetLastError();
43135 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000043136 printf("Leak of %d blocks found in xmlXPathCastStringToBoolean",
Daniel Veillardd93f6252004-11-02 15:53:51 +000043137 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043138 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000043139 printf(" %d", n_val);
43140 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000043141 }
43142 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043143 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043144#endif
43145
Daniel Veillard42595322004-11-08 10:52:06 +000043146 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043147}
43148
43149
43150static int
43151test_xmlXPathCastStringToNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043152 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043153
William M. Brack21e4ef22005-01-02 09:53:13 +000043154#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043155 int mem_base;
43156 double ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043157 xmlChar * val; /* a string */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043158 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043159
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043160 for (n_val = 0;n_val < gen_nb_const_xmlChar_ptr;n_val++) {
43161 mem_base = xmlMemBlocks();
43162 val = gen_const_xmlChar_ptr(n_val, 0);
43163
William M. Brackf13f77f2004-11-12 16:03:48 +000043164 ret_val = xmlXPathCastStringToNumber((const xmlChar *)val);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043165 desret_double(ret_val);
43166 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000043167 des_const_xmlChar_ptr(n_val, (const xmlChar *)val, 0);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043168 xmlResetLastError();
43169 if (mem_base != xmlMemBlocks()) {
43170 printf("Leak of %d blocks found in xmlXPathCastStringToNumber",
43171 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043172 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043173 printf(" %d", n_val);
43174 printf("\n");
43175 }
43176 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043177 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043178#endif
43179
Daniel Veillard42595322004-11-08 10:52:06 +000043180 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043181}
43182
43183
43184static int
43185test_xmlXPathCastToBoolean(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043186 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043187
William M. Brack21e4ef22005-01-02 09:53:13 +000043188#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000043189 int mem_base;
43190 int ret_val;
43191 xmlXPathObjectPtr val; /* an XPath object */
43192 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043193
Daniel Veillardd005b9e2004-11-03 17:07:05 +000043194 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
43195 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000043196 val = gen_xmlXPathObjectPtr(n_val, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000043197
43198 ret_val = xmlXPathCastToBoolean(val);
43199 desret_int(ret_val);
43200 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043201 des_xmlXPathObjectPtr(n_val, val, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000043202 xmlResetLastError();
43203 if (mem_base != xmlMemBlocks()) {
43204 printf("Leak of %d blocks found in xmlXPathCastToBoolean",
43205 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043206 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000043207 printf(" %d", n_val);
43208 printf("\n");
43209 }
43210 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043211 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000043212#endif
43213
Daniel Veillard42595322004-11-08 10:52:06 +000043214 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043215}
43216
43217
43218static int
43219test_xmlXPathCastToNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043220 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043221
William M. Brack21e4ef22005-01-02 09:53:13 +000043222#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043223 int mem_base;
43224 double ret_val;
43225 xmlXPathObjectPtr val; /* an XPath object */
43226 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043227
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043228 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
43229 mem_base = xmlMemBlocks();
43230 val = gen_xmlXPathObjectPtr(n_val, 0);
43231
43232 ret_val = xmlXPathCastToNumber(val);
43233 desret_double(ret_val);
43234 call_tests++;
43235 des_xmlXPathObjectPtr(n_val, val, 0);
43236 xmlResetLastError();
43237 if (mem_base != xmlMemBlocks()) {
43238 printf("Leak of %d blocks found in xmlXPathCastToNumber",
43239 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043240 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043241 printf(" %d", n_val);
43242 printf("\n");
43243 }
43244 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043245 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043246#endif
43247
Daniel Veillard42595322004-11-08 10:52:06 +000043248 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043249}
43250
43251
43252static int
43253test_xmlXPathCastToString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043254 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043255
William M. Brack21e4ef22005-01-02 09:53:13 +000043256#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000043257 int mem_base;
43258 xmlChar * ret_val;
43259 xmlXPathObjectPtr val; /* an XPath object */
43260 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043261
Daniel Veillardd005b9e2004-11-03 17:07:05 +000043262 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
43263 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000043264 val = gen_xmlXPathObjectPtr(n_val, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000043265
43266 ret_val = xmlXPathCastToString(val);
43267 desret_xmlChar_ptr(ret_val);
43268 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043269 des_xmlXPathObjectPtr(n_val, val, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000043270 xmlResetLastError();
43271 if (mem_base != xmlMemBlocks()) {
43272 printf("Leak of %d blocks found in xmlXPathCastToString",
43273 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043274 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000043275 printf(" %d", n_val);
43276 printf("\n");
43277 }
43278 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043279 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000043280#endif
43281
Daniel Veillard42595322004-11-08 10:52:06 +000043282 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043283}
43284
43285
43286static int
43287test_xmlXPathCmpNodes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043288 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043289
William M. Brack21e4ef22005-01-02 09:53:13 +000043290#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000043291 int mem_base;
43292 int ret_val;
43293 xmlNodePtr node1; /* the first node */
43294 int n_node1;
43295 xmlNodePtr node2; /* the second node */
43296 int n_node2;
43297
43298 for (n_node1 = 0;n_node1 < gen_nb_xmlNodePtr;n_node1++) {
43299 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
43300 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000043301 node1 = gen_xmlNodePtr(n_node1, 0);
43302 node2 = gen_xmlNodePtr(n_node2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043303
43304 ret_val = xmlXPathCmpNodes(node1, node2);
43305 desret_int(ret_val);
43306 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043307 des_xmlNodePtr(n_node1, node1, 0);
43308 des_xmlNodePtr(n_node2, node2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043309 xmlResetLastError();
43310 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000043311 printf("Leak of %d blocks found in xmlXPathCmpNodes",
Daniel Veillardd93f6252004-11-02 15:53:51 +000043312 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043313 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000043314 printf(" %d", n_node1);
43315 printf(" %d", n_node2);
43316 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000043317 }
43318 }
43319 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043320 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043321#endif
43322
Daniel Veillard42595322004-11-08 10:52:06 +000043323 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043324}
43325
43326
43327static int
43328test_xmlXPathCompile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043329 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043330
43331
43332 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000043333 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043334}
43335
Daniel Veillarda521d282004-11-09 14:59:59 +000043336#ifdef LIBXML_XPATH_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000043337
Daniel Veillardce682bc2004-11-05 17:22:25 +000043338#define gen_nb_xmlXPathCompExprPtr 1
43339static xmlXPathCompExprPtr gen_xmlXPathCompExprPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
43340 return(NULL);
43341}
43342static void des_xmlXPathCompExprPtr(int no ATTRIBUTE_UNUSED, xmlXPathCompExprPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
43343}
Daniel Veillarda521d282004-11-09 14:59:59 +000043344#endif
43345
43346#ifdef LIBXML_XPATH_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000043347
43348#define gen_nb_xmlXPathContextPtr 1
43349static xmlXPathContextPtr gen_xmlXPathContextPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
43350 return(NULL);
43351}
43352static void des_xmlXPathContextPtr(int no ATTRIBUTE_UNUSED, xmlXPathContextPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
43353}
Daniel Veillarda521d282004-11-09 14:59:59 +000043354#endif
43355
Daniel Veillardce682bc2004-11-05 17:22:25 +000043356
Daniel Veillardd93f6252004-11-02 15:53:51 +000043357static int
43358test_xmlXPathCompiledEval(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043359 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043360
William M. Brack21e4ef22005-01-02 09:53:13 +000043361#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000043362 int mem_base;
43363 xmlXPathObjectPtr ret_val;
43364 xmlXPathCompExprPtr comp; /* the compiled XPath expression */
43365 int n_comp;
43366 xmlXPathContextPtr ctx; /* the XPath context */
43367 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043368
Daniel Veillardce682bc2004-11-05 17:22:25 +000043369 for (n_comp = 0;n_comp < gen_nb_xmlXPathCompExprPtr;n_comp++) {
43370 for (n_ctx = 0;n_ctx < gen_nb_xmlXPathContextPtr;n_ctx++) {
43371 mem_base = xmlMemBlocks();
43372 comp = gen_xmlXPathCompExprPtr(n_comp, 0);
43373 ctx = gen_xmlXPathContextPtr(n_ctx, 1);
43374
43375 ret_val = xmlXPathCompiledEval(comp, ctx);
43376 desret_xmlXPathObjectPtr(ret_val);
43377 call_tests++;
43378 des_xmlXPathCompExprPtr(n_comp, comp, 0);
43379 des_xmlXPathContextPtr(n_ctx, ctx, 1);
43380 xmlResetLastError();
43381 if (mem_base != xmlMemBlocks()) {
43382 printf("Leak of %d blocks found in xmlXPathCompiledEval",
43383 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043384 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043385 printf(" %d", n_comp);
43386 printf(" %d", n_ctx);
43387 printf("\n");
43388 }
43389 }
43390 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043391 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043392#endif
43393
Daniel Veillard42595322004-11-08 10:52:06 +000043394 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043395}
43396
43397
43398static int
43399test_xmlXPathConvertBoolean(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043400 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043401
William M. Brack21e4ef22005-01-02 09:53:13 +000043402#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000043403 int mem_base;
43404 xmlXPathObjectPtr ret_val;
43405 xmlXPathObjectPtr val; /* an XPath object */
43406 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043407
Daniel Veillard3d97e662004-11-04 10:49:00 +000043408 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
43409 mem_base = xmlMemBlocks();
43410 val = gen_xmlXPathObjectPtr(n_val, 0);
43411
43412 ret_val = xmlXPathConvertBoolean(val);
43413 val = NULL;
43414 desret_xmlXPathObjectPtr(ret_val);
43415 call_tests++;
43416 des_xmlXPathObjectPtr(n_val, val, 0);
43417 xmlResetLastError();
43418 if (mem_base != xmlMemBlocks()) {
43419 printf("Leak of %d blocks found in xmlXPathConvertBoolean",
43420 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043421 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043422 printf(" %d", n_val);
43423 printf("\n");
43424 }
43425 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043426 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043427#endif
43428
Daniel Veillard42595322004-11-08 10:52:06 +000043429 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043430}
43431
43432
43433static int
43434test_xmlXPathConvertNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043435 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043436
William M. Brack21e4ef22005-01-02 09:53:13 +000043437#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000043438 int mem_base;
43439 xmlXPathObjectPtr ret_val;
43440 xmlXPathObjectPtr val; /* an XPath object */
43441 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043442
Daniel Veillard3d97e662004-11-04 10:49:00 +000043443 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
43444 mem_base = xmlMemBlocks();
43445 val = gen_xmlXPathObjectPtr(n_val, 0);
43446
43447 ret_val = xmlXPathConvertNumber(val);
43448 val = NULL;
43449 desret_xmlXPathObjectPtr(ret_val);
43450 call_tests++;
43451 des_xmlXPathObjectPtr(n_val, val, 0);
43452 xmlResetLastError();
43453 if (mem_base != xmlMemBlocks()) {
43454 printf("Leak of %d blocks found in xmlXPathConvertNumber",
43455 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043456 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043457 printf(" %d", n_val);
43458 printf("\n");
43459 }
43460 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043461 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043462#endif
43463
Daniel Veillard42595322004-11-08 10:52:06 +000043464 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043465}
43466
43467
43468static int
43469test_xmlXPathConvertString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043470 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043471
William M. Brack21e4ef22005-01-02 09:53:13 +000043472#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000043473 int mem_base;
43474 xmlXPathObjectPtr ret_val;
43475 xmlXPathObjectPtr val; /* an XPath object */
43476 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043477
Daniel Veillard3d97e662004-11-04 10:49:00 +000043478 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
43479 mem_base = xmlMemBlocks();
43480 val = gen_xmlXPathObjectPtr(n_val, 0);
43481
43482 ret_val = xmlXPathConvertString(val);
43483 val = NULL;
43484 desret_xmlXPathObjectPtr(ret_val);
43485 call_tests++;
43486 des_xmlXPathObjectPtr(n_val, val, 0);
43487 xmlResetLastError();
43488 if (mem_base != xmlMemBlocks()) {
43489 printf("Leak of %d blocks found in xmlXPathConvertString",
43490 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043491 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043492 printf(" %d", n_val);
43493 printf("\n");
43494 }
43495 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043496 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043497#endif
43498
Daniel Veillard42595322004-11-08 10:52:06 +000043499 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043500}
43501
43502
43503static int
43504test_xmlXPathCtxtCompile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043505 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043506
43507
43508 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000043509 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043510}
43511
43512
43513static int
43514test_xmlXPathEval(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043515 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043516
William M. Brack21e4ef22005-01-02 09:53:13 +000043517#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000043518 int mem_base;
43519 xmlXPathObjectPtr ret_val;
43520 xmlChar * str; /* the XPath expression */
43521 int n_str;
43522 xmlXPathContextPtr ctx; /* the XPath context */
43523 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043524
Daniel Veillardce682bc2004-11-05 17:22:25 +000043525 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
43526 for (n_ctx = 0;n_ctx < gen_nb_xmlXPathContextPtr;n_ctx++) {
43527 mem_base = xmlMemBlocks();
43528 str = gen_const_xmlChar_ptr(n_str, 0);
43529 ctx = gen_xmlXPathContextPtr(n_ctx, 1);
43530
William M. Brackf13f77f2004-11-12 16:03:48 +000043531 ret_val = xmlXPathEval((const xmlChar *)str, ctx);
Daniel Veillardce682bc2004-11-05 17:22:25 +000043532 desret_xmlXPathObjectPtr(ret_val);
43533 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000043534 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000043535 des_xmlXPathContextPtr(n_ctx, ctx, 1);
43536 xmlResetLastError();
43537 if (mem_base != xmlMemBlocks()) {
43538 printf("Leak of %d blocks found in xmlXPathEval",
43539 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043540 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043541 printf(" %d", n_str);
43542 printf(" %d", n_ctx);
43543 printf("\n");
43544 }
43545 }
43546 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043547 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043548#endif
43549
Daniel Veillard42595322004-11-08 10:52:06 +000043550 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043551}
43552
43553
43554static int
43555test_xmlXPathEvalExpression(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043556 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043557
William M. Brack21e4ef22005-01-02 09:53:13 +000043558#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000043559 int mem_base;
43560 xmlXPathObjectPtr ret_val;
43561 xmlChar * str; /* the XPath expression */
43562 int n_str;
43563 xmlXPathContextPtr ctxt; /* the XPath context */
43564 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043565
Daniel Veillardce682bc2004-11-05 17:22:25 +000043566 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
43567 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
43568 mem_base = xmlMemBlocks();
43569 str = gen_const_xmlChar_ptr(n_str, 0);
43570 ctxt = gen_xmlXPathContextPtr(n_ctxt, 1);
43571
William M. Brackf13f77f2004-11-12 16:03:48 +000043572 ret_val = xmlXPathEvalExpression((const xmlChar *)str, ctxt);
Daniel Veillardce682bc2004-11-05 17:22:25 +000043573 desret_xmlXPathObjectPtr(ret_val);
43574 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000043575 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000043576 des_xmlXPathContextPtr(n_ctxt, ctxt, 1);
43577 xmlResetLastError();
43578 if (mem_base != xmlMemBlocks()) {
43579 printf("Leak of %d blocks found in xmlXPathEvalExpression",
43580 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043581 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043582 printf(" %d", n_str);
43583 printf(" %d", n_ctxt);
43584 printf("\n");
43585 }
43586 }
43587 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043588 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043589#endif
43590
Daniel Veillard42595322004-11-08 10:52:06 +000043591 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043592}
43593
43594
43595static int
43596test_xmlXPathEvalPredicate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043597 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043598
William M. Brack21e4ef22005-01-02 09:53:13 +000043599#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000043600 int mem_base;
43601 int ret_val;
43602 xmlXPathContextPtr ctxt; /* the XPath context */
43603 int n_ctxt;
43604 xmlXPathObjectPtr res; /* the Predicate Expression evaluation result */
43605 int n_res;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043606
Daniel Veillardce682bc2004-11-05 17:22:25 +000043607 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
43608 for (n_res = 0;n_res < gen_nb_xmlXPathObjectPtr;n_res++) {
43609 mem_base = xmlMemBlocks();
43610 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
43611 res = gen_xmlXPathObjectPtr(n_res, 1);
43612
43613 ret_val = xmlXPathEvalPredicate(ctxt, res);
43614 desret_int(ret_val);
43615 call_tests++;
43616 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
43617 des_xmlXPathObjectPtr(n_res, res, 1);
43618 xmlResetLastError();
43619 if (mem_base != xmlMemBlocks()) {
43620 printf("Leak of %d blocks found in xmlXPathEvalPredicate",
43621 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043622 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043623 printf(" %d", n_ctxt);
43624 printf(" %d", n_res);
43625 printf("\n");
43626 }
43627 }
43628 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043629 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043630#endif
43631
Daniel Veillard42595322004-11-08 10:52:06 +000043632 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043633}
43634
43635
43636static int
43637test_xmlXPathInit(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043638 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043639
William M. Brack21e4ef22005-01-02 09:53:13 +000043640#if defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000043641 int mem_base;
43642
43643 mem_base = xmlMemBlocks();
43644
43645 xmlXPathInit();
43646 call_tests++;
43647 xmlResetLastError();
43648 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000043649 printf("Leak of %d blocks found in xmlXPathInit",
Daniel Veillardd93f6252004-11-02 15:53:51 +000043650 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043651 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000043652 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000043653 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043654 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043655#endif
43656
Daniel Veillard42595322004-11-08 10:52:06 +000043657 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043658}
43659
43660
43661static int
43662test_xmlXPathIsInf(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043663 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043664
William M. Brack21e4ef22005-01-02 09:53:13 +000043665#if defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard3d95c732004-11-06 22:25:14 +000043666 int mem_base;
43667 int ret_val;
43668 double val; /* a double value */
43669 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043670
Daniel Veillard3d95c732004-11-06 22:25:14 +000043671 for (n_val = 0;n_val < gen_nb_double;n_val++) {
43672 mem_base = xmlMemBlocks();
43673 val = gen_double(n_val, 0);
43674
43675 ret_val = xmlXPathIsInf(val);
43676 desret_int(ret_val);
43677 call_tests++;
43678 des_double(n_val, val, 0);
43679 xmlResetLastError();
43680 if (mem_base != xmlMemBlocks()) {
43681 printf("Leak of %d blocks found in xmlXPathIsInf",
43682 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043683 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000043684 printf(" %d", n_val);
43685 printf("\n");
43686 }
43687 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043688 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000043689#endif
43690
Daniel Veillard42595322004-11-08 10:52:06 +000043691 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043692}
43693
43694
43695static int
43696test_xmlXPathIsNaN(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043697 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043698
William M. Brack21e4ef22005-01-02 09:53:13 +000043699#if defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard3d95c732004-11-06 22:25:14 +000043700 int mem_base;
43701 int ret_val;
43702 double val; /* a double value */
43703 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043704
Daniel Veillard3d95c732004-11-06 22:25:14 +000043705 for (n_val = 0;n_val < gen_nb_double;n_val++) {
43706 mem_base = xmlMemBlocks();
43707 val = gen_double(n_val, 0);
43708
43709 ret_val = xmlXPathIsNaN(val);
43710 desret_int(ret_val);
43711 call_tests++;
43712 des_double(n_val, val, 0);
43713 xmlResetLastError();
43714 if (mem_base != xmlMemBlocks()) {
43715 printf("Leak of %d blocks found in xmlXPathIsNaN",
43716 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043717 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000043718 printf(" %d", n_val);
43719 printf("\n");
43720 }
43721 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043722 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000043723#endif
43724
Daniel Veillard42595322004-11-08 10:52:06 +000043725 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043726}
43727
43728
43729static int
43730test_xmlXPathNewContext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043731 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043732
43733
43734 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000043735 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043736}
43737
43738
43739static int
43740test_xmlXPathNodeSetCreate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043741 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043742
William M. Brack21e4ef22005-01-02 09:53:13 +000043743#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000043744 int mem_base;
43745 xmlNodeSetPtr ret_val;
43746 xmlNodePtr val; /* an initial xmlNodePtr, or NULL */
43747 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043748
Daniel Veillardf2a36f92004-11-08 17:55:01 +000043749 for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
43750 mem_base = xmlMemBlocks();
43751 val = gen_xmlNodePtr(n_val, 0);
43752
43753 ret_val = xmlXPathNodeSetCreate(val);
43754 desret_xmlNodeSetPtr(ret_val);
43755 call_tests++;
43756 des_xmlNodePtr(n_val, val, 0);
43757 xmlResetLastError();
43758 if (mem_base != xmlMemBlocks()) {
43759 printf("Leak of %d blocks found in xmlXPathNodeSetCreate",
43760 xmlMemBlocks() - mem_base);
43761 test_ret++;
43762 printf(" %d", n_val);
43763 printf("\n");
43764 }
43765 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043766 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000043767#endif
43768
Daniel Veillard42595322004-11-08 10:52:06 +000043769 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043770}
43771
43772
43773static int
43774test_xmlXPathObjectCopy(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043775 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043776
William M. Brack21e4ef22005-01-02 09:53:13 +000043777#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000043778 int mem_base;
43779 xmlXPathObjectPtr ret_val;
43780 xmlXPathObjectPtr val; /* the original object */
43781 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043782
Daniel Veillard3d97e662004-11-04 10:49:00 +000043783 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
43784 mem_base = xmlMemBlocks();
43785 val = gen_xmlXPathObjectPtr(n_val, 0);
43786
43787 ret_val = xmlXPathObjectCopy(val);
43788 desret_xmlXPathObjectPtr(ret_val);
43789 call_tests++;
43790 des_xmlXPathObjectPtr(n_val, val, 0);
43791 xmlResetLastError();
43792 if (mem_base != xmlMemBlocks()) {
43793 printf("Leak of %d blocks found in xmlXPathObjectCopy",
43794 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043795 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043796 printf(" %d", n_val);
43797 printf("\n");
43798 }
43799 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043800 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043801#endif
43802
Daniel Veillard42595322004-11-08 10:52:06 +000043803 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043804}
43805
43806
43807static int
43808test_xmlXPathOrderDocElems(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043809 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043810
William M. Brack21e4ef22005-01-02 09:53:13 +000043811#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043812 int mem_base;
43813 long ret_val;
43814 xmlDocPtr doc; /* an input document */
43815 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043816
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043817 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
43818 mem_base = xmlMemBlocks();
43819 doc = gen_xmlDocPtr(n_doc, 0);
43820
43821 ret_val = xmlXPathOrderDocElems(doc);
43822 desret_long(ret_val);
43823 call_tests++;
43824 des_xmlDocPtr(n_doc, doc, 0);
43825 xmlResetLastError();
43826 if (mem_base != xmlMemBlocks()) {
43827 printf("Leak of %d blocks found in xmlXPathOrderDocElems",
43828 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043829 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043830 printf(" %d", n_doc);
43831 printf("\n");
43832 }
43833 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043834 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043835#endif
43836
Daniel Veillard42595322004-11-08 10:52:06 +000043837 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043838}
43839
43840static int
43841test_xpath(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043842 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043843
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043844 if (quiet == 0) printf("Testing xpath : 28 of 36 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000043845 test_ret += test_xmlXPathCastBooleanToNumber();
43846 test_ret += test_xmlXPathCastBooleanToString();
43847 test_ret += test_xmlXPathCastNodeSetToBoolean();
43848 test_ret += test_xmlXPathCastNodeSetToNumber();
43849 test_ret += test_xmlXPathCastNodeSetToString();
43850 test_ret += test_xmlXPathCastNodeToNumber();
43851 test_ret += test_xmlXPathCastNodeToString();
43852 test_ret += test_xmlXPathCastNumberToBoolean();
43853 test_ret += test_xmlXPathCastNumberToString();
43854 test_ret += test_xmlXPathCastStringToBoolean();
43855 test_ret += test_xmlXPathCastStringToNumber();
43856 test_ret += test_xmlXPathCastToBoolean();
43857 test_ret += test_xmlXPathCastToNumber();
43858 test_ret += test_xmlXPathCastToString();
43859 test_ret += test_xmlXPathCmpNodes();
43860 test_ret += test_xmlXPathCompile();
43861 test_ret += test_xmlXPathCompiledEval();
43862 test_ret += test_xmlXPathConvertBoolean();
43863 test_ret += test_xmlXPathConvertNumber();
43864 test_ret += test_xmlXPathConvertString();
43865 test_ret += test_xmlXPathCtxtCompile();
43866 test_ret += test_xmlXPathEval();
43867 test_ret += test_xmlXPathEvalExpression();
43868 test_ret += test_xmlXPathEvalPredicate();
43869 test_ret += test_xmlXPathInit();
43870 test_ret += test_xmlXPathIsInf();
43871 test_ret += test_xmlXPathIsNaN();
43872 test_ret += test_xmlXPathNewContext();
43873 test_ret += test_xmlXPathNodeSetCreate();
43874 test_ret += test_xmlXPathObjectCopy();
43875 test_ret += test_xmlXPathOrderDocElems();
Daniel Veillardd93f6252004-11-02 15:53:51 +000043876
Daniel Veillard42595322004-11-08 10:52:06 +000043877 if (test_ret != 0)
43878 printf("Module xpath: %d errors\n", test_ret);
43879 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043880}
Daniel Veillarda521d282004-11-09 14:59:59 +000043881#ifdef LIBXML_XPATH_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000043882
Daniel Veillarda82b1822004-11-08 16:24:57 +000043883#define gen_nb_xmlXPathParserContextPtr 1
43884static xmlXPathParserContextPtr gen_xmlXPathParserContextPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
43885 return(NULL);
43886}
43887static void des_xmlXPathParserContextPtr(int no ATTRIBUTE_UNUSED, xmlXPathParserContextPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
43888}
Daniel Veillarda521d282004-11-09 14:59:59 +000043889#endif
43890
Daniel Veillarda82b1822004-11-08 16:24:57 +000043891
43892static int
43893test_valuePop(void) {
43894 int test_ret = 0;
43895
William M. Brack21e4ef22005-01-02 09:53:13 +000043896#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000043897 int mem_base;
43898 xmlXPathObjectPtr ret_val;
43899 xmlXPathParserContextPtr ctxt; /* an XPath evaluation context */
43900 int n_ctxt;
43901
43902 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43903 mem_base = xmlMemBlocks();
43904 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43905
43906 ret_val = valuePop(ctxt);
43907 desret_xmlXPathObjectPtr(ret_val);
43908 call_tests++;
43909 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43910 xmlResetLastError();
43911 if (mem_base != xmlMemBlocks()) {
43912 printf("Leak of %d blocks found in valuePop",
43913 xmlMemBlocks() - mem_base);
43914 test_ret++;
43915 printf(" %d", n_ctxt);
43916 printf("\n");
43917 }
43918 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043919 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000043920#endif
43921
Daniel Veillarda82b1822004-11-08 16:24:57 +000043922 return(test_ret);
43923}
43924
43925
43926static int
43927test_valuePush(void) {
43928 int test_ret = 0;
43929
William M. Brack21e4ef22005-01-02 09:53:13 +000043930#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000043931 int mem_base;
43932 int ret_val;
43933 xmlXPathParserContextPtr ctxt; /* an XPath evaluation context */
43934 int n_ctxt;
43935 xmlXPathObjectPtr value; /* the XPath object */
43936 int n_value;
43937
43938 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43939 for (n_value = 0;n_value < gen_nb_xmlXPathObjectPtr;n_value++) {
43940 mem_base = xmlMemBlocks();
43941 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43942 value = gen_xmlXPathObjectPtr(n_value, 1);
43943
43944 ret_val = valuePush(ctxt, value);
43945 desret_int(ret_val);
43946 call_tests++;
43947 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43948 des_xmlXPathObjectPtr(n_value, value, 1);
43949 xmlResetLastError();
43950 if (mem_base != xmlMemBlocks()) {
43951 printf("Leak of %d blocks found in valuePush",
43952 xmlMemBlocks() - mem_base);
43953 test_ret++;
43954 printf(" %d", n_ctxt);
43955 printf(" %d", n_value);
43956 printf("\n");
43957 }
43958 }
43959 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043960 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000043961#endif
43962
Daniel Veillarda82b1822004-11-08 16:24:57 +000043963 return(test_ret);
43964}
43965
43966
43967static int
43968test_xmlXPathAddValues(void) {
43969 int test_ret = 0;
43970
William M. Brack21e4ef22005-01-02 09:53:13 +000043971#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000043972 int mem_base;
43973 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
43974 int n_ctxt;
43975
43976 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43977 mem_base = xmlMemBlocks();
43978 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43979
43980 xmlXPathAddValues(ctxt);
43981 call_tests++;
43982 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43983 xmlResetLastError();
43984 if (mem_base != xmlMemBlocks()) {
43985 printf("Leak of %d blocks found in xmlXPathAddValues",
43986 xmlMemBlocks() - mem_base);
43987 test_ret++;
43988 printf(" %d", n_ctxt);
43989 printf("\n");
43990 }
43991 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043992 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000043993#endif
43994
Daniel Veillarda82b1822004-11-08 16:24:57 +000043995 return(test_ret);
43996}
43997
43998
43999static int
44000test_xmlXPathBooleanFunction(void) {
44001 int test_ret = 0;
44002
William M. Brack21e4ef22005-01-02 09:53:13 +000044003#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044004 int mem_base;
44005 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44006 int n_ctxt;
44007 int nargs; /* the number of arguments */
44008 int n_nargs;
44009
44010 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44011 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44012 mem_base = xmlMemBlocks();
44013 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44014 nargs = gen_int(n_nargs, 1);
44015
44016 xmlXPathBooleanFunction(ctxt, nargs);
44017 call_tests++;
44018 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44019 des_int(n_nargs, nargs, 1);
44020 xmlResetLastError();
44021 if (mem_base != xmlMemBlocks()) {
44022 printf("Leak of %d blocks found in xmlXPathBooleanFunction",
44023 xmlMemBlocks() - mem_base);
44024 test_ret++;
44025 printf(" %d", n_ctxt);
44026 printf(" %d", n_nargs);
44027 printf("\n");
44028 }
44029 }
44030 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044031 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044032#endif
44033
Daniel Veillarda82b1822004-11-08 16:24:57 +000044034 return(test_ret);
44035}
44036
44037
44038static int
44039test_xmlXPathCeilingFunction(void) {
44040 int test_ret = 0;
44041
William M. Brack21e4ef22005-01-02 09:53:13 +000044042#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044043 int mem_base;
44044 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44045 int n_ctxt;
44046 int nargs; /* the number of arguments */
44047 int n_nargs;
44048
44049 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44050 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44051 mem_base = xmlMemBlocks();
44052 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44053 nargs = gen_int(n_nargs, 1);
44054
44055 xmlXPathCeilingFunction(ctxt, nargs);
44056 call_tests++;
44057 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44058 des_int(n_nargs, nargs, 1);
44059 xmlResetLastError();
44060 if (mem_base != xmlMemBlocks()) {
44061 printf("Leak of %d blocks found in xmlXPathCeilingFunction",
44062 xmlMemBlocks() - mem_base);
44063 test_ret++;
44064 printf(" %d", n_ctxt);
44065 printf(" %d", n_nargs);
44066 printf("\n");
44067 }
44068 }
44069 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044070 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044071#endif
44072
Daniel Veillarda82b1822004-11-08 16:24:57 +000044073 return(test_ret);
44074}
44075
44076
44077static int
44078test_xmlXPathCompareValues(void) {
44079 int test_ret = 0;
44080
William M. Brack21e4ef22005-01-02 09:53:13 +000044081#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044082 int mem_base;
44083 int ret_val;
44084 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44085 int n_ctxt;
44086 int inf; /* less than (1) or greater than (0) */
44087 int n_inf;
44088 int strict; /* is the comparison strict */
44089 int n_strict;
44090
44091 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44092 for (n_inf = 0;n_inf < gen_nb_int;n_inf++) {
44093 for (n_strict = 0;n_strict < gen_nb_int;n_strict++) {
44094 mem_base = xmlMemBlocks();
44095 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44096 inf = gen_int(n_inf, 1);
44097 strict = gen_int(n_strict, 2);
44098
44099 ret_val = xmlXPathCompareValues(ctxt, inf, strict);
44100 desret_int(ret_val);
44101 call_tests++;
44102 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44103 des_int(n_inf, inf, 1);
44104 des_int(n_strict, strict, 2);
44105 xmlResetLastError();
44106 if (mem_base != xmlMemBlocks()) {
44107 printf("Leak of %d blocks found in xmlXPathCompareValues",
44108 xmlMemBlocks() - mem_base);
44109 test_ret++;
44110 printf(" %d", n_ctxt);
44111 printf(" %d", n_inf);
44112 printf(" %d", n_strict);
44113 printf("\n");
44114 }
44115 }
44116 }
44117 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044118 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044119#endif
44120
Daniel Veillarda82b1822004-11-08 16:24:57 +000044121 return(test_ret);
44122}
44123
44124
44125static int
44126test_xmlXPathConcatFunction(void) {
44127 int test_ret = 0;
44128
William M. Brack21e4ef22005-01-02 09:53:13 +000044129#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044130 int mem_base;
44131 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44132 int n_ctxt;
44133 int nargs; /* the number of arguments */
44134 int n_nargs;
44135
44136 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44137 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44138 mem_base = xmlMemBlocks();
44139 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44140 nargs = gen_int(n_nargs, 1);
44141
44142 xmlXPathConcatFunction(ctxt, nargs);
44143 call_tests++;
44144 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44145 des_int(n_nargs, nargs, 1);
44146 xmlResetLastError();
44147 if (mem_base != xmlMemBlocks()) {
44148 printf("Leak of %d blocks found in xmlXPathConcatFunction",
44149 xmlMemBlocks() - mem_base);
44150 test_ret++;
44151 printf(" %d", n_ctxt);
44152 printf(" %d", n_nargs);
44153 printf("\n");
44154 }
44155 }
44156 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044157 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044158#endif
44159
Daniel Veillarda82b1822004-11-08 16:24:57 +000044160 return(test_ret);
44161}
44162
44163
44164static int
44165test_xmlXPathContainsFunction(void) {
44166 int test_ret = 0;
44167
William M. Brack21e4ef22005-01-02 09:53:13 +000044168#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044169 int mem_base;
44170 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44171 int n_ctxt;
44172 int nargs; /* the number of arguments */
44173 int n_nargs;
44174
44175 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44176 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44177 mem_base = xmlMemBlocks();
44178 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44179 nargs = gen_int(n_nargs, 1);
44180
44181 xmlXPathContainsFunction(ctxt, nargs);
44182 call_tests++;
44183 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44184 des_int(n_nargs, nargs, 1);
44185 xmlResetLastError();
44186 if (mem_base != xmlMemBlocks()) {
44187 printf("Leak of %d blocks found in xmlXPathContainsFunction",
44188 xmlMemBlocks() - mem_base);
44189 test_ret++;
44190 printf(" %d", n_ctxt);
44191 printf(" %d", n_nargs);
44192 printf("\n");
44193 }
44194 }
44195 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044196 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044197#endif
44198
Daniel Veillarda82b1822004-11-08 16:24:57 +000044199 return(test_ret);
44200}
44201
44202
44203static int
44204test_xmlXPathCountFunction(void) {
44205 int test_ret = 0;
44206
William M. Brack21e4ef22005-01-02 09:53:13 +000044207#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044208 int mem_base;
44209 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44210 int n_ctxt;
44211 int nargs; /* the number of arguments */
44212 int n_nargs;
44213
44214 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44215 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44216 mem_base = xmlMemBlocks();
44217 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44218 nargs = gen_int(n_nargs, 1);
44219
44220 xmlXPathCountFunction(ctxt, nargs);
44221 call_tests++;
44222 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44223 des_int(n_nargs, nargs, 1);
44224 xmlResetLastError();
44225 if (mem_base != xmlMemBlocks()) {
44226 printf("Leak of %d blocks found in xmlXPathCountFunction",
44227 xmlMemBlocks() - mem_base);
44228 test_ret++;
44229 printf(" %d", n_ctxt);
44230 printf(" %d", n_nargs);
44231 printf("\n");
44232 }
44233 }
44234 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044235 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044236#endif
44237
Daniel Veillarda82b1822004-11-08 16:24:57 +000044238 return(test_ret);
44239}
44240
44241
44242static int
44243test_xmlXPathDebugDumpCompExpr(void) {
44244 int test_ret = 0;
44245
William M. Brack21e4ef22005-01-02 09:53:13 +000044246#if defined(LIBXML_XPATH_ENABLED) && defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044247 int mem_base;
44248 FILE * output; /* the FILE * for the output */
44249 int n_output;
44250 xmlXPathCompExprPtr comp; /* the precompiled XPath expression */
44251 int n_comp;
44252 int depth; /* the indentation level. */
44253 int n_depth;
44254
44255 for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
44256 for (n_comp = 0;n_comp < gen_nb_xmlXPathCompExprPtr;n_comp++) {
44257 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
44258 mem_base = xmlMemBlocks();
44259 output = gen_FILE_ptr(n_output, 0);
44260 comp = gen_xmlXPathCompExprPtr(n_comp, 1);
44261 depth = gen_int(n_depth, 2);
44262
44263 xmlXPathDebugDumpCompExpr(output, comp, depth);
44264 call_tests++;
44265 des_FILE_ptr(n_output, output, 0);
44266 des_xmlXPathCompExprPtr(n_comp, comp, 1);
44267 des_int(n_depth, depth, 2);
44268 xmlResetLastError();
44269 if (mem_base != xmlMemBlocks()) {
44270 printf("Leak of %d blocks found in xmlXPathDebugDumpCompExpr",
44271 xmlMemBlocks() - mem_base);
44272 test_ret++;
44273 printf(" %d", n_output);
44274 printf(" %d", n_comp);
44275 printf(" %d", n_depth);
44276 printf("\n");
44277 }
44278 }
44279 }
44280 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044281 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044282#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +000044283
Daniel Veillarda82b1822004-11-08 16:24:57 +000044284 return(test_ret);
44285}
44286
44287
44288static int
44289test_xmlXPathDebugDumpObject(void) {
44290 int test_ret = 0;
44291
William M. Brack21e4ef22005-01-02 09:53:13 +000044292#if defined(LIBXML_XPATH_ENABLED) && defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044293 int mem_base;
44294 FILE * output; /* the FILE * to dump the output */
44295 int n_output;
44296 xmlXPathObjectPtr cur; /* the object to inspect */
44297 int n_cur;
44298 int depth; /* indentation level */
44299 int n_depth;
44300
44301 for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
44302 for (n_cur = 0;n_cur < gen_nb_xmlXPathObjectPtr;n_cur++) {
44303 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
44304 mem_base = xmlMemBlocks();
44305 output = gen_FILE_ptr(n_output, 0);
44306 cur = gen_xmlXPathObjectPtr(n_cur, 1);
44307 depth = gen_int(n_depth, 2);
44308
44309 xmlXPathDebugDumpObject(output, cur, depth);
44310 call_tests++;
44311 des_FILE_ptr(n_output, output, 0);
44312 des_xmlXPathObjectPtr(n_cur, cur, 1);
44313 des_int(n_depth, depth, 2);
44314 xmlResetLastError();
44315 if (mem_base != xmlMemBlocks()) {
44316 printf("Leak of %d blocks found in xmlXPathDebugDumpObject",
44317 xmlMemBlocks() - mem_base);
44318 test_ret++;
44319 printf(" %d", n_output);
44320 printf(" %d", n_cur);
44321 printf(" %d", n_depth);
44322 printf("\n");
44323 }
44324 }
44325 }
44326 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044327 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044328#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +000044329
Daniel Veillarda82b1822004-11-08 16:24:57 +000044330 return(test_ret);
44331}
44332
44333
44334static int
44335test_xmlXPathDifference(void) {
44336 int test_ret = 0;
44337
William M. Brack21e4ef22005-01-02 09:53:13 +000044338#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044339 int mem_base;
44340 xmlNodeSetPtr ret_val;
44341 xmlNodeSetPtr nodes1; /* a node-set */
44342 int n_nodes1;
44343 xmlNodeSetPtr nodes2; /* a node-set */
44344 int n_nodes2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044345
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044346 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
44347 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
44348 mem_base = xmlMemBlocks();
44349 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
44350 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
44351
44352 ret_val = xmlXPathDifference(nodes1, nodes2);
44353 desret_xmlNodeSetPtr(ret_val);
44354 call_tests++;
44355 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
44356 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
44357 xmlResetLastError();
44358 if (mem_base != xmlMemBlocks()) {
44359 printf("Leak of %d blocks found in xmlXPathDifference",
44360 xmlMemBlocks() - mem_base);
44361 test_ret++;
44362 printf(" %d", n_nodes1);
44363 printf(" %d", n_nodes2);
44364 printf("\n");
44365 }
44366 }
44367 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044368 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044369#endif
44370
Daniel Veillarda82b1822004-11-08 16:24:57 +000044371 return(test_ret);
44372}
44373
44374
44375static int
44376test_xmlXPathDistinct(void) {
44377 int test_ret = 0;
44378
William M. Brack21e4ef22005-01-02 09:53:13 +000044379#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044380 int mem_base;
44381 xmlNodeSetPtr ret_val;
44382 xmlNodeSetPtr nodes; /* a node-set */
44383 int n_nodes;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044384
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044385 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
44386 mem_base = xmlMemBlocks();
44387 nodes = gen_xmlNodeSetPtr(n_nodes, 0);
44388
44389 ret_val = xmlXPathDistinct(nodes);
44390 desret_xmlNodeSetPtr(ret_val);
44391 call_tests++;
44392 des_xmlNodeSetPtr(n_nodes, nodes, 0);
44393 xmlResetLastError();
44394 if (mem_base != xmlMemBlocks()) {
44395 printf("Leak of %d blocks found in xmlXPathDistinct",
44396 xmlMemBlocks() - mem_base);
44397 test_ret++;
44398 printf(" %d", n_nodes);
44399 printf("\n");
44400 }
44401 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044402 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044403#endif
44404
Daniel Veillarda82b1822004-11-08 16:24:57 +000044405 return(test_ret);
44406}
44407
44408
44409static int
44410test_xmlXPathDistinctSorted(void) {
44411 int test_ret = 0;
44412
William M. Brack21e4ef22005-01-02 09:53:13 +000044413#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044414 int mem_base;
44415 xmlNodeSetPtr ret_val;
44416 xmlNodeSetPtr nodes; /* a node-set, sorted by document order */
44417 int n_nodes;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044418
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044419 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
44420 mem_base = xmlMemBlocks();
44421 nodes = gen_xmlNodeSetPtr(n_nodes, 0);
44422
44423 ret_val = xmlXPathDistinctSorted(nodes);
44424 desret_xmlNodeSetPtr(ret_val);
44425 call_tests++;
44426 des_xmlNodeSetPtr(n_nodes, nodes, 0);
44427 xmlResetLastError();
44428 if (mem_base != xmlMemBlocks()) {
44429 printf("Leak of %d blocks found in xmlXPathDistinctSorted",
44430 xmlMemBlocks() - mem_base);
44431 test_ret++;
44432 printf(" %d", n_nodes);
44433 printf("\n");
44434 }
44435 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044436 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044437#endif
44438
Daniel Veillarda82b1822004-11-08 16:24:57 +000044439 return(test_ret);
44440}
44441
44442
44443static int
44444test_xmlXPathDivValues(void) {
44445 int test_ret = 0;
44446
William M. Brack21e4ef22005-01-02 09:53:13 +000044447#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044448 int mem_base;
44449 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44450 int n_ctxt;
44451
44452 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44453 mem_base = xmlMemBlocks();
44454 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44455
44456 xmlXPathDivValues(ctxt);
44457 call_tests++;
44458 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44459 xmlResetLastError();
44460 if (mem_base != xmlMemBlocks()) {
44461 printf("Leak of %d blocks found in xmlXPathDivValues",
44462 xmlMemBlocks() - mem_base);
44463 test_ret++;
44464 printf(" %d", n_ctxt);
44465 printf("\n");
44466 }
44467 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044468 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044469#endif
44470
Daniel Veillarda82b1822004-11-08 16:24:57 +000044471 return(test_ret);
44472}
44473
44474
44475static int
44476test_xmlXPathEqualValues(void) {
44477 int test_ret = 0;
44478
William M. Brack21e4ef22005-01-02 09:53:13 +000044479#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044480 int mem_base;
44481 int ret_val;
44482 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44483 int n_ctxt;
44484
44485 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44486 mem_base = xmlMemBlocks();
44487 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44488
44489 ret_val = xmlXPathEqualValues(ctxt);
44490 desret_int(ret_val);
44491 call_tests++;
44492 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44493 xmlResetLastError();
44494 if (mem_base != xmlMemBlocks()) {
44495 printf("Leak of %d blocks found in xmlXPathEqualValues",
44496 xmlMemBlocks() - mem_base);
44497 test_ret++;
44498 printf(" %d", n_ctxt);
44499 printf("\n");
44500 }
44501 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044502 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044503#endif
44504
Daniel Veillarda82b1822004-11-08 16:24:57 +000044505 return(test_ret);
44506}
44507
44508
44509static int
44510test_xmlXPathErr(void) {
44511 int test_ret = 0;
44512
William M. Brack21e4ef22005-01-02 09:53:13 +000044513#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044514 int mem_base;
44515 xmlXPathParserContextPtr ctxt; /* a XPath parser context */
44516 int n_ctxt;
44517 int error; /* the error code */
44518 int n_error;
44519
44520 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44521 for (n_error = 0;n_error < gen_nb_int;n_error++) {
44522 mem_base = xmlMemBlocks();
44523 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44524 error = gen_int(n_error, 1);
44525
44526 xmlXPathErr(ctxt, error);
44527 call_tests++;
44528 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44529 des_int(n_error, error, 1);
44530 xmlResetLastError();
44531 if (mem_base != xmlMemBlocks()) {
44532 printf("Leak of %d blocks found in xmlXPathErr",
44533 xmlMemBlocks() - mem_base);
44534 test_ret++;
44535 printf(" %d", n_ctxt);
44536 printf(" %d", n_error);
44537 printf("\n");
44538 }
44539 }
44540 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044541 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044542#endif
44543
Daniel Veillarda82b1822004-11-08 16:24:57 +000044544 return(test_ret);
44545}
44546
44547
44548static int
44549test_xmlXPathEvalExpr(void) {
44550 int test_ret = 0;
44551
William M. Brack21e4ef22005-01-02 09:53:13 +000044552#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044553 int mem_base;
44554 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44555 int n_ctxt;
44556
44557 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44558 mem_base = xmlMemBlocks();
44559 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44560
44561 xmlXPathEvalExpr(ctxt);
44562 call_tests++;
44563 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44564 xmlResetLastError();
44565 if (mem_base != xmlMemBlocks()) {
44566 printf("Leak of %d blocks found in xmlXPathEvalExpr",
44567 xmlMemBlocks() - mem_base);
44568 test_ret++;
44569 printf(" %d", n_ctxt);
44570 printf("\n");
44571 }
44572 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044573 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044574#endif
44575
Daniel Veillarda82b1822004-11-08 16:24:57 +000044576 return(test_ret);
44577}
44578
44579
44580static int
44581test_xmlXPathEvaluatePredicateResult(void) {
44582 int test_ret = 0;
44583
William M. Brack21e4ef22005-01-02 09:53:13 +000044584#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044585 int mem_base;
44586 int ret_val;
44587 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44588 int n_ctxt;
44589 xmlXPathObjectPtr res; /* the Predicate Expression evaluation result */
44590 int n_res;
44591
44592 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44593 for (n_res = 0;n_res < gen_nb_xmlXPathObjectPtr;n_res++) {
44594 mem_base = xmlMemBlocks();
44595 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44596 res = gen_xmlXPathObjectPtr(n_res, 1);
44597
44598 ret_val = xmlXPathEvaluatePredicateResult(ctxt, res);
44599 desret_int(ret_val);
44600 call_tests++;
44601 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44602 des_xmlXPathObjectPtr(n_res, res, 1);
44603 xmlResetLastError();
44604 if (mem_base != xmlMemBlocks()) {
44605 printf("Leak of %d blocks found in xmlXPathEvaluatePredicateResult",
44606 xmlMemBlocks() - mem_base);
44607 test_ret++;
44608 printf(" %d", n_ctxt);
44609 printf(" %d", n_res);
44610 printf("\n");
44611 }
44612 }
44613 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044614 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044615#endif
44616
Daniel Veillarda82b1822004-11-08 16:24:57 +000044617 return(test_ret);
44618}
44619
44620
44621static int
44622test_xmlXPathFalseFunction(void) {
44623 int test_ret = 0;
44624
William M. Brack21e4ef22005-01-02 09:53:13 +000044625#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044626 int mem_base;
44627 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44628 int n_ctxt;
44629 int nargs; /* the number of arguments */
44630 int n_nargs;
44631
44632 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44633 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44634 mem_base = xmlMemBlocks();
44635 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44636 nargs = gen_int(n_nargs, 1);
44637
44638 xmlXPathFalseFunction(ctxt, nargs);
44639 call_tests++;
44640 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44641 des_int(n_nargs, nargs, 1);
44642 xmlResetLastError();
44643 if (mem_base != xmlMemBlocks()) {
44644 printf("Leak of %d blocks found in xmlXPathFalseFunction",
44645 xmlMemBlocks() - mem_base);
44646 test_ret++;
44647 printf(" %d", n_ctxt);
44648 printf(" %d", n_nargs);
44649 printf("\n");
44650 }
44651 }
44652 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044653 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044654#endif
44655
Daniel Veillarda82b1822004-11-08 16:24:57 +000044656 return(test_ret);
44657}
44658
44659
44660static int
44661test_xmlXPathFloorFunction(void) {
44662 int test_ret = 0;
44663
William M. Brack21e4ef22005-01-02 09:53:13 +000044664#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044665 int mem_base;
44666 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44667 int n_ctxt;
44668 int nargs; /* the number of arguments */
44669 int n_nargs;
44670
44671 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44672 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44673 mem_base = xmlMemBlocks();
44674 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44675 nargs = gen_int(n_nargs, 1);
44676
44677 xmlXPathFloorFunction(ctxt, nargs);
44678 call_tests++;
44679 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44680 des_int(n_nargs, nargs, 1);
44681 xmlResetLastError();
44682 if (mem_base != xmlMemBlocks()) {
44683 printf("Leak of %d blocks found in xmlXPathFloorFunction",
44684 xmlMemBlocks() - mem_base);
44685 test_ret++;
44686 printf(" %d", n_ctxt);
44687 printf(" %d", n_nargs);
44688 printf("\n");
44689 }
44690 }
44691 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044692 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044693#endif
44694
Daniel Veillarda82b1822004-11-08 16:24:57 +000044695 return(test_ret);
44696}
44697
44698
44699static int
44700test_xmlXPathFunctionLookup(void) {
44701 int test_ret = 0;
44702
44703
44704 /* missing type support */
44705 return(test_ret);
44706}
44707
44708
44709static int
44710test_xmlXPathFunctionLookupNS(void) {
44711 int test_ret = 0;
44712
44713
44714 /* missing type support */
44715 return(test_ret);
44716}
44717
44718
44719static int
44720test_xmlXPathHasSameNodes(void) {
44721 int test_ret = 0;
44722
William M. Brack21e4ef22005-01-02 09:53:13 +000044723#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044724 int mem_base;
44725 int ret_val;
44726 xmlNodeSetPtr nodes1; /* a node-set */
44727 int n_nodes1;
44728 xmlNodeSetPtr nodes2; /* a node-set */
44729 int n_nodes2;
44730
44731 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
44732 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
44733 mem_base = xmlMemBlocks();
44734 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
44735 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
44736
44737 ret_val = xmlXPathHasSameNodes(nodes1, nodes2);
44738 desret_int(ret_val);
44739 call_tests++;
44740 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
44741 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
44742 xmlResetLastError();
44743 if (mem_base != xmlMemBlocks()) {
44744 printf("Leak of %d blocks found in xmlXPathHasSameNodes",
44745 xmlMemBlocks() - mem_base);
44746 test_ret++;
44747 printf(" %d", n_nodes1);
44748 printf(" %d", n_nodes2);
44749 printf("\n");
44750 }
44751 }
44752 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044753 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044754#endif
44755
Daniel Veillarda82b1822004-11-08 16:24:57 +000044756 return(test_ret);
44757}
44758
44759
44760static int
44761test_xmlXPathIdFunction(void) {
44762 int test_ret = 0;
44763
William M. Brack21e4ef22005-01-02 09:53:13 +000044764#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044765 int mem_base;
44766 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44767 int n_ctxt;
44768 int nargs; /* the number of arguments */
44769 int n_nargs;
44770
44771 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44772 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44773 mem_base = xmlMemBlocks();
44774 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44775 nargs = gen_int(n_nargs, 1);
44776
44777 xmlXPathIdFunction(ctxt, nargs);
44778 call_tests++;
44779 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44780 des_int(n_nargs, nargs, 1);
44781 xmlResetLastError();
44782 if (mem_base != xmlMemBlocks()) {
44783 printf("Leak of %d blocks found in xmlXPathIdFunction",
44784 xmlMemBlocks() - mem_base);
44785 test_ret++;
44786 printf(" %d", n_ctxt);
44787 printf(" %d", n_nargs);
44788 printf("\n");
44789 }
44790 }
44791 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044792 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044793#endif
44794
Daniel Veillarda82b1822004-11-08 16:24:57 +000044795 return(test_ret);
44796}
44797
44798
44799static int
44800test_xmlXPathIntersection(void) {
44801 int test_ret = 0;
44802
William M. Brack21e4ef22005-01-02 09:53:13 +000044803#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044804 int mem_base;
44805 xmlNodeSetPtr ret_val;
44806 xmlNodeSetPtr nodes1; /* a node-set */
44807 int n_nodes1;
44808 xmlNodeSetPtr nodes2; /* a node-set */
44809 int n_nodes2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044810
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044811 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
44812 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
44813 mem_base = xmlMemBlocks();
44814 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
44815 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
44816
44817 ret_val = xmlXPathIntersection(nodes1, nodes2);
44818 desret_xmlNodeSetPtr(ret_val);
44819 call_tests++;
44820 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
44821 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
44822 xmlResetLastError();
44823 if (mem_base != xmlMemBlocks()) {
44824 printf("Leak of %d blocks found in xmlXPathIntersection",
44825 xmlMemBlocks() - mem_base);
44826 test_ret++;
44827 printf(" %d", n_nodes1);
44828 printf(" %d", n_nodes2);
44829 printf("\n");
44830 }
44831 }
44832 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044833 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044834#endif
44835
Daniel Veillarda82b1822004-11-08 16:24:57 +000044836 return(test_ret);
44837}
44838
44839
44840static int
44841test_xmlXPathIsNodeType(void) {
44842 int test_ret = 0;
44843
William M. Brack21e4ef22005-01-02 09:53:13 +000044844#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044845 int mem_base;
44846 int ret_val;
44847 xmlChar * name; /* a name string */
44848 int n_name;
44849
44850 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
44851 mem_base = xmlMemBlocks();
44852 name = gen_const_xmlChar_ptr(n_name, 0);
44853
William M. Brackf13f77f2004-11-12 16:03:48 +000044854 ret_val = xmlXPathIsNodeType((const xmlChar *)name);
Daniel Veillarda82b1822004-11-08 16:24:57 +000044855 desret_int(ret_val);
44856 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000044857 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
Daniel Veillarda82b1822004-11-08 16:24:57 +000044858 xmlResetLastError();
44859 if (mem_base != xmlMemBlocks()) {
44860 printf("Leak of %d blocks found in xmlXPathIsNodeType",
44861 xmlMemBlocks() - mem_base);
44862 test_ret++;
44863 printf(" %d", n_name);
44864 printf("\n");
44865 }
44866 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044867 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044868#endif
44869
Daniel Veillarda82b1822004-11-08 16:24:57 +000044870 return(test_ret);
44871}
44872
44873
44874static int
44875test_xmlXPathLangFunction(void) {
44876 int test_ret = 0;
44877
William M. Brack21e4ef22005-01-02 09:53:13 +000044878#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044879 int mem_base;
44880 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44881 int n_ctxt;
44882 int nargs; /* the number of arguments */
44883 int n_nargs;
44884
44885 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44886 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44887 mem_base = xmlMemBlocks();
44888 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44889 nargs = gen_int(n_nargs, 1);
44890
44891 xmlXPathLangFunction(ctxt, nargs);
44892 call_tests++;
44893 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44894 des_int(n_nargs, nargs, 1);
44895 xmlResetLastError();
44896 if (mem_base != xmlMemBlocks()) {
44897 printf("Leak of %d blocks found in xmlXPathLangFunction",
44898 xmlMemBlocks() - mem_base);
44899 test_ret++;
44900 printf(" %d", n_ctxt);
44901 printf(" %d", n_nargs);
44902 printf("\n");
44903 }
44904 }
44905 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044906 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044907#endif
44908
Daniel Veillarda82b1822004-11-08 16:24:57 +000044909 return(test_ret);
44910}
44911
44912
44913static int
44914test_xmlXPathLastFunction(void) {
44915 int test_ret = 0;
44916
William M. Brack21e4ef22005-01-02 09:53:13 +000044917#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044918 int mem_base;
44919 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44920 int n_ctxt;
44921 int nargs; /* the number of arguments */
44922 int n_nargs;
44923
44924 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44925 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44926 mem_base = xmlMemBlocks();
44927 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44928 nargs = gen_int(n_nargs, 1);
44929
44930 xmlXPathLastFunction(ctxt, nargs);
44931 call_tests++;
44932 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44933 des_int(n_nargs, nargs, 1);
44934 xmlResetLastError();
44935 if (mem_base != xmlMemBlocks()) {
44936 printf("Leak of %d blocks found in xmlXPathLastFunction",
44937 xmlMemBlocks() - mem_base);
44938 test_ret++;
44939 printf(" %d", n_ctxt);
44940 printf(" %d", n_nargs);
44941 printf("\n");
44942 }
44943 }
44944 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044945 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044946#endif
44947
Daniel Veillarda82b1822004-11-08 16:24:57 +000044948 return(test_ret);
44949}
44950
44951
44952static int
44953test_xmlXPathLeading(void) {
44954 int test_ret = 0;
44955
William M. Brack21e4ef22005-01-02 09:53:13 +000044956#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044957 int mem_base;
44958 xmlNodeSetPtr ret_val;
44959 xmlNodeSetPtr nodes1; /* a node-set */
44960 int n_nodes1;
44961 xmlNodeSetPtr nodes2; /* a node-set */
44962 int n_nodes2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044963
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044964 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
44965 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
44966 mem_base = xmlMemBlocks();
44967 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
44968 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
44969
44970 ret_val = xmlXPathLeading(nodes1, nodes2);
44971 desret_xmlNodeSetPtr(ret_val);
44972 call_tests++;
44973 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
44974 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
44975 xmlResetLastError();
44976 if (mem_base != xmlMemBlocks()) {
44977 printf("Leak of %d blocks found in xmlXPathLeading",
44978 xmlMemBlocks() - mem_base);
44979 test_ret++;
44980 printf(" %d", n_nodes1);
44981 printf(" %d", n_nodes2);
44982 printf("\n");
44983 }
44984 }
44985 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044986 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044987#endif
44988
Daniel Veillarda82b1822004-11-08 16:24:57 +000044989 return(test_ret);
44990}
44991
44992
44993static int
44994test_xmlXPathLeadingSorted(void) {
44995 int test_ret = 0;
44996
William M. Brack21e4ef22005-01-02 09:53:13 +000044997#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044998 int mem_base;
44999 xmlNodeSetPtr ret_val;
45000 xmlNodeSetPtr nodes1; /* a node-set, sorted by document order */
45001 int n_nodes1;
45002 xmlNodeSetPtr nodes2; /* a node-set, sorted by document order */
45003 int n_nodes2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045004
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045005 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
45006 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
45007 mem_base = xmlMemBlocks();
45008 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
45009 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
45010
45011 ret_val = xmlXPathLeadingSorted(nodes1, nodes2);
45012 desret_xmlNodeSetPtr(ret_val);
45013 call_tests++;
45014 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
45015 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
45016 xmlResetLastError();
45017 if (mem_base != xmlMemBlocks()) {
45018 printf("Leak of %d blocks found in xmlXPathLeadingSorted",
45019 xmlMemBlocks() - mem_base);
45020 test_ret++;
45021 printf(" %d", n_nodes1);
45022 printf(" %d", n_nodes2);
45023 printf("\n");
45024 }
45025 }
45026 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045027 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045028#endif
45029
Daniel Veillarda82b1822004-11-08 16:24:57 +000045030 return(test_ret);
45031}
45032
45033
45034static int
45035test_xmlXPathLocalNameFunction(void) {
45036 int test_ret = 0;
45037
William M. Brack21e4ef22005-01-02 09:53:13 +000045038#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045039 int mem_base;
45040 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45041 int n_ctxt;
45042 int nargs; /* the number of arguments */
45043 int n_nargs;
45044
45045 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45046 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
45047 mem_base = xmlMemBlocks();
45048 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45049 nargs = gen_int(n_nargs, 1);
45050
45051 xmlXPathLocalNameFunction(ctxt, nargs);
45052 call_tests++;
45053 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45054 des_int(n_nargs, nargs, 1);
45055 xmlResetLastError();
45056 if (mem_base != xmlMemBlocks()) {
45057 printf("Leak of %d blocks found in xmlXPathLocalNameFunction",
45058 xmlMemBlocks() - mem_base);
45059 test_ret++;
45060 printf(" %d", n_ctxt);
45061 printf(" %d", n_nargs);
45062 printf("\n");
45063 }
45064 }
45065 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045066 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045067#endif
45068
Daniel Veillarda82b1822004-11-08 16:24:57 +000045069 return(test_ret);
45070}
45071
45072
45073static int
45074test_xmlXPathModValues(void) {
45075 int test_ret = 0;
45076
William M. Brack21e4ef22005-01-02 09:53:13 +000045077#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045078 int mem_base;
45079 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45080 int n_ctxt;
45081
45082 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45083 mem_base = xmlMemBlocks();
45084 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45085
45086 xmlXPathModValues(ctxt);
45087 call_tests++;
45088 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45089 xmlResetLastError();
45090 if (mem_base != xmlMemBlocks()) {
45091 printf("Leak of %d blocks found in xmlXPathModValues",
45092 xmlMemBlocks() - mem_base);
45093 test_ret++;
45094 printf(" %d", n_ctxt);
45095 printf("\n");
45096 }
45097 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045098 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045099#endif
45100
Daniel Veillarda82b1822004-11-08 16:24:57 +000045101 return(test_ret);
45102}
45103
45104
45105static int
45106test_xmlXPathMultValues(void) {
45107 int test_ret = 0;
45108
William M. Brack21e4ef22005-01-02 09:53:13 +000045109#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045110 int mem_base;
45111 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45112 int n_ctxt;
45113
45114 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45115 mem_base = xmlMemBlocks();
45116 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45117
45118 xmlXPathMultValues(ctxt);
45119 call_tests++;
45120 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45121 xmlResetLastError();
45122 if (mem_base != xmlMemBlocks()) {
45123 printf("Leak of %d blocks found in xmlXPathMultValues",
45124 xmlMemBlocks() - mem_base);
45125 test_ret++;
45126 printf(" %d", n_ctxt);
45127 printf("\n");
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_xmlXPathNamespaceURIFunction(void) {
45139 int test_ret = 0;
45140
William M. Brack21e4ef22005-01-02 09:53:13 +000045141#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045142 int mem_base;
45143 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45144 int n_ctxt;
45145 int nargs; /* the number of arguments */
45146 int n_nargs;
45147
45148 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45149 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
45150 mem_base = xmlMemBlocks();
45151 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45152 nargs = gen_int(n_nargs, 1);
45153
45154 xmlXPathNamespaceURIFunction(ctxt, nargs);
45155 call_tests++;
45156 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45157 des_int(n_nargs, nargs, 1);
45158 xmlResetLastError();
45159 if (mem_base != xmlMemBlocks()) {
45160 printf("Leak of %d blocks found in xmlXPathNamespaceURIFunction",
45161 xmlMemBlocks() - mem_base);
45162 test_ret++;
45163 printf(" %d", n_ctxt);
45164 printf(" %d", n_nargs);
45165 printf("\n");
45166 }
45167 }
45168 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045169 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045170#endif
45171
Daniel Veillarda82b1822004-11-08 16:24:57 +000045172 return(test_ret);
45173}
45174
45175
45176static int
45177test_xmlXPathNewBoolean(void) {
45178 int test_ret = 0;
45179
William M. Brack21e4ef22005-01-02 09:53:13 +000045180#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045181 int mem_base;
45182 xmlXPathObjectPtr ret_val;
45183 int val; /* the boolean value */
45184 int n_val;
45185
45186 for (n_val = 0;n_val < gen_nb_int;n_val++) {
45187 mem_base = xmlMemBlocks();
45188 val = gen_int(n_val, 0);
45189
45190 ret_val = xmlXPathNewBoolean(val);
45191 desret_xmlXPathObjectPtr(ret_val);
45192 call_tests++;
45193 des_int(n_val, val, 0);
45194 xmlResetLastError();
45195 if (mem_base != xmlMemBlocks()) {
45196 printf("Leak of %d blocks found in xmlXPathNewBoolean",
45197 xmlMemBlocks() - mem_base);
45198 test_ret++;
45199 printf(" %d", n_val);
45200 printf("\n");
45201 }
45202 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045203 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045204#endif
45205
Daniel Veillarda82b1822004-11-08 16:24:57 +000045206 return(test_ret);
45207}
45208
45209
45210static int
45211test_xmlXPathNewCString(void) {
45212 int test_ret = 0;
45213
William M. Brack21e4ef22005-01-02 09:53:13 +000045214#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045215 int mem_base;
45216 xmlXPathObjectPtr ret_val;
45217 char * val; /* the char * value */
45218 int n_val;
45219
45220 for (n_val = 0;n_val < gen_nb_const_char_ptr;n_val++) {
45221 mem_base = xmlMemBlocks();
45222 val = gen_const_char_ptr(n_val, 0);
45223
William M. Brackf13f77f2004-11-12 16:03:48 +000045224 ret_val = xmlXPathNewCString((const char *)val);
Daniel Veillarda82b1822004-11-08 16:24:57 +000045225 desret_xmlXPathObjectPtr(ret_val);
45226 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000045227 des_const_char_ptr(n_val, (const char *)val, 0);
Daniel Veillarda82b1822004-11-08 16:24:57 +000045228 xmlResetLastError();
45229 if (mem_base != xmlMemBlocks()) {
45230 printf("Leak of %d blocks found in xmlXPathNewCString",
45231 xmlMemBlocks() - mem_base);
45232 test_ret++;
45233 printf(" %d", n_val);
45234 printf("\n");
45235 }
45236 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045237 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045238#endif
45239
Daniel Veillarda82b1822004-11-08 16:24:57 +000045240 return(test_ret);
45241}
45242
45243
45244static int
45245test_xmlXPathNewFloat(void) {
45246 int test_ret = 0;
45247
William M. Brack21e4ef22005-01-02 09:53:13 +000045248#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045249 int mem_base;
45250 xmlXPathObjectPtr ret_val;
45251 double val; /* the double value */
45252 int n_val;
45253
45254 for (n_val = 0;n_val < gen_nb_double;n_val++) {
45255 mem_base = xmlMemBlocks();
45256 val = gen_double(n_val, 0);
45257
45258 ret_val = xmlXPathNewFloat(val);
45259 desret_xmlXPathObjectPtr(ret_val);
45260 call_tests++;
45261 des_double(n_val, val, 0);
45262 xmlResetLastError();
45263 if (mem_base != xmlMemBlocks()) {
45264 printf("Leak of %d blocks found in xmlXPathNewFloat",
45265 xmlMemBlocks() - mem_base);
45266 test_ret++;
45267 printf(" %d", n_val);
45268 printf("\n");
45269 }
45270 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045271 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045272#endif
45273
Daniel Veillarda82b1822004-11-08 16:24:57 +000045274 return(test_ret);
45275}
45276
45277
45278static int
45279test_xmlXPathNewNodeSet(void) {
45280 int test_ret = 0;
45281
William M. Brack21e4ef22005-01-02 09:53:13 +000045282#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045283 int mem_base;
45284 xmlXPathObjectPtr ret_val;
45285 xmlNodePtr val; /* the NodePtr value */
45286 int n_val;
45287
45288 for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
45289 mem_base = xmlMemBlocks();
45290 val = gen_xmlNodePtr(n_val, 0);
45291
45292 ret_val = xmlXPathNewNodeSet(val);
45293 desret_xmlXPathObjectPtr(ret_val);
45294 call_tests++;
45295 des_xmlNodePtr(n_val, val, 0);
45296 xmlResetLastError();
45297 if (mem_base != xmlMemBlocks()) {
45298 printf("Leak of %d blocks found in xmlXPathNewNodeSet",
45299 xmlMemBlocks() - mem_base);
45300 test_ret++;
45301 printf(" %d", n_val);
45302 printf("\n");
45303 }
45304 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045305 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045306#endif
45307
Daniel Veillarda82b1822004-11-08 16:24:57 +000045308 return(test_ret);
45309}
45310
45311
45312static int
45313test_xmlXPathNewNodeSetList(void) {
45314 int test_ret = 0;
45315
William M. Brack21e4ef22005-01-02 09:53:13 +000045316#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045317 int mem_base;
45318 xmlXPathObjectPtr ret_val;
45319 xmlNodeSetPtr val; /* an existing NodeSet */
45320 int n_val;
45321
45322 for (n_val = 0;n_val < gen_nb_xmlNodeSetPtr;n_val++) {
45323 mem_base = xmlMemBlocks();
45324 val = gen_xmlNodeSetPtr(n_val, 0);
45325
45326 ret_val = xmlXPathNewNodeSetList(val);
45327 desret_xmlXPathObjectPtr(ret_val);
45328 call_tests++;
45329 des_xmlNodeSetPtr(n_val, val, 0);
45330 xmlResetLastError();
45331 if (mem_base != xmlMemBlocks()) {
45332 printf("Leak of %d blocks found in xmlXPathNewNodeSetList",
45333 xmlMemBlocks() - mem_base);
45334 test_ret++;
45335 printf(" %d", n_val);
45336 printf("\n");
45337 }
45338 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045339 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045340#endif
45341
Daniel Veillarda82b1822004-11-08 16:24:57 +000045342 return(test_ret);
45343}
45344
45345
45346static int
45347test_xmlXPathNewParserContext(void) {
45348 int test_ret = 0;
45349
45350
45351 /* missing type support */
45352 return(test_ret);
45353}
45354
45355
45356static int
45357test_xmlXPathNewString(void) {
45358 int test_ret = 0;
45359
William M. Brack21e4ef22005-01-02 09:53:13 +000045360#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045361 int mem_base;
45362 xmlXPathObjectPtr ret_val;
45363 xmlChar * val; /* the xmlChar * value */
45364 int n_val;
45365
45366 for (n_val = 0;n_val < gen_nb_const_xmlChar_ptr;n_val++) {
45367 mem_base = xmlMemBlocks();
45368 val = gen_const_xmlChar_ptr(n_val, 0);
45369
William M. Brackf13f77f2004-11-12 16:03:48 +000045370 ret_val = xmlXPathNewString((const xmlChar *)val);
Daniel Veillarda82b1822004-11-08 16:24:57 +000045371 desret_xmlXPathObjectPtr(ret_val);
45372 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000045373 des_const_xmlChar_ptr(n_val, (const xmlChar *)val, 0);
Daniel Veillarda82b1822004-11-08 16:24:57 +000045374 xmlResetLastError();
45375 if (mem_base != xmlMemBlocks()) {
45376 printf("Leak of %d blocks found in xmlXPathNewString",
45377 xmlMemBlocks() - mem_base);
45378 test_ret++;
45379 printf(" %d", n_val);
45380 printf("\n");
45381 }
45382 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045383 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045384#endif
45385
Daniel Veillarda82b1822004-11-08 16:24:57 +000045386 return(test_ret);
45387}
45388
45389
45390static int
45391test_xmlXPathNextAncestor(void) {
45392 int test_ret = 0;
45393
William M. Brack21e4ef22005-01-02 09:53:13 +000045394#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045395 int mem_base;
45396 xmlNodePtr ret_val;
45397 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45398 int n_ctxt;
45399 xmlNodePtr cur; /* the current node in the traversal */
45400 int n_cur;
45401
45402 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45403 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45404 mem_base = xmlMemBlocks();
45405 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45406 cur = gen_xmlNodePtr(n_cur, 1);
45407
45408 ret_val = xmlXPathNextAncestor(ctxt, cur);
45409 desret_xmlNodePtr(ret_val);
45410 call_tests++;
45411 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45412 des_xmlNodePtr(n_cur, cur, 1);
45413 xmlResetLastError();
45414 if (mem_base != xmlMemBlocks()) {
45415 printf("Leak of %d blocks found in xmlXPathNextAncestor",
45416 xmlMemBlocks() - mem_base);
45417 test_ret++;
45418 printf(" %d", n_ctxt);
45419 printf(" %d", n_cur);
45420 printf("\n");
45421 }
45422 }
45423 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045424 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045425#endif
45426
Daniel Veillarda82b1822004-11-08 16:24:57 +000045427 return(test_ret);
45428}
45429
45430
45431static int
45432test_xmlXPathNextAncestorOrSelf(void) {
45433 int test_ret = 0;
45434
William M. Brack21e4ef22005-01-02 09:53:13 +000045435#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045436 int mem_base;
45437 xmlNodePtr ret_val;
45438 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45439 int n_ctxt;
45440 xmlNodePtr cur; /* the current node in the traversal */
45441 int n_cur;
45442
45443 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45444 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45445 mem_base = xmlMemBlocks();
45446 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45447 cur = gen_xmlNodePtr(n_cur, 1);
45448
45449 ret_val = xmlXPathNextAncestorOrSelf(ctxt, cur);
45450 desret_xmlNodePtr(ret_val);
45451 call_tests++;
45452 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45453 des_xmlNodePtr(n_cur, cur, 1);
45454 xmlResetLastError();
45455 if (mem_base != xmlMemBlocks()) {
45456 printf("Leak of %d blocks found in xmlXPathNextAncestorOrSelf",
45457 xmlMemBlocks() - mem_base);
45458 test_ret++;
45459 printf(" %d", n_ctxt);
45460 printf(" %d", n_cur);
45461 printf("\n");
45462 }
45463 }
45464 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045465 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045466#endif
45467
Daniel Veillarda82b1822004-11-08 16:24:57 +000045468 return(test_ret);
45469}
45470
45471
45472static int
45473test_xmlXPathNextAttribute(void) {
45474 int test_ret = 0;
45475
William M. Brack21e4ef22005-01-02 09:53:13 +000045476#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045477 int mem_base;
45478 xmlNodePtr ret_val;
45479 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45480 int n_ctxt;
45481 xmlNodePtr cur; /* the current attribute in the traversal */
45482 int n_cur;
45483
45484 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45485 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45486 mem_base = xmlMemBlocks();
45487 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45488 cur = gen_xmlNodePtr(n_cur, 1);
45489
45490 ret_val = xmlXPathNextAttribute(ctxt, cur);
45491 desret_xmlNodePtr(ret_val);
45492 call_tests++;
45493 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45494 des_xmlNodePtr(n_cur, cur, 1);
45495 xmlResetLastError();
45496 if (mem_base != xmlMemBlocks()) {
45497 printf("Leak of %d blocks found in xmlXPathNextAttribute",
45498 xmlMemBlocks() - mem_base);
45499 test_ret++;
45500 printf(" %d", n_ctxt);
45501 printf(" %d", n_cur);
45502 printf("\n");
45503 }
45504 }
45505 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045506 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045507#endif
45508
Daniel Veillarda82b1822004-11-08 16:24:57 +000045509 return(test_ret);
45510}
45511
45512
45513static int
45514test_xmlXPathNextChild(void) {
45515 int test_ret = 0;
45516
William M. Brack21e4ef22005-01-02 09:53:13 +000045517#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045518 int mem_base;
45519 xmlNodePtr ret_val;
45520 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45521 int n_ctxt;
45522 xmlNodePtr cur; /* the current node in the traversal */
45523 int n_cur;
45524
45525 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45526 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45527 mem_base = xmlMemBlocks();
45528 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45529 cur = gen_xmlNodePtr(n_cur, 1);
45530
45531 ret_val = xmlXPathNextChild(ctxt, cur);
45532 desret_xmlNodePtr(ret_val);
45533 call_tests++;
45534 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45535 des_xmlNodePtr(n_cur, cur, 1);
45536 xmlResetLastError();
45537 if (mem_base != xmlMemBlocks()) {
45538 printf("Leak of %d blocks found in xmlXPathNextChild",
45539 xmlMemBlocks() - mem_base);
45540 test_ret++;
45541 printf(" %d", n_ctxt);
45542 printf(" %d", n_cur);
45543 printf("\n");
45544 }
45545 }
45546 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045547 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045548#endif
45549
Daniel Veillarda82b1822004-11-08 16:24:57 +000045550 return(test_ret);
45551}
45552
45553
45554static int
45555test_xmlXPathNextDescendant(void) {
45556 int test_ret = 0;
45557
William M. Brack21e4ef22005-01-02 09:53:13 +000045558#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045559 int mem_base;
45560 xmlNodePtr ret_val;
45561 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45562 int n_ctxt;
45563 xmlNodePtr cur; /* the current node in the traversal */
45564 int n_cur;
45565
45566 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45567 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45568 mem_base = xmlMemBlocks();
45569 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45570 cur = gen_xmlNodePtr(n_cur, 1);
45571
45572 ret_val = xmlXPathNextDescendant(ctxt, cur);
45573 desret_xmlNodePtr(ret_val);
45574 call_tests++;
45575 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45576 des_xmlNodePtr(n_cur, cur, 1);
45577 xmlResetLastError();
45578 if (mem_base != xmlMemBlocks()) {
45579 printf("Leak of %d blocks found in xmlXPathNextDescendant",
45580 xmlMemBlocks() - mem_base);
45581 test_ret++;
45582 printf(" %d", n_ctxt);
45583 printf(" %d", n_cur);
45584 printf("\n");
45585 }
45586 }
45587 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045588 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045589#endif
45590
Daniel Veillarda82b1822004-11-08 16:24:57 +000045591 return(test_ret);
45592}
45593
45594
45595static int
45596test_xmlXPathNextDescendantOrSelf(void) {
45597 int test_ret = 0;
45598
William M. Brack21e4ef22005-01-02 09:53:13 +000045599#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045600 int mem_base;
45601 xmlNodePtr ret_val;
45602 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45603 int n_ctxt;
45604 xmlNodePtr cur; /* the current node in the traversal */
45605 int n_cur;
45606
45607 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45608 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45609 mem_base = xmlMemBlocks();
45610 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45611 cur = gen_xmlNodePtr(n_cur, 1);
45612
45613 ret_val = xmlXPathNextDescendantOrSelf(ctxt, cur);
45614 desret_xmlNodePtr(ret_val);
45615 call_tests++;
45616 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45617 des_xmlNodePtr(n_cur, cur, 1);
45618 xmlResetLastError();
45619 if (mem_base != xmlMemBlocks()) {
45620 printf("Leak of %d blocks found in xmlXPathNextDescendantOrSelf",
45621 xmlMemBlocks() - mem_base);
45622 test_ret++;
45623 printf(" %d", n_ctxt);
45624 printf(" %d", n_cur);
45625 printf("\n");
45626 }
45627 }
45628 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045629 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045630#endif
45631
Daniel Veillarda82b1822004-11-08 16:24:57 +000045632 return(test_ret);
45633}
45634
45635
45636static int
45637test_xmlXPathNextFollowing(void) {
45638 int test_ret = 0;
45639
William M. Brack21e4ef22005-01-02 09:53:13 +000045640#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045641 int mem_base;
45642 xmlNodePtr ret_val;
45643 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45644 int n_ctxt;
45645 xmlNodePtr cur; /* the current node in the traversal */
45646 int n_cur;
45647
45648 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45649 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45650 mem_base = xmlMemBlocks();
45651 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45652 cur = gen_xmlNodePtr(n_cur, 1);
45653
45654 ret_val = xmlXPathNextFollowing(ctxt, cur);
45655 desret_xmlNodePtr(ret_val);
45656 call_tests++;
45657 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45658 des_xmlNodePtr(n_cur, cur, 1);
45659 xmlResetLastError();
45660 if (mem_base != xmlMemBlocks()) {
45661 printf("Leak of %d blocks found in xmlXPathNextFollowing",
45662 xmlMemBlocks() - mem_base);
45663 test_ret++;
45664 printf(" %d", n_ctxt);
45665 printf(" %d", n_cur);
45666 printf("\n");
45667 }
45668 }
45669 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045670 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045671#endif
45672
Daniel Veillarda82b1822004-11-08 16:24:57 +000045673 return(test_ret);
45674}
45675
45676
45677static int
45678test_xmlXPathNextFollowingSibling(void) {
45679 int test_ret = 0;
45680
William M. Brack21e4ef22005-01-02 09:53:13 +000045681#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045682 int mem_base;
45683 xmlNodePtr ret_val;
45684 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45685 int n_ctxt;
45686 xmlNodePtr cur; /* the current node in the traversal */
45687 int n_cur;
45688
45689 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45690 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45691 mem_base = xmlMemBlocks();
45692 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45693 cur = gen_xmlNodePtr(n_cur, 1);
45694
45695 ret_val = xmlXPathNextFollowingSibling(ctxt, cur);
45696 desret_xmlNodePtr(ret_val);
45697 call_tests++;
45698 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45699 des_xmlNodePtr(n_cur, cur, 1);
45700 xmlResetLastError();
45701 if (mem_base != xmlMemBlocks()) {
45702 printf("Leak of %d blocks found in xmlXPathNextFollowingSibling",
45703 xmlMemBlocks() - mem_base);
45704 test_ret++;
45705 printf(" %d", n_ctxt);
45706 printf(" %d", n_cur);
45707 printf("\n");
45708 }
45709 }
45710 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045711 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045712#endif
45713
Daniel Veillarda82b1822004-11-08 16:24:57 +000045714 return(test_ret);
45715}
45716
45717
45718static int
45719test_xmlXPathNextNamespace(void) {
45720 int test_ret = 0;
45721
William M. Brack21e4ef22005-01-02 09:53:13 +000045722#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045723 int mem_base;
45724 xmlNodePtr ret_val;
45725 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45726 int n_ctxt;
45727 xmlNodePtr cur; /* the current attribute in the traversal */
45728 int n_cur;
45729
45730 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45731 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45732 mem_base = xmlMemBlocks();
45733 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45734 cur = gen_xmlNodePtr(n_cur, 1);
45735
45736 ret_val = xmlXPathNextNamespace(ctxt, cur);
45737 desret_xmlNodePtr(ret_val);
45738 call_tests++;
45739 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45740 des_xmlNodePtr(n_cur, cur, 1);
45741 xmlResetLastError();
45742 if (mem_base != xmlMemBlocks()) {
45743 printf("Leak of %d blocks found in xmlXPathNextNamespace",
45744 xmlMemBlocks() - mem_base);
45745 test_ret++;
45746 printf(" %d", n_ctxt);
45747 printf(" %d", n_cur);
45748 printf("\n");
45749 }
45750 }
45751 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045752 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045753#endif
45754
Daniel Veillarda82b1822004-11-08 16:24:57 +000045755 return(test_ret);
45756}
45757
45758
45759static int
45760test_xmlXPathNextParent(void) {
45761 int test_ret = 0;
45762
William M. Brack21e4ef22005-01-02 09:53:13 +000045763#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045764 int mem_base;
45765 xmlNodePtr ret_val;
45766 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45767 int n_ctxt;
45768 xmlNodePtr cur; /* the current node in the traversal */
45769 int n_cur;
45770
45771 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45772 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45773 mem_base = xmlMemBlocks();
45774 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45775 cur = gen_xmlNodePtr(n_cur, 1);
45776
45777 ret_val = xmlXPathNextParent(ctxt, cur);
45778 desret_xmlNodePtr(ret_val);
45779 call_tests++;
45780 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45781 des_xmlNodePtr(n_cur, cur, 1);
45782 xmlResetLastError();
45783 if (mem_base != xmlMemBlocks()) {
45784 printf("Leak of %d blocks found in xmlXPathNextParent",
45785 xmlMemBlocks() - mem_base);
45786 test_ret++;
45787 printf(" %d", n_ctxt);
45788 printf(" %d", n_cur);
45789 printf("\n");
45790 }
45791 }
45792 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045793 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045794#endif
45795
Daniel Veillarda82b1822004-11-08 16:24:57 +000045796 return(test_ret);
45797}
45798
45799
45800static int
45801test_xmlXPathNextPreceding(void) {
45802 int test_ret = 0;
45803
William M. Brack21e4ef22005-01-02 09:53:13 +000045804#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045805 int mem_base;
45806 xmlNodePtr ret_val;
45807 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45808 int n_ctxt;
45809 xmlNodePtr cur; /* the current node in the traversal */
45810 int n_cur;
45811
45812 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45813 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45814 mem_base = xmlMemBlocks();
45815 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45816 cur = gen_xmlNodePtr(n_cur, 1);
45817
45818 ret_val = xmlXPathNextPreceding(ctxt, cur);
45819 desret_xmlNodePtr(ret_val);
45820 call_tests++;
45821 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45822 des_xmlNodePtr(n_cur, cur, 1);
45823 xmlResetLastError();
45824 if (mem_base != xmlMemBlocks()) {
45825 printf("Leak of %d blocks found in xmlXPathNextPreceding",
45826 xmlMemBlocks() - mem_base);
45827 test_ret++;
45828 printf(" %d", n_ctxt);
45829 printf(" %d", n_cur);
45830 printf("\n");
45831 }
45832 }
45833 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045834 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045835#endif
45836
Daniel Veillarda82b1822004-11-08 16:24:57 +000045837 return(test_ret);
45838}
45839
45840
45841static int
45842test_xmlXPathNextPrecedingSibling(void) {
45843 int test_ret = 0;
45844
William M. Brack21e4ef22005-01-02 09:53:13 +000045845#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045846 int mem_base;
45847 xmlNodePtr ret_val;
45848 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45849 int n_ctxt;
45850 xmlNodePtr cur; /* the current node in the traversal */
45851 int n_cur;
45852
45853 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45854 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45855 mem_base = xmlMemBlocks();
45856 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45857 cur = gen_xmlNodePtr(n_cur, 1);
45858
45859 ret_val = xmlXPathNextPrecedingSibling(ctxt, cur);
45860 desret_xmlNodePtr(ret_val);
45861 call_tests++;
45862 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45863 des_xmlNodePtr(n_cur, cur, 1);
45864 xmlResetLastError();
45865 if (mem_base != xmlMemBlocks()) {
45866 printf("Leak of %d blocks found in xmlXPathNextPrecedingSibling",
45867 xmlMemBlocks() - mem_base);
45868 test_ret++;
45869 printf(" %d", n_ctxt);
45870 printf(" %d", n_cur);
45871 printf("\n");
45872 }
45873 }
45874 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045875 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045876#endif
45877
Daniel Veillarda82b1822004-11-08 16:24:57 +000045878 return(test_ret);
45879}
45880
45881
45882static int
45883test_xmlXPathNextSelf(void) {
45884 int test_ret = 0;
45885
William M. Brack21e4ef22005-01-02 09:53:13 +000045886#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045887 int mem_base;
45888 xmlNodePtr ret_val;
45889 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45890 int n_ctxt;
45891 xmlNodePtr cur; /* the current node in the traversal */
45892 int n_cur;
45893
45894 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45895 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45896 mem_base = xmlMemBlocks();
45897 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45898 cur = gen_xmlNodePtr(n_cur, 1);
45899
45900 ret_val = xmlXPathNextSelf(ctxt, cur);
45901 desret_xmlNodePtr(ret_val);
45902 call_tests++;
45903 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45904 des_xmlNodePtr(n_cur, cur, 1);
45905 xmlResetLastError();
45906 if (mem_base != xmlMemBlocks()) {
45907 printf("Leak of %d blocks found in xmlXPathNextSelf",
45908 xmlMemBlocks() - mem_base);
45909 test_ret++;
45910 printf(" %d", n_ctxt);
45911 printf(" %d", n_cur);
45912 printf("\n");
45913 }
45914 }
45915 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045916 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045917#endif
45918
Daniel Veillarda82b1822004-11-08 16:24:57 +000045919 return(test_ret);
45920}
45921
45922
45923static int
45924test_xmlXPathNodeLeading(void) {
45925 int test_ret = 0;
45926
William M. Brack21e4ef22005-01-02 09:53:13 +000045927#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045928 int mem_base;
45929 xmlNodeSetPtr ret_val;
45930 xmlNodeSetPtr nodes; /* a node-set */
45931 int n_nodes;
45932 xmlNodePtr node; /* a node */
45933 int n_node;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045934
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045935 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
45936 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
45937 mem_base = xmlMemBlocks();
45938 nodes = gen_xmlNodeSetPtr(n_nodes, 0);
45939 node = gen_xmlNodePtr(n_node, 1);
45940
45941 ret_val = xmlXPathNodeLeading(nodes, node);
45942 desret_xmlNodeSetPtr(ret_val);
45943 call_tests++;
45944 des_xmlNodeSetPtr(n_nodes, nodes, 0);
45945 des_xmlNodePtr(n_node, node, 1);
45946 xmlResetLastError();
45947 if (mem_base != xmlMemBlocks()) {
45948 printf("Leak of %d blocks found in xmlXPathNodeLeading",
45949 xmlMemBlocks() - mem_base);
45950 test_ret++;
45951 printf(" %d", n_nodes);
45952 printf(" %d", n_node);
45953 printf("\n");
45954 }
45955 }
45956 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045957 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045958#endif
45959
Daniel Veillarda82b1822004-11-08 16:24:57 +000045960 return(test_ret);
45961}
45962
45963
45964static int
45965test_xmlXPathNodeLeadingSorted(void) {
45966 int test_ret = 0;
45967
William M. Brack21e4ef22005-01-02 09:53:13 +000045968#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045969 int mem_base;
45970 xmlNodeSetPtr ret_val;
45971 xmlNodeSetPtr nodes; /* a node-set, sorted by document order */
45972 int n_nodes;
45973 xmlNodePtr node; /* a node */
45974 int n_node;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045975
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045976 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
45977 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
45978 mem_base = xmlMemBlocks();
45979 nodes = gen_xmlNodeSetPtr(n_nodes, 0);
45980 node = gen_xmlNodePtr(n_node, 1);
45981
45982 ret_val = xmlXPathNodeLeadingSorted(nodes, node);
45983 desret_xmlNodeSetPtr(ret_val);
45984 call_tests++;
45985 des_xmlNodeSetPtr(n_nodes, nodes, 0);
45986 des_xmlNodePtr(n_node, node, 1);
45987 xmlResetLastError();
45988 if (mem_base != xmlMemBlocks()) {
45989 printf("Leak of %d blocks found in xmlXPathNodeLeadingSorted",
45990 xmlMemBlocks() - mem_base);
45991 test_ret++;
45992 printf(" %d", n_nodes);
45993 printf(" %d", n_node);
45994 printf("\n");
45995 }
45996 }
45997 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045998 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045999#endif
46000
Daniel Veillarda82b1822004-11-08 16:24:57 +000046001 return(test_ret);
46002}
46003
46004
46005static int
46006test_xmlXPathNodeSetAdd(void) {
46007 int test_ret = 0;
46008
William M. Brack21e4ef22005-01-02 09:53:13 +000046009#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046010 int mem_base;
46011 xmlNodeSetPtr cur; /* the initial node set */
46012 int n_cur;
46013 xmlNodePtr val; /* a new xmlNodePtr */
46014 int n_val;
46015
46016 for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
46017 for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
46018 mem_base = xmlMemBlocks();
46019 cur = gen_xmlNodeSetPtr(n_cur, 0);
46020 val = gen_xmlNodePtr(n_val, 1);
46021
46022 xmlXPathNodeSetAdd(cur, val);
46023 call_tests++;
46024 des_xmlNodeSetPtr(n_cur, cur, 0);
46025 des_xmlNodePtr(n_val, val, 1);
46026 xmlResetLastError();
46027 if (mem_base != xmlMemBlocks()) {
46028 printf("Leak of %d blocks found in xmlXPathNodeSetAdd",
46029 xmlMemBlocks() - mem_base);
46030 test_ret++;
46031 printf(" %d", n_cur);
46032 printf(" %d", n_val);
46033 printf("\n");
46034 }
46035 }
46036 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046037 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046038#endif
46039
Daniel Veillarda82b1822004-11-08 16:24:57 +000046040 return(test_ret);
46041}
46042
46043
46044static int
46045test_xmlXPathNodeSetAddNs(void) {
46046 int test_ret = 0;
46047
William M. Brack21e4ef22005-01-02 09:53:13 +000046048#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046049 int mem_base;
46050 xmlNodeSetPtr cur; /* the initial node set */
46051 int n_cur;
46052 xmlNodePtr node; /* the hosting node */
46053 int n_node;
46054 xmlNsPtr ns; /* a the namespace node */
46055 int n_ns;
46056
46057 for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
46058 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
46059 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
46060 mem_base = xmlMemBlocks();
46061 cur = gen_xmlNodeSetPtr(n_cur, 0);
46062 node = gen_xmlNodePtr(n_node, 1);
46063 ns = gen_xmlNsPtr(n_ns, 2);
46064
46065 xmlXPathNodeSetAddNs(cur, node, ns);
46066 call_tests++;
46067 des_xmlNodeSetPtr(n_cur, cur, 0);
46068 des_xmlNodePtr(n_node, node, 1);
46069 des_xmlNsPtr(n_ns, ns, 2);
46070 xmlResetLastError();
46071 if (mem_base != xmlMemBlocks()) {
46072 printf("Leak of %d blocks found in xmlXPathNodeSetAddNs",
46073 xmlMemBlocks() - mem_base);
46074 test_ret++;
46075 printf(" %d", n_cur);
46076 printf(" %d", n_node);
46077 printf(" %d", n_ns);
46078 printf("\n");
46079 }
46080 }
46081 }
46082 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046083 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046084#endif
46085
Daniel Veillarda82b1822004-11-08 16:24:57 +000046086 return(test_ret);
46087}
46088
46089
46090static int
46091test_xmlXPathNodeSetAddUnique(void) {
46092 int test_ret = 0;
46093
William M. Brack21e4ef22005-01-02 09:53:13 +000046094#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046095 int mem_base;
46096 xmlNodeSetPtr cur; /* the initial node set */
46097 int n_cur;
46098 xmlNodePtr val; /* a new xmlNodePtr */
46099 int n_val;
46100
46101 for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
46102 for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
46103 mem_base = xmlMemBlocks();
46104 cur = gen_xmlNodeSetPtr(n_cur, 0);
46105 val = gen_xmlNodePtr(n_val, 1);
46106
46107 xmlXPathNodeSetAddUnique(cur, val);
46108 call_tests++;
46109 des_xmlNodeSetPtr(n_cur, cur, 0);
46110 des_xmlNodePtr(n_val, val, 1);
46111 xmlResetLastError();
46112 if (mem_base != xmlMemBlocks()) {
46113 printf("Leak of %d blocks found in xmlXPathNodeSetAddUnique",
46114 xmlMemBlocks() - mem_base);
46115 test_ret++;
46116 printf(" %d", n_cur);
46117 printf(" %d", n_val);
46118 printf("\n");
46119 }
46120 }
46121 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046122 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046123#endif
46124
Daniel Veillarda82b1822004-11-08 16:24:57 +000046125 return(test_ret);
46126}
46127
46128
46129static int
46130test_xmlXPathNodeSetContains(void) {
46131 int test_ret = 0;
46132
William M. Brack21e4ef22005-01-02 09:53:13 +000046133#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046134 int mem_base;
46135 int ret_val;
46136 xmlNodeSetPtr cur; /* the node-set */
46137 int n_cur;
46138 xmlNodePtr val; /* the node */
46139 int n_val;
46140
46141 for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
46142 for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
46143 mem_base = xmlMemBlocks();
46144 cur = gen_xmlNodeSetPtr(n_cur, 0);
46145 val = gen_xmlNodePtr(n_val, 1);
46146
46147 ret_val = xmlXPathNodeSetContains(cur, val);
46148 desret_int(ret_val);
46149 call_tests++;
46150 des_xmlNodeSetPtr(n_cur, cur, 0);
46151 des_xmlNodePtr(n_val, val, 1);
46152 xmlResetLastError();
46153 if (mem_base != xmlMemBlocks()) {
46154 printf("Leak of %d blocks found in xmlXPathNodeSetContains",
46155 xmlMemBlocks() - mem_base);
46156 test_ret++;
46157 printf(" %d", n_cur);
46158 printf(" %d", n_val);
46159 printf("\n");
46160 }
46161 }
46162 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046163 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046164#endif
46165
Daniel Veillarda82b1822004-11-08 16:24:57 +000046166 return(test_ret);
46167}
46168
46169
46170static int
46171test_xmlXPathNodeSetDel(void) {
46172 int test_ret = 0;
46173
William M. Brack21e4ef22005-01-02 09:53:13 +000046174#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046175 int mem_base;
46176 xmlNodeSetPtr cur; /* the initial node set */
46177 int n_cur;
46178 xmlNodePtr val; /* an xmlNodePtr */
46179 int n_val;
46180
46181 for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
46182 for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
46183 mem_base = xmlMemBlocks();
46184 cur = gen_xmlNodeSetPtr(n_cur, 0);
46185 val = gen_xmlNodePtr(n_val, 1);
46186
46187 xmlXPathNodeSetDel(cur, val);
46188 call_tests++;
46189 des_xmlNodeSetPtr(n_cur, cur, 0);
46190 des_xmlNodePtr(n_val, val, 1);
46191 xmlResetLastError();
46192 if (mem_base != xmlMemBlocks()) {
46193 printf("Leak of %d blocks found in xmlXPathNodeSetDel",
46194 xmlMemBlocks() - mem_base);
46195 test_ret++;
46196 printf(" %d", n_cur);
46197 printf(" %d", n_val);
46198 printf("\n");
46199 }
46200 }
46201 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046202 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046203#endif
46204
Daniel Veillarda82b1822004-11-08 16:24:57 +000046205 return(test_ret);
46206}
46207
46208
46209static int
46210test_xmlXPathNodeSetMerge(void) {
46211 int test_ret = 0;
46212
William M. Brack21e4ef22005-01-02 09:53:13 +000046213#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046214 int mem_base;
46215 xmlNodeSetPtr ret_val;
46216 xmlNodeSetPtr val1; /* the first NodeSet or NULL */
46217 int n_val1;
46218 xmlNodeSetPtr val2; /* the second NodeSet */
46219 int n_val2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046220
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046221 for (n_val1 = 0;n_val1 < gen_nb_xmlNodeSetPtr;n_val1++) {
46222 for (n_val2 = 0;n_val2 < gen_nb_xmlNodeSetPtr;n_val2++) {
46223 mem_base = xmlMemBlocks();
46224 val1 = gen_xmlNodeSetPtr(n_val1, 0);
46225 val2 = gen_xmlNodeSetPtr(n_val2, 1);
46226
46227 ret_val = xmlXPathNodeSetMerge(val1, val2);
46228 desret_xmlNodeSetPtr(ret_val);
46229 call_tests++;
46230 des_xmlNodeSetPtr(n_val1, val1, 0);
46231 des_xmlNodeSetPtr(n_val2, val2, 1);
46232 xmlResetLastError();
46233 if (mem_base != xmlMemBlocks()) {
46234 printf("Leak of %d blocks found in xmlXPathNodeSetMerge",
46235 xmlMemBlocks() - mem_base);
46236 test_ret++;
46237 printf(" %d", n_val1);
46238 printf(" %d", n_val2);
46239 printf("\n");
46240 }
46241 }
46242 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046243 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046244#endif
46245
Daniel Veillarda82b1822004-11-08 16:24:57 +000046246 return(test_ret);
46247}
46248
46249
46250static int
46251test_xmlXPathNodeSetRemove(void) {
46252 int test_ret = 0;
46253
William M. Brack21e4ef22005-01-02 09:53:13 +000046254#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046255 int mem_base;
46256 xmlNodeSetPtr cur; /* the initial node set */
46257 int n_cur;
46258 int val; /* the index to remove */
46259 int n_val;
46260
46261 for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
46262 for (n_val = 0;n_val < gen_nb_int;n_val++) {
46263 mem_base = xmlMemBlocks();
46264 cur = gen_xmlNodeSetPtr(n_cur, 0);
46265 val = gen_int(n_val, 1);
46266
46267 xmlXPathNodeSetRemove(cur, val);
46268 call_tests++;
46269 des_xmlNodeSetPtr(n_cur, cur, 0);
46270 des_int(n_val, val, 1);
46271 xmlResetLastError();
46272 if (mem_base != xmlMemBlocks()) {
46273 printf("Leak of %d blocks found in xmlXPathNodeSetRemove",
46274 xmlMemBlocks() - mem_base);
46275 test_ret++;
46276 printf(" %d", n_cur);
46277 printf(" %d", n_val);
46278 printf("\n");
46279 }
46280 }
46281 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046282 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046283#endif
46284
Daniel Veillarda82b1822004-11-08 16:24:57 +000046285 return(test_ret);
46286}
46287
46288
46289static int
46290test_xmlXPathNodeSetSort(void) {
46291 int test_ret = 0;
46292
William M. Brack21e4ef22005-01-02 09:53:13 +000046293#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046294 int mem_base;
46295 xmlNodeSetPtr set; /* the node set */
46296 int n_set;
46297
46298 for (n_set = 0;n_set < gen_nb_xmlNodeSetPtr;n_set++) {
46299 mem_base = xmlMemBlocks();
46300 set = gen_xmlNodeSetPtr(n_set, 0);
46301
46302 xmlXPathNodeSetSort(set);
46303 call_tests++;
46304 des_xmlNodeSetPtr(n_set, set, 0);
46305 xmlResetLastError();
46306 if (mem_base != xmlMemBlocks()) {
46307 printf("Leak of %d blocks found in xmlXPathNodeSetSort",
46308 xmlMemBlocks() - mem_base);
46309 test_ret++;
46310 printf(" %d", n_set);
46311 printf("\n");
46312 }
46313 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046314 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046315#endif
46316
Daniel Veillarda82b1822004-11-08 16:24:57 +000046317 return(test_ret);
46318}
46319
46320
46321static int
46322test_xmlXPathNodeTrailing(void) {
46323 int test_ret = 0;
46324
William M. Brack21e4ef22005-01-02 09:53:13 +000046325#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046326 int mem_base;
46327 xmlNodeSetPtr ret_val;
46328 xmlNodeSetPtr nodes; /* a node-set */
46329 int n_nodes;
46330 xmlNodePtr node; /* a node */
46331 int n_node;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046332
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046333 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
46334 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
46335 mem_base = xmlMemBlocks();
46336 nodes = gen_xmlNodeSetPtr(n_nodes, 0);
46337 node = gen_xmlNodePtr(n_node, 1);
46338
46339 ret_val = xmlXPathNodeTrailing(nodes, node);
46340 desret_xmlNodeSetPtr(ret_val);
46341 call_tests++;
46342 des_xmlNodeSetPtr(n_nodes, nodes, 0);
46343 des_xmlNodePtr(n_node, node, 1);
46344 xmlResetLastError();
46345 if (mem_base != xmlMemBlocks()) {
46346 printf("Leak of %d blocks found in xmlXPathNodeTrailing",
46347 xmlMemBlocks() - mem_base);
46348 test_ret++;
46349 printf(" %d", n_nodes);
46350 printf(" %d", n_node);
46351 printf("\n");
46352 }
46353 }
46354 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046355 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046356#endif
46357
Daniel Veillarda82b1822004-11-08 16:24:57 +000046358 return(test_ret);
46359}
46360
46361
46362static int
46363test_xmlXPathNodeTrailingSorted(void) {
46364 int test_ret = 0;
46365
William M. Brack21e4ef22005-01-02 09:53:13 +000046366#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046367 int mem_base;
46368 xmlNodeSetPtr ret_val;
46369 xmlNodeSetPtr nodes; /* a node-set, sorted by document order */
46370 int n_nodes;
46371 xmlNodePtr node; /* a node */
46372 int n_node;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046373
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046374 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
46375 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
46376 mem_base = xmlMemBlocks();
46377 nodes = gen_xmlNodeSetPtr(n_nodes, 0);
46378 node = gen_xmlNodePtr(n_node, 1);
46379
46380 ret_val = xmlXPathNodeTrailingSorted(nodes, node);
46381 desret_xmlNodeSetPtr(ret_val);
46382 call_tests++;
46383 des_xmlNodeSetPtr(n_nodes, nodes, 0);
46384 des_xmlNodePtr(n_node, node, 1);
46385 xmlResetLastError();
46386 if (mem_base != xmlMemBlocks()) {
46387 printf("Leak of %d blocks found in xmlXPathNodeTrailingSorted",
46388 xmlMemBlocks() - mem_base);
46389 test_ret++;
46390 printf(" %d", n_nodes);
46391 printf(" %d", n_node);
46392 printf("\n");
46393 }
46394 }
46395 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046396 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046397#endif
46398
Daniel Veillarda82b1822004-11-08 16:24:57 +000046399 return(test_ret);
46400}
46401
46402
46403static int
46404test_xmlXPathNormalizeFunction(void) {
46405 int test_ret = 0;
46406
William M. Brack21e4ef22005-01-02 09:53:13 +000046407#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046408 int mem_base;
46409 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46410 int n_ctxt;
46411 int nargs; /* the number of arguments */
46412 int n_nargs;
46413
46414 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46415 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
46416 mem_base = xmlMemBlocks();
46417 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46418 nargs = gen_int(n_nargs, 1);
46419
46420 xmlXPathNormalizeFunction(ctxt, nargs);
46421 call_tests++;
46422 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46423 des_int(n_nargs, nargs, 1);
46424 xmlResetLastError();
46425 if (mem_base != xmlMemBlocks()) {
46426 printf("Leak of %d blocks found in xmlXPathNormalizeFunction",
46427 xmlMemBlocks() - mem_base);
46428 test_ret++;
46429 printf(" %d", n_ctxt);
46430 printf(" %d", n_nargs);
46431 printf("\n");
46432 }
46433 }
46434 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046435 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046436#endif
46437
Daniel Veillarda82b1822004-11-08 16:24:57 +000046438 return(test_ret);
46439}
46440
46441
46442static int
46443test_xmlXPathNotEqualValues(void) {
46444 int test_ret = 0;
46445
William M. Brack21e4ef22005-01-02 09:53:13 +000046446#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046447 int mem_base;
46448 int ret_val;
46449 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46450 int n_ctxt;
46451
46452 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46453 mem_base = xmlMemBlocks();
46454 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46455
46456 ret_val = xmlXPathNotEqualValues(ctxt);
46457 desret_int(ret_val);
46458 call_tests++;
46459 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46460 xmlResetLastError();
46461 if (mem_base != xmlMemBlocks()) {
46462 printf("Leak of %d blocks found in xmlXPathNotEqualValues",
46463 xmlMemBlocks() - mem_base);
46464 test_ret++;
46465 printf(" %d", n_ctxt);
46466 printf("\n");
46467 }
46468 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046469 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046470#endif
46471
Daniel Veillarda82b1822004-11-08 16:24:57 +000046472 return(test_ret);
46473}
46474
46475
46476static int
46477test_xmlXPathNotFunction(void) {
46478 int test_ret = 0;
46479
William M. Brack21e4ef22005-01-02 09:53:13 +000046480#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046481 int mem_base;
46482 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46483 int n_ctxt;
46484 int nargs; /* the number of arguments */
46485 int n_nargs;
46486
46487 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46488 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
46489 mem_base = xmlMemBlocks();
46490 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46491 nargs = gen_int(n_nargs, 1);
46492
46493 xmlXPathNotFunction(ctxt, nargs);
46494 call_tests++;
46495 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46496 des_int(n_nargs, nargs, 1);
46497 xmlResetLastError();
46498 if (mem_base != xmlMemBlocks()) {
46499 printf("Leak of %d blocks found in xmlXPathNotFunction",
46500 xmlMemBlocks() - mem_base);
46501 test_ret++;
46502 printf(" %d", n_ctxt);
46503 printf(" %d", n_nargs);
46504 printf("\n");
46505 }
46506 }
46507 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046508 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046509#endif
46510
Daniel Veillarda82b1822004-11-08 16:24:57 +000046511 return(test_ret);
46512}
46513
46514
46515static int
46516test_xmlXPathNsLookup(void) {
46517 int test_ret = 0;
46518
William M. Brack21e4ef22005-01-02 09:53:13 +000046519#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046520 int mem_base;
46521 const xmlChar * ret_val;
46522 xmlXPathContextPtr ctxt; /* the XPath context */
46523 int n_ctxt;
46524 xmlChar * prefix; /* the namespace prefix value */
46525 int n_prefix;
46526
46527 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
46528 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
46529 mem_base = xmlMemBlocks();
46530 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
46531 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
46532
William M. Brackf13f77f2004-11-12 16:03:48 +000046533 ret_val = xmlXPathNsLookup(ctxt, (const xmlChar *)prefix);
Daniel Veillarda82b1822004-11-08 16:24:57 +000046534 desret_const_xmlChar_ptr(ret_val);
46535 call_tests++;
46536 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000046537 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
Daniel Veillarda82b1822004-11-08 16:24:57 +000046538 xmlResetLastError();
46539 if (mem_base != xmlMemBlocks()) {
46540 printf("Leak of %d blocks found in xmlXPathNsLookup",
46541 xmlMemBlocks() - mem_base);
46542 test_ret++;
46543 printf(" %d", n_ctxt);
46544 printf(" %d", n_prefix);
46545 printf("\n");
46546 }
46547 }
46548 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046549 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046550#endif
46551
Daniel Veillarda82b1822004-11-08 16:24:57 +000046552 return(test_ret);
46553}
46554
46555
46556static int
46557test_xmlXPathNumberFunction(void) {
46558 int test_ret = 0;
46559
William M. Brack21e4ef22005-01-02 09:53:13 +000046560#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046561 int mem_base;
46562 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46563 int n_ctxt;
46564 int nargs; /* the number of arguments */
46565 int n_nargs;
46566
46567 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46568 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
46569 mem_base = xmlMemBlocks();
46570 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46571 nargs = gen_int(n_nargs, 1);
46572
46573 xmlXPathNumberFunction(ctxt, nargs);
46574 call_tests++;
46575 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46576 des_int(n_nargs, nargs, 1);
46577 xmlResetLastError();
46578 if (mem_base != xmlMemBlocks()) {
46579 printf("Leak of %d blocks found in xmlXPathNumberFunction",
46580 xmlMemBlocks() - mem_base);
46581 test_ret++;
46582 printf(" %d", n_ctxt);
46583 printf(" %d", n_nargs);
46584 printf("\n");
46585 }
46586 }
46587 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046588 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046589#endif
46590
Daniel Veillarda82b1822004-11-08 16:24:57 +000046591 return(test_ret);
46592}
46593
46594
46595static int
46596test_xmlXPathParseNCName(void) {
46597 int test_ret = 0;
46598
William M. Brack21e4ef22005-01-02 09:53:13 +000046599#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046600 int mem_base;
46601 xmlChar * ret_val;
46602 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46603 int n_ctxt;
46604
46605 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46606 mem_base = xmlMemBlocks();
46607 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46608
46609 ret_val = xmlXPathParseNCName(ctxt);
46610 desret_xmlChar_ptr(ret_val);
46611 call_tests++;
46612 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46613 xmlResetLastError();
46614 if (mem_base != xmlMemBlocks()) {
46615 printf("Leak of %d blocks found in xmlXPathParseNCName",
46616 xmlMemBlocks() - mem_base);
46617 test_ret++;
46618 printf(" %d", n_ctxt);
46619 printf("\n");
46620 }
46621 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046622 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046623#endif
46624
Daniel Veillarda82b1822004-11-08 16:24:57 +000046625 return(test_ret);
46626}
46627
46628
46629static int
46630test_xmlXPathParseName(void) {
46631 int test_ret = 0;
46632
William M. Brack21e4ef22005-01-02 09:53:13 +000046633#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046634 int mem_base;
46635 xmlChar * ret_val;
46636 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46637 int n_ctxt;
46638
46639 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46640 mem_base = xmlMemBlocks();
46641 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46642
46643 ret_val = xmlXPathParseName(ctxt);
46644 desret_xmlChar_ptr(ret_val);
46645 call_tests++;
46646 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46647 xmlResetLastError();
46648 if (mem_base != xmlMemBlocks()) {
46649 printf("Leak of %d blocks found in xmlXPathParseName",
46650 xmlMemBlocks() - mem_base);
46651 test_ret++;
46652 printf(" %d", n_ctxt);
46653 printf("\n");
46654 }
46655 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046656 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046657#endif
46658
Daniel Veillarda82b1822004-11-08 16:24:57 +000046659 return(test_ret);
46660}
46661
46662
46663static int
46664test_xmlXPathPopBoolean(void) {
46665 int test_ret = 0;
46666
William M. Brack21e4ef22005-01-02 09:53:13 +000046667#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046668 int mem_base;
46669 int ret_val;
46670 xmlXPathParserContextPtr ctxt; /* an XPath parser context */
46671 int n_ctxt;
46672
46673 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46674 mem_base = xmlMemBlocks();
46675 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46676
46677 ret_val = xmlXPathPopBoolean(ctxt);
46678 desret_int(ret_val);
46679 call_tests++;
46680 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46681 xmlResetLastError();
46682 if (mem_base != xmlMemBlocks()) {
46683 printf("Leak of %d blocks found in xmlXPathPopBoolean",
46684 xmlMemBlocks() - mem_base);
46685 test_ret++;
46686 printf(" %d", n_ctxt);
46687 printf("\n");
46688 }
46689 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046690 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046691#endif
46692
Daniel Veillarda82b1822004-11-08 16:24:57 +000046693 return(test_ret);
46694}
46695
46696
46697static int
46698test_xmlXPathPopExternal(void) {
46699 int test_ret = 0;
46700
William M. Brack21e4ef22005-01-02 09:53:13 +000046701#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046702 int mem_base;
46703 void * ret_val;
46704 xmlXPathParserContextPtr ctxt; /* an XPath parser context */
46705 int n_ctxt;
46706
46707 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46708 mem_base = xmlMemBlocks();
46709 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46710
46711 ret_val = xmlXPathPopExternal(ctxt);
46712 desret_void_ptr(ret_val);
46713 call_tests++;
46714 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46715 xmlResetLastError();
46716 if (mem_base != xmlMemBlocks()) {
46717 printf("Leak of %d blocks found in xmlXPathPopExternal",
46718 xmlMemBlocks() - mem_base);
46719 test_ret++;
46720 printf(" %d", n_ctxt);
46721 printf("\n");
46722 }
46723 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046724 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046725#endif
46726
Daniel Veillarda82b1822004-11-08 16:24:57 +000046727 return(test_ret);
46728}
46729
46730
46731static int
46732test_xmlXPathPopNodeSet(void) {
46733 int test_ret = 0;
46734
William M. Brack21e4ef22005-01-02 09:53:13 +000046735#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046736 int mem_base;
46737 xmlNodeSetPtr ret_val;
46738 xmlXPathParserContextPtr ctxt; /* an XPath parser context */
46739 int n_ctxt;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046740
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046741 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46742 mem_base = xmlMemBlocks();
46743 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46744
46745 ret_val = xmlXPathPopNodeSet(ctxt);
46746 desret_xmlNodeSetPtr(ret_val);
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 xmlXPathPopNodeSet",
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 Veillardf2a36f92004-11-08 17:55:01 +000046759#endif
46760
Daniel Veillarda82b1822004-11-08 16:24:57 +000046761 return(test_ret);
46762}
46763
46764
46765static int
46766test_xmlXPathPopNumber(void) {
46767 int test_ret = 0;
46768
William M. Brack21e4ef22005-01-02 09:53:13 +000046769#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046770 int mem_base;
46771 double ret_val;
46772 xmlXPathParserContextPtr ctxt; /* an XPath parser context */
46773 int n_ctxt;
46774
46775 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46776 mem_base = xmlMemBlocks();
46777 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46778
46779 ret_val = xmlXPathPopNumber(ctxt);
46780 desret_double(ret_val);
46781 call_tests++;
46782 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46783 xmlResetLastError();
46784 if (mem_base != xmlMemBlocks()) {
46785 printf("Leak of %d blocks found in xmlXPathPopNumber",
46786 xmlMemBlocks() - mem_base);
46787 test_ret++;
46788 printf(" %d", n_ctxt);
46789 printf("\n");
46790 }
46791 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046792 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046793#endif
46794
Daniel Veillarda82b1822004-11-08 16:24:57 +000046795 return(test_ret);
46796}
46797
46798
46799static int
46800test_xmlXPathPopString(void) {
46801 int test_ret = 0;
46802
William M. Brack21e4ef22005-01-02 09:53:13 +000046803#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046804 int mem_base;
46805 xmlChar * ret_val;
46806 xmlXPathParserContextPtr ctxt; /* an XPath parser context */
46807 int n_ctxt;
46808
46809 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46810 mem_base = xmlMemBlocks();
46811 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46812
46813 ret_val = xmlXPathPopString(ctxt);
46814 desret_xmlChar_ptr(ret_val);
46815 call_tests++;
46816 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46817 xmlResetLastError();
46818 if (mem_base != xmlMemBlocks()) {
46819 printf("Leak of %d blocks found in xmlXPathPopString",
46820 xmlMemBlocks() - mem_base);
46821 test_ret++;
46822 printf(" %d", n_ctxt);
46823 printf("\n");
46824 }
46825 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046826 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046827#endif
46828
Daniel Veillarda82b1822004-11-08 16:24:57 +000046829 return(test_ret);
46830}
46831
46832
46833static int
46834test_xmlXPathPositionFunction(void) {
46835 int test_ret = 0;
46836
William M. Brack21e4ef22005-01-02 09:53:13 +000046837#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046838 int mem_base;
46839 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46840 int n_ctxt;
46841 int nargs; /* the number of arguments */
46842 int n_nargs;
46843
46844 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46845 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
46846 mem_base = xmlMemBlocks();
46847 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46848 nargs = gen_int(n_nargs, 1);
46849
46850 xmlXPathPositionFunction(ctxt, nargs);
46851 call_tests++;
46852 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46853 des_int(n_nargs, nargs, 1);
46854 xmlResetLastError();
46855 if (mem_base != xmlMemBlocks()) {
46856 printf("Leak of %d blocks found in xmlXPathPositionFunction",
46857 xmlMemBlocks() - mem_base);
46858 test_ret++;
46859 printf(" %d", n_ctxt);
46860 printf(" %d", n_nargs);
46861 printf("\n");
46862 }
46863 }
46864 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046865 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046866#endif
46867
Daniel Veillarda82b1822004-11-08 16:24:57 +000046868 return(test_ret);
46869}
46870
46871
46872static int
46873test_xmlXPathRegisterAllFunctions(void) {
46874 int test_ret = 0;
46875
William M. Brack21e4ef22005-01-02 09:53:13 +000046876#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046877 int mem_base;
46878 xmlXPathContextPtr ctxt; /* the XPath context */
46879 int n_ctxt;
46880
46881 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
46882 mem_base = xmlMemBlocks();
46883 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
46884
46885 xmlXPathRegisterAllFunctions(ctxt);
46886 call_tests++;
46887 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
46888 xmlResetLastError();
46889 if (mem_base != xmlMemBlocks()) {
46890 printf("Leak of %d blocks found in xmlXPathRegisterAllFunctions",
46891 xmlMemBlocks() - mem_base);
46892 test_ret++;
46893 printf(" %d", n_ctxt);
46894 printf("\n");
46895 }
46896 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046897 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046898#endif
46899
Daniel Veillarda82b1822004-11-08 16:24:57 +000046900 return(test_ret);
46901}
46902
46903
46904static int
46905test_xmlXPathRegisterFunc(void) {
46906 int test_ret = 0;
46907
46908
46909 /* missing type support */
46910 return(test_ret);
46911}
46912
46913
46914static int
46915test_xmlXPathRegisterFuncLookup(void) {
46916 int test_ret = 0;
46917
46918
46919 /* missing type support */
46920 return(test_ret);
46921}
46922
46923
46924static int
46925test_xmlXPathRegisterFuncNS(void) {
46926 int test_ret = 0;
46927
46928
46929 /* missing type support */
46930 return(test_ret);
46931}
46932
46933
46934static int
46935test_xmlXPathRegisterNs(void) {
46936 int test_ret = 0;
46937
William M. Brack21e4ef22005-01-02 09:53:13 +000046938#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046939 int mem_base;
46940 int ret_val;
46941 xmlXPathContextPtr ctxt; /* the XPath context */
46942 int n_ctxt;
46943 xmlChar * prefix; /* the namespace prefix */
46944 int n_prefix;
46945 xmlChar * ns_uri; /* the namespace name */
46946 int n_ns_uri;
46947
46948 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
46949 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
46950 for (n_ns_uri = 0;n_ns_uri < gen_nb_const_xmlChar_ptr;n_ns_uri++) {
46951 mem_base = xmlMemBlocks();
46952 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
46953 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
46954 ns_uri = gen_const_xmlChar_ptr(n_ns_uri, 2);
46955
William M. Brackf13f77f2004-11-12 16:03:48 +000046956 ret_val = xmlXPathRegisterNs(ctxt, (const xmlChar *)prefix, (const xmlChar *)ns_uri);
Daniel Veillarda82b1822004-11-08 16:24:57 +000046957 desret_int(ret_val);
46958 call_tests++;
46959 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000046960 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
46961 des_const_xmlChar_ptr(n_ns_uri, (const xmlChar *)ns_uri, 2);
Daniel Veillarda82b1822004-11-08 16:24:57 +000046962 xmlResetLastError();
46963 if (mem_base != xmlMemBlocks()) {
46964 printf("Leak of %d blocks found in xmlXPathRegisterNs",
46965 xmlMemBlocks() - mem_base);
46966 test_ret++;
46967 printf(" %d", n_ctxt);
46968 printf(" %d", n_prefix);
46969 printf(" %d", n_ns_uri);
46970 printf("\n");
46971 }
46972 }
46973 }
46974 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046975 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046976#endif
46977
Daniel Veillarda82b1822004-11-08 16:24:57 +000046978 return(test_ret);
46979}
46980
46981
46982static int
46983test_xmlXPathRegisterVariable(void) {
46984 int test_ret = 0;
46985
William M. Brack21e4ef22005-01-02 09:53:13 +000046986#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046987 int mem_base;
46988 int ret_val;
46989 xmlXPathContextPtr ctxt; /* the XPath context */
46990 int n_ctxt;
46991 xmlChar * name; /* the variable name */
46992 int n_name;
46993 xmlXPathObjectPtr value; /* the variable value or NULL */
46994 int n_value;
46995
46996 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
46997 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
46998 for (n_value = 0;n_value < gen_nb_xmlXPathObjectPtr;n_value++) {
46999 mem_base = xmlMemBlocks();
47000 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
47001 name = gen_const_xmlChar_ptr(n_name, 1);
47002 value = gen_xmlXPathObjectPtr(n_value, 2);
47003
William M. Brackf13f77f2004-11-12 16:03:48 +000047004 ret_val = xmlXPathRegisterVariable(ctxt, (const xmlChar *)name, value);
Daniel Veillarda82b1822004-11-08 16:24:57 +000047005 desret_int(ret_val);
47006 call_tests++;
47007 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000047008 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarda82b1822004-11-08 16:24:57 +000047009 des_xmlXPathObjectPtr(n_value, value, 2);
47010 xmlResetLastError();
47011 if (mem_base != xmlMemBlocks()) {
47012 printf("Leak of %d blocks found in xmlXPathRegisterVariable",
47013 xmlMemBlocks() - mem_base);
47014 test_ret++;
47015 printf(" %d", n_ctxt);
47016 printf(" %d", n_name);
47017 printf(" %d", n_value);
47018 printf("\n");
47019 }
47020 }
47021 }
47022 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047023 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047024#endif
47025
Daniel Veillarda82b1822004-11-08 16:24:57 +000047026 return(test_ret);
47027}
47028
47029
47030static int
47031test_xmlXPathRegisterVariableLookup(void) {
47032 int test_ret = 0;
47033
47034
47035 /* missing type support */
47036 return(test_ret);
47037}
47038
47039
47040static int
47041test_xmlXPathRegisterVariableNS(void) {
47042 int test_ret = 0;
47043
William M. Brack21e4ef22005-01-02 09:53:13 +000047044#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047045 int mem_base;
47046 int ret_val;
47047 xmlXPathContextPtr ctxt; /* the XPath context */
47048 int n_ctxt;
47049 xmlChar * name; /* the variable name */
47050 int n_name;
47051 xmlChar * ns_uri; /* the variable namespace URI */
47052 int n_ns_uri;
47053 xmlXPathObjectPtr value; /* the variable value or NULL */
47054 int n_value;
47055
47056 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
47057 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
47058 for (n_ns_uri = 0;n_ns_uri < gen_nb_const_xmlChar_ptr;n_ns_uri++) {
47059 for (n_value = 0;n_value < gen_nb_xmlXPathObjectPtr;n_value++) {
47060 mem_base = xmlMemBlocks();
47061 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
47062 name = gen_const_xmlChar_ptr(n_name, 1);
47063 ns_uri = gen_const_xmlChar_ptr(n_ns_uri, 2);
47064 value = gen_xmlXPathObjectPtr(n_value, 3);
47065
William M. Brackf13f77f2004-11-12 16:03:48 +000047066 ret_val = xmlXPathRegisterVariableNS(ctxt, (const xmlChar *)name, (const xmlChar *)ns_uri, value);
Daniel Veillarda82b1822004-11-08 16:24:57 +000047067 desret_int(ret_val);
47068 call_tests++;
47069 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000047070 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
47071 des_const_xmlChar_ptr(n_ns_uri, (const xmlChar *)ns_uri, 2);
Daniel Veillarda82b1822004-11-08 16:24:57 +000047072 des_xmlXPathObjectPtr(n_value, value, 3);
47073 xmlResetLastError();
47074 if (mem_base != xmlMemBlocks()) {
47075 printf("Leak of %d blocks found in xmlXPathRegisterVariableNS",
47076 xmlMemBlocks() - mem_base);
47077 test_ret++;
47078 printf(" %d", n_ctxt);
47079 printf(" %d", n_name);
47080 printf(" %d", n_ns_uri);
47081 printf(" %d", n_value);
47082 printf("\n");
47083 }
47084 }
47085 }
47086 }
47087 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047088 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047089#endif
47090
Daniel Veillarda82b1822004-11-08 16:24:57 +000047091 return(test_ret);
47092}
47093
47094
47095static int
47096test_xmlXPathRegisteredFuncsCleanup(void) {
47097 int test_ret = 0;
47098
William M. Brack21e4ef22005-01-02 09:53:13 +000047099#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047100 int mem_base;
47101 xmlXPathContextPtr ctxt; /* the XPath context */
47102 int n_ctxt;
47103
47104 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
47105 mem_base = xmlMemBlocks();
47106 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
47107
47108 xmlXPathRegisteredFuncsCleanup(ctxt);
47109 call_tests++;
47110 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
47111 xmlResetLastError();
47112 if (mem_base != xmlMemBlocks()) {
47113 printf("Leak of %d blocks found in xmlXPathRegisteredFuncsCleanup",
47114 xmlMemBlocks() - mem_base);
47115 test_ret++;
47116 printf(" %d", n_ctxt);
47117 printf("\n");
47118 }
47119 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047120 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047121#endif
47122
Daniel Veillarda82b1822004-11-08 16:24:57 +000047123 return(test_ret);
47124}
47125
47126
47127static int
47128test_xmlXPathRegisteredNsCleanup(void) {
47129 int test_ret = 0;
47130
William M. Brack21e4ef22005-01-02 09:53:13 +000047131#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047132 int mem_base;
47133 xmlXPathContextPtr ctxt; /* the XPath context */
47134 int n_ctxt;
47135
47136 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
47137 mem_base = xmlMemBlocks();
47138 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
47139
47140 xmlXPathRegisteredNsCleanup(ctxt);
47141 call_tests++;
47142 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
47143 xmlResetLastError();
47144 if (mem_base != xmlMemBlocks()) {
47145 printf("Leak of %d blocks found in xmlXPathRegisteredNsCleanup",
47146 xmlMemBlocks() - mem_base);
47147 test_ret++;
47148 printf(" %d", n_ctxt);
47149 printf("\n");
47150 }
47151 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047152 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047153#endif
47154
Daniel Veillarda82b1822004-11-08 16:24:57 +000047155 return(test_ret);
47156}
47157
47158
47159static int
47160test_xmlXPathRegisteredVariablesCleanup(void) {
47161 int test_ret = 0;
47162
William M. Brack21e4ef22005-01-02 09:53:13 +000047163#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047164 int mem_base;
47165 xmlXPathContextPtr ctxt; /* the XPath context */
47166 int n_ctxt;
47167
47168 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
47169 mem_base = xmlMemBlocks();
47170 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
47171
47172 xmlXPathRegisteredVariablesCleanup(ctxt);
47173 call_tests++;
47174 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
47175 xmlResetLastError();
47176 if (mem_base != xmlMemBlocks()) {
47177 printf("Leak of %d blocks found in xmlXPathRegisteredVariablesCleanup",
47178 xmlMemBlocks() - mem_base);
47179 test_ret++;
47180 printf(" %d", n_ctxt);
47181 printf("\n");
47182 }
47183 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047184 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047185#endif
47186
Daniel Veillarda82b1822004-11-08 16:24:57 +000047187 return(test_ret);
47188}
47189
47190
47191static int
47192test_xmlXPathRoot(void) {
47193 int test_ret = 0;
47194
William M. Brack21e4ef22005-01-02 09:53:13 +000047195#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047196 int mem_base;
47197 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47198 int n_ctxt;
47199
47200 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47201 mem_base = xmlMemBlocks();
47202 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47203
47204 xmlXPathRoot(ctxt);
47205 call_tests++;
47206 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47207 xmlResetLastError();
47208 if (mem_base != xmlMemBlocks()) {
47209 printf("Leak of %d blocks found in xmlXPathRoot",
47210 xmlMemBlocks() - mem_base);
47211 test_ret++;
47212 printf(" %d", n_ctxt);
47213 printf("\n");
47214 }
47215 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047216 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047217#endif
47218
Daniel Veillarda82b1822004-11-08 16:24:57 +000047219 return(test_ret);
47220}
47221
47222
47223static int
47224test_xmlXPathRoundFunction(void) {
47225 int test_ret = 0;
47226
William M. Brack21e4ef22005-01-02 09:53:13 +000047227#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047228 int mem_base;
47229 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47230 int n_ctxt;
47231 int nargs; /* the number of arguments */
47232 int n_nargs;
47233
47234 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47235 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47236 mem_base = xmlMemBlocks();
47237 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47238 nargs = gen_int(n_nargs, 1);
47239
47240 xmlXPathRoundFunction(ctxt, nargs);
47241 call_tests++;
47242 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47243 des_int(n_nargs, nargs, 1);
47244 xmlResetLastError();
47245 if (mem_base != xmlMemBlocks()) {
47246 printf("Leak of %d blocks found in xmlXPathRoundFunction",
47247 xmlMemBlocks() - mem_base);
47248 test_ret++;
47249 printf(" %d", n_ctxt);
47250 printf(" %d", n_nargs);
47251 printf("\n");
47252 }
47253 }
47254 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047255 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047256#endif
47257
Daniel Veillarda82b1822004-11-08 16:24:57 +000047258 return(test_ret);
47259}
47260
47261
47262static int
47263test_xmlXPathStartsWithFunction(void) {
47264 int test_ret = 0;
47265
William M. Brack21e4ef22005-01-02 09:53:13 +000047266#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047267 int mem_base;
47268 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47269 int n_ctxt;
47270 int nargs; /* the number of arguments */
47271 int n_nargs;
47272
47273 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47274 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47275 mem_base = xmlMemBlocks();
47276 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47277 nargs = gen_int(n_nargs, 1);
47278
47279 xmlXPathStartsWithFunction(ctxt, nargs);
47280 call_tests++;
47281 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47282 des_int(n_nargs, nargs, 1);
47283 xmlResetLastError();
47284 if (mem_base != xmlMemBlocks()) {
47285 printf("Leak of %d blocks found in xmlXPathStartsWithFunction",
47286 xmlMemBlocks() - mem_base);
47287 test_ret++;
47288 printf(" %d", n_ctxt);
47289 printf(" %d", n_nargs);
47290 printf("\n");
47291 }
47292 }
47293 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047294 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047295#endif
47296
Daniel Veillarda82b1822004-11-08 16:24:57 +000047297 return(test_ret);
47298}
47299
47300
47301static int
47302test_xmlXPathStringEvalNumber(void) {
47303 int test_ret = 0;
47304
William M. Brack21e4ef22005-01-02 09:53:13 +000047305#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047306 int mem_base;
47307 double ret_val;
47308 xmlChar * str; /* A string to scan */
47309 int n_str;
47310
47311 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
47312 mem_base = xmlMemBlocks();
47313 str = gen_const_xmlChar_ptr(n_str, 0);
47314
William M. Brackf13f77f2004-11-12 16:03:48 +000047315 ret_val = xmlXPathStringEvalNumber((const xmlChar *)str);
Daniel Veillarda82b1822004-11-08 16:24:57 +000047316 desret_double(ret_val);
47317 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000047318 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillarda82b1822004-11-08 16:24:57 +000047319 xmlResetLastError();
47320 if (mem_base != xmlMemBlocks()) {
47321 printf("Leak of %d blocks found in xmlXPathStringEvalNumber",
47322 xmlMemBlocks() - mem_base);
47323 test_ret++;
47324 printf(" %d", n_str);
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_xmlXPathStringFunction(void) {
47337 int test_ret = 0;
47338
William M. Brack21e4ef22005-01-02 09:53:13 +000047339#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047340 int mem_base;
47341 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47342 int n_ctxt;
47343 int nargs; /* the number of arguments */
47344 int n_nargs;
47345
47346 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47347 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47348 mem_base = xmlMemBlocks();
47349 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47350 nargs = gen_int(n_nargs, 1);
47351
47352 xmlXPathStringFunction(ctxt, nargs);
47353 call_tests++;
47354 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47355 des_int(n_nargs, nargs, 1);
47356 xmlResetLastError();
47357 if (mem_base != xmlMemBlocks()) {
47358 printf("Leak of %d blocks found in xmlXPathStringFunction",
47359 xmlMemBlocks() - mem_base);
47360 test_ret++;
47361 printf(" %d", n_ctxt);
47362 printf(" %d", n_nargs);
47363 printf("\n");
47364 }
47365 }
47366 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047367 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047368#endif
47369
Daniel Veillarda82b1822004-11-08 16:24:57 +000047370 return(test_ret);
47371}
47372
47373
47374static int
47375test_xmlXPathStringLengthFunction(void) {
47376 int test_ret = 0;
47377
William M. Brack21e4ef22005-01-02 09:53:13 +000047378#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047379 int mem_base;
47380 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47381 int n_ctxt;
47382 int nargs; /* the number of arguments */
47383 int n_nargs;
47384
47385 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47386 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47387 mem_base = xmlMemBlocks();
47388 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47389 nargs = gen_int(n_nargs, 1);
47390
47391 xmlXPathStringLengthFunction(ctxt, nargs);
47392 call_tests++;
47393 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47394 des_int(n_nargs, nargs, 1);
47395 xmlResetLastError();
47396 if (mem_base != xmlMemBlocks()) {
47397 printf("Leak of %d blocks found in xmlXPathStringLengthFunction",
47398 xmlMemBlocks() - mem_base);
47399 test_ret++;
47400 printf(" %d", n_ctxt);
47401 printf(" %d", n_nargs);
47402 printf("\n");
47403 }
47404 }
47405 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047406 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047407#endif
47408
Daniel Veillarda82b1822004-11-08 16:24:57 +000047409 return(test_ret);
47410}
47411
47412
47413static int
47414test_xmlXPathSubValues(void) {
47415 int test_ret = 0;
47416
William M. Brack21e4ef22005-01-02 09:53:13 +000047417#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047418 int mem_base;
47419 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47420 int n_ctxt;
47421
47422 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47423 mem_base = xmlMemBlocks();
47424 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47425
47426 xmlXPathSubValues(ctxt);
47427 call_tests++;
47428 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47429 xmlResetLastError();
47430 if (mem_base != xmlMemBlocks()) {
47431 printf("Leak of %d blocks found in xmlXPathSubValues",
47432 xmlMemBlocks() - mem_base);
47433 test_ret++;
47434 printf(" %d", n_ctxt);
47435 printf("\n");
47436 }
47437 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047438 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047439#endif
47440
Daniel Veillarda82b1822004-11-08 16:24:57 +000047441 return(test_ret);
47442}
47443
47444
47445static int
47446test_xmlXPathSubstringAfterFunction(void) {
47447 int test_ret = 0;
47448
William M. Brack21e4ef22005-01-02 09:53:13 +000047449#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047450 int mem_base;
47451 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47452 int n_ctxt;
47453 int nargs; /* the number of arguments */
47454 int n_nargs;
47455
47456 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47457 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47458 mem_base = xmlMemBlocks();
47459 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47460 nargs = gen_int(n_nargs, 1);
47461
47462 xmlXPathSubstringAfterFunction(ctxt, nargs);
47463 call_tests++;
47464 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47465 des_int(n_nargs, nargs, 1);
47466 xmlResetLastError();
47467 if (mem_base != xmlMemBlocks()) {
47468 printf("Leak of %d blocks found in xmlXPathSubstringAfterFunction",
47469 xmlMemBlocks() - mem_base);
47470 test_ret++;
47471 printf(" %d", n_ctxt);
47472 printf(" %d", n_nargs);
47473 printf("\n");
47474 }
47475 }
47476 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047477 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047478#endif
47479
Daniel Veillarda82b1822004-11-08 16:24:57 +000047480 return(test_ret);
47481}
47482
47483
47484static int
47485test_xmlXPathSubstringBeforeFunction(void) {
47486 int test_ret = 0;
47487
William M. Brack21e4ef22005-01-02 09:53:13 +000047488#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047489 int mem_base;
47490 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47491 int n_ctxt;
47492 int nargs; /* the number of arguments */
47493 int n_nargs;
47494
47495 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47496 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47497 mem_base = xmlMemBlocks();
47498 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47499 nargs = gen_int(n_nargs, 1);
47500
47501 xmlXPathSubstringBeforeFunction(ctxt, nargs);
47502 call_tests++;
47503 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47504 des_int(n_nargs, nargs, 1);
47505 xmlResetLastError();
47506 if (mem_base != xmlMemBlocks()) {
47507 printf("Leak of %d blocks found in xmlXPathSubstringBeforeFunction",
47508 xmlMemBlocks() - mem_base);
47509 test_ret++;
47510 printf(" %d", n_ctxt);
47511 printf(" %d", n_nargs);
47512 printf("\n");
47513 }
47514 }
47515 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047516 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047517#endif
47518
Daniel Veillarda82b1822004-11-08 16:24:57 +000047519 return(test_ret);
47520}
47521
47522
47523static int
47524test_xmlXPathSubstringFunction(void) {
47525 int test_ret = 0;
47526
William M. Brack21e4ef22005-01-02 09:53:13 +000047527#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047528 int mem_base;
47529 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47530 int n_ctxt;
47531 int nargs; /* the number of arguments */
47532 int n_nargs;
47533
47534 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47535 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47536 mem_base = xmlMemBlocks();
47537 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47538 nargs = gen_int(n_nargs, 1);
47539
47540 xmlXPathSubstringFunction(ctxt, nargs);
47541 call_tests++;
47542 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47543 des_int(n_nargs, nargs, 1);
47544 xmlResetLastError();
47545 if (mem_base != xmlMemBlocks()) {
47546 printf("Leak of %d blocks found in xmlXPathSubstringFunction",
47547 xmlMemBlocks() - mem_base);
47548 test_ret++;
47549 printf(" %d", n_ctxt);
47550 printf(" %d", n_nargs);
47551 printf("\n");
47552 }
47553 }
47554 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047555 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047556#endif
47557
Daniel Veillarda82b1822004-11-08 16:24:57 +000047558 return(test_ret);
47559}
47560
47561
47562static int
47563test_xmlXPathSumFunction(void) {
47564 int test_ret = 0;
47565
William M. Brack21e4ef22005-01-02 09:53:13 +000047566#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047567 int mem_base;
47568 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47569 int n_ctxt;
47570 int nargs; /* the number of arguments */
47571 int n_nargs;
47572
47573 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47574 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47575 mem_base = xmlMemBlocks();
47576 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47577 nargs = gen_int(n_nargs, 1);
47578
47579 xmlXPathSumFunction(ctxt, nargs);
47580 call_tests++;
47581 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47582 des_int(n_nargs, nargs, 1);
47583 xmlResetLastError();
47584 if (mem_base != xmlMemBlocks()) {
47585 printf("Leak of %d blocks found in xmlXPathSumFunction",
47586 xmlMemBlocks() - mem_base);
47587 test_ret++;
47588 printf(" %d", n_ctxt);
47589 printf(" %d", n_nargs);
47590 printf("\n");
47591 }
47592 }
47593 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047594 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047595#endif
47596
Daniel Veillarda82b1822004-11-08 16:24:57 +000047597 return(test_ret);
47598}
47599
47600
47601static int
47602test_xmlXPathTrailing(void) {
47603 int test_ret = 0;
47604
William M. Brack21e4ef22005-01-02 09:53:13 +000047605#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047606 int mem_base;
47607 xmlNodeSetPtr ret_val;
47608 xmlNodeSetPtr nodes1; /* a node-set */
47609 int n_nodes1;
47610 xmlNodeSetPtr nodes2; /* a node-set */
47611 int n_nodes2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047612
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047613 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
47614 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
47615 mem_base = xmlMemBlocks();
47616 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
47617 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
47618
47619 ret_val = xmlXPathTrailing(nodes1, nodes2);
47620 desret_xmlNodeSetPtr(ret_val);
47621 call_tests++;
47622 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
47623 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
47624 xmlResetLastError();
47625 if (mem_base != xmlMemBlocks()) {
47626 printf("Leak of %d blocks found in xmlXPathTrailing",
47627 xmlMemBlocks() - mem_base);
47628 test_ret++;
47629 printf(" %d", n_nodes1);
47630 printf(" %d", n_nodes2);
47631 printf("\n");
47632 }
47633 }
47634 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047635 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047636#endif
47637
Daniel Veillarda82b1822004-11-08 16:24:57 +000047638 return(test_ret);
47639}
47640
47641
47642static int
47643test_xmlXPathTrailingSorted(void) {
47644 int test_ret = 0;
47645
William M. Brack21e4ef22005-01-02 09:53:13 +000047646#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047647 int mem_base;
47648 xmlNodeSetPtr ret_val;
47649 xmlNodeSetPtr nodes1; /* a node-set, sorted by document order */
47650 int n_nodes1;
47651 xmlNodeSetPtr nodes2; /* a node-set, sorted by document order */
47652 int n_nodes2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047653
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047654 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
47655 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
47656 mem_base = xmlMemBlocks();
47657 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
47658 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
47659
47660 ret_val = xmlXPathTrailingSorted(nodes1, nodes2);
47661 desret_xmlNodeSetPtr(ret_val);
47662 call_tests++;
47663 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
47664 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
47665 xmlResetLastError();
47666 if (mem_base != xmlMemBlocks()) {
47667 printf("Leak of %d blocks found in xmlXPathTrailingSorted",
47668 xmlMemBlocks() - mem_base);
47669 test_ret++;
47670 printf(" %d", n_nodes1);
47671 printf(" %d", n_nodes2);
47672 printf("\n");
47673 }
47674 }
47675 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047676 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047677#endif
47678
Daniel Veillarda82b1822004-11-08 16:24:57 +000047679 return(test_ret);
47680}
47681
47682
47683static int
47684test_xmlXPathTranslateFunction(void) {
47685 int test_ret = 0;
47686
William M. Brack21e4ef22005-01-02 09:53:13 +000047687#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047688 int mem_base;
47689 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47690 int n_ctxt;
47691 int nargs; /* the number of arguments */
47692 int n_nargs;
47693
47694 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47695 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47696 mem_base = xmlMemBlocks();
47697 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47698 nargs = gen_int(n_nargs, 1);
47699
47700 xmlXPathTranslateFunction(ctxt, nargs);
47701 call_tests++;
47702 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47703 des_int(n_nargs, nargs, 1);
47704 xmlResetLastError();
47705 if (mem_base != xmlMemBlocks()) {
47706 printf("Leak of %d blocks found in xmlXPathTranslateFunction",
47707 xmlMemBlocks() - mem_base);
47708 test_ret++;
47709 printf(" %d", n_ctxt);
47710 printf(" %d", n_nargs);
47711 printf("\n");
47712 }
47713 }
47714 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047715 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047716#endif
47717
Daniel Veillarda82b1822004-11-08 16:24:57 +000047718 return(test_ret);
47719}
47720
47721
47722static int
47723test_xmlXPathTrueFunction(void) {
47724 int test_ret = 0;
47725
William M. Brack21e4ef22005-01-02 09:53:13 +000047726#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047727 int mem_base;
47728 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47729 int n_ctxt;
47730 int nargs; /* the number of arguments */
47731 int n_nargs;
47732
47733 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47734 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47735 mem_base = xmlMemBlocks();
47736 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47737 nargs = gen_int(n_nargs, 1);
47738
47739 xmlXPathTrueFunction(ctxt, nargs);
47740 call_tests++;
47741 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47742 des_int(n_nargs, nargs, 1);
47743 xmlResetLastError();
47744 if (mem_base != xmlMemBlocks()) {
47745 printf("Leak of %d blocks found in xmlXPathTrueFunction",
47746 xmlMemBlocks() - mem_base);
47747 test_ret++;
47748 printf(" %d", n_ctxt);
47749 printf(" %d", n_nargs);
47750 printf("\n");
47751 }
47752 }
47753 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047754 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047755#endif
47756
Daniel Veillarda82b1822004-11-08 16:24:57 +000047757 return(test_ret);
47758}
47759
47760
47761static int
47762test_xmlXPathValueFlipSign(void) {
47763 int test_ret = 0;
47764
William M. Brack21e4ef22005-01-02 09:53:13 +000047765#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047766 int mem_base;
47767 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47768 int n_ctxt;
47769
47770 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47771 mem_base = xmlMemBlocks();
47772 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47773
47774 xmlXPathValueFlipSign(ctxt);
47775 call_tests++;
47776 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47777 xmlResetLastError();
47778 if (mem_base != xmlMemBlocks()) {
47779 printf("Leak of %d blocks found in xmlXPathValueFlipSign",
47780 xmlMemBlocks() - mem_base);
47781 test_ret++;
47782 printf(" %d", n_ctxt);
47783 printf("\n");
47784 }
47785 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047786 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047787#endif
47788
Daniel Veillarda82b1822004-11-08 16:24:57 +000047789 return(test_ret);
47790}
47791
47792
47793static int
47794test_xmlXPathVariableLookup(void) {
47795 int test_ret = 0;
47796
William M. Brack21e4ef22005-01-02 09:53:13 +000047797#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047798 int mem_base;
47799 xmlXPathObjectPtr ret_val;
47800 xmlXPathContextPtr ctxt; /* the XPath context */
47801 int n_ctxt;
47802 xmlChar * name; /* the variable name */
47803 int n_name;
47804
47805 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
47806 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
47807 mem_base = xmlMemBlocks();
47808 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
47809 name = gen_const_xmlChar_ptr(n_name, 1);
47810
William M. Brackf13f77f2004-11-12 16:03:48 +000047811 ret_val = xmlXPathVariableLookup(ctxt, (const xmlChar *)name);
Daniel Veillarda82b1822004-11-08 16:24:57 +000047812 desret_xmlXPathObjectPtr(ret_val);
47813 call_tests++;
47814 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000047815 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarda82b1822004-11-08 16:24:57 +000047816 xmlResetLastError();
47817 if (mem_base != xmlMemBlocks()) {
47818 printf("Leak of %d blocks found in xmlXPathVariableLookup",
47819 xmlMemBlocks() - mem_base);
47820 test_ret++;
47821 printf(" %d", n_ctxt);
47822 printf(" %d", n_name);
47823 printf("\n");
47824 }
47825 }
47826 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047827 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047828#endif
47829
Daniel Veillarda82b1822004-11-08 16:24:57 +000047830 return(test_ret);
47831}
47832
47833
47834static int
47835test_xmlXPathVariableLookupNS(void) {
47836 int test_ret = 0;
47837
William M. Brack21e4ef22005-01-02 09:53:13 +000047838#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047839 int mem_base;
47840 xmlXPathObjectPtr ret_val;
47841 xmlXPathContextPtr ctxt; /* the XPath context */
47842 int n_ctxt;
47843 xmlChar * name; /* the variable name */
47844 int n_name;
47845 xmlChar * ns_uri; /* the variable namespace URI */
47846 int n_ns_uri;
47847
47848 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
47849 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
47850 for (n_ns_uri = 0;n_ns_uri < gen_nb_const_xmlChar_ptr;n_ns_uri++) {
47851 mem_base = xmlMemBlocks();
47852 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
47853 name = gen_const_xmlChar_ptr(n_name, 1);
47854 ns_uri = gen_const_xmlChar_ptr(n_ns_uri, 2);
47855
William M. Brackf13f77f2004-11-12 16:03:48 +000047856 ret_val = xmlXPathVariableLookupNS(ctxt, (const xmlChar *)name, (const xmlChar *)ns_uri);
Daniel Veillarda82b1822004-11-08 16:24:57 +000047857 desret_xmlXPathObjectPtr(ret_val);
47858 call_tests++;
47859 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000047860 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
47861 des_const_xmlChar_ptr(n_ns_uri, (const xmlChar *)ns_uri, 2);
Daniel Veillarda82b1822004-11-08 16:24:57 +000047862 xmlResetLastError();
47863 if (mem_base != xmlMemBlocks()) {
47864 printf("Leak of %d blocks found in xmlXPathVariableLookupNS",
47865 xmlMemBlocks() - mem_base);
47866 test_ret++;
47867 printf(" %d", n_ctxt);
47868 printf(" %d", n_name);
47869 printf(" %d", n_ns_uri);
47870 printf("\n");
47871 }
47872 }
47873 }
47874 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047875 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047876#endif
47877
Daniel Veillarda82b1822004-11-08 16:24:57 +000047878 return(test_ret);
47879}
47880
47881
47882static int
47883test_xmlXPathWrapCString(void) {
47884 int test_ret = 0;
47885
William M. Brack21e4ef22005-01-02 09:53:13 +000047886#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047887 int mem_base;
47888 xmlXPathObjectPtr ret_val;
47889 char * val; /* the char * value */
47890 int n_val;
47891
47892 for (n_val = 0;n_val < gen_nb_char_ptr;n_val++) {
47893 mem_base = xmlMemBlocks();
47894 val = gen_char_ptr(n_val, 0);
47895
47896 ret_val = xmlXPathWrapCString(val);
47897 desret_xmlXPathObjectPtr(ret_val);
47898 call_tests++;
47899 des_char_ptr(n_val, val, 0);
47900 xmlResetLastError();
47901 if (mem_base != xmlMemBlocks()) {
47902 printf("Leak of %d blocks found in xmlXPathWrapCString",
47903 xmlMemBlocks() - mem_base);
47904 test_ret++;
47905 printf(" %d", n_val);
47906 printf("\n");
47907 }
47908 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047909 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047910#endif
47911
Daniel Veillarda82b1822004-11-08 16:24:57 +000047912 return(test_ret);
47913}
47914
47915
47916static int
47917test_xmlXPathWrapExternal(void) {
47918 int test_ret = 0;
47919
William M. Brack21e4ef22005-01-02 09:53:13 +000047920#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047921 int mem_base;
47922 xmlXPathObjectPtr ret_val;
47923 void * val; /* the user data */
47924 int n_val;
47925
47926 for (n_val = 0;n_val < gen_nb_void_ptr;n_val++) {
47927 mem_base = xmlMemBlocks();
47928 val = gen_void_ptr(n_val, 0);
47929
47930 ret_val = xmlXPathWrapExternal(val);
47931 desret_xmlXPathObjectPtr(ret_val);
47932 call_tests++;
47933 des_void_ptr(n_val, val, 0);
47934 xmlResetLastError();
47935 if (mem_base != xmlMemBlocks()) {
47936 printf("Leak of %d blocks found in xmlXPathWrapExternal",
47937 xmlMemBlocks() - mem_base);
47938 test_ret++;
47939 printf(" %d", n_val);
47940 printf("\n");
47941 }
47942 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047943 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047944#endif
47945
Daniel Veillarda82b1822004-11-08 16:24:57 +000047946 return(test_ret);
47947}
47948
47949
47950static int
47951test_xmlXPathWrapNodeSet(void) {
47952 int test_ret = 0;
47953
William M. Brack21e4ef22005-01-02 09:53:13 +000047954#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047955 int mem_base;
47956 xmlXPathObjectPtr ret_val;
47957 xmlNodeSetPtr val; /* the NodePtr value */
47958 int n_val;
47959
47960 for (n_val = 0;n_val < gen_nb_xmlNodeSetPtr;n_val++) {
47961 mem_base = xmlMemBlocks();
47962 val = gen_xmlNodeSetPtr(n_val, 0);
47963
47964 ret_val = xmlXPathWrapNodeSet(val);
47965 desret_xmlXPathObjectPtr(ret_val);
47966 call_tests++;
47967 des_xmlNodeSetPtr(n_val, val, 0);
47968 xmlResetLastError();
47969 if (mem_base != xmlMemBlocks()) {
47970 printf("Leak of %d blocks found in xmlXPathWrapNodeSet",
47971 xmlMemBlocks() - mem_base);
47972 test_ret++;
47973 printf(" %d", n_val);
47974 printf("\n");
47975 }
47976 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047977 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047978#endif
47979
Daniel Veillarda82b1822004-11-08 16:24:57 +000047980 return(test_ret);
47981}
47982
47983
47984static int
47985test_xmlXPatherror(void) {
47986 int test_ret = 0;
47987
William M. Brack21e4ef22005-01-02 09:53:13 +000047988#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047989 int mem_base;
47990 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47991 int n_ctxt;
47992 const char * file; /* the file name */
47993 int n_file;
47994 int line; /* the line number */
47995 int n_line;
47996 int no; /* the error number */
47997 int n_no;
47998
47999 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
48000 for (n_file = 0;n_file < gen_nb_filepath;n_file++) {
48001 for (n_line = 0;n_line < gen_nb_int;n_line++) {
48002 for (n_no = 0;n_no < gen_nb_int;n_no++) {
48003 mem_base = xmlMemBlocks();
48004 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
48005 file = gen_filepath(n_file, 1);
48006 line = gen_int(n_line, 2);
48007 no = gen_int(n_no, 3);
48008
48009 xmlXPatherror(ctxt, file, line, no);
48010 call_tests++;
48011 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
48012 des_filepath(n_file, file, 1);
48013 des_int(n_line, line, 2);
48014 des_int(n_no, no, 3);
48015 xmlResetLastError();
48016 if (mem_base != xmlMemBlocks()) {
48017 printf("Leak of %d blocks found in xmlXPatherror",
48018 xmlMemBlocks() - mem_base);
48019 test_ret++;
48020 printf(" %d", n_ctxt);
48021 printf(" %d", n_file);
48022 printf(" %d", n_line);
48023 printf(" %d", n_no);
48024 printf("\n");
48025 }
48026 }
48027 }
48028 }
48029 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048030 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000048031#endif
48032
Daniel Veillarda82b1822004-11-08 16:24:57 +000048033 return(test_ret);
48034}
48035
48036static int
48037test_xpathInternals(void) {
48038 int test_ret = 0;
48039
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048040 if (quiet == 0) printf("Testing xpathInternals : 106 of 117 functions ...\n");
Daniel Veillarda82b1822004-11-08 16:24:57 +000048041 test_ret += test_valuePop();
48042 test_ret += test_valuePush();
48043 test_ret += test_xmlXPathAddValues();
48044 test_ret += test_xmlXPathBooleanFunction();
48045 test_ret += test_xmlXPathCeilingFunction();
48046 test_ret += test_xmlXPathCompareValues();
48047 test_ret += test_xmlXPathConcatFunction();
48048 test_ret += test_xmlXPathContainsFunction();
48049 test_ret += test_xmlXPathCountFunction();
48050 test_ret += test_xmlXPathDebugDumpCompExpr();
48051 test_ret += test_xmlXPathDebugDumpObject();
48052 test_ret += test_xmlXPathDifference();
48053 test_ret += test_xmlXPathDistinct();
48054 test_ret += test_xmlXPathDistinctSorted();
48055 test_ret += test_xmlXPathDivValues();
48056 test_ret += test_xmlXPathEqualValues();
48057 test_ret += test_xmlXPathErr();
48058 test_ret += test_xmlXPathEvalExpr();
48059 test_ret += test_xmlXPathEvaluatePredicateResult();
48060 test_ret += test_xmlXPathFalseFunction();
48061 test_ret += test_xmlXPathFloorFunction();
48062 test_ret += test_xmlXPathFunctionLookup();
48063 test_ret += test_xmlXPathFunctionLookupNS();
48064 test_ret += test_xmlXPathHasSameNodes();
48065 test_ret += test_xmlXPathIdFunction();
48066 test_ret += test_xmlXPathIntersection();
48067 test_ret += test_xmlXPathIsNodeType();
48068 test_ret += test_xmlXPathLangFunction();
48069 test_ret += test_xmlXPathLastFunction();
48070 test_ret += test_xmlXPathLeading();
48071 test_ret += test_xmlXPathLeadingSorted();
48072 test_ret += test_xmlXPathLocalNameFunction();
48073 test_ret += test_xmlXPathModValues();
48074 test_ret += test_xmlXPathMultValues();
48075 test_ret += test_xmlXPathNamespaceURIFunction();
48076 test_ret += test_xmlXPathNewBoolean();
48077 test_ret += test_xmlXPathNewCString();
48078 test_ret += test_xmlXPathNewFloat();
48079 test_ret += test_xmlXPathNewNodeSet();
48080 test_ret += test_xmlXPathNewNodeSetList();
48081 test_ret += test_xmlXPathNewParserContext();
48082 test_ret += test_xmlXPathNewString();
48083 test_ret += test_xmlXPathNextAncestor();
48084 test_ret += test_xmlXPathNextAncestorOrSelf();
48085 test_ret += test_xmlXPathNextAttribute();
48086 test_ret += test_xmlXPathNextChild();
48087 test_ret += test_xmlXPathNextDescendant();
48088 test_ret += test_xmlXPathNextDescendantOrSelf();
48089 test_ret += test_xmlXPathNextFollowing();
48090 test_ret += test_xmlXPathNextFollowingSibling();
48091 test_ret += test_xmlXPathNextNamespace();
48092 test_ret += test_xmlXPathNextParent();
48093 test_ret += test_xmlXPathNextPreceding();
48094 test_ret += test_xmlXPathNextPrecedingSibling();
48095 test_ret += test_xmlXPathNextSelf();
48096 test_ret += test_xmlXPathNodeLeading();
48097 test_ret += test_xmlXPathNodeLeadingSorted();
48098 test_ret += test_xmlXPathNodeSetAdd();
48099 test_ret += test_xmlXPathNodeSetAddNs();
48100 test_ret += test_xmlXPathNodeSetAddUnique();
48101 test_ret += test_xmlXPathNodeSetContains();
48102 test_ret += test_xmlXPathNodeSetDel();
48103 test_ret += test_xmlXPathNodeSetMerge();
48104 test_ret += test_xmlXPathNodeSetRemove();
48105 test_ret += test_xmlXPathNodeSetSort();
48106 test_ret += test_xmlXPathNodeTrailing();
48107 test_ret += test_xmlXPathNodeTrailingSorted();
48108 test_ret += test_xmlXPathNormalizeFunction();
48109 test_ret += test_xmlXPathNotEqualValues();
48110 test_ret += test_xmlXPathNotFunction();
48111 test_ret += test_xmlXPathNsLookup();
48112 test_ret += test_xmlXPathNumberFunction();
48113 test_ret += test_xmlXPathParseNCName();
48114 test_ret += test_xmlXPathParseName();
48115 test_ret += test_xmlXPathPopBoolean();
48116 test_ret += test_xmlXPathPopExternal();
48117 test_ret += test_xmlXPathPopNodeSet();
48118 test_ret += test_xmlXPathPopNumber();
48119 test_ret += test_xmlXPathPopString();
48120 test_ret += test_xmlXPathPositionFunction();
48121 test_ret += test_xmlXPathRegisterAllFunctions();
48122 test_ret += test_xmlXPathRegisterFunc();
48123 test_ret += test_xmlXPathRegisterFuncLookup();
48124 test_ret += test_xmlXPathRegisterFuncNS();
48125 test_ret += test_xmlXPathRegisterNs();
48126 test_ret += test_xmlXPathRegisterVariable();
48127 test_ret += test_xmlXPathRegisterVariableLookup();
48128 test_ret += test_xmlXPathRegisterVariableNS();
48129 test_ret += test_xmlXPathRegisteredFuncsCleanup();
48130 test_ret += test_xmlXPathRegisteredNsCleanup();
48131 test_ret += test_xmlXPathRegisteredVariablesCleanup();
48132 test_ret += test_xmlXPathRoot();
48133 test_ret += test_xmlXPathRoundFunction();
48134 test_ret += test_xmlXPathStartsWithFunction();
48135 test_ret += test_xmlXPathStringEvalNumber();
48136 test_ret += test_xmlXPathStringFunction();
48137 test_ret += test_xmlXPathStringLengthFunction();
48138 test_ret += test_xmlXPathSubValues();
48139 test_ret += test_xmlXPathSubstringAfterFunction();
48140 test_ret += test_xmlXPathSubstringBeforeFunction();
48141 test_ret += test_xmlXPathSubstringFunction();
48142 test_ret += test_xmlXPathSumFunction();
48143 test_ret += test_xmlXPathTrailing();
48144 test_ret += test_xmlXPathTrailingSorted();
48145 test_ret += test_xmlXPathTranslateFunction();
48146 test_ret += test_xmlXPathTrueFunction();
48147 test_ret += test_xmlXPathValueFlipSign();
48148 test_ret += test_xmlXPathVariableLookup();
48149 test_ret += test_xmlXPathVariableLookupNS();
48150 test_ret += test_xmlXPathWrapCString();
48151 test_ret += test_xmlXPathWrapExternal();
48152 test_ret += test_xmlXPathWrapNodeSet();
48153 test_ret += test_xmlXPatherror();
48154
48155 if (test_ret != 0)
48156 printf("Module xpathInternals: %d errors\n", test_ret);
48157 return(test_ret);
48158}
48159
Daniel Veillardd93f6252004-11-02 15:53:51 +000048160static int
48161test_xmlXPtrBuildNodeList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048162 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048163
William M. Brack21e4ef22005-01-02 09:53:13 +000048164#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000048165 int mem_base;
48166 xmlNodePtr ret_val;
48167 xmlXPathObjectPtr obj; /* the XPointer result from the evaluation. */
48168 int n_obj;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048169
Daniel Veillardd005b9e2004-11-03 17:07:05 +000048170 for (n_obj = 0;n_obj < gen_nb_xmlXPathObjectPtr;n_obj++) {
48171 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000048172 obj = gen_xmlXPathObjectPtr(n_obj, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000048173
48174 ret_val = xmlXPtrBuildNodeList(obj);
48175 desret_xmlNodePtr(ret_val);
48176 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048177 des_xmlXPathObjectPtr(n_obj, obj, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000048178 xmlResetLastError();
48179 if (mem_base != xmlMemBlocks()) {
48180 printf("Leak of %d blocks found in xmlXPtrBuildNodeList",
48181 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048182 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000048183 printf(" %d", n_obj);
48184 printf("\n");
48185 }
48186 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048187 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000048188#endif
48189
Daniel Veillard42595322004-11-08 10:52:06 +000048190 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048191}
48192
48193
48194static int
48195test_xmlXPtrEval(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048196 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048197
William M. Brack21e4ef22005-01-02 09:53:13 +000048198#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000048199 int mem_base;
48200 xmlXPathObjectPtr ret_val;
48201 xmlChar * str; /* the XPointer expression */
48202 int n_str;
48203 xmlXPathContextPtr ctx; /* the XPointer context */
48204 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048205
Daniel Veillardce682bc2004-11-05 17:22:25 +000048206 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
48207 for (n_ctx = 0;n_ctx < gen_nb_xmlXPathContextPtr;n_ctx++) {
48208 mem_base = xmlMemBlocks();
48209 str = gen_const_xmlChar_ptr(n_str, 0);
48210 ctx = gen_xmlXPathContextPtr(n_ctx, 1);
48211
William M. Brackf13f77f2004-11-12 16:03:48 +000048212 ret_val = xmlXPtrEval((const xmlChar *)str, ctx);
Daniel Veillardce682bc2004-11-05 17:22:25 +000048213 desret_xmlXPathObjectPtr(ret_val);
48214 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000048215 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000048216 des_xmlXPathContextPtr(n_ctx, ctx, 1);
48217 xmlResetLastError();
48218 if (mem_base != xmlMemBlocks()) {
48219 printf("Leak of %d blocks found in xmlXPtrEval",
48220 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048221 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048222 printf(" %d", n_str);
48223 printf(" %d", n_ctx);
48224 printf("\n");
48225 }
48226 }
48227 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048228 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048229#endif
48230
Daniel Veillard42595322004-11-08 10:52:06 +000048231 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048232}
48233
48234
48235static int
48236test_xmlXPtrEvalRangePredicate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048237 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048238
William M. Brack21e4ef22005-01-02 09:53:13 +000048239#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000048240 int mem_base;
48241 xmlXPathParserContextPtr ctxt; /* the XPointer Parser context */
48242 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048243
Daniel Veillardce682bc2004-11-05 17:22:25 +000048244 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
48245 mem_base = xmlMemBlocks();
48246 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
48247
48248 xmlXPtrEvalRangePredicate(ctxt);
48249 call_tests++;
48250 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
48251 xmlResetLastError();
48252 if (mem_base != xmlMemBlocks()) {
48253 printf("Leak of %d blocks found in xmlXPtrEvalRangePredicate",
48254 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048255 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048256 printf(" %d", n_ctxt);
48257 printf("\n");
48258 }
48259 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048260 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048261#endif
48262
Daniel Veillard42595322004-11-08 10:52:06 +000048263 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048264}
48265
Daniel Veillarda521d282004-11-09 14:59:59 +000048266#ifdef LIBXML_XPTR_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000048267
Daniel Veillardce682bc2004-11-05 17:22:25 +000048268#define gen_nb_xmlLocationSetPtr 1
48269static xmlLocationSetPtr gen_xmlLocationSetPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
48270 return(NULL);
48271}
48272static void des_xmlLocationSetPtr(int no ATTRIBUTE_UNUSED, xmlLocationSetPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
48273}
Daniel Veillarda521d282004-11-09 14:59:59 +000048274#endif
48275
Daniel Veillardce682bc2004-11-05 17:22:25 +000048276
Daniel Veillardd93f6252004-11-02 15:53:51 +000048277static int
48278test_xmlXPtrLocationSetAdd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048279 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048280
William M. Brack21e4ef22005-01-02 09:53:13 +000048281#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000048282 int mem_base;
48283 xmlLocationSetPtr cur; /* the initial range set */
48284 int n_cur;
48285 xmlXPathObjectPtr val; /* a new xmlXPathObjectPtr */
48286 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048287
Daniel Veillardce682bc2004-11-05 17:22:25 +000048288 for (n_cur = 0;n_cur < gen_nb_xmlLocationSetPtr;n_cur++) {
48289 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
48290 mem_base = xmlMemBlocks();
48291 cur = gen_xmlLocationSetPtr(n_cur, 0);
48292 val = gen_xmlXPathObjectPtr(n_val, 1);
48293
48294 xmlXPtrLocationSetAdd(cur, val);
48295 call_tests++;
48296 des_xmlLocationSetPtr(n_cur, cur, 0);
48297 des_xmlXPathObjectPtr(n_val, val, 1);
48298 xmlResetLastError();
48299 if (mem_base != xmlMemBlocks()) {
48300 printf("Leak of %d blocks found in xmlXPtrLocationSetAdd",
48301 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048302 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048303 printf(" %d", n_cur);
48304 printf(" %d", n_val);
48305 printf("\n");
48306 }
48307 }
48308 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048309 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048310#endif
48311
Daniel Veillard42595322004-11-08 10:52:06 +000048312 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048313}
48314
48315
48316static int
48317test_xmlXPtrLocationSetCreate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048318 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048319
48320
48321 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000048322 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048323}
48324
48325
48326static int
48327test_xmlXPtrLocationSetDel(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048328 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048329
William M. Brack21e4ef22005-01-02 09:53:13 +000048330#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000048331 int mem_base;
48332 xmlLocationSetPtr cur; /* the initial range set */
48333 int n_cur;
48334 xmlXPathObjectPtr val; /* an xmlXPathObjectPtr */
48335 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048336
Daniel Veillardce682bc2004-11-05 17:22:25 +000048337 for (n_cur = 0;n_cur < gen_nb_xmlLocationSetPtr;n_cur++) {
48338 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
48339 mem_base = xmlMemBlocks();
48340 cur = gen_xmlLocationSetPtr(n_cur, 0);
48341 val = gen_xmlXPathObjectPtr(n_val, 1);
48342
48343 xmlXPtrLocationSetDel(cur, val);
48344 call_tests++;
48345 des_xmlLocationSetPtr(n_cur, cur, 0);
48346 des_xmlXPathObjectPtr(n_val, val, 1);
48347 xmlResetLastError();
48348 if (mem_base != xmlMemBlocks()) {
48349 printf("Leak of %d blocks found in xmlXPtrLocationSetDel",
48350 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048351 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048352 printf(" %d", n_cur);
48353 printf(" %d", n_val);
48354 printf("\n");
48355 }
48356 }
48357 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048358 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048359#endif
48360
Daniel Veillard42595322004-11-08 10:52:06 +000048361 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048362}
48363
48364
48365static int
48366test_xmlXPtrLocationSetMerge(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048367 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048368
48369
48370 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000048371 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048372}
48373
48374
48375static int
48376test_xmlXPtrLocationSetRemove(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048377 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048378
William M. Brack21e4ef22005-01-02 09:53:13 +000048379#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000048380 int mem_base;
48381 xmlLocationSetPtr cur; /* the initial range set */
48382 int n_cur;
48383 int val; /* the index to remove */
48384 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048385
Daniel Veillardce682bc2004-11-05 17:22:25 +000048386 for (n_cur = 0;n_cur < gen_nb_xmlLocationSetPtr;n_cur++) {
48387 for (n_val = 0;n_val < gen_nb_int;n_val++) {
48388 mem_base = xmlMemBlocks();
48389 cur = gen_xmlLocationSetPtr(n_cur, 0);
48390 val = gen_int(n_val, 1);
48391
48392 xmlXPtrLocationSetRemove(cur, val);
48393 call_tests++;
48394 des_xmlLocationSetPtr(n_cur, cur, 0);
48395 des_int(n_val, val, 1);
48396 xmlResetLastError();
48397 if (mem_base != xmlMemBlocks()) {
48398 printf("Leak of %d blocks found in xmlXPtrLocationSetRemove",
48399 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048400 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048401 printf(" %d", n_cur);
48402 printf(" %d", n_val);
48403 printf("\n");
48404 }
48405 }
48406 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048407 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048408#endif
48409
Daniel Veillard42595322004-11-08 10:52:06 +000048410 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048411}
48412
48413
48414static int
48415test_xmlXPtrNewCollapsedRange(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048416 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048417
William M. Brack21e4ef22005-01-02 09:53:13 +000048418#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000048419 int mem_base;
48420 xmlXPathObjectPtr ret_val;
48421 xmlNodePtr start; /* the starting and ending node */
48422 int n_start;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048423
Daniel Veillard3d97e662004-11-04 10:49:00 +000048424 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
48425 mem_base = xmlMemBlocks();
48426 start = gen_xmlNodePtr(n_start, 0);
48427
48428 ret_val = xmlXPtrNewCollapsedRange(start);
48429 desret_xmlXPathObjectPtr(ret_val);
48430 call_tests++;
48431 des_xmlNodePtr(n_start, start, 0);
48432 xmlResetLastError();
48433 if (mem_base != xmlMemBlocks()) {
48434 printf("Leak of %d blocks found in xmlXPtrNewCollapsedRange",
48435 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048436 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048437 printf(" %d", n_start);
48438 printf("\n");
48439 }
48440 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048441 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048442#endif
48443
Daniel Veillard42595322004-11-08 10:52:06 +000048444 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048445}
48446
48447
48448static int
48449test_xmlXPtrNewContext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048450 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048451
48452
48453 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000048454 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048455}
48456
48457
48458static int
48459test_xmlXPtrNewLocationSetNodeSet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048460 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048461
William M. Brack21e4ef22005-01-02 09:53:13 +000048462#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000048463 int mem_base;
48464 xmlXPathObjectPtr ret_val;
48465 xmlNodeSetPtr set; /* a node set */
48466 int n_set;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048467
Daniel Veillardce682bc2004-11-05 17:22:25 +000048468 for (n_set = 0;n_set < gen_nb_xmlNodeSetPtr;n_set++) {
48469 mem_base = xmlMemBlocks();
48470 set = gen_xmlNodeSetPtr(n_set, 0);
48471
48472 ret_val = xmlXPtrNewLocationSetNodeSet(set);
48473 desret_xmlXPathObjectPtr(ret_val);
48474 call_tests++;
48475 des_xmlNodeSetPtr(n_set, set, 0);
48476 xmlResetLastError();
48477 if (mem_base != xmlMemBlocks()) {
48478 printf("Leak of %d blocks found in xmlXPtrNewLocationSetNodeSet",
48479 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048480 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048481 printf(" %d", n_set);
48482 printf("\n");
48483 }
48484 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048485 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048486#endif
48487
Daniel Veillard42595322004-11-08 10:52:06 +000048488 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048489}
48490
48491
48492static int
48493test_xmlXPtrNewLocationSetNodes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048494 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048495
William M. Brack21e4ef22005-01-02 09:53:13 +000048496#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000048497 int mem_base;
48498 xmlXPathObjectPtr ret_val;
48499 xmlNodePtr start; /* the start NodePtr value */
48500 int n_start;
48501 xmlNodePtr end; /* the end NodePtr value or NULL */
48502 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048503
Daniel Veillard3d97e662004-11-04 10:49:00 +000048504 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
48505 for (n_end = 0;n_end < gen_nb_xmlNodePtr;n_end++) {
48506 mem_base = xmlMemBlocks();
48507 start = gen_xmlNodePtr(n_start, 0);
48508 end = gen_xmlNodePtr(n_end, 1);
48509
48510 ret_val = xmlXPtrNewLocationSetNodes(start, end);
48511 desret_xmlXPathObjectPtr(ret_val);
48512 call_tests++;
48513 des_xmlNodePtr(n_start, start, 0);
48514 des_xmlNodePtr(n_end, end, 1);
48515 xmlResetLastError();
48516 if (mem_base != xmlMemBlocks()) {
48517 printf("Leak of %d blocks found in xmlXPtrNewLocationSetNodes",
48518 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048519 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048520 printf(" %d", n_start);
48521 printf(" %d", n_end);
48522 printf("\n");
48523 }
48524 }
48525 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048526 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048527#endif
48528
Daniel Veillard42595322004-11-08 10:52:06 +000048529 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048530}
48531
48532
48533static int
48534test_xmlXPtrNewRange(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048535 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048536
William M. Brack21e4ef22005-01-02 09:53:13 +000048537#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000048538 int mem_base;
48539 xmlXPathObjectPtr ret_val;
48540 xmlNodePtr start; /* the starting node */
48541 int n_start;
48542 int startindex; /* the start index */
48543 int n_startindex;
48544 xmlNodePtr end; /* the ending point */
48545 int n_end;
48546 int endindex; /* the ending index */
48547 int n_endindex;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048548
Daniel Veillard3d97e662004-11-04 10:49:00 +000048549 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
48550 for (n_startindex = 0;n_startindex < gen_nb_int;n_startindex++) {
48551 for (n_end = 0;n_end < gen_nb_xmlNodePtr;n_end++) {
48552 for (n_endindex = 0;n_endindex < gen_nb_int;n_endindex++) {
48553 mem_base = xmlMemBlocks();
48554 start = gen_xmlNodePtr(n_start, 0);
48555 startindex = gen_int(n_startindex, 1);
48556 end = gen_xmlNodePtr(n_end, 2);
48557 endindex = gen_int(n_endindex, 3);
48558
48559 ret_val = xmlXPtrNewRange(start, startindex, end, endindex);
48560 desret_xmlXPathObjectPtr(ret_val);
48561 call_tests++;
48562 des_xmlNodePtr(n_start, start, 0);
48563 des_int(n_startindex, startindex, 1);
48564 des_xmlNodePtr(n_end, end, 2);
48565 des_int(n_endindex, endindex, 3);
48566 xmlResetLastError();
48567 if (mem_base != xmlMemBlocks()) {
48568 printf("Leak of %d blocks found in xmlXPtrNewRange",
48569 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048570 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048571 printf(" %d", n_start);
48572 printf(" %d", n_startindex);
48573 printf(" %d", n_end);
48574 printf(" %d", n_endindex);
48575 printf("\n");
48576 }
48577 }
48578 }
48579 }
48580 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048581 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048582#endif
48583
Daniel Veillard42595322004-11-08 10:52:06 +000048584 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048585}
48586
48587
48588static int
48589test_xmlXPtrNewRangeNodeObject(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048590 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048591
William M. Brack21e4ef22005-01-02 09:53:13 +000048592#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000048593 int mem_base;
48594 xmlXPathObjectPtr ret_val;
48595 xmlNodePtr start; /* the starting node */
48596 int n_start;
48597 xmlXPathObjectPtr end; /* the ending object */
48598 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048599
Daniel Veillard3d97e662004-11-04 10:49:00 +000048600 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
48601 for (n_end = 0;n_end < gen_nb_xmlXPathObjectPtr;n_end++) {
48602 mem_base = xmlMemBlocks();
48603 start = gen_xmlNodePtr(n_start, 0);
48604 end = gen_xmlXPathObjectPtr(n_end, 1);
48605
48606 ret_val = xmlXPtrNewRangeNodeObject(start, end);
48607 desret_xmlXPathObjectPtr(ret_val);
48608 call_tests++;
48609 des_xmlNodePtr(n_start, start, 0);
48610 des_xmlXPathObjectPtr(n_end, end, 1);
48611 xmlResetLastError();
48612 if (mem_base != xmlMemBlocks()) {
48613 printf("Leak of %d blocks found in xmlXPtrNewRangeNodeObject",
48614 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048615 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048616 printf(" %d", n_start);
48617 printf(" %d", n_end);
48618 printf("\n");
48619 }
48620 }
48621 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048622 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048623#endif
48624
Daniel Veillard42595322004-11-08 10:52:06 +000048625 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048626}
48627
48628
48629static int
48630test_xmlXPtrNewRangeNodePoint(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048631 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048632
William M. Brack21e4ef22005-01-02 09:53:13 +000048633#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000048634 int mem_base;
48635 xmlXPathObjectPtr ret_val;
48636 xmlNodePtr start; /* the starting node */
48637 int n_start;
48638 xmlXPathObjectPtr end; /* the ending point */
48639 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048640
Daniel Veillard3d97e662004-11-04 10:49:00 +000048641 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
48642 for (n_end = 0;n_end < gen_nb_xmlXPathObjectPtr;n_end++) {
48643 mem_base = xmlMemBlocks();
48644 start = gen_xmlNodePtr(n_start, 0);
48645 end = gen_xmlXPathObjectPtr(n_end, 1);
48646
48647 ret_val = xmlXPtrNewRangeNodePoint(start, end);
48648 desret_xmlXPathObjectPtr(ret_val);
48649 call_tests++;
48650 des_xmlNodePtr(n_start, start, 0);
48651 des_xmlXPathObjectPtr(n_end, end, 1);
48652 xmlResetLastError();
48653 if (mem_base != xmlMemBlocks()) {
48654 printf("Leak of %d blocks found in xmlXPtrNewRangeNodePoint",
48655 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048656 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048657 printf(" %d", n_start);
48658 printf(" %d", n_end);
48659 printf("\n");
48660 }
48661 }
48662 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048663 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048664#endif
48665
Daniel Veillard42595322004-11-08 10:52:06 +000048666 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048667}
48668
48669
48670static int
48671test_xmlXPtrNewRangeNodes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048672 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048673
William M. Brack21e4ef22005-01-02 09:53:13 +000048674#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000048675 int mem_base;
48676 xmlXPathObjectPtr ret_val;
48677 xmlNodePtr start; /* the starting node */
48678 int n_start;
48679 xmlNodePtr end; /* the ending node */
48680 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048681
Daniel Veillard3d97e662004-11-04 10:49:00 +000048682 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
48683 for (n_end = 0;n_end < gen_nb_xmlNodePtr;n_end++) {
48684 mem_base = xmlMemBlocks();
48685 start = gen_xmlNodePtr(n_start, 0);
48686 end = gen_xmlNodePtr(n_end, 1);
48687
48688 ret_val = xmlXPtrNewRangeNodes(start, end);
48689 desret_xmlXPathObjectPtr(ret_val);
48690 call_tests++;
48691 des_xmlNodePtr(n_start, start, 0);
48692 des_xmlNodePtr(n_end, end, 1);
48693 xmlResetLastError();
48694 if (mem_base != xmlMemBlocks()) {
48695 printf("Leak of %d blocks found in xmlXPtrNewRangeNodes",
48696 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048697 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048698 printf(" %d", n_start);
48699 printf(" %d", n_end);
48700 printf("\n");
48701 }
48702 }
48703 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048704 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048705#endif
48706
Daniel Veillard42595322004-11-08 10:52:06 +000048707 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048708}
48709
48710
48711static int
48712test_xmlXPtrNewRangePointNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048713 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048714
William M. Brack21e4ef22005-01-02 09:53:13 +000048715#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000048716 int mem_base;
48717 xmlXPathObjectPtr ret_val;
48718 xmlXPathObjectPtr start; /* the starting point */
48719 int n_start;
48720 xmlNodePtr end; /* the ending node */
48721 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048722
Daniel Veillard3d97e662004-11-04 10:49:00 +000048723 for (n_start = 0;n_start < gen_nb_xmlXPathObjectPtr;n_start++) {
48724 for (n_end = 0;n_end < gen_nb_xmlNodePtr;n_end++) {
48725 mem_base = xmlMemBlocks();
48726 start = gen_xmlXPathObjectPtr(n_start, 0);
48727 end = gen_xmlNodePtr(n_end, 1);
48728
48729 ret_val = xmlXPtrNewRangePointNode(start, end);
48730 desret_xmlXPathObjectPtr(ret_val);
48731 call_tests++;
48732 des_xmlXPathObjectPtr(n_start, start, 0);
48733 des_xmlNodePtr(n_end, end, 1);
48734 xmlResetLastError();
48735 if (mem_base != xmlMemBlocks()) {
48736 printf("Leak of %d blocks found in xmlXPtrNewRangePointNode",
48737 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048738 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048739 printf(" %d", n_start);
48740 printf(" %d", n_end);
48741 printf("\n");
48742 }
48743 }
48744 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048745 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048746#endif
48747
Daniel Veillard42595322004-11-08 10:52:06 +000048748 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048749}
48750
48751
48752static int
48753test_xmlXPtrNewRangePoints(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048754 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048755
William M. Brack21e4ef22005-01-02 09:53:13 +000048756#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000048757 int mem_base;
48758 xmlXPathObjectPtr ret_val;
48759 xmlXPathObjectPtr start; /* the starting point */
48760 int n_start;
48761 xmlXPathObjectPtr end; /* the ending point */
48762 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048763
Daniel Veillard3d97e662004-11-04 10:49:00 +000048764 for (n_start = 0;n_start < gen_nb_xmlXPathObjectPtr;n_start++) {
48765 for (n_end = 0;n_end < gen_nb_xmlXPathObjectPtr;n_end++) {
48766 mem_base = xmlMemBlocks();
48767 start = gen_xmlXPathObjectPtr(n_start, 0);
48768 end = gen_xmlXPathObjectPtr(n_end, 1);
48769
48770 ret_val = xmlXPtrNewRangePoints(start, end);
48771 desret_xmlXPathObjectPtr(ret_val);
48772 call_tests++;
48773 des_xmlXPathObjectPtr(n_start, start, 0);
48774 des_xmlXPathObjectPtr(n_end, end, 1);
48775 xmlResetLastError();
48776 if (mem_base != xmlMemBlocks()) {
48777 printf("Leak of %d blocks found in xmlXPtrNewRangePoints",
48778 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048779 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048780 printf(" %d", n_start);
48781 printf(" %d", n_end);
48782 printf("\n");
48783 }
48784 }
48785 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048786 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048787#endif
48788
Daniel Veillard42595322004-11-08 10:52:06 +000048789 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048790}
48791
48792
48793static int
48794test_xmlXPtrRangeToFunction(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048795 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048796
William M. Brack21e4ef22005-01-02 09:53:13 +000048797#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000048798 int mem_base;
48799 xmlXPathParserContextPtr ctxt; /* the XPointer Parser context */
48800 int n_ctxt;
48801 int nargs; /* the number of args */
48802 int n_nargs;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048803
Daniel Veillardce682bc2004-11-05 17:22:25 +000048804 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
48805 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
48806 mem_base = xmlMemBlocks();
48807 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
48808 nargs = gen_int(n_nargs, 1);
48809
48810 xmlXPtrRangeToFunction(ctxt, nargs);
48811 call_tests++;
48812 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
48813 des_int(n_nargs, nargs, 1);
48814 xmlResetLastError();
48815 if (mem_base != xmlMemBlocks()) {
48816 printf("Leak of %d blocks found in xmlXPtrRangeToFunction",
48817 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048818 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048819 printf(" %d", n_ctxt);
48820 printf(" %d", n_nargs);
48821 printf("\n");
48822 }
48823 }
48824 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048825 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048826#endif
48827
Daniel Veillard42595322004-11-08 10:52:06 +000048828 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048829}
48830
48831
48832static int
48833test_xmlXPtrWrapLocationSet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048834 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048835
William M. Brack21e4ef22005-01-02 09:53:13 +000048836#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000048837 int mem_base;
48838 xmlXPathObjectPtr ret_val;
48839 xmlLocationSetPtr val; /* the LocationSet value */
48840 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048841
Daniel Veillardce682bc2004-11-05 17:22:25 +000048842 for (n_val = 0;n_val < gen_nb_xmlLocationSetPtr;n_val++) {
48843 mem_base = xmlMemBlocks();
48844 val = gen_xmlLocationSetPtr(n_val, 0);
48845
48846 ret_val = xmlXPtrWrapLocationSet(val);
48847 desret_xmlXPathObjectPtr(ret_val);
48848 call_tests++;
48849 des_xmlLocationSetPtr(n_val, val, 0);
48850 xmlResetLastError();
48851 if (mem_base != xmlMemBlocks()) {
48852 printf("Leak of %d blocks found in xmlXPtrWrapLocationSet",
48853 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048854 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048855 printf(" %d", n_val);
48856 printf("\n");
48857 }
48858 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048859 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048860#endif
48861
Daniel Veillard42595322004-11-08 10:52:06 +000048862 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048863}
48864
48865static int
48866test_xpointer(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048867 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048868
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048869 if (quiet == 0) printf("Testing xpointer : 17 of 21 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000048870 test_ret += test_xmlXPtrBuildNodeList();
48871 test_ret += test_xmlXPtrEval();
48872 test_ret += test_xmlXPtrEvalRangePredicate();
48873 test_ret += test_xmlXPtrLocationSetAdd();
48874 test_ret += test_xmlXPtrLocationSetCreate();
48875 test_ret += test_xmlXPtrLocationSetDel();
48876 test_ret += test_xmlXPtrLocationSetMerge();
48877 test_ret += test_xmlXPtrLocationSetRemove();
48878 test_ret += test_xmlXPtrNewCollapsedRange();
48879 test_ret += test_xmlXPtrNewContext();
48880 test_ret += test_xmlXPtrNewLocationSetNodeSet();
48881 test_ret += test_xmlXPtrNewLocationSetNodes();
48882 test_ret += test_xmlXPtrNewRange();
48883 test_ret += test_xmlXPtrNewRangeNodeObject();
48884 test_ret += test_xmlXPtrNewRangeNodePoint();
48885 test_ret += test_xmlXPtrNewRangeNodes();
48886 test_ret += test_xmlXPtrNewRangePointNode();
48887 test_ret += test_xmlXPtrNewRangePoints();
48888 test_ret += test_xmlXPtrRangeToFunction();
48889 test_ret += test_xmlXPtrWrapLocationSet();
Daniel Veillardd93f6252004-11-02 15:53:51 +000048890
Daniel Veillard42595322004-11-08 10:52:06 +000048891 if (test_ret != 0)
48892 printf("Module xpointer: %d errors\n", test_ret);
48893 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048894}
Daniel Veillardce244ad2004-11-05 10:03:46 +000048895static int
48896test_module(const char *module) {
48897 if (!strcmp(module, "HTMLparser")) return(test_HTMLparser());
48898 if (!strcmp(module, "HTMLtree")) return(test_HTMLtree());
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000048899 if (!strcmp(module, "SAX2")) return(test_SAX2());
Daniel Veillarda82b1822004-11-08 16:24:57 +000048900 if (!strcmp(module, "c14n")) return(test_c14n());
Daniel Veillardce244ad2004-11-05 10:03:46 +000048901 if (!strcmp(module, "catalog")) return(test_catalog());
48902 if (!strcmp(module, "chvalid")) return(test_chvalid());
Daniel Veillarda82b1822004-11-08 16:24:57 +000048903 if (!strcmp(module, "debugXML")) return(test_debugXML());
Daniel Veillardce244ad2004-11-05 10:03:46 +000048904 if (!strcmp(module, "dict")) return(test_dict());
48905 if (!strcmp(module, "encoding")) return(test_encoding());
48906 if (!strcmp(module, "entities")) return(test_entities());
48907 if (!strcmp(module, "hash")) return(test_hash());
48908 if (!strcmp(module, "list")) return(test_list());
48909 if (!strcmp(module, "nanoftp")) return(test_nanoftp());
48910 if (!strcmp(module, "nanohttp")) return(test_nanohttp());
48911 if (!strcmp(module, "parser")) return(test_parser());
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000048912 if (!strcmp(module, "parserInternals")) return(test_parserInternals());
Daniel Veillardce244ad2004-11-05 10:03:46 +000048913 if (!strcmp(module, "pattern")) return(test_pattern());
48914 if (!strcmp(module, "relaxng")) return(test_relaxng());
48915 if (!strcmp(module, "schemasInternals")) return(test_schemasInternals());
48916 if (!strcmp(module, "tree")) return(test_tree());
48917 if (!strcmp(module, "uri")) return(test_uri());
48918 if (!strcmp(module, "valid")) return(test_valid());
48919 if (!strcmp(module, "xinclude")) return(test_xinclude());
48920 if (!strcmp(module, "xmlIO")) return(test_xmlIO());
Daniel Veillarda82b1822004-11-08 16:24:57 +000048921 if (!strcmp(module, "xmlautomata")) return(test_xmlautomata());
Daniel Veillardce244ad2004-11-05 10:03:46 +000048922 if (!strcmp(module, "xmlerror")) return(test_xmlerror());
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000048923 if (!strcmp(module, "xmlmodule")) return(test_xmlmodule());
Daniel Veillardce244ad2004-11-05 10:03:46 +000048924 if (!strcmp(module, "xmlreader")) return(test_xmlreader());
Daniel Veillarda82b1822004-11-08 16:24:57 +000048925 if (!strcmp(module, "xmlregexp")) return(test_xmlregexp());
Daniel Veillardce244ad2004-11-05 10:03:46 +000048926 if (!strcmp(module, "xmlsave")) return(test_xmlsave());
48927 if (!strcmp(module, "xmlschemas")) return(test_xmlschemas());
48928 if (!strcmp(module, "xmlschemastypes")) return(test_xmlschemastypes());
48929 if (!strcmp(module, "xmlstring")) return(test_xmlstring());
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000048930 if (!strcmp(module, "xmlunicode")) return(test_xmlunicode());
Daniel Veillardce244ad2004-11-05 10:03:46 +000048931 if (!strcmp(module, "xmlwriter")) return(test_xmlwriter());
48932 if (!strcmp(module, "xpath")) return(test_xpath());
Daniel Veillarda82b1822004-11-08 16:24:57 +000048933 if (!strcmp(module, "xpathInternals")) return(test_xpathInternals());
Daniel Veillardce244ad2004-11-05 10:03:46 +000048934 if (!strcmp(module, "xpointer")) return(test_xpointer());
48935 return(0);
48936}