blob: c5773ae46cf6bbf3cb49d2e532e31cdf3fc86132 [file] [log] [blame]
Daniel Veillardd93f6252004-11-02 15:53:51 +00001/*
2 * testapi.c: libxml2 API tester program.
3 *
4 * Automatically generated by gentest.py from libxml2-api.xml
5 *
6 * See Copyright for the status of this software.
7 *
8 * daniel@veillard.com
9 */
10
11#include <stdio.h>
Daniel Veillardce244ad2004-11-05 10:03:46 +000012#include <string.h>
Daniel Veillardd93f6252004-11-02 15:53:51 +000013#include <libxml/xmlerror.h>
Daniel Veillard3d97e662004-11-04 10:49:00 +000014#include <libxml/relaxng.h>
Daniel Veillardd93f6252004-11-02 15:53:51 +000015
16static int testlibxml2(void);
Daniel Veillardce244ad2004-11-05 10:03:46 +000017static int test_module(const char *module);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018
19static int generic_errors = 0;
20static int call_tests = 0;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021static int function_tests = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022
Daniel Veillard5ea30d72004-11-08 11:54:28 +000023static xmlChar chartab[1024];
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000024static int inttab[1024];
25static unsigned long longtab[1024];
Daniel Veillardce244ad2004-11-05 10:03:46 +000026
27static xmlDocPtr api_doc = NULL;
Daniel Veillard27f20102004-11-05 11:50:11 +000028static xmlDtdPtr api_dtd = NULL;
Daniel Veillardce244ad2004-11-05 10:03:46 +000029static xmlNodePtr api_root = NULL;
30static xmlAttrPtr api_attr = NULL;
Daniel Veillard27f20102004-11-05 11:50:11 +000031static xmlNsPtr api_ns = NULL;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032
Daniel Veillardd93f6252004-11-02 15:53:51 +000033static void
34structured_errors(void *userData ATTRIBUTE_UNUSED,
35 xmlErrorPtr error ATTRIBUTE_UNUSED) {
36 generic_errors++;
37}
38
Daniel Veillardce244ad2004-11-05 10:03:46 +000039static void
40free_api_doc(void) {
41 xmlFreeDoc(api_doc);
42 api_doc = NULL;
Daniel Veillard27f20102004-11-05 11:50:11 +000043 api_dtd = NULL;
Daniel Veillardce244ad2004-11-05 10:03:46 +000044 api_root = NULL;
45 api_attr = NULL;
Daniel Veillard27f20102004-11-05 11:50:11 +000046 api_ns = NULL;
Daniel Veillardce244ad2004-11-05 10:03:46 +000047}
48
49static xmlDocPtr
50get_api_doc(void) {
51 if (api_doc == NULL) {
Daniel Veillard27f20102004-11-05 11:50:11 +000052 api_doc = xmlReadMemory("<!DOCTYPE root [<!ELEMENT root EMPTY>]><root xmlns:h='http://example.com/' h:foo='bar'/>", 88, "root_test", NULL, 0);
Daniel Veillardce244ad2004-11-05 10:03:46 +000053 api_root = NULL;
54 api_attr = NULL;
55 }
56 return(api_doc);
57}
58
Daniel Veillard27f20102004-11-05 11:50:11 +000059static xmlDtdPtr
60get_api_dtd(void) {
61 if ((api_dtd == NULL) || (api_dtd->type != XML_DTD_NODE)) {
62 get_api_doc();
63 if ((api_doc != NULL) && (api_doc->children != NULL) &&
64 (api_doc->children->type == XML_DTD_NODE))
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000065 api_dtd = (xmlDtdPtr) api_doc->children;
Daniel Veillard27f20102004-11-05 11:50:11 +000066 }
67 return(api_dtd);
68}
69
Daniel Veillardce244ad2004-11-05 10:03:46 +000070static xmlNodePtr
71get_api_root(void) {
72 if ((api_root == NULL) || (api_root->type != XML_ELEMENT_NODE)) {
73 get_api_doc();
74 if ((api_doc != NULL) && (api_doc->children != NULL) &&
Daniel Veillard27f20102004-11-05 11:50:11 +000075 (api_doc->children->next != NULL) &&
76 (api_doc->children->next->type == XML_ELEMENT_NODE))
77 api_root = api_doc->children->next;
Daniel Veillardce244ad2004-11-05 10:03:46 +000078 }
79 return(api_root);
80}
81
Daniel Veillard27f20102004-11-05 11:50:11 +000082static xmlNsPtr
83get_api_ns(void) {
84 get_api_root();
85 if (api_root != NULL)
86 api_ns = api_root->nsDef;
87 return(api_ns);
88}
89
Daniel Veillardce244ad2004-11-05 10:03:46 +000090static xmlAttrPtr
91get_api_attr(void) {
Daniel Veillardc8311492004-11-08 16:51:13 +000092#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED)
Daniel Veillardce244ad2004-11-05 10:03:46 +000093 static int nr = 0;
94 xmlChar name[20];
Daniel Veillardc8311492004-11-08 16:51:13 +000095#endif
Daniel Veillardce244ad2004-11-05 10:03:46 +000096
97 if ((api_root == NULL) || (api_root->type != XML_ELEMENT_NODE)) {
98 get_api_root();
99 }
100 if (api_root == NULL)
101 return(NULL);
102 if (api_root->properties != NULL) {
103 api_attr = api_root->properties;
104 return(api_root->properties);
105 }
Daniel Veillardc8311492004-11-08 16:51:13 +0000106 api_attr = NULL;
107#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED)
Daniel Veillardce244ad2004-11-05 10:03:46 +0000108 snprintf((char *) name, 20, "foo%d", nr++);
109 api_attr = xmlSetProp(api_root, name, (const xmlChar *) "bar");
Daniel Veillardc8311492004-11-08 16:51:13 +0000110#endif
Daniel Veillardce244ad2004-11-05 10:03:46 +0000111 return(api_attr);
112}
113
Daniel Veillardd0cf7f62004-11-09 16:17:02 +0000114static int quiet = 0;
115
Daniel Veillardce244ad2004-11-05 10:03:46 +0000116int main(int argc, char **argv) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000117 int ret;
118 int blocks, mem;
119
Daniel Veillard5ea30d72004-11-08 11:54:28 +0000120 memset(chartab, 0, sizeof(chartab));
Daniel Veillardc8311492004-11-08 16:51:13 +0000121 strncpy((char *) chartab, " chartab\n", 20);
Daniel Veillard5ea30d72004-11-08 11:54:28 +0000122 memset(inttab, 0, sizeof(inttab));
123 memset(longtab, 0, sizeof(longtab));
124
Daniel Veillarda03e3652004-11-02 18:45:30 +0000125 xmlInitParser();
Daniel Veillard3d97e662004-11-04 10:49:00 +0000126#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillarddd6d3002004-11-03 14:20:29 +0000127 xmlRelaxNGInitTypes();
Daniel Veillard3d97e662004-11-04 10:49:00 +0000128#endif
Daniel Veillarda03e3652004-11-02 18:45:30 +0000129
Daniel Veillardd93f6252004-11-02 15:53:51 +0000130 LIBXML_TEST_VERSION
131
132 xmlSetStructuredErrorFunc(NULL, structured_errors);
133
Daniel Veillardd0cf7f62004-11-09 16:17:02 +0000134 if (argc >= 2) {
135 if (!strcmp(argv[1], "-q")) {
136 quiet = 1;
137 if (argc >= 3)
138 ret = test_module(argv[2]);
139 else
140 ret = testlibxml2();
141 } else {
142 ret = test_module(argv[1]);
143 }
144 } else
Daniel Veillardce244ad2004-11-05 10:03:46 +0000145 ret = testlibxml2();
Daniel Veillardd93f6252004-11-02 15:53:51 +0000146
147 xmlCleanupParser();
148 blocks = xmlMemBlocks();
149 mem = xmlMemUsed();
150 if ((blocks != 0) || (mem != 0)) {
151 printf("testapi leaked %d bytes in %d blocks\n", mem, blocks);
152 }
153 xmlMemoryDump();
154
155 return (ret != 0);
156}
157
158#include <libxml/HTMLparser.h>
159#include <libxml/HTMLtree.h>
Daniel Veillardd93f6252004-11-02 15:53:51 +0000160#include <libxml/catalog.h>
161#include <libxml/chvalid.h>
162#include <libxml/dict.h>
163#include <libxml/encoding.h>
164#include <libxml/entities.h>
165#include <libxml/hash.h>
166#include <libxml/list.h>
167#include <libxml/nanoftp.h>
168#include <libxml/nanohttp.h>
169#include <libxml/parser.h>
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +0000170#include <libxml/parserInternals.h>
Daniel Veillardd93f6252004-11-02 15:53:51 +0000171#include <libxml/pattern.h>
172#include <libxml/relaxng.h>
173#include <libxml/schemasInternals.h>
174#include <libxml/tree.h>
175#include <libxml/uri.h>
176#include <libxml/valid.h>
177#include <libxml/xinclude.h>
178#include <libxml/xmlIO.h>
Daniel Veillardd93f6252004-11-02 15:53:51 +0000179#include <libxml/xmlerror.h>
Daniel Veillardd93f6252004-11-02 15:53:51 +0000180#include <libxml/xmlreader.h>
Daniel Veillardd93f6252004-11-02 15:53:51 +0000181#include <libxml/xmlsave.h>
182#include <libxml/xmlschemas.h>
183#include <libxml/xmlschemastypes.h>
184#include <libxml/xmlstring.h>
185#include <libxml/xmlwriter.h>
186#include <libxml/xpath.h>
187#include <libxml/xpointer.h>
Daniel Veillarda521d282004-11-09 14:59:59 +0000188#include <libxml/debugXML.h>
Daniel Veillardd93f6252004-11-02 15:53:51 +0000189
William M. Brackf13f77f2004-11-12 16:03:48 +0000190/*
191 We manually define xmlErrMemory because it's normal declaration
192 is "hidden" by #ifdef IN_LIBXML
193*/
194void xmlErrMemory(xmlParserCtxtPtr ctxt, const char *extra);
195
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000196#define gen_nb_void_ptr 2
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +0000197
Daniel Veillard3d97e662004-11-04 10:49:00 +0000198static void *gen_void_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +0000199 return(NULL);
200}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000201static void des_void_ptr(int no ATTRIBUTE_UNUSED, void *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +0000202}
203
Daniel Veillardce244ad2004-11-05 10:03:46 +0000204#if 0
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000205#define gen_nb_const_void_ptr 2
206
207static const void *gen_const_void_ptr(int no, int nr ATTRIBUTE_UNUSED) {
208 if (no == 0) return((const void *) "immutable string");
209 return(NULL);
210}
211static void des_const_void_ptr(int no ATTRIBUTE_UNUSED, const void *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
212}
Daniel Veillardce244ad2004-11-05 10:03:46 +0000213#endif
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000214
Daniel Veillard8a32fe42004-11-02 22:10:16 +0000215#define gen_nb_userdata 3
216
Daniel Veillard3d97e662004-11-04 10:49:00 +0000217static void *gen_userdata(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillard8a32fe42004-11-02 22:10:16 +0000218 if (no == 0) return((void *) &call_tests);
219 if (no == 1) return((void *) -1);
220 return(NULL);
221}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000222static void des_userdata(int no ATTRIBUTE_UNUSED, void *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillard8a32fe42004-11-02 22:10:16 +0000223}
224
225
Daniel Veillardd93f6252004-11-02 15:53:51 +0000226#define gen_nb_int 4
227
Daniel Veillard3d97e662004-11-04 10:49:00 +0000228static int gen_int(int no, int nr ATTRIBUTE_UNUSED) {
229 if (no == 0) return(0);
230 if (no == 1) return(1);
Daniel Veillardc2c894f2004-11-07 12:17:35 +0000231 if (no == 2) return(-1);
232 if (no == 3) return(122);
Daniel Veillard3d97e662004-11-04 10:49:00 +0000233 return(-1);
234}
235
236static void des_int(int no ATTRIBUTE_UNUSED, int val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
237}
238
Daniel Veillard6128c012004-11-08 17:16:15 +0000239#define gen_nb_parseroptions 5
240
241static int gen_parseroptions(int no, int nr ATTRIBUTE_UNUSED) {
242 if (no == 0) return(XML_PARSE_NOBLANKS | XML_PARSE_RECOVER);
243 if (no == 1) return(XML_PARSE_NOENT | XML_PARSE_DTDLOAD | XML_PARSE_DTDATTR | XML_PARSE_DTDVALID | XML_PARSE_NOCDATA);
244 if (no == 2) return(XML_PARSE_XINCLUDE | XML_PARSE_NOXINCNODE | XML_PARSE_NSCLEAN);
245 if (no == 3) return(XML_PARSE_XINCLUDE | XML_PARSE_NODICT);
246 return(XML_PARSE_SAX1);
247}
248
249static void des_parseroptions(int no ATTRIBUTE_UNUSED, int val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
250}
251
Daniel Veillardce244ad2004-11-05 10:03:46 +0000252#if 0
Daniel Veillardf2a36f92004-11-08 17:55:01 +0000253#define gen_nb_long 5
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000254
255static long gen_long(int no, int nr ATTRIBUTE_UNUSED) {
256 if (no == 0) return(0);
257 if (no == 1) return(1);
Daniel Veillardc2c894f2004-11-07 12:17:35 +0000258 if (no == 2) return(-1);
259 if (no == 3) return(122);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000260 return(-1);
261}
262
263static void des_long(int no ATTRIBUTE_UNUSED, long val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
264}
Daniel Veillardce244ad2004-11-05 10:03:46 +0000265#endif
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000266
Daniel Veillardf2a36f92004-11-08 17:55:01 +0000267#define gen_nb_xmlChar 4
268
269static xmlChar gen_xmlChar(int no, int nr ATTRIBUTE_UNUSED) {
270 if (no == 0) return('a');
271 if (no == 1) return(' ');
272 if (no == 2) return('ø');
273 return(0);
274}
275
276static void des_xmlChar(int no ATTRIBUTE_UNUSED, xmlChar val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
277}
278
Daniel Veillard3d97e662004-11-04 10:49:00 +0000279#define gen_nb_unsigned_int 3
280
281static unsigned int gen_unsigned_int(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000282 if (no == 0) return(0);
283 if (no == 1) return(1);
284 if (no == 2) return(122);
285 return(-1);
286}
287
Daniel Veillard3d97e662004-11-04 10:49:00 +0000288static void des_unsigned_int(int no ATTRIBUTE_UNUSED, unsigned int val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000289}
290
Daniel Veillard3d95c732004-11-06 22:25:14 +0000291#define gen_nb_unsigned_long 4
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000292
293static unsigned long gen_unsigned_long(int no, int nr ATTRIBUTE_UNUSED) {
294 if (no == 0) return(0);
295 if (no == 1) return(1);
296 if (no == 2) return(122);
297 return(-1);
298}
299
300static void des_unsigned_long(int no ATTRIBUTE_UNUSED, unsigned long val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
301}
302
Daniel Veillard3d95c732004-11-06 22:25:14 +0000303#define gen_nb_double 4
304
305static double gen_double(int no, int nr ATTRIBUTE_UNUSED) {
306 if (no == 0) return(0);
307 if (no == 1) return(-1.1);
Daniel Veillardd0cf7f62004-11-09 16:17:02 +0000308#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard3d95c732004-11-06 22:25:14 +0000309 if (no == 2) return(xmlXPathNAN);
Daniel Veillardc8311492004-11-08 16:51:13 +0000310#endif
Daniel Veillard3d95c732004-11-06 22:25:14 +0000311 return(-1);
312}
313
314static void des_double(int no ATTRIBUTE_UNUSED, double val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
315}
316
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000317#define gen_nb_unsigned_long_ptr 2
318
319static unsigned long *gen_unsigned_long_ptr(int no, int nr) {
320 if (no == 0) return(&longtab[nr]);
321 return(NULL);
322}
323
324static void des_unsigned_long_ptr(int no ATTRIBUTE_UNUSED, unsigned long *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
325}
326
327#define gen_nb_int_ptr 2
328
329static int *gen_int_ptr(int no, int nr) {
330 if (no == 0) return(&inttab[nr]);
331 return(NULL);
332}
333
334static void des_int_ptr(int no ATTRIBUTE_UNUSED, int *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
335}
336
Daniel Veillardd93f6252004-11-02 15:53:51 +0000337#define gen_nb_const_char_ptr 4
338
Daniel Veillardce682bc2004-11-05 17:22:25 +0000339static char *gen_const_char_ptr(int no, int nr ATTRIBUTE_UNUSED) {
340 if (no == 0) return((char *) "foo");
341 if (no == 1) return((char *) "<foo/>");
342 if (no == 2) return((char *) "test/ent2");
Daniel Veillardd93f6252004-11-02 15:53:51 +0000343 return(NULL);
344}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000345static void des_const_char_ptr(int no ATTRIBUTE_UNUSED, const char *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000346}
347
Daniel Veillard8a32fe42004-11-02 22:10:16 +0000348#define gen_nb_xmlChar_ptr 2
349
Daniel Veillard3d97e662004-11-04 10:49:00 +0000350static xmlChar *gen_xmlChar_ptr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000351 if (no == 0) return(&chartab[0]);
Daniel Veillard8a32fe42004-11-02 22:10:16 +0000352 return(NULL);
353}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000354static void des_xmlChar_ptr(int no ATTRIBUTE_UNUSED, xmlChar *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillard8a32fe42004-11-02 22:10:16 +0000355}
356
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000357#define gen_nb_FILE_ptr 2
358
359static FILE *gen_FILE_ptr(int no, int nr ATTRIBUTE_UNUSED) {
360 if (no == 0) return(fopen("test.out", "a+"));
361 return(NULL);
362}
363static void des_FILE_ptr(int no ATTRIBUTE_UNUSED, FILE *val, int nr ATTRIBUTE_UNUSED) {
364 if (val != NULL) fclose(val);
365}
366
Daniel Veillarda82b1822004-11-08 16:24:57 +0000367#define gen_nb_debug_FILE_ptr 2
368static FILE *gen_debug_FILE_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
369 return(fopen("test.out", "a+"));
370}
371static void des_debug_FILE_ptr(int no ATTRIBUTE_UNUSED, FILE *val, int nr ATTRIBUTE_UNUSED) {
372 if (val != NULL) fclose(val);
373}
374
Daniel Veillardd93f6252004-11-02 15:53:51 +0000375#define gen_nb_const_xmlChar_ptr 5
376
Daniel Veillardce682bc2004-11-05 17:22:25 +0000377static xmlChar *gen_const_xmlChar_ptr(int no, int nr ATTRIBUTE_UNUSED) {
378 if (no == 0) return((xmlChar *) "foo");
379 if (no == 1) return((xmlChar *) "<foo/>");
380 if (no == 2) return((xmlChar *) "nøne");
381 if (no == 3) return((xmlChar *) " 2ab ");
Daniel Veillardd93f6252004-11-02 15:53:51 +0000382 return(NULL);
383}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000384static void des_const_xmlChar_ptr(int no ATTRIBUTE_UNUSED, const xmlChar *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000385}
386
387#define gen_nb_filepath 8
388
Daniel Veillard3d97e662004-11-04 10:49:00 +0000389static const char *gen_filepath(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000390 if (no == 0) return("missing.xml");
391 if (no == 1) return("<foo/>");
392 if (no == 2) return("test/ent2");
393 if (no == 3) return("test/valid/REC-xml-19980210.xml");
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000394 if (no == 4) return("test/valid/dtds/xhtml1-strict.dtd");
Daniel Veillardd93f6252004-11-02 15:53:51 +0000395 if (no == 5) return("http://missing.example.org/");
396 if (no == 6) return("http://missing. example.org/");
397 return(NULL);
398}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000399static void des_filepath(int no ATTRIBUTE_UNUSED, const char *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000400}
401
Daniel Veillard27f20102004-11-05 11:50:11 +0000402#define gen_nb_eaten_name 2
403
404static xmlChar *gen_eaten_name(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +0000405 if (no == 0) return(xmlStrdup(BAD_CAST "eaten"));
Daniel Veillard27f20102004-11-05 11:50:11 +0000406 return(NULL);
407}
408static void des_eaten_name(int no ATTRIBUTE_UNUSED, xmlChar *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
409}
410
Daniel Veillardd93f6252004-11-02 15:53:51 +0000411#define gen_nb_fileoutput 6
412
Daniel Veillard3d97e662004-11-04 10:49:00 +0000413static const char *gen_fileoutput(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000414 if (no == 0) return("/missing.xml");
415 if (no == 1) return("<foo/>");
416 if (no == 2) return("ftp://missing.example.org/foo");
417 if (no == 3) return("http://missing.example.org/");
418 if (no == 4) return("http://missing. example.org/");
419 return(NULL);
420}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000421static void des_fileoutput(int no ATTRIBUTE_UNUSED, const char *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000422}
423
Daniel Veillarda521d282004-11-09 14:59:59 +0000424#define gen_nb_xmlParserCtxtPtr 3
Daniel Veillard3d97e662004-11-04 10:49:00 +0000425static xmlParserCtxtPtr gen_xmlParserCtxtPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000426 if (no == 0) return(xmlNewParserCtxt());
Daniel Veillarda521d282004-11-09 14:59:59 +0000427 if (no == 1) return(xmlCreateMemoryParserCtxt("<doc/>", 6));
Daniel Veillardd93f6252004-11-02 15:53:51 +0000428 return(NULL);
429}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000430static void des_xmlParserCtxtPtr(int no ATTRIBUTE_UNUSED, xmlParserCtxtPtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000431 if (val != NULL)
432 xmlFreeParserCtxt(val);
433}
434
Daniel Veillard34099b42004-11-04 17:34:35 +0000435#define gen_nb_xmlSAXHandlerPtr 2
436static xmlSAXHandlerPtr gen_xmlSAXHandlerPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillarda521d282004-11-09 14:59:59 +0000437#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +0000438 if (no == 0) return((xmlSAXHandlerPtr) &xmlDefaultSAXHandler);
Daniel Veillarda521d282004-11-09 14:59:59 +0000439#endif
Daniel Veillard34099b42004-11-04 17:34:35 +0000440 return(NULL);
441}
442static void des_xmlSAXHandlerPtr(int no ATTRIBUTE_UNUSED, xmlSAXHandlerPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
443}
444
Daniel Veillardc0be74b2004-11-03 19:16:55 +0000445#define gen_nb_xmlValidCtxtPtr 2
Daniel Veillard3d97e662004-11-04 10:49:00 +0000446static xmlValidCtxtPtr gen_xmlValidCtxtPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillarda521d282004-11-09 14:59:59 +0000447#ifdef LIBXML_VALID_ENABLED
Daniel Veillardc0be74b2004-11-03 19:16:55 +0000448 if (no == 0) return(xmlNewValidCtxt());
Daniel Veillarda521d282004-11-09 14:59:59 +0000449#endif
Daniel Veillardc0be74b2004-11-03 19:16:55 +0000450 return(NULL);
451}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000452static void des_xmlValidCtxtPtr(int no ATTRIBUTE_UNUSED, xmlValidCtxtPtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillarda521d282004-11-09 14:59:59 +0000453#ifdef LIBXML_VALID_ENABLED
Daniel Veillardc0be74b2004-11-03 19:16:55 +0000454 if (val != NULL)
455 xmlFreeValidCtxt(val);
Daniel Veillarda521d282004-11-09 14:59:59 +0000456#endif
Daniel Veillardc0be74b2004-11-03 19:16:55 +0000457}
458
Daniel Veillard34099b42004-11-04 17:34:35 +0000459#define gen_nb_xmlParserInputBufferPtr 8
460
461static xmlParserInputBufferPtr gen_xmlParserInputBufferPtr(int no, int nr ATTRIBUTE_UNUSED) {
462 if (no == 0) return(xmlParserInputBufferCreateFilename("missing.xml", XML_CHAR_ENCODING_NONE));
463 if (no == 1) return(xmlParserInputBufferCreateFilename("<foo/>", XML_CHAR_ENCODING_NONE));
464 if (no == 2) return(xmlParserInputBufferCreateFilename("test/ent2", XML_CHAR_ENCODING_NONE));
465 if (no == 3) return(xmlParserInputBufferCreateFilename("test/valid/REC-xml-19980210.xml", XML_CHAR_ENCODING_NONE));
466 if (no == 4) return(xmlParserInputBufferCreateFilename("test/valid/dtds/xhtml1-strict.dtd", XML_CHAR_ENCODING_NONE));
467 if (no == 5) return(xmlParserInputBufferCreateFilename("http://missing.example.org/", XML_CHAR_ENCODING_NONE));
468 if (no == 6) return(xmlParserInputBufferCreateFilename("http://missing. example.org/", XML_CHAR_ENCODING_NONE));
469 return(NULL);
470}
471static void des_xmlParserInputBufferPtr(int no ATTRIBUTE_UNUSED, xmlParserInputBufferPtr val, int nr ATTRIBUTE_UNUSED) {
472 xmlFreeParserInputBuffer(val);
473}
474
Daniel Veillardd93f6252004-11-02 15:53:51 +0000475#define gen_nb_xmlDocPtr 3
Daniel Veillard3d97e662004-11-04 10:49:00 +0000476static xmlDocPtr gen_xmlDocPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000477 if (no == 0) return(xmlNewDoc(BAD_CAST "1.0"));
478 if (no == 1) return(xmlReadMemory("<foo/>", 6, "test", NULL, 0));
479 return(NULL);
480}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000481static void des_xmlDocPtr(int no ATTRIBUTE_UNUSED, xmlDocPtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardce244ad2004-11-05 10:03:46 +0000482 if ((val != NULL) && (val != api_doc) && (val->doc != api_doc))
Daniel Veillardd93f6252004-11-02 15:53:51 +0000483 xmlFreeDoc(val);
484}
485
Daniel Veillardce244ad2004-11-05 10:03:46 +0000486#define gen_nb_xmlAttrPtr 2
487static xmlAttrPtr gen_xmlAttrPtr(int no, int nr ATTRIBUTE_UNUSED) {
488 if (no == 0) return(get_api_attr());
489 return(NULL);
490}
491static void des_xmlAttrPtr(int no, xmlAttrPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
492 if (no == 0) free_api_doc();
493}
494
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000495#define gen_nb_xmlDictPtr 2
496static xmlDictPtr gen_xmlDictPtr(int no, int nr ATTRIBUTE_UNUSED) {
497 if (no == 0) return(xmlDictCreate());
498 return(NULL);
499}
500static void des_xmlDictPtr(int no ATTRIBUTE_UNUSED, xmlDictPtr val, int nr ATTRIBUTE_UNUSED) {
501 if (val != NULL)
502 xmlDictFree(val);
503}
504
Daniel Veillardce244ad2004-11-05 10:03:46 +0000505#define gen_nb_xmlNodePtr 3
Daniel Veillard3d97e662004-11-04 10:49:00 +0000506static xmlNodePtr gen_xmlNodePtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000507 if (no == 0) return(xmlNewPI(BAD_CAST "test", NULL));
Daniel Veillardce244ad2004-11-05 10:03:46 +0000508 if (no == 1) return(get_api_root());
Daniel Veillardd93f6252004-11-02 15:53:51 +0000509 return(NULL);
Daniel Veillardce244ad2004-11-05 10:03:46 +0000510/* if (no == 2) return((xmlNodePtr) get_api_doc()); */
Daniel Veillardd93f6252004-11-02 15:53:51 +0000511}
Daniel Veillard27f20102004-11-05 11:50:11 +0000512static void des_xmlNodePtr(int no, xmlNodePtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardce244ad2004-11-05 10:03:46 +0000513 if (no == 1) free_api_doc();
514 else if (val != NULL) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000515 xmlUnlinkNode(val);
516 xmlFreeNode(val);
517 }
518}
519
Daniel Veillard27f20102004-11-05 11:50:11 +0000520#define gen_nb_xmlDtdPtr 3
521static xmlDtdPtr gen_xmlDtdPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +0000522 if (no == 0)
523 return(xmlNewDtd(NULL, BAD_CAST "dtd", BAD_CAST"foo", BAD_CAST"bar"));
Daniel Veillard27f20102004-11-05 11:50:11 +0000524 if (no == 1) return(get_api_dtd());
525 return(NULL);
526}
527static void des_xmlDtdPtr(int no, xmlDtdPtr val, int nr ATTRIBUTE_UNUSED) {
528 if (no == 1) free_api_doc();
529 else if (val != NULL) {
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +0000530 xmlUnlinkNode((xmlNodePtr) val);
531 xmlFreeNode((xmlNodePtr) val);
Daniel Veillard27f20102004-11-05 11:50:11 +0000532 }
533}
534
535#define gen_nb_xmlNsPtr 2
536static xmlNsPtr gen_xmlNsPtr(int no, int nr ATTRIBUTE_UNUSED) {
537 if (no == 0) return(get_api_ns());
538 return(NULL);
539}
540static void des_xmlNsPtr(int no, xmlNsPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
541 if (no == 0) free_api_doc();
542}
543
Daniel Veillardd93f6252004-11-02 15:53:51 +0000544#define gen_nb_xmlNodePtr_in 3
Daniel Veillard3d97e662004-11-04 10:49:00 +0000545static xmlNodePtr gen_xmlNodePtr_in(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000546 if (no == 0) return(xmlNewPI(BAD_CAST "test", NULL));
547 if (no == 0) return(xmlNewText(BAD_CAST "text"));
548 return(NULL);
549}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000550static void des_xmlNodePtr_in(int no ATTRIBUTE_UNUSED, xmlNodePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000551}
552
Daniel Veillardc8311492004-11-08 16:51:13 +0000553#ifdef LIBXML_WRITER_ENABLED
Daniel Veillarde43cc572004-11-03 11:50:29 +0000554#define gen_nb_xmlTextWriterPtr 2
Daniel Veillard3d97e662004-11-04 10:49:00 +0000555static xmlTextWriterPtr gen_xmlTextWriterPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillarde43cc572004-11-03 11:50:29 +0000556 if (no == 0) return(xmlNewTextWriterFilename("test.out", 0));
557 return(NULL);
558}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000559static void des_xmlTextWriterPtr(int no ATTRIBUTE_UNUSED, xmlTextWriterPtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillarde43cc572004-11-03 11:50:29 +0000560 if (val != NULL) xmlFreeTextWriter(val);
561}
Daniel Veillardc8311492004-11-08 16:51:13 +0000562#endif
Daniel Veillarde43cc572004-11-03 11:50:29 +0000563
Daniel Veillardc8311492004-11-08 16:51:13 +0000564#ifdef LIBXML_READER_ENABLED
Daniel Veillarddd6d3002004-11-03 14:20:29 +0000565#define gen_nb_xmlTextReaderPtr 4
Daniel Veillard3d97e662004-11-04 10:49:00 +0000566static xmlTextReaderPtr gen_xmlTextReaderPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillarddd6d3002004-11-03 14:20:29 +0000567 if (no == 0) return(xmlNewTextReaderFilename("test/ent2"));
568 if (no == 1) return(xmlNewTextReaderFilename("test/valid/REC-xml-19980210.xml"));
569 if (no == 2) return(xmlNewTextReaderFilename("test/valid/dtds/xhtml1-strict.dtd"));
570 return(NULL);
571}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000572static void des_xmlTextReaderPtr(int no ATTRIBUTE_UNUSED, xmlTextReaderPtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillarddd6d3002004-11-03 14:20:29 +0000573 if (val != NULL) xmlFreeTextReader(val);
574}
Daniel Veillardc8311492004-11-08 16:51:13 +0000575#endif
Daniel Veillarddd6d3002004-11-03 14:20:29 +0000576
Daniel Veillard34099b42004-11-04 17:34:35 +0000577#define gen_nb_xmlBufferPtr 3
Daniel Veillard3d97e662004-11-04 10:49:00 +0000578static xmlBufferPtr gen_xmlBufferPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000579 if (no == 0) return(xmlBufferCreate());
Daniel Veillardce244ad2004-11-05 10:03:46 +0000580 if (no == 1) return(xmlBufferCreateStatic((void *)"a static buffer", 13));
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000581 return(NULL);
582}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000583static void des_xmlBufferPtr(int no ATTRIBUTE_UNUSED, xmlBufferPtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000584 if (val != NULL) {
585 xmlBufferFree(val);
586 }
587}
588
589#define gen_nb_xmlListPtr 2
Daniel Veillard3d97e662004-11-04 10:49:00 +0000590static xmlListPtr gen_xmlListPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000591 if (no == 0) return(xmlListCreate(NULL, NULL));
592 return(NULL);
593}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000594static void des_xmlListPtr(int no ATTRIBUTE_UNUSED, xmlListPtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000595 if (val != NULL) {
596 xmlListDelete(val);
597 }
598}
599
600#define gen_nb_xmlHashTablePtr 2
Daniel Veillard3d97e662004-11-04 10:49:00 +0000601static xmlHashTablePtr gen_xmlHashTablePtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000602 if (no == 0) return(xmlHashCreate(10));
603 return(NULL);
604}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000605static void des_xmlHashTablePtr(int no ATTRIBUTE_UNUSED, xmlHashTablePtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000606 if (val != NULL) {
607 xmlHashFree(val, NULL);
608 }
609}
610
611#include <libxml/xpathInternals.h>
612
Daniel Veillardc8311492004-11-08 16:51:13 +0000613#ifdef LIBXML_XPATH_ENABLED
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000614#define gen_nb_xmlXPathObjectPtr 5
Daniel Veillard3d97e662004-11-04 10:49:00 +0000615static xmlXPathObjectPtr gen_xmlXPathObjectPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000616 if (no == 0) return(xmlXPathNewString(BAD_CAST "string object"));
617 if (no == 1) return(xmlXPathNewFloat(1.1));
618 if (no == 2) return(xmlXPathNewBoolean(1));
619 if (no == 3) return(xmlXPathNewNodeSet(NULL));
620 return(NULL);
621}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000622static void des_xmlXPathObjectPtr(int no ATTRIBUTE_UNUSED, xmlXPathObjectPtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000623 if (val != NULL) {
624 xmlXPathFreeObject(val);
625 }
626}
Daniel Veillardc8311492004-11-08 16:51:13 +0000627#endif
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000628
Daniel Veillardc8311492004-11-08 16:51:13 +0000629#ifdef LIBXML_OUTPUT_ENABLED
Daniel Veillard3d97e662004-11-04 10:49:00 +0000630#define gen_nb_xmlOutputBufferPtr 2
631static xmlOutputBufferPtr gen_xmlOutputBufferPtr(int no, int nr ATTRIBUTE_UNUSED) {
632 if (no == 0) return(xmlOutputBufferCreateFilename("test.out", NULL, 0));
633 return(NULL);
634}
635static void des_xmlOutputBufferPtr(int no ATTRIBUTE_UNUSED, xmlOutputBufferPtr val, int nr ATTRIBUTE_UNUSED) {
636 if (val != NULL) {
637 xmlOutputBufferClose(val);
638 }
639}
Daniel Veillardc8311492004-11-08 16:51:13 +0000640#endif
Daniel Veillard3d97e662004-11-04 10:49:00 +0000641
Daniel Veillardc8311492004-11-08 16:51:13 +0000642#ifdef LIBXML_FTP_ENABLED
Daniel Veillard27f20102004-11-05 11:50:11 +0000643#define gen_nb_xmlNanoFTPCtxtPtr 4
644static void *gen_xmlNanoFTPCtxtPtr(int no, int nr ATTRIBUTE_UNUSED) {
645 if (no == 0) return(xmlNanoFTPNewCtxt("ftp://example.com/"));
646 if (no == 1) return(xmlNanoFTPNewCtxt("http://example.com/"));
647 if (no == 2) return(xmlNanoFTPNewCtxt("foo"));
648 return(NULL);
649}
650static void des_xmlNanoFTPCtxtPtr(int no ATTRIBUTE_UNUSED, void *val, int nr ATTRIBUTE_UNUSED) {
651 if (val != NULL) {
652 xmlNanoFTPFreeCtxt(val);
653 }
654}
Daniel Veillardc8311492004-11-08 16:51:13 +0000655#endif
Daniel Veillard27f20102004-11-05 11:50:11 +0000656
Daniel Veillardc8311492004-11-08 16:51:13 +0000657#ifdef LIBXML_HTTP_ENABLED
Daniel Veillard27f20102004-11-05 11:50:11 +0000658#define gen_nb_xmlNanoHTTPCtxtPtr 1
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +0000659static void *gen_xmlNanoHTTPCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillard27f20102004-11-05 11:50:11 +0000660 return(NULL);
661}
662static void des_xmlNanoHTTPCtxtPtr(int no ATTRIBUTE_UNUSED, void *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
663}
Daniel Veillardc8311492004-11-08 16:51:13 +0000664#endif
Daniel Veillard27f20102004-11-05 11:50:11 +0000665
Daniel Veillard3d97e662004-11-04 10:49:00 +0000666#define gen_nb_xmlCharEncoding 4
667static xmlCharEncoding gen_xmlCharEncoding(int no, int nr ATTRIBUTE_UNUSED) {
668 if (no == 0) return(XML_CHAR_ENCODING_UTF8);
669 if (no == 1) return(XML_CHAR_ENCODING_NONE);
670 if (no == 0) return(XML_CHAR_ENCODING_8859_1);
671 return(XML_CHAR_ENCODING_ERROR);
672}
673static void des_xmlCharEncoding(int no ATTRIBUTE_UNUSED, xmlCharEncoding val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
674}
675
Daniel Veillard42595322004-11-08 10:52:06 +0000676#define gen_nb_xmlHashDeallocator 2
677static void
678test_xmlHashDeallocator(void *payload ATTRIBUTE_UNUSED, xmlChar *name ATTRIBUTE_UNUSED) {
679}
680
681static xmlHashDeallocator gen_xmlHashDeallocator(int no, int nr ATTRIBUTE_UNUSED) {
682 if (no == 0) return(test_xmlHashDeallocator);
683 return(NULL);
684}
685static void des_xmlHashDeallocator(int no ATTRIBUTE_UNUSED, xmlHashDeallocator val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
686}
687
Daniel Veillardd93f6252004-11-02 15:53:51 +0000688
689static void desret_int(int val ATTRIBUTE_UNUSED) {
690}
Daniel Veillardf2a36f92004-11-08 17:55:01 +0000691static void desret_xmlChar(xmlChar val ATTRIBUTE_UNUSED) {
692}
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000693static void desret_long(long val ATTRIBUTE_UNUSED) {
694}
William M. Brack094dd862004-11-14 14:28:34 +0000695static void desret_unsigned_long(unsigned long val ATTRIBUTE_UNUSED) {
696}
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000697static void desret_double(double val ATTRIBUTE_UNUSED) {
698}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000699static void desret_xmlCharEncoding(xmlCharEncoding val ATTRIBUTE_UNUSED) {
700}
Daniel Veillardce244ad2004-11-05 10:03:46 +0000701#if 0
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000702static void desret_const_void_ptr(void *val ATTRIBUTE_UNUSED) {
703}
Daniel Veillardce244ad2004-11-05 10:03:46 +0000704#endif
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +0000705static void desret_void_ptr(void *val ATTRIBUTE_UNUSED) {
706}
Daniel Veillardd93f6252004-11-02 15:53:51 +0000707static void desret_const_char_ptr(const char *val ATTRIBUTE_UNUSED) {
708}
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000709static void desret_const_xmlChar_ptr(const xmlChar *val ATTRIBUTE_UNUSED) {
710}
Daniel Veillard8a32fe42004-11-02 22:10:16 +0000711static void desret_xmlChar_ptr(xmlChar *val) {
712 if (val != NULL)
713 xmlFree(val);
714}
Daniel Veillardd93f6252004-11-02 15:53:51 +0000715static void desret_xmlDocPtr(xmlDocPtr val) {
Daniel Veillardce244ad2004-11-05 10:03:46 +0000716 if (val != api_doc)
717 xmlFreeDoc(val);
Daniel Veillardd93f6252004-11-02 15:53:51 +0000718}
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000719static void desret_xmlDictPtr(xmlDictPtr val) {
720 xmlDictFree(val);
721}
Daniel Veillardc8311492004-11-08 16:51:13 +0000722#ifdef LIBXML_OUTPUT_ENABLED
Daniel Veillard3d95c732004-11-06 22:25:14 +0000723static void desret_xmlOutputBufferPtr(xmlOutputBufferPtr val) {
724 xmlOutputBufferClose(val);
725}
Daniel Veillardc8311492004-11-08 16:51:13 +0000726#endif
727#ifdef LIBXML_READER_ENABLED
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000728static void desret_xmlTextReaderPtr(xmlTextReaderPtr val) {
729 xmlFreeTextReader(val);
730}
Daniel Veillardc8311492004-11-08 16:51:13 +0000731#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +0000732static void desret_xmlNodePtr(xmlNodePtr val) {
Daniel Veillardce244ad2004-11-05 10:03:46 +0000733 if ((val != NULL) && (val != api_root) && (val != (xmlNodePtr) api_doc)) {
734 xmlUnlinkNode(val);
735 xmlFreeNode(val);
736 }
Daniel Veillardd93f6252004-11-02 15:53:51 +0000737}
Daniel Veillard57b25162004-11-06 14:50:18 +0000738static void desret_xmlAttrPtr(xmlAttrPtr val) {
739 if (val != NULL) {
740 xmlUnlinkNode((xmlNodePtr) val);
741 xmlFreeNode((xmlNodePtr) val);
742 }
743}
Daniel Veillardd5cc0f72004-11-06 19:24:28 +0000744static void desret_xmlEntityPtr(xmlEntityPtr val) {
745 if (val != NULL) {
746 xmlUnlinkNode((xmlNodePtr) val);
747 xmlFreeNode((xmlNodePtr) val);
748 }
749}
Daniel Veillard42595322004-11-08 10:52:06 +0000750static void desret_xmlElementPtr(xmlElementPtr val) {
751 if (val != NULL) {
752 xmlUnlinkNode((xmlNodePtr) val);
753 }
754}
755static void desret_xmlAttributePtr(xmlAttributePtr val) {
756 if (val != NULL) {
757 xmlUnlinkNode((xmlNodePtr) val);
758 }
759}
Daniel Veillardd5cc0f72004-11-06 19:24:28 +0000760static void desret_xmlNsPtr(xmlNsPtr val ATTRIBUTE_UNUSED) {
761}
Daniel Veillard34099b42004-11-04 17:34:35 +0000762static void desret_xmlDtdPtr(xmlDtdPtr val) {
763 desret_xmlNodePtr((xmlNodePtr)val);
764}
Daniel Veillardc8311492004-11-08 16:51:13 +0000765#ifdef LIBXML_XPATH_ENABLED
Daniel Veillard3d97e662004-11-04 10:49:00 +0000766static void desret_xmlXPathObjectPtr(xmlXPathObjectPtr val) {
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000767 xmlXPathFreeObject(val);
Daniel Veillard3d97e662004-11-04 10:49:00 +0000768}
Daniel Veillardf2a36f92004-11-08 17:55:01 +0000769static void desret_xmlNodeSetPtr(xmlNodeSetPtr val) {
770 xmlXPathFreeNodeSet(val);
771}
Daniel Veillardc8311492004-11-08 16:51:13 +0000772#endif
Daniel Veillard34099b42004-11-04 17:34:35 +0000773static void desret_xmlParserCtxtPtr(xmlParserCtxtPtr val) {
774 xmlFreeParserCtxt(val);
775}
Daniel Veillardd5cc0f72004-11-06 19:24:28 +0000776static void desret_xmlParserInputBufferPtr(xmlParserInputBufferPtr val) {
777 xmlFreeParserInputBuffer(val);
778}
Daniel Veillard42595322004-11-08 10:52:06 +0000779static void desret_xmlParserInputPtr(xmlParserInputPtr val) {
780 xmlFreeInputStream(val);
781}
Daniel Veillardc8311492004-11-08 16:51:13 +0000782#ifdef LIBXML_WRITER_ENABLED
Daniel Veillardd5cc0f72004-11-06 19:24:28 +0000783static void desret_xmlTextWriterPtr(xmlTextWriterPtr val) {
784 xmlFreeTextWriter(val);
785}
Daniel Veillardc8311492004-11-08 16:51:13 +0000786#endif
Daniel Veillard3d95c732004-11-06 22:25:14 +0000787static void desret_xmlBufferPtr(xmlBufferPtr val) {
788 xmlBufferFree(val);
789}
Daniel Veillardc8311492004-11-08 16:51:13 +0000790#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillard42595322004-11-08 10:52:06 +0000791static void desret_xmlSchemaParserCtxtPtr(xmlSchemaParserCtxtPtr val) {
792 xmlSchemaFreeParserCtxt(val);
793}
794static void desret_xmlSchemaTypePtr(xmlSchemaTypePtr val ATTRIBUTE_UNUSED) {
795}
796static void desret_xmlRelaxNGParserCtxtPtr(xmlRelaxNGParserCtxtPtr val) {
797 xmlRelaxNGFreeParserCtxt(val);
798}
Daniel Veillardc8311492004-11-08 16:51:13 +0000799#endif
800#ifdef LIBXML_HTML_ENABLED
William M. Brackf13f77f2004-11-12 16:03:48 +0000801static void desret_const_htmlEntityDesc_ptr(const htmlEntityDesc * val ATTRIBUTE_UNUSED) {
Daniel Veillard42595322004-11-08 10:52:06 +0000802}
Daniel Veillardc8311492004-11-08 16:51:13 +0000803#endif
Daniel Veillardd5cc0f72004-11-06 19:24:28 +0000804
Daniel Veillarda521d282004-11-09 14:59:59 +0000805/* cut and pasted from autogenerated to avoid troubles */
806#define gen_nb_const_xmlChar_ptr_ptr 1
807static xmlChar ** gen_const_xmlChar_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
808 return(NULL);
809}
810static void des_const_xmlChar_ptr_ptr(int no ATTRIBUTE_UNUSED, const xmlChar ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
811}
812
813#define gen_nb_unsigned_char_ptr 1
814static unsigned char * gen_unsigned_char_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
815 return(NULL);
816}
817static void des_unsigned_char_ptr(int no ATTRIBUTE_UNUSED, unsigned char * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
818}
819
820#define gen_nb_const_unsigned_char_ptr 1
821static unsigned char * gen_const_unsigned_char_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
822 return(NULL);
823}
824static void des_const_unsigned_char_ptr(int no ATTRIBUTE_UNUSED, const unsigned char * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
825}
826
827#ifdef LIBXML_HTML_ENABLED
828#define gen_nb_const_htmlNodePtr 1
829static htmlNodePtr gen_const_htmlNodePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
830 return(NULL);
831}
832static void des_const_htmlNodePtr(int no ATTRIBUTE_UNUSED, const htmlNodePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
833}
834#endif
835
836#ifdef LIBXML_HTML_ENABLED
837#define gen_nb_htmlDocPtr 3
838static htmlDocPtr gen_htmlDocPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
839 if (no == 0) return(htmlNewDoc(NULL, NULL));
840 if (no == 1) return(htmlReadMemory("<html/>", 7, "test", NULL, 0));
841 return(NULL);
842}
843static void des_htmlDocPtr(int no ATTRIBUTE_UNUSED, htmlDocPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
844 if ((val != NULL) && (val != api_doc) && (val->doc != api_doc))
845 xmlFreeDoc(val);
846}
847static void desret_htmlDocPtr(htmlDocPtr val) {
848 if ((val != NULL) && (val != api_doc) && (val->doc != api_doc))
849 xmlFreeDoc(val);
850}
851#define gen_nb_htmlParserCtxtPtr 3
852static htmlParserCtxtPtr gen_htmlParserCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
853 if (no == 0) return(xmlNewParserCtxt());
854 if (no == 1) return(htmlCreateMemoryParserCtxt("<html/>", 7));
855 return(NULL);
856}
857static void des_htmlParserCtxtPtr(int no ATTRIBUTE_UNUSED, htmlParserCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
858 if (val != NULL)
859 htmlFreeParserCtxt(val);
860}
861static void desret_htmlParserCtxtPtr(htmlParserCtxtPtr val) {
862 if (val != NULL)
863 htmlFreeParserCtxt(val);
864}
865#endif
866
867#ifdef LIBXML_XPATH_ENABLED
868#define gen_nb_xmlNodeSetPtr 1
869static xmlNodeSetPtr gen_xmlNodeSetPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
870 return(NULL);
871}
872static void des_xmlNodeSetPtr(int no ATTRIBUTE_UNUSED, xmlNodeSetPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
873}
874#endif
875
876#ifdef LIBXML_DEBUG_ENABLED
Daniel Veillardd0cf7f62004-11-09 16:17:02 +0000877#ifdef LIBXML_XPATH_ENABLED
Daniel Veillarda521d282004-11-09 14:59:59 +0000878#define gen_nb_xmlShellCtxtPtr 1
879static xmlShellCtxtPtr gen_xmlShellCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
880 return(NULL);
881}
882static void des_xmlShellCtxtPtr(int no ATTRIBUTE_UNUSED, xmlShellCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
883}
884#endif
Daniel Veillardd0cf7f62004-11-09 16:17:02 +0000885#endif
Daniel Veillarda521d282004-11-09 14:59:59 +0000886
887#ifdef LIBXML_PATTERN_ENABLED
888#define gen_nb_xmlPatternPtr 1
889static xmlPatternPtr gen_xmlPatternPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
890 return(NULL);
891}
892static void des_xmlPatternPtr(int no ATTRIBUTE_UNUSED, xmlPatternPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
893}
894#endif
895
William M. Brack094dd862004-11-14 14:28:34 +0000896#define gen_nb_xmlElementContentPtr 1
897static xmlElementContentPtr gen_xmlElementContentPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
898 return(NULL);
899}
900static void des_xmlElementContentPtr(int no ATTRIBUTE_UNUSED, xmlElementContentPtr val, int nr ATTRIBUTE_UNUSED) {
901 if (val != NULL)
902 xmlFreeElementContent(val);
903}
904static void desret_xmlElementContentPtr(xmlElementContentPtr val) {
905 if (val != NULL)
906 xmlFreeElementContent(val);
907}
908
909#define gen_nb_xmlParserNodeInfoSeqPtr 1
910static xmlParserNodeInfoSeqPtr gen_xmlParserNodeInfoSeqPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
911 return(NULL);
912}
913static void des_xmlParserNodeInfoSeqPtr(int no ATTRIBUTE_UNUSED, xmlParserNodeInfoSeqPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
914}
915
916static void desret_const_xmlParserNodeInfo_ptr(const xmlParserNodeInfo *val ATTRIBUTE_UNUSED) {
917}
918
Daniel Veillardd5cc0f72004-11-06 19:24:28 +0000919/************************************************************************
920 * *
921 * WARNING: end of the manually maintained part of the test code *
922 * do not remove or alter the CUT HERE line *
923 * *
924 ************************************************************************/
925
Daniel Veillard34099b42004-11-04 17:34:35 +0000926/* CUT HERE: everything below that line is generated */
Daniel Veillarda521d282004-11-09 14:59:59 +0000927#ifdef LIBXML_HTML_ENABLED
Daniel Veillard57b25162004-11-06 14:50:18 +0000928static void desret_htmlStatus(htmlStatus val ATTRIBUTE_UNUSED) {
929}
930
Daniel Veillarda521d282004-11-09 14:59:59 +0000931#endif
932
Daniel Veillard57b25162004-11-06 14:50:18 +0000933#define gen_nb_xmlAttributeDefault 4
934static xmlAttributeDefault gen_xmlAttributeDefault(int no, int nr ATTRIBUTE_UNUSED) {
935 if (no == 1) return(XML_ATTRIBUTE_FIXED);
936 if (no == 2) return(XML_ATTRIBUTE_IMPLIED);
937 if (no == 3) return(XML_ATTRIBUTE_NONE);
938 if (no == 4) return(XML_ATTRIBUTE_REQUIRED);
939 return(0);
940}
William M. Brack094dd862004-11-14 14:28:34 +0000941
Daniel Veillard57b25162004-11-06 14:50:18 +0000942static void des_xmlAttributeDefault(int no ATTRIBUTE_UNUSED, xmlAttributeDefault val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
943}
Daniel Veillard57b25162004-11-06 14:50:18 +0000944
945#define gen_nb_xmlAttributeType 4
946static xmlAttributeType gen_xmlAttributeType(int no, int nr ATTRIBUTE_UNUSED) {
947 if (no == 1) return(XML_ATTRIBUTE_CDATA);
948 if (no == 2) return(XML_ATTRIBUTE_ENTITIES);
949 if (no == 3) return(XML_ATTRIBUTE_ENTITY);
950 if (no == 4) return(XML_ATTRIBUTE_ENUMERATION);
951 return(0);
952}
William M. Brack094dd862004-11-14 14:28:34 +0000953
Daniel Veillard57b25162004-11-06 14:50:18 +0000954static void des_xmlAttributeType(int no ATTRIBUTE_UNUSED, xmlAttributeType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
955}
Daniel Veillard57b25162004-11-06 14:50:18 +0000956
957#define gen_nb_xmlBufferAllocationScheme 3
958static xmlBufferAllocationScheme gen_xmlBufferAllocationScheme(int no, int nr ATTRIBUTE_UNUSED) {
959 if (no == 1) return(XML_BUFFER_ALLOC_DOUBLEIT);
960 if (no == 2) return(XML_BUFFER_ALLOC_EXACT);
961 if (no == 3) return(XML_BUFFER_ALLOC_IMMUTABLE);
962 return(0);
963}
William M. Brack094dd862004-11-14 14:28:34 +0000964
Daniel Veillard57b25162004-11-06 14:50:18 +0000965static void des_xmlBufferAllocationScheme(int no ATTRIBUTE_UNUSED, xmlBufferAllocationScheme val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
966}
William M. Brack094dd862004-11-14 14:28:34 +0000967
Daniel Veillard57b25162004-11-06 14:50:18 +0000968static void desret_xmlBufferAllocationScheme(xmlBufferAllocationScheme val ATTRIBUTE_UNUSED) {
969}
970
Daniel Veillarda521d282004-11-09 14:59:59 +0000971#ifdef LIBXML_CATALOG_ENABLED
Daniel Veillard57b25162004-11-06 14:50:18 +0000972#define gen_nb_xmlCatalogAllow 4
973static xmlCatalogAllow gen_xmlCatalogAllow(int no, int nr ATTRIBUTE_UNUSED) {
974 if (no == 1) return(XML_CATA_ALLOW_ALL);
975 if (no == 2) return(XML_CATA_ALLOW_DOCUMENT);
976 if (no == 3) return(XML_CATA_ALLOW_GLOBAL);
977 if (no == 4) return(XML_CATA_ALLOW_NONE);
978 return(0);
979}
William M. Brack094dd862004-11-14 14:28:34 +0000980
Daniel Veillard57b25162004-11-06 14:50:18 +0000981static void des_xmlCatalogAllow(int no ATTRIBUTE_UNUSED, xmlCatalogAllow val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
982}
William M. Brack094dd862004-11-14 14:28:34 +0000983
Daniel Veillard57b25162004-11-06 14:50:18 +0000984static void desret_xmlCatalogAllow(xmlCatalogAllow val ATTRIBUTE_UNUSED) {
985}
986
Daniel Veillarda521d282004-11-09 14:59:59 +0000987#endif
988
989#ifdef LIBXML_CATALOG_ENABLED
Daniel Veillard57b25162004-11-06 14:50:18 +0000990#define gen_nb_xmlCatalogPrefer 3
991static xmlCatalogPrefer gen_xmlCatalogPrefer(int no, int nr ATTRIBUTE_UNUSED) {
992 if (no == 1) return(XML_CATA_PREFER_NONE);
993 if (no == 2) return(XML_CATA_PREFER_PUBLIC);
994 if (no == 3) return(XML_CATA_PREFER_SYSTEM);
995 return(0);
996}
William M. Brack094dd862004-11-14 14:28:34 +0000997
Daniel Veillard57b25162004-11-06 14:50:18 +0000998static void des_xmlCatalogPrefer(int no ATTRIBUTE_UNUSED, xmlCatalogPrefer val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
999}
William M. Brack094dd862004-11-14 14:28:34 +00001000
Daniel Veillard57b25162004-11-06 14:50:18 +00001001static void desret_xmlCatalogPrefer(xmlCatalogPrefer val ATTRIBUTE_UNUSED) {
1002}
1003
Daniel Veillarda521d282004-11-09 14:59:59 +00001004#endif
1005
Daniel Veillard57b25162004-11-06 14:50:18 +00001006#define gen_nb_xmlElementContentType 4
1007static xmlElementContentType gen_xmlElementContentType(int no, int nr ATTRIBUTE_UNUSED) {
1008 if (no == 1) return(XML_ELEMENT_CONTENT_ELEMENT);
1009 if (no == 2) return(XML_ELEMENT_CONTENT_OR);
1010 if (no == 3) return(XML_ELEMENT_CONTENT_PCDATA);
1011 if (no == 4) return(XML_ELEMENT_CONTENT_SEQ);
1012 return(0);
1013}
Daniel Veillard57b25162004-11-06 14:50:18 +00001014
William M. Brack094dd862004-11-14 14:28:34 +00001015static void des_xmlElementContentType(int no ATTRIBUTE_UNUSED, xmlElementContentType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillard57b25162004-11-06 14:50:18 +00001016}
1017
1018#define gen_nb_xmlElementTypeVal 4
1019static xmlElementTypeVal gen_xmlElementTypeVal(int no, int nr ATTRIBUTE_UNUSED) {
1020 if (no == 1) return(XML_ELEMENT_TYPE_ANY);
1021 if (no == 2) return(XML_ELEMENT_TYPE_ELEMENT);
1022 if (no == 3) return(XML_ELEMENT_TYPE_EMPTY);
1023 if (no == 4) return(XML_ELEMENT_TYPE_MIXED);
1024 return(0);
1025}
William M. Brack094dd862004-11-14 14:28:34 +00001026
Daniel Veillard57b25162004-11-06 14:50:18 +00001027static void des_xmlElementTypeVal(int no ATTRIBUTE_UNUSED, xmlElementTypeVal val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1028}
Daniel Veillard57b25162004-11-06 14:50:18 +00001029
Daniel Veillard57b25162004-11-06 14:50:18 +00001030static void desret_xmlParserErrors(xmlParserErrors val ATTRIBUTE_UNUSED) {
1031}
1032
Daniel Veillarda521d282004-11-09 14:59:59 +00001033#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillard57b25162004-11-06 14:50:18 +00001034#define gen_nb_xmlSchemaValType 4
1035static xmlSchemaValType gen_xmlSchemaValType(int no, int nr ATTRIBUTE_UNUSED) {
1036 if (no == 1) return(XML_SCHEMAS_ANYSIMPLETYPE);
1037 if (no == 2) return(XML_SCHEMAS_ANYTYPE);
1038 if (no == 3) return(XML_SCHEMAS_ANYURI);
1039 if (no == 4) return(XML_SCHEMAS_BASE64BINARY);
1040 return(0);
1041}
William M. Brack094dd862004-11-14 14:28:34 +00001042
Daniel Veillard57b25162004-11-06 14:50:18 +00001043static void des_xmlSchemaValType(int no ATTRIBUTE_UNUSED, xmlSchemaValType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1044}
Daniel Veillard57b25162004-11-06 14:50:18 +00001045
Daniel Veillarda521d282004-11-09 14:59:59 +00001046#endif
1047
Daniel Veillard34099b42004-11-04 17:34:35 +00001048#include <libxml/HTMLparser.h>
1049#include <libxml/HTMLtree.h>
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00001050#include <libxml/SAX2.h>
Daniel Veillarda82b1822004-11-08 16:24:57 +00001051#include <libxml/c14n.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001052#include <libxml/catalog.h>
1053#include <libxml/chvalid.h>
Daniel Veillarda82b1822004-11-08 16:24:57 +00001054#include <libxml/debugXML.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001055#include <libxml/dict.h>
1056#include <libxml/encoding.h>
1057#include <libxml/entities.h>
1058#include <libxml/hash.h>
1059#include <libxml/list.h>
1060#include <libxml/nanoftp.h>
1061#include <libxml/nanohttp.h>
1062#include <libxml/parser.h>
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00001063#include <libxml/parserInternals.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001064#include <libxml/pattern.h>
1065#include <libxml/relaxng.h>
1066#include <libxml/schemasInternals.h>
1067#include <libxml/tree.h>
1068#include <libxml/uri.h>
1069#include <libxml/valid.h>
1070#include <libxml/xinclude.h>
1071#include <libxml/xmlIO.h>
Daniel Veillarda82b1822004-11-08 16:24:57 +00001072#include <libxml/xmlautomata.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001073#include <libxml/xmlerror.h>
1074#include <libxml/xmlreader.h>
Daniel Veillarda82b1822004-11-08 16:24:57 +00001075#include <libxml/xmlregexp.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001076#include <libxml/xmlsave.h>
1077#include <libxml/xmlschemas.h>
1078#include <libxml/xmlschemastypes.h>
1079#include <libxml/xmlstring.h>
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +00001080#include <libxml/xmlunicode.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001081#include <libxml/xmlwriter.h>
1082#include <libxml/xpath.h>
Daniel Veillarda82b1822004-11-08 16:24:57 +00001083#include <libxml/xpathInternals.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001084#include <libxml/xpointer.h>
1085static int test_HTMLparser(void);
1086static int test_HTMLtree(void);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00001087static int test_SAX2(void);
Daniel Veillarda82b1822004-11-08 16:24:57 +00001088static int test_c14n(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001089static int test_catalog(void);
1090static int test_chvalid(void);
Daniel Veillarda82b1822004-11-08 16:24:57 +00001091static int test_debugXML(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001092static int test_dict(void);
1093static int test_encoding(void);
1094static int test_entities(void);
1095static int test_hash(void);
1096static int test_list(void);
1097static int test_nanoftp(void);
1098static int test_nanohttp(void);
1099static int test_parser(void);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00001100static int test_parserInternals(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001101static int test_pattern(void);
1102static int test_relaxng(void);
1103static int test_schemasInternals(void);
1104static int test_tree(void);
1105static int test_uri(void);
1106static int test_valid(void);
1107static int test_xinclude(void);
1108static int test_xmlIO(void);
Daniel Veillarda82b1822004-11-08 16:24:57 +00001109static int test_xmlautomata(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001110static int test_xmlerror(void);
1111static int test_xmlreader(void);
Daniel Veillarda82b1822004-11-08 16:24:57 +00001112static int test_xmlregexp(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001113static int test_xmlsave(void);
1114static int test_xmlschemas(void);
1115static int test_xmlschemastypes(void);
1116static int test_xmlstring(void);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +00001117static int test_xmlunicode(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001118static int test_xmlwriter(void);
1119static int test_xpath(void);
Daniel Veillarda82b1822004-11-08 16:24:57 +00001120static int test_xpathInternals(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001121static int test_xpointer(void);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001122
1123/**
1124 * testlibxml2:
1125 *
1126 * Main entry point of the tester for the full libxml2 module,
1127 * it calls all the tester entry point for each module.
1128 *
1129 * Returns the number of error found
1130 */
1131static int
1132testlibxml2(void)
1133{
Daniel Veillard42595322004-11-08 10:52:06 +00001134 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001135
Daniel Veillard42595322004-11-08 10:52:06 +00001136 test_ret += test_HTMLparser();
1137 test_ret += test_HTMLtree();
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00001138 test_ret += test_SAX2();
Daniel Veillarda82b1822004-11-08 16:24:57 +00001139 test_ret += test_c14n();
Daniel Veillard42595322004-11-08 10:52:06 +00001140 test_ret += test_catalog();
1141 test_ret += test_chvalid();
Daniel Veillarda82b1822004-11-08 16:24:57 +00001142 test_ret += test_debugXML();
Daniel Veillard42595322004-11-08 10:52:06 +00001143 test_ret += test_dict();
1144 test_ret += test_encoding();
1145 test_ret += test_entities();
1146 test_ret += test_hash();
1147 test_ret += test_list();
1148 test_ret += test_nanoftp();
1149 test_ret += test_nanohttp();
1150 test_ret += test_parser();
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00001151 test_ret += test_parserInternals();
Daniel Veillard42595322004-11-08 10:52:06 +00001152 test_ret += test_pattern();
1153 test_ret += test_relaxng();
1154 test_ret += test_schemasInternals();
1155 test_ret += test_tree();
1156 test_ret += test_uri();
1157 test_ret += test_valid();
1158 test_ret += test_xinclude();
1159 test_ret += test_xmlIO();
Daniel Veillarda82b1822004-11-08 16:24:57 +00001160 test_ret += test_xmlautomata();
Daniel Veillard42595322004-11-08 10:52:06 +00001161 test_ret += test_xmlerror();
1162 test_ret += test_xmlreader();
Daniel Veillarda82b1822004-11-08 16:24:57 +00001163 test_ret += test_xmlregexp();
Daniel Veillard42595322004-11-08 10:52:06 +00001164 test_ret += test_xmlsave();
1165 test_ret += test_xmlschemas();
1166 test_ret += test_xmlschemastypes();
1167 test_ret += test_xmlstring();
1168 test_ret += test_xmlunicode();
1169 test_ret += test_xmlwriter();
1170 test_ret += test_xpath();
Daniel Veillarda82b1822004-11-08 16:24:57 +00001171 test_ret += test_xpathInternals();
Daniel Veillard42595322004-11-08 10:52:06 +00001172 test_ret += test_xpointer();
Daniel Veillardd93f6252004-11-02 15:53:51 +00001173
Daniel Veillard3d97e662004-11-04 10:49:00 +00001174 printf("Total: %d functions, %d tests, %d errors\n",
Daniel Veillard42595322004-11-08 10:52:06 +00001175 function_tests, call_tests, test_ret);
1176 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001177}
1178
1179
1180static int
1181test_UTF8ToHtml(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001182 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001183
Daniel Veillardce682bc2004-11-05 17:22:25 +00001184#ifdef LIBXML_HTML_ENABLED
1185 int mem_base;
1186 int ret_val;
1187 unsigned char * out; /* a pointer to an array of bytes to store the result */
1188 int n_out;
1189 int * outlen; /* the length of @out */
1190 int n_outlen;
1191 unsigned char * in; /* a pointer to an array of UTF-8 chars */
1192 int n_in;
1193 int * inlen; /* the length of @in */
1194 int n_inlen;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001195
Daniel Veillardce682bc2004-11-05 17:22:25 +00001196 for (n_out = 0;n_out < gen_nb_unsigned_char_ptr;n_out++) {
1197 for (n_outlen = 0;n_outlen < gen_nb_int_ptr;n_outlen++) {
1198 for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) {
1199 for (n_inlen = 0;n_inlen < gen_nb_int_ptr;n_inlen++) {
1200 mem_base = xmlMemBlocks();
1201 out = gen_unsigned_char_ptr(n_out, 0);
1202 outlen = gen_int_ptr(n_outlen, 1);
1203 in = gen_const_unsigned_char_ptr(n_in, 2);
1204 inlen = gen_int_ptr(n_inlen, 3);
1205
William M. Brackf13f77f2004-11-12 16:03:48 +00001206 ret_val = UTF8ToHtml(out, outlen, (const unsigned char *)in, inlen);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001207 desret_int(ret_val);
1208 call_tests++;
1209 des_unsigned_char_ptr(n_out, out, 0);
1210 des_int_ptr(n_outlen, outlen, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00001211 des_const_unsigned_char_ptr(n_in, (const unsigned char *)in, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001212 des_int_ptr(n_inlen, inlen, 3);
1213 xmlResetLastError();
1214 if (mem_base != xmlMemBlocks()) {
1215 printf("Leak of %d blocks found in UTF8ToHtml",
1216 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001217 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001218 printf(" %d", n_out);
1219 printf(" %d", n_outlen);
1220 printf(" %d", n_in);
1221 printf(" %d", n_inlen);
1222 printf("\n");
1223 }
1224 }
1225 }
1226 }
1227 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001228 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001229#endif
1230
Daniel Veillard42595322004-11-08 10:52:06 +00001231 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001232}
1233
Daniel Veillarda521d282004-11-09 14:59:59 +00001234#ifdef LIBXML_HTML_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +00001235
Daniel Veillardce682bc2004-11-05 17:22:25 +00001236#define gen_nb_const_htmlElemDesc_ptr 1
1237static htmlElemDesc * gen_const_htmlElemDesc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1238 return(NULL);
1239}
1240static void des_const_htmlElemDesc_ptr(int no ATTRIBUTE_UNUSED, const htmlElemDesc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1241}
Daniel Veillarda521d282004-11-09 14:59:59 +00001242#endif
1243
Daniel Veillardce682bc2004-11-05 17:22:25 +00001244
Daniel Veillardd93f6252004-11-02 15:53:51 +00001245static int
1246test_htmlAttrAllowed(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001247 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001248
Daniel Veillard57b25162004-11-06 14:50:18 +00001249#ifdef LIBXML_HTML_ENABLED
1250 int mem_base;
1251 htmlStatus ret_val;
1252 htmlElemDesc * elt; /* HTML element */
1253 int n_elt;
1254 xmlChar * attr; /* HTML attribute */
1255 int n_attr;
1256 int legacy; /* whether to allow deprecated attributes */
1257 int n_legacy;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001258
Daniel Veillard57b25162004-11-06 14:50:18 +00001259 for (n_elt = 0;n_elt < gen_nb_const_htmlElemDesc_ptr;n_elt++) {
1260 for (n_attr = 0;n_attr < gen_nb_const_xmlChar_ptr;n_attr++) {
1261 for (n_legacy = 0;n_legacy < gen_nb_int;n_legacy++) {
1262 mem_base = xmlMemBlocks();
1263 elt = gen_const_htmlElemDesc_ptr(n_elt, 0);
1264 attr = gen_const_xmlChar_ptr(n_attr, 1);
1265 legacy = gen_int(n_legacy, 2);
1266
William M. Brackf13f77f2004-11-12 16:03:48 +00001267 ret_val = htmlAttrAllowed((const htmlElemDesc *)elt, (const xmlChar *)attr, legacy);
Daniel Veillard57b25162004-11-06 14:50:18 +00001268 desret_htmlStatus(ret_val);
1269 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00001270 des_const_htmlElemDesc_ptr(n_elt, (const htmlElemDesc *)elt, 0);
1271 des_const_xmlChar_ptr(n_attr, (const xmlChar *)attr, 1);
Daniel Veillard57b25162004-11-06 14:50:18 +00001272 des_int(n_legacy, legacy, 2);
1273 xmlResetLastError();
1274 if (mem_base != xmlMemBlocks()) {
1275 printf("Leak of %d blocks found in htmlAttrAllowed",
1276 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001277 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +00001278 printf(" %d", n_elt);
1279 printf(" %d", n_attr);
1280 printf(" %d", n_legacy);
1281 printf("\n");
1282 }
1283 }
1284 }
1285 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001286 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +00001287#endif
1288
Daniel Veillard42595322004-11-08 10:52:06 +00001289 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001290}
1291
Daniel Veillarda521d282004-11-09 14:59:59 +00001292#ifdef LIBXML_HTML_ENABLED
1293
1294#define gen_nb_htmlNodePtr 1
1295static htmlNodePtr gen_htmlNodePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1296 return(NULL);
1297}
1298static void des_htmlNodePtr(int no ATTRIBUTE_UNUSED, htmlNodePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1299}
1300#endif
1301
Daniel Veillardd93f6252004-11-02 15:53:51 +00001302
1303static int
1304test_htmlAutoCloseTag(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001305 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001306
Daniel Veillarda03e3652004-11-02 18:45:30 +00001307#ifdef LIBXML_HTML_ENABLED
1308 int mem_base;
1309 int ret_val;
1310 htmlDocPtr doc; /* the HTML document */
1311 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001312 xmlChar * name; /* The tag name */
Daniel Veillarda03e3652004-11-02 18:45:30 +00001313 int n_name;
1314 htmlNodePtr elem; /* the HTML element */
1315 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001316
Daniel Veillarda521d282004-11-09 14:59:59 +00001317 for (n_doc = 0;n_doc < gen_nb_htmlDocPtr;n_doc++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00001318 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
Daniel Veillarda521d282004-11-09 14:59:59 +00001319 for (n_elem = 0;n_elem < gen_nb_htmlNodePtr;n_elem++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00001320 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00001321 doc = gen_htmlDocPtr(n_doc, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001322 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarda521d282004-11-09 14:59:59 +00001323 elem = gen_htmlNodePtr(n_elem, 2);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001324
William M. Brackf13f77f2004-11-12 16:03:48 +00001325 ret_val = htmlAutoCloseTag(doc, (const xmlChar *)name, elem);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001326 desret_int(ret_val);
1327 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00001328 des_htmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00001329 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarda521d282004-11-09 14:59:59 +00001330 des_htmlNodePtr(n_elem, elem, 2);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001331 xmlResetLastError();
1332 if (mem_base != xmlMemBlocks()) {
1333 printf("Leak of %d blocks found in htmlAutoCloseTag",
1334 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001335 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001336 printf(" %d", n_doc);
1337 printf(" %d", n_name);
1338 printf(" %d", n_elem);
1339 printf("\n");
1340 }
1341 }
1342 }
1343 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001344 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001345#endif
1346
Daniel Veillard42595322004-11-08 10:52:06 +00001347 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001348}
1349
1350
1351static int
1352test_htmlCreateMemoryParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001353 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001354
Daniel Veillard34099b42004-11-04 17:34:35 +00001355#ifdef LIBXML_HTML_ENABLED
1356 int mem_base;
1357 htmlParserCtxtPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001358 char * buffer; /* a pointer to a char array */
Daniel Veillard34099b42004-11-04 17:34:35 +00001359 int n_buffer;
1360 int size; /* the size of the array */
1361 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001362
Daniel Veillard34099b42004-11-04 17:34:35 +00001363 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
1364 for (n_size = 0;n_size < gen_nb_int;n_size++) {
1365 mem_base = xmlMemBlocks();
1366 buffer = gen_const_char_ptr(n_buffer, 0);
1367 size = gen_int(n_size, 1);
1368
William M. Brackf13f77f2004-11-12 16:03:48 +00001369 ret_val = htmlCreateMemoryParserCtxt((const char *)buffer, size);
Daniel Veillarda521d282004-11-09 14:59:59 +00001370 desret_htmlParserCtxtPtr(ret_val);
Daniel Veillard34099b42004-11-04 17:34:35 +00001371 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00001372 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard34099b42004-11-04 17:34:35 +00001373 des_int(n_size, size, 1);
1374 xmlResetLastError();
1375 if (mem_base != xmlMemBlocks()) {
1376 printf("Leak of %d blocks found in htmlCreateMemoryParserCtxt",
1377 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001378 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +00001379 printf(" %d", n_buffer);
1380 printf(" %d", n_size);
1381 printf("\n");
1382 }
1383 }
1384 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001385 function_tests++;
Daniel Veillard34099b42004-11-04 17:34:35 +00001386#endif
1387
Daniel Veillard42595322004-11-08 10:52:06 +00001388 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001389}
1390
Daniel Veillarda521d282004-11-09 14:59:59 +00001391#ifdef LIBXML_HTML_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +00001392
Daniel Veillardce682bc2004-11-05 17:22:25 +00001393#define gen_nb_htmlSAXHandlerPtr 1
1394static htmlSAXHandlerPtr gen_htmlSAXHandlerPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1395 return(NULL);
1396}
1397static void des_htmlSAXHandlerPtr(int no ATTRIBUTE_UNUSED, htmlSAXHandlerPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1398}
Daniel Veillarda521d282004-11-09 14:59:59 +00001399#endif
1400
Daniel Veillardce682bc2004-11-05 17:22:25 +00001401
Daniel Veillardd93f6252004-11-02 15:53:51 +00001402static int
1403test_htmlCreatePushParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001404 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001405
Daniel Veillardce682bc2004-11-05 17:22:25 +00001406#ifdef LIBXML_HTML_ENABLED
1407#ifdef LIBXML_PUSH_ENABLED
1408 int mem_base;
1409 htmlParserCtxtPtr ret_val;
1410 htmlSAXHandlerPtr sax; /* a SAX handler */
1411 int n_sax;
1412 void * user_data; /* The user data returned on SAX callbacks */
1413 int n_user_data;
1414 char * chunk; /* a pointer to an array of chars */
1415 int n_chunk;
1416 int size; /* number of chars in the array */
1417 int n_size;
1418 const char * filename; /* an optional file name or URI */
1419 int n_filename;
1420 xmlCharEncoding enc; /* an optional encoding */
1421 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001422
Daniel Veillardce682bc2004-11-05 17:22:25 +00001423 for (n_sax = 0;n_sax < gen_nb_htmlSAXHandlerPtr;n_sax++) {
1424 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
1425 for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) {
1426 for (n_size = 0;n_size < gen_nb_int;n_size++) {
Daniel Veillard42595322004-11-08 10:52:06 +00001427 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
Daniel Veillardce682bc2004-11-05 17:22:25 +00001428 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
1429 mem_base = xmlMemBlocks();
1430 sax = gen_htmlSAXHandlerPtr(n_sax, 0);
1431 user_data = gen_userdata(n_user_data, 1);
1432 chunk = gen_const_char_ptr(n_chunk, 2);
1433 size = gen_int(n_size, 3);
Daniel Veillard42595322004-11-08 10:52:06 +00001434 filename = gen_fileoutput(n_filename, 4);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001435 enc = gen_xmlCharEncoding(n_enc, 5);
1436
William M. Brackf13f77f2004-11-12 16:03:48 +00001437 ret_val = htmlCreatePushParserCtxt(sax, user_data, (const char *)chunk, size, filename, enc);
Daniel Veillarda521d282004-11-09 14:59:59 +00001438 desret_htmlParserCtxtPtr(ret_val);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001439 call_tests++;
1440 des_htmlSAXHandlerPtr(n_sax, sax, 0);
1441 des_userdata(n_user_data, user_data, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00001442 des_const_char_ptr(n_chunk, (const char *)chunk, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001443 des_int(n_size, size, 3);
Daniel Veillard42595322004-11-08 10:52:06 +00001444 des_fileoutput(n_filename, filename, 4);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001445 des_xmlCharEncoding(n_enc, enc, 5);
1446 xmlResetLastError();
1447 if (mem_base != xmlMemBlocks()) {
1448 printf("Leak of %d blocks found in htmlCreatePushParserCtxt",
1449 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001450 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001451 printf(" %d", n_sax);
1452 printf(" %d", n_user_data);
1453 printf(" %d", n_chunk);
1454 printf(" %d", n_size);
1455 printf(" %d", n_filename);
1456 printf(" %d", n_enc);
1457 printf("\n");
1458 }
1459 }
1460 }
1461 }
1462 }
1463 }
1464 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001465 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001466#endif
1467#endif
1468
Daniel Veillard42595322004-11-08 10:52:06 +00001469 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001470}
1471
1472
1473static int
1474test_htmlCtxtReadDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001475 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001476
Daniel Veillarda03e3652004-11-02 18:45:30 +00001477#ifdef LIBXML_HTML_ENABLED
1478 int mem_base;
1479 htmlDocPtr ret_val;
1480 htmlParserCtxtPtr ctxt; /* an HTML parser context */
1481 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001482 xmlChar * cur; /* a pointer to a zero terminated string */
Daniel Veillarda03e3652004-11-02 18:45:30 +00001483 int n_cur;
1484 const char * URL; /* the base URL to use for the document */
1485 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001486 char * encoding; /* the document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00001487 int n_encoding;
1488 int options; /* a combination of htmlParserOption(s) */
1489 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001490
Daniel Veillarda521d282004-11-09 14:59:59 +00001491 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00001492 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
1493 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
1494 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
1495 for (n_options = 0;n_options < gen_nb_int;n_options++) {
1496 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00001497 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001498 cur = gen_const_xmlChar_ptr(n_cur, 1);
1499 URL = gen_filepath(n_URL, 2);
1500 encoding = gen_const_char_ptr(n_encoding, 3);
1501 options = gen_int(n_options, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001502
William M. Brackf13f77f2004-11-12 16:03:48 +00001503 ret_val = htmlCtxtReadDoc(ctxt, (const xmlChar *)cur, URL, (const char *)encoding, options);
Daniel Veillarda521d282004-11-09 14:59:59 +00001504 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001505 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00001506 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00001507 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001508 des_filepath(n_URL, URL, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +00001509 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001510 des_int(n_options, options, 4);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001511 xmlResetLastError();
1512 if (mem_base != xmlMemBlocks()) {
1513 printf("Leak of %d blocks found in htmlCtxtReadDoc",
1514 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001515 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001516 printf(" %d", n_ctxt);
1517 printf(" %d", n_cur);
1518 printf(" %d", n_URL);
1519 printf(" %d", n_encoding);
1520 printf(" %d", n_options);
1521 printf("\n");
1522 }
1523 }
1524 }
1525 }
1526 }
1527 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001528 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001529#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +00001530
Daniel Veillard42595322004-11-08 10:52:06 +00001531 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001532}
1533
1534
1535static int
1536test_htmlCtxtReadFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001537 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001538
Daniel Veillarda03e3652004-11-02 18:45:30 +00001539#ifdef LIBXML_HTML_ENABLED
1540 int mem_base;
1541 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++) {
1555 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00001556 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001557 filename = gen_filepath(n_filename, 1);
1558 encoding = gen_const_char_ptr(n_encoding, 2);
1559 options = gen_int(n_options, 3);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001560
William M. Brackf13f77f2004-11-12 16:03:48 +00001561 ret_val = htmlCtxtReadFile(ctxt, filename, (const char *)encoding, options);
Daniel Veillarda521d282004-11-09 14:59:59 +00001562 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001563 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00001564 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001565 des_filepath(n_filename, filename, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00001566 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001567 des_int(n_options, options, 3);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001568 xmlResetLastError();
1569 if (mem_base != xmlMemBlocks()) {
1570 printf("Leak of %d blocks found in htmlCtxtReadFile",
1571 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001572 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001573 printf(" %d", n_ctxt);
1574 printf(" %d", n_filename);
1575 printf(" %d", n_encoding);
1576 printf(" %d", n_options);
1577 printf("\n");
1578 }
1579 }
1580 }
1581 }
1582 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001583 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001584#endif
1585
Daniel Veillard42595322004-11-08 10:52:06 +00001586 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001587}
1588
1589
1590static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00001591test_htmlCtxtReadMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001592 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001593
Daniel Veillarda03e3652004-11-02 18:45:30 +00001594#ifdef LIBXML_HTML_ENABLED
1595 int mem_base;
1596 htmlDocPtr ret_val;
1597 htmlParserCtxtPtr ctxt; /* an HTML parser context */
1598 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001599 char * buffer; /* a pointer to a char array */
Daniel Veillarda03e3652004-11-02 18:45:30 +00001600 int n_buffer;
1601 int size; /* the size of the array */
1602 int n_size;
1603 const char * URL; /* the base URL to use for the document */
1604 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001605 char * encoding; /* the document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00001606 int n_encoding;
1607 int options; /* a combination of htmlParserOption(s) */
1608 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001609
Daniel Veillarda521d282004-11-09 14:59:59 +00001610 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00001611 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
1612 for (n_size = 0;n_size < gen_nb_int;n_size++) {
1613 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
1614 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
1615 for (n_options = 0;n_options < gen_nb_int;n_options++) {
1616 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00001617 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001618 buffer = gen_const_char_ptr(n_buffer, 1);
1619 size = gen_int(n_size, 2);
1620 URL = gen_filepath(n_URL, 3);
1621 encoding = gen_const_char_ptr(n_encoding, 4);
1622 options = gen_int(n_options, 5);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001623
William M. Brackf13f77f2004-11-12 16:03:48 +00001624 ret_val = htmlCtxtReadMemory(ctxt, (const char *)buffer, size, URL, (const char *)encoding, options);
Daniel Veillarda521d282004-11-09 14:59:59 +00001625 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001626 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00001627 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00001628 des_const_char_ptr(n_buffer, (const char *)buffer, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001629 des_int(n_size, size, 2);
1630 des_filepath(n_URL, URL, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +00001631 des_const_char_ptr(n_encoding, (const char *)encoding, 4);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001632 des_int(n_options, options, 5);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001633 xmlResetLastError();
1634 if (mem_base != xmlMemBlocks()) {
1635 printf("Leak of %d blocks found in htmlCtxtReadMemory",
1636 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001637 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001638 printf(" %d", n_ctxt);
1639 printf(" %d", n_buffer);
1640 printf(" %d", n_size);
1641 printf(" %d", n_URL);
1642 printf(" %d", n_encoding);
1643 printf(" %d", n_options);
1644 printf("\n");
1645 }
1646 }
1647 }
1648 }
1649 }
1650 }
1651 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001652 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001653#endif
1654
Daniel Veillard42595322004-11-08 10:52:06 +00001655 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001656}
1657
1658
1659static int
1660test_htmlCtxtReset(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001661 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001662
Daniel Veillarda03e3652004-11-02 18:45:30 +00001663#ifdef LIBXML_HTML_ENABLED
1664 int mem_base;
1665 htmlParserCtxtPtr ctxt; /* an HTML parser context */
1666 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001667
Daniel Veillarda521d282004-11-09 14:59:59 +00001668 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00001669 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00001670 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001671
1672 htmlCtxtReset(ctxt);
1673 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00001674 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001675 xmlResetLastError();
1676 if (mem_base != xmlMemBlocks()) {
1677 printf("Leak of %d blocks found in htmlCtxtReset",
1678 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001679 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001680 printf(" %d", n_ctxt);
1681 printf("\n");
1682 }
1683 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001684 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001685#endif
1686
Daniel Veillard42595322004-11-08 10:52:06 +00001687 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001688}
1689
1690
1691static int
1692test_htmlCtxtUseOptions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001693 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001694
Daniel Veillarda03e3652004-11-02 18:45:30 +00001695#ifdef LIBXML_HTML_ENABLED
1696 int mem_base;
1697 int ret_val;
1698 htmlParserCtxtPtr ctxt; /* an HTML parser context */
1699 int n_ctxt;
1700 int options; /* a combination of htmlParserOption(s) */
1701 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001702
Daniel Veillarda521d282004-11-09 14:59:59 +00001703 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00001704 for (n_options = 0;n_options < gen_nb_int;n_options++) {
1705 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00001706 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001707 options = gen_int(n_options, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001708
1709 ret_val = htmlCtxtUseOptions(ctxt, options);
1710 desret_int(ret_val);
1711 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00001712 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001713 des_int(n_options, options, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001714 xmlResetLastError();
1715 if (mem_base != xmlMemBlocks()) {
1716 printf("Leak of %d blocks found in htmlCtxtUseOptions",
1717 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001718 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001719 printf(" %d", n_ctxt);
1720 printf(" %d", n_options);
1721 printf("\n");
1722 }
1723 }
1724 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001725 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001726#endif
1727
Daniel Veillard42595322004-11-08 10:52:06 +00001728 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001729}
1730
1731
1732static int
1733test_htmlElementAllowedHere(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001734 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001735
Daniel Veillardce682bc2004-11-05 17:22:25 +00001736#ifdef LIBXML_HTML_ENABLED
1737 int mem_base;
1738 int ret_val;
1739 htmlElemDesc * parent; /* HTML parent element */
1740 int n_parent;
1741 xmlChar * elt; /* HTML element */
1742 int n_elt;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001743
Daniel Veillardce682bc2004-11-05 17:22:25 +00001744 for (n_parent = 0;n_parent < gen_nb_const_htmlElemDesc_ptr;n_parent++) {
1745 for (n_elt = 0;n_elt < gen_nb_const_xmlChar_ptr;n_elt++) {
1746 mem_base = xmlMemBlocks();
1747 parent = gen_const_htmlElemDesc_ptr(n_parent, 0);
1748 elt = gen_const_xmlChar_ptr(n_elt, 1);
1749
William M. Brackf13f77f2004-11-12 16:03:48 +00001750 ret_val = htmlElementAllowedHere((const htmlElemDesc *)parent, (const xmlChar *)elt);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001751 desret_int(ret_val);
1752 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00001753 des_const_htmlElemDesc_ptr(n_parent, (const htmlElemDesc *)parent, 0);
1754 des_const_xmlChar_ptr(n_elt, (const xmlChar *)elt, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001755 xmlResetLastError();
1756 if (mem_base != xmlMemBlocks()) {
1757 printf("Leak of %d blocks found in htmlElementAllowedHere",
1758 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001759 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001760 printf(" %d", n_parent);
1761 printf(" %d", n_elt);
1762 printf("\n");
1763 }
1764 }
1765 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001766 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001767#endif
1768
Daniel Veillard42595322004-11-08 10:52:06 +00001769 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001770}
1771
1772
1773static int
1774test_htmlElementStatusHere(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001775 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001776
Daniel Veillard57b25162004-11-06 14:50:18 +00001777#ifdef LIBXML_HTML_ENABLED
1778 int mem_base;
1779 htmlStatus ret_val;
1780 htmlElemDesc * parent; /* HTML parent element */
1781 int n_parent;
1782 htmlElemDesc * elt; /* HTML element */
1783 int n_elt;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001784
Daniel Veillard57b25162004-11-06 14:50:18 +00001785 for (n_parent = 0;n_parent < gen_nb_const_htmlElemDesc_ptr;n_parent++) {
1786 for (n_elt = 0;n_elt < gen_nb_const_htmlElemDesc_ptr;n_elt++) {
1787 mem_base = xmlMemBlocks();
1788 parent = gen_const_htmlElemDesc_ptr(n_parent, 0);
1789 elt = gen_const_htmlElemDesc_ptr(n_elt, 1);
1790
William M. Brackf13f77f2004-11-12 16:03:48 +00001791 ret_val = htmlElementStatusHere((const htmlElemDesc *)parent, (const htmlElemDesc *)elt);
Daniel Veillard57b25162004-11-06 14:50:18 +00001792 desret_htmlStatus(ret_val);
1793 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00001794 des_const_htmlElemDesc_ptr(n_parent, (const htmlElemDesc *)parent, 0);
1795 des_const_htmlElemDesc_ptr(n_elt, (const htmlElemDesc *)elt, 1);
Daniel Veillard57b25162004-11-06 14:50:18 +00001796 xmlResetLastError();
1797 if (mem_base != xmlMemBlocks()) {
1798 printf("Leak of %d blocks found in htmlElementStatusHere",
1799 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001800 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +00001801 printf(" %d", n_parent);
1802 printf(" %d", n_elt);
1803 printf("\n");
1804 }
1805 }
1806 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001807 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +00001808#endif
1809
Daniel Veillard42595322004-11-08 10:52:06 +00001810 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001811}
1812
1813
1814static int
1815test_htmlEncodeEntities(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001816 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001817
Daniel Veillardce682bc2004-11-05 17:22:25 +00001818#ifdef LIBXML_HTML_ENABLED
1819 int mem_base;
1820 int ret_val;
1821 unsigned char * out; /* a pointer to an array of bytes to store the result */
1822 int n_out;
1823 int * outlen; /* the length of @out */
1824 int n_outlen;
1825 unsigned char * in; /* a pointer to an array of UTF-8 chars */
1826 int n_in;
1827 int * inlen; /* the length of @in */
1828 int n_inlen;
1829 int quoteChar; /* the quote character to escape (' or ") or zero. */
1830 int n_quoteChar;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001831
Daniel Veillardce682bc2004-11-05 17:22:25 +00001832 for (n_out = 0;n_out < gen_nb_unsigned_char_ptr;n_out++) {
1833 for (n_outlen = 0;n_outlen < gen_nb_int_ptr;n_outlen++) {
1834 for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) {
1835 for (n_inlen = 0;n_inlen < gen_nb_int_ptr;n_inlen++) {
1836 for (n_quoteChar = 0;n_quoteChar < gen_nb_int;n_quoteChar++) {
1837 mem_base = xmlMemBlocks();
1838 out = gen_unsigned_char_ptr(n_out, 0);
1839 outlen = gen_int_ptr(n_outlen, 1);
1840 in = gen_const_unsigned_char_ptr(n_in, 2);
1841 inlen = gen_int_ptr(n_inlen, 3);
1842 quoteChar = gen_int(n_quoteChar, 4);
1843
William M. Brackf13f77f2004-11-12 16:03:48 +00001844 ret_val = htmlEncodeEntities(out, outlen, (const unsigned char *)in, inlen, quoteChar);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001845 desret_int(ret_val);
1846 call_tests++;
1847 des_unsigned_char_ptr(n_out, out, 0);
1848 des_int_ptr(n_outlen, outlen, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00001849 des_const_unsigned_char_ptr(n_in, (const unsigned char *)in, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001850 des_int_ptr(n_inlen, inlen, 3);
1851 des_int(n_quoteChar, quoteChar, 4);
1852 xmlResetLastError();
1853 if (mem_base != xmlMemBlocks()) {
1854 printf("Leak of %d blocks found in htmlEncodeEntities",
1855 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001856 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001857 printf(" %d", n_out);
1858 printf(" %d", n_outlen);
1859 printf(" %d", n_in);
1860 printf(" %d", n_inlen);
1861 printf(" %d", n_quoteChar);
1862 printf("\n");
1863 }
1864 }
1865 }
1866 }
1867 }
1868 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001869 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001870#endif
1871
Daniel Veillard42595322004-11-08 10:52:06 +00001872 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001873}
1874
1875
1876static int
1877test_htmlEntityLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001878 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001879
Daniel Veillard42595322004-11-08 10:52:06 +00001880#ifdef LIBXML_HTML_ENABLED
1881 int mem_base;
1882 const htmlEntityDesc * ret_val;
1883 xmlChar * name; /* the entity name */
1884 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001885
Daniel Veillard42595322004-11-08 10:52:06 +00001886 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
1887 mem_base = xmlMemBlocks();
1888 name = gen_const_xmlChar_ptr(n_name, 0);
1889
William M. Brackf13f77f2004-11-12 16:03:48 +00001890 ret_val = htmlEntityLookup((const xmlChar *)name);
Daniel Veillard42595322004-11-08 10:52:06 +00001891 desret_const_htmlEntityDesc_ptr(ret_val);
1892 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00001893 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
Daniel Veillard42595322004-11-08 10:52:06 +00001894 xmlResetLastError();
1895 if (mem_base != xmlMemBlocks()) {
1896 printf("Leak of %d blocks found in htmlEntityLookup",
1897 xmlMemBlocks() - mem_base);
1898 test_ret++;
1899 printf(" %d", n_name);
1900 printf("\n");
1901 }
1902 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001903 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00001904#endif
1905
Daniel Veillard42595322004-11-08 10:52:06 +00001906 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001907}
1908
1909
1910static int
1911test_htmlEntityValueLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001912 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001913
Daniel Veillard42595322004-11-08 10:52:06 +00001914#ifdef LIBXML_HTML_ENABLED
1915 int mem_base;
1916 const htmlEntityDesc * ret_val;
1917 unsigned int value; /* the entity's unicode value */
1918 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001919
Daniel Veillard42595322004-11-08 10:52:06 +00001920 for (n_value = 0;n_value < gen_nb_unsigned_int;n_value++) {
1921 mem_base = xmlMemBlocks();
1922 value = gen_unsigned_int(n_value, 0);
1923
1924 ret_val = htmlEntityValueLookup(value);
1925 desret_const_htmlEntityDesc_ptr(ret_val);
1926 call_tests++;
1927 des_unsigned_int(n_value, value, 0);
1928 xmlResetLastError();
1929 if (mem_base != xmlMemBlocks()) {
1930 printf("Leak of %d blocks found in htmlEntityValueLookup",
1931 xmlMemBlocks() - mem_base);
1932 test_ret++;
1933 printf(" %d", n_value);
1934 printf("\n");
1935 }
1936 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001937 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00001938#endif
1939
Daniel Veillard42595322004-11-08 10:52:06 +00001940 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001941}
1942
1943
1944static int
1945test_htmlHandleOmittedElem(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001946 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001947
1948#ifdef LIBXML_HTML_ENABLED
1949 int mem_base;
1950 int ret_val;
1951 int val; /* int 0 or 1 */
1952 int n_val;
1953
1954 for (n_val = 0;n_val < gen_nb_int;n_val++) {
1955 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00001956 val = gen_int(n_val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001957
1958 ret_val = htmlHandleOmittedElem(val);
1959 desret_int(ret_val);
1960 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00001961 des_int(n_val, val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001962 xmlResetLastError();
1963 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00001964 printf("Leak of %d blocks found in htmlHandleOmittedElem",
Daniel Veillardd93f6252004-11-02 15:53:51 +00001965 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001966 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001967 printf(" %d", n_val);
1968 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00001969 }
1970 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001971 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001972#endif
1973
Daniel Veillard42595322004-11-08 10:52:06 +00001974 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001975}
1976
1977
1978static int
1979test_htmlIsAutoClosed(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001980 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001981
Daniel Veillarda03e3652004-11-02 18:45:30 +00001982#ifdef LIBXML_HTML_ENABLED
1983 int mem_base;
1984 int ret_val;
1985 htmlDocPtr doc; /* the HTML document */
1986 int n_doc;
1987 htmlNodePtr elem; /* the HTML element */
1988 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001989
Daniel Veillarda521d282004-11-09 14:59:59 +00001990 for (n_doc = 0;n_doc < gen_nb_htmlDocPtr;n_doc++) {
1991 for (n_elem = 0;n_elem < gen_nb_htmlNodePtr;n_elem++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00001992 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00001993 doc = gen_htmlDocPtr(n_doc, 0);
1994 elem = gen_htmlNodePtr(n_elem, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001995
1996 ret_val = htmlIsAutoClosed(doc, elem);
1997 desret_int(ret_val);
1998 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00001999 des_htmlDocPtr(n_doc, doc, 0);
2000 des_htmlNodePtr(n_elem, elem, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002001 xmlResetLastError();
2002 if (mem_base != xmlMemBlocks()) {
2003 printf("Leak of %d blocks found in htmlIsAutoClosed",
2004 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002005 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002006 printf(" %d", n_doc);
2007 printf(" %d", n_elem);
2008 printf("\n");
2009 }
2010 }
2011 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002012 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002013#endif
2014
Daniel Veillard42595322004-11-08 10:52:06 +00002015 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002016}
2017
2018
2019static int
2020test_htmlIsScriptAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002021 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002022
2023#ifdef LIBXML_HTML_ENABLED
2024 int mem_base;
2025 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002026 xmlChar * name; /* an attribute name */
Daniel Veillardd93f6252004-11-02 15:53:51 +00002027 int n_name;
2028
2029 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
2030 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002031 name = gen_const_xmlChar_ptr(n_name, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002032
William M. Brackf13f77f2004-11-12 16:03:48 +00002033 ret_val = htmlIsScriptAttribute((const xmlChar *)name);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002034 desret_int(ret_val);
2035 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00002036 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002037 xmlResetLastError();
2038 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00002039 printf("Leak of %d blocks found in htmlIsScriptAttribute",
Daniel Veillardd93f6252004-11-02 15:53:51 +00002040 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002041 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002042 printf(" %d", n_name);
2043 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00002044 }
2045 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002046 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002047#endif
2048
Daniel Veillard42595322004-11-08 10:52:06 +00002049 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002050}
2051
2052
2053static int
2054test_htmlNodeStatus(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002055 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002056
Daniel Veillard57b25162004-11-06 14:50:18 +00002057#ifdef LIBXML_HTML_ENABLED
2058 int mem_base;
2059 htmlStatus ret_val;
2060 htmlNodePtr node; /* an htmlNodePtr in a tree */
2061 int n_node;
2062 int legacy; /* whether to allow deprecated elements (YES is faster here for Element nodes) */
2063 int n_legacy;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002064
Daniel Veillarda521d282004-11-09 14:59:59 +00002065 for (n_node = 0;n_node < gen_nb_const_htmlNodePtr;n_node++) {
Daniel Veillard57b25162004-11-06 14:50:18 +00002066 for (n_legacy = 0;n_legacy < gen_nb_int;n_legacy++) {
2067 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00002068 node = gen_const_htmlNodePtr(n_node, 0);
Daniel Veillard57b25162004-11-06 14:50:18 +00002069 legacy = gen_int(n_legacy, 1);
2070
William M. Brackf13f77f2004-11-12 16:03:48 +00002071 ret_val = htmlNodeStatus((const htmlNodePtr)node, legacy);
Daniel Veillard57b25162004-11-06 14:50:18 +00002072 desret_htmlStatus(ret_val);
2073 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00002074 des_const_htmlNodePtr(n_node, (const htmlNodePtr)node, 0);
Daniel Veillard57b25162004-11-06 14:50:18 +00002075 des_int(n_legacy, legacy, 1);
2076 xmlResetLastError();
2077 if (mem_base != xmlMemBlocks()) {
2078 printf("Leak of %d blocks found in htmlNodeStatus",
2079 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002080 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +00002081 printf(" %d", n_node);
2082 printf(" %d", n_legacy);
2083 printf("\n");
2084 }
2085 }
2086 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002087 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +00002088#endif
2089
Daniel Veillard42595322004-11-08 10:52:06 +00002090 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002091}
2092
2093
2094static int
2095test_htmlParseCharRef(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002096 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002097
Daniel Veillarda03e3652004-11-02 18:45:30 +00002098#ifdef LIBXML_HTML_ENABLED
2099 int mem_base;
2100 int ret_val;
2101 htmlParserCtxtPtr ctxt; /* an HTML parser context */
2102 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002103
Daniel Veillarda521d282004-11-09 14:59:59 +00002104 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00002105 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00002106 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002107
2108 ret_val = htmlParseCharRef(ctxt);
2109 desret_int(ret_val);
2110 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00002111 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002112 xmlResetLastError();
2113 if (mem_base != xmlMemBlocks()) {
2114 printf("Leak of %d blocks found in htmlParseCharRef",
2115 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002116 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002117 printf(" %d", n_ctxt);
2118 printf("\n");
2119 }
2120 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002121 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002122#endif
2123
Daniel Veillard42595322004-11-08 10:52:06 +00002124 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002125}
2126
2127
2128static int
2129test_htmlParseChunk(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002130 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002131
Daniel Veillarda03e3652004-11-02 18:45:30 +00002132#ifdef LIBXML_HTML_ENABLED
2133#ifdef LIBXML_PUSH_ENABLED
2134 int mem_base;
2135 int ret_val;
2136 htmlParserCtxtPtr ctxt; /* an HTML parser context */
2137 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002138 char * chunk; /* an char array */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002139 int n_chunk;
2140 int size; /* the size in byte of the chunk */
2141 int n_size;
2142 int terminate; /* last chunk indicator */
2143 int n_terminate;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002144
Daniel Veillarda521d282004-11-09 14:59:59 +00002145 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00002146 for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) {
2147 for (n_size = 0;n_size < gen_nb_int;n_size++) {
2148 for (n_terminate = 0;n_terminate < gen_nb_int;n_terminate++) {
2149 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00002150 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002151 chunk = gen_const_char_ptr(n_chunk, 1);
2152 size = gen_int(n_size, 2);
2153 terminate = gen_int(n_terminate, 3);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002154
William M. Brackf13f77f2004-11-12 16:03:48 +00002155 ret_val = htmlParseChunk(ctxt, (const char *)chunk, size, terminate);
Daniel Veillarda521d282004-11-09 14:59:59 +00002156 if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;}
Daniel Veillarda03e3652004-11-02 18:45:30 +00002157 desret_int(ret_val);
2158 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00002159 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00002160 des_const_char_ptr(n_chunk, (const char *)chunk, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002161 des_int(n_size, size, 2);
2162 des_int(n_terminate, terminate, 3);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002163 xmlResetLastError();
2164 if (mem_base != xmlMemBlocks()) {
2165 printf("Leak of %d blocks found in htmlParseChunk",
2166 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002167 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002168 printf(" %d", n_ctxt);
2169 printf(" %d", n_chunk);
2170 printf(" %d", n_size);
2171 printf(" %d", n_terminate);
2172 printf("\n");
2173 }
2174 }
2175 }
2176 }
2177 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002178 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002179#endif
2180#endif
2181
Daniel Veillard42595322004-11-08 10:52:06 +00002182 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002183}
2184
2185
2186static int
2187test_htmlParseDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002188 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002189
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002190#ifdef LIBXML_HTML_ENABLED
2191 int mem_base;
2192 htmlDocPtr ret_val;
2193 xmlChar * cur; /* a pointer to an array of xmlChar */
2194 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002195 char * encoding; /* a free form C string describing the HTML document encoding, or NULL */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002196 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002197
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002198 for (n_cur = 0;n_cur < gen_nb_xmlChar_ptr;n_cur++) {
2199 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2200 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002201 cur = gen_xmlChar_ptr(n_cur, 0);
2202 encoding = gen_const_char_ptr(n_encoding, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002203
William M. Brackf13f77f2004-11-12 16:03:48 +00002204 ret_val = htmlParseDoc(cur, (const char *)encoding);
Daniel Veillarda521d282004-11-09 14:59:59 +00002205 desret_htmlDocPtr(ret_val);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002206 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002207 des_xmlChar_ptr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00002208 des_const_char_ptr(n_encoding, (const char *)encoding, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002209 xmlResetLastError();
2210 if (mem_base != xmlMemBlocks()) {
2211 printf("Leak of %d blocks found in htmlParseDoc",
2212 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002213 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002214 printf(" %d", n_cur);
2215 printf(" %d", n_encoding);
2216 printf("\n");
2217 }
2218 }
2219 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002220 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002221#endif
2222
Daniel Veillard42595322004-11-08 10:52:06 +00002223 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002224}
2225
2226
2227static int
2228test_htmlParseDocument(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002229 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002230
Daniel Veillarda03e3652004-11-02 18:45:30 +00002231#ifdef LIBXML_HTML_ENABLED
2232 int mem_base;
2233 int ret_val;
2234 htmlParserCtxtPtr ctxt; /* an HTML parser context */
2235 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002236
Daniel Veillarda521d282004-11-09 14:59:59 +00002237 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00002238 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00002239 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002240
2241 ret_val = htmlParseDocument(ctxt);
Daniel Veillarda521d282004-11-09 14:59:59 +00002242 if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;}
Daniel Veillarda03e3652004-11-02 18:45:30 +00002243 desret_int(ret_val);
2244 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00002245 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002246 xmlResetLastError();
2247 if (mem_base != xmlMemBlocks()) {
2248 printf("Leak of %d blocks found in htmlParseDocument",
2249 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002250 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002251 printf(" %d", n_ctxt);
2252 printf("\n");
2253 }
2254 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002255 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002256#endif
2257
Daniel Veillard42595322004-11-08 10:52:06 +00002258 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002259}
2260
2261
2262static int
2263test_htmlParseElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002264 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002265
Daniel Veillarda03e3652004-11-02 18:45:30 +00002266#ifdef LIBXML_HTML_ENABLED
2267 int mem_base;
2268 htmlParserCtxtPtr ctxt; /* an HTML parser context */
2269 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002270
Daniel Veillarda521d282004-11-09 14:59:59 +00002271 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00002272 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00002273 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002274
2275 htmlParseElement(ctxt);
2276 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00002277 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002278 xmlResetLastError();
2279 if (mem_base != xmlMemBlocks()) {
2280 printf("Leak of %d blocks found in htmlParseElement",
2281 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002282 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002283 printf(" %d", n_ctxt);
2284 printf("\n");
2285 }
2286 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002287 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002288#endif
2289
Daniel Veillard42595322004-11-08 10:52:06 +00002290 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002291}
2292
2293
2294static int
2295test_htmlParseEntityRef(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002296 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002297
Daniel Veillard42595322004-11-08 10:52:06 +00002298#ifdef LIBXML_HTML_ENABLED
2299 int mem_base;
2300 const htmlEntityDesc * ret_val;
2301 htmlParserCtxtPtr ctxt; /* an HTML parser context */
2302 int n_ctxt;
2303 xmlChar ** str; /* location to store the entity name */
2304 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002305
Daniel Veillarda521d282004-11-09 14:59:59 +00002306 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillard42595322004-11-08 10:52:06 +00002307 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr_ptr;n_str++) {
2308 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00002309 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillard42595322004-11-08 10:52:06 +00002310 str = gen_const_xmlChar_ptr_ptr(n_str, 1);
2311
William M. Brackf13f77f2004-11-12 16:03:48 +00002312 ret_val = htmlParseEntityRef(ctxt, (const xmlChar **)str);
Daniel Veillard42595322004-11-08 10:52:06 +00002313 desret_const_htmlEntityDesc_ptr(ret_val);
2314 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00002315 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00002316 des_const_xmlChar_ptr_ptr(n_str, (const xmlChar **)str, 1);
Daniel Veillard42595322004-11-08 10:52:06 +00002317 xmlResetLastError();
2318 if (mem_base != xmlMemBlocks()) {
2319 printf("Leak of %d blocks found in htmlParseEntityRef",
2320 xmlMemBlocks() - mem_base);
2321 test_ret++;
2322 printf(" %d", n_ctxt);
2323 printf(" %d", n_str);
2324 printf("\n");
2325 }
2326 }
2327 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002328 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00002329#endif
2330
Daniel Veillard42595322004-11-08 10:52:06 +00002331 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002332}
2333
2334
2335static int
2336test_htmlParseFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002337 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002338
Daniel Veillarda03e3652004-11-02 18:45:30 +00002339#ifdef LIBXML_HTML_ENABLED
2340 htmlDocPtr ret_val;
2341 const char * filename; /* the filename */
2342 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002343 char * encoding; /* a free form C string describing the HTML document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002344 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002345
Daniel Veillarda03e3652004-11-02 18:45:30 +00002346 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
2347 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +00002348 filename = gen_filepath(n_filename, 0);
2349 encoding = gen_const_char_ptr(n_encoding, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002350
William M. Brackf13f77f2004-11-12 16:03:48 +00002351 ret_val = htmlParseFile(filename, (const char *)encoding);
Daniel Veillarda521d282004-11-09 14:59:59 +00002352 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002353 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002354 des_filepath(n_filename, filename, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00002355 des_const_char_ptr(n_encoding, (const char *)encoding, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002356 xmlResetLastError();
2357 }
2358 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002359 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002360#endif
2361
Daniel Veillard42595322004-11-08 10:52:06 +00002362 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002363}
2364
2365
2366static int
2367test_htmlReadDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002368 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002369
Daniel Veillarda03e3652004-11-02 18:45:30 +00002370#ifdef LIBXML_HTML_ENABLED
2371 int mem_base;
2372 htmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002373 xmlChar * cur; /* a pointer to a zero terminated string */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002374 int n_cur;
2375 const char * URL; /* the base URL to use for the document */
2376 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002377 char * encoding; /* the document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002378 int n_encoding;
2379 int options; /* a combination of htmlParserOption(s) */
2380 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002381
Daniel Veillarda03e3652004-11-02 18:45:30 +00002382 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
2383 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
2384 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2385 for (n_options = 0;n_options < gen_nb_int;n_options++) {
2386 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002387 cur = gen_const_xmlChar_ptr(n_cur, 0);
2388 URL = gen_filepath(n_URL, 1);
2389 encoding = gen_const_char_ptr(n_encoding, 2);
2390 options = gen_int(n_options, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002391
William M. Brackf13f77f2004-11-12 16:03:48 +00002392 ret_val = htmlReadDoc((const xmlChar *)cur, URL, (const char *)encoding, options);
Daniel Veillarda521d282004-11-09 14:59:59 +00002393 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002394 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00002395 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002396 des_filepath(n_URL, URL, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00002397 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002398 des_int(n_options, options, 3);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002399 xmlResetLastError();
2400 if (mem_base != xmlMemBlocks()) {
2401 printf("Leak of %d blocks found in htmlReadDoc",
2402 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002403 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002404 printf(" %d", n_cur);
2405 printf(" %d", n_URL);
2406 printf(" %d", n_encoding);
2407 printf(" %d", n_options);
2408 printf("\n");
2409 }
2410 }
2411 }
2412 }
2413 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002414 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002415#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +00002416
Daniel Veillard42595322004-11-08 10:52:06 +00002417 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002418}
2419
2420
2421static int
2422test_htmlReadFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002423 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002424
Daniel Veillarda03e3652004-11-02 18:45:30 +00002425#ifdef LIBXML_HTML_ENABLED
2426 int mem_base;
2427 htmlDocPtr ret_val;
2428 const char * filename; /* a file or URL */
2429 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002430 char * encoding; /* the document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002431 int n_encoding;
2432 int options; /* a combination of htmlParserOption(s) */
2433 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002434
Daniel Veillarda03e3652004-11-02 18:45:30 +00002435 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
2436 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2437 for (n_options = 0;n_options < gen_nb_int;n_options++) {
2438 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002439 filename = gen_filepath(n_filename, 0);
2440 encoding = gen_const_char_ptr(n_encoding, 1);
2441 options = gen_int(n_options, 2);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002442
William M. Brackf13f77f2004-11-12 16:03:48 +00002443 ret_val = htmlReadFile(filename, (const char *)encoding, options);
Daniel Veillarda521d282004-11-09 14:59:59 +00002444 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002445 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002446 des_filepath(n_filename, filename, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00002447 des_const_char_ptr(n_encoding, (const char *)encoding, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002448 des_int(n_options, options, 2);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002449 xmlResetLastError();
2450 if (mem_base != xmlMemBlocks()) {
2451 printf("Leak of %d blocks found in htmlReadFile",
2452 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002453 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002454 printf(" %d", n_filename);
2455 printf(" %d", n_encoding);
2456 printf(" %d", n_options);
2457 printf("\n");
2458 }
2459 }
2460 }
2461 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002462 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002463#endif
2464
Daniel Veillard42595322004-11-08 10:52:06 +00002465 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002466}
2467
2468
2469static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00002470test_htmlReadMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002471 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002472
Daniel Veillarda03e3652004-11-02 18:45:30 +00002473#ifdef LIBXML_HTML_ENABLED
2474 int mem_base;
2475 htmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002476 char * buffer; /* a pointer to a char array */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002477 int n_buffer;
2478 int size; /* the size of the array */
2479 int n_size;
2480 const char * URL; /* the base URL to use for the document */
2481 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002482 char * encoding; /* the document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002483 int n_encoding;
2484 int options; /* a combination of htmlParserOption(s) */
2485 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002486
Daniel Veillarda03e3652004-11-02 18:45:30 +00002487 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
2488 for (n_size = 0;n_size < gen_nb_int;n_size++) {
2489 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
2490 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2491 for (n_options = 0;n_options < gen_nb_int;n_options++) {
2492 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002493 buffer = gen_const_char_ptr(n_buffer, 0);
2494 size = gen_int(n_size, 1);
2495 URL = gen_filepath(n_URL, 2);
2496 encoding = gen_const_char_ptr(n_encoding, 3);
2497 options = gen_int(n_options, 4);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002498
William M. Brackf13f77f2004-11-12 16:03:48 +00002499 ret_val = htmlReadMemory((const char *)buffer, size, URL, (const char *)encoding, options);
Daniel Veillarda521d282004-11-09 14:59:59 +00002500 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002501 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00002502 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002503 des_int(n_size, size, 1);
2504 des_filepath(n_URL, URL, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +00002505 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002506 des_int(n_options, options, 4);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002507 xmlResetLastError();
2508 if (mem_base != xmlMemBlocks()) {
2509 printf("Leak of %d blocks found in htmlReadMemory",
2510 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002511 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002512 printf(" %d", n_buffer);
2513 printf(" %d", n_size);
2514 printf(" %d", n_URL);
2515 printf(" %d", n_encoding);
2516 printf(" %d", n_options);
2517 printf("\n");
2518 }
2519 }
2520 }
2521 }
2522 }
2523 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002524 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002525#endif
2526
Daniel Veillard42595322004-11-08 10:52:06 +00002527 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002528}
2529
2530
2531static int
2532test_htmlSAXParseDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002533 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002534
Daniel Veillardce682bc2004-11-05 17:22:25 +00002535#ifdef LIBXML_HTML_ENABLED
2536 int mem_base;
2537 htmlDocPtr ret_val;
2538 xmlChar * cur; /* a pointer to an array of xmlChar */
2539 int n_cur;
2540 char * encoding; /* a free form C string describing the HTML document encoding, or NULL */
2541 int n_encoding;
2542 htmlSAXHandlerPtr sax; /* the SAX handler block */
2543 int n_sax;
2544 void * userData; /* if using SAX, this pointer will be provided on callbacks. */
2545 int n_userData;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002546
Daniel Veillardce682bc2004-11-05 17:22:25 +00002547 for (n_cur = 0;n_cur < gen_nb_xmlChar_ptr;n_cur++) {
2548 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2549 for (n_sax = 0;n_sax < gen_nb_htmlSAXHandlerPtr;n_sax++) {
2550 for (n_userData = 0;n_userData < gen_nb_userdata;n_userData++) {
2551 mem_base = xmlMemBlocks();
2552 cur = gen_xmlChar_ptr(n_cur, 0);
2553 encoding = gen_const_char_ptr(n_encoding, 1);
2554 sax = gen_htmlSAXHandlerPtr(n_sax, 2);
2555 userData = gen_userdata(n_userData, 3);
2556
William M. Brackf13f77f2004-11-12 16:03:48 +00002557 ret_val = htmlSAXParseDoc(cur, (const char *)encoding, sax, userData);
Daniel Veillarda521d282004-11-09 14:59:59 +00002558 desret_htmlDocPtr(ret_val);
Daniel Veillardce682bc2004-11-05 17:22:25 +00002559 call_tests++;
2560 des_xmlChar_ptr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00002561 des_const_char_ptr(n_encoding, (const char *)encoding, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +00002562 des_htmlSAXHandlerPtr(n_sax, sax, 2);
2563 des_userdata(n_userData, userData, 3);
2564 xmlResetLastError();
2565 if (mem_base != xmlMemBlocks()) {
2566 printf("Leak of %d blocks found in htmlSAXParseDoc",
2567 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002568 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002569 printf(" %d", n_cur);
2570 printf(" %d", n_encoding);
2571 printf(" %d", n_sax);
2572 printf(" %d", n_userData);
2573 printf("\n");
2574 }
2575 }
2576 }
2577 }
2578 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002579 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002580#endif
2581
Daniel Veillard42595322004-11-08 10:52:06 +00002582 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002583}
2584
2585
2586static int
2587test_htmlSAXParseFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002588 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002589
Daniel Veillardce682bc2004-11-05 17:22:25 +00002590#ifdef LIBXML_HTML_ENABLED
2591 int mem_base;
2592 htmlDocPtr ret_val;
2593 const char * filename; /* the filename */
2594 int n_filename;
2595 char * encoding; /* a free form C string describing the HTML document encoding, or NULL */
2596 int n_encoding;
2597 htmlSAXHandlerPtr sax; /* the SAX handler block */
2598 int n_sax;
2599 void * userData; /* if using SAX, this pointer will be provided on callbacks. */
2600 int n_userData;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002601
Daniel Veillardce682bc2004-11-05 17:22:25 +00002602 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
2603 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2604 for (n_sax = 0;n_sax < gen_nb_htmlSAXHandlerPtr;n_sax++) {
2605 for (n_userData = 0;n_userData < gen_nb_userdata;n_userData++) {
2606 mem_base = xmlMemBlocks();
2607 filename = gen_filepath(n_filename, 0);
2608 encoding = gen_const_char_ptr(n_encoding, 1);
2609 sax = gen_htmlSAXHandlerPtr(n_sax, 2);
2610 userData = gen_userdata(n_userData, 3);
2611
William M. Brackf13f77f2004-11-12 16:03:48 +00002612 ret_val = htmlSAXParseFile(filename, (const char *)encoding, sax, userData);
Daniel Veillarda521d282004-11-09 14:59:59 +00002613 desret_htmlDocPtr(ret_val);
Daniel Veillardce682bc2004-11-05 17:22:25 +00002614 call_tests++;
2615 des_filepath(n_filename, filename, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00002616 des_const_char_ptr(n_encoding, (const char *)encoding, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +00002617 des_htmlSAXHandlerPtr(n_sax, sax, 2);
2618 des_userdata(n_userData, userData, 3);
2619 xmlResetLastError();
2620 if (mem_base != xmlMemBlocks()) {
2621 printf("Leak of %d blocks found in htmlSAXParseFile",
2622 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002623 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002624 printf(" %d", n_filename);
2625 printf(" %d", n_encoding);
2626 printf(" %d", n_sax);
2627 printf(" %d", n_userData);
2628 printf("\n");
2629 }
2630 }
2631 }
2632 }
2633 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002634 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002635#endif
2636
Daniel Veillard42595322004-11-08 10:52:06 +00002637 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002638}
2639
2640
2641static int
2642test_htmlTagLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002643 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002644
2645
2646 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00002647 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002648}
2649
2650static int
2651test_HTMLparser(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002652 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002653
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002654 if (quiet == 0) printf("Testing HTMLparser : 31 of 37 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00002655 test_ret += test_UTF8ToHtml();
2656 test_ret += test_htmlAttrAllowed();
2657 test_ret += test_htmlAutoCloseTag();
2658 test_ret += test_htmlCreateMemoryParserCtxt();
2659 test_ret += test_htmlCreatePushParserCtxt();
2660 test_ret += test_htmlCtxtReadDoc();
2661 test_ret += test_htmlCtxtReadFile();
2662 test_ret += test_htmlCtxtReadMemory();
2663 test_ret += test_htmlCtxtReset();
2664 test_ret += test_htmlCtxtUseOptions();
2665 test_ret += test_htmlElementAllowedHere();
2666 test_ret += test_htmlElementStatusHere();
2667 test_ret += test_htmlEncodeEntities();
2668 test_ret += test_htmlEntityLookup();
2669 test_ret += test_htmlEntityValueLookup();
2670 test_ret += test_htmlHandleOmittedElem();
2671 test_ret += test_htmlIsAutoClosed();
2672 test_ret += test_htmlIsScriptAttribute();
2673 test_ret += test_htmlNodeStatus();
2674 test_ret += test_htmlParseCharRef();
2675 test_ret += test_htmlParseChunk();
2676 test_ret += test_htmlParseDoc();
2677 test_ret += test_htmlParseDocument();
2678 test_ret += test_htmlParseElement();
2679 test_ret += test_htmlParseEntityRef();
2680 test_ret += test_htmlParseFile();
2681 test_ret += test_htmlReadDoc();
2682 test_ret += test_htmlReadFile();
2683 test_ret += test_htmlReadMemory();
2684 test_ret += test_htmlSAXParseDoc();
2685 test_ret += test_htmlSAXParseFile();
2686 test_ret += test_htmlTagLookup();
Daniel Veillardd93f6252004-11-02 15:53:51 +00002687
Daniel Veillard42595322004-11-08 10:52:06 +00002688 if (test_ret != 0)
2689 printf("Module HTMLparser: %d errors\n", test_ret);
2690 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002691}
2692
2693static int
2694test_htmlDocContentDumpFormatOutput(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002695 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002696
Daniel Veillard3d97e662004-11-04 10:49:00 +00002697#ifdef LIBXML_HTML_ENABLED
2698#ifdef LIBXML_OUTPUT_ENABLED
2699 int mem_base;
2700 xmlOutputBufferPtr buf; /* the HTML buffer output */
2701 int n_buf;
2702 xmlDocPtr cur; /* the document */
2703 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002704 char * encoding; /* the encoding string */
Daniel Veillard3d97e662004-11-04 10:49:00 +00002705 int n_encoding;
2706 int format; /* should formatting spaces been added */
2707 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002708
Daniel Veillard3d97e662004-11-04 10:49:00 +00002709 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
2710 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
2711 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2712 for (n_format = 0;n_format < gen_nb_int;n_format++) {
2713 mem_base = xmlMemBlocks();
2714 buf = gen_xmlOutputBufferPtr(n_buf, 0);
2715 cur = gen_xmlDocPtr(n_cur, 1);
2716 encoding = gen_const_char_ptr(n_encoding, 2);
2717 format = gen_int(n_format, 3);
2718
William M. Brackf13f77f2004-11-12 16:03:48 +00002719 htmlDocContentDumpFormatOutput(buf, cur, (const char *)encoding, format);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002720 call_tests++;
2721 des_xmlOutputBufferPtr(n_buf, buf, 0);
2722 des_xmlDocPtr(n_cur, cur, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00002723 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002724 des_int(n_format, format, 3);
2725 xmlResetLastError();
2726 if (mem_base != xmlMemBlocks()) {
2727 printf("Leak of %d blocks found in htmlDocContentDumpFormatOutput",
2728 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002729 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002730 printf(" %d", n_buf);
2731 printf(" %d", n_cur);
2732 printf(" %d", n_encoding);
2733 printf(" %d", n_format);
2734 printf("\n");
2735 }
2736 }
2737 }
2738 }
2739 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002740 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002741#endif
2742#endif
2743
Daniel Veillard42595322004-11-08 10:52:06 +00002744 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002745}
2746
2747
2748static int
2749test_htmlDocContentDumpOutput(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002750 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002751
Daniel Veillard3d97e662004-11-04 10:49:00 +00002752#ifdef LIBXML_HTML_ENABLED
2753#ifdef LIBXML_OUTPUT_ENABLED
2754 int mem_base;
2755 xmlOutputBufferPtr buf; /* the HTML buffer output */
2756 int n_buf;
2757 xmlDocPtr cur; /* the document */
2758 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002759 char * encoding; /* the encoding string */
Daniel Veillard3d97e662004-11-04 10:49:00 +00002760 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002761
Daniel Veillard3d97e662004-11-04 10:49:00 +00002762 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
2763 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
2764 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2765 mem_base = xmlMemBlocks();
2766 buf = gen_xmlOutputBufferPtr(n_buf, 0);
2767 cur = gen_xmlDocPtr(n_cur, 1);
2768 encoding = gen_const_char_ptr(n_encoding, 2);
2769
William M. Brackf13f77f2004-11-12 16:03:48 +00002770 htmlDocContentDumpOutput(buf, cur, (const char *)encoding);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002771 call_tests++;
2772 des_xmlOutputBufferPtr(n_buf, buf, 0);
2773 des_xmlDocPtr(n_cur, cur, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00002774 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002775 xmlResetLastError();
2776 if (mem_base != xmlMemBlocks()) {
2777 printf("Leak of %d blocks found in htmlDocContentDumpOutput",
2778 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002779 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002780 printf(" %d", n_buf);
2781 printf(" %d", n_cur);
2782 printf(" %d", n_encoding);
2783 printf("\n");
2784 }
2785 }
2786 }
2787 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002788 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002789#endif
2790#endif
2791
Daniel Veillard42595322004-11-08 10:52:06 +00002792 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002793}
2794
2795
2796static int
2797test_htmlDocDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002798 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002799
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00002800#ifdef LIBXML_HTML_ENABLED
2801#ifdef LIBXML_OUTPUT_ENABLED
2802 int mem_base;
2803 int ret_val;
2804 FILE * f; /* the FILE* */
2805 int n_f;
2806 xmlDocPtr cur; /* the document */
2807 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002808
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00002809 for (n_f = 0;n_f < gen_nb_FILE_ptr;n_f++) {
2810 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
2811 mem_base = xmlMemBlocks();
2812 f = gen_FILE_ptr(n_f, 0);
2813 cur = gen_xmlDocPtr(n_cur, 1);
2814
2815 ret_val = htmlDocDump(f, cur);
2816 desret_int(ret_val);
2817 call_tests++;
2818 des_FILE_ptr(n_f, f, 0);
2819 des_xmlDocPtr(n_cur, cur, 1);
2820 xmlResetLastError();
2821 if (mem_base != xmlMemBlocks()) {
2822 printf("Leak of %d blocks found in htmlDocDump",
2823 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002824 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00002825 printf(" %d", n_f);
2826 printf(" %d", n_cur);
2827 printf("\n");
2828 }
2829 }
2830 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002831 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00002832#endif
2833#endif
2834
Daniel Veillard42595322004-11-08 10:52:06 +00002835 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002836}
2837
2838
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00002839#define gen_nb_xmlChar_ptr_ptr 1
2840static xmlChar ** gen_xmlChar_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
2841 return(NULL);
2842}
2843static void des_xmlChar_ptr_ptr(int no ATTRIBUTE_UNUSED, xmlChar ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
2844}
2845
Daniel Veillardd93f6252004-11-02 15:53:51 +00002846static int
2847test_htmlDocDumpMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002848 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002849
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00002850#ifdef LIBXML_HTML_ENABLED
2851#ifdef LIBXML_OUTPUT_ENABLED
2852 int mem_base;
2853 xmlDocPtr cur; /* the document */
2854 int n_cur;
2855 xmlChar ** mem; /* OUT: the memory pointer */
2856 int n_mem;
2857 int * size; /* OUT: the memory length */
2858 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002859
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00002860 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
2861 for (n_mem = 0;n_mem < gen_nb_xmlChar_ptr_ptr;n_mem++) {
2862 for (n_size = 0;n_size < gen_nb_int_ptr;n_size++) {
2863 mem_base = xmlMemBlocks();
2864 cur = gen_xmlDocPtr(n_cur, 0);
2865 mem = gen_xmlChar_ptr_ptr(n_mem, 1);
2866 size = gen_int_ptr(n_size, 2);
2867
2868 htmlDocDumpMemory(cur, mem, size);
2869 call_tests++;
2870 des_xmlDocPtr(n_cur, cur, 0);
2871 des_xmlChar_ptr_ptr(n_mem, mem, 1);
2872 des_int_ptr(n_size, size, 2);
2873 xmlResetLastError();
2874 if (mem_base != xmlMemBlocks()) {
2875 printf("Leak of %d blocks found in htmlDocDumpMemory",
2876 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002877 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00002878 printf(" %d", n_cur);
2879 printf(" %d", n_mem);
2880 printf(" %d", n_size);
2881 printf("\n");
2882 }
2883 }
2884 }
2885 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002886 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00002887#endif
2888#endif
2889
Daniel Veillard42595322004-11-08 10:52:06 +00002890 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002891}
2892
2893
2894static int
2895test_htmlGetMetaEncoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002896 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002897
Daniel Veillardd005b9e2004-11-03 17:07:05 +00002898#ifdef LIBXML_HTML_ENABLED
2899 int mem_base;
2900 const xmlChar * ret_val;
2901 htmlDocPtr doc; /* the document */
2902 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002903
Daniel Veillarda521d282004-11-09 14:59:59 +00002904 for (n_doc = 0;n_doc < gen_nb_htmlDocPtr;n_doc++) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +00002905 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00002906 doc = gen_htmlDocPtr(n_doc, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00002907
2908 ret_val = htmlGetMetaEncoding(doc);
2909 desret_const_xmlChar_ptr(ret_val);
2910 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00002911 des_htmlDocPtr(n_doc, doc, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00002912 xmlResetLastError();
2913 if (mem_base != xmlMemBlocks()) {
2914 printf("Leak of %d blocks found in htmlGetMetaEncoding",
2915 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002916 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00002917 printf(" %d", n_doc);
2918 printf("\n");
2919 }
2920 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002921 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00002922#endif
2923
Daniel Veillard42595322004-11-08 10:52:06 +00002924 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002925}
2926
2927
2928static int
2929test_htmlIsBooleanAttr(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002930 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002931
2932#ifdef LIBXML_HTML_ENABLED
2933 int mem_base;
2934 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002935 xmlChar * name; /* the name of the attribute to check */
Daniel Veillardd93f6252004-11-02 15:53:51 +00002936 int n_name;
2937
2938 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
2939 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002940 name = gen_const_xmlChar_ptr(n_name, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002941
William M. Brackf13f77f2004-11-12 16:03:48 +00002942 ret_val = htmlIsBooleanAttr((const xmlChar *)name);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002943 desret_int(ret_val);
2944 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00002945 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002946 xmlResetLastError();
2947 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00002948 printf("Leak of %d blocks found in htmlIsBooleanAttr",
Daniel Veillardd93f6252004-11-02 15:53:51 +00002949 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002950 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002951 printf(" %d", n_name);
2952 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00002953 }
2954 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002955 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002956#endif
2957
Daniel Veillard42595322004-11-08 10:52:06 +00002958 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002959}
2960
2961
2962static int
2963test_htmlNewDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002964 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002965
Daniel Veillarda03e3652004-11-02 18:45:30 +00002966#ifdef LIBXML_HTML_ENABLED
2967 int mem_base;
2968 htmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002969 xmlChar * URI; /* URI for the dtd, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002970 int n_URI;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002971 xmlChar * ExternalID; /* the external ID of the DTD, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002972 int n_ExternalID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002973
Daniel Veillarda03e3652004-11-02 18:45:30 +00002974 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
2975 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
2976 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002977 URI = gen_const_xmlChar_ptr(n_URI, 0);
2978 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002979
William M. Brackf13f77f2004-11-12 16:03:48 +00002980 ret_val = htmlNewDoc((const xmlChar *)URI, (const xmlChar *)ExternalID);
Daniel Veillarda521d282004-11-09 14:59:59 +00002981 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002982 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00002983 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 0);
2984 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002985 xmlResetLastError();
2986 if (mem_base != xmlMemBlocks()) {
2987 printf("Leak of %d blocks found in htmlNewDoc",
2988 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002989 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002990 printf(" %d", n_URI);
2991 printf(" %d", n_ExternalID);
2992 printf("\n");
2993 }
2994 }
2995 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002996 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002997#endif
2998
Daniel Veillard42595322004-11-08 10:52:06 +00002999 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003000}
3001
3002
3003static int
3004test_htmlNewDocNoDtD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003005 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003006
Daniel Veillarda03e3652004-11-02 18:45:30 +00003007#ifdef LIBXML_HTML_ENABLED
3008 int mem_base;
3009 htmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003010 xmlChar * URI; /* URI for the dtd, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00003011 int n_URI;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003012 xmlChar * ExternalID; /* the external ID of the DTD, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00003013 int n_ExternalID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003014
Daniel Veillarda03e3652004-11-02 18:45:30 +00003015 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
3016 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
3017 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00003018 URI = gen_const_xmlChar_ptr(n_URI, 0);
3019 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003020
William M. Brackf13f77f2004-11-12 16:03:48 +00003021 ret_val = htmlNewDocNoDtD((const xmlChar *)URI, (const xmlChar *)ExternalID);
Daniel Veillarda521d282004-11-09 14:59:59 +00003022 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003023 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00003024 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 0);
3025 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003026 xmlResetLastError();
3027 if (mem_base != xmlMemBlocks()) {
3028 printf("Leak of %d blocks found in htmlNewDocNoDtD",
3029 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003030 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003031 printf(" %d", n_URI);
3032 printf(" %d", n_ExternalID);
3033 printf("\n");
3034 }
3035 }
3036 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003037 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003038#endif
3039
Daniel Veillard42595322004-11-08 10:52:06 +00003040 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003041}
3042
3043
3044static int
3045test_htmlNodeDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003046 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003047
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003048#ifdef LIBXML_HTML_ENABLED
3049#ifdef LIBXML_OUTPUT_ENABLED
3050 int mem_base;
3051 int ret_val;
3052 xmlBufferPtr buf; /* the HTML buffer output */
3053 int n_buf;
3054 xmlDocPtr doc; /* the document */
3055 int n_doc;
3056 xmlNodePtr cur; /* the current node */
3057 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003058
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003059 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
3060 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
3061 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
3062 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00003063 buf = gen_xmlBufferPtr(n_buf, 0);
3064 doc = gen_xmlDocPtr(n_doc, 1);
3065 cur = gen_xmlNodePtr(n_cur, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003066
3067 ret_val = htmlNodeDump(buf, doc, cur);
3068 desret_int(ret_val);
3069 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003070 des_xmlBufferPtr(n_buf, buf, 0);
3071 des_xmlDocPtr(n_doc, doc, 1);
3072 des_xmlNodePtr(n_cur, cur, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003073 xmlResetLastError();
3074 if (mem_base != xmlMemBlocks()) {
3075 printf("Leak of %d blocks found in htmlNodeDump",
3076 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003077 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003078 printf(" %d", n_buf);
3079 printf(" %d", n_doc);
3080 printf(" %d", n_cur);
3081 printf("\n");
3082 }
3083 }
3084 }
3085 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003086 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003087#endif
3088#endif
3089
Daniel Veillard42595322004-11-08 10:52:06 +00003090 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003091}
3092
3093
3094static int
3095test_htmlNodeDumpFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003096 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003097
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003098#ifdef LIBXML_HTML_ENABLED
3099#ifdef LIBXML_OUTPUT_ENABLED
3100 int mem_base;
3101 FILE * out; /* the FILE pointer */
3102 int n_out;
3103 xmlDocPtr doc; /* the document */
3104 int n_doc;
3105 xmlNodePtr cur; /* the current node */
3106 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003107
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003108 for (n_out = 0;n_out < gen_nb_FILE_ptr;n_out++) {
3109 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
3110 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
3111 mem_base = xmlMemBlocks();
3112 out = gen_FILE_ptr(n_out, 0);
3113 doc = gen_xmlDocPtr(n_doc, 1);
3114 cur = gen_xmlNodePtr(n_cur, 2);
3115
3116 htmlNodeDumpFile(out, doc, cur);
3117 call_tests++;
3118 des_FILE_ptr(n_out, out, 0);
3119 des_xmlDocPtr(n_doc, doc, 1);
3120 des_xmlNodePtr(n_cur, cur, 2);
3121 xmlResetLastError();
3122 if (mem_base != xmlMemBlocks()) {
3123 printf("Leak of %d blocks found in htmlNodeDumpFile",
3124 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003125 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003126 printf(" %d", n_out);
3127 printf(" %d", n_doc);
3128 printf(" %d", n_cur);
3129 printf("\n");
3130 }
3131 }
3132 }
3133 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003134 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003135#endif
3136#endif
3137
Daniel Veillard42595322004-11-08 10:52:06 +00003138 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003139}
3140
3141
3142static int
3143test_htmlNodeDumpFileFormat(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003144 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003145
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003146#ifdef LIBXML_HTML_ENABLED
3147#ifdef LIBXML_OUTPUT_ENABLED
3148 int mem_base;
3149 int ret_val;
3150 FILE * out; /* the FILE pointer */
3151 int n_out;
3152 xmlDocPtr doc; /* the document */
3153 int n_doc;
3154 xmlNodePtr cur; /* the current node */
3155 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003156 char * encoding; /* the document encoding */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003157 int n_encoding;
3158 int format; /* should formatting spaces been added */
3159 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003160
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003161 for (n_out = 0;n_out < gen_nb_FILE_ptr;n_out++) {
3162 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
3163 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
3164 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
3165 for (n_format = 0;n_format < gen_nb_int;n_format++) {
3166 mem_base = xmlMemBlocks();
3167 out = gen_FILE_ptr(n_out, 0);
3168 doc = gen_xmlDocPtr(n_doc, 1);
3169 cur = gen_xmlNodePtr(n_cur, 2);
3170 encoding = gen_const_char_ptr(n_encoding, 3);
3171 format = gen_int(n_format, 4);
3172
William M. Brackf13f77f2004-11-12 16:03:48 +00003173 ret_val = htmlNodeDumpFileFormat(out, doc, cur, (const char *)encoding, format);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003174 desret_int(ret_val);
3175 call_tests++;
3176 des_FILE_ptr(n_out, out, 0);
3177 des_xmlDocPtr(n_doc, doc, 1);
3178 des_xmlNodePtr(n_cur, cur, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +00003179 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003180 des_int(n_format, format, 4);
3181 xmlResetLastError();
3182 if (mem_base != xmlMemBlocks()) {
3183 printf("Leak of %d blocks found in htmlNodeDumpFileFormat",
3184 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003185 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003186 printf(" %d", n_out);
3187 printf(" %d", n_doc);
3188 printf(" %d", n_cur);
3189 printf(" %d", n_encoding);
3190 printf(" %d", n_format);
3191 printf("\n");
3192 }
3193 }
3194 }
3195 }
3196 }
3197 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003198 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003199#endif
3200#endif
3201
Daniel Veillard42595322004-11-08 10:52:06 +00003202 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003203}
3204
3205
3206static int
3207test_htmlNodeDumpFormatOutput(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003208 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003209
Daniel Veillard3d97e662004-11-04 10:49:00 +00003210#ifdef LIBXML_HTML_ENABLED
3211#ifdef LIBXML_OUTPUT_ENABLED
3212 int mem_base;
3213 xmlOutputBufferPtr buf; /* the HTML buffer output */
3214 int n_buf;
3215 xmlDocPtr doc; /* the document */
3216 int n_doc;
3217 xmlNodePtr cur; /* the current node */
3218 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003219 char * encoding; /* the encoding string */
Daniel Veillard3d97e662004-11-04 10:49:00 +00003220 int n_encoding;
3221 int format; /* should formatting spaces been added */
3222 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003223
Daniel Veillard3d97e662004-11-04 10:49:00 +00003224 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
3225 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
3226 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
3227 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
3228 for (n_format = 0;n_format < gen_nb_int;n_format++) {
3229 mem_base = xmlMemBlocks();
3230 buf = gen_xmlOutputBufferPtr(n_buf, 0);
3231 doc = gen_xmlDocPtr(n_doc, 1);
3232 cur = gen_xmlNodePtr(n_cur, 2);
3233 encoding = gen_const_char_ptr(n_encoding, 3);
3234 format = gen_int(n_format, 4);
3235
William M. Brackf13f77f2004-11-12 16:03:48 +00003236 htmlNodeDumpFormatOutput(buf, doc, cur, (const char *)encoding, format);
Daniel Veillard3d97e662004-11-04 10:49:00 +00003237 call_tests++;
3238 des_xmlOutputBufferPtr(n_buf, buf, 0);
3239 des_xmlDocPtr(n_doc, doc, 1);
3240 des_xmlNodePtr(n_cur, cur, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +00003241 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard3d97e662004-11-04 10:49:00 +00003242 des_int(n_format, format, 4);
3243 xmlResetLastError();
3244 if (mem_base != xmlMemBlocks()) {
3245 printf("Leak of %d blocks found in htmlNodeDumpFormatOutput",
3246 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003247 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003248 printf(" %d", n_buf);
3249 printf(" %d", n_doc);
3250 printf(" %d", n_cur);
3251 printf(" %d", n_encoding);
3252 printf(" %d", n_format);
3253 printf("\n");
3254 }
3255 }
3256 }
3257 }
3258 }
3259 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003260 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003261#endif
3262#endif
3263
Daniel Veillard42595322004-11-08 10:52:06 +00003264 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003265}
3266
3267
3268static int
3269test_htmlNodeDumpOutput(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003270 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003271
Daniel Veillard3d97e662004-11-04 10:49:00 +00003272#ifdef LIBXML_HTML_ENABLED
3273#ifdef LIBXML_OUTPUT_ENABLED
3274 int mem_base;
3275 xmlOutputBufferPtr buf; /* the HTML buffer output */
3276 int n_buf;
3277 xmlDocPtr doc; /* the document */
3278 int n_doc;
3279 xmlNodePtr cur; /* the current node */
3280 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003281 char * encoding; /* the encoding string */
Daniel Veillard3d97e662004-11-04 10:49:00 +00003282 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003283
Daniel Veillard3d97e662004-11-04 10:49:00 +00003284 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
3285 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
3286 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
3287 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
3288 mem_base = xmlMemBlocks();
3289 buf = gen_xmlOutputBufferPtr(n_buf, 0);
3290 doc = gen_xmlDocPtr(n_doc, 1);
3291 cur = gen_xmlNodePtr(n_cur, 2);
3292 encoding = gen_const_char_ptr(n_encoding, 3);
3293
William M. Brackf13f77f2004-11-12 16:03:48 +00003294 htmlNodeDumpOutput(buf, doc, cur, (const char *)encoding);
Daniel Veillard3d97e662004-11-04 10:49:00 +00003295 call_tests++;
3296 des_xmlOutputBufferPtr(n_buf, buf, 0);
3297 des_xmlDocPtr(n_doc, doc, 1);
3298 des_xmlNodePtr(n_cur, cur, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +00003299 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard3d97e662004-11-04 10:49:00 +00003300 xmlResetLastError();
3301 if (mem_base != xmlMemBlocks()) {
3302 printf("Leak of %d blocks found in htmlNodeDumpOutput",
3303 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003304 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003305 printf(" %d", n_buf);
3306 printf(" %d", n_doc);
3307 printf(" %d", n_cur);
3308 printf(" %d", n_encoding);
3309 printf("\n");
3310 }
3311 }
3312 }
3313 }
3314 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003315 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003316#endif
3317#endif
3318
Daniel Veillard42595322004-11-08 10:52:06 +00003319 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003320}
3321
3322
3323static int
3324test_htmlSaveFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003325 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003326
3327#ifdef LIBXML_HTML_ENABLED
3328#ifdef LIBXML_OUTPUT_ENABLED
3329 int mem_base;
3330 int ret_val;
3331 const char * filename; /* the filename (or URL) */
3332 int n_filename;
3333 xmlDocPtr cur; /* the document */
3334 int n_cur;
3335
3336 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
3337 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
3338 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00003339 filename = gen_fileoutput(n_filename, 0);
3340 cur = gen_xmlDocPtr(n_cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003341
3342 ret_val = htmlSaveFile(filename, cur);
3343 desret_int(ret_val);
3344 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003345 des_fileoutput(n_filename, filename, 0);
3346 des_xmlDocPtr(n_cur, cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003347 xmlResetLastError();
3348 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00003349 printf("Leak of %d blocks found in htmlSaveFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +00003350 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003351 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003352 printf(" %d", n_filename);
3353 printf(" %d", n_cur);
3354 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00003355 }
3356 }
3357 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003358 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003359#endif
3360#endif
3361
Daniel Veillard42595322004-11-08 10:52:06 +00003362 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003363}
3364
3365
3366static int
3367test_htmlSaveFileEnc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003368 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003369
3370#ifdef LIBXML_HTML_ENABLED
3371#ifdef LIBXML_OUTPUT_ENABLED
3372 int mem_base;
3373 int ret_val;
3374 const char * filename; /* the filename */
3375 int n_filename;
3376 xmlDocPtr cur; /* the document */
3377 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003378 char * encoding; /* the document encoding */
Daniel Veillardd93f6252004-11-02 15:53:51 +00003379 int n_encoding;
3380
3381 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
3382 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
3383 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
3384 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00003385 filename = gen_fileoutput(n_filename, 0);
3386 cur = gen_xmlDocPtr(n_cur, 1);
3387 encoding = gen_const_char_ptr(n_encoding, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003388
William M. Brackf13f77f2004-11-12 16:03:48 +00003389 ret_val = htmlSaveFileEnc(filename, cur, (const char *)encoding);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003390 desret_int(ret_val);
3391 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003392 des_fileoutput(n_filename, filename, 0);
3393 des_xmlDocPtr(n_cur, cur, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00003394 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003395 xmlResetLastError();
3396 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00003397 printf("Leak of %d blocks found in htmlSaveFileEnc",
Daniel Veillardd93f6252004-11-02 15:53:51 +00003398 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003399 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003400 printf(" %d", n_filename);
3401 printf(" %d", n_cur);
3402 printf(" %d", n_encoding);
3403 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00003404 }
3405 }
3406 }
3407 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003408 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003409#endif
3410#endif
3411
Daniel Veillard42595322004-11-08 10:52:06 +00003412 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003413}
3414
3415
3416static int
3417test_htmlSaveFileFormat(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003418 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003419
3420#ifdef LIBXML_HTML_ENABLED
3421#ifdef LIBXML_OUTPUT_ENABLED
3422 int mem_base;
3423 int ret_val;
3424 const char * filename; /* the filename */
3425 int n_filename;
3426 xmlDocPtr cur; /* the document */
3427 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003428 char * encoding; /* the document encoding */
Daniel Veillardd93f6252004-11-02 15:53:51 +00003429 int n_encoding;
3430 int format; /* should formatting spaces been added */
3431 int n_format;
3432
3433 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
3434 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
3435 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
3436 for (n_format = 0;n_format < gen_nb_int;n_format++) {
3437 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00003438 filename = gen_fileoutput(n_filename, 0);
3439 cur = gen_xmlDocPtr(n_cur, 1);
3440 encoding = gen_const_char_ptr(n_encoding, 2);
3441 format = gen_int(n_format, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003442
William M. Brackf13f77f2004-11-12 16:03:48 +00003443 ret_val = htmlSaveFileFormat(filename, cur, (const char *)encoding, format);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003444 desret_int(ret_val);
3445 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003446 des_fileoutput(n_filename, filename, 0);
3447 des_xmlDocPtr(n_cur, cur, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00003448 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +00003449 des_int(n_format, format, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003450 xmlResetLastError();
3451 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00003452 printf("Leak of %d blocks found in htmlSaveFileFormat",
Daniel Veillardd93f6252004-11-02 15:53:51 +00003453 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003454 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003455 printf(" %d", n_filename);
3456 printf(" %d", n_cur);
3457 printf(" %d", n_encoding);
3458 printf(" %d", n_format);
3459 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00003460 }
3461 }
3462 }
3463 }
3464 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003465 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003466#endif
3467#endif
3468
Daniel Veillard42595322004-11-08 10:52:06 +00003469 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003470}
3471
3472
3473static int
3474test_htmlSetMetaEncoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003475 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003476
Daniel Veillarda03e3652004-11-02 18:45:30 +00003477#ifdef LIBXML_HTML_ENABLED
3478 int mem_base;
3479 int ret_val;
3480 htmlDocPtr doc; /* the document */
3481 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003482 xmlChar * encoding; /* the encoding string */
Daniel Veillarda03e3652004-11-02 18:45:30 +00003483 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003484
Daniel Veillarda521d282004-11-09 14:59:59 +00003485 for (n_doc = 0;n_doc < gen_nb_htmlDocPtr;n_doc++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00003486 for (n_encoding = 0;n_encoding < gen_nb_const_xmlChar_ptr;n_encoding++) {
3487 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00003488 doc = gen_htmlDocPtr(n_doc, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00003489 encoding = gen_const_xmlChar_ptr(n_encoding, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003490
William M. Brackf13f77f2004-11-12 16:03:48 +00003491 ret_val = htmlSetMetaEncoding(doc, (const xmlChar *)encoding);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003492 desret_int(ret_val);
3493 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00003494 des_htmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00003495 des_const_xmlChar_ptr(n_encoding, (const xmlChar *)encoding, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003496 xmlResetLastError();
3497 if (mem_base != xmlMemBlocks()) {
3498 printf("Leak of %d blocks found in htmlSetMetaEncoding",
3499 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003500 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003501 printf(" %d", n_doc);
3502 printf(" %d", n_encoding);
3503 printf("\n");
3504 }
3505 }
3506 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003507 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003508#endif
3509
Daniel Veillard42595322004-11-08 10:52:06 +00003510 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003511}
3512
3513static int
3514test_HTMLtree(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003515 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003516
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003517 if (quiet == 0) printf("Testing HTMLtree : 17 of 17 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00003518 test_ret += test_htmlDocContentDumpFormatOutput();
3519 test_ret += test_htmlDocContentDumpOutput();
3520 test_ret += test_htmlDocDump();
3521 test_ret += test_htmlDocDumpMemory();
3522 test_ret += test_htmlGetMetaEncoding();
3523 test_ret += test_htmlIsBooleanAttr();
3524 test_ret += test_htmlNewDoc();
3525 test_ret += test_htmlNewDocNoDtD();
3526 test_ret += test_htmlNodeDump();
3527 test_ret += test_htmlNodeDumpFile();
3528 test_ret += test_htmlNodeDumpFileFormat();
3529 test_ret += test_htmlNodeDumpFormatOutput();
3530 test_ret += test_htmlNodeDumpOutput();
3531 test_ret += test_htmlSaveFile();
3532 test_ret += test_htmlSaveFileEnc();
3533 test_ret += test_htmlSaveFileFormat();
3534 test_ret += test_htmlSetMetaEncoding();
Daniel Veillardd93f6252004-11-02 15:53:51 +00003535
Daniel Veillard42595322004-11-08 10:52:06 +00003536 if (test_ret != 0)
3537 printf("Module HTMLtree: %d errors\n", test_ret);
3538 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003539}
3540
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003541static int
3542test_docbDefaultSAXHandlerInit(void) {
3543 int test_ret = 0;
3544
Daniel Veillarda521d282004-11-09 14:59:59 +00003545#ifdef LIBXML_DOCB_ENABLED
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003546 int mem_base;
3547
3548 mem_base = xmlMemBlocks();
3549
3550 docbDefaultSAXHandlerInit();
3551 call_tests++;
3552 xmlResetLastError();
3553 if (mem_base != xmlMemBlocks()) {
3554 printf("Leak of %d blocks found in docbDefaultSAXHandlerInit",
3555 xmlMemBlocks() - mem_base);
3556 test_ret++;
3557 printf("\n");
3558 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003559 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00003560#endif
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003561
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003562 return(test_ret);
3563}
3564
3565
3566static int
3567test_htmlDefaultSAXHandlerInit(void) {
3568 int test_ret = 0;
3569
Daniel Veillarda521d282004-11-09 14:59:59 +00003570#ifdef LIBXML_HTML_ENABLED
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003571 int mem_base;
3572
3573 mem_base = xmlMemBlocks();
3574
3575 htmlDefaultSAXHandlerInit();
3576 call_tests++;
3577 xmlResetLastError();
3578 if (mem_base != xmlMemBlocks()) {
3579 printf("Leak of %d blocks found in htmlDefaultSAXHandlerInit",
3580 xmlMemBlocks() - mem_base);
3581 test_ret++;
3582 printf("\n");
3583 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003584 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00003585#endif
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003586
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003587 return(test_ret);
3588}
3589
3590
3591static int
3592test_xmlDefaultSAXHandlerInit(void) {
3593 int test_ret = 0;
3594
3595 int mem_base;
3596
3597 mem_base = xmlMemBlocks();
3598
3599 xmlDefaultSAXHandlerInit();
3600 call_tests++;
3601 xmlResetLastError();
3602 if (mem_base != xmlMemBlocks()) {
3603 printf("Leak of %d blocks found in xmlDefaultSAXHandlerInit",
3604 xmlMemBlocks() - mem_base);
3605 test_ret++;
3606 printf("\n");
3607 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003608 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003609
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003610 return(test_ret);
3611}
3612
3613
3614#define gen_nb_xmlEnumerationPtr 1
3615static xmlEnumerationPtr gen_xmlEnumerationPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
3616 return(NULL);
3617}
3618static void des_xmlEnumerationPtr(int no ATTRIBUTE_UNUSED, xmlEnumerationPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
3619}
3620
3621static int
3622test_xmlSAX2AttributeDecl(void) {
3623 int test_ret = 0;
3624
3625 int mem_base;
3626 void * ctx; /* the user data (XML parser context) */
3627 int n_ctx;
3628 xmlChar * elem; /* the name of the element */
3629 int n_elem;
3630 xmlChar * fullname; /* the attribute name */
3631 int n_fullname;
3632 int type; /* the attribute type */
3633 int n_type;
3634 int def; /* the type of default value */
3635 int n_def;
3636 xmlChar * defaultValue; /* the attribute default value */
3637 int n_defaultValue;
3638 xmlEnumerationPtr tree; /* the tree of enumerated value set */
3639 int n_tree;
3640
3641 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
3642 for (n_elem = 0;n_elem < gen_nb_const_xmlChar_ptr;n_elem++) {
3643 for (n_fullname = 0;n_fullname < gen_nb_const_xmlChar_ptr;n_fullname++) {
3644 for (n_type = 0;n_type < gen_nb_int;n_type++) {
3645 for (n_def = 0;n_def < gen_nb_int;n_def++) {
3646 for (n_defaultValue = 0;n_defaultValue < gen_nb_const_xmlChar_ptr;n_defaultValue++) {
3647 for (n_tree = 0;n_tree < gen_nb_xmlEnumerationPtr;n_tree++) {
3648 mem_base = xmlMemBlocks();
3649 ctx = gen_void_ptr(n_ctx, 0);
3650 elem = gen_const_xmlChar_ptr(n_elem, 1);
3651 fullname = gen_const_xmlChar_ptr(n_fullname, 2);
3652 type = gen_int(n_type, 3);
3653 def = gen_int(n_def, 4);
3654 defaultValue = gen_const_xmlChar_ptr(n_defaultValue, 5);
3655 tree = gen_xmlEnumerationPtr(n_tree, 6);
3656
William M. Brackf13f77f2004-11-12 16:03:48 +00003657 xmlSAX2AttributeDecl(ctx, (const xmlChar *)elem, (const xmlChar *)fullname, type, def, (const xmlChar *)defaultValue, tree);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003658 call_tests++;
3659 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00003660 des_const_xmlChar_ptr(n_elem, (const xmlChar *)elem, 1);
3661 des_const_xmlChar_ptr(n_fullname, (const xmlChar *)fullname, 2);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003662 des_int(n_type, type, 3);
3663 des_int(n_def, def, 4);
William M. Brackf13f77f2004-11-12 16:03:48 +00003664 des_const_xmlChar_ptr(n_defaultValue, (const xmlChar *)defaultValue, 5);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003665 des_xmlEnumerationPtr(n_tree, tree, 6);
3666 xmlResetLastError();
3667 if (mem_base != xmlMemBlocks()) {
3668 printf("Leak of %d blocks found in xmlSAX2AttributeDecl",
3669 xmlMemBlocks() - mem_base);
3670 test_ret++;
3671 printf(" %d", n_ctx);
3672 printf(" %d", n_elem);
3673 printf(" %d", n_fullname);
3674 printf(" %d", n_type);
3675 printf(" %d", n_def);
3676 printf(" %d", n_defaultValue);
3677 printf(" %d", n_tree);
3678 printf("\n");
3679 }
3680 }
3681 }
3682 }
3683 }
3684 }
3685 }
3686 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003687 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003688
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003689 return(test_ret);
3690}
3691
3692
3693static int
3694test_xmlSAX2CDataBlock(void) {
3695 int test_ret = 0;
3696
3697 int mem_base;
3698 void * ctx; /* the user data (XML parser context) */
3699 int n_ctx;
3700 xmlChar * value; /* The pcdata content */
3701 int n_value;
3702 int len; /* the block length */
3703 int n_len;
3704
3705 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
3706 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
3707 for (n_len = 0;n_len < gen_nb_int;n_len++) {
3708 mem_base = xmlMemBlocks();
3709 ctx = gen_void_ptr(n_ctx, 0);
3710 value = gen_const_xmlChar_ptr(n_value, 1);
3711 len = gen_int(n_len, 2);
3712
William M. Brackf13f77f2004-11-12 16:03:48 +00003713 xmlSAX2CDataBlock(ctx, (const xmlChar *)value, len);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003714 call_tests++;
3715 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00003716 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003717 des_int(n_len, len, 2);
3718 xmlResetLastError();
3719 if (mem_base != xmlMemBlocks()) {
3720 printf("Leak of %d blocks found in xmlSAX2CDataBlock",
3721 xmlMemBlocks() - mem_base);
3722 test_ret++;
3723 printf(" %d", n_ctx);
3724 printf(" %d", n_value);
3725 printf(" %d", n_len);
3726 printf("\n");
3727 }
3728 }
3729 }
3730 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003731 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003732
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003733 return(test_ret);
3734}
3735
3736
3737static int
3738test_xmlSAX2Characters(void) {
3739 int test_ret = 0;
3740
3741 int mem_base;
3742 void * ctx; /* the user data (XML parser context) */
3743 int n_ctx;
3744 xmlChar * ch; /* a xmlChar string */
3745 int n_ch;
3746 int len; /* the number of xmlChar */
3747 int n_len;
3748
3749 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
3750 for (n_ch = 0;n_ch < gen_nb_const_xmlChar_ptr;n_ch++) {
3751 for (n_len = 0;n_len < gen_nb_int;n_len++) {
3752 mem_base = xmlMemBlocks();
3753 ctx = gen_void_ptr(n_ctx, 0);
3754 ch = gen_const_xmlChar_ptr(n_ch, 1);
3755 len = gen_int(n_len, 2);
3756
William M. Brackf13f77f2004-11-12 16:03:48 +00003757 xmlSAX2Characters(ctx, (const xmlChar *)ch, len);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003758 call_tests++;
3759 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00003760 des_const_xmlChar_ptr(n_ch, (const xmlChar *)ch, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003761 des_int(n_len, len, 2);
3762 xmlResetLastError();
3763 if (mem_base != xmlMemBlocks()) {
3764 printf("Leak of %d blocks found in xmlSAX2Characters",
3765 xmlMemBlocks() - mem_base);
3766 test_ret++;
3767 printf(" %d", n_ctx);
3768 printf(" %d", n_ch);
3769 printf(" %d", n_len);
3770 printf("\n");
3771 }
3772 }
3773 }
3774 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003775 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003776
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003777 return(test_ret);
3778}
3779
3780
3781static int
3782test_xmlSAX2Comment(void) {
3783 int test_ret = 0;
3784
3785 int mem_base;
3786 void * ctx; /* the user data (XML parser context) */
3787 int n_ctx;
3788 xmlChar * value; /* the xmlSAX2Comment content */
3789 int n_value;
3790
3791 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
3792 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
3793 mem_base = xmlMemBlocks();
3794 ctx = gen_void_ptr(n_ctx, 0);
3795 value = gen_const_xmlChar_ptr(n_value, 1);
3796
William M. Brackf13f77f2004-11-12 16:03:48 +00003797 xmlSAX2Comment(ctx, (const xmlChar *)value);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003798 call_tests++;
3799 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00003800 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003801 xmlResetLastError();
3802 if (mem_base != xmlMemBlocks()) {
3803 printf("Leak of %d blocks found in xmlSAX2Comment",
3804 xmlMemBlocks() - mem_base);
3805 test_ret++;
3806 printf(" %d", n_ctx);
3807 printf(" %d", n_value);
3808 printf("\n");
3809 }
3810 }
3811 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003812 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003813
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003814 return(test_ret);
3815}
3816
3817
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003818static int
3819test_xmlSAX2ElementDecl(void) {
3820 int test_ret = 0;
3821
3822 int mem_base;
3823 void * ctx; /* the user data (XML parser context) */
3824 int n_ctx;
3825 xmlChar * name; /* the element name */
3826 int n_name;
3827 int type; /* the element type */
3828 int n_type;
3829 xmlElementContentPtr content; /* the element value tree */
3830 int n_content;
3831
3832 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
3833 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
3834 for (n_type = 0;n_type < gen_nb_int;n_type++) {
3835 for (n_content = 0;n_content < gen_nb_xmlElementContentPtr;n_content++) {
3836 mem_base = xmlMemBlocks();
3837 ctx = gen_void_ptr(n_ctx, 0);
3838 name = gen_const_xmlChar_ptr(n_name, 1);
3839 type = gen_int(n_type, 2);
3840 content = gen_xmlElementContentPtr(n_content, 3);
3841
William M. Brackf13f77f2004-11-12 16:03:48 +00003842 xmlSAX2ElementDecl(ctx, (const xmlChar *)name, type, content);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003843 call_tests++;
3844 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00003845 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003846 des_int(n_type, type, 2);
3847 des_xmlElementContentPtr(n_content, content, 3);
3848 xmlResetLastError();
3849 if (mem_base != xmlMemBlocks()) {
3850 printf("Leak of %d blocks found in xmlSAX2ElementDecl",
3851 xmlMemBlocks() - mem_base);
3852 test_ret++;
3853 printf(" %d", n_ctx);
3854 printf(" %d", n_name);
3855 printf(" %d", n_type);
3856 printf(" %d", n_content);
3857 printf("\n");
3858 }
3859 }
3860 }
3861 }
3862 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003863 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003864
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003865 return(test_ret);
3866}
3867
3868
3869static int
3870test_xmlSAX2EndDocument(void) {
3871 int test_ret = 0;
3872
3873 int mem_base;
3874 void * ctx; /* the user data (XML parser context) */
3875 int n_ctx;
3876
3877 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
3878 mem_base = xmlMemBlocks();
3879 ctx = gen_void_ptr(n_ctx, 0);
3880
3881 xmlSAX2EndDocument(ctx);
3882 call_tests++;
3883 des_void_ptr(n_ctx, ctx, 0);
3884 xmlResetLastError();
3885 if (mem_base != xmlMemBlocks()) {
3886 printf("Leak of %d blocks found in xmlSAX2EndDocument",
3887 xmlMemBlocks() - mem_base);
3888 test_ret++;
3889 printf(" %d", n_ctx);
3890 printf("\n");
3891 }
3892 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003893 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003894
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003895 return(test_ret);
3896}
3897
3898
3899static int
3900test_xmlSAX2EndElement(void) {
3901 int test_ret = 0;
3902
Daniel Veillarda521d282004-11-09 14:59:59 +00003903#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003904 int mem_base;
3905 void * ctx; /* the user data (XML parser context) */
3906 int n_ctx;
3907 xmlChar * name; /* The element name */
3908 int n_name;
3909
3910 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
3911 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
3912 mem_base = xmlMemBlocks();
3913 ctx = gen_void_ptr(n_ctx, 0);
3914 name = gen_const_xmlChar_ptr(n_name, 1);
3915
William M. Brackf13f77f2004-11-12 16:03:48 +00003916 xmlSAX2EndElement(ctx, (const xmlChar *)name);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003917 call_tests++;
3918 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00003919 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003920 xmlResetLastError();
3921 if (mem_base != xmlMemBlocks()) {
3922 printf("Leak of %d blocks found in xmlSAX2EndElement",
3923 xmlMemBlocks() - mem_base);
3924 test_ret++;
3925 printf(" %d", n_ctx);
3926 printf(" %d", n_name);
3927 printf("\n");
3928 }
3929 }
3930 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003931 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00003932#endif
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003933
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003934 return(test_ret);
3935}
3936
3937
3938static int
3939test_xmlSAX2EndElementNs(void) {
3940 int test_ret = 0;
3941
3942 int mem_base;
3943 void * ctx; /* the user data (XML parser context) */
3944 int n_ctx;
3945 xmlChar * localname; /* the local name of the element */
3946 int n_localname;
3947 xmlChar * prefix; /* the element namespace prefix if available */
3948 int n_prefix;
3949 xmlChar * URI; /* the element namespace name if available */
3950 int n_URI;
3951
3952 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
3953 for (n_localname = 0;n_localname < gen_nb_const_xmlChar_ptr;n_localname++) {
3954 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
3955 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
3956 mem_base = xmlMemBlocks();
3957 ctx = gen_void_ptr(n_ctx, 0);
3958 localname = gen_const_xmlChar_ptr(n_localname, 1);
3959 prefix = gen_const_xmlChar_ptr(n_prefix, 2);
3960 URI = gen_const_xmlChar_ptr(n_URI, 3);
3961
William M. Brackf13f77f2004-11-12 16:03:48 +00003962 xmlSAX2EndElementNs(ctx, (const xmlChar *)localname, (const xmlChar *)prefix, (const xmlChar *)URI);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003963 call_tests++;
3964 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00003965 des_const_xmlChar_ptr(n_localname, (const xmlChar *)localname, 1);
3966 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 2);
3967 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 3);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003968 xmlResetLastError();
3969 if (mem_base != xmlMemBlocks()) {
3970 printf("Leak of %d blocks found in xmlSAX2EndElementNs",
3971 xmlMemBlocks() - mem_base);
3972 test_ret++;
3973 printf(" %d", n_ctx);
3974 printf(" %d", n_localname);
3975 printf(" %d", n_prefix);
3976 printf(" %d", n_URI);
3977 printf("\n");
3978 }
3979 }
3980 }
3981 }
3982 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003983 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003984
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003985 return(test_ret);
3986}
3987
3988
3989static int
3990test_xmlSAX2EntityDecl(void) {
3991 int test_ret = 0;
3992
3993 int mem_base;
3994 void * ctx; /* the user data (XML parser context) */
3995 int n_ctx;
3996 xmlChar * name; /* the entity name */
3997 int n_name;
3998 int type; /* the entity type */
3999 int n_type;
4000 xmlChar * publicId; /* The public ID of the entity */
4001 int n_publicId;
4002 xmlChar * systemId; /* The system ID of the entity */
4003 int n_systemId;
4004 xmlChar * content; /* the entity value (without processing). */
4005 int n_content;
4006
4007 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4008 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4009 for (n_type = 0;n_type < gen_nb_int;n_type++) {
4010 for (n_publicId = 0;n_publicId < gen_nb_const_xmlChar_ptr;n_publicId++) {
4011 for (n_systemId = 0;n_systemId < gen_nb_const_xmlChar_ptr;n_systemId++) {
4012 for (n_content = 0;n_content < gen_nb_xmlChar_ptr;n_content++) {
4013 mem_base = xmlMemBlocks();
4014 ctx = gen_void_ptr(n_ctx, 0);
4015 name = gen_const_xmlChar_ptr(n_name, 1);
4016 type = gen_int(n_type, 2);
4017 publicId = gen_const_xmlChar_ptr(n_publicId, 3);
4018 systemId = gen_const_xmlChar_ptr(n_systemId, 4);
4019 content = gen_xmlChar_ptr(n_content, 5);
4020
William M. Brackf13f77f2004-11-12 16:03:48 +00004021 xmlSAX2EntityDecl(ctx, (const xmlChar *)name, type, (const xmlChar *)publicId, (const xmlChar *)systemId, content);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004022 call_tests++;
4023 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004024 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004025 des_int(n_type, type, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +00004026 des_const_xmlChar_ptr(n_publicId, (const xmlChar *)publicId, 3);
4027 des_const_xmlChar_ptr(n_systemId, (const xmlChar *)systemId, 4);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004028 des_xmlChar_ptr(n_content, content, 5);
4029 xmlResetLastError();
4030 if (mem_base != xmlMemBlocks()) {
4031 printf("Leak of %d blocks found in xmlSAX2EntityDecl",
4032 xmlMemBlocks() - mem_base);
4033 test_ret++;
4034 printf(" %d", n_ctx);
4035 printf(" %d", n_name);
4036 printf(" %d", n_type);
4037 printf(" %d", n_publicId);
4038 printf(" %d", n_systemId);
4039 printf(" %d", n_content);
4040 printf("\n");
4041 }
4042 }
4043 }
4044 }
4045 }
4046 }
4047 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004048 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004049
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004050 return(test_ret);
4051}
4052
4053
4054static int
4055test_xmlSAX2ExternalSubset(void) {
4056 int test_ret = 0;
4057
4058 int mem_base;
4059 void * ctx; /* the user data (XML parser context) */
4060 int n_ctx;
4061 xmlChar * name; /* the root element name */
4062 int n_name;
4063 xmlChar * ExternalID; /* the external ID */
4064 int n_ExternalID;
4065 xmlChar * SystemID; /* the SYSTEM ID (e.g. filename or URL) */
4066 int n_SystemID;
4067
4068 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4069 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4070 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
4071 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
4072 mem_base = xmlMemBlocks();
4073 ctx = gen_void_ptr(n_ctx, 0);
4074 name = gen_const_xmlChar_ptr(n_name, 1);
4075 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 2);
4076 SystemID = gen_const_xmlChar_ptr(n_SystemID, 3);
4077
William M. Brackf13f77f2004-11-12 16:03:48 +00004078 xmlSAX2ExternalSubset(ctx, (const xmlChar *)name, (const xmlChar *)ExternalID, (const xmlChar *)SystemID);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004079 call_tests++;
4080 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004081 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
4082 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 2);
4083 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 3);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004084 xmlResetLastError();
4085 if (mem_base != xmlMemBlocks()) {
4086 printf("Leak of %d blocks found in xmlSAX2ExternalSubset",
4087 xmlMemBlocks() - mem_base);
4088 test_ret++;
4089 printf(" %d", n_ctx);
4090 printf(" %d", n_name);
4091 printf(" %d", n_ExternalID);
4092 printf(" %d", n_SystemID);
4093 printf("\n");
4094 }
4095 }
4096 }
4097 }
4098 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004099 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004100
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004101 return(test_ret);
4102}
4103
4104
4105static int
4106test_xmlSAX2GetColumnNumber(void) {
4107 int test_ret = 0;
4108
4109 int mem_base;
4110 int ret_val;
4111 void * ctx; /* the user data (XML parser context) */
4112 int n_ctx;
4113
4114 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4115 mem_base = xmlMemBlocks();
4116 ctx = gen_void_ptr(n_ctx, 0);
4117
4118 ret_val = xmlSAX2GetColumnNumber(ctx);
4119 desret_int(ret_val);
4120 call_tests++;
4121 des_void_ptr(n_ctx, ctx, 0);
4122 xmlResetLastError();
4123 if (mem_base != xmlMemBlocks()) {
4124 printf("Leak of %d blocks found in xmlSAX2GetColumnNumber",
4125 xmlMemBlocks() - mem_base);
4126 test_ret++;
4127 printf(" %d", n_ctx);
4128 printf("\n");
4129 }
4130 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004131 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004132
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004133 return(test_ret);
4134}
4135
4136
4137static int
4138test_xmlSAX2GetEntity(void) {
4139 int test_ret = 0;
4140
4141 int mem_base;
4142 xmlEntityPtr ret_val;
4143 void * ctx; /* the user data (XML parser context) */
4144 int n_ctx;
4145 xmlChar * name; /* The entity name */
4146 int n_name;
4147
4148 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4149 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4150 mem_base = xmlMemBlocks();
4151 ctx = gen_void_ptr(n_ctx, 0);
4152 name = gen_const_xmlChar_ptr(n_name, 1);
4153
William M. Brackf13f77f2004-11-12 16:03:48 +00004154 ret_val = xmlSAX2GetEntity(ctx, (const xmlChar *)name);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004155 desret_xmlEntityPtr(ret_val);
4156 call_tests++;
4157 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004158 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004159 xmlResetLastError();
4160 if (mem_base != xmlMemBlocks()) {
4161 printf("Leak of %d blocks found in xmlSAX2GetEntity",
4162 xmlMemBlocks() - mem_base);
4163 test_ret++;
4164 printf(" %d", n_ctx);
4165 printf(" %d", n_name);
4166 printf("\n");
4167 }
4168 }
4169 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004170 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004171
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004172 return(test_ret);
4173}
4174
4175
4176static int
4177test_xmlSAX2GetLineNumber(void) {
4178 int test_ret = 0;
4179
4180 int mem_base;
4181 int ret_val;
4182 void * ctx; /* the user data (XML parser context) */
4183 int n_ctx;
4184
4185 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4186 mem_base = xmlMemBlocks();
4187 ctx = gen_void_ptr(n_ctx, 0);
4188
4189 ret_val = xmlSAX2GetLineNumber(ctx);
4190 desret_int(ret_val);
4191 call_tests++;
4192 des_void_ptr(n_ctx, ctx, 0);
4193 xmlResetLastError();
4194 if (mem_base != xmlMemBlocks()) {
4195 printf("Leak of %d blocks found in xmlSAX2GetLineNumber",
4196 xmlMemBlocks() - mem_base);
4197 test_ret++;
4198 printf(" %d", n_ctx);
4199 printf("\n");
4200 }
4201 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004202 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004203
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004204 return(test_ret);
4205}
4206
4207
4208static int
4209test_xmlSAX2GetParameterEntity(void) {
4210 int test_ret = 0;
4211
4212 int mem_base;
4213 xmlEntityPtr ret_val;
4214 void * ctx; /* the user data (XML parser context) */
4215 int n_ctx;
4216 xmlChar * name; /* The entity name */
4217 int n_name;
4218
4219 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4220 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4221 mem_base = xmlMemBlocks();
4222 ctx = gen_void_ptr(n_ctx, 0);
4223 name = gen_const_xmlChar_ptr(n_name, 1);
4224
William M. Brackf13f77f2004-11-12 16:03:48 +00004225 ret_val = xmlSAX2GetParameterEntity(ctx, (const xmlChar *)name);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004226 desret_xmlEntityPtr(ret_val);
4227 call_tests++;
4228 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004229 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004230 xmlResetLastError();
4231 if (mem_base != xmlMemBlocks()) {
4232 printf("Leak of %d blocks found in xmlSAX2GetParameterEntity",
4233 xmlMemBlocks() - mem_base);
4234 test_ret++;
4235 printf(" %d", n_ctx);
4236 printf(" %d", n_name);
4237 printf("\n");
4238 }
4239 }
4240 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004241 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004242
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004243 return(test_ret);
4244}
4245
4246
4247static int
4248test_xmlSAX2GetPublicId(void) {
4249 int test_ret = 0;
4250
4251 int mem_base;
4252 const xmlChar * ret_val;
4253 void * ctx; /* the user data (XML parser context) */
4254 int n_ctx;
4255
4256 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4257 mem_base = xmlMemBlocks();
4258 ctx = gen_void_ptr(n_ctx, 0);
4259
4260 ret_val = xmlSAX2GetPublicId(ctx);
4261 desret_const_xmlChar_ptr(ret_val);
4262 call_tests++;
4263 des_void_ptr(n_ctx, ctx, 0);
4264 xmlResetLastError();
4265 if (mem_base != xmlMemBlocks()) {
4266 printf("Leak of %d blocks found in xmlSAX2GetPublicId",
4267 xmlMemBlocks() - mem_base);
4268 test_ret++;
4269 printf(" %d", n_ctx);
4270 printf("\n");
4271 }
4272 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004273 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004274
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004275 return(test_ret);
4276}
4277
4278
4279static int
4280test_xmlSAX2GetSystemId(void) {
4281 int test_ret = 0;
4282
4283 int mem_base;
4284 const xmlChar * ret_val;
4285 void * ctx; /* the user data (XML parser context) */
4286 int n_ctx;
4287
4288 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4289 mem_base = xmlMemBlocks();
4290 ctx = gen_void_ptr(n_ctx, 0);
4291
4292 ret_val = xmlSAX2GetSystemId(ctx);
4293 desret_const_xmlChar_ptr(ret_val);
4294 call_tests++;
4295 des_void_ptr(n_ctx, ctx, 0);
4296 xmlResetLastError();
4297 if (mem_base != xmlMemBlocks()) {
4298 printf("Leak of %d blocks found in xmlSAX2GetSystemId",
4299 xmlMemBlocks() - mem_base);
4300 test_ret++;
4301 printf(" %d", n_ctx);
4302 printf("\n");
4303 }
4304 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004305 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004306
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004307 return(test_ret);
4308}
4309
4310
4311static int
4312test_xmlSAX2HasExternalSubset(void) {
4313 int test_ret = 0;
4314
4315 int mem_base;
4316 int ret_val;
4317 void * ctx; /* the user data (XML parser context) */
4318 int n_ctx;
4319
4320 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4321 mem_base = xmlMemBlocks();
4322 ctx = gen_void_ptr(n_ctx, 0);
4323
4324 ret_val = xmlSAX2HasExternalSubset(ctx);
4325 desret_int(ret_val);
4326 call_tests++;
4327 des_void_ptr(n_ctx, ctx, 0);
4328 xmlResetLastError();
4329 if (mem_base != xmlMemBlocks()) {
4330 printf("Leak of %d blocks found in xmlSAX2HasExternalSubset",
4331 xmlMemBlocks() - mem_base);
4332 test_ret++;
4333 printf(" %d", n_ctx);
4334 printf("\n");
4335 }
4336 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004337 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004338
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004339 return(test_ret);
4340}
4341
4342
4343static int
4344test_xmlSAX2HasInternalSubset(void) {
4345 int test_ret = 0;
4346
4347 int mem_base;
4348 int ret_val;
4349 void * ctx; /* the user data (XML parser context) */
4350 int n_ctx;
4351
4352 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4353 mem_base = xmlMemBlocks();
4354 ctx = gen_void_ptr(n_ctx, 0);
4355
4356 ret_val = xmlSAX2HasInternalSubset(ctx);
4357 desret_int(ret_val);
4358 call_tests++;
4359 des_void_ptr(n_ctx, ctx, 0);
4360 xmlResetLastError();
4361 if (mem_base != xmlMemBlocks()) {
4362 printf("Leak of %d blocks found in xmlSAX2HasInternalSubset",
4363 xmlMemBlocks() - mem_base);
4364 test_ret++;
4365 printf(" %d", n_ctx);
4366 printf("\n");
4367 }
4368 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004369 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004370
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004371 return(test_ret);
4372}
4373
4374
4375static int
4376test_xmlSAX2IgnorableWhitespace(void) {
4377 int test_ret = 0;
4378
4379 int mem_base;
4380 void * ctx; /* the user data (XML parser context) */
4381 int n_ctx;
4382 xmlChar * ch; /* a xmlChar string */
4383 int n_ch;
4384 int len; /* the number of xmlChar */
4385 int n_len;
4386
4387 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4388 for (n_ch = 0;n_ch < gen_nb_const_xmlChar_ptr;n_ch++) {
4389 for (n_len = 0;n_len < gen_nb_int;n_len++) {
4390 mem_base = xmlMemBlocks();
4391 ctx = gen_void_ptr(n_ctx, 0);
4392 ch = gen_const_xmlChar_ptr(n_ch, 1);
4393 len = gen_int(n_len, 2);
4394
William M. Brackf13f77f2004-11-12 16:03:48 +00004395 xmlSAX2IgnorableWhitespace(ctx, (const xmlChar *)ch, len);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004396 call_tests++;
4397 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004398 des_const_xmlChar_ptr(n_ch, (const xmlChar *)ch, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004399 des_int(n_len, len, 2);
4400 xmlResetLastError();
4401 if (mem_base != xmlMemBlocks()) {
4402 printf("Leak of %d blocks found in xmlSAX2IgnorableWhitespace",
4403 xmlMemBlocks() - mem_base);
4404 test_ret++;
4405 printf(" %d", n_ctx);
4406 printf(" %d", n_ch);
4407 printf(" %d", n_len);
4408 printf("\n");
4409 }
4410 }
4411 }
4412 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004413 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004414
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004415 return(test_ret);
4416}
4417
4418
4419#define gen_nb_xmlSAXHandler_ptr 1
4420static xmlSAXHandler * gen_xmlSAXHandler_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
4421 return(NULL);
4422}
4423static void des_xmlSAXHandler_ptr(int no ATTRIBUTE_UNUSED, xmlSAXHandler * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
4424}
4425
4426static int
4427test_xmlSAX2InitDefaultSAXHandler(void) {
4428 int test_ret = 0;
4429
4430 int mem_base;
4431 xmlSAXHandler * hdlr; /* the SAX handler */
4432 int n_hdlr;
4433 int warning; /* flag if non-zero sets the handler warning procedure */
4434 int n_warning;
4435
4436 for (n_hdlr = 0;n_hdlr < gen_nb_xmlSAXHandler_ptr;n_hdlr++) {
4437 for (n_warning = 0;n_warning < gen_nb_int;n_warning++) {
4438 mem_base = xmlMemBlocks();
4439 hdlr = gen_xmlSAXHandler_ptr(n_hdlr, 0);
4440 warning = gen_int(n_warning, 1);
4441
4442 xmlSAX2InitDefaultSAXHandler(hdlr, warning);
4443 call_tests++;
4444 des_xmlSAXHandler_ptr(n_hdlr, hdlr, 0);
4445 des_int(n_warning, warning, 1);
4446 xmlResetLastError();
4447 if (mem_base != xmlMemBlocks()) {
4448 printf("Leak of %d blocks found in xmlSAX2InitDefaultSAXHandler",
4449 xmlMemBlocks() - mem_base);
4450 test_ret++;
4451 printf(" %d", n_hdlr);
4452 printf(" %d", n_warning);
4453 printf("\n");
4454 }
4455 }
4456 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004457 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004458
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004459 return(test_ret);
4460}
4461
4462
4463static int
4464test_xmlSAX2InitDocbDefaultSAXHandler(void) {
4465 int test_ret = 0;
4466
4467#ifdef LIBXML_DOCB_ENABLED
4468 int mem_base;
4469 xmlSAXHandler * hdlr; /* the SAX handler */
4470 int n_hdlr;
4471
4472 for (n_hdlr = 0;n_hdlr < gen_nb_xmlSAXHandler_ptr;n_hdlr++) {
4473 mem_base = xmlMemBlocks();
4474 hdlr = gen_xmlSAXHandler_ptr(n_hdlr, 0);
4475
4476 xmlSAX2InitDocbDefaultSAXHandler(hdlr);
4477 call_tests++;
4478 des_xmlSAXHandler_ptr(n_hdlr, hdlr, 0);
4479 xmlResetLastError();
4480 if (mem_base != xmlMemBlocks()) {
4481 printf("Leak of %d blocks found in xmlSAX2InitDocbDefaultSAXHandler",
4482 xmlMemBlocks() - mem_base);
4483 test_ret++;
4484 printf(" %d", n_hdlr);
4485 printf("\n");
4486 }
4487 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004488 function_tests++;
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004489#endif
4490
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004491 return(test_ret);
4492}
4493
4494
4495static int
4496test_xmlSAX2InitHtmlDefaultSAXHandler(void) {
4497 int test_ret = 0;
4498
4499#ifdef LIBXML_HTML_ENABLED
4500 int mem_base;
4501 xmlSAXHandler * hdlr; /* the SAX handler */
4502 int n_hdlr;
4503
4504 for (n_hdlr = 0;n_hdlr < gen_nb_xmlSAXHandler_ptr;n_hdlr++) {
4505 mem_base = xmlMemBlocks();
4506 hdlr = gen_xmlSAXHandler_ptr(n_hdlr, 0);
4507
4508 xmlSAX2InitHtmlDefaultSAXHandler(hdlr);
4509 call_tests++;
4510 des_xmlSAXHandler_ptr(n_hdlr, hdlr, 0);
4511 xmlResetLastError();
4512 if (mem_base != xmlMemBlocks()) {
4513 printf("Leak of %d blocks found in xmlSAX2InitHtmlDefaultSAXHandler",
4514 xmlMemBlocks() - mem_base);
4515 test_ret++;
4516 printf(" %d", n_hdlr);
4517 printf("\n");
4518 }
4519 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004520 function_tests++;
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004521#endif
4522
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004523 return(test_ret);
4524}
4525
4526
4527static int
4528test_xmlSAX2InternalSubset(void) {
4529 int test_ret = 0;
4530
4531 int mem_base;
4532 void * ctx; /* the user data (XML parser context) */
4533 int n_ctx;
4534 xmlChar * name; /* the root element name */
4535 int n_name;
4536 xmlChar * ExternalID; /* the external ID */
4537 int n_ExternalID;
4538 xmlChar * SystemID; /* the SYSTEM ID (e.g. filename or URL) */
4539 int n_SystemID;
4540
4541 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4542 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4543 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
4544 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
4545 mem_base = xmlMemBlocks();
4546 ctx = gen_void_ptr(n_ctx, 0);
4547 name = gen_const_xmlChar_ptr(n_name, 1);
4548 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 2);
4549 SystemID = gen_const_xmlChar_ptr(n_SystemID, 3);
4550
William M. Brackf13f77f2004-11-12 16:03:48 +00004551 xmlSAX2InternalSubset(ctx, (const xmlChar *)name, (const xmlChar *)ExternalID, (const xmlChar *)SystemID);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004552 call_tests++;
4553 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004554 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
4555 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 2);
4556 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 3);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004557 xmlResetLastError();
4558 if (mem_base != xmlMemBlocks()) {
4559 printf("Leak of %d blocks found in xmlSAX2InternalSubset",
4560 xmlMemBlocks() - mem_base);
4561 test_ret++;
4562 printf(" %d", n_ctx);
4563 printf(" %d", n_name);
4564 printf(" %d", n_ExternalID);
4565 printf(" %d", n_SystemID);
4566 printf("\n");
4567 }
4568 }
4569 }
4570 }
4571 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004572 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004573
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004574 return(test_ret);
4575}
4576
4577
4578static int
4579test_xmlSAX2IsStandalone(void) {
4580 int test_ret = 0;
4581
4582 int mem_base;
4583 int ret_val;
4584 void * ctx; /* the user data (XML parser context) */
4585 int n_ctx;
4586
4587 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4588 mem_base = xmlMemBlocks();
4589 ctx = gen_void_ptr(n_ctx, 0);
4590
4591 ret_val = xmlSAX2IsStandalone(ctx);
4592 desret_int(ret_val);
4593 call_tests++;
4594 des_void_ptr(n_ctx, ctx, 0);
4595 xmlResetLastError();
4596 if (mem_base != xmlMemBlocks()) {
4597 printf("Leak of %d blocks found in xmlSAX2IsStandalone",
4598 xmlMemBlocks() - mem_base);
4599 test_ret++;
4600 printf(" %d", n_ctx);
4601 printf("\n");
4602 }
4603 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004604 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004605
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004606 return(test_ret);
4607}
4608
4609
4610static int
4611test_xmlSAX2NotationDecl(void) {
4612 int test_ret = 0;
4613
4614 int mem_base;
4615 void * ctx; /* the user data (XML parser context) */
4616 int n_ctx;
4617 xmlChar * name; /* The name of the notation */
4618 int n_name;
4619 xmlChar * publicId; /* The public ID of the entity */
4620 int n_publicId;
4621 xmlChar * systemId; /* The system ID of the entity */
4622 int n_systemId;
4623
4624 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4625 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4626 for (n_publicId = 0;n_publicId < gen_nb_const_xmlChar_ptr;n_publicId++) {
4627 for (n_systemId = 0;n_systemId < gen_nb_const_xmlChar_ptr;n_systemId++) {
4628 mem_base = xmlMemBlocks();
4629 ctx = gen_void_ptr(n_ctx, 0);
4630 name = gen_const_xmlChar_ptr(n_name, 1);
4631 publicId = gen_const_xmlChar_ptr(n_publicId, 2);
4632 systemId = gen_const_xmlChar_ptr(n_systemId, 3);
4633
William M. Brackf13f77f2004-11-12 16:03:48 +00004634 xmlSAX2NotationDecl(ctx, (const xmlChar *)name, (const xmlChar *)publicId, (const xmlChar *)systemId);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004635 call_tests++;
4636 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004637 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
4638 des_const_xmlChar_ptr(n_publicId, (const xmlChar *)publicId, 2);
4639 des_const_xmlChar_ptr(n_systemId, (const xmlChar *)systemId, 3);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004640 xmlResetLastError();
4641 if (mem_base != xmlMemBlocks()) {
4642 printf("Leak of %d blocks found in xmlSAX2NotationDecl",
4643 xmlMemBlocks() - mem_base);
4644 test_ret++;
4645 printf(" %d", n_ctx);
4646 printf(" %d", n_name);
4647 printf(" %d", n_publicId);
4648 printf(" %d", n_systemId);
4649 printf("\n");
4650 }
4651 }
4652 }
4653 }
4654 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004655 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004656
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004657 return(test_ret);
4658}
4659
4660
4661static int
4662test_xmlSAX2ProcessingInstruction(void) {
4663 int test_ret = 0;
4664
4665 int mem_base;
4666 void * ctx; /* the user data (XML parser context) */
4667 int n_ctx;
4668 xmlChar * target; /* the target name */
4669 int n_target;
4670 xmlChar * data; /* the PI data's */
4671 int n_data;
4672
4673 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4674 for (n_target = 0;n_target < gen_nb_const_xmlChar_ptr;n_target++) {
4675 for (n_data = 0;n_data < gen_nb_const_xmlChar_ptr;n_data++) {
4676 mem_base = xmlMemBlocks();
4677 ctx = gen_void_ptr(n_ctx, 0);
4678 target = gen_const_xmlChar_ptr(n_target, 1);
4679 data = gen_const_xmlChar_ptr(n_data, 2);
4680
William M. Brackf13f77f2004-11-12 16:03:48 +00004681 xmlSAX2ProcessingInstruction(ctx, (const xmlChar *)target, (const xmlChar *)data);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004682 call_tests++;
4683 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004684 des_const_xmlChar_ptr(n_target, (const xmlChar *)target, 1);
4685 des_const_xmlChar_ptr(n_data, (const xmlChar *)data, 2);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004686 xmlResetLastError();
4687 if (mem_base != xmlMemBlocks()) {
4688 printf("Leak of %d blocks found in xmlSAX2ProcessingInstruction",
4689 xmlMemBlocks() - mem_base);
4690 test_ret++;
4691 printf(" %d", n_ctx);
4692 printf(" %d", n_target);
4693 printf(" %d", n_data);
4694 printf("\n");
4695 }
4696 }
4697 }
4698 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004699 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004700
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004701 return(test_ret);
4702}
4703
4704
4705static int
4706test_xmlSAX2Reference(void) {
4707 int test_ret = 0;
4708
4709 int mem_base;
4710 void * ctx; /* the user data (XML parser context) */
4711 int n_ctx;
4712 xmlChar * name; /* The entity name */
4713 int n_name;
4714
4715 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4716 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4717 mem_base = xmlMemBlocks();
4718 ctx = gen_void_ptr(n_ctx, 0);
4719 name = gen_const_xmlChar_ptr(n_name, 1);
4720
William M. Brackf13f77f2004-11-12 16:03:48 +00004721 xmlSAX2Reference(ctx, (const xmlChar *)name);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004722 call_tests++;
4723 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004724 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004725 xmlResetLastError();
4726 if (mem_base != xmlMemBlocks()) {
4727 printf("Leak of %d blocks found in xmlSAX2Reference",
4728 xmlMemBlocks() - mem_base);
4729 test_ret++;
4730 printf(" %d", n_ctx);
4731 printf(" %d", n_name);
4732 printf("\n");
4733 }
4734 }
4735 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004736 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004737
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004738 return(test_ret);
4739}
4740
4741
4742static int
4743test_xmlSAX2ResolveEntity(void) {
4744 int test_ret = 0;
4745
4746 int mem_base;
4747 xmlParserInputPtr ret_val;
4748 void * ctx; /* the user data (XML parser context) */
4749 int n_ctx;
4750 xmlChar * publicId; /* The public ID of the entity */
4751 int n_publicId;
4752 xmlChar * systemId; /* The system ID of the entity */
4753 int n_systemId;
4754
4755 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4756 for (n_publicId = 0;n_publicId < gen_nb_const_xmlChar_ptr;n_publicId++) {
4757 for (n_systemId = 0;n_systemId < gen_nb_const_xmlChar_ptr;n_systemId++) {
4758 mem_base = xmlMemBlocks();
4759 ctx = gen_void_ptr(n_ctx, 0);
4760 publicId = gen_const_xmlChar_ptr(n_publicId, 1);
4761 systemId = gen_const_xmlChar_ptr(n_systemId, 2);
4762
William M. Brackf13f77f2004-11-12 16:03:48 +00004763 ret_val = xmlSAX2ResolveEntity(ctx, (const xmlChar *)publicId, (const xmlChar *)systemId);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004764 desret_xmlParserInputPtr(ret_val);
4765 call_tests++;
4766 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004767 des_const_xmlChar_ptr(n_publicId, (const xmlChar *)publicId, 1);
4768 des_const_xmlChar_ptr(n_systemId, (const xmlChar *)systemId, 2);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004769 xmlResetLastError();
4770 if (mem_base != xmlMemBlocks()) {
4771 printf("Leak of %d blocks found in xmlSAX2ResolveEntity",
4772 xmlMemBlocks() - mem_base);
4773 test_ret++;
4774 printf(" %d", n_ctx);
4775 printf(" %d", n_publicId);
4776 printf(" %d", n_systemId);
4777 printf("\n");
4778 }
4779 }
4780 }
4781 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004782 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004783
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004784 return(test_ret);
4785}
4786
4787
4788#define gen_nb_xmlSAXLocatorPtr 1
4789static xmlSAXLocatorPtr gen_xmlSAXLocatorPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
4790 return(NULL);
4791}
4792static void des_xmlSAXLocatorPtr(int no ATTRIBUTE_UNUSED, xmlSAXLocatorPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
4793}
4794
4795static int
4796test_xmlSAX2SetDocumentLocator(void) {
4797 int test_ret = 0;
4798
4799 int mem_base;
4800 void * ctx; /* the user data (XML parser context) */
4801 int n_ctx;
4802 xmlSAXLocatorPtr loc; /* A SAX Locator */
4803 int n_loc;
4804
4805 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4806 for (n_loc = 0;n_loc < gen_nb_xmlSAXLocatorPtr;n_loc++) {
4807 mem_base = xmlMemBlocks();
4808 ctx = gen_void_ptr(n_ctx, 0);
4809 loc = gen_xmlSAXLocatorPtr(n_loc, 1);
4810
4811 xmlSAX2SetDocumentLocator(ctx, loc);
4812 call_tests++;
4813 des_void_ptr(n_ctx, ctx, 0);
4814 des_xmlSAXLocatorPtr(n_loc, loc, 1);
4815 xmlResetLastError();
4816 if (mem_base != xmlMemBlocks()) {
4817 printf("Leak of %d blocks found in xmlSAX2SetDocumentLocator",
4818 xmlMemBlocks() - mem_base);
4819 test_ret++;
4820 printf(" %d", n_ctx);
4821 printf(" %d", n_loc);
4822 printf("\n");
4823 }
4824 }
4825 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004826 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004827
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004828 return(test_ret);
4829}
4830
4831
4832static int
4833test_xmlSAX2StartDocument(void) {
4834 int test_ret = 0;
4835
4836 int mem_base;
4837 void * ctx; /* the user data (XML parser context) */
4838 int n_ctx;
4839
4840 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4841 mem_base = xmlMemBlocks();
4842 ctx = gen_void_ptr(n_ctx, 0);
4843
4844 xmlSAX2StartDocument(ctx);
4845 call_tests++;
4846 des_void_ptr(n_ctx, ctx, 0);
4847 xmlResetLastError();
4848 if (mem_base != xmlMemBlocks()) {
4849 printf("Leak of %d blocks found in xmlSAX2StartDocument",
4850 xmlMemBlocks() - mem_base);
4851 test_ret++;
4852 printf(" %d", n_ctx);
4853 printf("\n");
4854 }
4855 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004856 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004857
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004858 return(test_ret);
4859}
4860
4861
4862static int
4863test_xmlSAX2StartElement(void) {
4864 int test_ret = 0;
4865
Daniel Veillarda521d282004-11-09 14:59:59 +00004866#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004867 int mem_base;
4868 void * ctx; /* the user data (XML parser context) */
4869 int n_ctx;
4870 xmlChar * fullname; /* The element name, including namespace prefix */
4871 int n_fullname;
4872 xmlChar ** atts; /* An array of name/value attributes pairs, NULL terminated */
4873 int n_atts;
4874
4875 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4876 for (n_fullname = 0;n_fullname < gen_nb_const_xmlChar_ptr;n_fullname++) {
4877 for (n_atts = 0;n_atts < gen_nb_const_xmlChar_ptr_ptr;n_atts++) {
4878 mem_base = xmlMemBlocks();
4879 ctx = gen_void_ptr(n_ctx, 0);
4880 fullname = gen_const_xmlChar_ptr(n_fullname, 1);
4881 atts = gen_const_xmlChar_ptr_ptr(n_atts, 2);
4882
William M. Brackf13f77f2004-11-12 16:03:48 +00004883 xmlSAX2StartElement(ctx, (const xmlChar *)fullname, (const xmlChar **)atts);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004884 call_tests++;
4885 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004886 des_const_xmlChar_ptr(n_fullname, (const xmlChar *)fullname, 1);
4887 des_const_xmlChar_ptr_ptr(n_atts, (const xmlChar **)atts, 2);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004888 xmlResetLastError();
4889 if (mem_base != xmlMemBlocks()) {
4890 printf("Leak of %d blocks found in xmlSAX2StartElement",
4891 xmlMemBlocks() - mem_base);
4892 test_ret++;
4893 printf(" %d", n_ctx);
4894 printf(" %d", n_fullname);
4895 printf(" %d", n_atts);
4896 printf("\n");
4897 }
4898 }
4899 }
4900 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004901 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00004902#endif
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004903
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004904 return(test_ret);
4905}
4906
4907
4908static int
4909test_xmlSAX2StartElementNs(void) {
4910 int test_ret = 0;
4911
4912 int mem_base;
4913 void * ctx; /* the user data (XML parser context) */
4914 int n_ctx;
4915 xmlChar * localname; /* the local name of the element */
4916 int n_localname;
4917 xmlChar * prefix; /* the element namespace prefix if available */
4918 int n_prefix;
4919 xmlChar * URI; /* the element namespace name if available */
4920 int n_URI;
4921 int nb_namespaces; /* number of namespace definitions on that node */
4922 int n_nb_namespaces;
4923 xmlChar ** namespaces; /* pointer to the array of prefix/URI pairs namespace definitions */
4924 int n_namespaces;
4925 int nb_attributes; /* the number of attributes on that node */
4926 int n_nb_attributes;
4927 int nb_defaulted; /* the number of defaulted attributes. */
4928 int n_nb_defaulted;
4929 xmlChar ** attributes; /* pointer to the array of (localname/prefix/URI/value/end) attribute values. */
4930 int n_attributes;
4931
4932 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4933 for (n_localname = 0;n_localname < gen_nb_const_xmlChar_ptr;n_localname++) {
4934 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
4935 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
4936 for (n_nb_namespaces = 0;n_nb_namespaces < gen_nb_int;n_nb_namespaces++) {
4937 for (n_namespaces = 0;n_namespaces < gen_nb_const_xmlChar_ptr_ptr;n_namespaces++) {
4938 for (n_nb_attributes = 0;n_nb_attributes < gen_nb_int;n_nb_attributes++) {
4939 for (n_nb_defaulted = 0;n_nb_defaulted < gen_nb_int;n_nb_defaulted++) {
4940 for (n_attributes = 0;n_attributes < gen_nb_const_xmlChar_ptr_ptr;n_attributes++) {
4941 mem_base = xmlMemBlocks();
4942 ctx = gen_void_ptr(n_ctx, 0);
4943 localname = gen_const_xmlChar_ptr(n_localname, 1);
4944 prefix = gen_const_xmlChar_ptr(n_prefix, 2);
4945 URI = gen_const_xmlChar_ptr(n_URI, 3);
4946 nb_namespaces = gen_int(n_nb_namespaces, 4);
4947 namespaces = gen_const_xmlChar_ptr_ptr(n_namespaces, 5);
4948 nb_attributes = gen_int(n_nb_attributes, 6);
4949 nb_defaulted = gen_int(n_nb_defaulted, 7);
4950 attributes = gen_const_xmlChar_ptr_ptr(n_attributes, 8);
4951
William M. Brackf13f77f2004-11-12 16:03:48 +00004952 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 +00004953 call_tests++;
4954 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004955 des_const_xmlChar_ptr(n_localname, (const xmlChar *)localname, 1);
4956 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 2);
4957 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 3);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004958 des_int(n_nb_namespaces, nb_namespaces, 4);
William M. Brackf13f77f2004-11-12 16:03:48 +00004959 des_const_xmlChar_ptr_ptr(n_namespaces, (const xmlChar **)namespaces, 5);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004960 des_int(n_nb_attributes, nb_attributes, 6);
4961 des_int(n_nb_defaulted, nb_defaulted, 7);
William M. Brackf13f77f2004-11-12 16:03:48 +00004962 des_const_xmlChar_ptr_ptr(n_attributes, (const xmlChar **)attributes, 8);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004963 xmlResetLastError();
4964 if (mem_base != xmlMemBlocks()) {
4965 printf("Leak of %d blocks found in xmlSAX2StartElementNs",
4966 xmlMemBlocks() - mem_base);
4967 test_ret++;
4968 printf(" %d", n_ctx);
4969 printf(" %d", n_localname);
4970 printf(" %d", n_prefix);
4971 printf(" %d", n_URI);
4972 printf(" %d", n_nb_namespaces);
4973 printf(" %d", n_namespaces);
4974 printf(" %d", n_nb_attributes);
4975 printf(" %d", n_nb_defaulted);
4976 printf(" %d", n_attributes);
4977 printf("\n");
4978 }
4979 }
4980 }
4981 }
4982 }
4983 }
4984 }
4985 }
4986 }
4987 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004988 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004989
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004990 return(test_ret);
4991}
4992
4993
4994static int
4995test_xmlSAX2UnparsedEntityDecl(void) {
4996 int test_ret = 0;
4997
4998 int mem_base;
4999 void * ctx; /* the user data (XML parser context) */
5000 int n_ctx;
5001 xmlChar * name; /* The name of the entity */
5002 int n_name;
5003 xmlChar * publicId; /* The public ID of the entity */
5004 int n_publicId;
5005 xmlChar * systemId; /* The system ID of the entity */
5006 int n_systemId;
5007 xmlChar * notationName; /* the name of the notation */
5008 int n_notationName;
5009
5010 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
5011 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
5012 for (n_publicId = 0;n_publicId < gen_nb_const_xmlChar_ptr;n_publicId++) {
5013 for (n_systemId = 0;n_systemId < gen_nb_const_xmlChar_ptr;n_systemId++) {
5014 for (n_notationName = 0;n_notationName < gen_nb_const_xmlChar_ptr;n_notationName++) {
5015 mem_base = xmlMemBlocks();
5016 ctx = gen_void_ptr(n_ctx, 0);
5017 name = gen_const_xmlChar_ptr(n_name, 1);
5018 publicId = gen_const_xmlChar_ptr(n_publicId, 2);
5019 systemId = gen_const_xmlChar_ptr(n_systemId, 3);
5020 notationName = gen_const_xmlChar_ptr(n_notationName, 4);
5021
William M. Brackf13f77f2004-11-12 16:03:48 +00005022 xmlSAX2UnparsedEntityDecl(ctx, (const xmlChar *)name, (const xmlChar *)publicId, (const xmlChar *)systemId, (const xmlChar *)notationName);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005023 call_tests++;
5024 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00005025 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
5026 des_const_xmlChar_ptr(n_publicId, (const xmlChar *)publicId, 2);
5027 des_const_xmlChar_ptr(n_systemId, (const xmlChar *)systemId, 3);
5028 des_const_xmlChar_ptr(n_notationName, (const xmlChar *)notationName, 4);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005029 xmlResetLastError();
5030 if (mem_base != xmlMemBlocks()) {
5031 printf("Leak of %d blocks found in xmlSAX2UnparsedEntityDecl",
5032 xmlMemBlocks() - mem_base);
5033 test_ret++;
5034 printf(" %d", n_ctx);
5035 printf(" %d", n_name);
5036 printf(" %d", n_publicId);
5037 printf(" %d", n_systemId);
5038 printf(" %d", n_notationName);
5039 printf("\n");
5040 }
5041 }
5042 }
5043 }
5044 }
5045 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005046 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005047
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005048 return(test_ret);
5049}
5050
5051
5052static int
5053test_xmlSAXDefaultVersion(void) {
5054 int test_ret = 0;
5055
Daniel Veillarda521d282004-11-09 14:59:59 +00005056#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005057 int mem_base;
5058 int ret_val;
5059 int version; /* the version, 1 or 2 */
5060 int n_version;
5061
5062 for (n_version = 0;n_version < gen_nb_int;n_version++) {
5063 mem_base = xmlMemBlocks();
5064 version = gen_int(n_version, 0);
5065
5066 ret_val = xmlSAXDefaultVersion(version);
5067 desret_int(ret_val);
5068 call_tests++;
5069 des_int(n_version, version, 0);
5070 xmlResetLastError();
5071 if (mem_base != xmlMemBlocks()) {
5072 printf("Leak of %d blocks found in xmlSAXDefaultVersion",
5073 xmlMemBlocks() - mem_base);
5074 test_ret++;
5075 printf(" %d", n_version);
5076 printf("\n");
5077 }
5078 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005079 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00005080#endif
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005081
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005082 return(test_ret);
5083}
5084
5085
5086static int
5087test_xmlSAXVersion(void) {
5088 int test_ret = 0;
5089
5090 int mem_base;
5091 int ret_val;
5092 xmlSAXHandler * hdlr; /* the SAX handler */
5093 int n_hdlr;
5094 int version; /* the version, 1 or 2 */
5095 int n_version;
5096
5097 for (n_hdlr = 0;n_hdlr < gen_nb_xmlSAXHandler_ptr;n_hdlr++) {
5098 for (n_version = 0;n_version < gen_nb_int;n_version++) {
5099 mem_base = xmlMemBlocks();
5100 hdlr = gen_xmlSAXHandler_ptr(n_hdlr, 0);
5101 version = gen_int(n_version, 1);
5102
5103 ret_val = xmlSAXVersion(hdlr, version);
5104 desret_int(ret_val);
5105 call_tests++;
5106 des_xmlSAXHandler_ptr(n_hdlr, hdlr, 0);
5107 des_int(n_version, version, 1);
5108 xmlResetLastError();
5109 if (mem_base != xmlMemBlocks()) {
5110 printf("Leak of %d blocks found in xmlSAXVersion",
5111 xmlMemBlocks() - mem_base);
5112 test_ret++;
5113 printf(" %d", n_hdlr);
5114 printf(" %d", n_version);
5115 printf("\n");
5116 }
5117 }
5118 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005119 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005120
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005121 return(test_ret);
5122}
5123
5124static int
5125test_SAX2(void) {
5126 int test_ret = 0;
5127
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005128 if (quiet == 0) printf("Testing SAX2 : 38 of 38 functions ...\n");
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005129 test_ret += test_docbDefaultSAXHandlerInit();
5130 test_ret += test_htmlDefaultSAXHandlerInit();
5131 test_ret += test_xmlDefaultSAXHandlerInit();
5132 test_ret += test_xmlSAX2AttributeDecl();
5133 test_ret += test_xmlSAX2CDataBlock();
5134 test_ret += test_xmlSAX2Characters();
5135 test_ret += test_xmlSAX2Comment();
5136 test_ret += test_xmlSAX2ElementDecl();
5137 test_ret += test_xmlSAX2EndDocument();
5138 test_ret += test_xmlSAX2EndElement();
5139 test_ret += test_xmlSAX2EndElementNs();
5140 test_ret += test_xmlSAX2EntityDecl();
5141 test_ret += test_xmlSAX2ExternalSubset();
5142 test_ret += test_xmlSAX2GetColumnNumber();
5143 test_ret += test_xmlSAX2GetEntity();
5144 test_ret += test_xmlSAX2GetLineNumber();
5145 test_ret += test_xmlSAX2GetParameterEntity();
5146 test_ret += test_xmlSAX2GetPublicId();
5147 test_ret += test_xmlSAX2GetSystemId();
5148 test_ret += test_xmlSAX2HasExternalSubset();
5149 test_ret += test_xmlSAX2HasInternalSubset();
5150 test_ret += test_xmlSAX2IgnorableWhitespace();
5151 test_ret += test_xmlSAX2InitDefaultSAXHandler();
5152 test_ret += test_xmlSAX2InitDocbDefaultSAXHandler();
5153 test_ret += test_xmlSAX2InitHtmlDefaultSAXHandler();
5154 test_ret += test_xmlSAX2InternalSubset();
5155 test_ret += test_xmlSAX2IsStandalone();
5156 test_ret += test_xmlSAX2NotationDecl();
5157 test_ret += test_xmlSAX2ProcessingInstruction();
5158 test_ret += test_xmlSAX2Reference();
5159 test_ret += test_xmlSAX2ResolveEntity();
5160 test_ret += test_xmlSAX2SetDocumentLocator();
5161 test_ret += test_xmlSAX2StartDocument();
5162 test_ret += test_xmlSAX2StartElement();
5163 test_ret += test_xmlSAX2StartElementNs();
5164 test_ret += test_xmlSAX2UnparsedEntityDecl();
5165 test_ret += test_xmlSAXDefaultVersion();
5166 test_ret += test_xmlSAXVersion();
5167
5168 if (test_ret != 0)
5169 printf("Module SAX2: %d errors\n", test_ret);
5170 return(test_ret);
5171}
5172
Daniel Veillarda82b1822004-11-08 16:24:57 +00005173static int
5174test_xmlC14NDocDumpMemory(void) {
5175 int test_ret = 0;
5176
5177#ifdef LIBXML_C14N_ENABLED
5178#ifdef LIBXML_OUTPUT_ENABLED
5179 int mem_base;
5180 int ret_val;
5181 xmlDocPtr doc; /* the XML document for canonization */
5182 int n_doc;
5183 xmlNodeSetPtr nodes; /* the nodes set to be included in the canonized image or NULL if all document nodes should be included */
5184 int n_nodes;
5185 int exclusive; /* the exclusive flag (0 - non-exclusive canonicalization; otherwise - exclusive canonicalization) */
5186 int n_exclusive;
5187 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) */
5188 int n_inclusive_ns_prefixes;
5189 int with_comments; /* include comments in the result (!=0) or not (==0) */
5190 int n_with_comments;
5191 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 */
5192 int n_doc_txt_ptr;
5193
5194 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
5195 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
5196 for (n_exclusive = 0;n_exclusive < gen_nb_int;n_exclusive++) {
5197 for (n_inclusive_ns_prefixes = 0;n_inclusive_ns_prefixes < gen_nb_xmlChar_ptr_ptr;n_inclusive_ns_prefixes++) {
5198 for (n_with_comments = 0;n_with_comments < gen_nb_int;n_with_comments++) {
5199 for (n_doc_txt_ptr = 0;n_doc_txt_ptr < gen_nb_xmlChar_ptr_ptr;n_doc_txt_ptr++) {
5200 mem_base = xmlMemBlocks();
5201 doc = gen_xmlDocPtr(n_doc, 0);
5202 nodes = gen_xmlNodeSetPtr(n_nodes, 1);
5203 exclusive = gen_int(n_exclusive, 2);
5204 inclusive_ns_prefixes = gen_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, 3);
5205 with_comments = gen_int(n_with_comments, 4);
5206 doc_txt_ptr = gen_xmlChar_ptr_ptr(n_doc_txt_ptr, 5);
5207
5208 ret_val = xmlC14NDocDumpMemory(doc, nodes, exclusive, inclusive_ns_prefixes, with_comments, doc_txt_ptr);
5209 desret_int(ret_val);
5210 call_tests++;
5211 des_xmlDocPtr(n_doc, doc, 0);
5212 des_xmlNodeSetPtr(n_nodes, nodes, 1);
5213 des_int(n_exclusive, exclusive, 2);
5214 des_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, inclusive_ns_prefixes, 3);
5215 des_int(n_with_comments, with_comments, 4);
5216 des_xmlChar_ptr_ptr(n_doc_txt_ptr, doc_txt_ptr, 5);
5217 xmlResetLastError();
5218 if (mem_base != xmlMemBlocks()) {
5219 printf("Leak of %d blocks found in xmlC14NDocDumpMemory",
5220 xmlMemBlocks() - mem_base);
5221 test_ret++;
5222 printf(" %d", n_doc);
5223 printf(" %d", n_nodes);
5224 printf(" %d", n_exclusive);
5225 printf(" %d", n_inclusive_ns_prefixes);
5226 printf(" %d", n_with_comments);
5227 printf(" %d", n_doc_txt_ptr);
5228 printf("\n");
5229 }
5230 }
5231 }
5232 }
5233 }
5234 }
5235 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005236 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00005237#endif
5238#endif
5239
Daniel Veillarda82b1822004-11-08 16:24:57 +00005240 return(test_ret);
5241}
5242
5243
5244static int
5245test_xmlC14NDocSave(void) {
5246 int test_ret = 0;
5247
5248#ifdef LIBXML_C14N_ENABLED
5249#ifdef LIBXML_OUTPUT_ENABLED
5250 int mem_base;
5251 int ret_val;
5252 xmlDocPtr doc; /* the XML document for canonization */
5253 int n_doc;
5254 xmlNodeSetPtr nodes; /* the nodes set to be included in the canonized image or NULL if all document nodes should be included */
5255 int n_nodes;
5256 int exclusive; /* the exclusive flag (0 - non-exclusive canonicalization; otherwise - exclusive canonicalization) */
5257 int n_exclusive;
5258 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) */
5259 int n_inclusive_ns_prefixes;
5260 int with_comments; /* include comments in the result (!=0) or not (==0) */
5261 int n_with_comments;
5262 const char * filename; /* the filename to store canonical XML image */
5263 int n_filename;
5264 int compression; /* the compression level (zlib requred): -1 - libxml default, 0 - uncompressed, >0 - compression level */
5265 int n_compression;
5266
5267 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
5268 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
5269 for (n_exclusive = 0;n_exclusive < gen_nb_int;n_exclusive++) {
5270 for (n_inclusive_ns_prefixes = 0;n_inclusive_ns_prefixes < gen_nb_xmlChar_ptr_ptr;n_inclusive_ns_prefixes++) {
5271 for (n_with_comments = 0;n_with_comments < gen_nb_int;n_with_comments++) {
5272 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
5273 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
5274 mem_base = xmlMemBlocks();
5275 doc = gen_xmlDocPtr(n_doc, 0);
5276 nodes = gen_xmlNodeSetPtr(n_nodes, 1);
5277 exclusive = gen_int(n_exclusive, 2);
5278 inclusive_ns_prefixes = gen_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, 3);
5279 with_comments = gen_int(n_with_comments, 4);
5280 filename = gen_fileoutput(n_filename, 5);
5281 compression = gen_int(n_compression, 6);
5282
5283 ret_val = xmlC14NDocSave(doc, nodes, exclusive, inclusive_ns_prefixes, with_comments, filename, compression);
5284 desret_int(ret_val);
5285 call_tests++;
5286 des_xmlDocPtr(n_doc, doc, 0);
5287 des_xmlNodeSetPtr(n_nodes, nodes, 1);
5288 des_int(n_exclusive, exclusive, 2);
5289 des_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, inclusive_ns_prefixes, 3);
5290 des_int(n_with_comments, with_comments, 4);
5291 des_fileoutput(n_filename, filename, 5);
5292 des_int(n_compression, compression, 6);
5293 xmlResetLastError();
5294 if (mem_base != xmlMemBlocks()) {
5295 printf("Leak of %d blocks found in xmlC14NDocSave",
5296 xmlMemBlocks() - mem_base);
5297 test_ret++;
5298 printf(" %d", n_doc);
5299 printf(" %d", n_nodes);
5300 printf(" %d", n_exclusive);
5301 printf(" %d", n_inclusive_ns_prefixes);
5302 printf(" %d", n_with_comments);
5303 printf(" %d", n_filename);
5304 printf(" %d", n_compression);
5305 printf("\n");
5306 }
5307 }
5308 }
5309 }
5310 }
5311 }
5312 }
5313 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005314 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00005315#endif
5316#endif
5317
Daniel Veillarda82b1822004-11-08 16:24:57 +00005318 return(test_ret);
5319}
5320
5321
5322static int
5323test_xmlC14NDocSaveTo(void) {
5324 int test_ret = 0;
5325
5326#ifdef LIBXML_C14N_ENABLED
5327#ifdef LIBXML_OUTPUT_ENABLED
5328 int mem_base;
5329 int ret_val;
5330 xmlDocPtr doc; /* the XML document for canonization */
5331 int n_doc;
5332 xmlNodeSetPtr nodes; /* the nodes set to be included in the canonized image or NULL if all document nodes should be included */
5333 int n_nodes;
5334 int exclusive; /* the exclusive flag (0 - non-exclusive canonicalization; otherwise - exclusive canonicalization) */
5335 int n_exclusive;
5336 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) */
5337 int n_inclusive_ns_prefixes;
5338 int with_comments; /* include comments in the result (!=0) or not (==0) */
5339 int n_with_comments;
5340 xmlOutputBufferPtr buf; /* the output buffer to store canonical XML; this buffer MUST have encoder==NULL because C14N requires UTF-8 output */
5341 int n_buf;
5342
5343 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
5344 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
5345 for (n_exclusive = 0;n_exclusive < gen_nb_int;n_exclusive++) {
5346 for (n_inclusive_ns_prefixes = 0;n_inclusive_ns_prefixes < gen_nb_xmlChar_ptr_ptr;n_inclusive_ns_prefixes++) {
5347 for (n_with_comments = 0;n_with_comments < gen_nb_int;n_with_comments++) {
5348 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
5349 mem_base = xmlMemBlocks();
5350 doc = gen_xmlDocPtr(n_doc, 0);
5351 nodes = gen_xmlNodeSetPtr(n_nodes, 1);
5352 exclusive = gen_int(n_exclusive, 2);
5353 inclusive_ns_prefixes = gen_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, 3);
5354 with_comments = gen_int(n_with_comments, 4);
5355 buf = gen_xmlOutputBufferPtr(n_buf, 5);
5356
5357 ret_val = xmlC14NDocSaveTo(doc, nodes, exclusive, inclusive_ns_prefixes, with_comments, buf);
5358 desret_int(ret_val);
5359 call_tests++;
5360 des_xmlDocPtr(n_doc, doc, 0);
5361 des_xmlNodeSetPtr(n_nodes, nodes, 1);
5362 des_int(n_exclusive, exclusive, 2);
5363 des_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, inclusive_ns_prefixes, 3);
5364 des_int(n_with_comments, with_comments, 4);
5365 des_xmlOutputBufferPtr(n_buf, buf, 5);
5366 xmlResetLastError();
5367 if (mem_base != xmlMemBlocks()) {
5368 printf("Leak of %d blocks found in xmlC14NDocSaveTo",
5369 xmlMemBlocks() - mem_base);
5370 test_ret++;
5371 printf(" %d", n_doc);
5372 printf(" %d", n_nodes);
5373 printf(" %d", n_exclusive);
5374 printf(" %d", n_inclusive_ns_prefixes);
5375 printf(" %d", n_with_comments);
5376 printf(" %d", n_buf);
5377 printf("\n");
5378 }
5379 }
5380 }
5381 }
5382 }
5383 }
5384 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005385 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00005386#endif
5387#endif
5388
Daniel Veillarda82b1822004-11-08 16:24:57 +00005389 return(test_ret);
5390}
5391
5392
5393static int
5394test_xmlC14NExecute(void) {
5395 int test_ret = 0;
5396
5397
5398 /* missing type support */
5399 return(test_ret);
5400}
5401
5402static int
5403test_c14n(void) {
5404 int test_ret = 0;
5405
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005406 if (quiet == 0) printf("Testing c14n : 3 of 4 functions ...\n");
Daniel Veillarda82b1822004-11-08 16:24:57 +00005407 test_ret += test_xmlC14NDocDumpMemory();
5408 test_ret += test_xmlC14NDocSave();
5409 test_ret += test_xmlC14NDocSaveTo();
5410 test_ret += test_xmlC14NExecute();
5411
5412 if (test_ret != 0)
5413 printf("Module c14n: %d errors\n", test_ret);
5414 return(test_ret);
5415}
Daniel Veillarda521d282004-11-09 14:59:59 +00005416#ifdef LIBXML_CATALOG_ENABLED
Daniel Veillarda82b1822004-11-08 16:24:57 +00005417
Daniel Veillardce682bc2004-11-05 17:22:25 +00005418#define gen_nb_xmlCatalogPtr 1
5419static xmlCatalogPtr gen_xmlCatalogPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
5420 return(NULL);
5421}
5422static void des_xmlCatalogPtr(int no ATTRIBUTE_UNUSED, xmlCatalogPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
5423}
Daniel Veillarda521d282004-11-09 14:59:59 +00005424#endif
5425
Daniel Veillardce682bc2004-11-05 17:22:25 +00005426
Daniel Veillardd93f6252004-11-02 15:53:51 +00005427static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00005428test_xmlACatalogAdd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005429 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005430
Daniel Veillardce682bc2004-11-05 17:22:25 +00005431#ifdef LIBXML_CATALOG_ENABLED
5432 int mem_base;
5433 int ret_val;
5434 xmlCatalogPtr catal; /* a Catalog */
5435 int n_catal;
5436 xmlChar * type; /* the type of record to add to the catalog */
5437 int n_type;
5438 xmlChar * orig; /* the system, public or prefix to match */
5439 int n_orig;
5440 xmlChar * replace; /* the replacement value for the match */
5441 int n_replace;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005442
Daniel Veillardce682bc2004-11-05 17:22:25 +00005443 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5444 for (n_type = 0;n_type < gen_nb_const_xmlChar_ptr;n_type++) {
5445 for (n_orig = 0;n_orig < gen_nb_const_xmlChar_ptr;n_orig++) {
5446 for (n_replace = 0;n_replace < gen_nb_const_xmlChar_ptr;n_replace++) {
5447 mem_base = xmlMemBlocks();
5448 catal = gen_xmlCatalogPtr(n_catal, 0);
5449 type = gen_const_xmlChar_ptr(n_type, 1);
5450 orig = gen_const_xmlChar_ptr(n_orig, 2);
5451 replace = gen_const_xmlChar_ptr(n_replace, 3);
5452
William M. Brackf13f77f2004-11-12 16:03:48 +00005453 ret_val = xmlACatalogAdd(catal, (const xmlChar *)type, (const xmlChar *)orig, (const xmlChar *)replace);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005454 desret_int(ret_val);
5455 call_tests++;
5456 des_xmlCatalogPtr(n_catal, catal, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00005457 des_const_xmlChar_ptr(n_type, (const xmlChar *)type, 1);
5458 des_const_xmlChar_ptr(n_orig, (const xmlChar *)orig, 2);
5459 des_const_xmlChar_ptr(n_replace, (const xmlChar *)replace, 3);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005460 xmlResetLastError();
5461 if (mem_base != xmlMemBlocks()) {
5462 printf("Leak of %d blocks found in xmlACatalogAdd",
5463 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005464 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005465 printf(" %d", n_catal);
5466 printf(" %d", n_type);
5467 printf(" %d", n_orig);
5468 printf(" %d", n_replace);
5469 printf("\n");
5470 }
5471 }
5472 }
5473 }
5474 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005475 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005476#endif
5477
Daniel Veillard42595322004-11-08 10:52:06 +00005478 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005479}
5480
5481
5482static int
5483test_xmlACatalogDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005484 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005485
Daniel Veillardce682bc2004-11-05 17:22:25 +00005486#ifdef LIBXML_CATALOG_ENABLED
5487#ifdef LIBXML_OUTPUT_ENABLED
5488 int mem_base;
5489 xmlCatalogPtr catal; /* a Catalog */
5490 int n_catal;
5491 FILE * out; /* the file. */
5492 int n_out;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005493
Daniel Veillardce682bc2004-11-05 17:22:25 +00005494 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5495 for (n_out = 0;n_out < gen_nb_FILE_ptr;n_out++) {
5496 mem_base = xmlMemBlocks();
5497 catal = gen_xmlCatalogPtr(n_catal, 0);
5498 out = gen_FILE_ptr(n_out, 1);
5499
5500 xmlACatalogDump(catal, out);
5501 call_tests++;
5502 des_xmlCatalogPtr(n_catal, catal, 0);
5503 des_FILE_ptr(n_out, out, 1);
5504 xmlResetLastError();
5505 if (mem_base != xmlMemBlocks()) {
5506 printf("Leak of %d blocks found in xmlACatalogDump",
5507 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005508 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005509 printf(" %d", n_catal);
5510 printf(" %d", n_out);
5511 printf("\n");
5512 }
5513 }
5514 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005515 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005516#endif
5517#endif
5518
Daniel Veillard42595322004-11-08 10:52:06 +00005519 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005520}
5521
5522
5523static int
5524test_xmlACatalogRemove(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005525 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005526
Daniel Veillardce682bc2004-11-05 17:22:25 +00005527#ifdef LIBXML_CATALOG_ENABLED
5528 int mem_base;
5529 int ret_val;
5530 xmlCatalogPtr catal; /* a Catalog */
5531 int n_catal;
5532 xmlChar * value; /* the value to remove */
5533 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005534
Daniel Veillardce682bc2004-11-05 17:22:25 +00005535 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5536 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
5537 mem_base = xmlMemBlocks();
5538 catal = gen_xmlCatalogPtr(n_catal, 0);
5539 value = gen_const_xmlChar_ptr(n_value, 1);
5540
William M. Brackf13f77f2004-11-12 16:03:48 +00005541 ret_val = xmlACatalogRemove(catal, (const xmlChar *)value);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005542 desret_int(ret_val);
5543 call_tests++;
5544 des_xmlCatalogPtr(n_catal, catal, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00005545 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005546 xmlResetLastError();
5547 if (mem_base != xmlMemBlocks()) {
5548 printf("Leak of %d blocks found in xmlACatalogRemove",
5549 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005550 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005551 printf(" %d", n_catal);
5552 printf(" %d", n_value);
5553 printf("\n");
5554 }
5555 }
5556 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005557 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005558#endif
5559
Daniel Veillard42595322004-11-08 10:52:06 +00005560 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005561}
5562
5563
5564static int
5565test_xmlACatalogResolve(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005566 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005567
Daniel Veillardce682bc2004-11-05 17:22:25 +00005568#ifdef LIBXML_CATALOG_ENABLED
5569 int mem_base;
5570 xmlChar * ret_val;
5571 xmlCatalogPtr catal; /* a Catalog */
5572 int n_catal;
5573 xmlChar * pubID; /* the public ID string */
5574 int n_pubID;
5575 xmlChar * sysID; /* the system ID string */
5576 int n_sysID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005577
Daniel Veillardce682bc2004-11-05 17:22:25 +00005578 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5579 for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) {
5580 for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) {
5581 mem_base = xmlMemBlocks();
5582 catal = gen_xmlCatalogPtr(n_catal, 0);
5583 pubID = gen_const_xmlChar_ptr(n_pubID, 1);
5584 sysID = gen_const_xmlChar_ptr(n_sysID, 2);
5585
William M. Brackf13f77f2004-11-12 16:03:48 +00005586 ret_val = xmlACatalogResolve(catal, (const xmlChar *)pubID, (const xmlChar *)sysID);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005587 desret_xmlChar_ptr(ret_val);
5588 call_tests++;
5589 des_xmlCatalogPtr(n_catal, catal, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00005590 des_const_xmlChar_ptr(n_pubID, (const xmlChar *)pubID, 1);
5591 des_const_xmlChar_ptr(n_sysID, (const xmlChar *)sysID, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005592 xmlResetLastError();
5593 if (mem_base != xmlMemBlocks()) {
5594 printf("Leak of %d blocks found in xmlACatalogResolve",
5595 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005596 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005597 printf(" %d", n_catal);
5598 printf(" %d", n_pubID);
5599 printf(" %d", n_sysID);
5600 printf("\n");
5601 }
5602 }
5603 }
5604 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005605 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005606#endif
5607
Daniel Veillard42595322004-11-08 10:52:06 +00005608 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005609}
5610
5611
5612static int
5613test_xmlACatalogResolvePublic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005614 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005615
Daniel Veillardce682bc2004-11-05 17:22:25 +00005616#ifdef LIBXML_CATALOG_ENABLED
5617 int mem_base;
5618 xmlChar * ret_val;
5619 xmlCatalogPtr catal; /* a Catalog */
5620 int n_catal;
5621 xmlChar * pubID; /* the public ID string */
5622 int n_pubID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005623
Daniel Veillardce682bc2004-11-05 17:22:25 +00005624 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5625 for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) {
5626 mem_base = xmlMemBlocks();
5627 catal = gen_xmlCatalogPtr(n_catal, 0);
5628 pubID = gen_const_xmlChar_ptr(n_pubID, 1);
5629
William M. Brackf13f77f2004-11-12 16:03:48 +00005630 ret_val = xmlACatalogResolvePublic(catal, (const xmlChar *)pubID);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005631 desret_xmlChar_ptr(ret_val);
5632 call_tests++;
5633 des_xmlCatalogPtr(n_catal, catal, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00005634 des_const_xmlChar_ptr(n_pubID, (const xmlChar *)pubID, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005635 xmlResetLastError();
5636 if (mem_base != xmlMemBlocks()) {
5637 printf("Leak of %d blocks found in xmlACatalogResolvePublic",
5638 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005639 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005640 printf(" %d", n_catal);
5641 printf(" %d", n_pubID);
5642 printf("\n");
5643 }
5644 }
5645 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005646 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005647#endif
5648
Daniel Veillard42595322004-11-08 10:52:06 +00005649 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005650}
5651
5652
5653static int
5654test_xmlACatalogResolveSystem(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005655 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005656
Daniel Veillardce682bc2004-11-05 17:22:25 +00005657#ifdef LIBXML_CATALOG_ENABLED
5658 int mem_base;
5659 xmlChar * ret_val;
5660 xmlCatalogPtr catal; /* a Catalog */
5661 int n_catal;
5662 xmlChar * sysID; /* the system ID string */
5663 int n_sysID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005664
Daniel Veillardce682bc2004-11-05 17:22:25 +00005665 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5666 for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) {
5667 mem_base = xmlMemBlocks();
5668 catal = gen_xmlCatalogPtr(n_catal, 0);
5669 sysID = gen_const_xmlChar_ptr(n_sysID, 1);
5670
William M. Brackf13f77f2004-11-12 16:03:48 +00005671 ret_val = xmlACatalogResolveSystem(catal, (const xmlChar *)sysID);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005672 desret_xmlChar_ptr(ret_val);
5673 call_tests++;
5674 des_xmlCatalogPtr(n_catal, catal, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00005675 des_const_xmlChar_ptr(n_sysID, (const xmlChar *)sysID, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005676 xmlResetLastError();
5677 if (mem_base != xmlMemBlocks()) {
5678 printf("Leak of %d blocks found in xmlACatalogResolveSystem",
5679 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005680 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005681 printf(" %d", n_catal);
5682 printf(" %d", n_sysID);
5683 printf("\n");
5684 }
5685 }
5686 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005687 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005688#endif
5689
Daniel Veillard42595322004-11-08 10:52:06 +00005690 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005691}
5692
5693
5694static int
5695test_xmlACatalogResolveURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005696 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005697
Daniel Veillardce682bc2004-11-05 17:22:25 +00005698#ifdef LIBXML_CATALOG_ENABLED
5699 int mem_base;
5700 xmlChar * ret_val;
5701 xmlCatalogPtr catal; /* a Catalog */
5702 int n_catal;
5703 xmlChar * URI; /* the URI */
5704 int n_URI;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005705
Daniel Veillardce682bc2004-11-05 17:22:25 +00005706 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5707 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
5708 mem_base = xmlMemBlocks();
5709 catal = gen_xmlCatalogPtr(n_catal, 0);
5710 URI = gen_const_xmlChar_ptr(n_URI, 1);
5711
William M. Brackf13f77f2004-11-12 16:03:48 +00005712 ret_val = xmlACatalogResolveURI(catal, (const xmlChar *)URI);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005713 desret_xmlChar_ptr(ret_val);
5714 call_tests++;
5715 des_xmlCatalogPtr(n_catal, catal, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00005716 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005717 xmlResetLastError();
5718 if (mem_base != xmlMemBlocks()) {
5719 printf("Leak of %d blocks found in xmlACatalogResolveURI",
5720 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005721 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005722 printf(" %d", n_catal);
5723 printf(" %d", n_URI);
5724 printf("\n");
5725 }
5726 }
5727 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005728 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005729#endif
5730
Daniel Veillard42595322004-11-08 10:52:06 +00005731 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005732}
5733
5734
5735static int
5736test_xmlCatalogAdd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005737 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005738
5739#ifdef LIBXML_CATALOG_ENABLED
5740 int mem_base;
5741 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005742 xmlChar * type; /* the type of record to add to the catalog */
Daniel Veillardd93f6252004-11-02 15:53:51 +00005743 int n_type;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005744 xmlChar * orig; /* the system, public or prefix to match */
Daniel Veillardd93f6252004-11-02 15:53:51 +00005745 int n_orig;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005746 xmlChar * replace; /* the replacement value for the match */
Daniel Veillardd93f6252004-11-02 15:53:51 +00005747 int n_replace;
5748
5749 for (n_type = 0;n_type < gen_nb_const_xmlChar_ptr;n_type++) {
5750 for (n_orig = 0;n_orig < gen_nb_const_xmlChar_ptr;n_orig++) {
5751 for (n_replace = 0;n_replace < gen_nb_const_xmlChar_ptr;n_replace++) {
5752 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00005753 type = gen_const_xmlChar_ptr(n_type, 0);
5754 orig = gen_const_xmlChar_ptr(n_orig, 1);
5755 replace = gen_const_xmlChar_ptr(n_replace, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005756
William M. Brackf13f77f2004-11-12 16:03:48 +00005757 ret_val = xmlCatalogAdd((const xmlChar *)type, (const xmlChar *)orig, (const xmlChar *)replace);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005758 desret_int(ret_val);
5759 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00005760 des_const_xmlChar_ptr(n_type, (const xmlChar *)type, 0);
5761 des_const_xmlChar_ptr(n_orig, (const xmlChar *)orig, 1);
5762 des_const_xmlChar_ptr(n_replace, (const xmlChar *)replace, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005763 xmlResetLastError();
5764 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00005765 printf("Leak of %d blocks found in xmlCatalogAdd",
Daniel Veillardd93f6252004-11-02 15:53:51 +00005766 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005767 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00005768 printf(" %d", n_type);
5769 printf(" %d", n_orig);
5770 printf(" %d", n_replace);
5771 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00005772 }
5773 }
5774 }
5775 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005776 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005777#endif
5778
Daniel Veillard42595322004-11-08 10:52:06 +00005779 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005780}
5781
5782
5783static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00005784test_xmlCatalogCleanup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005785 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005786
5787#ifdef LIBXML_CATALOG_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +00005788
Daniel Veillardd93f6252004-11-02 15:53:51 +00005789
5790 xmlCatalogCleanup();
5791 call_tests++;
5792 xmlResetLastError();
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005793 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005794#endif
5795
Daniel Veillard42595322004-11-08 10:52:06 +00005796 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005797}
5798
5799
5800static int
5801test_xmlCatalogConvert(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005802 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005803
5804#ifdef LIBXML_CATALOG_ENABLED
5805 int ret_val;
5806
5807
5808 ret_val = xmlCatalogConvert();
5809 desret_int(ret_val);
5810 call_tests++;
5811 xmlResetLastError();
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005812 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005813#endif
5814
Daniel Veillard42595322004-11-08 10:52:06 +00005815 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005816}
5817
5818
5819static int
5820test_xmlCatalogDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005821 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005822
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00005823#ifdef LIBXML_CATALOG_ENABLED
5824#ifdef LIBXML_OUTPUT_ENABLED
5825 int mem_base;
5826 FILE * out; /* the file. */
5827 int n_out;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005828
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00005829 for (n_out = 0;n_out < gen_nb_FILE_ptr;n_out++) {
5830 mem_base = xmlMemBlocks();
5831 out = gen_FILE_ptr(n_out, 0);
5832
5833 xmlCatalogDump(out);
5834 call_tests++;
5835 des_FILE_ptr(n_out, out, 0);
5836 xmlResetLastError();
5837 if (mem_base != xmlMemBlocks()) {
5838 printf("Leak of %d blocks found in xmlCatalogDump",
5839 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005840 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00005841 printf(" %d", n_out);
5842 printf("\n");
5843 }
5844 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005845 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00005846#endif
5847#endif
5848
Daniel Veillard42595322004-11-08 10:52:06 +00005849 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005850}
5851
5852
5853static int
5854test_xmlCatalogGetDefaults(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005855 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005856
Daniel Veillard57b25162004-11-06 14:50:18 +00005857#ifdef LIBXML_CATALOG_ENABLED
5858 int mem_base;
5859 xmlCatalogAllow ret_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005860
Daniel Veillard57b25162004-11-06 14:50:18 +00005861 mem_base = xmlMemBlocks();
5862
5863 ret_val = xmlCatalogGetDefaults();
5864 desret_xmlCatalogAllow(ret_val);
5865 call_tests++;
5866 xmlResetLastError();
5867 if (mem_base != xmlMemBlocks()) {
5868 printf("Leak of %d blocks found in xmlCatalogGetDefaults",
5869 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005870 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +00005871 printf("\n");
5872 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005873 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +00005874#endif
5875
Daniel Veillard42595322004-11-08 10:52:06 +00005876 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005877}
5878
5879
5880static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00005881test_xmlCatalogIsEmpty(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005882 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005883
Daniel Veillardce682bc2004-11-05 17:22:25 +00005884#ifdef LIBXML_CATALOG_ENABLED
5885 int mem_base;
5886 int ret_val;
5887 xmlCatalogPtr catal; /* should this create an SGML catalog */
5888 int n_catal;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005889
Daniel Veillardce682bc2004-11-05 17:22:25 +00005890 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5891 mem_base = xmlMemBlocks();
5892 catal = gen_xmlCatalogPtr(n_catal, 0);
5893
5894 ret_val = xmlCatalogIsEmpty(catal);
5895 desret_int(ret_val);
5896 call_tests++;
5897 des_xmlCatalogPtr(n_catal, catal, 0);
5898 xmlResetLastError();
5899 if (mem_base != xmlMemBlocks()) {
5900 printf("Leak of %d blocks found in xmlCatalogIsEmpty",
5901 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005902 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005903 printf(" %d", n_catal);
5904 printf("\n");
5905 }
5906 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005907 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005908#endif
5909
Daniel Veillard42595322004-11-08 10:52:06 +00005910 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005911}
5912
5913
5914static int
5915test_xmlCatalogLocalResolve(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005916 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005917
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005918#ifdef LIBXML_CATALOG_ENABLED
5919 int mem_base;
5920 xmlChar * ret_val;
5921 void * catalogs; /* a document's list of catalogs */
5922 int n_catalogs;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005923 xmlChar * pubID; /* the public ID string */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005924 int n_pubID;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005925 xmlChar * sysID; /* the system ID string */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005926 int n_sysID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005927
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005928 for (n_catalogs = 0;n_catalogs < gen_nb_void_ptr;n_catalogs++) {
5929 for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) {
5930 for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) {
5931 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00005932 catalogs = gen_void_ptr(n_catalogs, 0);
5933 pubID = gen_const_xmlChar_ptr(n_pubID, 1);
5934 sysID = gen_const_xmlChar_ptr(n_sysID, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005935
William M. Brackf13f77f2004-11-12 16:03:48 +00005936 ret_val = xmlCatalogLocalResolve(catalogs, (const xmlChar *)pubID, (const xmlChar *)sysID);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005937 desret_xmlChar_ptr(ret_val);
5938 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00005939 des_void_ptr(n_catalogs, catalogs, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00005940 des_const_xmlChar_ptr(n_pubID, (const xmlChar *)pubID, 1);
5941 des_const_xmlChar_ptr(n_sysID, (const xmlChar *)sysID, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005942 xmlResetLastError();
5943 if (mem_base != xmlMemBlocks()) {
5944 printf("Leak of %d blocks found in xmlCatalogLocalResolve",
5945 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005946 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005947 printf(" %d", n_catalogs);
5948 printf(" %d", n_pubID);
5949 printf(" %d", n_sysID);
5950 printf("\n");
5951 }
5952 }
5953 }
5954 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005955 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005956#endif
5957
Daniel Veillard42595322004-11-08 10:52:06 +00005958 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005959}
5960
5961
5962static int
5963test_xmlCatalogLocalResolveURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005964 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005965
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005966#ifdef LIBXML_CATALOG_ENABLED
5967 int mem_base;
5968 xmlChar * ret_val;
5969 void * catalogs; /* a document's list of catalogs */
5970 int n_catalogs;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005971 xmlChar * URI; /* the URI */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005972 int n_URI;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005973
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005974 for (n_catalogs = 0;n_catalogs < gen_nb_void_ptr;n_catalogs++) {
5975 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
5976 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00005977 catalogs = gen_void_ptr(n_catalogs, 0);
5978 URI = gen_const_xmlChar_ptr(n_URI, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005979
William M. Brackf13f77f2004-11-12 16:03:48 +00005980 ret_val = xmlCatalogLocalResolveURI(catalogs, (const xmlChar *)URI);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005981 desret_xmlChar_ptr(ret_val);
5982 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00005983 des_void_ptr(n_catalogs, catalogs, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00005984 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005985 xmlResetLastError();
5986 if (mem_base != xmlMemBlocks()) {
5987 printf("Leak of %d blocks found in xmlCatalogLocalResolveURI",
5988 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005989 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005990 printf(" %d", n_catalogs);
5991 printf(" %d", n_URI);
5992 printf("\n");
5993 }
5994 }
5995 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005996 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005997#endif
5998
Daniel Veillard42595322004-11-08 10:52:06 +00005999 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006000}
6001
6002
6003static int
6004test_xmlCatalogRemove(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006005 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006006
6007#ifdef LIBXML_CATALOG_ENABLED
6008 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006009 xmlChar * value; /* the value to remove */
Daniel Veillardd93f6252004-11-02 15:53:51 +00006010 int n_value;
6011
6012 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +00006013 value = gen_const_xmlChar_ptr(n_value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006014
William M. Brackf13f77f2004-11-12 16:03:48 +00006015 ret_val = xmlCatalogRemove((const xmlChar *)value);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006016 desret_int(ret_val);
6017 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00006018 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006019 xmlResetLastError();
6020 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006021 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006022#endif
6023
Daniel Veillard42595322004-11-08 10:52:06 +00006024 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006025}
6026
6027
6028static int
6029test_xmlCatalogResolve(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006030 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006031
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006032#ifdef LIBXML_CATALOG_ENABLED
6033 int mem_base;
6034 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006035 xmlChar * pubID; /* the public ID string */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006036 int n_pubID;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006037 xmlChar * sysID; /* the system ID string */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006038 int n_sysID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006039
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006040 for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) {
6041 for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) {
6042 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00006043 pubID = gen_const_xmlChar_ptr(n_pubID, 0);
6044 sysID = gen_const_xmlChar_ptr(n_sysID, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006045
William M. Brackf13f77f2004-11-12 16:03:48 +00006046 ret_val = xmlCatalogResolve((const xmlChar *)pubID, (const xmlChar *)sysID);
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);
6050 des_const_xmlChar_ptr(n_sysID, (const xmlChar *)sysID, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006051 xmlResetLastError();
6052 if (mem_base != xmlMemBlocks()) {
6053 printf("Leak of %d blocks found in xmlCatalogResolve",
6054 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006055 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006056 printf(" %d", n_pubID);
6057 printf(" %d", n_sysID);
6058 printf("\n");
6059 }
6060 }
6061 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006062 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006063#endif
6064
Daniel Veillard42595322004-11-08 10:52:06 +00006065 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006066}
6067
6068
6069static int
6070test_xmlCatalogResolvePublic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006071 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006072
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006073#ifdef LIBXML_CATALOG_ENABLED
6074 int mem_base;
6075 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006076 xmlChar * pubID; /* the public ID string */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006077 int n_pubID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006078
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006079 for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) {
6080 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00006081 pubID = gen_const_xmlChar_ptr(n_pubID, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006082
William M. Brackf13f77f2004-11-12 16:03:48 +00006083 ret_val = xmlCatalogResolvePublic((const xmlChar *)pubID);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006084 desret_xmlChar_ptr(ret_val);
6085 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00006086 des_const_xmlChar_ptr(n_pubID, (const xmlChar *)pubID, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006087 xmlResetLastError();
6088 if (mem_base != xmlMemBlocks()) {
6089 printf("Leak of %d blocks found in xmlCatalogResolvePublic",
6090 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006091 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006092 printf(" %d", n_pubID);
6093 printf("\n");
6094 }
6095 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006096 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006097#endif
6098
Daniel Veillard42595322004-11-08 10:52:06 +00006099 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006100}
6101
6102
6103static int
6104test_xmlCatalogResolveSystem(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006105 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006106
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006107#ifdef LIBXML_CATALOG_ENABLED
6108 int mem_base;
6109 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006110 xmlChar * sysID; /* the system ID string */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006111 int n_sysID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006112
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006113 for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) {
6114 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00006115 sysID = gen_const_xmlChar_ptr(n_sysID, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006116
William M. Brackf13f77f2004-11-12 16:03:48 +00006117 ret_val = xmlCatalogResolveSystem((const xmlChar *)sysID);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006118 desret_xmlChar_ptr(ret_val);
6119 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00006120 des_const_xmlChar_ptr(n_sysID, (const xmlChar *)sysID, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006121 xmlResetLastError();
6122 if (mem_base != xmlMemBlocks()) {
6123 printf("Leak of %d blocks found in xmlCatalogResolveSystem",
6124 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006125 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006126 printf(" %d", n_sysID);
6127 printf("\n");
6128 }
6129 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006130 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006131#endif
6132
Daniel Veillard42595322004-11-08 10:52:06 +00006133 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006134}
6135
6136
6137static int
6138test_xmlCatalogResolveURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006139 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006140
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006141#ifdef LIBXML_CATALOG_ENABLED
6142 int mem_base;
6143 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006144 xmlChar * URI; /* the URI */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006145 int n_URI;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006146
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006147 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
6148 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00006149 URI = gen_const_xmlChar_ptr(n_URI, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006150
William M. Brackf13f77f2004-11-12 16:03:48 +00006151 ret_val = xmlCatalogResolveURI((const xmlChar *)URI);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006152 desret_xmlChar_ptr(ret_val);
6153 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00006154 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006155 xmlResetLastError();
6156 if (mem_base != xmlMemBlocks()) {
6157 printf("Leak of %d blocks found in xmlCatalogResolveURI",
6158 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006159 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006160 printf(" %d", n_URI);
6161 printf("\n");
6162 }
6163 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006164 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006165#endif
6166
Daniel Veillard42595322004-11-08 10:52:06 +00006167 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006168}
6169
6170
6171static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00006172test_xmlCatalogSetDefaultPrefer(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006173 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006174
Daniel Veillard57b25162004-11-06 14:50:18 +00006175#ifdef LIBXML_CATALOG_ENABLED
6176 int mem_base;
6177 xmlCatalogPrefer ret_val;
6178 xmlCatalogPrefer prefer; /* the default preference for delegation */
6179 int n_prefer;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006180
Daniel Veillard57b25162004-11-06 14:50:18 +00006181 for (n_prefer = 0;n_prefer < gen_nb_xmlCatalogPrefer;n_prefer++) {
6182 mem_base = xmlMemBlocks();
6183 prefer = gen_xmlCatalogPrefer(n_prefer, 0);
6184
6185 ret_val = xmlCatalogSetDefaultPrefer(prefer);
6186 desret_xmlCatalogPrefer(ret_val);
6187 call_tests++;
6188 des_xmlCatalogPrefer(n_prefer, prefer, 0);
6189 xmlResetLastError();
6190 if (mem_base != xmlMemBlocks()) {
6191 printf("Leak of %d blocks found in xmlCatalogSetDefaultPrefer",
6192 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006193 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +00006194 printf(" %d", n_prefer);
6195 printf("\n");
6196 }
6197 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006198 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +00006199#endif
6200
Daniel Veillard42595322004-11-08 10:52:06 +00006201 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006202}
6203
6204
6205static int
6206test_xmlCatalogSetDefaults(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006207 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006208
Daniel Veillard57b25162004-11-06 14:50:18 +00006209#ifdef LIBXML_CATALOG_ENABLED
6210 int mem_base;
6211 xmlCatalogAllow allow; /* what catalogs should be accepted */
6212 int n_allow;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006213
Daniel Veillard57b25162004-11-06 14:50:18 +00006214 for (n_allow = 0;n_allow < gen_nb_xmlCatalogAllow;n_allow++) {
6215 mem_base = xmlMemBlocks();
6216 allow = gen_xmlCatalogAllow(n_allow, 0);
6217
6218 xmlCatalogSetDefaults(allow);
6219 call_tests++;
6220 des_xmlCatalogAllow(n_allow, allow, 0);
6221 xmlResetLastError();
6222 if (mem_base != xmlMemBlocks()) {
6223 printf("Leak of %d blocks found in xmlCatalogSetDefaults",
6224 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006225 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +00006226 printf(" %d", n_allow);
6227 printf("\n");
6228 }
6229 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006230 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +00006231#endif
6232
Daniel Veillard42595322004-11-08 10:52:06 +00006233 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006234}
6235
6236
6237static int
6238test_xmlConvertSGMLCatalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006239 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006240
Daniel Veillardce682bc2004-11-05 17:22:25 +00006241#ifdef LIBXML_CATALOG_ENABLED
6242 int mem_base;
6243 int ret_val;
6244 xmlCatalogPtr catal; /* the catalog */
6245 int n_catal;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006246
Daniel Veillardce682bc2004-11-05 17:22:25 +00006247 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
6248 mem_base = xmlMemBlocks();
6249 catal = gen_xmlCatalogPtr(n_catal, 0);
6250
6251 ret_val = xmlConvertSGMLCatalog(catal);
6252 desret_int(ret_val);
6253 call_tests++;
6254 des_xmlCatalogPtr(n_catal, catal, 0);
6255 xmlResetLastError();
6256 if (mem_base != xmlMemBlocks()) {
6257 printf("Leak of %d blocks found in xmlConvertSGMLCatalog",
6258 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006259 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006260 printf(" %d", n_catal);
6261 printf("\n");
6262 }
6263 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006264 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006265#endif
6266
Daniel Veillard42595322004-11-08 10:52:06 +00006267 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006268}
6269
6270
6271static int
6272test_xmlInitializeCatalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006273 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006274
6275#ifdef LIBXML_CATALOG_ENABLED
6276 int mem_base;
6277
6278 mem_base = xmlMemBlocks();
6279
6280 xmlInitializeCatalog();
6281 call_tests++;
6282 xmlResetLastError();
6283 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00006284 printf("Leak of %d blocks found in xmlInitializeCatalog",
Daniel Veillardd93f6252004-11-02 15:53:51 +00006285 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006286 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00006287 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00006288 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006289 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006290#endif
6291
Daniel Veillard42595322004-11-08 10:52:06 +00006292 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006293}
6294
6295
6296static int
6297test_xmlLoadACatalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006298 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006299
6300
6301 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00006302 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006303}
6304
6305
6306static int
6307test_xmlLoadCatalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006308 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006309
6310#ifdef LIBXML_CATALOG_ENABLED
6311 int ret_val;
6312 const char * filename; /* a file path */
6313 int n_filename;
6314
6315 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +00006316 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006317
6318 ret_val = xmlLoadCatalog(filename);
6319 desret_int(ret_val);
6320 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006321 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006322 xmlResetLastError();
6323 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006324 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006325#endif
6326
Daniel Veillard42595322004-11-08 10:52:06 +00006327 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006328}
6329
6330
6331static int
6332test_xmlLoadCatalogs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006333 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006334
6335#ifdef LIBXML_CATALOG_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +00006336 char * pathss; /* a list of directories separated by a colon or a space. */
Daniel Veillardd93f6252004-11-02 15:53:51 +00006337 int n_pathss;
6338
6339 for (n_pathss = 0;n_pathss < gen_nb_const_char_ptr;n_pathss++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +00006340 pathss = gen_const_char_ptr(n_pathss, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006341
William M. Brackf13f77f2004-11-12 16:03:48 +00006342 xmlLoadCatalogs((const char *)pathss);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006343 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00006344 des_const_char_ptr(n_pathss, (const char *)pathss, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006345 xmlResetLastError();
6346 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006347 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006348#endif
6349
Daniel Veillard42595322004-11-08 10:52:06 +00006350 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006351}
6352
6353
6354static int
6355test_xmlLoadSGMLSuperCatalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006356 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006357
6358
6359 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00006360 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006361}
6362
6363
6364static int
6365test_xmlNewCatalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006366 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006367
6368
6369 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00006370 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006371}
6372
6373
6374static int
6375test_xmlParseCatalogFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006376 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006377
6378#ifdef LIBXML_CATALOG_ENABLED
6379 int mem_base;
6380 xmlDocPtr ret_val;
6381 const char * filename; /* the filename */
6382 int n_filename;
6383
6384 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
6385 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00006386 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006387
6388 ret_val = xmlParseCatalogFile(filename);
6389 desret_xmlDocPtr(ret_val);
6390 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006391 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006392 xmlResetLastError();
6393 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00006394 printf("Leak of %d blocks found in xmlParseCatalogFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +00006395 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006396 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00006397 printf(" %d", n_filename);
6398 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00006399 }
6400 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006401 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006402#endif
6403
Daniel Veillard42595322004-11-08 10:52:06 +00006404 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006405}
6406
6407static int
6408test_catalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006409 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006410
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006411 if (quiet == 0) printf("Testing catalog : 27 of 36 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00006412 test_ret += test_xmlACatalogAdd();
6413 test_ret += test_xmlACatalogDump();
6414 test_ret += test_xmlACatalogRemove();
6415 test_ret += test_xmlACatalogResolve();
6416 test_ret += test_xmlACatalogResolvePublic();
6417 test_ret += test_xmlACatalogResolveSystem();
6418 test_ret += test_xmlACatalogResolveURI();
6419 test_ret += test_xmlCatalogAdd();
6420 test_ret += test_xmlCatalogCleanup();
6421 test_ret += test_xmlCatalogConvert();
6422 test_ret += test_xmlCatalogDump();
6423 test_ret += test_xmlCatalogGetDefaults();
6424 test_ret += test_xmlCatalogIsEmpty();
6425 test_ret += test_xmlCatalogLocalResolve();
6426 test_ret += test_xmlCatalogLocalResolveURI();
6427 test_ret += test_xmlCatalogRemove();
6428 test_ret += test_xmlCatalogResolve();
6429 test_ret += test_xmlCatalogResolvePublic();
6430 test_ret += test_xmlCatalogResolveSystem();
6431 test_ret += test_xmlCatalogResolveURI();
6432 test_ret += test_xmlCatalogSetDefaultPrefer();
6433 test_ret += test_xmlCatalogSetDefaults();
6434 test_ret += test_xmlConvertSGMLCatalog();
6435 test_ret += test_xmlInitializeCatalog();
6436 test_ret += test_xmlLoadACatalog();
6437 test_ret += test_xmlLoadCatalog();
6438 test_ret += test_xmlLoadCatalogs();
6439 test_ret += test_xmlLoadSGMLSuperCatalog();
6440 test_ret += test_xmlNewCatalog();
6441 test_ret += test_xmlParseCatalogFile();
Daniel Veillardd93f6252004-11-02 15:53:51 +00006442
Daniel Veillard42595322004-11-08 10:52:06 +00006443 if (test_ret != 0)
6444 printf("Module catalog: %d errors\n", test_ret);
6445 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006446}
6447
Daniel Veillardce682bc2004-11-05 17:22:25 +00006448#define gen_nb_const_xmlChRangeGroupPtr 1
6449static xmlChRangeGroupPtr gen_const_xmlChRangeGroupPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
6450 return(NULL);
6451}
6452static void des_const_xmlChRangeGroupPtr(int no ATTRIBUTE_UNUSED, const xmlChRangeGroupPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
6453}
6454
Daniel Veillardd93f6252004-11-02 15:53:51 +00006455static int
6456test_xmlCharInRange(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006457 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006458
Daniel Veillardce682bc2004-11-05 17:22:25 +00006459 int mem_base;
6460 int ret_val;
6461 unsigned int val; /* character to be validated */
6462 int n_val;
6463 xmlChRangeGroupPtr rptr; /* pointer to range to be used to validate */
6464 int n_rptr;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006465
Daniel Veillardce682bc2004-11-05 17:22:25 +00006466 for (n_val = 0;n_val < gen_nb_unsigned_int;n_val++) {
6467 for (n_rptr = 0;n_rptr < gen_nb_const_xmlChRangeGroupPtr;n_rptr++) {
6468 mem_base = xmlMemBlocks();
6469 val = gen_unsigned_int(n_val, 0);
6470 rptr = gen_const_xmlChRangeGroupPtr(n_rptr, 1);
6471
William M. Brackf13f77f2004-11-12 16:03:48 +00006472 ret_val = xmlCharInRange(val, (const xmlChRangeGroupPtr)rptr);
Daniel Veillardce682bc2004-11-05 17:22:25 +00006473 desret_int(ret_val);
6474 call_tests++;
6475 des_unsigned_int(n_val, val, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00006476 des_const_xmlChRangeGroupPtr(n_rptr, (const xmlChRangeGroupPtr)rptr, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +00006477 xmlResetLastError();
6478 if (mem_base != xmlMemBlocks()) {
6479 printf("Leak of %d blocks found in xmlCharInRange",
6480 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006481 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006482 printf(" %d", n_val);
6483 printf(" %d", n_rptr);
6484 printf("\n");
6485 }
6486 }
6487 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00006488 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006489
Daniel Veillard42595322004-11-08 10:52:06 +00006490 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006491}
6492
6493
6494static int
6495test_xmlIsBaseChar(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006496 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006497
Daniel Veillard3d97e662004-11-04 10:49:00 +00006498 int mem_base;
6499 int ret_val;
6500 unsigned int ch; /* character to validate */
6501 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006502
Daniel Veillard3d97e662004-11-04 10:49:00 +00006503 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6504 mem_base = xmlMemBlocks();
6505 ch = gen_unsigned_int(n_ch, 0);
6506
6507 ret_val = xmlIsBaseChar(ch);
6508 desret_int(ret_val);
6509 call_tests++;
6510 des_unsigned_int(n_ch, ch, 0);
6511 xmlResetLastError();
6512 if (mem_base != xmlMemBlocks()) {
6513 printf("Leak of %d blocks found in xmlIsBaseChar",
6514 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006515 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006516 printf(" %d", n_ch);
6517 printf("\n");
6518 }
6519 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00006520 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006521
Daniel Veillard42595322004-11-08 10:52:06 +00006522 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006523}
6524
6525
6526static int
6527test_xmlIsBlank(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006528 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006529
Daniel Veillard3d97e662004-11-04 10:49:00 +00006530 int mem_base;
6531 int ret_val;
6532 unsigned int ch; /* character to validate */
6533 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006534
Daniel Veillard3d97e662004-11-04 10:49:00 +00006535 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6536 mem_base = xmlMemBlocks();
6537 ch = gen_unsigned_int(n_ch, 0);
6538
6539 ret_val = xmlIsBlank(ch);
6540 desret_int(ret_val);
6541 call_tests++;
6542 des_unsigned_int(n_ch, ch, 0);
6543 xmlResetLastError();
6544 if (mem_base != xmlMemBlocks()) {
6545 printf("Leak of %d blocks found in xmlIsBlank",
6546 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006547 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006548 printf(" %d", n_ch);
6549 printf("\n");
6550 }
6551 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00006552 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006553
Daniel Veillard42595322004-11-08 10:52:06 +00006554 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006555}
6556
6557
6558static int
6559test_xmlIsChar(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006560 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006561
Daniel Veillard3d97e662004-11-04 10:49:00 +00006562 int mem_base;
6563 int ret_val;
6564 unsigned int ch; /* character to validate */
6565 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006566
Daniel Veillard3d97e662004-11-04 10:49:00 +00006567 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6568 mem_base = xmlMemBlocks();
6569 ch = gen_unsigned_int(n_ch, 0);
6570
6571 ret_val = xmlIsChar(ch);
6572 desret_int(ret_val);
6573 call_tests++;
6574 des_unsigned_int(n_ch, ch, 0);
6575 xmlResetLastError();
6576 if (mem_base != xmlMemBlocks()) {
6577 printf("Leak of %d blocks found in xmlIsChar",
6578 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006579 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006580 printf(" %d", n_ch);
6581 printf("\n");
6582 }
6583 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00006584 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006585
Daniel Veillard42595322004-11-08 10:52:06 +00006586 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006587}
6588
6589
6590static int
6591test_xmlIsCombining(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006592 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006593
Daniel Veillard3d97e662004-11-04 10:49:00 +00006594 int mem_base;
6595 int ret_val;
6596 unsigned int ch; /* character to validate */
6597 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006598
Daniel Veillard3d97e662004-11-04 10:49:00 +00006599 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6600 mem_base = xmlMemBlocks();
6601 ch = gen_unsigned_int(n_ch, 0);
6602
6603 ret_val = xmlIsCombining(ch);
6604 desret_int(ret_val);
6605 call_tests++;
6606 des_unsigned_int(n_ch, ch, 0);
6607 xmlResetLastError();
6608 if (mem_base != xmlMemBlocks()) {
6609 printf("Leak of %d blocks found in xmlIsCombining",
6610 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006611 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006612 printf(" %d", n_ch);
6613 printf("\n");
6614 }
6615 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00006616 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006617
Daniel Veillard42595322004-11-08 10:52:06 +00006618 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006619}
6620
6621
6622static int
6623test_xmlIsDigit(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006624 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006625
Daniel Veillard3d97e662004-11-04 10:49:00 +00006626 int mem_base;
6627 int ret_val;
6628 unsigned int ch; /* character to validate */
6629 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006630
Daniel Veillard3d97e662004-11-04 10:49:00 +00006631 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6632 mem_base = xmlMemBlocks();
6633 ch = gen_unsigned_int(n_ch, 0);
6634
6635 ret_val = xmlIsDigit(ch);
6636 desret_int(ret_val);
6637 call_tests++;
6638 des_unsigned_int(n_ch, ch, 0);
6639 xmlResetLastError();
6640 if (mem_base != xmlMemBlocks()) {
6641 printf("Leak of %d blocks found in xmlIsDigit",
6642 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006643 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006644 printf(" %d", n_ch);
6645 printf("\n");
6646 }
6647 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00006648 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006649
Daniel Veillard42595322004-11-08 10:52:06 +00006650 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006651}
6652
6653
6654static int
6655test_xmlIsExtender(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006656 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006657
Daniel Veillard3d97e662004-11-04 10:49:00 +00006658 int mem_base;
6659 int ret_val;
6660 unsigned int ch; /* character to validate */
6661 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006662
Daniel Veillard3d97e662004-11-04 10:49:00 +00006663 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6664 mem_base = xmlMemBlocks();
6665 ch = gen_unsigned_int(n_ch, 0);
6666
6667 ret_val = xmlIsExtender(ch);
6668 desret_int(ret_val);
6669 call_tests++;
6670 des_unsigned_int(n_ch, ch, 0);
6671 xmlResetLastError();
6672 if (mem_base != xmlMemBlocks()) {
6673 printf("Leak of %d blocks found in xmlIsExtender",
6674 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006675 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006676 printf(" %d", n_ch);
6677 printf("\n");
6678 }
6679 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00006680 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006681
Daniel Veillard42595322004-11-08 10:52:06 +00006682 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006683}
6684
6685
6686static int
6687test_xmlIsIdeographic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006688 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006689
Daniel Veillard3d97e662004-11-04 10:49:00 +00006690 int mem_base;
6691 int ret_val;
6692 unsigned int ch; /* character to validate */
6693 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006694
Daniel Veillard3d97e662004-11-04 10:49:00 +00006695 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6696 mem_base = xmlMemBlocks();
6697 ch = gen_unsigned_int(n_ch, 0);
6698
6699 ret_val = xmlIsIdeographic(ch);
6700 desret_int(ret_val);
6701 call_tests++;
6702 des_unsigned_int(n_ch, ch, 0);
6703 xmlResetLastError();
6704 if (mem_base != xmlMemBlocks()) {
6705 printf("Leak of %d blocks found in xmlIsIdeographic",
6706 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006707 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006708 printf(" %d", n_ch);
6709 printf("\n");
6710 }
6711 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00006712 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006713
Daniel Veillard42595322004-11-08 10:52:06 +00006714 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006715}
6716
6717
6718static int
6719test_xmlIsPubidChar(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006720 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006721
Daniel Veillard3d97e662004-11-04 10:49:00 +00006722 int mem_base;
6723 int ret_val;
6724 unsigned int ch; /* character to validate */
6725 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006726
Daniel Veillard3d97e662004-11-04 10:49:00 +00006727 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6728 mem_base = xmlMemBlocks();
6729 ch = gen_unsigned_int(n_ch, 0);
6730
6731 ret_val = xmlIsPubidChar(ch);
6732 desret_int(ret_val);
6733 call_tests++;
6734 des_unsigned_int(n_ch, ch, 0);
6735 xmlResetLastError();
6736 if (mem_base != xmlMemBlocks()) {
6737 printf("Leak of %d blocks found in xmlIsPubidChar",
6738 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006739 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006740 printf(" %d", n_ch);
6741 printf("\n");
6742 }
6743 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00006744 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006745
Daniel Veillard42595322004-11-08 10:52:06 +00006746 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006747}
6748
6749static int
6750test_chvalid(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006751 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006752
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006753 if (quiet == 0) printf("Testing chvalid : 9 of 9 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00006754 test_ret += test_xmlCharInRange();
6755 test_ret += test_xmlIsBaseChar();
6756 test_ret += test_xmlIsBlank();
6757 test_ret += test_xmlIsChar();
6758 test_ret += test_xmlIsCombining();
6759 test_ret += test_xmlIsDigit();
6760 test_ret += test_xmlIsExtender();
6761 test_ret += test_xmlIsIdeographic();
6762 test_ret += test_xmlIsPubidChar();
Daniel Veillardd93f6252004-11-02 15:53:51 +00006763
Daniel Veillard42595322004-11-08 10:52:06 +00006764 if (test_ret != 0)
6765 printf("Module chvalid: %d errors\n", test_ret);
6766 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006767}
6768
6769static int
Daniel Veillarda82b1822004-11-08 16:24:57 +00006770test_xmlBoolToText(void) {
6771 int test_ret = 0;
6772
6773#ifdef LIBXML_DEBUG_ENABLED
6774 int mem_base;
6775 const char * ret_val;
6776 int boolval; /* a bool to turn into text */
6777 int n_boolval;
6778
6779 for (n_boolval = 0;n_boolval < gen_nb_int;n_boolval++) {
6780 mem_base = xmlMemBlocks();
6781 boolval = gen_int(n_boolval, 0);
6782
6783 ret_val = xmlBoolToText(boolval);
6784 desret_const_char_ptr(ret_val);
6785 call_tests++;
6786 des_int(n_boolval, boolval, 0);
6787 xmlResetLastError();
6788 if (mem_base != xmlMemBlocks()) {
6789 printf("Leak of %d blocks found in xmlBoolToText",
6790 xmlMemBlocks() - mem_base);
6791 test_ret++;
6792 printf(" %d", n_boolval);
6793 printf("\n");
6794 }
6795 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006796 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00006797#endif
6798
Daniel Veillarda82b1822004-11-08 16:24:57 +00006799 return(test_ret);
6800}
6801
6802
6803static int
6804test_xmlDebugCheckDocument(void) {
6805 int test_ret = 0;
6806
6807#ifdef LIBXML_DEBUG_ENABLED
6808 int mem_base;
6809 int ret_val;
6810 FILE * output; /* the FILE * for the output */
6811 int n_output;
6812 xmlDocPtr doc; /* the document */
6813 int n_doc;
6814
6815 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
6816 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
6817 mem_base = xmlMemBlocks();
6818 output = gen_debug_FILE_ptr(n_output, 0);
6819 doc = gen_xmlDocPtr(n_doc, 1);
6820
6821 ret_val = xmlDebugCheckDocument(output, doc);
6822 desret_int(ret_val);
6823 call_tests++;
6824 des_debug_FILE_ptr(n_output, output, 0);
6825 des_xmlDocPtr(n_doc, doc, 1);
6826 xmlResetLastError();
6827 if (mem_base != xmlMemBlocks()) {
6828 printf("Leak of %d blocks found in xmlDebugCheckDocument",
6829 xmlMemBlocks() - mem_base);
6830 test_ret++;
6831 printf(" %d", n_output);
6832 printf(" %d", n_doc);
6833 printf("\n");
6834 }
6835 }
6836 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006837 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00006838#endif
6839
Daniel Veillarda82b1822004-11-08 16:24:57 +00006840 return(test_ret);
6841}
6842
6843
6844static int
6845test_xmlDebugDumpAttr(void) {
6846 int test_ret = 0;
6847
6848#ifdef LIBXML_DEBUG_ENABLED
6849 int mem_base;
6850 FILE * output; /* the FILE * for the output */
6851 int n_output;
6852 xmlAttrPtr attr; /* the attribute */
6853 int n_attr;
6854 int depth; /* the indentation level. */
6855 int n_depth;
6856
6857 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
6858 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
6859 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
6860 mem_base = xmlMemBlocks();
6861 output = gen_debug_FILE_ptr(n_output, 0);
6862 attr = gen_xmlAttrPtr(n_attr, 1);
6863 depth = gen_int(n_depth, 2);
6864
6865 xmlDebugDumpAttr(output, attr, depth);
6866 call_tests++;
6867 des_debug_FILE_ptr(n_output, output, 0);
6868 des_xmlAttrPtr(n_attr, attr, 1);
6869 des_int(n_depth, depth, 2);
6870 xmlResetLastError();
6871 if (mem_base != xmlMemBlocks()) {
6872 printf("Leak of %d blocks found in xmlDebugDumpAttr",
6873 xmlMemBlocks() - mem_base);
6874 test_ret++;
6875 printf(" %d", n_output);
6876 printf(" %d", n_attr);
6877 printf(" %d", n_depth);
6878 printf("\n");
6879 }
6880 }
6881 }
6882 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006883 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00006884#endif
6885
Daniel Veillarda82b1822004-11-08 16:24:57 +00006886 return(test_ret);
6887}
6888
6889
6890static int
6891test_xmlDebugDumpAttrList(void) {
6892 int test_ret = 0;
6893
6894#ifdef LIBXML_DEBUG_ENABLED
6895 int mem_base;
6896 FILE * output; /* the FILE * for the output */
6897 int n_output;
6898 xmlAttrPtr attr; /* the attribute list */
6899 int n_attr;
6900 int depth; /* the indentation level. */
6901 int n_depth;
6902
6903 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
6904 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
6905 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
6906 mem_base = xmlMemBlocks();
6907 output = gen_debug_FILE_ptr(n_output, 0);
6908 attr = gen_xmlAttrPtr(n_attr, 1);
6909 depth = gen_int(n_depth, 2);
6910
6911 xmlDebugDumpAttrList(output, attr, depth);
6912 call_tests++;
6913 des_debug_FILE_ptr(n_output, output, 0);
6914 des_xmlAttrPtr(n_attr, attr, 1);
6915 des_int(n_depth, depth, 2);
6916 xmlResetLastError();
6917 if (mem_base != xmlMemBlocks()) {
6918 printf("Leak of %d blocks found in xmlDebugDumpAttrList",
6919 xmlMemBlocks() - mem_base);
6920 test_ret++;
6921 printf(" %d", n_output);
6922 printf(" %d", n_attr);
6923 printf(" %d", n_depth);
6924 printf("\n");
6925 }
6926 }
6927 }
6928 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006929 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00006930#endif
6931
Daniel Veillarda82b1822004-11-08 16:24:57 +00006932 return(test_ret);
6933}
6934
6935
6936static int
6937test_xmlDebugDumpDTD(void) {
6938 int test_ret = 0;
6939
6940#ifdef LIBXML_DEBUG_ENABLED
6941 int mem_base;
6942 FILE * output; /* the FILE * for the output */
6943 int n_output;
6944 xmlDtdPtr dtd; /* the DTD */
6945 int n_dtd;
6946
6947 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
6948 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
6949 mem_base = xmlMemBlocks();
6950 output = gen_debug_FILE_ptr(n_output, 0);
6951 dtd = gen_xmlDtdPtr(n_dtd, 1);
6952
6953 xmlDebugDumpDTD(output, dtd);
6954 call_tests++;
6955 des_debug_FILE_ptr(n_output, output, 0);
6956 des_xmlDtdPtr(n_dtd, dtd, 1);
6957 xmlResetLastError();
6958 if (mem_base != xmlMemBlocks()) {
6959 printf("Leak of %d blocks found in xmlDebugDumpDTD",
6960 xmlMemBlocks() - mem_base);
6961 test_ret++;
6962 printf(" %d", n_output);
6963 printf(" %d", n_dtd);
6964 printf("\n");
6965 }
6966 }
6967 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006968 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00006969#endif
6970
Daniel Veillarda82b1822004-11-08 16:24:57 +00006971 return(test_ret);
6972}
6973
6974
6975static int
6976test_xmlDebugDumpDocument(void) {
6977 int test_ret = 0;
6978
6979#ifdef LIBXML_DEBUG_ENABLED
6980 int mem_base;
6981 FILE * output; /* the FILE * for the output */
6982 int n_output;
6983 xmlDocPtr doc; /* the document */
6984 int n_doc;
6985
6986 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
6987 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
6988 mem_base = xmlMemBlocks();
6989 output = gen_debug_FILE_ptr(n_output, 0);
6990 doc = gen_xmlDocPtr(n_doc, 1);
6991
6992 xmlDebugDumpDocument(output, doc);
6993 call_tests++;
6994 des_debug_FILE_ptr(n_output, output, 0);
6995 des_xmlDocPtr(n_doc, doc, 1);
6996 xmlResetLastError();
6997 if (mem_base != xmlMemBlocks()) {
6998 printf("Leak of %d blocks found in xmlDebugDumpDocument",
6999 xmlMemBlocks() - mem_base);
7000 test_ret++;
7001 printf(" %d", n_output);
7002 printf(" %d", n_doc);
7003 printf("\n");
7004 }
7005 }
7006 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007007 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007008#endif
7009
Daniel Veillarda82b1822004-11-08 16:24:57 +00007010 return(test_ret);
7011}
7012
7013
7014static int
7015test_xmlDebugDumpDocumentHead(void) {
7016 int test_ret = 0;
7017
7018#ifdef LIBXML_DEBUG_ENABLED
7019 int mem_base;
7020 FILE * output; /* the FILE * for the output */
7021 int n_output;
7022 xmlDocPtr doc; /* the document */
7023 int n_doc;
7024
7025 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7026 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
7027 mem_base = xmlMemBlocks();
7028 output = gen_debug_FILE_ptr(n_output, 0);
7029 doc = gen_xmlDocPtr(n_doc, 1);
7030
7031 xmlDebugDumpDocumentHead(output, doc);
7032 call_tests++;
7033 des_debug_FILE_ptr(n_output, output, 0);
7034 des_xmlDocPtr(n_doc, doc, 1);
7035 xmlResetLastError();
7036 if (mem_base != xmlMemBlocks()) {
7037 printf("Leak of %d blocks found in xmlDebugDumpDocumentHead",
7038 xmlMemBlocks() - mem_base);
7039 test_ret++;
7040 printf(" %d", n_output);
7041 printf(" %d", n_doc);
7042 printf("\n");
7043 }
7044 }
7045 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007046 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007047#endif
7048
Daniel Veillarda82b1822004-11-08 16:24:57 +00007049 return(test_ret);
7050}
7051
7052
7053static int
7054test_xmlDebugDumpEntities(void) {
7055 int test_ret = 0;
7056
7057#ifdef LIBXML_DEBUG_ENABLED
7058 int mem_base;
7059 FILE * output; /* the FILE * for the output */
7060 int n_output;
7061 xmlDocPtr doc; /* the document */
7062 int n_doc;
7063
7064 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7065 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
7066 mem_base = xmlMemBlocks();
7067 output = gen_debug_FILE_ptr(n_output, 0);
7068 doc = gen_xmlDocPtr(n_doc, 1);
7069
7070 xmlDebugDumpEntities(output, doc);
7071 call_tests++;
7072 des_debug_FILE_ptr(n_output, output, 0);
7073 des_xmlDocPtr(n_doc, doc, 1);
7074 xmlResetLastError();
7075 if (mem_base != xmlMemBlocks()) {
7076 printf("Leak of %d blocks found in xmlDebugDumpEntities",
7077 xmlMemBlocks() - mem_base);
7078 test_ret++;
7079 printf(" %d", n_output);
7080 printf(" %d", n_doc);
7081 printf("\n");
7082 }
7083 }
7084 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007085 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007086#endif
7087
Daniel Veillarda82b1822004-11-08 16:24:57 +00007088 return(test_ret);
7089}
7090
7091
7092static int
7093test_xmlDebugDumpNode(void) {
7094 int test_ret = 0;
7095
7096#ifdef LIBXML_DEBUG_ENABLED
7097 int mem_base;
7098 FILE * output; /* the FILE * for the output */
7099 int n_output;
7100 xmlNodePtr node; /* the node */
7101 int n_node;
7102 int depth; /* the indentation level. */
7103 int n_depth;
7104
7105 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7106 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7107 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
7108 mem_base = xmlMemBlocks();
7109 output = gen_debug_FILE_ptr(n_output, 0);
7110 node = gen_xmlNodePtr(n_node, 1);
7111 depth = gen_int(n_depth, 2);
7112
7113 xmlDebugDumpNode(output, node, depth);
7114 call_tests++;
7115 des_debug_FILE_ptr(n_output, output, 0);
7116 des_xmlNodePtr(n_node, node, 1);
7117 des_int(n_depth, depth, 2);
7118 xmlResetLastError();
7119 if (mem_base != xmlMemBlocks()) {
7120 printf("Leak of %d blocks found in xmlDebugDumpNode",
7121 xmlMemBlocks() - mem_base);
7122 test_ret++;
7123 printf(" %d", n_output);
7124 printf(" %d", n_node);
7125 printf(" %d", n_depth);
7126 printf("\n");
7127 }
7128 }
7129 }
7130 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007131 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007132#endif
7133
Daniel Veillarda82b1822004-11-08 16:24:57 +00007134 return(test_ret);
7135}
7136
7137
7138static int
7139test_xmlDebugDumpNodeList(void) {
7140 int test_ret = 0;
7141
7142#ifdef LIBXML_DEBUG_ENABLED
7143 int mem_base;
7144 FILE * output; /* the FILE * for the output */
7145 int n_output;
7146 xmlNodePtr node; /* the node list */
7147 int n_node;
7148 int depth; /* the indentation level. */
7149 int n_depth;
7150
7151 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7152 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7153 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
7154 mem_base = xmlMemBlocks();
7155 output = gen_debug_FILE_ptr(n_output, 0);
7156 node = gen_xmlNodePtr(n_node, 1);
7157 depth = gen_int(n_depth, 2);
7158
7159 xmlDebugDumpNodeList(output, node, depth);
7160 call_tests++;
7161 des_debug_FILE_ptr(n_output, output, 0);
7162 des_xmlNodePtr(n_node, node, 1);
7163 des_int(n_depth, depth, 2);
7164 xmlResetLastError();
7165 if (mem_base != xmlMemBlocks()) {
7166 printf("Leak of %d blocks found in xmlDebugDumpNodeList",
7167 xmlMemBlocks() - mem_base);
7168 test_ret++;
7169 printf(" %d", n_output);
7170 printf(" %d", n_node);
7171 printf(" %d", n_depth);
7172 printf("\n");
7173 }
7174 }
7175 }
7176 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007177 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007178#endif
7179
Daniel Veillarda82b1822004-11-08 16:24:57 +00007180 return(test_ret);
7181}
7182
7183
7184static int
7185test_xmlDebugDumpOneNode(void) {
7186 int test_ret = 0;
7187
7188#ifdef LIBXML_DEBUG_ENABLED
7189 int mem_base;
7190 FILE * output; /* the FILE * for the output */
7191 int n_output;
7192 xmlNodePtr node; /* the node */
7193 int n_node;
7194 int depth; /* the indentation level. */
7195 int n_depth;
7196
7197 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7198 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7199 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
7200 mem_base = xmlMemBlocks();
7201 output = gen_debug_FILE_ptr(n_output, 0);
7202 node = gen_xmlNodePtr(n_node, 1);
7203 depth = gen_int(n_depth, 2);
7204
7205 xmlDebugDumpOneNode(output, node, depth);
7206 call_tests++;
7207 des_debug_FILE_ptr(n_output, output, 0);
7208 des_xmlNodePtr(n_node, node, 1);
7209 des_int(n_depth, depth, 2);
7210 xmlResetLastError();
7211 if (mem_base != xmlMemBlocks()) {
7212 printf("Leak of %d blocks found in xmlDebugDumpOneNode",
7213 xmlMemBlocks() - mem_base);
7214 test_ret++;
7215 printf(" %d", n_output);
7216 printf(" %d", n_node);
7217 printf(" %d", n_depth);
7218 printf("\n");
7219 }
7220 }
7221 }
7222 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007223 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007224#endif
7225
Daniel Veillarda82b1822004-11-08 16:24:57 +00007226 return(test_ret);
7227}
7228
7229
7230static int
7231test_xmlDebugDumpString(void) {
7232 int test_ret = 0;
7233
7234#ifdef LIBXML_DEBUG_ENABLED
7235 int mem_base;
7236 FILE * output; /* the FILE * for the output */
7237 int n_output;
7238 xmlChar * str; /* the string */
7239 int n_str;
7240
7241 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7242 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
7243 mem_base = xmlMemBlocks();
7244 output = gen_debug_FILE_ptr(n_output, 0);
7245 str = gen_const_xmlChar_ptr(n_str, 1);
7246
William M. Brackf13f77f2004-11-12 16:03:48 +00007247 xmlDebugDumpString(output, (const xmlChar *)str);
Daniel Veillarda82b1822004-11-08 16:24:57 +00007248 call_tests++;
7249 des_debug_FILE_ptr(n_output, output, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00007250 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillarda82b1822004-11-08 16:24:57 +00007251 xmlResetLastError();
7252 if (mem_base != xmlMemBlocks()) {
7253 printf("Leak of %d blocks found in xmlDebugDumpString",
7254 xmlMemBlocks() - mem_base);
7255 test_ret++;
7256 printf(" %d", n_output);
7257 printf(" %d", n_str);
7258 printf("\n");
7259 }
7260 }
7261 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007262 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007263#endif
7264
Daniel Veillarda82b1822004-11-08 16:24:57 +00007265 return(test_ret);
7266}
7267
7268
7269static int
7270test_xmlLsCountNode(void) {
7271 int test_ret = 0;
7272
7273#ifdef LIBXML_DEBUG_ENABLED
7274 int mem_base;
7275 int ret_val;
7276 xmlNodePtr node; /* the node to count */
7277 int n_node;
7278
7279 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7280 mem_base = xmlMemBlocks();
7281 node = gen_xmlNodePtr(n_node, 0);
7282
7283 ret_val = xmlLsCountNode(node);
7284 desret_int(ret_val);
7285 call_tests++;
7286 des_xmlNodePtr(n_node, node, 0);
7287 xmlResetLastError();
7288 if (mem_base != xmlMemBlocks()) {
7289 printf("Leak of %d blocks found in xmlLsCountNode",
7290 xmlMemBlocks() - mem_base);
7291 test_ret++;
7292 printf(" %d", n_node);
7293 printf("\n");
7294 }
7295 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007296 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007297#endif
7298
Daniel Veillarda82b1822004-11-08 16:24:57 +00007299 return(test_ret);
7300}
7301
7302
7303static int
7304test_xmlLsOneNode(void) {
7305 int test_ret = 0;
7306
7307#ifdef LIBXML_DEBUG_ENABLED
7308 int mem_base;
7309 FILE * output; /* the FILE * for the output */
7310 int n_output;
7311 xmlNodePtr node; /* the node to dump */
7312 int n_node;
7313
7314 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7315 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7316 mem_base = xmlMemBlocks();
7317 output = gen_debug_FILE_ptr(n_output, 0);
7318 node = gen_xmlNodePtr(n_node, 1);
7319
7320 xmlLsOneNode(output, node);
7321 call_tests++;
7322 des_debug_FILE_ptr(n_output, output, 0);
7323 des_xmlNodePtr(n_node, node, 1);
7324 xmlResetLastError();
7325 if (mem_base != xmlMemBlocks()) {
7326 printf("Leak of %d blocks found in xmlLsOneNode",
7327 xmlMemBlocks() - mem_base);
7328 test_ret++;
7329 printf(" %d", n_output);
7330 printf(" %d", n_node);
7331 printf("\n");
7332 }
7333 }
7334 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007335 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007336#endif
7337
Daniel Veillarda82b1822004-11-08 16:24:57 +00007338 return(test_ret);
7339}
7340
7341
7342#define gen_nb_char_ptr 1
7343static char * gen_char_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
7344 return(NULL);
7345}
7346static void des_char_ptr(int no ATTRIBUTE_UNUSED, char * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
7347}
7348
7349static int
7350test_xmlShell(void) {
7351 int test_ret = 0;
7352
7353
7354 /* missing type support */
7355 return(test_ret);
7356}
7357
7358
Daniel Veillarda82b1822004-11-08 16:24:57 +00007359static int
7360test_xmlShellBase(void) {
7361 int test_ret = 0;
7362
7363#ifdef LIBXML_DEBUG_ENABLED
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007364#ifdef LIBXML_XPATH_ENABLED
Daniel Veillarda82b1822004-11-08 16:24:57 +00007365 int mem_base;
7366 int ret_val;
7367 xmlShellCtxtPtr ctxt; /* the shell context */
7368 int n_ctxt;
7369 char * arg; /* unused */
7370 int n_arg;
7371 xmlNodePtr node; /* a node */
7372 int n_node;
7373 xmlNodePtr node2; /* unused */
7374 int n_node2;
7375
7376 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7377 for (n_arg = 0;n_arg < gen_nb_char_ptr;n_arg++) {
7378 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7379 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7380 mem_base = xmlMemBlocks();
7381 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7382 arg = gen_char_ptr(n_arg, 1);
7383 node = gen_xmlNodePtr(n_node, 2);
7384 node2 = gen_xmlNodePtr(n_node2, 3);
7385
7386 ret_val = xmlShellBase(ctxt, arg, node, node2);
7387 desret_int(ret_val);
7388 call_tests++;
7389 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7390 des_char_ptr(n_arg, arg, 1);
7391 des_xmlNodePtr(n_node, node, 2);
7392 des_xmlNodePtr(n_node2, node2, 3);
7393 xmlResetLastError();
7394 if (mem_base != xmlMemBlocks()) {
7395 printf("Leak of %d blocks found in xmlShellBase",
7396 xmlMemBlocks() - mem_base);
7397 test_ret++;
7398 printf(" %d", n_ctxt);
7399 printf(" %d", n_arg);
7400 printf(" %d", n_node);
7401 printf(" %d", n_node2);
7402 printf("\n");
7403 }
7404 }
7405 }
7406 }
7407 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007408 function_tests++;
7409#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007410#endif
7411
Daniel Veillarda82b1822004-11-08 16:24:57 +00007412 return(test_ret);
7413}
7414
7415
7416static int
7417test_xmlShellCat(void) {
7418 int test_ret = 0;
7419
7420#ifdef LIBXML_DEBUG_ENABLED
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007421#ifdef LIBXML_XPATH_ENABLED
Daniel Veillarda82b1822004-11-08 16:24:57 +00007422 int mem_base;
7423 int ret_val;
7424 xmlShellCtxtPtr ctxt; /* the shell context */
7425 int n_ctxt;
7426 char * arg; /* unused */
7427 int n_arg;
7428 xmlNodePtr node; /* a node */
7429 int n_node;
7430 xmlNodePtr node2; /* unused */
7431 int n_node2;
7432
7433 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7434 for (n_arg = 0;n_arg < gen_nb_char_ptr;n_arg++) {
7435 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7436 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7437 mem_base = xmlMemBlocks();
7438 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7439 arg = gen_char_ptr(n_arg, 1);
7440 node = gen_xmlNodePtr(n_node, 2);
7441 node2 = gen_xmlNodePtr(n_node2, 3);
7442
7443 ret_val = xmlShellCat(ctxt, arg, node, node2);
7444 desret_int(ret_val);
7445 call_tests++;
7446 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7447 des_char_ptr(n_arg, arg, 1);
7448 des_xmlNodePtr(n_node, node, 2);
7449 des_xmlNodePtr(n_node2, node2, 3);
7450 xmlResetLastError();
7451 if (mem_base != xmlMemBlocks()) {
7452 printf("Leak of %d blocks found in xmlShellCat",
7453 xmlMemBlocks() - mem_base);
7454 test_ret++;
7455 printf(" %d", n_ctxt);
7456 printf(" %d", n_arg);
7457 printf(" %d", n_node);
7458 printf(" %d", n_node2);
7459 printf("\n");
7460 }
7461 }
7462 }
7463 }
7464 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007465 function_tests++;
7466#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007467#endif
7468
Daniel Veillarda82b1822004-11-08 16:24:57 +00007469 return(test_ret);
7470}
7471
7472
7473static int
7474test_xmlShellDir(void) {
7475 int test_ret = 0;
7476
7477#ifdef LIBXML_DEBUG_ENABLED
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007478#ifdef LIBXML_XPATH_ENABLED
Daniel Veillarda82b1822004-11-08 16:24:57 +00007479 int mem_base;
7480 int ret_val;
7481 xmlShellCtxtPtr ctxt; /* the shell context */
7482 int n_ctxt;
7483 char * arg; /* unused */
7484 int n_arg;
7485 xmlNodePtr node; /* a node */
7486 int n_node;
7487 xmlNodePtr node2; /* unused */
7488 int n_node2;
7489
7490 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7491 for (n_arg = 0;n_arg < gen_nb_char_ptr;n_arg++) {
7492 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7493 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7494 mem_base = xmlMemBlocks();
7495 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7496 arg = gen_char_ptr(n_arg, 1);
7497 node = gen_xmlNodePtr(n_node, 2);
7498 node2 = gen_xmlNodePtr(n_node2, 3);
7499
7500 ret_val = xmlShellDir(ctxt, arg, node, node2);
7501 desret_int(ret_val);
7502 call_tests++;
7503 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7504 des_char_ptr(n_arg, arg, 1);
7505 des_xmlNodePtr(n_node, node, 2);
7506 des_xmlNodePtr(n_node2, node2, 3);
7507 xmlResetLastError();
7508 if (mem_base != xmlMemBlocks()) {
7509 printf("Leak of %d blocks found in xmlShellDir",
7510 xmlMemBlocks() - mem_base);
7511 test_ret++;
7512 printf(" %d", n_ctxt);
7513 printf(" %d", n_arg);
7514 printf(" %d", n_node);
7515 printf(" %d", n_node2);
7516 printf("\n");
7517 }
7518 }
7519 }
7520 }
7521 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007522 function_tests++;
7523#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007524#endif
7525
Daniel Veillarda82b1822004-11-08 16:24:57 +00007526 return(test_ret);
7527}
7528
7529
7530static int
7531test_xmlShellDu(void) {
7532 int test_ret = 0;
7533
7534#ifdef LIBXML_DEBUG_ENABLED
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007535#ifdef LIBXML_XPATH_ENABLED
Daniel Veillarda82b1822004-11-08 16:24:57 +00007536 int mem_base;
7537 int ret_val;
7538 xmlShellCtxtPtr ctxt; /* the shell context */
7539 int n_ctxt;
7540 char * arg; /* unused */
7541 int n_arg;
7542 xmlNodePtr tree; /* a node defining a subtree */
7543 int n_tree;
7544 xmlNodePtr node2; /* unused */
7545 int n_node2;
7546
7547 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7548 for (n_arg = 0;n_arg < gen_nb_char_ptr;n_arg++) {
7549 for (n_tree = 0;n_tree < gen_nb_xmlNodePtr;n_tree++) {
7550 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7551 mem_base = xmlMemBlocks();
7552 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7553 arg = gen_char_ptr(n_arg, 1);
7554 tree = gen_xmlNodePtr(n_tree, 2);
7555 node2 = gen_xmlNodePtr(n_node2, 3);
7556
7557 ret_val = xmlShellDu(ctxt, arg, tree, node2);
7558 desret_int(ret_val);
7559 call_tests++;
7560 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7561 des_char_ptr(n_arg, arg, 1);
7562 des_xmlNodePtr(n_tree, tree, 2);
7563 des_xmlNodePtr(n_node2, node2, 3);
7564 xmlResetLastError();
7565 if (mem_base != xmlMemBlocks()) {
7566 printf("Leak of %d blocks found in xmlShellDu",
7567 xmlMemBlocks() - mem_base);
7568 test_ret++;
7569 printf(" %d", n_ctxt);
7570 printf(" %d", n_arg);
7571 printf(" %d", n_tree);
7572 printf(" %d", n_node2);
7573 printf("\n");
7574 }
7575 }
7576 }
7577 }
7578 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007579 function_tests++;
7580#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007581#endif
7582
Daniel Veillarda82b1822004-11-08 16:24:57 +00007583 return(test_ret);
7584}
7585
7586
7587static int
7588test_xmlShellList(void) {
7589 int test_ret = 0;
7590
7591#ifdef LIBXML_DEBUG_ENABLED
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007592#ifdef LIBXML_XPATH_ENABLED
Daniel Veillarda82b1822004-11-08 16:24:57 +00007593 int mem_base;
7594 int ret_val;
7595 xmlShellCtxtPtr ctxt; /* the shell context */
7596 int n_ctxt;
7597 char * arg; /* unused */
7598 int n_arg;
7599 xmlNodePtr node; /* a node */
7600 int n_node;
7601 xmlNodePtr node2; /* unused */
7602 int n_node2;
7603
7604 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7605 for (n_arg = 0;n_arg < gen_nb_char_ptr;n_arg++) {
7606 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7607 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7608 mem_base = xmlMemBlocks();
7609 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7610 arg = gen_char_ptr(n_arg, 1);
7611 node = gen_xmlNodePtr(n_node, 2);
7612 node2 = gen_xmlNodePtr(n_node2, 3);
7613
7614 ret_val = xmlShellList(ctxt, arg, node, node2);
7615 desret_int(ret_val);
7616 call_tests++;
7617 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7618 des_char_ptr(n_arg, arg, 1);
7619 des_xmlNodePtr(n_node, node, 2);
7620 des_xmlNodePtr(n_node2, node2, 3);
7621 xmlResetLastError();
7622 if (mem_base != xmlMemBlocks()) {
7623 printf("Leak of %d blocks found in xmlShellList",
7624 xmlMemBlocks() - mem_base);
7625 test_ret++;
7626 printf(" %d", n_ctxt);
7627 printf(" %d", n_arg);
7628 printf(" %d", n_node);
7629 printf(" %d", n_node2);
7630 printf("\n");
7631 }
7632 }
7633 }
7634 }
7635 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007636 function_tests++;
7637#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007638#endif
7639
Daniel Veillarda82b1822004-11-08 16:24:57 +00007640 return(test_ret);
7641}
7642
7643
7644static int
7645test_xmlShellLoad(void) {
7646 int test_ret = 0;
7647
7648#ifdef LIBXML_DEBUG_ENABLED
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007649#ifdef LIBXML_XPATH_ENABLED
Daniel Veillarda82b1822004-11-08 16:24:57 +00007650 int mem_base;
7651 int ret_val;
7652 xmlShellCtxtPtr ctxt; /* the shell context */
7653 int n_ctxt;
7654 char * filename; /* the file name */
7655 int n_filename;
7656 xmlNodePtr node; /* unused */
7657 int n_node;
7658 xmlNodePtr node2; /* unused */
7659 int n_node2;
7660
7661 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7662 for (n_filename = 0;n_filename < gen_nb_char_ptr;n_filename++) {
7663 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7664 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7665 mem_base = xmlMemBlocks();
7666 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7667 filename = gen_char_ptr(n_filename, 1);
7668 node = gen_xmlNodePtr(n_node, 2);
7669 node2 = gen_xmlNodePtr(n_node2, 3);
7670
7671 ret_val = xmlShellLoad(ctxt, filename, node, node2);
7672 desret_int(ret_val);
7673 call_tests++;
7674 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7675 des_char_ptr(n_filename, filename, 1);
7676 des_xmlNodePtr(n_node, node, 2);
7677 des_xmlNodePtr(n_node2, node2, 3);
7678 xmlResetLastError();
7679 if (mem_base != xmlMemBlocks()) {
7680 printf("Leak of %d blocks found in xmlShellLoad",
7681 xmlMemBlocks() - mem_base);
7682 test_ret++;
7683 printf(" %d", n_ctxt);
7684 printf(" %d", n_filename);
7685 printf(" %d", n_node);
7686 printf(" %d", n_node2);
7687 printf("\n");
7688 }
7689 }
7690 }
7691 }
7692 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007693 function_tests++;
7694#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007695#endif
7696
Daniel Veillarda82b1822004-11-08 16:24:57 +00007697 return(test_ret);
7698}
7699
7700
7701static int
7702test_xmlShellPrintXPathResult(void) {
7703 int test_ret = 0;
7704
7705#ifdef LIBXML_DEBUG_ENABLED
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007706#ifdef LIBXML_XPATH_ENABLED
Daniel Veillarda82b1822004-11-08 16:24:57 +00007707 int mem_base;
7708 xmlXPathObjectPtr list; /* a valid result generated by an xpath evaluation */
7709 int n_list;
7710
7711 for (n_list = 0;n_list < gen_nb_xmlXPathObjectPtr;n_list++) {
7712 mem_base = xmlMemBlocks();
7713 list = gen_xmlXPathObjectPtr(n_list, 0);
7714
7715 xmlShellPrintXPathResult(list);
7716 call_tests++;
7717 des_xmlXPathObjectPtr(n_list, list, 0);
7718 xmlResetLastError();
7719 if (mem_base != xmlMemBlocks()) {
7720 printf("Leak of %d blocks found in xmlShellPrintXPathResult",
7721 xmlMemBlocks() - mem_base);
7722 test_ret++;
7723 printf(" %d", n_list);
7724 printf("\n");
7725 }
7726 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007727 function_tests++;
7728#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007729#endif
7730
Daniel Veillarda82b1822004-11-08 16:24:57 +00007731 return(test_ret);
7732}
7733
7734
7735static int
7736test_xmlShellPwd(void) {
7737 int test_ret = 0;
7738
7739#ifdef LIBXML_DEBUG_ENABLED
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007740#ifdef LIBXML_XPATH_ENABLED
Daniel Veillarda82b1822004-11-08 16:24:57 +00007741 int mem_base;
7742 int ret_val;
7743 xmlShellCtxtPtr ctxt; /* the shell context */
7744 int n_ctxt;
7745 char * buffer; /* the output buffer */
7746 int n_buffer;
7747 xmlNodePtr node; /* a node */
7748 int n_node;
7749 xmlNodePtr node2; /* unused */
7750 int n_node2;
7751
7752 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7753 for (n_buffer = 0;n_buffer < gen_nb_char_ptr;n_buffer++) {
7754 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7755 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7756 mem_base = xmlMemBlocks();
7757 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7758 buffer = gen_char_ptr(n_buffer, 1);
7759 node = gen_xmlNodePtr(n_node, 2);
7760 node2 = gen_xmlNodePtr(n_node2, 3);
7761
7762 ret_val = xmlShellPwd(ctxt, buffer, node, node2);
7763 desret_int(ret_val);
7764 call_tests++;
7765 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7766 des_char_ptr(n_buffer, buffer, 1);
7767 des_xmlNodePtr(n_node, node, 2);
7768 des_xmlNodePtr(n_node2, node2, 3);
7769 xmlResetLastError();
7770 if (mem_base != xmlMemBlocks()) {
7771 printf("Leak of %d blocks found in xmlShellPwd",
7772 xmlMemBlocks() - mem_base);
7773 test_ret++;
7774 printf(" %d", n_ctxt);
7775 printf(" %d", n_buffer);
7776 printf(" %d", n_node);
7777 printf(" %d", n_node2);
7778 printf("\n");
7779 }
7780 }
7781 }
7782 }
7783 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007784 function_tests++;
7785#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007786#endif
7787
Daniel Veillarda82b1822004-11-08 16:24:57 +00007788 return(test_ret);
7789}
7790
7791
7792static int
7793test_xmlShellSave(void) {
7794 int test_ret = 0;
7795
7796#ifdef LIBXML_DEBUG_ENABLED
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007797#ifdef LIBXML_XPATH_ENABLED
Daniel Veillarda82b1822004-11-08 16:24:57 +00007798#ifdef LIBXML_OUTPUT_ENABLED
7799 int mem_base;
7800 int ret_val;
7801 xmlShellCtxtPtr ctxt; /* the shell context */
7802 int n_ctxt;
7803 char * filename; /* the file name (optional) */
7804 int n_filename;
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_filename = 0;n_filename < gen_nb_char_ptr;n_filename++) {
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 filename = gen_char_ptr(n_filename, 1);
7817 node = gen_xmlNodePtr(n_node, 2);
7818 node2 = gen_xmlNodePtr(n_node2, 3);
7819
7820 ret_val = xmlShellSave(ctxt, filename, node, node2);
7821 desret_int(ret_val);
7822 call_tests++;
7823 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7824 des_char_ptr(n_filename, filename, 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 xmlShellSave",
7830 xmlMemBlocks() - mem_base);
7831 test_ret++;
7832 printf(" %d", n_ctxt);
7833 printf(" %d", n_filename);
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#endif
7845#endif
7846
Daniel Veillarda82b1822004-11-08 16:24:57 +00007847 return(test_ret);
7848}
7849
7850
7851static int
7852test_xmlShellValidate(void) {
7853 int test_ret = 0;
7854
7855#ifdef LIBXML_DEBUG_ENABLED
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007856#ifdef LIBXML_XPATH_ENABLED
Daniel Veillarda82b1822004-11-08 16:24:57 +00007857 int mem_base;
7858 int ret_val;
7859 xmlShellCtxtPtr ctxt; /* the shell context */
7860 int n_ctxt;
7861 char * dtd; /* the DTD URI (optional) */
7862 int n_dtd;
7863 xmlNodePtr node; /* unused */
7864 int n_node;
7865 xmlNodePtr node2; /* unused */
7866 int n_node2;
7867
7868 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7869 for (n_dtd = 0;n_dtd < gen_nb_char_ptr;n_dtd++) {
7870 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7871 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7872 mem_base = xmlMemBlocks();
7873 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7874 dtd = gen_char_ptr(n_dtd, 1);
7875 node = gen_xmlNodePtr(n_node, 2);
7876 node2 = gen_xmlNodePtr(n_node2, 3);
7877
7878 ret_val = xmlShellValidate(ctxt, dtd, node, node2);
7879 desret_int(ret_val);
7880 call_tests++;
7881 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7882 des_char_ptr(n_dtd, dtd, 1);
7883 des_xmlNodePtr(n_node, node, 2);
7884 des_xmlNodePtr(n_node2, node2, 3);
7885 xmlResetLastError();
7886 if (mem_base != xmlMemBlocks()) {
7887 printf("Leak of %d blocks found in xmlShellValidate",
7888 xmlMemBlocks() - mem_base);
7889 test_ret++;
7890 printf(" %d", n_ctxt);
7891 printf(" %d", n_dtd);
7892 printf(" %d", n_node);
7893 printf(" %d", n_node2);
7894 printf("\n");
7895 }
7896 }
7897 }
7898 }
7899 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007900 function_tests++;
7901#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007902#endif
7903
Daniel Veillarda82b1822004-11-08 16:24:57 +00007904 return(test_ret);
7905}
7906
7907
7908static int
7909test_xmlShellWrite(void) {
7910 int test_ret = 0;
7911
7912#ifdef LIBXML_DEBUG_ENABLED
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007913#ifdef LIBXML_XPATH_ENABLED
Daniel Veillarda82b1822004-11-08 16:24:57 +00007914#ifdef LIBXML_OUTPUT_ENABLED
7915 int mem_base;
7916 int ret_val;
7917 xmlShellCtxtPtr ctxt; /* the shell context */
7918 int n_ctxt;
7919 char * filename; /* the file name */
7920 int n_filename;
7921 xmlNodePtr node; /* a node in the tree */
7922 int n_node;
7923 xmlNodePtr node2; /* unused */
7924 int n_node2;
7925
7926 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7927 for (n_filename = 0;n_filename < gen_nb_char_ptr;n_filename++) {
7928 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7929 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7930 mem_base = xmlMemBlocks();
7931 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7932 filename = gen_char_ptr(n_filename, 1);
7933 node = gen_xmlNodePtr(n_node, 2);
7934 node2 = gen_xmlNodePtr(n_node2, 3);
7935
7936 ret_val = xmlShellWrite(ctxt, filename, node, node2);
7937 desret_int(ret_val);
7938 call_tests++;
7939 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7940 des_char_ptr(n_filename, filename, 1);
7941 des_xmlNodePtr(n_node, node, 2);
7942 des_xmlNodePtr(n_node2, node2, 3);
7943 xmlResetLastError();
7944 if (mem_base != xmlMemBlocks()) {
7945 printf("Leak of %d blocks found in xmlShellWrite",
7946 xmlMemBlocks() - mem_base);
7947 test_ret++;
7948 printf(" %d", n_ctxt);
7949 printf(" %d", n_filename);
7950 printf(" %d", n_node);
7951 printf(" %d", n_node2);
7952 printf("\n");
7953 }
7954 }
7955 }
7956 }
7957 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007958 function_tests++;
7959#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007960#endif
7961#endif
7962
Daniel Veillarda82b1822004-11-08 16:24:57 +00007963 return(test_ret);
7964}
7965
7966static int
7967test_debugXML(void) {
7968 int test_ret = 0;
7969
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007970 if (quiet == 0) printf("Testing debugXML : 25 of 28 functions ...\n");
Daniel Veillarda82b1822004-11-08 16:24:57 +00007971 test_ret += test_xmlBoolToText();
7972 test_ret += test_xmlDebugCheckDocument();
7973 test_ret += test_xmlDebugDumpAttr();
7974 test_ret += test_xmlDebugDumpAttrList();
7975 test_ret += test_xmlDebugDumpDTD();
7976 test_ret += test_xmlDebugDumpDocument();
7977 test_ret += test_xmlDebugDumpDocumentHead();
7978 test_ret += test_xmlDebugDumpEntities();
7979 test_ret += test_xmlDebugDumpNode();
7980 test_ret += test_xmlDebugDumpNodeList();
7981 test_ret += test_xmlDebugDumpOneNode();
7982 test_ret += test_xmlDebugDumpString();
7983 test_ret += test_xmlLsCountNode();
7984 test_ret += test_xmlLsOneNode();
7985 test_ret += test_xmlShell();
7986 test_ret += test_xmlShellBase();
7987 test_ret += test_xmlShellCat();
7988 test_ret += test_xmlShellDir();
7989 test_ret += test_xmlShellDu();
7990 test_ret += test_xmlShellList();
7991 test_ret += test_xmlShellLoad();
7992 test_ret += test_xmlShellPrintXPathResult();
7993 test_ret += test_xmlShellPwd();
7994 test_ret += test_xmlShellSave();
7995 test_ret += test_xmlShellValidate();
7996 test_ret += test_xmlShellWrite();
7997
7998 if (test_ret != 0)
7999 printf("Module debugXML: %d errors\n", test_ret);
8000 return(test_ret);
8001}
8002
8003static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00008004test_xmlDictCreate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008005 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008006
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008007 int mem_base;
8008 xmlDictPtr ret_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008009
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008010 mem_base = xmlMemBlocks();
8011
8012 ret_val = xmlDictCreate();
8013 desret_xmlDictPtr(ret_val);
8014 call_tests++;
8015 xmlResetLastError();
8016 if (mem_base != xmlMemBlocks()) {
8017 printf("Leak of %d blocks found in xmlDictCreate",
8018 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008019 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008020 printf("\n");
8021 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008022 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008023
Daniel Veillard42595322004-11-08 10:52:06 +00008024 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008025}
8026
8027
8028static int
8029test_xmlDictCreateSub(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008030 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008031
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008032 int mem_base;
8033 xmlDictPtr ret_val;
8034 xmlDictPtr sub; /* an existing dictionnary */
8035 int n_sub;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008036
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008037 for (n_sub = 0;n_sub < gen_nb_xmlDictPtr;n_sub++) {
8038 mem_base = xmlMemBlocks();
8039 sub = gen_xmlDictPtr(n_sub, 0);
8040
8041 ret_val = xmlDictCreateSub(sub);
8042 desret_xmlDictPtr(ret_val);
8043 call_tests++;
8044 des_xmlDictPtr(n_sub, sub, 0);
8045 xmlResetLastError();
8046 if (mem_base != xmlMemBlocks()) {
8047 printf("Leak of %d blocks found in xmlDictCreateSub",
8048 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008049 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008050 printf(" %d", n_sub);
8051 printf("\n");
8052 }
8053 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008054 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008055
Daniel Veillard42595322004-11-08 10:52:06 +00008056 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008057}
8058
8059
8060static int
8061test_xmlDictLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008062 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008063
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008064 int mem_base;
8065 const xmlChar * ret_val;
8066 xmlDictPtr dict; /* the dictionnary */
8067 int n_dict;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008068 xmlChar * name; /* the name of the userdata */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008069 int n_name;
8070 int len; /* the length of the name, if -1 it is recomputed */
8071 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008072
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008073 for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
8074 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
8075 for (n_len = 0;n_len < gen_nb_int;n_len++) {
8076 mem_base = xmlMemBlocks();
8077 dict = gen_xmlDictPtr(n_dict, 0);
8078 name = gen_const_xmlChar_ptr(n_name, 1);
8079 len = gen_int(n_len, 2);
8080
William M. Brackf13f77f2004-11-12 16:03:48 +00008081 ret_val = xmlDictLookup(dict, (const xmlChar *)name, len);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008082 desret_const_xmlChar_ptr(ret_val);
8083 call_tests++;
8084 des_xmlDictPtr(n_dict, dict, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00008085 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008086 des_int(n_len, len, 2);
8087 xmlResetLastError();
8088 if (mem_base != xmlMemBlocks()) {
8089 printf("Leak of %d blocks found in xmlDictLookup",
8090 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008091 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008092 printf(" %d", n_dict);
8093 printf(" %d", n_name);
8094 printf(" %d", n_len);
8095 printf("\n");
8096 }
8097 }
8098 }
8099 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008100 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008101
Daniel Veillard42595322004-11-08 10:52:06 +00008102 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008103}
8104
8105
8106static int
8107test_xmlDictOwns(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008108 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008109
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008110 int mem_base;
8111 int ret_val;
8112 xmlDictPtr dict; /* the dictionnary */
8113 int n_dict;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008114 xmlChar * str; /* the string */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008115 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008116
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008117 for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
8118 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
8119 mem_base = xmlMemBlocks();
8120 dict = gen_xmlDictPtr(n_dict, 0);
8121 str = gen_const_xmlChar_ptr(n_str, 1);
8122
William M. Brackf13f77f2004-11-12 16:03:48 +00008123 ret_val = xmlDictOwns(dict, (const xmlChar *)str);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008124 desret_int(ret_val);
8125 call_tests++;
8126 des_xmlDictPtr(n_dict, dict, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00008127 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008128 xmlResetLastError();
8129 if (mem_base != xmlMemBlocks()) {
8130 printf("Leak of %d blocks found in xmlDictOwns",
8131 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008132 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008133 printf(" %d", n_dict);
8134 printf(" %d", n_str);
8135 printf("\n");
8136 }
8137 }
8138 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008139 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008140
Daniel Veillard42595322004-11-08 10:52:06 +00008141 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008142}
8143
8144
8145static int
8146test_xmlDictQLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008147 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008148
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008149 int mem_base;
8150 const xmlChar * ret_val;
8151 xmlDictPtr dict; /* the dictionnary */
8152 int n_dict;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008153 xmlChar * prefix; /* the prefix */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008154 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008155 xmlChar * name; /* the name */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008156 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008157
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008158 for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
8159 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
8160 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
8161 mem_base = xmlMemBlocks();
8162 dict = gen_xmlDictPtr(n_dict, 0);
8163 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
8164 name = gen_const_xmlChar_ptr(n_name, 2);
8165
William M. Brackf13f77f2004-11-12 16:03:48 +00008166 ret_val = xmlDictQLookup(dict, (const xmlChar *)prefix, (const xmlChar *)name);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008167 desret_const_xmlChar_ptr(ret_val);
8168 call_tests++;
8169 des_xmlDictPtr(n_dict, dict, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00008170 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
8171 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008172 xmlResetLastError();
8173 if (mem_base != xmlMemBlocks()) {
8174 printf("Leak of %d blocks found in xmlDictQLookup",
8175 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008176 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008177 printf(" %d", n_dict);
8178 printf(" %d", n_prefix);
8179 printf(" %d", n_name);
8180 printf("\n");
8181 }
8182 }
8183 }
8184 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008185 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008186
Daniel Veillard42595322004-11-08 10:52:06 +00008187 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008188}
8189
8190
8191static int
8192test_xmlDictReference(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008193 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008194
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008195 int mem_base;
8196 int ret_val;
8197 xmlDictPtr dict; /* the dictionnary */
8198 int n_dict;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008199
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008200 for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
8201 mem_base = xmlMemBlocks();
8202 dict = gen_xmlDictPtr(n_dict, 0);
8203
8204 ret_val = xmlDictReference(dict);
8205 xmlDictFree(dict);
8206 desret_int(ret_val);
8207 call_tests++;
8208 des_xmlDictPtr(n_dict, dict, 0);
8209 xmlResetLastError();
8210 if (mem_base != xmlMemBlocks()) {
8211 printf("Leak of %d blocks found in xmlDictReference",
8212 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008213 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008214 printf(" %d", n_dict);
8215 printf("\n");
8216 }
8217 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008218 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008219
Daniel Veillard42595322004-11-08 10:52:06 +00008220 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008221}
8222
8223
8224static int
8225test_xmlDictSize(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008226 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008227
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008228 int mem_base;
8229 int ret_val;
8230 xmlDictPtr dict; /* the dictionnary */
8231 int n_dict;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008232
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008233 for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
8234 mem_base = xmlMemBlocks();
8235 dict = gen_xmlDictPtr(n_dict, 0);
8236
8237 ret_val = xmlDictSize(dict);
8238 desret_int(ret_val);
8239 call_tests++;
8240 des_xmlDictPtr(n_dict, dict, 0);
8241 xmlResetLastError();
8242 if (mem_base != xmlMemBlocks()) {
8243 printf("Leak of %d blocks found in xmlDictSize",
8244 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008245 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008246 printf(" %d", n_dict);
8247 printf("\n");
8248 }
8249 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008250 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008251
Daniel Veillard42595322004-11-08 10:52:06 +00008252 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008253}
8254
8255static int
8256test_dict(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008257 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008258
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008259 if (quiet == 0) printf("Testing dict : 7 of 8 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00008260 test_ret += test_xmlDictCreate();
8261 test_ret += test_xmlDictCreateSub();
8262 test_ret += test_xmlDictLookup();
8263 test_ret += test_xmlDictOwns();
8264 test_ret += test_xmlDictQLookup();
8265 test_ret += test_xmlDictReference();
8266 test_ret += test_xmlDictSize();
Daniel Veillardd93f6252004-11-02 15:53:51 +00008267
Daniel Veillard42595322004-11-08 10:52:06 +00008268 if (test_ret != 0)
8269 printf("Module dict: %d errors\n", test_ret);
8270 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008271}
8272
8273static int
8274test_UTF8Toisolat1(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008275 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008276
Daniel Veillarda521d282004-11-09 14:59:59 +00008277#ifdef LIBXML_OUTPUT_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +00008278 int mem_base;
8279 int ret_val;
8280 unsigned char * out; /* a pointer to an array of bytes to store the result */
8281 int n_out;
8282 int * outlen; /* the length of @out */
8283 int n_outlen;
8284 unsigned char * in; /* a pointer to an array of UTF-8 chars */
8285 int n_in;
8286 int * inlen; /* the length of @in */
8287 int n_inlen;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008288
Daniel Veillardce682bc2004-11-05 17:22:25 +00008289 for (n_out = 0;n_out < gen_nb_unsigned_char_ptr;n_out++) {
8290 for (n_outlen = 0;n_outlen < gen_nb_int_ptr;n_outlen++) {
8291 for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) {
8292 for (n_inlen = 0;n_inlen < gen_nb_int_ptr;n_inlen++) {
8293 mem_base = xmlMemBlocks();
8294 out = gen_unsigned_char_ptr(n_out, 0);
8295 outlen = gen_int_ptr(n_outlen, 1);
8296 in = gen_const_unsigned_char_ptr(n_in, 2);
8297 inlen = gen_int_ptr(n_inlen, 3);
8298
William M. Brackf13f77f2004-11-12 16:03:48 +00008299 ret_val = UTF8Toisolat1(out, outlen, (const unsigned char *)in, inlen);
Daniel Veillardce682bc2004-11-05 17:22:25 +00008300 desret_int(ret_val);
8301 call_tests++;
8302 des_unsigned_char_ptr(n_out, out, 0);
8303 des_int_ptr(n_outlen, outlen, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00008304 des_const_unsigned_char_ptr(n_in, (const unsigned char *)in, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +00008305 des_int_ptr(n_inlen, inlen, 3);
8306 xmlResetLastError();
8307 if (mem_base != xmlMemBlocks()) {
8308 printf("Leak of %d blocks found in UTF8Toisolat1",
8309 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008310 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008311 printf(" %d", n_out);
8312 printf(" %d", n_outlen);
8313 printf(" %d", n_in);
8314 printf(" %d", n_inlen);
8315 printf("\n");
8316 }
8317 }
8318 }
8319 }
8320 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008321 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00008322#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +00008323
Daniel Veillard42595322004-11-08 10:52:06 +00008324 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008325}
8326
8327
8328static int
8329test_isolat1ToUTF8(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008330 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008331
Daniel Veillardce682bc2004-11-05 17:22:25 +00008332 int mem_base;
8333 int ret_val;
8334 unsigned char * out; /* a pointer to an array of bytes to store the result */
8335 int n_out;
8336 int * outlen; /* the length of @out */
8337 int n_outlen;
8338 unsigned char * in; /* a pointer to an array of ISO Latin 1 chars */
8339 int n_in;
8340 int * inlen; /* the length of @in */
8341 int n_inlen;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008342
Daniel Veillardce682bc2004-11-05 17:22:25 +00008343 for (n_out = 0;n_out < gen_nb_unsigned_char_ptr;n_out++) {
8344 for (n_outlen = 0;n_outlen < gen_nb_int_ptr;n_outlen++) {
8345 for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) {
8346 for (n_inlen = 0;n_inlen < gen_nb_int_ptr;n_inlen++) {
8347 mem_base = xmlMemBlocks();
8348 out = gen_unsigned_char_ptr(n_out, 0);
8349 outlen = gen_int_ptr(n_outlen, 1);
8350 in = gen_const_unsigned_char_ptr(n_in, 2);
8351 inlen = gen_int_ptr(n_inlen, 3);
8352
William M. Brackf13f77f2004-11-12 16:03:48 +00008353 ret_val = isolat1ToUTF8(out, outlen, (const unsigned char *)in, inlen);
Daniel Veillardce682bc2004-11-05 17:22:25 +00008354 desret_int(ret_val);
8355 call_tests++;
8356 des_unsigned_char_ptr(n_out, out, 0);
8357 des_int_ptr(n_outlen, outlen, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00008358 des_const_unsigned_char_ptr(n_in, (const unsigned char *)in, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +00008359 des_int_ptr(n_inlen, inlen, 3);
8360 xmlResetLastError();
8361 if (mem_base != xmlMemBlocks()) {
8362 printf("Leak of %d blocks found in isolat1ToUTF8",
8363 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008364 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008365 printf(" %d", n_out);
8366 printf(" %d", n_outlen);
8367 printf(" %d", n_in);
8368 printf(" %d", n_inlen);
8369 printf("\n");
8370 }
8371 }
8372 }
8373 }
8374 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00008375 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008376
Daniel Veillard42595322004-11-08 10:52:06 +00008377 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008378}
8379
8380
8381static int
8382test_xmlAddEncodingAlias(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008383 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008384
8385 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008386 char * name; /* the encoding name as parsed, in UTF-8 format (ASCII actually) */
Daniel Veillardd93f6252004-11-02 15:53:51 +00008387 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008388 char * alias; /* the alias name as parsed, in UTF-8 format (ASCII actually) */
Daniel Veillardd93f6252004-11-02 15:53:51 +00008389 int n_alias;
8390
8391 for (n_name = 0;n_name < gen_nb_const_char_ptr;n_name++) {
8392 for (n_alias = 0;n_alias < gen_nb_const_char_ptr;n_alias++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +00008393 name = gen_const_char_ptr(n_name, 0);
8394 alias = gen_const_char_ptr(n_alias, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008395
William M. Brackf13f77f2004-11-12 16:03:48 +00008396 ret_val = xmlAddEncodingAlias((const char *)name, (const char *)alias);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008397 desret_int(ret_val);
8398 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00008399 des_const_char_ptr(n_name, (const char *)name, 0);
8400 des_const_char_ptr(n_alias, (const char *)alias, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008401 xmlResetLastError();
8402 }
8403 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00008404 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008405
Daniel Veillard42595322004-11-08 10:52:06 +00008406 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008407}
8408
8409
Daniel Veillardce682bc2004-11-05 17:22:25 +00008410#define gen_nb_xmlCharEncodingHandler_ptr 1
8411static xmlCharEncodingHandler * gen_xmlCharEncodingHandler_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
8412 return(NULL);
8413}
8414static void des_xmlCharEncodingHandler_ptr(int no ATTRIBUTE_UNUSED, xmlCharEncodingHandler * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
8415}
8416
Daniel Veillardd93f6252004-11-02 15:53:51 +00008417static int
8418test_xmlCharEncCloseFunc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008419 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008420
Daniel Veillardce682bc2004-11-05 17:22:25 +00008421 int mem_base;
8422 int ret_val;
8423 xmlCharEncodingHandler * handler; /* char enconding transformation data structure */
8424 int n_handler;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008425
Daniel Veillardce682bc2004-11-05 17:22:25 +00008426 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandler_ptr;n_handler++) {
8427 mem_base = xmlMemBlocks();
8428 handler = gen_xmlCharEncodingHandler_ptr(n_handler, 0);
8429
8430 ret_val = xmlCharEncCloseFunc(handler);
8431 desret_int(ret_val);
8432 call_tests++;
8433 des_xmlCharEncodingHandler_ptr(n_handler, handler, 0);
8434 xmlResetLastError();
8435 if (mem_base != xmlMemBlocks()) {
8436 printf("Leak of %d blocks found in xmlCharEncCloseFunc",
8437 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008438 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008439 printf(" %d", n_handler);
8440 printf("\n");
8441 }
8442 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00008443 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008444
Daniel Veillard42595322004-11-08 10:52:06 +00008445 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008446}
8447
8448
8449static int
8450test_xmlCharEncFirstLine(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008451 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008452
Daniel Veillardce682bc2004-11-05 17:22:25 +00008453 int mem_base;
8454 int ret_val;
8455 xmlCharEncodingHandler * handler; /* char enconding transformation data structure */
8456 int n_handler;
8457 xmlBufferPtr out; /* an xmlBuffer for the output. */
8458 int n_out;
8459 xmlBufferPtr in; /* an xmlBuffer for the input */
8460 int n_in;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008461
Daniel Veillardce682bc2004-11-05 17:22:25 +00008462 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandler_ptr;n_handler++) {
8463 for (n_out = 0;n_out < gen_nb_xmlBufferPtr;n_out++) {
8464 for (n_in = 0;n_in < gen_nb_xmlBufferPtr;n_in++) {
8465 mem_base = xmlMemBlocks();
8466 handler = gen_xmlCharEncodingHandler_ptr(n_handler, 0);
8467 out = gen_xmlBufferPtr(n_out, 1);
8468 in = gen_xmlBufferPtr(n_in, 2);
8469
8470 ret_val = xmlCharEncFirstLine(handler, out, in);
8471 desret_int(ret_val);
8472 call_tests++;
8473 des_xmlCharEncodingHandler_ptr(n_handler, handler, 0);
8474 des_xmlBufferPtr(n_out, out, 1);
8475 des_xmlBufferPtr(n_in, in, 2);
8476 xmlResetLastError();
8477 if (mem_base != xmlMemBlocks()) {
8478 printf("Leak of %d blocks found in xmlCharEncFirstLine",
8479 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008480 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008481 printf(" %d", n_handler);
8482 printf(" %d", n_out);
8483 printf(" %d", n_in);
8484 printf("\n");
8485 }
8486 }
8487 }
8488 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00008489 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008490
Daniel Veillard42595322004-11-08 10:52:06 +00008491 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008492}
8493
8494
8495static int
8496test_xmlCharEncInFunc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008497 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008498
Daniel Veillardce682bc2004-11-05 17:22:25 +00008499 int mem_base;
8500 int ret_val;
8501 xmlCharEncodingHandler * handler; /* char encoding transformation data structure */
8502 int n_handler;
8503 xmlBufferPtr out; /* an xmlBuffer for the output. */
8504 int n_out;
8505 xmlBufferPtr in; /* an xmlBuffer for the input */
8506 int n_in;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008507
Daniel Veillardce682bc2004-11-05 17:22:25 +00008508 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandler_ptr;n_handler++) {
8509 for (n_out = 0;n_out < gen_nb_xmlBufferPtr;n_out++) {
8510 for (n_in = 0;n_in < gen_nb_xmlBufferPtr;n_in++) {
8511 mem_base = xmlMemBlocks();
8512 handler = gen_xmlCharEncodingHandler_ptr(n_handler, 0);
8513 out = gen_xmlBufferPtr(n_out, 1);
8514 in = gen_xmlBufferPtr(n_in, 2);
8515
8516 ret_val = xmlCharEncInFunc(handler, out, in);
8517 desret_int(ret_val);
8518 call_tests++;
8519 des_xmlCharEncodingHandler_ptr(n_handler, handler, 0);
8520 des_xmlBufferPtr(n_out, out, 1);
8521 des_xmlBufferPtr(n_in, in, 2);
8522 xmlResetLastError();
8523 if (mem_base != xmlMemBlocks()) {
8524 printf("Leak of %d blocks found in xmlCharEncInFunc",
8525 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008526 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008527 printf(" %d", n_handler);
8528 printf(" %d", n_out);
8529 printf(" %d", n_in);
8530 printf("\n");
8531 }
8532 }
8533 }
8534 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00008535 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008536
Daniel Veillard42595322004-11-08 10:52:06 +00008537 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008538}
8539
8540
8541static int
8542test_xmlCharEncOutFunc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008543 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008544
Daniel Veillardce682bc2004-11-05 17:22:25 +00008545 int mem_base;
8546 int ret_val;
8547 xmlCharEncodingHandler * handler; /* char enconding transformation data structure */
8548 int n_handler;
8549 xmlBufferPtr out; /* an xmlBuffer for the output. */
8550 int n_out;
8551 xmlBufferPtr in; /* an xmlBuffer for the input */
8552 int n_in;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008553
Daniel Veillardce682bc2004-11-05 17:22:25 +00008554 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandler_ptr;n_handler++) {
8555 for (n_out = 0;n_out < gen_nb_xmlBufferPtr;n_out++) {
8556 for (n_in = 0;n_in < gen_nb_xmlBufferPtr;n_in++) {
8557 mem_base = xmlMemBlocks();
8558 handler = gen_xmlCharEncodingHandler_ptr(n_handler, 0);
8559 out = gen_xmlBufferPtr(n_out, 1);
8560 in = gen_xmlBufferPtr(n_in, 2);
8561
8562 ret_val = xmlCharEncOutFunc(handler, out, in);
8563 desret_int(ret_val);
8564 call_tests++;
8565 des_xmlCharEncodingHandler_ptr(n_handler, handler, 0);
8566 des_xmlBufferPtr(n_out, out, 1);
8567 des_xmlBufferPtr(n_in, in, 2);
8568 xmlResetLastError();
8569 if (mem_base != xmlMemBlocks()) {
8570 printf("Leak of %d blocks found in xmlCharEncOutFunc",
8571 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008572 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008573 printf(" %d", n_handler);
8574 printf(" %d", n_out);
8575 printf(" %d", n_in);
8576 printf("\n");
8577 }
8578 }
8579 }
8580 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00008581 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008582
Daniel Veillard42595322004-11-08 10:52:06 +00008583 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008584}
8585
8586
8587static int
8588test_xmlCleanupCharEncodingHandlers(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008589 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008590
8591
8592
8593 xmlCleanupCharEncodingHandlers();
8594 call_tests++;
8595 xmlResetLastError();
Daniel Veillard3d97e662004-11-04 10:49:00 +00008596 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008597
Daniel Veillard42595322004-11-08 10:52:06 +00008598 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008599}
8600
8601
8602static int
8603test_xmlCleanupEncodingAliases(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008604 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008605
8606 int mem_base;
8607
8608 mem_base = xmlMemBlocks();
8609
8610 xmlCleanupEncodingAliases();
8611 call_tests++;
8612 xmlResetLastError();
8613 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00008614 printf("Leak of %d blocks found in xmlCleanupEncodingAliases",
Daniel Veillardd93f6252004-11-02 15:53:51 +00008615 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008616 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00008617 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00008618 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00008619 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008620
Daniel Veillard42595322004-11-08 10:52:06 +00008621 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008622}
8623
8624
8625static int
8626test_xmlDelEncodingAlias(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008627 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008628
8629 int mem_base;
8630 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008631 char * alias; /* the alias name as parsed, in UTF-8 format (ASCII actually) */
Daniel Veillardd93f6252004-11-02 15:53:51 +00008632 int n_alias;
8633
8634 for (n_alias = 0;n_alias < gen_nb_const_char_ptr;n_alias++) {
8635 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00008636 alias = gen_const_char_ptr(n_alias, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008637
William M. Brackf13f77f2004-11-12 16:03:48 +00008638 ret_val = xmlDelEncodingAlias((const char *)alias);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008639 desret_int(ret_val);
8640 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00008641 des_const_char_ptr(n_alias, (const char *)alias, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008642 xmlResetLastError();
8643 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00008644 printf("Leak of %d blocks found in xmlDelEncodingAlias",
Daniel Veillardd93f6252004-11-02 15:53:51 +00008645 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008646 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00008647 printf(" %d", n_alias);
8648 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00008649 }
8650 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00008651 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008652
Daniel Veillard42595322004-11-08 10:52:06 +00008653 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008654}
8655
8656
8657static int
8658test_xmlDetectCharEncoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008659 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008660
Daniel Veillardce682bc2004-11-05 17:22:25 +00008661 int mem_base;
8662 xmlCharEncoding ret_val;
8663 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). */
8664 int n_in;
8665 int len; /* pointer to the length of the buffer */
8666 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008667
Daniel Veillardce682bc2004-11-05 17:22:25 +00008668 for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) {
8669 for (n_len = 0;n_len < gen_nb_int;n_len++) {
8670 mem_base = xmlMemBlocks();
8671 in = gen_const_unsigned_char_ptr(n_in, 0);
8672 len = gen_int(n_len, 1);
8673
William M. Brackf13f77f2004-11-12 16:03:48 +00008674 ret_val = xmlDetectCharEncoding((const unsigned char *)in, len);
Daniel Veillardce682bc2004-11-05 17:22:25 +00008675 desret_xmlCharEncoding(ret_val);
8676 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00008677 des_const_unsigned_char_ptr(n_in, (const unsigned char *)in, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +00008678 des_int(n_len, len, 1);
8679 xmlResetLastError();
8680 if (mem_base != xmlMemBlocks()) {
8681 printf("Leak of %d blocks found in xmlDetectCharEncoding",
8682 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008683 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008684 printf(" %d", n_in);
8685 printf(" %d", n_len);
8686 printf("\n");
8687 }
8688 }
8689 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00008690 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008691
Daniel Veillard42595322004-11-08 10:52:06 +00008692 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008693}
8694
8695
8696static int
8697test_xmlFindCharEncodingHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008698 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008699
8700
8701 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00008702 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008703}
8704
8705
8706static int
8707test_xmlGetCharEncodingHandler(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_xmlGetCharEncodingName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008718 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008719
Daniel Veillard3d97e662004-11-04 10:49:00 +00008720 int mem_base;
8721 const char * ret_val;
8722 xmlCharEncoding enc; /* the encoding */
8723 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008724
Daniel Veillard3d97e662004-11-04 10:49:00 +00008725 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
8726 mem_base = xmlMemBlocks();
8727 enc = gen_xmlCharEncoding(n_enc, 0);
8728
8729 ret_val = xmlGetCharEncodingName(enc);
8730 desret_const_char_ptr(ret_val);
8731 call_tests++;
8732 des_xmlCharEncoding(n_enc, enc, 0);
8733 xmlResetLastError();
8734 if (mem_base != xmlMemBlocks()) {
8735 printf("Leak of %d blocks found in xmlGetCharEncodingName",
8736 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008737 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00008738 printf(" %d", n_enc);
8739 printf("\n");
8740 }
8741 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00008742 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008743
Daniel Veillard42595322004-11-08 10:52:06 +00008744 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008745}
8746
8747
8748static int
8749test_xmlGetEncodingAlias(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008750 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008751
8752 int mem_base;
8753 const char * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008754 char * alias; /* the alias name as parsed, in UTF-8 format (ASCII actually) */
Daniel Veillardd93f6252004-11-02 15:53:51 +00008755 int n_alias;
8756
8757 for (n_alias = 0;n_alias < gen_nb_const_char_ptr;n_alias++) {
8758 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00008759 alias = gen_const_char_ptr(n_alias, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008760
William M. Brackf13f77f2004-11-12 16:03:48 +00008761 ret_val = xmlGetEncodingAlias((const char *)alias);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008762 desret_const_char_ptr(ret_val);
8763 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00008764 des_const_char_ptr(n_alias, (const char *)alias, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008765 xmlResetLastError();
8766 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00008767 printf("Leak of %d blocks found in xmlGetEncodingAlias",
Daniel Veillardd93f6252004-11-02 15:53:51 +00008768 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008769 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00008770 printf(" %d", n_alias);
8771 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00008772 }
8773 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00008774 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008775
Daniel Veillard42595322004-11-08 10:52:06 +00008776 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008777}
8778
8779
8780static int
8781test_xmlInitCharEncodingHandlers(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008782 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008783
8784
8785
8786 xmlInitCharEncodingHandlers();
8787 call_tests++;
8788 xmlResetLastError();
Daniel Veillard3d97e662004-11-04 10:49:00 +00008789 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008790
Daniel Veillard42595322004-11-08 10:52:06 +00008791 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008792}
8793
8794
8795static int
8796test_xmlNewCharEncodingHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008797 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008798
8799
8800 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00008801 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008802}
8803
8804
8805static int
8806test_xmlParseCharEncoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008807 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008808
Daniel Veillard3d97e662004-11-04 10:49:00 +00008809 int mem_base;
8810 xmlCharEncoding ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008811 char * name; /* the encoding name as parsed, in UTF-8 format (ASCII actually) */
Daniel Veillard3d97e662004-11-04 10:49:00 +00008812 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008813
Daniel Veillard3d97e662004-11-04 10:49:00 +00008814 for (n_name = 0;n_name < gen_nb_const_char_ptr;n_name++) {
8815 mem_base = xmlMemBlocks();
8816 name = gen_const_char_ptr(n_name, 0);
8817
William M. Brackf13f77f2004-11-12 16:03:48 +00008818 ret_val = xmlParseCharEncoding((const char *)name);
Daniel Veillard3d97e662004-11-04 10:49:00 +00008819 desret_xmlCharEncoding(ret_val);
8820 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00008821 des_const_char_ptr(n_name, (const char *)name, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00008822 xmlResetLastError();
8823 if (mem_base != xmlMemBlocks()) {
8824 printf("Leak of %d blocks found in xmlParseCharEncoding",
8825 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008826 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00008827 printf(" %d", n_name);
8828 printf("\n");
8829 }
8830 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00008831 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008832
Daniel Veillard42595322004-11-08 10:52:06 +00008833 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008834}
8835
8836
Daniel Veillardce682bc2004-11-05 17:22:25 +00008837#define gen_nb_xmlCharEncodingHandlerPtr 1
8838static xmlCharEncodingHandlerPtr gen_xmlCharEncodingHandlerPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
8839 return(NULL);
8840}
8841static void des_xmlCharEncodingHandlerPtr(int no ATTRIBUTE_UNUSED, xmlCharEncodingHandlerPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
8842}
8843
Daniel Veillardd93f6252004-11-02 15:53:51 +00008844static int
8845test_xmlRegisterCharEncodingHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008846 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008847
Daniel Veillardce682bc2004-11-05 17:22:25 +00008848 int mem_base;
8849 xmlCharEncodingHandlerPtr handler; /* the xmlCharEncodingHandlerPtr handler block */
8850 int n_handler;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008851
Daniel Veillardce682bc2004-11-05 17:22:25 +00008852 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandlerPtr;n_handler++) {
8853 mem_base = xmlMemBlocks();
8854 handler = gen_xmlCharEncodingHandlerPtr(n_handler, 0);
8855
8856 xmlRegisterCharEncodingHandler(handler);
8857 call_tests++;
8858 des_xmlCharEncodingHandlerPtr(n_handler, handler, 0);
8859 xmlResetLastError();
8860 if (mem_base != xmlMemBlocks()) {
8861 printf("Leak of %d blocks found in xmlRegisterCharEncodingHandler",
8862 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008863 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008864 printf(" %d", n_handler);
8865 printf("\n");
8866 }
8867 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00008868 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008869
Daniel Veillard42595322004-11-08 10:52:06 +00008870 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008871}
8872
8873static int
8874test_encoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008875 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008876
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008877 if (quiet == 0) printf("Testing encoding : 16 of 19 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00008878 test_ret += test_UTF8Toisolat1();
8879 test_ret += test_isolat1ToUTF8();
8880 test_ret += test_xmlAddEncodingAlias();
8881 test_ret += test_xmlCharEncCloseFunc();
8882 test_ret += test_xmlCharEncFirstLine();
8883 test_ret += test_xmlCharEncInFunc();
8884 test_ret += test_xmlCharEncOutFunc();
8885 test_ret += test_xmlCleanupCharEncodingHandlers();
8886 test_ret += test_xmlCleanupEncodingAliases();
8887 test_ret += test_xmlDelEncodingAlias();
8888 test_ret += test_xmlDetectCharEncoding();
8889 test_ret += test_xmlFindCharEncodingHandler();
8890 test_ret += test_xmlGetCharEncodingHandler();
8891 test_ret += test_xmlGetCharEncodingName();
8892 test_ret += test_xmlGetEncodingAlias();
8893 test_ret += test_xmlInitCharEncodingHandlers();
8894 test_ret += test_xmlNewCharEncodingHandler();
8895 test_ret += test_xmlParseCharEncoding();
8896 test_ret += test_xmlRegisterCharEncodingHandler();
Daniel Veillardd93f6252004-11-02 15:53:51 +00008897
Daniel Veillard42595322004-11-08 10:52:06 +00008898 if (test_ret != 0)
8899 printf("Module encoding: %d errors\n", test_ret);
8900 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008901}
8902
8903static int
8904test_xmlAddDocEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008905 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008906
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00008907 int mem_base;
8908 xmlEntityPtr ret_val;
8909 xmlDocPtr doc; /* the document */
8910 int n_doc;
8911 xmlChar * name; /* the entity name */
8912 int n_name;
8913 int type; /* the entity type XML_xxx_yyy_ENTITY */
8914 int n_type;
8915 xmlChar * ExternalID; /* the entity external ID if available */
8916 int n_ExternalID;
8917 xmlChar * SystemID; /* the entity system ID if available */
8918 int n_SystemID;
8919 xmlChar * content; /* the entity content */
8920 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008921
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00008922 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
8923 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
8924 for (n_type = 0;n_type < gen_nb_int;n_type++) {
8925 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
8926 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
8927 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
8928 mem_base = xmlMemBlocks();
8929 doc = gen_xmlDocPtr(n_doc, 0);
8930 name = gen_const_xmlChar_ptr(n_name, 1);
8931 type = gen_int(n_type, 2);
8932 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 3);
8933 SystemID = gen_const_xmlChar_ptr(n_SystemID, 4);
8934 content = gen_const_xmlChar_ptr(n_content, 5);
8935
William M. Brackf13f77f2004-11-12 16:03:48 +00008936 ret_val = xmlAddDocEntity(doc, (const xmlChar *)name, type, (const xmlChar *)ExternalID, (const xmlChar *)SystemID, (const xmlChar *)content);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00008937 desret_xmlEntityPtr(ret_val);
8938 call_tests++;
8939 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00008940 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00008941 des_int(n_type, type, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +00008942 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 3);
8943 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 4);
8944 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 5);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00008945 xmlResetLastError();
8946 if (mem_base != xmlMemBlocks()) {
8947 printf("Leak of %d blocks found in xmlAddDocEntity",
8948 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008949 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00008950 printf(" %d", n_doc);
8951 printf(" %d", n_name);
8952 printf(" %d", n_type);
8953 printf(" %d", n_ExternalID);
8954 printf(" %d", n_SystemID);
8955 printf(" %d", n_content);
8956 printf("\n");
8957 }
8958 }
8959 }
8960 }
8961 }
8962 }
8963 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00008964 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008965
Daniel Veillard42595322004-11-08 10:52:06 +00008966 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008967}
8968
8969
8970static int
8971test_xmlAddDtdEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008972 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008973
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00008974 int mem_base;
8975 xmlEntityPtr ret_val;
8976 xmlDocPtr doc; /* the document */
8977 int n_doc;
8978 xmlChar * name; /* the entity name */
8979 int n_name;
8980 int type; /* the entity type XML_xxx_yyy_ENTITY */
8981 int n_type;
8982 xmlChar * ExternalID; /* the entity external ID if available */
8983 int n_ExternalID;
8984 xmlChar * SystemID; /* the entity system ID if available */
8985 int n_SystemID;
8986 xmlChar * content; /* the entity content */
8987 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008988
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00008989 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
8990 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
8991 for (n_type = 0;n_type < gen_nb_int;n_type++) {
8992 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
8993 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
8994 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
8995 mem_base = xmlMemBlocks();
8996 doc = gen_xmlDocPtr(n_doc, 0);
8997 name = gen_const_xmlChar_ptr(n_name, 1);
8998 type = gen_int(n_type, 2);
8999 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 3);
9000 SystemID = gen_const_xmlChar_ptr(n_SystemID, 4);
9001 content = gen_const_xmlChar_ptr(n_content, 5);
9002
William M. Brackf13f77f2004-11-12 16:03:48 +00009003 ret_val = xmlAddDtdEntity(doc, (const xmlChar *)name, type, (const xmlChar *)ExternalID, (const xmlChar *)SystemID, (const xmlChar *)content);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009004 desret_xmlEntityPtr(ret_val);
9005 call_tests++;
9006 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009007 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009008 des_int(n_type, type, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +00009009 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 3);
9010 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 4);
9011 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 5);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009012 xmlResetLastError();
9013 if (mem_base != xmlMemBlocks()) {
9014 printf("Leak of %d blocks found in xmlAddDtdEntity",
9015 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009016 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009017 printf(" %d", n_doc);
9018 printf(" %d", n_name);
9019 printf(" %d", n_type);
9020 printf(" %d", n_ExternalID);
9021 printf(" %d", n_SystemID);
9022 printf(" %d", n_content);
9023 printf("\n");
9024 }
9025 }
9026 }
9027 }
9028 }
9029 }
9030 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009031 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009032
Daniel Veillard42595322004-11-08 10:52:06 +00009033 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009034}
9035
9036
9037static int
9038test_xmlCleanupPredefinedEntities(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009039 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009040
Daniel Veillarda521d282004-11-09 14:59:59 +00009041#ifdef LIBXML_LEGACY_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +00009042 int mem_base;
9043
9044 mem_base = xmlMemBlocks();
9045
9046 xmlCleanupPredefinedEntities();
9047 call_tests++;
9048 xmlResetLastError();
9049 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00009050 printf("Leak of %d blocks found in xmlCleanupPredefinedEntities",
Daniel Veillardd93f6252004-11-02 15:53:51 +00009051 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009052 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00009053 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00009054 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009055 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00009056#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +00009057
Daniel Veillard42595322004-11-08 10:52:06 +00009058 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009059}
9060
9061
Daniel Veillardce682bc2004-11-05 17:22:25 +00009062#define gen_nb_xmlEntitiesTablePtr 1
9063static xmlEntitiesTablePtr gen_xmlEntitiesTablePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
9064 return(NULL);
9065}
9066static void des_xmlEntitiesTablePtr(int no ATTRIBUTE_UNUSED, xmlEntitiesTablePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
9067}
9068
Daniel Veillardd93f6252004-11-02 15:53:51 +00009069static int
9070test_xmlCopyEntitiesTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009071 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009072
9073
9074 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00009075 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009076}
9077
9078
9079static int
9080test_xmlCreateEntitiesTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009081 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009082
9083
9084 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00009085 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009086}
9087
9088
9089static int
9090test_xmlDumpEntitiesTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009091 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009092
Daniel Veillardce682bc2004-11-05 17:22:25 +00009093#ifdef LIBXML_OUTPUT_ENABLED
9094 int mem_base;
9095 xmlBufferPtr buf; /* An XML buffer. */
9096 int n_buf;
9097 xmlEntitiesTablePtr table; /* An entity table */
9098 int n_table;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009099
Daniel Veillardce682bc2004-11-05 17:22:25 +00009100 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
9101 for (n_table = 0;n_table < gen_nb_xmlEntitiesTablePtr;n_table++) {
9102 mem_base = xmlMemBlocks();
9103 buf = gen_xmlBufferPtr(n_buf, 0);
9104 table = gen_xmlEntitiesTablePtr(n_table, 1);
9105
9106 xmlDumpEntitiesTable(buf, table);
9107 call_tests++;
9108 des_xmlBufferPtr(n_buf, buf, 0);
9109 des_xmlEntitiesTablePtr(n_table, table, 1);
9110 xmlResetLastError();
9111 if (mem_base != xmlMemBlocks()) {
9112 printf("Leak of %d blocks found in xmlDumpEntitiesTable",
9113 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009114 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009115 printf(" %d", n_buf);
9116 printf(" %d", n_table);
9117 printf("\n");
9118 }
9119 }
9120 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009121 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009122#endif
9123
Daniel Veillard42595322004-11-08 10:52:06 +00009124 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009125}
9126
9127
Daniel Veillardce682bc2004-11-05 17:22:25 +00009128#define gen_nb_xmlEntityPtr 1
9129static xmlEntityPtr gen_xmlEntityPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
9130 return(NULL);
9131}
9132static void des_xmlEntityPtr(int no ATTRIBUTE_UNUSED, xmlEntityPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
9133}
9134
Daniel Veillardd93f6252004-11-02 15:53:51 +00009135static int
9136test_xmlDumpEntityDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009137 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009138
Daniel Veillardce682bc2004-11-05 17:22:25 +00009139#ifdef LIBXML_OUTPUT_ENABLED
9140 int mem_base;
9141 xmlBufferPtr buf; /* An XML buffer. */
9142 int n_buf;
9143 xmlEntityPtr ent; /* An entity table */
9144 int n_ent;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009145
Daniel Veillardce682bc2004-11-05 17:22:25 +00009146 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
9147 for (n_ent = 0;n_ent < gen_nb_xmlEntityPtr;n_ent++) {
9148 mem_base = xmlMemBlocks();
9149 buf = gen_xmlBufferPtr(n_buf, 0);
9150 ent = gen_xmlEntityPtr(n_ent, 1);
9151
9152 xmlDumpEntityDecl(buf, ent);
9153 call_tests++;
9154 des_xmlBufferPtr(n_buf, buf, 0);
9155 des_xmlEntityPtr(n_ent, ent, 1);
9156 xmlResetLastError();
9157 if (mem_base != xmlMemBlocks()) {
9158 printf("Leak of %d blocks found in xmlDumpEntityDecl",
9159 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009160 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009161 printf(" %d", n_buf);
9162 printf(" %d", n_ent);
9163 printf("\n");
9164 }
9165 }
9166 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009167 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009168#endif
9169
Daniel Veillard42595322004-11-08 10:52:06 +00009170 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009171}
9172
9173
9174static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00009175test_xmlEncodeEntitiesReentrant(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009176 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009177
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009178 int mem_base;
9179 xmlChar * ret_val;
9180 xmlDocPtr doc; /* the document containing the string */
9181 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009182 xmlChar * input; /* A string to convert to XML. */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009183 int n_input;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009184
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009185 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
9186 for (n_input = 0;n_input < gen_nb_const_xmlChar_ptr;n_input++) {
9187 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009188 doc = gen_xmlDocPtr(n_doc, 0);
9189 input = gen_const_xmlChar_ptr(n_input, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009190
William M. Brackf13f77f2004-11-12 16:03:48 +00009191 ret_val = xmlEncodeEntitiesReentrant(doc, (const xmlChar *)input);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009192 desret_xmlChar_ptr(ret_val);
9193 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009194 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009195 des_const_xmlChar_ptr(n_input, (const xmlChar *)input, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009196 xmlResetLastError();
9197 if (mem_base != xmlMemBlocks()) {
9198 printf("Leak of %d blocks found in xmlEncodeEntitiesReentrant",
9199 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009200 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009201 printf(" %d", n_doc);
9202 printf(" %d", n_input);
9203 printf("\n");
9204 }
9205 }
9206 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009207 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009208
Daniel Veillard42595322004-11-08 10:52:06 +00009209 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009210}
9211
9212
9213static int
9214test_xmlEncodeSpecialChars(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009215 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009216
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009217 int mem_base;
9218 xmlChar * ret_val;
9219 xmlDocPtr doc; /* the document containing the string */
9220 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009221 xmlChar * input; /* A string to convert to XML. */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009222 int n_input;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009223
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009224 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
9225 for (n_input = 0;n_input < gen_nb_const_xmlChar_ptr;n_input++) {
9226 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009227 doc = gen_xmlDocPtr(n_doc, 0);
9228 input = gen_const_xmlChar_ptr(n_input, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009229
William M. Brackf13f77f2004-11-12 16:03:48 +00009230 ret_val = xmlEncodeSpecialChars(doc, (const xmlChar *)input);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009231 desret_xmlChar_ptr(ret_val);
9232 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009233 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009234 des_const_xmlChar_ptr(n_input, (const xmlChar *)input, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009235 xmlResetLastError();
9236 if (mem_base != xmlMemBlocks()) {
9237 printf("Leak of %d blocks found in xmlEncodeSpecialChars",
9238 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009239 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009240 printf(" %d", n_doc);
9241 printf(" %d", n_input);
9242 printf("\n");
9243 }
9244 }
9245 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009246 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009247
Daniel Veillard42595322004-11-08 10:52:06 +00009248 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009249}
9250
9251
9252static int
9253test_xmlGetDocEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009254 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009255
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009256 int mem_base;
9257 xmlEntityPtr ret_val;
9258 xmlDocPtr doc; /* the document referencing the entity */
9259 int n_doc;
9260 xmlChar * name; /* the entity name */
9261 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009262
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009263 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
9264 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9265 mem_base = xmlMemBlocks();
9266 doc = gen_xmlDocPtr(n_doc, 0);
9267 name = gen_const_xmlChar_ptr(n_name, 1);
9268
William M. Brackf13f77f2004-11-12 16:03:48 +00009269 ret_val = xmlGetDocEntity(doc, (const xmlChar *)name);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009270 desret_xmlEntityPtr(ret_val);
9271 call_tests++;
9272 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009273 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009274 xmlResetLastError();
9275 if (mem_base != xmlMemBlocks()) {
9276 printf("Leak of %d blocks found in xmlGetDocEntity",
9277 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009278 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009279 printf(" %d", n_doc);
9280 printf(" %d", n_name);
9281 printf("\n");
9282 }
9283 }
9284 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009285 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009286
Daniel Veillard42595322004-11-08 10:52:06 +00009287 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009288}
9289
9290
9291static int
9292test_xmlGetDtdEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009293 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009294
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009295 int mem_base;
9296 xmlEntityPtr ret_val;
9297 xmlDocPtr doc; /* the document referencing the entity */
9298 int n_doc;
9299 xmlChar * name; /* the entity name */
9300 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009301
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009302 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
9303 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9304 mem_base = xmlMemBlocks();
9305 doc = gen_xmlDocPtr(n_doc, 0);
9306 name = gen_const_xmlChar_ptr(n_name, 1);
9307
William M. Brackf13f77f2004-11-12 16:03:48 +00009308 ret_val = xmlGetDtdEntity(doc, (const xmlChar *)name);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009309 desret_xmlEntityPtr(ret_val);
9310 call_tests++;
9311 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009312 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009313 xmlResetLastError();
9314 if (mem_base != xmlMemBlocks()) {
9315 printf("Leak of %d blocks found in xmlGetDtdEntity",
9316 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009317 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009318 printf(" %d", n_doc);
9319 printf(" %d", n_name);
9320 printf("\n");
9321 }
9322 }
9323 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009324 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009325
Daniel Veillard42595322004-11-08 10:52:06 +00009326 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009327}
9328
9329
9330static int
9331test_xmlGetParameterEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009332 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009333
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009334 int mem_base;
9335 xmlEntityPtr ret_val;
9336 xmlDocPtr doc; /* the document referencing the entity */
9337 int n_doc;
9338 xmlChar * name; /* the entity name */
9339 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009340
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009341 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
9342 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9343 mem_base = xmlMemBlocks();
9344 doc = gen_xmlDocPtr(n_doc, 0);
9345 name = gen_const_xmlChar_ptr(n_name, 1);
9346
William M. Brackf13f77f2004-11-12 16:03:48 +00009347 ret_val = xmlGetParameterEntity(doc, (const xmlChar *)name);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009348 desret_xmlEntityPtr(ret_val);
9349 call_tests++;
9350 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009351 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009352 xmlResetLastError();
9353 if (mem_base != xmlMemBlocks()) {
9354 printf("Leak of %d blocks found in xmlGetParameterEntity",
9355 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009356 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009357 printf(" %d", n_doc);
9358 printf(" %d", n_name);
9359 printf("\n");
9360 }
9361 }
9362 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009363 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009364
Daniel Veillard42595322004-11-08 10:52:06 +00009365 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009366}
9367
9368
9369static int
9370test_xmlGetPredefinedEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009371 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009372
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009373 int mem_base;
9374 xmlEntityPtr ret_val;
9375 xmlChar * name; /* the entity name */
9376 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009377
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009378 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9379 mem_base = xmlMemBlocks();
9380 name = gen_const_xmlChar_ptr(n_name, 0);
9381
William M. Brackf13f77f2004-11-12 16:03:48 +00009382 ret_val = xmlGetPredefinedEntity((const xmlChar *)name);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009383 desret_xmlEntityPtr(ret_val);
9384 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00009385 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009386 xmlResetLastError();
9387 if (mem_base != xmlMemBlocks()) {
9388 printf("Leak of %d blocks found in xmlGetPredefinedEntity",
9389 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009390 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009391 printf(" %d", n_name);
9392 printf("\n");
9393 }
9394 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009395 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009396
Daniel Veillard42595322004-11-08 10:52:06 +00009397 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009398}
9399
9400
9401static int
9402test_xmlInitializePredefinedEntities(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009403 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009404
Daniel Veillarda521d282004-11-09 14:59:59 +00009405#ifdef LIBXML_LEGACY_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +00009406 int mem_base;
9407
9408 mem_base = xmlMemBlocks();
9409
9410 xmlInitializePredefinedEntities();
9411 call_tests++;
9412 xmlResetLastError();
9413 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00009414 printf("Leak of %d blocks found in xmlInitializePredefinedEntities",
Daniel Veillardd93f6252004-11-02 15:53:51 +00009415 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009416 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00009417 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00009418 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009419 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00009420#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +00009421
Daniel Veillard42595322004-11-08 10:52:06 +00009422 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009423}
9424
9425static int
9426test_entities(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009427 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009428
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009429 if (quiet == 0) printf("Testing entities : 12 of 16 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00009430 test_ret += test_xmlAddDocEntity();
9431 test_ret += test_xmlAddDtdEntity();
9432 test_ret += test_xmlCleanupPredefinedEntities();
9433 test_ret += test_xmlCopyEntitiesTable();
9434 test_ret += test_xmlCreateEntitiesTable();
9435 test_ret += test_xmlDumpEntitiesTable();
9436 test_ret += test_xmlDumpEntityDecl();
9437 test_ret += test_xmlEncodeEntitiesReentrant();
9438 test_ret += test_xmlEncodeSpecialChars();
9439 test_ret += test_xmlGetDocEntity();
9440 test_ret += test_xmlGetDtdEntity();
9441 test_ret += test_xmlGetParameterEntity();
9442 test_ret += test_xmlGetPredefinedEntity();
9443 test_ret += test_xmlInitializePredefinedEntities();
Daniel Veillardd93f6252004-11-02 15:53:51 +00009444
Daniel Veillard42595322004-11-08 10:52:06 +00009445 if (test_ret != 0)
9446 printf("Module entities: %d errors\n", test_ret);
9447 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009448}
9449
9450static int
9451test_xmlHashAddEntry(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009452 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009453
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009454 int mem_base;
9455 int ret_val;
9456 xmlHashTablePtr table; /* the hash table */
9457 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009458 xmlChar * name; /* the name of the userdata */
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009459 int n_name;
9460 void * userdata; /* a pointer to the userdata */
9461 int n_userdata;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009462
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009463 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9464 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9465 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
9466 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009467 table = gen_xmlHashTablePtr(n_table, 0);
9468 name = gen_const_xmlChar_ptr(n_name, 1);
9469 userdata = gen_userdata(n_userdata, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009470
William M. Brackf13f77f2004-11-12 16:03:48 +00009471 ret_val = xmlHashAddEntry(table, (const xmlChar *)name, userdata);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009472 desret_int(ret_val);
9473 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009474 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009475 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +00009476 des_userdata(n_userdata, userdata, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009477 xmlResetLastError();
9478 if (mem_base != xmlMemBlocks()) {
9479 printf("Leak of %d blocks found in xmlHashAddEntry",
9480 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009481 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009482 printf(" %d", n_table);
9483 printf(" %d", n_name);
9484 printf(" %d", n_userdata);
9485 printf("\n");
9486 }
9487 }
9488 }
9489 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009490 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009491
Daniel Veillard42595322004-11-08 10:52:06 +00009492 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009493}
9494
9495
9496static int
9497test_xmlHashAddEntry2(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009498 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009499
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009500 int mem_base;
9501 int ret_val;
9502 xmlHashTablePtr table; /* the hash table */
9503 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009504 xmlChar * name; /* the name of the userdata */
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009505 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009506 xmlChar * name2; /* a second name of the userdata */
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009507 int n_name2;
9508 void * userdata; /* a pointer to the userdata */
9509 int n_userdata;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009510
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009511 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9512 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9513 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
9514 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
9515 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009516 table = gen_xmlHashTablePtr(n_table, 0);
9517 name = gen_const_xmlChar_ptr(n_name, 1);
9518 name2 = gen_const_xmlChar_ptr(n_name2, 2);
9519 userdata = gen_userdata(n_userdata, 3);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009520
William M. Brackf13f77f2004-11-12 16:03:48 +00009521 ret_val = xmlHashAddEntry2(table, (const xmlChar *)name, (const xmlChar *)name2, userdata);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009522 desret_int(ret_val);
9523 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009524 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009525 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
9526 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +00009527 des_userdata(n_userdata, userdata, 3);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009528 xmlResetLastError();
9529 if (mem_base != xmlMemBlocks()) {
9530 printf("Leak of %d blocks found in xmlHashAddEntry2",
9531 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009532 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009533 printf(" %d", n_table);
9534 printf(" %d", n_name);
9535 printf(" %d", n_name2);
9536 printf(" %d", n_userdata);
9537 printf("\n");
9538 }
9539 }
9540 }
9541 }
9542 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009543 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009544
Daniel Veillard42595322004-11-08 10:52:06 +00009545 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009546}
9547
9548
9549static int
9550test_xmlHashAddEntry3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009551 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009552
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009553 int mem_base;
9554 int ret_val;
9555 xmlHashTablePtr table; /* the hash table */
9556 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009557 xmlChar * name; /* the name of the userdata */
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009558 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009559 xmlChar * name2; /* a second name of the userdata */
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009560 int n_name2;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009561 xmlChar * name3; /* a third name of the userdata */
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009562 int n_name3;
9563 void * userdata; /* a pointer to the userdata */
9564 int n_userdata;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009565
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009566 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9567 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9568 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
9569 for (n_name3 = 0;n_name3 < gen_nb_const_xmlChar_ptr;n_name3++) {
9570 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
9571 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009572 table = gen_xmlHashTablePtr(n_table, 0);
9573 name = gen_const_xmlChar_ptr(n_name, 1);
9574 name2 = gen_const_xmlChar_ptr(n_name2, 2);
9575 name3 = gen_const_xmlChar_ptr(n_name3, 3);
9576 userdata = gen_userdata(n_userdata, 4);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009577
William M. Brackf13f77f2004-11-12 16:03:48 +00009578 ret_val = xmlHashAddEntry3(table, (const xmlChar *)name, (const xmlChar *)name2, (const xmlChar *)name3, userdata);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009579 desret_int(ret_val);
9580 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009581 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009582 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
9583 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
9584 des_const_xmlChar_ptr(n_name3, (const xmlChar *)name3, 3);
Daniel Veillard3d97e662004-11-04 10:49:00 +00009585 des_userdata(n_userdata, userdata, 4);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009586 xmlResetLastError();
9587 if (mem_base != xmlMemBlocks()) {
9588 printf("Leak of %d blocks found in xmlHashAddEntry3",
9589 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009590 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009591 printf(" %d", n_table);
9592 printf(" %d", n_name);
9593 printf(" %d", n_name2);
9594 printf(" %d", n_name3);
9595 printf(" %d", n_userdata);
9596 printf("\n");
9597 }
9598 }
9599 }
9600 }
9601 }
9602 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009603 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009604
Daniel Veillard42595322004-11-08 10:52:06 +00009605 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009606}
9607
9608
9609static int
9610test_xmlHashCopy(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009611 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009612
9613
9614 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00009615 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009616}
9617
9618
9619static int
9620test_xmlHashCreate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009621 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009622
9623
9624 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00009625 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009626}
9627
9628
9629static int
9630test_xmlHashLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009631 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009632
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009633 int mem_base;
9634 void * ret_val;
9635 xmlHashTablePtr table; /* the hash table */
9636 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009637 xmlChar * name; /* the name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009638 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009639
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009640 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9641 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9642 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009643 table = gen_xmlHashTablePtr(n_table, 0);
9644 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009645
William M. Brackf13f77f2004-11-12 16:03:48 +00009646 ret_val = xmlHashLookup(table, (const xmlChar *)name);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009647 desret_void_ptr(ret_val);
9648 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009649 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009650 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009651 xmlResetLastError();
9652 if (mem_base != xmlMemBlocks()) {
9653 printf("Leak of %d blocks found in xmlHashLookup",
9654 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009655 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009656 printf(" %d", n_table);
9657 printf(" %d", n_name);
9658 printf("\n");
9659 }
9660 }
9661 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009662 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009663
Daniel Veillard42595322004-11-08 10:52:06 +00009664 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009665}
9666
9667
9668static int
9669test_xmlHashLookup2(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009670 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009671
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009672 int mem_base;
9673 void * ret_val;
9674 xmlHashTablePtr table; /* the hash table */
9675 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009676 xmlChar * name; /* the name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009677 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009678 xmlChar * name2; /* a second name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009679 int n_name2;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009680
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009681 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9682 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9683 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
9684 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009685 table = gen_xmlHashTablePtr(n_table, 0);
9686 name = gen_const_xmlChar_ptr(n_name, 1);
9687 name2 = gen_const_xmlChar_ptr(n_name2, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009688
William M. Brackf13f77f2004-11-12 16:03:48 +00009689 ret_val = xmlHashLookup2(table, (const xmlChar *)name, (const xmlChar *)name2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009690 desret_void_ptr(ret_val);
9691 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009692 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009693 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
9694 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009695 xmlResetLastError();
9696 if (mem_base != xmlMemBlocks()) {
9697 printf("Leak of %d blocks found in xmlHashLookup2",
9698 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009699 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009700 printf(" %d", n_table);
9701 printf(" %d", n_name);
9702 printf(" %d", n_name2);
9703 printf("\n");
9704 }
9705 }
9706 }
9707 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009708 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009709
Daniel Veillard42595322004-11-08 10:52:06 +00009710 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009711}
9712
9713
9714static int
9715test_xmlHashLookup3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009716 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009717
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009718 int mem_base;
9719 void * ret_val;
9720 xmlHashTablePtr table; /* the hash table */
9721 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009722 xmlChar * name; /* the name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009723 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009724 xmlChar * name2; /* a second name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009725 int n_name2;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009726 xmlChar * name3; /* a third name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009727 int n_name3;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009728
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009729 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9730 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9731 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
9732 for (n_name3 = 0;n_name3 < gen_nb_const_xmlChar_ptr;n_name3++) {
9733 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009734 table = gen_xmlHashTablePtr(n_table, 0);
9735 name = gen_const_xmlChar_ptr(n_name, 1);
9736 name2 = gen_const_xmlChar_ptr(n_name2, 2);
9737 name3 = gen_const_xmlChar_ptr(n_name3, 3);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009738
William M. Brackf13f77f2004-11-12 16:03:48 +00009739 ret_val = xmlHashLookup3(table, (const xmlChar *)name, (const xmlChar *)name2, (const xmlChar *)name3);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009740 desret_void_ptr(ret_val);
9741 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009742 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009743 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
9744 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
9745 des_const_xmlChar_ptr(n_name3, (const xmlChar *)name3, 3);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009746 xmlResetLastError();
9747 if (mem_base != xmlMemBlocks()) {
9748 printf("Leak of %d blocks found in xmlHashLookup3",
9749 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009750 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009751 printf(" %d", n_table);
9752 printf(" %d", n_name);
9753 printf(" %d", n_name2);
9754 printf(" %d", n_name3);
9755 printf("\n");
9756 }
9757 }
9758 }
9759 }
9760 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009761 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009762
Daniel Veillard42595322004-11-08 10:52:06 +00009763 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009764}
9765
9766
9767static int
9768test_xmlHashQLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009769 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009770
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009771 int mem_base;
9772 void * ret_val;
9773 xmlHashTablePtr table; /* the hash table */
9774 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009775 xmlChar * prefix; /* the prefix of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009776 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009777 xmlChar * name; /* the name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009778 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009779
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009780 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9781 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
9782 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9783 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009784 table = gen_xmlHashTablePtr(n_table, 0);
9785 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
9786 name = gen_const_xmlChar_ptr(n_name, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009787
William M. Brackf13f77f2004-11-12 16:03:48 +00009788 ret_val = xmlHashQLookup(table, (const xmlChar *)prefix, (const xmlChar *)name);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009789 desret_void_ptr(ret_val);
9790 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009791 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009792 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
9793 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009794 xmlResetLastError();
9795 if (mem_base != xmlMemBlocks()) {
9796 printf("Leak of %d blocks found in xmlHashQLookup",
9797 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009798 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009799 printf(" %d", n_table);
9800 printf(" %d", n_prefix);
9801 printf(" %d", n_name);
9802 printf("\n");
9803 }
9804 }
9805 }
9806 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009807 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009808
Daniel Veillard42595322004-11-08 10:52:06 +00009809 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009810}
9811
9812
9813static int
9814test_xmlHashQLookup2(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009815 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009816
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009817 int mem_base;
9818 void * ret_val;
9819 xmlHashTablePtr table; /* the hash table */
9820 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009821 xmlChar * prefix; /* the prefix of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009822 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009823 xmlChar * name; /* the name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009824 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009825 xmlChar * prefix2; /* the second prefix of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009826 int n_prefix2;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009827 xmlChar * name2; /* a second name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009828 int n_name2;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009829
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009830 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9831 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
9832 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9833 for (n_prefix2 = 0;n_prefix2 < gen_nb_const_xmlChar_ptr;n_prefix2++) {
9834 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
9835 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009836 table = gen_xmlHashTablePtr(n_table, 0);
9837 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
9838 name = gen_const_xmlChar_ptr(n_name, 2);
9839 prefix2 = gen_const_xmlChar_ptr(n_prefix2, 3);
9840 name2 = gen_const_xmlChar_ptr(n_name2, 4);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009841
William M. Brackf13f77f2004-11-12 16:03:48 +00009842 ret_val = xmlHashQLookup2(table, (const xmlChar *)prefix, (const xmlChar *)name, (const xmlChar *)prefix2, (const xmlChar *)name2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009843 desret_void_ptr(ret_val);
9844 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009845 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009846 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
9847 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
9848 des_const_xmlChar_ptr(n_prefix2, (const xmlChar *)prefix2, 3);
9849 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 4);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009850 xmlResetLastError();
9851 if (mem_base != xmlMemBlocks()) {
9852 printf("Leak of %d blocks found in xmlHashQLookup2",
9853 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009854 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009855 printf(" %d", n_table);
9856 printf(" %d", n_prefix);
9857 printf(" %d", n_name);
9858 printf(" %d", n_prefix2);
9859 printf(" %d", n_name2);
9860 printf("\n");
9861 }
9862 }
9863 }
9864 }
9865 }
9866 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009867 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009868
Daniel Veillard42595322004-11-08 10:52:06 +00009869 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009870}
9871
9872
9873static int
9874test_xmlHashQLookup3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009875 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009876
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009877 int mem_base;
9878 void * ret_val;
9879 xmlHashTablePtr table; /* the hash table */
9880 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009881 xmlChar * prefix; /* the prefix of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009882 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009883 xmlChar * name; /* the name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009884 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009885 xmlChar * prefix2; /* the second prefix of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009886 int n_prefix2;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009887 xmlChar * name2; /* a second name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009888 int n_name2;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009889 xmlChar * prefix3; /* the third prefix of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009890 int n_prefix3;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009891 xmlChar * name3; /* a third name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009892 int n_name3;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009893
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009894 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9895 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
9896 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9897 for (n_prefix2 = 0;n_prefix2 < gen_nb_const_xmlChar_ptr;n_prefix2++) {
9898 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
9899 for (n_prefix3 = 0;n_prefix3 < gen_nb_const_xmlChar_ptr;n_prefix3++) {
9900 for (n_name3 = 0;n_name3 < gen_nb_const_xmlChar_ptr;n_name3++) {
9901 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009902 table = gen_xmlHashTablePtr(n_table, 0);
9903 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
9904 name = gen_const_xmlChar_ptr(n_name, 2);
9905 prefix2 = gen_const_xmlChar_ptr(n_prefix2, 3);
9906 name2 = gen_const_xmlChar_ptr(n_name2, 4);
9907 prefix3 = gen_const_xmlChar_ptr(n_prefix3, 5);
9908 name3 = gen_const_xmlChar_ptr(n_name3, 6);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009909
William M. Brackf13f77f2004-11-12 16:03:48 +00009910 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 +00009911 desret_void_ptr(ret_val);
9912 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009913 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009914 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
9915 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
9916 des_const_xmlChar_ptr(n_prefix2, (const xmlChar *)prefix2, 3);
9917 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 4);
9918 des_const_xmlChar_ptr(n_prefix3, (const xmlChar *)prefix3, 5);
9919 des_const_xmlChar_ptr(n_name3, (const xmlChar *)name3, 6);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009920 xmlResetLastError();
9921 if (mem_base != xmlMemBlocks()) {
9922 printf("Leak of %d blocks found in xmlHashQLookup3",
9923 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009924 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009925 printf(" %d", n_table);
9926 printf(" %d", n_prefix);
9927 printf(" %d", n_name);
9928 printf(" %d", n_prefix2);
9929 printf(" %d", n_name2);
9930 printf(" %d", n_prefix3);
9931 printf(" %d", n_name3);
9932 printf("\n");
9933 }
9934 }
9935 }
9936 }
9937 }
9938 }
9939 }
9940 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009941 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009942
Daniel Veillard42595322004-11-08 10:52:06 +00009943 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009944}
9945
9946
9947static int
9948test_xmlHashRemoveEntry(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009949 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009950
Daniel Veillard42595322004-11-08 10:52:06 +00009951 int mem_base;
9952 int ret_val;
9953 xmlHashTablePtr table; /* the hash table */
9954 int n_table;
9955 xmlChar * name; /* the name of the userdata */
9956 int n_name;
9957 xmlHashDeallocator f; /* the deallocator function for removed item (if any) */
9958 int n_f;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009959
Daniel Veillard42595322004-11-08 10:52:06 +00009960 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9961 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9962 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
9963 mem_base = xmlMemBlocks();
9964 table = gen_xmlHashTablePtr(n_table, 0);
9965 name = gen_const_xmlChar_ptr(n_name, 1);
9966 f = gen_xmlHashDeallocator(n_f, 2);
9967
William M. Brackf13f77f2004-11-12 16:03:48 +00009968 ret_val = xmlHashRemoveEntry(table, (const xmlChar *)name, f);
Daniel Veillard42595322004-11-08 10:52:06 +00009969 desret_int(ret_val);
9970 call_tests++;
9971 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009972 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard42595322004-11-08 10:52:06 +00009973 des_xmlHashDeallocator(n_f, f, 2);
9974 xmlResetLastError();
9975 if (mem_base != xmlMemBlocks()) {
9976 printf("Leak of %d blocks found in xmlHashRemoveEntry",
9977 xmlMemBlocks() - mem_base);
9978 test_ret++;
9979 printf(" %d", n_table);
9980 printf(" %d", n_name);
9981 printf(" %d", n_f);
9982 printf("\n");
9983 }
9984 }
9985 }
9986 }
Daniel Veillard42595322004-11-08 10:52:06 +00009987 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009988
Daniel Veillard42595322004-11-08 10:52:06 +00009989 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009990}
9991
9992
9993static int
9994test_xmlHashRemoveEntry2(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009995 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009996
Daniel Veillard42595322004-11-08 10:52:06 +00009997 int mem_base;
9998 int ret_val;
9999 xmlHashTablePtr table; /* the hash table */
10000 int n_table;
10001 xmlChar * name; /* the name of the userdata */
10002 int n_name;
10003 xmlChar * name2; /* a second name of the userdata */
10004 int n_name2;
10005 xmlHashDeallocator f; /* the deallocator function for removed item (if any) */
10006 int n_f;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010007
Daniel Veillard42595322004-11-08 10:52:06 +000010008 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10009 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
10010 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
10011 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
10012 mem_base = xmlMemBlocks();
10013 table = gen_xmlHashTablePtr(n_table, 0);
10014 name = gen_const_xmlChar_ptr(n_name, 1);
10015 name2 = gen_const_xmlChar_ptr(n_name2, 2);
10016 f = gen_xmlHashDeallocator(n_f, 3);
10017
William M. Brackf13f77f2004-11-12 16:03:48 +000010018 ret_val = xmlHashRemoveEntry2(table, (const xmlChar *)name, (const xmlChar *)name2, f);
Daniel Veillard42595322004-11-08 10:52:06 +000010019 desret_int(ret_val);
10020 call_tests++;
10021 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000010022 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
10023 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
Daniel Veillard42595322004-11-08 10:52:06 +000010024 des_xmlHashDeallocator(n_f, f, 3);
10025 xmlResetLastError();
10026 if (mem_base != xmlMemBlocks()) {
10027 printf("Leak of %d blocks found in xmlHashRemoveEntry2",
10028 xmlMemBlocks() - mem_base);
10029 test_ret++;
10030 printf(" %d", n_table);
10031 printf(" %d", n_name);
10032 printf(" %d", n_name2);
10033 printf(" %d", n_f);
10034 printf("\n");
10035 }
10036 }
10037 }
10038 }
10039 }
Daniel Veillard42595322004-11-08 10:52:06 +000010040 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010041
Daniel Veillard42595322004-11-08 10:52:06 +000010042 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010043}
10044
10045
10046static int
10047test_xmlHashRemoveEntry3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010048 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010049
Daniel Veillard42595322004-11-08 10:52:06 +000010050 int mem_base;
10051 int ret_val;
10052 xmlHashTablePtr table; /* the hash table */
10053 int n_table;
10054 xmlChar * name; /* the name of the userdata */
10055 int n_name;
10056 xmlChar * name2; /* a second name of the userdata */
10057 int n_name2;
10058 xmlChar * name3; /* a third name of the userdata */
10059 int n_name3;
10060 xmlHashDeallocator f; /* the deallocator function for removed item (if any) */
10061 int n_f;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010062
Daniel Veillard42595322004-11-08 10:52:06 +000010063 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10064 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
10065 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
10066 for (n_name3 = 0;n_name3 < gen_nb_const_xmlChar_ptr;n_name3++) {
10067 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
10068 mem_base = xmlMemBlocks();
10069 table = gen_xmlHashTablePtr(n_table, 0);
10070 name = gen_const_xmlChar_ptr(n_name, 1);
10071 name2 = gen_const_xmlChar_ptr(n_name2, 2);
10072 name3 = gen_const_xmlChar_ptr(n_name3, 3);
10073 f = gen_xmlHashDeallocator(n_f, 4);
10074
William M. Brackf13f77f2004-11-12 16:03:48 +000010075 ret_val = xmlHashRemoveEntry3(table, (const xmlChar *)name, (const xmlChar *)name2, (const xmlChar *)name3, f);
Daniel Veillard42595322004-11-08 10:52:06 +000010076 desret_int(ret_val);
10077 call_tests++;
10078 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000010079 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
10080 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
10081 des_const_xmlChar_ptr(n_name3, (const xmlChar *)name3, 3);
Daniel Veillard42595322004-11-08 10:52:06 +000010082 des_xmlHashDeallocator(n_f, f, 4);
10083 xmlResetLastError();
10084 if (mem_base != xmlMemBlocks()) {
10085 printf("Leak of %d blocks found in xmlHashRemoveEntry3",
10086 xmlMemBlocks() - mem_base);
10087 test_ret++;
10088 printf(" %d", n_table);
10089 printf(" %d", n_name);
10090 printf(" %d", n_name2);
10091 printf(" %d", n_name3);
10092 printf(" %d", n_f);
10093 printf("\n");
10094 }
10095 }
10096 }
10097 }
10098 }
10099 }
Daniel Veillard42595322004-11-08 10:52:06 +000010100 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010101
Daniel Veillard42595322004-11-08 10:52:06 +000010102 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010103}
10104
10105
10106static int
10107test_xmlHashScan(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010108 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010109
10110
10111 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010112 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010113}
10114
10115
10116static int
10117test_xmlHashScan3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010118 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010119
10120
10121 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010122 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010123}
10124
10125
10126static int
10127test_xmlHashScanFull(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010128 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010129
10130
10131 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010132 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010133}
10134
10135
10136static int
10137test_xmlHashScanFull3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010138 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010139
10140
10141 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010142 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010143}
10144
10145
10146static int
10147test_xmlHashSize(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010148 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010149
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010150 int mem_base;
10151 int ret_val;
10152 xmlHashTablePtr table; /* the hash table */
10153 int n_table;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010154
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010155 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10156 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010157 table = gen_xmlHashTablePtr(n_table, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010158
10159 ret_val = xmlHashSize(table);
10160 desret_int(ret_val);
10161 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010162 des_xmlHashTablePtr(n_table, table, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010163 xmlResetLastError();
10164 if (mem_base != xmlMemBlocks()) {
10165 printf("Leak of %d blocks found in xmlHashSize",
10166 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010167 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010168 printf(" %d", n_table);
10169 printf("\n");
10170 }
10171 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010172 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010173
Daniel Veillard42595322004-11-08 10:52:06 +000010174 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010175}
10176
10177
10178static int
10179test_xmlHashUpdateEntry(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010180 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010181
Daniel Veillard42595322004-11-08 10:52:06 +000010182 int mem_base;
10183 int ret_val;
10184 xmlHashTablePtr table; /* the hash table */
10185 int n_table;
10186 xmlChar * name; /* the name of the userdata */
10187 int n_name;
10188 void * userdata; /* a pointer to the userdata */
10189 int n_userdata;
10190 xmlHashDeallocator f; /* the deallocator function for replaced item (if any) */
10191 int n_f;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010192
Daniel Veillard42595322004-11-08 10:52:06 +000010193 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10194 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
10195 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
10196 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
10197 mem_base = xmlMemBlocks();
10198 table = gen_xmlHashTablePtr(n_table, 0);
10199 name = gen_const_xmlChar_ptr(n_name, 1);
10200 userdata = gen_userdata(n_userdata, 2);
10201 f = gen_xmlHashDeallocator(n_f, 3);
10202
William M. Brackf13f77f2004-11-12 16:03:48 +000010203 ret_val = xmlHashUpdateEntry(table, (const xmlChar *)name, userdata, f);
Daniel Veillard42595322004-11-08 10:52:06 +000010204 desret_int(ret_val);
10205 call_tests++;
10206 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000010207 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard42595322004-11-08 10:52:06 +000010208 des_userdata(n_userdata, userdata, 2);
10209 des_xmlHashDeallocator(n_f, f, 3);
10210 xmlResetLastError();
10211 if (mem_base != xmlMemBlocks()) {
10212 printf("Leak of %d blocks found in xmlHashUpdateEntry",
10213 xmlMemBlocks() - mem_base);
10214 test_ret++;
10215 printf(" %d", n_table);
10216 printf(" %d", n_name);
10217 printf(" %d", n_userdata);
10218 printf(" %d", n_f);
10219 printf("\n");
10220 }
10221 }
10222 }
10223 }
10224 }
Daniel Veillard42595322004-11-08 10:52:06 +000010225 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010226
Daniel Veillard42595322004-11-08 10:52:06 +000010227 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010228}
10229
10230
10231static int
10232test_xmlHashUpdateEntry2(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010233 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010234
Daniel Veillard42595322004-11-08 10:52:06 +000010235 int mem_base;
10236 int ret_val;
10237 xmlHashTablePtr table; /* the hash table */
10238 int n_table;
10239 xmlChar * name; /* the name of the userdata */
10240 int n_name;
10241 xmlChar * name2; /* a second name of the userdata */
10242 int n_name2;
10243 void * userdata; /* a pointer to the userdata */
10244 int n_userdata;
10245 xmlHashDeallocator f; /* the deallocator function for replaced item (if any) */
10246 int n_f;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010247
Daniel Veillard42595322004-11-08 10:52:06 +000010248 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10249 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
10250 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
10251 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
10252 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
10253 mem_base = xmlMemBlocks();
10254 table = gen_xmlHashTablePtr(n_table, 0);
10255 name = gen_const_xmlChar_ptr(n_name, 1);
10256 name2 = gen_const_xmlChar_ptr(n_name2, 2);
10257 userdata = gen_userdata(n_userdata, 3);
10258 f = gen_xmlHashDeallocator(n_f, 4);
10259
William M. Brackf13f77f2004-11-12 16:03:48 +000010260 ret_val = xmlHashUpdateEntry2(table, (const xmlChar *)name, (const xmlChar *)name2, userdata, f);
Daniel Veillard42595322004-11-08 10:52:06 +000010261 desret_int(ret_val);
10262 call_tests++;
10263 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000010264 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
10265 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
Daniel Veillard42595322004-11-08 10:52:06 +000010266 des_userdata(n_userdata, userdata, 3);
10267 des_xmlHashDeallocator(n_f, f, 4);
10268 xmlResetLastError();
10269 if (mem_base != xmlMemBlocks()) {
10270 printf("Leak of %d blocks found in xmlHashUpdateEntry2",
10271 xmlMemBlocks() - mem_base);
10272 test_ret++;
10273 printf(" %d", n_table);
10274 printf(" %d", n_name);
10275 printf(" %d", n_name2);
10276 printf(" %d", n_userdata);
10277 printf(" %d", n_f);
10278 printf("\n");
10279 }
10280 }
10281 }
10282 }
10283 }
10284 }
Daniel Veillard42595322004-11-08 10:52:06 +000010285 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010286
Daniel Veillard42595322004-11-08 10:52:06 +000010287 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010288}
10289
10290
10291static int
10292test_xmlHashUpdateEntry3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010293 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010294
Daniel Veillard42595322004-11-08 10:52:06 +000010295 int mem_base;
10296 int ret_val;
10297 xmlHashTablePtr table; /* the hash table */
10298 int n_table;
10299 xmlChar * name; /* the name of the userdata */
10300 int n_name;
10301 xmlChar * name2; /* a second name of the userdata */
10302 int n_name2;
10303 xmlChar * name3; /* a third name of the userdata */
10304 int n_name3;
10305 void * userdata; /* a pointer to the userdata */
10306 int n_userdata;
10307 xmlHashDeallocator f; /* the deallocator function for replaced item (if any) */
10308 int n_f;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010309
Daniel Veillard42595322004-11-08 10:52:06 +000010310 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10311 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
10312 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
10313 for (n_name3 = 0;n_name3 < gen_nb_const_xmlChar_ptr;n_name3++) {
10314 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
10315 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
10316 mem_base = xmlMemBlocks();
10317 table = gen_xmlHashTablePtr(n_table, 0);
10318 name = gen_const_xmlChar_ptr(n_name, 1);
10319 name2 = gen_const_xmlChar_ptr(n_name2, 2);
10320 name3 = gen_const_xmlChar_ptr(n_name3, 3);
10321 userdata = gen_userdata(n_userdata, 4);
10322 f = gen_xmlHashDeallocator(n_f, 5);
10323
William M. Brackf13f77f2004-11-12 16:03:48 +000010324 ret_val = xmlHashUpdateEntry3(table, (const xmlChar *)name, (const xmlChar *)name2, (const xmlChar *)name3, userdata, f);
Daniel Veillard42595322004-11-08 10:52:06 +000010325 desret_int(ret_val);
10326 call_tests++;
10327 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000010328 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
10329 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
10330 des_const_xmlChar_ptr(n_name3, (const xmlChar *)name3, 3);
Daniel Veillard42595322004-11-08 10:52:06 +000010331 des_userdata(n_userdata, userdata, 4);
10332 des_xmlHashDeallocator(n_f, f, 5);
10333 xmlResetLastError();
10334 if (mem_base != xmlMemBlocks()) {
10335 printf("Leak of %d blocks found in xmlHashUpdateEntry3",
10336 xmlMemBlocks() - mem_base);
10337 test_ret++;
10338 printf(" %d", n_table);
10339 printf(" %d", n_name);
10340 printf(" %d", n_name2);
10341 printf(" %d", n_name3);
10342 printf(" %d", n_userdata);
10343 printf(" %d", n_f);
10344 printf("\n");
10345 }
10346 }
10347 }
10348 }
10349 }
10350 }
10351 }
Daniel Veillard42595322004-11-08 10:52:06 +000010352 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010353
Daniel Veillard42595322004-11-08 10:52:06 +000010354 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010355}
10356
10357static int
10358test_hash(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010359 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010360
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010361 if (quiet == 0) printf("Testing hash : 16 of 23 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000010362 test_ret += test_xmlHashAddEntry();
10363 test_ret += test_xmlHashAddEntry2();
10364 test_ret += test_xmlHashAddEntry3();
10365 test_ret += test_xmlHashCopy();
10366 test_ret += test_xmlHashCreate();
10367 test_ret += test_xmlHashLookup();
10368 test_ret += test_xmlHashLookup2();
10369 test_ret += test_xmlHashLookup3();
10370 test_ret += test_xmlHashQLookup();
10371 test_ret += test_xmlHashQLookup2();
10372 test_ret += test_xmlHashQLookup3();
10373 test_ret += test_xmlHashRemoveEntry();
10374 test_ret += test_xmlHashRemoveEntry2();
10375 test_ret += test_xmlHashRemoveEntry3();
10376 test_ret += test_xmlHashScan();
10377 test_ret += test_xmlHashScan3();
10378 test_ret += test_xmlHashScanFull();
10379 test_ret += test_xmlHashScanFull3();
10380 test_ret += test_xmlHashSize();
10381 test_ret += test_xmlHashUpdateEntry();
10382 test_ret += test_xmlHashUpdateEntry2();
10383 test_ret += test_xmlHashUpdateEntry3();
Daniel Veillardd93f6252004-11-02 15:53:51 +000010384
Daniel Veillard42595322004-11-08 10:52:06 +000010385 if (test_ret != 0)
10386 printf("Module hash: %d errors\n", test_ret);
10387 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010388}
10389
Daniel Veillardce682bc2004-11-05 17:22:25 +000010390#define gen_nb_xmlLinkPtr 1
10391static xmlLinkPtr gen_xmlLinkPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
10392 return(NULL);
10393}
10394static void des_xmlLinkPtr(int no ATTRIBUTE_UNUSED, xmlLinkPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
10395}
10396
Daniel Veillardd93f6252004-11-02 15:53:51 +000010397static int
10398test_xmlLinkGetData(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010399 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010400
Daniel Veillardce682bc2004-11-05 17:22:25 +000010401 int mem_base;
10402 void * ret_val;
10403 xmlLinkPtr lk; /* a link */
10404 int n_lk;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010405
Daniel Veillardce682bc2004-11-05 17:22:25 +000010406 for (n_lk = 0;n_lk < gen_nb_xmlLinkPtr;n_lk++) {
10407 mem_base = xmlMemBlocks();
10408 lk = gen_xmlLinkPtr(n_lk, 0);
10409
10410 ret_val = xmlLinkGetData(lk);
10411 desret_void_ptr(ret_val);
10412 call_tests++;
10413 des_xmlLinkPtr(n_lk, lk, 0);
10414 xmlResetLastError();
10415 if (mem_base != xmlMemBlocks()) {
10416 printf("Leak of %d blocks found in xmlLinkGetData",
10417 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010418 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000010419 printf(" %d", n_lk);
10420 printf("\n");
10421 }
10422 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000010423 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010424
Daniel Veillard42595322004-11-08 10:52:06 +000010425 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010426}
10427
10428
10429static int
10430test_xmlListAppend(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010431 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010432
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010433 int mem_base;
10434 int ret_val;
10435 xmlListPtr l; /* a list */
10436 int n_l;
10437 void * data; /* the data */
10438 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010439
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010440 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10441 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
10442 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010443 l = gen_xmlListPtr(n_l, 0);
10444 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010445
10446 ret_val = xmlListAppend(l, data);
10447 desret_int(ret_val);
10448 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010449 des_xmlListPtr(n_l, l, 0);
10450 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010451 xmlResetLastError();
10452 if (mem_base != xmlMemBlocks()) {
10453 printf("Leak of %d blocks found in xmlListAppend",
10454 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010455 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010456 printf(" %d", n_l);
10457 printf(" %d", n_data);
10458 printf("\n");
10459 }
10460 }
10461 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010462 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010463
Daniel Veillard42595322004-11-08 10:52:06 +000010464 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010465}
10466
10467
10468static int
10469test_xmlListClear(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010470 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010471
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010472 int mem_base;
10473 xmlListPtr l; /* a list */
10474 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010475
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010476 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10477 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010478 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010479
10480 xmlListClear(l);
10481 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010482 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010483 xmlResetLastError();
10484 if (mem_base != xmlMemBlocks()) {
10485 printf("Leak of %d blocks found in xmlListClear",
10486 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010487 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010488 printf(" %d", n_l);
10489 printf("\n");
10490 }
10491 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010492 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010493
Daniel Veillard42595322004-11-08 10:52:06 +000010494 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010495}
10496
10497
Daniel Veillardce682bc2004-11-05 17:22:25 +000010498#define gen_nb_const_xmlListPtr 1
10499static xmlListPtr gen_const_xmlListPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
10500 return(NULL);
10501}
10502static void des_const_xmlListPtr(int no ATTRIBUTE_UNUSED, const xmlListPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
10503}
10504
Daniel Veillardd93f6252004-11-02 15:53:51 +000010505static int
10506test_xmlListCopy(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010507 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010508
Daniel Veillardce682bc2004-11-05 17:22:25 +000010509 int mem_base;
10510 int ret_val;
10511 xmlListPtr cur; /* the new list */
10512 int n_cur;
10513 xmlListPtr old; /* the old list */
10514 int n_old;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010515
Daniel Veillardce682bc2004-11-05 17:22:25 +000010516 for (n_cur = 0;n_cur < gen_nb_xmlListPtr;n_cur++) {
10517 for (n_old = 0;n_old < gen_nb_const_xmlListPtr;n_old++) {
10518 mem_base = xmlMemBlocks();
10519 cur = gen_xmlListPtr(n_cur, 0);
10520 old = gen_const_xmlListPtr(n_old, 1);
10521
William M. Brackf13f77f2004-11-12 16:03:48 +000010522 ret_val = xmlListCopy(cur, (const xmlListPtr)old);
Daniel Veillardce682bc2004-11-05 17:22:25 +000010523 desret_int(ret_val);
10524 call_tests++;
10525 des_xmlListPtr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000010526 des_const_xmlListPtr(n_old, (const xmlListPtr)old, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000010527 xmlResetLastError();
10528 if (mem_base != xmlMemBlocks()) {
10529 printf("Leak of %d blocks found in xmlListCopy",
10530 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010531 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000010532 printf(" %d", n_cur);
10533 printf(" %d", n_old);
10534 printf("\n");
10535 }
10536 }
10537 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000010538 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010539
Daniel Veillard42595322004-11-08 10:52:06 +000010540 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010541}
10542
10543
10544static int
10545test_xmlListCreate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010546 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010547
10548
10549 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010550 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010551}
10552
10553
10554static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000010555test_xmlListDup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010556 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010557
10558
10559 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010560 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010561}
10562
10563
10564static int
10565test_xmlListEmpty(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010566 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010567
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010568 int mem_base;
10569 int ret_val;
10570 xmlListPtr l; /* a list */
10571 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010572
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010573 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10574 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010575 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010576
10577 ret_val = xmlListEmpty(l);
10578 desret_int(ret_val);
10579 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010580 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010581 xmlResetLastError();
10582 if (mem_base != xmlMemBlocks()) {
10583 printf("Leak of %d blocks found in xmlListEmpty",
10584 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010585 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010586 printf(" %d", n_l);
10587 printf("\n");
10588 }
10589 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010590 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010591
Daniel Veillard42595322004-11-08 10:52:06 +000010592 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010593}
10594
10595
10596static int
10597test_xmlListEnd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010598 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010599
10600
10601 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010602 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010603}
10604
10605
10606static int
10607test_xmlListFront(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010608 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010609
10610
10611 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010612 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010613}
10614
10615
10616static int
10617test_xmlListInsert(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010618 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010619
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010620 int mem_base;
10621 int ret_val;
10622 xmlListPtr l; /* a list */
10623 int n_l;
10624 void * data; /* the data */
10625 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010626
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010627 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10628 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
10629 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010630 l = gen_xmlListPtr(n_l, 0);
10631 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010632
10633 ret_val = xmlListInsert(l, data);
10634 desret_int(ret_val);
10635 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010636 des_xmlListPtr(n_l, l, 0);
10637 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010638 xmlResetLastError();
10639 if (mem_base != xmlMemBlocks()) {
10640 printf("Leak of %d blocks found in xmlListInsert",
10641 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010642 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010643 printf(" %d", n_l);
10644 printf(" %d", n_data);
10645 printf("\n");
10646 }
10647 }
10648 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010649 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010650
Daniel Veillard42595322004-11-08 10:52:06 +000010651 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010652}
10653
10654
10655static int
10656test_xmlListMerge(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010657 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010658
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010659 int mem_base;
10660 xmlListPtr l1; /* the original list */
10661 int n_l1;
10662 xmlListPtr l2; /* the new list */
10663 int n_l2;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010664
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010665 for (n_l1 = 0;n_l1 < gen_nb_xmlListPtr;n_l1++) {
10666 for (n_l2 = 0;n_l2 < gen_nb_xmlListPtr;n_l2++) {
10667 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010668 l1 = gen_xmlListPtr(n_l1, 0);
10669 l2 = gen_xmlListPtr(n_l2, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010670
10671 xmlListMerge(l1, l2);
10672 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010673 des_xmlListPtr(n_l1, l1, 0);
10674 des_xmlListPtr(n_l2, l2, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010675 xmlResetLastError();
10676 if (mem_base != xmlMemBlocks()) {
10677 printf("Leak of %d blocks found in xmlListMerge",
10678 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010679 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010680 printf(" %d", n_l1);
10681 printf(" %d", n_l2);
10682 printf("\n");
10683 }
10684 }
10685 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010686 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010687
Daniel Veillard42595322004-11-08 10:52:06 +000010688 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010689}
10690
10691
10692static int
10693test_xmlListPopBack(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010694 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010695
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010696 int mem_base;
10697 xmlListPtr l; /* a list */
10698 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010699
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010700 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10701 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010702 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010703
10704 xmlListPopBack(l);
10705 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010706 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010707 xmlResetLastError();
10708 if (mem_base != xmlMemBlocks()) {
10709 printf("Leak of %d blocks found in xmlListPopBack",
10710 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010711 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010712 printf(" %d", n_l);
10713 printf("\n");
10714 }
10715 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010716 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010717
Daniel Veillard42595322004-11-08 10:52:06 +000010718 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010719}
10720
10721
10722static int
10723test_xmlListPopFront(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010724 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010725
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010726 int mem_base;
10727 xmlListPtr l; /* a list */
10728 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010729
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010730 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10731 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010732 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010733
10734 xmlListPopFront(l);
10735 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010736 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010737 xmlResetLastError();
10738 if (mem_base != xmlMemBlocks()) {
10739 printf("Leak of %d blocks found in xmlListPopFront",
10740 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010741 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010742 printf(" %d", n_l);
10743 printf("\n");
10744 }
10745 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010746 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010747
Daniel Veillard42595322004-11-08 10:52:06 +000010748 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010749}
10750
10751
10752static int
10753test_xmlListPushBack(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010754 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010755
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010756 int mem_base;
10757 int ret_val;
10758 xmlListPtr l; /* a list */
10759 int n_l;
10760 void * data; /* new data */
10761 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010762
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010763 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10764 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
10765 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010766 l = gen_xmlListPtr(n_l, 0);
10767 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010768
10769 ret_val = xmlListPushBack(l, data);
10770 desret_int(ret_val);
10771 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010772 des_xmlListPtr(n_l, l, 0);
10773 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010774 xmlResetLastError();
10775 if (mem_base != xmlMemBlocks()) {
10776 printf("Leak of %d blocks found in xmlListPushBack",
10777 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010778 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010779 printf(" %d", n_l);
10780 printf(" %d", n_data);
10781 printf("\n");
10782 }
10783 }
10784 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010785 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010786
Daniel Veillard42595322004-11-08 10:52:06 +000010787 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010788}
10789
10790
10791static int
10792test_xmlListPushFront(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010793 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010794
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010795 int mem_base;
10796 int ret_val;
10797 xmlListPtr l; /* a list */
10798 int n_l;
10799 void * data; /* new data */
10800 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010801
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010802 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10803 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
10804 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010805 l = gen_xmlListPtr(n_l, 0);
10806 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010807
10808 ret_val = xmlListPushFront(l, data);
10809 desret_int(ret_val);
10810 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010811 des_xmlListPtr(n_l, l, 0);
10812 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010813 xmlResetLastError();
10814 if (mem_base != xmlMemBlocks()) {
10815 printf("Leak of %d blocks found in xmlListPushFront",
10816 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010817 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010818 printf(" %d", n_l);
10819 printf(" %d", n_data);
10820 printf("\n");
10821 }
10822 }
10823 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010824 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010825
Daniel Veillard42595322004-11-08 10:52:06 +000010826 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010827}
10828
10829
10830static int
10831test_xmlListRemoveAll(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010832 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010833
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010834 int mem_base;
10835 int ret_val;
10836 xmlListPtr l; /* a list */
10837 int n_l;
10838 void * data; /* list data */
10839 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010840
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010841 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10842 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
10843 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010844 l = gen_xmlListPtr(n_l, 0);
10845 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010846
10847 ret_val = xmlListRemoveAll(l, data);
10848 desret_int(ret_val);
10849 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010850 des_xmlListPtr(n_l, l, 0);
10851 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010852 xmlResetLastError();
10853 if (mem_base != xmlMemBlocks()) {
10854 printf("Leak of %d blocks found in xmlListRemoveAll",
10855 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010856 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010857 printf(" %d", n_l);
10858 printf(" %d", n_data);
10859 printf("\n");
10860 }
10861 }
10862 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010863 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010864
Daniel Veillard42595322004-11-08 10:52:06 +000010865 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010866}
10867
10868
10869static int
10870test_xmlListRemoveFirst(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010871 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010872
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010873 int mem_base;
10874 int ret_val;
10875 xmlListPtr l; /* a list */
10876 int n_l;
10877 void * data; /* list data */
10878 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010879
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010880 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10881 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
10882 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010883 l = gen_xmlListPtr(n_l, 0);
10884 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010885
10886 ret_val = xmlListRemoveFirst(l, data);
10887 desret_int(ret_val);
10888 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010889 des_xmlListPtr(n_l, l, 0);
10890 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010891 xmlResetLastError();
10892 if (mem_base != xmlMemBlocks()) {
10893 printf("Leak of %d blocks found in xmlListRemoveFirst",
10894 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010895 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010896 printf(" %d", n_l);
10897 printf(" %d", n_data);
10898 printf("\n");
10899 }
10900 }
10901 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010902 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010903
Daniel Veillard42595322004-11-08 10:52:06 +000010904 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010905}
10906
10907
10908static int
10909test_xmlListRemoveLast(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010910 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010911
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010912 int mem_base;
10913 int ret_val;
10914 xmlListPtr l; /* a list */
10915 int n_l;
10916 void * data; /* list data */
10917 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010918
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010919 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10920 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
10921 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010922 l = gen_xmlListPtr(n_l, 0);
10923 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010924
10925 ret_val = xmlListRemoveLast(l, data);
10926 desret_int(ret_val);
10927 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010928 des_xmlListPtr(n_l, l, 0);
10929 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010930 xmlResetLastError();
10931 if (mem_base != xmlMemBlocks()) {
10932 printf("Leak of %d blocks found in xmlListRemoveLast",
10933 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010934 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010935 printf(" %d", n_l);
10936 printf(" %d", n_data);
10937 printf("\n");
10938 }
10939 }
10940 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010941 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010942
Daniel Veillard42595322004-11-08 10:52:06 +000010943 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010944}
10945
10946
10947static int
10948test_xmlListReverse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010949 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010950
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010951 int mem_base;
10952 xmlListPtr l; /* a list */
10953 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010954
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010955 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10956 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010957 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010958
10959 xmlListReverse(l);
10960 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010961 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010962 xmlResetLastError();
10963 if (mem_base != xmlMemBlocks()) {
10964 printf("Leak of %d blocks found in xmlListReverse",
10965 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010966 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010967 printf(" %d", n_l);
10968 printf("\n");
10969 }
10970 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010971 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010972
Daniel Veillard42595322004-11-08 10:52:06 +000010973 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010974}
10975
10976
10977static int
10978test_xmlListReverseSearch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010979 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010980
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010981 int mem_base;
10982 void * ret_val;
10983 xmlListPtr l; /* a list */
10984 int n_l;
10985 void * data; /* a search value */
10986 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010987
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010988 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10989 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
10990 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010991 l = gen_xmlListPtr(n_l, 0);
10992 data = gen_userdata(n_data, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010993
10994 ret_val = xmlListReverseSearch(l, data);
10995 desret_void_ptr(ret_val);
10996 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010997 des_xmlListPtr(n_l, l, 0);
10998 des_userdata(n_data, data, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010999 xmlResetLastError();
11000 if (mem_base != xmlMemBlocks()) {
11001 printf("Leak of %d blocks found in xmlListReverseSearch",
11002 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011003 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011004 printf(" %d", n_l);
11005 printf(" %d", n_data);
11006 printf("\n");
11007 }
11008 }
11009 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000011010 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011011
Daniel Veillard42595322004-11-08 10:52:06 +000011012 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011013}
11014
11015
11016static int
11017test_xmlListReverseWalk(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011018 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011019
11020
11021 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000011022 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011023}
11024
11025
11026static int
11027test_xmlListSearch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011028 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011029
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011030 int mem_base;
11031 void * ret_val;
11032 xmlListPtr l; /* a list */
11033 int n_l;
11034 void * data; /* a search value */
11035 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011036
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011037 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
11038 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
11039 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011040 l = gen_xmlListPtr(n_l, 0);
11041 data = gen_userdata(n_data, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011042
11043 ret_val = xmlListSearch(l, data);
11044 desret_void_ptr(ret_val);
11045 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011046 des_xmlListPtr(n_l, l, 0);
11047 des_userdata(n_data, data, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011048 xmlResetLastError();
11049 if (mem_base != xmlMemBlocks()) {
11050 printf("Leak of %d blocks found in xmlListSearch",
11051 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011052 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011053 printf(" %d", n_l);
11054 printf(" %d", n_data);
11055 printf("\n");
11056 }
11057 }
11058 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000011059 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011060
Daniel Veillard42595322004-11-08 10:52:06 +000011061 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011062}
11063
11064
11065static int
11066test_xmlListSize(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011067 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011068
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011069 int mem_base;
11070 int ret_val;
11071 xmlListPtr l; /* a list */
11072 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011073
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011074 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
11075 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011076 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011077
11078 ret_val = xmlListSize(l);
11079 desret_int(ret_val);
11080 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011081 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011082 xmlResetLastError();
11083 if (mem_base != xmlMemBlocks()) {
11084 printf("Leak of %d blocks found in xmlListSize",
11085 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011086 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011087 printf(" %d", n_l);
11088 printf("\n");
11089 }
11090 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000011091 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011092
Daniel Veillard42595322004-11-08 10:52:06 +000011093 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011094}
11095
11096
11097static int
11098test_xmlListSort(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011099 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011100
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011101 int mem_base;
11102 xmlListPtr l; /* a list */
11103 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011104
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011105 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
11106 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011107 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011108
11109 xmlListSort(l);
11110 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011111 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011112 xmlResetLastError();
11113 if (mem_base != xmlMemBlocks()) {
11114 printf("Leak of %d blocks found in xmlListSort",
11115 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011116 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011117 printf(" %d", n_l);
11118 printf("\n");
11119 }
11120 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000011121 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011122
Daniel Veillard42595322004-11-08 10:52:06 +000011123 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011124}
11125
11126
11127static int
11128test_xmlListWalk(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011129 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011130
11131
11132 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000011133 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011134}
11135
11136static int
11137test_list(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011138 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011139
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011140 if (quiet == 0) printf("Testing list : 19 of 26 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000011141 test_ret += test_xmlLinkGetData();
11142 test_ret += test_xmlListAppend();
11143 test_ret += test_xmlListClear();
11144 test_ret += test_xmlListCopy();
11145 test_ret += test_xmlListCreate();
11146 test_ret += test_xmlListDup();
11147 test_ret += test_xmlListEmpty();
11148 test_ret += test_xmlListEnd();
11149 test_ret += test_xmlListFront();
11150 test_ret += test_xmlListInsert();
11151 test_ret += test_xmlListMerge();
11152 test_ret += test_xmlListPopBack();
11153 test_ret += test_xmlListPopFront();
11154 test_ret += test_xmlListPushBack();
11155 test_ret += test_xmlListPushFront();
11156 test_ret += test_xmlListRemoveAll();
11157 test_ret += test_xmlListRemoveFirst();
11158 test_ret += test_xmlListRemoveLast();
11159 test_ret += test_xmlListReverse();
11160 test_ret += test_xmlListReverseSearch();
11161 test_ret += test_xmlListReverseWalk();
11162 test_ret += test_xmlListSearch();
11163 test_ret += test_xmlListSize();
11164 test_ret += test_xmlListSort();
11165 test_ret += test_xmlListWalk();
Daniel Veillardd93f6252004-11-02 15:53:51 +000011166
Daniel Veillard42595322004-11-08 10:52:06 +000011167 if (test_ret != 0)
11168 printf("Module list: %d errors\n", test_ret);
11169 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011170}
11171
11172static int
11173test_xmlNanoFTPCheckResponse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011174 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011175
Daniel Veillard27f20102004-11-05 11:50:11 +000011176#ifdef LIBXML_FTP_ENABLED
11177 int mem_base;
11178 int ret_val;
11179 void * ctx; /* an FTP context */
11180 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011181
Daniel Veillard27f20102004-11-05 11:50:11 +000011182 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11183 mem_base = xmlMemBlocks();
11184 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11185
11186 ret_val = xmlNanoFTPCheckResponse(ctx);
11187 desret_int(ret_val);
11188 call_tests++;
11189 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11190 xmlResetLastError();
11191 if (mem_base != xmlMemBlocks()) {
11192 printf("Leak of %d blocks found in xmlNanoFTPCheckResponse",
11193 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011194 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011195 printf(" %d", n_ctx);
11196 printf("\n");
11197 }
11198 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011199 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011200#endif
11201
Daniel Veillard42595322004-11-08 10:52:06 +000011202 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011203}
11204
11205
11206static int
11207test_xmlNanoFTPCleanup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011208 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011209
11210#ifdef LIBXML_FTP_ENABLED
11211 int mem_base;
11212
11213 mem_base = xmlMemBlocks();
11214
11215 xmlNanoFTPCleanup();
11216 call_tests++;
11217 xmlResetLastError();
11218 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000011219 printf("Leak of %d blocks found in xmlNanoFTPCleanup",
Daniel Veillardd93f6252004-11-02 15:53:51 +000011220 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011221 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000011222 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000011223 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011224 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +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
Daniel Veillardd93f6252004-11-02 15:53:51 +000011232test_xmlNanoFTPCloseConnection(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011233 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011234
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011235#ifdef LIBXML_FTP_ENABLED
11236 int mem_base;
Daniel Veillard27f20102004-11-05 11:50:11 +000011237 int ret_val;
11238 void * ctx; /* an FTP context */
11239 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011240
Daniel Veillard27f20102004-11-05 11:50:11 +000011241 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011242 mem_base = xmlMemBlocks();
Daniel Veillard27f20102004-11-05 11:50:11 +000011243 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011244
Daniel Veillard27f20102004-11-05 11:50:11 +000011245 ret_val = xmlNanoFTPCloseConnection(ctx);
11246 desret_int(ret_val);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011247 call_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011248 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011249 xmlResetLastError();
11250 if (mem_base != xmlMemBlocks()) {
Daniel Veillard27f20102004-11-05 11:50:11 +000011251 printf("Leak of %d blocks found in xmlNanoFTPCloseConnection",
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011252 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011253 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011254 printf(" %d", n_ctx);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011255 printf("\n");
11256 }
11257 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011258 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011259#endif
11260
Daniel Veillard42595322004-11-08 10:52:06 +000011261 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011262}
11263
11264
11265static int
11266test_xmlNanoFTPCwd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011267 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011268
Daniel Veillard27f20102004-11-05 11:50:11 +000011269#ifdef LIBXML_FTP_ENABLED
11270 int mem_base;
11271 int ret_val;
11272 void * ctx; /* an FTP context */
11273 int n_ctx;
Daniel Veillardce682bc2004-11-05 17:22:25 +000011274 char * directory; /* a directory on the server */
Daniel Veillard27f20102004-11-05 11:50:11 +000011275 int n_directory;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011276
Daniel Veillard27f20102004-11-05 11:50:11 +000011277 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11278 for (n_directory = 0;n_directory < gen_nb_const_char_ptr;n_directory++) {
11279 mem_base = xmlMemBlocks();
11280 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11281 directory = gen_const_char_ptr(n_directory, 1);
11282
William M. Brackf13f77f2004-11-12 16:03:48 +000011283 ret_val = xmlNanoFTPCwd(ctx, (const char *)directory);
Daniel Veillard27f20102004-11-05 11:50:11 +000011284 desret_int(ret_val);
11285 call_tests++;
11286 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000011287 des_const_char_ptr(n_directory, (const char *)directory, 1);
Daniel Veillard27f20102004-11-05 11:50:11 +000011288 xmlResetLastError();
11289 if (mem_base != xmlMemBlocks()) {
11290 printf("Leak of %d blocks found in xmlNanoFTPCwd",
11291 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011292 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011293 printf(" %d", n_ctx);
11294 printf(" %d", n_directory);
11295 printf("\n");
11296 }
11297 }
11298 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011299 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011300#endif
11301
Daniel Veillard42595322004-11-08 10:52:06 +000011302 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011303}
11304
11305
11306static int
11307test_xmlNanoFTPDele(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011308 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011309
Daniel Veillard27f20102004-11-05 11:50:11 +000011310#ifdef LIBXML_FTP_ENABLED
11311 int mem_base;
11312 int ret_val;
11313 void * ctx; /* an FTP context */
11314 int n_ctx;
11315 const char * file; /* a file or directory on the server */
11316 int n_file;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011317
Daniel Veillard27f20102004-11-05 11:50:11 +000011318 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11319 for (n_file = 0;n_file < gen_nb_filepath;n_file++) {
11320 mem_base = xmlMemBlocks();
11321 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11322 file = gen_filepath(n_file, 1);
11323
11324 ret_val = xmlNanoFTPDele(ctx, file);
11325 desret_int(ret_val);
11326 call_tests++;
11327 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11328 des_filepath(n_file, file, 1);
11329 xmlResetLastError();
11330 if (mem_base != xmlMemBlocks()) {
11331 printf("Leak of %d blocks found in xmlNanoFTPDele",
11332 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011333 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011334 printf(" %d", n_ctx);
11335 printf(" %d", n_file);
11336 printf("\n");
11337 }
11338 }
11339 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011340 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011341#endif
11342
Daniel Veillard42595322004-11-08 10:52:06 +000011343 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011344}
11345
11346
11347static int
11348test_xmlNanoFTPGet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011349 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011350
11351
11352 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000011353 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011354}
11355
11356
11357static int
11358test_xmlNanoFTPGetConnection(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011359 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011360
Daniel Veillard27f20102004-11-05 11:50:11 +000011361#ifdef LIBXML_FTP_ENABLED
11362 int mem_base;
11363 int ret_val;
11364 void * ctx; /* an FTP context */
11365 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011366
Daniel Veillard27f20102004-11-05 11:50:11 +000011367 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11368 mem_base = xmlMemBlocks();
11369 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11370
11371 ret_val = xmlNanoFTPGetConnection(ctx);
11372 desret_int(ret_val);
11373 call_tests++;
11374 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11375 xmlResetLastError();
11376 if (mem_base != xmlMemBlocks()) {
11377 printf("Leak of %d blocks found in xmlNanoFTPGetConnection",
11378 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011379 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011380 printf(" %d", n_ctx);
11381 printf("\n");
11382 }
11383 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011384 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011385#endif
11386
Daniel Veillard42595322004-11-08 10:52:06 +000011387 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011388}
11389
11390
11391static int
11392test_xmlNanoFTPGetResponse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011393 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011394
Daniel Veillard27f20102004-11-05 11:50:11 +000011395#ifdef LIBXML_FTP_ENABLED
11396 int mem_base;
11397 int ret_val;
11398 void * ctx; /* an FTP context */
11399 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011400
Daniel Veillard27f20102004-11-05 11:50:11 +000011401 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11402 mem_base = xmlMemBlocks();
11403 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11404
11405 ret_val = xmlNanoFTPGetResponse(ctx);
11406 desret_int(ret_val);
11407 call_tests++;
11408 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11409 xmlResetLastError();
11410 if (mem_base != xmlMemBlocks()) {
11411 printf("Leak of %d blocks found in xmlNanoFTPGetResponse",
11412 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011413 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011414 printf(" %d", n_ctx);
11415 printf("\n");
11416 }
11417 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011418 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011419#endif
11420
Daniel Veillard42595322004-11-08 10:52:06 +000011421 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011422}
11423
11424
11425static int
11426test_xmlNanoFTPGetSocket(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011427 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011428
Daniel Veillard27f20102004-11-05 11:50:11 +000011429#ifdef LIBXML_FTP_ENABLED
11430 int mem_base;
11431 int ret_val;
11432 void * ctx; /* an FTP context */
11433 int n_ctx;
11434 const char * filename; /* the file to retrieve (or NULL if path is in context). */
11435 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011436
Daniel Veillard27f20102004-11-05 11:50:11 +000011437 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11438 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
11439 mem_base = xmlMemBlocks();
11440 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11441 filename = gen_filepath(n_filename, 1);
11442
11443 ret_val = xmlNanoFTPGetSocket(ctx, filename);
11444 desret_int(ret_val);
11445 call_tests++;
11446 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11447 des_filepath(n_filename, filename, 1);
11448 xmlResetLastError();
11449 if (mem_base != xmlMemBlocks()) {
11450 printf("Leak of %d blocks found in xmlNanoFTPGetSocket",
11451 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011452 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011453 printf(" %d", n_ctx);
11454 printf(" %d", n_filename);
11455 printf("\n");
11456 }
11457 }
11458 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011459 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011460#endif
11461
Daniel Veillard42595322004-11-08 10:52:06 +000011462 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011463}
11464
11465
11466static int
11467test_xmlNanoFTPInit(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011468 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011469
11470#ifdef LIBXML_FTP_ENABLED
11471 int mem_base;
11472
11473 mem_base = xmlMemBlocks();
11474
11475 xmlNanoFTPInit();
11476 call_tests++;
11477 xmlResetLastError();
11478 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000011479 printf("Leak of %d blocks found in xmlNanoFTPInit",
Daniel Veillardd93f6252004-11-02 15:53:51 +000011480 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011481 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000011482 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000011483 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011484 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +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_xmlNanoFTPList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011493 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011494
11495
11496 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000011497 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011498}
11499
11500
11501static int
11502test_xmlNanoFTPNewCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011503 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011504
11505
11506 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000011507 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011508}
11509
11510
11511static int
11512test_xmlNanoFTPOpen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011513 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011514
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011515#ifdef LIBXML_FTP_ENABLED
11516 int mem_base;
11517 void * ret_val;
11518 const char * URL; /* the URL to the resource */
11519 int n_URL;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011520
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011521 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
11522 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011523 URL = gen_filepath(n_URL, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011524
11525 ret_val = xmlNanoFTPOpen(URL);
11526 desret_void_ptr(ret_val);
11527 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011528 des_filepath(n_URL, URL, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011529 xmlResetLastError();
11530 if (mem_base != xmlMemBlocks()) {
11531 printf("Leak of %d blocks found in xmlNanoFTPOpen",
11532 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011533 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011534 printf(" %d", n_URL);
11535 printf("\n");
11536 }
11537 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011538 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011539#endif
11540
Daniel Veillard42595322004-11-08 10:52:06 +000011541 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011542}
11543
11544
11545static int
11546test_xmlNanoFTPProxy(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011547 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011548
11549#ifdef LIBXML_FTP_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000011550 char * host; /* the proxy host name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000011551 int n_host;
11552 int port; /* the proxy port */
11553 int n_port;
Daniel Veillardce682bc2004-11-05 17:22:25 +000011554 char * user; /* the proxy user name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000011555 int n_user;
Daniel Veillardce682bc2004-11-05 17:22:25 +000011556 char * passwd; /* the proxy password */
Daniel Veillardd93f6252004-11-02 15:53:51 +000011557 int n_passwd;
11558 int type; /* the type of proxy 1 for using SITE, 2 for USER a@b */
11559 int n_type;
11560
11561 for (n_host = 0;n_host < gen_nb_const_char_ptr;n_host++) {
11562 for (n_port = 0;n_port < gen_nb_int;n_port++) {
11563 for (n_user = 0;n_user < gen_nb_const_char_ptr;n_user++) {
11564 for (n_passwd = 0;n_passwd < gen_nb_const_char_ptr;n_passwd++) {
11565 for (n_type = 0;n_type < gen_nb_int;n_type++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +000011566 host = gen_const_char_ptr(n_host, 0);
11567 port = gen_int(n_port, 1);
11568 user = gen_const_char_ptr(n_user, 2);
11569 passwd = gen_const_char_ptr(n_passwd, 3);
11570 type = gen_int(n_type, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011571
William M. Brackf13f77f2004-11-12 16:03:48 +000011572 xmlNanoFTPProxy((const char *)host, port, (const char *)user, (const char *)passwd, type);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011573 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000011574 des_const_char_ptr(n_host, (const char *)host, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000011575 des_int(n_port, port, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000011576 des_const_char_ptr(n_user, (const char *)user, 2);
11577 des_const_char_ptr(n_passwd, (const char *)passwd, 3);
Daniel Veillard3d97e662004-11-04 10:49:00 +000011578 des_int(n_type, type, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011579 xmlResetLastError();
11580 }
11581 }
11582 }
11583 }
11584 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011585 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011586#endif
11587
Daniel Veillard42595322004-11-08 10:52:06 +000011588 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011589}
11590
11591
11592static int
11593test_xmlNanoFTPQuit(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011594 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011595
Daniel Veillard27f20102004-11-05 11:50:11 +000011596#ifdef LIBXML_FTP_ENABLED
11597 int mem_base;
11598 int ret_val;
11599 void * ctx; /* an FTP context */
11600 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011601
Daniel Veillard27f20102004-11-05 11:50:11 +000011602 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11603 mem_base = xmlMemBlocks();
11604 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11605
11606 ret_val = xmlNanoFTPQuit(ctx);
11607 desret_int(ret_val);
11608 call_tests++;
11609 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11610 xmlResetLastError();
11611 if (mem_base != xmlMemBlocks()) {
11612 printf("Leak of %d blocks found in xmlNanoFTPQuit",
11613 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011614 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011615 printf(" %d", n_ctx);
11616 printf("\n");
11617 }
11618 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011619 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011620#endif
11621
Daniel Veillard42595322004-11-08 10:52:06 +000011622 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011623}
11624
11625
11626static int
11627test_xmlNanoFTPRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011628 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011629
Daniel Veillard27f20102004-11-05 11:50:11 +000011630#ifdef LIBXML_FTP_ENABLED
11631 int mem_base;
11632 int ret_val;
11633 void * ctx; /* the FTP context */
11634 int n_ctx;
11635 void * dest; /* a buffer */
11636 int n_dest;
11637 int len; /* the buffer length */
11638 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011639
Daniel Veillard27f20102004-11-05 11:50:11 +000011640 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11641 for (n_dest = 0;n_dest < gen_nb_void_ptr;n_dest++) {
11642 for (n_len = 0;n_len < gen_nb_int;n_len++) {
11643 mem_base = xmlMemBlocks();
11644 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11645 dest = gen_void_ptr(n_dest, 1);
11646 len = gen_int(n_len, 2);
11647
11648 ret_val = xmlNanoFTPRead(ctx, dest, len);
11649 desret_int(ret_val);
11650 call_tests++;
11651 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11652 des_void_ptr(n_dest, dest, 1);
11653 des_int(n_len, len, 2);
11654 xmlResetLastError();
11655 if (mem_base != xmlMemBlocks()) {
11656 printf("Leak of %d blocks found in xmlNanoFTPRead",
11657 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011658 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011659 printf(" %d", n_ctx);
11660 printf(" %d", n_dest);
11661 printf(" %d", n_len);
11662 printf("\n");
11663 }
11664 }
11665 }
11666 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011667 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011668#endif
11669
Daniel Veillard42595322004-11-08 10:52:06 +000011670 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011671}
11672
11673
11674static int
11675test_xmlNanoFTPScanProxy(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011676 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011677
11678#ifdef LIBXML_FTP_ENABLED
11679 const char * URL; /* The proxy URL used to initialize the proxy context */
11680 int n_URL;
11681
11682 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +000011683 URL = gen_filepath(n_URL, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011684
11685 xmlNanoFTPScanProxy(URL);
11686 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011687 des_filepath(n_URL, URL, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011688 xmlResetLastError();
11689 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011690 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011691#endif
11692
Daniel Veillard42595322004-11-08 10:52:06 +000011693 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011694}
11695
11696
11697static int
11698test_xmlNanoFTPUpdateURL(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011699 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011700
Daniel Veillard27f20102004-11-05 11:50:11 +000011701#ifdef LIBXML_FTP_ENABLED
11702 int mem_base;
11703 int ret_val;
11704 void * ctx; /* an FTP context */
11705 int n_ctx;
11706 const char * URL; /* The URL used to update the context */
11707 int n_URL;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011708
Daniel Veillard27f20102004-11-05 11:50:11 +000011709 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11710 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
11711 mem_base = xmlMemBlocks();
11712 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11713 URL = gen_filepath(n_URL, 1);
11714
11715 ret_val = xmlNanoFTPUpdateURL(ctx, URL);
11716 desret_int(ret_val);
11717 call_tests++;
11718 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11719 des_filepath(n_URL, URL, 1);
11720 xmlResetLastError();
11721 if (mem_base != xmlMemBlocks()) {
11722 printf("Leak of %d blocks found in xmlNanoFTPUpdateURL",
11723 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011724 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011725 printf(" %d", n_ctx);
11726 printf(" %d", n_URL);
11727 printf("\n");
11728 }
11729 }
11730 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011731 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011732#endif
11733
Daniel Veillard42595322004-11-08 10:52:06 +000011734 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011735}
11736
11737static int
11738test_nanoftp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011739 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011740
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011741 if (quiet == 0) printf("Testing nanoftp : 15 of 22 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000011742 test_ret += test_xmlNanoFTPCheckResponse();
11743 test_ret += test_xmlNanoFTPCleanup();
11744 test_ret += test_xmlNanoFTPCloseConnection();
11745 test_ret += test_xmlNanoFTPCwd();
11746 test_ret += test_xmlNanoFTPDele();
11747 test_ret += test_xmlNanoFTPGet();
11748 test_ret += test_xmlNanoFTPGetConnection();
11749 test_ret += test_xmlNanoFTPGetResponse();
11750 test_ret += test_xmlNanoFTPGetSocket();
11751 test_ret += test_xmlNanoFTPInit();
11752 test_ret += test_xmlNanoFTPList();
11753 test_ret += test_xmlNanoFTPNewCtxt();
11754 test_ret += test_xmlNanoFTPOpen();
11755 test_ret += test_xmlNanoFTPProxy();
11756 test_ret += test_xmlNanoFTPQuit();
11757 test_ret += test_xmlNanoFTPRead();
11758 test_ret += test_xmlNanoFTPScanProxy();
11759 test_ret += test_xmlNanoFTPUpdateURL();
Daniel Veillardd93f6252004-11-02 15:53:51 +000011760
Daniel Veillard42595322004-11-08 10:52:06 +000011761 if (test_ret != 0)
11762 printf("Module nanoftp: %d errors\n", test_ret);
11763 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011764}
11765
11766static int
11767test_xmlNanoHTTPAuthHeader(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011768 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011769
Daniel Veillard27f20102004-11-05 11:50:11 +000011770#ifdef LIBXML_HTTP_ENABLED
11771 int mem_base;
11772 const char * ret_val;
11773 void * ctx; /* the HTTP context */
11774 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011775
Daniel Veillard27f20102004-11-05 11:50:11 +000011776 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
11777 mem_base = xmlMemBlocks();
11778 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
11779
11780 ret_val = xmlNanoHTTPAuthHeader(ctx);
11781 desret_const_char_ptr(ret_val);
11782 call_tests++;
11783 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
11784 xmlResetLastError();
11785 if (mem_base != xmlMemBlocks()) {
11786 printf("Leak of %d blocks found in xmlNanoHTTPAuthHeader",
11787 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011788 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011789 printf(" %d", n_ctx);
11790 printf("\n");
11791 }
11792 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011793 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011794#endif
11795
Daniel Veillard42595322004-11-08 10:52:06 +000011796 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011797}
11798
11799
11800static int
11801test_xmlNanoHTTPCleanup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011802 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011803
11804#ifdef LIBXML_HTTP_ENABLED
11805 int mem_base;
11806
11807 mem_base = xmlMemBlocks();
11808
11809 xmlNanoHTTPCleanup();
11810 call_tests++;
11811 xmlResetLastError();
11812 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000011813 printf("Leak of %d blocks found in xmlNanoHTTPCleanup",
Daniel Veillardd93f6252004-11-02 15:53:51 +000011814 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011815 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000011816 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000011817 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011818 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +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_xmlNanoHTTPClose(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011827 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011828
Daniel Veillard27f20102004-11-05 11:50:11 +000011829#ifdef LIBXML_HTTP_ENABLED
11830 int mem_base;
11831 void * ctx; /* the HTTP context */
11832 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011833
Daniel Veillard27f20102004-11-05 11:50:11 +000011834 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
11835 mem_base = xmlMemBlocks();
11836 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
11837
11838 xmlNanoHTTPClose(ctx);
11839 call_tests++;
11840 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
11841 xmlResetLastError();
11842 if (mem_base != xmlMemBlocks()) {
11843 printf("Leak of %d blocks found in xmlNanoHTTPClose",
11844 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011845 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011846 printf(" %d", n_ctx);
11847 printf("\n");
11848 }
11849 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011850 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011851#endif
11852
Daniel Veillard42595322004-11-08 10:52:06 +000011853 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011854}
11855
11856
11857static int
11858test_xmlNanoHTTPContentLength(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011859 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011860
Daniel Veillard27f20102004-11-05 11:50:11 +000011861#ifdef LIBXML_HTTP_ENABLED
11862 int mem_base;
11863 int ret_val;
11864 void * ctx; /* the HTTP context */
11865 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011866
Daniel Veillard27f20102004-11-05 11:50:11 +000011867 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
11868 mem_base = xmlMemBlocks();
11869 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
11870
11871 ret_val = xmlNanoHTTPContentLength(ctx);
11872 desret_int(ret_val);
11873 call_tests++;
11874 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
11875 xmlResetLastError();
11876 if (mem_base != xmlMemBlocks()) {
11877 printf("Leak of %d blocks found in xmlNanoHTTPContentLength",
11878 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011879 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011880 printf(" %d", n_ctx);
11881 printf("\n");
11882 }
11883 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011884 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011885#endif
11886
Daniel Veillard42595322004-11-08 10:52:06 +000011887 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011888}
11889
11890
11891static int
11892test_xmlNanoHTTPEncoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011893 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011894
Daniel Veillard27f20102004-11-05 11:50:11 +000011895#ifdef LIBXML_HTTP_ENABLED
11896 int mem_base;
11897 const char * ret_val;
11898 void * ctx; /* the HTTP context */
11899 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011900
Daniel Veillard27f20102004-11-05 11:50:11 +000011901 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
11902 mem_base = xmlMemBlocks();
11903 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
11904
11905 ret_val = xmlNanoHTTPEncoding(ctx);
11906 desret_const_char_ptr(ret_val);
11907 call_tests++;
11908 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
11909 xmlResetLastError();
11910 if (mem_base != xmlMemBlocks()) {
11911 printf("Leak of %d blocks found in xmlNanoHTTPEncoding",
11912 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011913 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011914 printf(" %d", n_ctx);
11915 printf("\n");
11916 }
11917 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011918 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011919#endif
11920
Daniel Veillard42595322004-11-08 10:52:06 +000011921 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011922}
11923
11924
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000011925#define gen_nb_char_ptr_ptr 1
11926static char ** gen_char_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
11927 return(NULL);
11928}
11929static void des_char_ptr_ptr(int no ATTRIBUTE_UNUSED, char ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
11930}
11931
Daniel Veillardd93f6252004-11-02 15:53:51 +000011932static int
11933test_xmlNanoHTTPFetch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011934 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011935
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000011936#ifdef LIBXML_HTTP_ENABLED
11937 int mem_base;
11938 int ret_val;
11939 const char * URL; /* The URL to load */
11940 int n_URL;
11941 const char * filename; /* the filename where the content should be saved */
11942 int n_filename;
11943 char ** contentType; /* if available the Content-Type information will be returned at that location */
11944 int n_contentType;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011945
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000011946 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
11947 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
11948 for (n_contentType = 0;n_contentType < gen_nb_char_ptr_ptr;n_contentType++) {
11949 mem_base = xmlMemBlocks();
11950 URL = gen_filepath(n_URL, 0);
11951 filename = gen_filepath(n_filename, 1);
11952 contentType = gen_char_ptr_ptr(n_contentType, 2);
11953
11954 ret_val = xmlNanoHTTPFetch(URL, filename, contentType);
11955 desret_int(ret_val);
11956 call_tests++;
11957 des_filepath(n_URL, URL, 0);
11958 des_filepath(n_filename, filename, 1);
11959 des_char_ptr_ptr(n_contentType, contentType, 2);
11960 xmlResetLastError();
11961 if (mem_base != xmlMemBlocks()) {
11962 printf("Leak of %d blocks found in xmlNanoHTTPFetch",
11963 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011964 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000011965 printf(" %d", n_URL);
11966 printf(" %d", n_filename);
11967 printf(" %d", n_contentType);
11968 printf("\n");
11969 }
11970 }
11971 }
11972 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011973 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000011974#endif
11975
Daniel Veillard42595322004-11-08 10:52:06 +000011976 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011977}
11978
11979
11980static int
11981test_xmlNanoHTTPInit(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011982 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011983
11984#ifdef LIBXML_HTTP_ENABLED
11985 int mem_base;
11986
11987 mem_base = xmlMemBlocks();
11988
11989 xmlNanoHTTPInit();
11990 call_tests++;
11991 xmlResetLastError();
11992 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000011993 printf("Leak of %d blocks found in xmlNanoHTTPInit",
Daniel Veillardd93f6252004-11-02 15:53:51 +000011994 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011995 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000011996 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000011997 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011998 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +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_xmlNanoHTTPMethod(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012007 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012008
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012009#ifdef LIBXML_HTTP_ENABLED
12010 int mem_base;
12011 void * ret_val;
12012 const char * URL; /* The URL to load */
12013 int n_URL;
12014 char * method; /* the HTTP method to use */
12015 int n_method;
12016 char * input; /* the input string if any */
12017 int n_input;
12018 char ** contentType; /* the Content-Type information IN and OUT */
12019 int n_contentType;
12020 char * headers; /* the extra headers */
12021 int n_headers;
12022 int ilen; /* input length */
12023 int n_ilen;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012024
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012025 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
12026 for (n_method = 0;n_method < gen_nb_const_char_ptr;n_method++) {
12027 for (n_input = 0;n_input < gen_nb_const_char_ptr;n_input++) {
12028 for (n_contentType = 0;n_contentType < gen_nb_char_ptr_ptr;n_contentType++) {
12029 for (n_headers = 0;n_headers < gen_nb_const_char_ptr;n_headers++) {
12030 for (n_ilen = 0;n_ilen < gen_nb_int;n_ilen++) {
12031 mem_base = xmlMemBlocks();
12032 URL = gen_filepath(n_URL, 0);
12033 method = gen_const_char_ptr(n_method, 1);
12034 input = gen_const_char_ptr(n_input, 2);
12035 contentType = gen_char_ptr_ptr(n_contentType, 3);
12036 headers = gen_const_char_ptr(n_headers, 4);
12037 ilen = gen_int(n_ilen, 5);
12038
William M. Brackf13f77f2004-11-12 16:03:48 +000012039 ret_val = xmlNanoHTTPMethod(URL, (const char *)method, (const char *)input, contentType, (const char *)headers, ilen);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012040 desret_void_ptr(ret_val);
12041 call_tests++;
12042 des_filepath(n_URL, URL, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000012043 des_const_char_ptr(n_method, (const char *)method, 1);
12044 des_const_char_ptr(n_input, (const char *)input, 2);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012045 des_char_ptr_ptr(n_contentType, contentType, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +000012046 des_const_char_ptr(n_headers, (const char *)headers, 4);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012047 des_int(n_ilen, ilen, 5);
12048 xmlResetLastError();
12049 if (mem_base != xmlMemBlocks()) {
12050 printf("Leak of %d blocks found in xmlNanoHTTPMethod",
12051 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012052 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012053 printf(" %d", n_URL);
12054 printf(" %d", n_method);
12055 printf(" %d", n_input);
12056 printf(" %d", n_contentType);
12057 printf(" %d", n_headers);
12058 printf(" %d", n_ilen);
12059 printf("\n");
12060 }
12061 }
12062 }
12063 }
12064 }
12065 }
12066 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012067 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012068#endif
12069
Daniel Veillard42595322004-11-08 10:52:06 +000012070 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012071}
12072
12073
12074static int
12075test_xmlNanoHTTPMethodRedir(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012076 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012077
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012078#ifdef LIBXML_HTTP_ENABLED
12079 int mem_base;
12080 void * ret_val;
12081 const char * URL; /* The URL to load */
12082 int n_URL;
12083 char * method; /* the HTTP method to use */
12084 int n_method;
12085 char * input; /* the input string if any */
12086 int n_input;
12087 char ** contentType; /* the Content-Type information IN and OUT */
12088 int n_contentType;
12089 char ** redir; /* the redirected URL OUT */
12090 int n_redir;
12091 char * headers; /* the extra headers */
12092 int n_headers;
12093 int ilen; /* input length */
12094 int n_ilen;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012095
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012096 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
12097 for (n_method = 0;n_method < gen_nb_const_char_ptr;n_method++) {
12098 for (n_input = 0;n_input < gen_nb_const_char_ptr;n_input++) {
12099 for (n_contentType = 0;n_contentType < gen_nb_char_ptr_ptr;n_contentType++) {
12100 for (n_redir = 0;n_redir < gen_nb_char_ptr_ptr;n_redir++) {
12101 for (n_headers = 0;n_headers < gen_nb_const_char_ptr;n_headers++) {
12102 for (n_ilen = 0;n_ilen < gen_nb_int;n_ilen++) {
12103 mem_base = xmlMemBlocks();
12104 URL = gen_filepath(n_URL, 0);
12105 method = gen_const_char_ptr(n_method, 1);
12106 input = gen_const_char_ptr(n_input, 2);
12107 contentType = gen_char_ptr_ptr(n_contentType, 3);
12108 redir = gen_char_ptr_ptr(n_redir, 4);
12109 headers = gen_const_char_ptr(n_headers, 5);
12110 ilen = gen_int(n_ilen, 6);
12111
William M. Brackf13f77f2004-11-12 16:03:48 +000012112 ret_val = xmlNanoHTTPMethodRedir(URL, (const char *)method, (const char *)input, contentType, redir, (const char *)headers, ilen);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012113 desret_void_ptr(ret_val);
12114 call_tests++;
12115 des_filepath(n_URL, URL, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000012116 des_const_char_ptr(n_method, (const char *)method, 1);
12117 des_const_char_ptr(n_input, (const char *)input, 2);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012118 des_char_ptr_ptr(n_contentType, contentType, 3);
12119 des_char_ptr_ptr(n_redir, redir, 4);
William M. Brackf13f77f2004-11-12 16:03:48 +000012120 des_const_char_ptr(n_headers, (const char *)headers, 5);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012121 des_int(n_ilen, ilen, 6);
12122 xmlResetLastError();
12123 if (mem_base != xmlMemBlocks()) {
12124 printf("Leak of %d blocks found in xmlNanoHTTPMethodRedir",
12125 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012126 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012127 printf(" %d", n_URL);
12128 printf(" %d", n_method);
12129 printf(" %d", n_input);
12130 printf(" %d", n_contentType);
12131 printf(" %d", n_redir);
12132 printf(" %d", n_headers);
12133 printf(" %d", n_ilen);
12134 printf("\n");
12135 }
12136 }
12137 }
12138 }
12139 }
12140 }
12141 }
12142 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012143 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012144#endif
12145
Daniel Veillard42595322004-11-08 10:52:06 +000012146 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012147}
12148
12149
12150static int
12151test_xmlNanoHTTPMimeType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012152 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012153
Daniel Veillard27f20102004-11-05 11:50:11 +000012154#ifdef LIBXML_HTTP_ENABLED
12155 int mem_base;
12156 const char * ret_val;
12157 void * ctx; /* the HTTP context */
12158 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012159
Daniel Veillard27f20102004-11-05 11:50:11 +000012160 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
12161 mem_base = xmlMemBlocks();
12162 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
12163
12164 ret_val = xmlNanoHTTPMimeType(ctx);
12165 desret_const_char_ptr(ret_val);
12166 call_tests++;
12167 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
12168 xmlResetLastError();
12169 if (mem_base != xmlMemBlocks()) {
12170 printf("Leak of %d blocks found in xmlNanoHTTPMimeType",
12171 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012172 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012173 printf(" %d", n_ctx);
12174 printf("\n");
12175 }
12176 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012177 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012178#endif
12179
Daniel Veillard42595322004-11-08 10:52:06 +000012180 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012181}
12182
12183
12184static int
12185test_xmlNanoHTTPOpen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012186 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012187
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012188#ifdef LIBXML_HTTP_ENABLED
12189 int mem_base;
12190 void * ret_val;
12191 const char * URL; /* The URL to load */
12192 int n_URL;
12193 char ** contentType; /* if available the Content-Type information will be returned at that location */
12194 int n_contentType;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012195
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012196 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
12197 for (n_contentType = 0;n_contentType < gen_nb_char_ptr_ptr;n_contentType++) {
12198 mem_base = xmlMemBlocks();
12199 URL = gen_filepath(n_URL, 0);
12200 contentType = gen_char_ptr_ptr(n_contentType, 1);
12201
12202 ret_val = xmlNanoHTTPOpen(URL, contentType);
12203 desret_void_ptr(ret_val);
12204 call_tests++;
12205 des_filepath(n_URL, URL, 0);
12206 des_char_ptr_ptr(n_contentType, contentType, 1);
12207 xmlResetLastError();
12208 if (mem_base != xmlMemBlocks()) {
12209 printf("Leak of %d blocks found in xmlNanoHTTPOpen",
12210 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012211 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012212 printf(" %d", n_URL);
12213 printf(" %d", n_contentType);
12214 printf("\n");
12215 }
12216 }
12217 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012218 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012219#endif
12220
Daniel Veillard42595322004-11-08 10:52:06 +000012221 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012222}
12223
12224
12225static int
12226test_xmlNanoHTTPOpenRedir(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012227 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012228
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012229#ifdef LIBXML_HTTP_ENABLED
12230 int mem_base;
12231 void * ret_val;
12232 const char * URL; /* The URL to load */
12233 int n_URL;
12234 char ** contentType; /* if available the Content-Type information will be returned at that location */
12235 int n_contentType;
12236 char ** redir; /* if available the redirected URL will be returned */
12237 int n_redir;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012238
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012239 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
12240 for (n_contentType = 0;n_contentType < gen_nb_char_ptr_ptr;n_contentType++) {
12241 for (n_redir = 0;n_redir < gen_nb_char_ptr_ptr;n_redir++) {
12242 mem_base = xmlMemBlocks();
12243 URL = gen_filepath(n_URL, 0);
12244 contentType = gen_char_ptr_ptr(n_contentType, 1);
12245 redir = gen_char_ptr_ptr(n_redir, 2);
12246
12247 ret_val = xmlNanoHTTPOpenRedir(URL, contentType, redir);
12248 desret_void_ptr(ret_val);
12249 call_tests++;
12250 des_filepath(n_URL, URL, 0);
12251 des_char_ptr_ptr(n_contentType, contentType, 1);
12252 des_char_ptr_ptr(n_redir, redir, 2);
12253 xmlResetLastError();
12254 if (mem_base != xmlMemBlocks()) {
12255 printf("Leak of %d blocks found in xmlNanoHTTPOpenRedir",
12256 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012257 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012258 printf(" %d", n_URL);
12259 printf(" %d", n_contentType);
12260 printf(" %d", n_redir);
12261 printf("\n");
12262 }
12263 }
12264 }
12265 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012266 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012267#endif
12268
Daniel Veillard42595322004-11-08 10:52:06 +000012269 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012270}
12271
12272
12273static int
12274test_xmlNanoHTTPRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012275 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012276
Daniel Veillard27f20102004-11-05 11:50:11 +000012277#ifdef LIBXML_HTTP_ENABLED
12278 int mem_base;
12279 int ret_val;
12280 void * ctx; /* the HTTP context */
12281 int n_ctx;
12282 void * dest; /* a buffer */
12283 int n_dest;
12284 int len; /* the buffer length */
12285 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012286
Daniel Veillard27f20102004-11-05 11:50:11 +000012287 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
12288 for (n_dest = 0;n_dest < gen_nb_void_ptr;n_dest++) {
12289 for (n_len = 0;n_len < gen_nb_int;n_len++) {
12290 mem_base = xmlMemBlocks();
12291 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
12292 dest = gen_void_ptr(n_dest, 1);
12293 len = gen_int(n_len, 2);
12294
12295 ret_val = xmlNanoHTTPRead(ctx, dest, len);
12296 desret_int(ret_val);
12297 call_tests++;
12298 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
12299 des_void_ptr(n_dest, dest, 1);
12300 des_int(n_len, len, 2);
12301 xmlResetLastError();
12302 if (mem_base != xmlMemBlocks()) {
12303 printf("Leak of %d blocks found in xmlNanoHTTPRead",
12304 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012305 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012306 printf(" %d", n_ctx);
12307 printf(" %d", n_dest);
12308 printf(" %d", n_len);
12309 printf("\n");
12310 }
12311 }
12312 }
12313 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012314 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012315#endif
12316
Daniel Veillard42595322004-11-08 10:52:06 +000012317 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012318}
12319
12320
12321static int
12322test_xmlNanoHTTPRedir(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012323 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012324
12325
12326 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000012327 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012328}
12329
12330
12331static int
12332test_xmlNanoHTTPReturnCode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012333 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012334
Daniel Veillard27f20102004-11-05 11:50:11 +000012335#ifdef LIBXML_HTTP_ENABLED
12336 int mem_base;
12337 int ret_val;
12338 void * ctx; /* the HTTP context */
12339 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012340
Daniel Veillard27f20102004-11-05 11:50:11 +000012341 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
12342 mem_base = xmlMemBlocks();
12343 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
12344
12345 ret_val = xmlNanoHTTPReturnCode(ctx);
12346 desret_int(ret_val);
12347 call_tests++;
12348 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
12349 xmlResetLastError();
12350 if (mem_base != xmlMemBlocks()) {
12351 printf("Leak of %d blocks found in xmlNanoHTTPReturnCode",
12352 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012353 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012354 printf(" %d", n_ctx);
12355 printf("\n");
12356 }
12357 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012358 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012359#endif
12360
Daniel Veillard42595322004-11-08 10:52:06 +000012361 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012362}
12363
12364
12365static int
12366test_xmlNanoHTTPSave(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012367 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012368
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012369#ifdef LIBXML_HTTP_ENABLED
12370#ifdef LIBXML_OUTPUT_ENABLED
12371 int mem_base;
12372 int ret_val;
12373 void * ctxt; /* the HTTP context */
12374 int n_ctxt;
12375 const char * filename; /* the filename where the content should be saved */
12376 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012377
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012378 for (n_ctxt = 0;n_ctxt < gen_nb_void_ptr;n_ctxt++) {
12379 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
12380 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012381 ctxt = gen_void_ptr(n_ctxt, 0);
12382 filename = gen_fileoutput(n_filename, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012383
12384 ret_val = xmlNanoHTTPSave(ctxt, filename);
12385 desret_int(ret_val);
12386 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012387 des_void_ptr(n_ctxt, ctxt, 0);
12388 des_fileoutput(n_filename, filename, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012389 xmlResetLastError();
12390 if (mem_base != xmlMemBlocks()) {
12391 printf("Leak of %d blocks found in xmlNanoHTTPSave",
12392 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012393 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012394 printf(" %d", n_ctxt);
12395 printf(" %d", n_filename);
12396 printf("\n");
12397 }
12398 }
12399 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012400 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012401#endif
12402#endif
12403
Daniel Veillard42595322004-11-08 10:52:06 +000012404 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012405}
12406
12407
12408static int
12409test_xmlNanoHTTPScanProxy(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012410 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012411
12412#ifdef LIBXML_HTTP_ENABLED
12413 const char * URL; /* The proxy URL used to initialize the proxy context */
12414 int n_URL;
12415
12416 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +000012417 URL = gen_filepath(n_URL, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012418
12419 xmlNanoHTTPScanProxy(URL);
12420 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012421 des_filepath(n_URL, URL, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012422 xmlResetLastError();
12423 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012424 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012425#endif
12426
Daniel Veillard42595322004-11-08 10:52:06 +000012427 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012428}
12429
12430static int
12431test_nanohttp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012432 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012433
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012434 if (quiet == 0) printf("Testing nanohttp : 16 of 17 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000012435 test_ret += test_xmlNanoHTTPAuthHeader();
12436 test_ret += test_xmlNanoHTTPCleanup();
12437 test_ret += test_xmlNanoHTTPClose();
12438 test_ret += test_xmlNanoHTTPContentLength();
12439 test_ret += test_xmlNanoHTTPEncoding();
12440 test_ret += test_xmlNanoHTTPFetch();
12441 test_ret += test_xmlNanoHTTPInit();
12442 test_ret += test_xmlNanoHTTPMethod();
12443 test_ret += test_xmlNanoHTTPMethodRedir();
12444 test_ret += test_xmlNanoHTTPMimeType();
12445 test_ret += test_xmlNanoHTTPOpen();
12446 test_ret += test_xmlNanoHTTPOpenRedir();
12447 test_ret += test_xmlNanoHTTPRead();
12448 test_ret += test_xmlNanoHTTPRedir();
12449 test_ret += test_xmlNanoHTTPReturnCode();
12450 test_ret += test_xmlNanoHTTPSave();
12451 test_ret += test_xmlNanoHTTPScanProxy();
Daniel Veillardd93f6252004-11-02 15:53:51 +000012452
Daniel Veillard42595322004-11-08 10:52:06 +000012453 if (test_ret != 0)
12454 printf("Module nanohttp: %d errors\n", test_ret);
12455 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012456}
12457
12458static int
12459test_xmlByteConsumed(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012460 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012461
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000012462 int mem_base;
12463 long ret_val;
12464 xmlParserCtxtPtr ctxt; /* an XML parser context */
12465 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012466
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000012467 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12468 mem_base = xmlMemBlocks();
12469 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
12470
12471 ret_val = xmlByteConsumed(ctxt);
12472 desret_long(ret_val);
12473 call_tests++;
12474 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
12475 xmlResetLastError();
12476 if (mem_base != xmlMemBlocks()) {
12477 printf("Leak of %d blocks found in xmlByteConsumed",
12478 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012479 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000012480 printf(" %d", n_ctxt);
12481 printf("\n");
12482 }
12483 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000012484 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012485
Daniel Veillard42595322004-11-08 10:52:06 +000012486 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012487}
12488
12489
12490static int
12491test_xmlClearNodeInfoSeq(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012492 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012493
Daniel Veillardce682bc2004-11-05 17:22:25 +000012494 int mem_base;
12495 xmlParserNodeInfoSeqPtr seq; /* a node info sequence pointer */
12496 int n_seq;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012497
Daniel Veillardce682bc2004-11-05 17:22:25 +000012498 for (n_seq = 0;n_seq < gen_nb_xmlParserNodeInfoSeqPtr;n_seq++) {
12499 mem_base = xmlMemBlocks();
12500 seq = gen_xmlParserNodeInfoSeqPtr(n_seq, 0);
12501
12502 xmlClearNodeInfoSeq(seq);
12503 call_tests++;
12504 des_xmlParserNodeInfoSeqPtr(n_seq, seq, 0);
12505 xmlResetLastError();
12506 if (mem_base != xmlMemBlocks()) {
12507 printf("Leak of %d blocks found in xmlClearNodeInfoSeq",
12508 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012509 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012510 printf(" %d", n_seq);
12511 printf("\n");
12512 }
12513 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000012514 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012515
Daniel Veillard42595322004-11-08 10:52:06 +000012516 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012517}
12518
12519
12520static int
12521test_xmlClearParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012522 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012523
12524 int mem_base;
12525 xmlParserCtxtPtr ctxt; /* an XML parser context */
12526 int n_ctxt;
12527
12528 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12529 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012530 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012531
12532 xmlClearParserCtxt(ctxt);
12533 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012534 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012535 xmlResetLastError();
12536 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012537 printf("Leak of %d blocks found in xmlClearParserCtxt",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012538 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012539 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012540 printf(" %d", n_ctxt);
12541 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012542 }
12543 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000012544 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012545
Daniel Veillard42595322004-11-08 10:52:06 +000012546 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012547}
12548
12549
12550static int
12551test_xmlCreateDocParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012552 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012553
Daniel Veillard34099b42004-11-04 17:34:35 +000012554 int mem_base;
12555 xmlParserCtxtPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012556 xmlChar * cur; /* a pointer to an array of xmlChar */
Daniel Veillard34099b42004-11-04 17:34:35 +000012557 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012558
Daniel Veillard34099b42004-11-04 17:34:35 +000012559 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
12560 mem_base = xmlMemBlocks();
12561 cur = gen_const_xmlChar_ptr(n_cur, 0);
12562
William M. Brackf13f77f2004-11-12 16:03:48 +000012563 ret_val = xmlCreateDocParserCtxt((const xmlChar *)cur);
Daniel Veillard34099b42004-11-04 17:34:35 +000012564 desret_xmlParserCtxtPtr(ret_val);
12565 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000012566 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 0);
Daniel Veillard34099b42004-11-04 17:34:35 +000012567 xmlResetLastError();
12568 if (mem_base != xmlMemBlocks()) {
12569 printf("Leak of %d blocks found in xmlCreateDocParserCtxt",
12570 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012571 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000012572 printf(" %d", n_cur);
12573 printf("\n");
12574 }
12575 }
Daniel Veillard34099b42004-11-04 17:34:35 +000012576 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012577
Daniel Veillard42595322004-11-08 10:52:06 +000012578 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012579}
12580
12581
12582static int
12583test_xmlCreatePushParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012584 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012585
Daniel Veillard34099b42004-11-04 17:34:35 +000012586#ifdef LIBXML_PUSH_ENABLED
12587 int mem_base;
12588 xmlParserCtxtPtr ret_val;
12589 xmlSAXHandlerPtr sax; /* a SAX handler */
12590 int n_sax;
12591 void * user_data; /* The user data returned on SAX callbacks */
12592 int n_user_data;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012593 char * chunk; /* a pointer to an array of chars */
Daniel Veillard34099b42004-11-04 17:34:35 +000012594 int n_chunk;
12595 int size; /* number of chars in the array */
12596 int n_size;
12597 const char * filename; /* an optional file name or URI */
12598 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012599
Daniel Veillard34099b42004-11-04 17:34:35 +000012600 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
12601 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
12602 for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) {
12603 for (n_size = 0;n_size < gen_nb_int;n_size++) {
Daniel Veillard42595322004-11-08 10:52:06 +000012604 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
Daniel Veillard34099b42004-11-04 17:34:35 +000012605 mem_base = xmlMemBlocks();
12606 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
12607 user_data = gen_userdata(n_user_data, 1);
12608 chunk = gen_const_char_ptr(n_chunk, 2);
12609 size = gen_int(n_size, 3);
Daniel Veillard42595322004-11-08 10:52:06 +000012610 filename = gen_fileoutput(n_filename, 4);
Daniel Veillard34099b42004-11-04 17:34:35 +000012611
William M. Brackf13f77f2004-11-12 16:03:48 +000012612 ret_val = xmlCreatePushParserCtxt(sax, user_data, (const char *)chunk, size, filename);
Daniel Veillard34099b42004-11-04 17:34:35 +000012613 desret_xmlParserCtxtPtr(ret_val);
12614 call_tests++;
12615 des_xmlSAXHandlerPtr(n_sax, sax, 0);
12616 des_userdata(n_user_data, user_data, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000012617 des_const_char_ptr(n_chunk, (const char *)chunk, 2);
Daniel Veillard34099b42004-11-04 17:34:35 +000012618 des_int(n_size, size, 3);
Daniel Veillard42595322004-11-08 10:52:06 +000012619 des_fileoutput(n_filename, filename, 4);
Daniel Veillard34099b42004-11-04 17:34:35 +000012620 xmlResetLastError();
12621 if (mem_base != xmlMemBlocks()) {
12622 printf("Leak of %d blocks found in xmlCreatePushParserCtxt",
12623 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012624 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000012625 printf(" %d", n_sax);
12626 printf(" %d", n_user_data);
12627 printf(" %d", n_chunk);
12628 printf(" %d", n_size);
12629 printf(" %d", n_filename);
12630 printf("\n");
12631 }
12632 }
12633 }
12634 }
12635 }
12636 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012637 function_tests++;
Daniel Veillard34099b42004-11-04 17:34:35 +000012638#endif
12639
Daniel Veillard42595322004-11-08 10:52:06 +000012640 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012641}
12642
12643
12644static int
12645test_xmlCtxtReadDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012646 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012647
12648 int mem_base;
12649 xmlDocPtr ret_val;
12650 xmlParserCtxtPtr ctxt; /* an XML parser context */
12651 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012652 xmlChar * cur; /* a pointer to a zero terminated string */
Daniel Veillardd93f6252004-11-02 15:53:51 +000012653 int n_cur;
12654 const char * URL; /* the base URL to use for the document */
12655 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012656 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000012657 int n_encoding;
12658 int options; /* a combination of xmlParserOption */
12659 int n_options;
12660
12661 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12662 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
12663 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
12664 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000012665 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000012666 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012667 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
12668 cur = gen_const_xmlChar_ptr(n_cur, 1);
12669 URL = gen_filepath(n_URL, 2);
12670 encoding = gen_const_char_ptr(n_encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000012671 options = gen_parseroptions(n_options, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012672
William M. Brackf13f77f2004-11-12 16:03:48 +000012673 ret_val = xmlCtxtReadDoc(ctxt, (const xmlChar *)cur, URL, (const char *)encoding, options);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012674 desret_xmlDocPtr(ret_val);
12675 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012676 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000012677 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000012678 des_filepath(n_URL, URL, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000012679 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000012680 des_parseroptions(n_options, options, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012681 xmlResetLastError();
12682 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012683 printf("Leak of %d blocks found in xmlCtxtReadDoc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012684 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012685 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012686 printf(" %d", n_ctxt);
12687 printf(" %d", n_cur);
12688 printf(" %d", n_URL);
12689 printf(" %d", n_encoding);
12690 printf(" %d", n_options);
12691 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012692 }
12693 }
12694 }
12695 }
12696 }
12697 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000012698 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012699
Daniel Veillard42595322004-11-08 10:52:06 +000012700 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012701}
12702
12703
12704static int
12705test_xmlCtxtReadFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012706 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012707
12708 int mem_base;
12709 xmlDocPtr ret_val;
12710 xmlParserCtxtPtr ctxt; /* an XML parser context */
12711 int n_ctxt;
12712 const char * filename; /* a file or URL */
12713 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012714 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000012715 int n_encoding;
12716 int options; /* a combination of xmlParserOption */
12717 int n_options;
12718
12719 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12720 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
12721 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000012722 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000012723 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012724 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
12725 filename = gen_filepath(n_filename, 1);
12726 encoding = gen_const_char_ptr(n_encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000012727 options = gen_parseroptions(n_options, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012728
William M. Brackf13f77f2004-11-12 16:03:48 +000012729 ret_val = xmlCtxtReadFile(ctxt, filename, (const char *)encoding, options);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012730 desret_xmlDocPtr(ret_val);
12731 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012732 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
12733 des_filepath(n_filename, filename, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000012734 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000012735 des_parseroptions(n_options, options, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012736 xmlResetLastError();
12737 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012738 printf("Leak of %d blocks found in xmlCtxtReadFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012739 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012740 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012741 printf(" %d", n_ctxt);
12742 printf(" %d", n_filename);
12743 printf(" %d", n_encoding);
12744 printf(" %d", n_options);
12745 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012746 }
12747 }
12748 }
12749 }
12750 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000012751 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012752
Daniel Veillard42595322004-11-08 10:52:06 +000012753 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012754}
12755
12756
12757static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000012758test_xmlCtxtReadMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012759 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012760
12761 int mem_base;
12762 xmlDocPtr ret_val;
12763 xmlParserCtxtPtr ctxt; /* an XML parser context */
12764 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012765 char * buffer; /* a pointer to a char array */
Daniel Veillardd93f6252004-11-02 15:53:51 +000012766 int n_buffer;
12767 int size; /* the size of the array */
12768 int n_size;
12769 const char * URL; /* the base URL to use for the document */
12770 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012771 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000012772 int n_encoding;
12773 int options; /* a combination of xmlParserOption */
12774 int n_options;
12775
12776 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12777 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
12778 for (n_size = 0;n_size < gen_nb_int;n_size++) {
12779 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
12780 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000012781 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000012782 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012783 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
12784 buffer = gen_const_char_ptr(n_buffer, 1);
12785 size = gen_int(n_size, 2);
12786 URL = gen_filepath(n_URL, 3);
12787 encoding = gen_const_char_ptr(n_encoding, 4);
Daniel Veillard6128c012004-11-08 17:16:15 +000012788 options = gen_parseroptions(n_options, 5);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012789
William M. Brackf13f77f2004-11-12 16:03:48 +000012790 ret_val = xmlCtxtReadMemory(ctxt, (const char *)buffer, size, URL, (const char *)encoding, options);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012791 desret_xmlDocPtr(ret_val);
12792 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012793 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000012794 des_const_char_ptr(n_buffer, (const char *)buffer, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000012795 des_int(n_size, size, 2);
12796 des_filepath(n_URL, URL, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +000012797 des_const_char_ptr(n_encoding, (const char *)encoding, 4);
Daniel Veillard6128c012004-11-08 17:16:15 +000012798 des_parseroptions(n_options, options, 5);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012799 xmlResetLastError();
12800 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012801 printf("Leak of %d blocks found in xmlCtxtReadMemory",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012802 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012803 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012804 printf(" %d", n_ctxt);
12805 printf(" %d", n_buffer);
12806 printf(" %d", n_size);
12807 printf(" %d", n_URL);
12808 printf(" %d", n_encoding);
12809 printf(" %d", n_options);
12810 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012811 }
12812 }
12813 }
12814 }
12815 }
12816 }
12817 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000012818 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012819
Daniel Veillard42595322004-11-08 10:52:06 +000012820 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012821}
12822
12823
12824static int
12825test_xmlCtxtReset(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012826 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012827
12828 int mem_base;
12829 xmlParserCtxtPtr ctxt; /* an XML parser context */
12830 int n_ctxt;
12831
12832 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12833 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012834 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012835
12836 xmlCtxtReset(ctxt);
12837 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012838 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012839 xmlResetLastError();
12840 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012841 printf("Leak of %d blocks found in xmlCtxtReset",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012842 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012843 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012844 printf(" %d", n_ctxt);
12845 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012846 }
12847 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000012848 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012849
Daniel Veillard42595322004-11-08 10:52:06 +000012850 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012851}
12852
12853
12854static int
12855test_xmlCtxtResetPush(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012856 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012857
12858 int mem_base;
12859 int ret_val;
12860 xmlParserCtxtPtr ctxt; /* an XML parser context */
12861 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012862 char * chunk; /* a pointer to an array of chars */
Daniel Veillardd93f6252004-11-02 15:53:51 +000012863 int n_chunk;
12864 int size; /* number of chars in the array */
12865 int n_size;
12866 const char * filename; /* an optional file name or URI */
12867 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012868 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000012869 int n_encoding;
12870
12871 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12872 for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) {
12873 for (n_size = 0;n_size < gen_nb_int;n_size++) {
12874 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
12875 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
12876 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012877 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
12878 chunk = gen_const_char_ptr(n_chunk, 1);
12879 size = gen_int(n_size, 2);
12880 filename = gen_filepath(n_filename, 3);
12881 encoding = gen_const_char_ptr(n_encoding, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012882
William M. Brackf13f77f2004-11-12 16:03:48 +000012883 ret_val = xmlCtxtResetPush(ctxt, (const char *)chunk, size, filename, (const char *)encoding);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012884 desret_int(ret_val);
12885 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012886 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000012887 des_const_char_ptr(n_chunk, (const char *)chunk, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000012888 des_int(n_size, size, 2);
12889 des_filepath(n_filename, filename, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +000012890 des_const_char_ptr(n_encoding, (const char *)encoding, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012891 xmlResetLastError();
12892 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012893 printf("Leak of %d blocks found in xmlCtxtResetPush",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012894 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012895 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012896 printf(" %d", n_ctxt);
12897 printf(" %d", n_chunk);
12898 printf(" %d", n_size);
12899 printf(" %d", n_filename);
12900 printf(" %d", n_encoding);
12901 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012902 }
12903 }
12904 }
12905 }
12906 }
12907 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000012908 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012909
Daniel Veillard42595322004-11-08 10:52:06 +000012910 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012911}
12912
12913
12914static int
12915test_xmlCtxtUseOptions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012916 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012917
12918 int mem_base;
12919 int ret_val;
12920 xmlParserCtxtPtr ctxt; /* an XML parser context */
12921 int n_ctxt;
12922 int options; /* a combination of xmlParserOption */
12923 int n_options;
12924
12925 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000012926 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000012927 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012928 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillard6128c012004-11-08 17:16:15 +000012929 options = gen_parseroptions(n_options, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012930
12931 ret_val = xmlCtxtUseOptions(ctxt, options);
12932 desret_int(ret_val);
12933 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012934 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillard6128c012004-11-08 17:16:15 +000012935 des_parseroptions(n_options, options, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012936 xmlResetLastError();
12937 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012938 printf("Leak of %d blocks found in xmlCtxtUseOptions",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012939 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012940 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012941 printf(" %d", n_ctxt);
12942 printf(" %d", n_options);
12943 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012944 }
12945 }
12946 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000012947 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012948
Daniel Veillard42595322004-11-08 10:52:06 +000012949 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012950}
12951
12952
12953static int
12954test_xmlGetExternalEntityLoader(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012955 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012956
12957
12958 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000012959 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012960}
12961
12962
12963static int
12964test_xmlGetFeature(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012965 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012966
Daniel Veillarda521d282004-11-09 14:59:59 +000012967#ifdef LIBXML_LEGACY_ENABLED
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012968 int mem_base;
12969 int ret_val;
12970 xmlParserCtxtPtr ctxt; /* an XML/HTML parser context */
12971 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012972 char * name; /* the feature name */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012973 int n_name;
12974 void * result; /* location to store the result */
12975 int n_result;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012976
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012977 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12978 for (n_name = 0;n_name < gen_nb_const_char_ptr;n_name++) {
12979 for (n_result = 0;n_result < gen_nb_void_ptr;n_result++) {
12980 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012981 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
12982 name = gen_const_char_ptr(n_name, 1);
12983 result = gen_void_ptr(n_result, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012984
William M. Brackf13f77f2004-11-12 16:03:48 +000012985 ret_val = xmlGetFeature(ctxt, (const char *)name, result);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012986 desret_int(ret_val);
12987 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012988 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000012989 des_const_char_ptr(n_name, (const char *)name, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000012990 des_void_ptr(n_result, result, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012991 xmlResetLastError();
12992 if (mem_base != xmlMemBlocks()) {
12993 printf("Leak of %d blocks found in xmlGetFeature",
12994 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012995 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012996 printf(" %d", n_ctxt);
12997 printf(" %d", n_name);
12998 printf(" %d", n_result);
12999 printf("\n");
13000 }
13001 }
13002 }
13003 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013004 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013005#endif
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000013006
Daniel Veillard42595322004-11-08 10:52:06 +000013007 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013008}
13009
13010
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000013011#define gen_nb_const_char_ptr_ptr 1
13012static char ** gen_const_char_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
13013 return(NULL);
13014}
13015static void des_const_char_ptr_ptr(int no ATTRIBUTE_UNUSED, const char ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
13016}
13017
Daniel Veillardd93f6252004-11-02 15:53:51 +000013018static int
13019test_xmlGetFeaturesList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013020 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013021
Daniel Veillarda521d282004-11-09 14:59:59 +000013022#ifdef LIBXML_LEGACY_ENABLED
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000013023 int mem_base;
13024 int ret_val;
13025 int * len; /* the length of the features name array (input/output) */
13026 int n_len;
13027 char ** result; /* an array of string to be filled with the features name. */
13028 int n_result;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013029
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000013030 for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
13031 for (n_result = 0;n_result < gen_nb_const_char_ptr_ptr;n_result++) {
13032 mem_base = xmlMemBlocks();
13033 len = gen_int_ptr(n_len, 0);
13034 result = gen_const_char_ptr_ptr(n_result, 1);
13035
William M. Brackf13f77f2004-11-12 16:03:48 +000013036 ret_val = xmlGetFeaturesList(len, (const char **)result);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000013037 desret_int(ret_val);
13038 call_tests++;
13039 des_int_ptr(n_len, len, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000013040 des_const_char_ptr_ptr(n_result, (const char **)result, 1);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000013041 xmlResetLastError();
13042 if (mem_base != xmlMemBlocks()) {
13043 printf("Leak of %d blocks found in xmlGetFeaturesList",
13044 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013045 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000013046 printf(" %d", n_len);
13047 printf(" %d", n_result);
13048 printf("\n");
13049 }
13050 }
13051 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013052 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013053#endif
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000013054
Daniel Veillard42595322004-11-08 10:52:06 +000013055 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013056}
13057
13058
13059static int
13060test_xmlIOParseDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013061 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013062
Daniel Veillarda521d282004-11-09 14:59:59 +000013063#ifdef LIBXML_VALID_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000013064 int mem_base;
13065 xmlDtdPtr ret_val;
13066 xmlSAXHandlerPtr sax; /* the SAX handler block or NULL */
13067 int n_sax;
13068 xmlParserInputBufferPtr input; /* an Input Buffer */
13069 int n_input;
13070 xmlCharEncoding enc; /* the charset encoding if known */
13071 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013072
Daniel Veillard34099b42004-11-04 17:34:35 +000013073 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
13074 for (n_input = 0;n_input < gen_nb_xmlParserInputBufferPtr;n_input++) {
13075 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
13076 mem_base = xmlMemBlocks();
13077 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
13078 input = gen_xmlParserInputBufferPtr(n_input, 1);
13079 enc = gen_xmlCharEncoding(n_enc, 2);
13080
13081 ret_val = xmlIOParseDTD(sax, input, enc);
13082 input = NULL;
13083 desret_xmlDtdPtr(ret_val);
13084 call_tests++;
13085 des_xmlSAXHandlerPtr(n_sax, sax, 0);
13086 des_xmlParserInputBufferPtr(n_input, input, 1);
13087 des_xmlCharEncoding(n_enc, enc, 2);
13088 xmlResetLastError();
13089 if (mem_base != xmlMemBlocks()) {
13090 printf("Leak of %d blocks found in xmlIOParseDTD",
13091 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013092 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000013093 printf(" %d", n_sax);
13094 printf(" %d", n_input);
13095 printf(" %d", n_enc);
13096 printf("\n");
13097 }
13098 }
13099 }
13100 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013101 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013102#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000013103
Daniel Veillard42595322004-11-08 10:52:06 +000013104 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013105}
13106
13107
13108static int
13109test_xmlInitNodeInfoSeq(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013110 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013111
Daniel Veillardce682bc2004-11-05 17:22:25 +000013112 int mem_base;
13113 xmlParserNodeInfoSeqPtr seq; /* a node info sequence pointer */
13114 int n_seq;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013115
Daniel Veillardce682bc2004-11-05 17:22:25 +000013116 for (n_seq = 0;n_seq < gen_nb_xmlParserNodeInfoSeqPtr;n_seq++) {
13117 mem_base = xmlMemBlocks();
13118 seq = gen_xmlParserNodeInfoSeqPtr(n_seq, 0);
13119
13120 xmlInitNodeInfoSeq(seq);
13121 call_tests++;
13122 des_xmlParserNodeInfoSeqPtr(n_seq, seq, 0);
13123 xmlResetLastError();
13124 if (mem_base != xmlMemBlocks()) {
13125 printf("Leak of %d blocks found in xmlInitNodeInfoSeq",
13126 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013127 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013128 printf(" %d", n_seq);
13129 printf("\n");
13130 }
13131 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000013132 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013133
Daniel Veillard42595322004-11-08 10:52:06 +000013134 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013135}
13136
13137
13138static int
13139test_xmlInitParser(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013140 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013141
13142 int mem_base;
13143
13144 mem_base = xmlMemBlocks();
13145
13146 xmlInitParser();
13147 call_tests++;
13148 xmlResetLastError();
13149 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013150 printf("Leak of %d blocks found in xmlInitParser",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013151 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013152 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013153 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013154 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000013155 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013156
Daniel Veillard42595322004-11-08 10:52:06 +000013157 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013158}
13159
13160
13161static int
13162test_xmlInitParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013163 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013164
13165 int mem_base;
13166 int ret_val;
13167 xmlParserCtxtPtr ctxt; /* an XML parser context */
13168 int n_ctxt;
13169
13170 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13171 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013172 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013173
13174 ret_val = xmlInitParserCtxt(ctxt);
13175 desret_int(ret_val);
13176 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013177 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013178 xmlResetLastError();
13179 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013180 printf("Leak of %d blocks found in xmlInitParserCtxt",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013181 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013182 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013183 printf(" %d", n_ctxt);
13184 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013185 }
13186 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000013187 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013188
Daniel Veillard42595322004-11-08 10:52:06 +000013189 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013190}
13191
13192
13193static int
13194test_xmlKeepBlanksDefault(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013195 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013196
13197 int mem_base;
13198 int ret_val;
13199 int val; /* int 0 or 1 */
13200 int n_val;
13201
13202 for (n_val = 0;n_val < gen_nb_int;n_val++) {
13203 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013204 val = gen_int(n_val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013205
13206 ret_val = xmlKeepBlanksDefault(val);
13207 desret_int(ret_val);
13208 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013209 des_int(n_val, val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013210 xmlResetLastError();
13211 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013212 printf("Leak of %d blocks found in xmlKeepBlanksDefault",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013213 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013214 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013215 printf(" %d", n_val);
13216 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013217 }
13218 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000013219 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013220
Daniel Veillard42595322004-11-08 10:52:06 +000013221 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013222}
13223
13224
13225static int
13226test_xmlLineNumbersDefault(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013227 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013228
13229 int mem_base;
13230 int ret_val;
13231 int val; /* int 0 or 1 */
13232 int n_val;
13233
13234 for (n_val = 0;n_val < gen_nb_int;n_val++) {
13235 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013236 val = gen_int(n_val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013237
13238 ret_val = xmlLineNumbersDefault(val);
13239 desret_int(ret_val);
13240 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013241 des_int(n_val, val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013242 xmlResetLastError();
13243 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013244 printf("Leak of %d blocks found in xmlLineNumbersDefault",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013245 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013246 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013247 printf(" %d", n_val);
13248 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013249 }
13250 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000013251 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013252
Daniel Veillard42595322004-11-08 10:52:06 +000013253 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013254}
13255
13256
13257static int
13258test_xmlLoadExternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013259 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013260
Daniel Veillard42595322004-11-08 10:52:06 +000013261 int mem_base;
13262 xmlParserInputPtr ret_val;
13263 const char * URL; /* the URL for the entity to load */
13264 int n_URL;
13265 char * ID; /* the Public ID for the entity to load */
13266 int n_ID;
13267 xmlParserCtxtPtr ctxt; /* the context in which the entity is called or NULL */
13268 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013269
Daniel Veillard42595322004-11-08 10:52:06 +000013270 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
13271 for (n_ID = 0;n_ID < gen_nb_const_char_ptr;n_ID++) {
13272 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13273 mem_base = xmlMemBlocks();
13274 URL = gen_filepath(n_URL, 0);
13275 ID = gen_const_char_ptr(n_ID, 1);
13276 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 2);
13277
William M. Brackf13f77f2004-11-12 16:03:48 +000013278 ret_val = xmlLoadExternalEntity(URL, (const char *)ID, ctxt);
Daniel Veillard42595322004-11-08 10:52:06 +000013279 desret_xmlParserInputPtr(ret_val);
13280 call_tests++;
13281 des_filepath(n_URL, URL, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000013282 des_const_char_ptr(n_ID, (const char *)ID, 1);
Daniel Veillard42595322004-11-08 10:52:06 +000013283 des_xmlParserCtxtPtr(n_ctxt, ctxt, 2);
13284 xmlResetLastError();
13285 if (mem_base != xmlMemBlocks()) {
13286 printf("Leak of %d blocks found in xmlLoadExternalEntity",
13287 xmlMemBlocks() - mem_base);
13288 test_ret++;
13289 printf(" %d", n_URL);
13290 printf(" %d", n_ID);
13291 printf(" %d", n_ctxt);
13292 printf("\n");
13293 }
13294 }
13295 }
13296 }
Daniel Veillard42595322004-11-08 10:52:06 +000013297 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013298
Daniel Veillard42595322004-11-08 10:52:06 +000013299 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013300}
13301
13302
13303static int
13304test_xmlNewIOInputStream(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013305 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013306
Daniel Veillard42595322004-11-08 10:52:06 +000013307 int mem_base;
13308 xmlParserInputPtr ret_val;
13309 xmlParserCtxtPtr ctxt; /* an XML parser context */
13310 int n_ctxt;
13311 xmlParserInputBufferPtr input; /* an I/O Input */
13312 int n_input;
13313 xmlCharEncoding enc; /* the charset encoding if known */
13314 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013315
Daniel Veillard42595322004-11-08 10:52:06 +000013316 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13317 for (n_input = 0;n_input < gen_nb_xmlParserInputBufferPtr;n_input++) {
13318 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
13319 mem_base = xmlMemBlocks();
13320 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
13321 input = gen_xmlParserInputBufferPtr(n_input, 1);
13322 enc = gen_xmlCharEncoding(n_enc, 2);
13323
13324 ret_val = xmlNewIOInputStream(ctxt, input, enc);
13325 if (ret_val != NULL) input = NULL;
13326 desret_xmlParserInputPtr(ret_val);
13327 call_tests++;
13328 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
13329 des_xmlParserInputBufferPtr(n_input, input, 1);
13330 des_xmlCharEncoding(n_enc, enc, 2);
13331 xmlResetLastError();
13332 if (mem_base != xmlMemBlocks()) {
13333 printf("Leak of %d blocks found in xmlNewIOInputStream",
13334 xmlMemBlocks() - mem_base);
13335 test_ret++;
13336 printf(" %d", n_ctxt);
13337 printf(" %d", n_input);
13338 printf(" %d", n_enc);
13339 printf("\n");
13340 }
13341 }
13342 }
13343 }
Daniel Veillard42595322004-11-08 10:52:06 +000013344 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013345
Daniel Veillard42595322004-11-08 10:52:06 +000013346 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013347}
13348
13349
13350static int
13351test_xmlNewParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013352 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013353
Daniel Veillard34099b42004-11-04 17:34:35 +000013354 int mem_base;
13355 xmlParserCtxtPtr ret_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013356
Daniel Veillard34099b42004-11-04 17:34:35 +000013357 mem_base = xmlMemBlocks();
13358
13359 ret_val = xmlNewParserCtxt();
13360 desret_xmlParserCtxtPtr(ret_val);
13361 call_tests++;
13362 xmlResetLastError();
13363 if (mem_base != xmlMemBlocks()) {
13364 printf("Leak of %d blocks found in xmlNewParserCtxt",
13365 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013366 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000013367 printf("\n");
13368 }
Daniel Veillard34099b42004-11-04 17:34:35 +000013369 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013370
Daniel Veillard42595322004-11-08 10:52:06 +000013371 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013372}
13373
13374
Daniel Veillardce682bc2004-11-05 17:22:25 +000013375#define gen_nb_xmlNodePtr_ptr 1
13376static xmlNodePtr * gen_xmlNodePtr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
13377 return(NULL);
13378}
13379static void des_xmlNodePtr_ptr(int no ATTRIBUTE_UNUSED, xmlNodePtr * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
13380}
13381
Daniel Veillardd93f6252004-11-02 15:53:51 +000013382static int
13383test_xmlParseBalancedChunkMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013384 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013385
Daniel Veillarda521d282004-11-09 14:59:59 +000013386#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000013387 int mem_base;
13388 int ret_val;
13389 xmlDocPtr doc; /* the document the chunk pertains to */
13390 int n_doc;
13391 xmlSAXHandlerPtr sax; /* the SAX handler bloc (possibly NULL) */
13392 int n_sax;
13393 void * user_data; /* The user data returned on SAX callbacks (possibly NULL) */
13394 int n_user_data;
13395 int depth; /* Used for loop detection, use 0 */
13396 int n_depth;
13397 xmlChar * string; /* the input string in UTF8 or ISO-Latin (zero terminated) */
13398 int n_string;
13399 xmlNodePtr * lst; /* the return value for the set of parsed nodes */
13400 int n_lst;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013401
Daniel Veillardce682bc2004-11-05 17:22:25 +000013402 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
13403 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
13404 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
13405 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
13406 for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) {
13407 for (n_lst = 0;n_lst < gen_nb_xmlNodePtr_ptr;n_lst++) {
13408 mem_base = xmlMemBlocks();
13409 doc = gen_xmlDocPtr(n_doc, 0);
13410 sax = gen_xmlSAXHandlerPtr(n_sax, 1);
13411 user_data = gen_userdata(n_user_data, 2);
13412 depth = gen_int(n_depth, 3);
13413 string = gen_const_xmlChar_ptr(n_string, 4);
13414 lst = gen_xmlNodePtr_ptr(n_lst, 5);
Daniel Veillarda521d282004-11-09 14:59:59 +000013415
13416#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000013417 if (sax == (xmlSAXHandlerPtr)&xmlDefaultSAXHandler) user_data = NULL;
Daniel Veillarda521d282004-11-09 14:59:59 +000013418#endif
13419
Daniel Veillardce682bc2004-11-05 17:22:25 +000013420
William M. Brackf13f77f2004-11-12 16:03:48 +000013421 ret_val = xmlParseBalancedChunkMemory(doc, sax, user_data, depth, (const xmlChar *)string, lst);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013422 desret_int(ret_val);
13423 call_tests++;
13424 des_xmlDocPtr(n_doc, doc, 0);
13425 des_xmlSAXHandlerPtr(n_sax, sax, 1);
13426 des_userdata(n_user_data, user_data, 2);
13427 des_int(n_depth, depth, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +000013428 des_const_xmlChar_ptr(n_string, (const xmlChar *)string, 4);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013429 des_xmlNodePtr_ptr(n_lst, lst, 5);
13430 xmlResetLastError();
13431 if (mem_base != xmlMemBlocks()) {
13432 printf("Leak of %d blocks found in xmlParseBalancedChunkMemory",
13433 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013434 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013435 printf(" %d", n_doc);
13436 printf(" %d", n_sax);
13437 printf(" %d", n_user_data);
13438 printf(" %d", n_depth);
13439 printf(" %d", n_string);
13440 printf(" %d", n_lst);
13441 printf("\n");
13442 }
13443 }
13444 }
13445 }
13446 }
13447 }
13448 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013449 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013450#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +000013451
Daniel Veillard42595322004-11-08 10:52:06 +000013452 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013453}
13454
13455
13456static int
13457test_xmlParseBalancedChunkMemoryRecover(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013458 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013459
Daniel Veillarda521d282004-11-09 14:59:59 +000013460#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000013461 int mem_base;
13462 int ret_val;
13463 xmlDocPtr doc; /* the document the chunk pertains to */
13464 int n_doc;
13465 xmlSAXHandlerPtr sax; /* the SAX handler bloc (possibly NULL) */
13466 int n_sax;
13467 void * user_data; /* The user data returned on SAX callbacks (possibly NULL) */
13468 int n_user_data;
13469 int depth; /* Used for loop detection, use 0 */
13470 int n_depth;
13471 xmlChar * string; /* the input string in UTF8 or ISO-Latin (zero terminated) */
13472 int n_string;
13473 xmlNodePtr * lst; /* the return value for the set of parsed nodes */
13474 int n_lst;
13475 int recover; /* return nodes even if the data is broken (use 0) */
13476 int n_recover;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013477
Daniel Veillardce682bc2004-11-05 17:22:25 +000013478 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
13479 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
13480 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
13481 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
13482 for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) {
13483 for (n_lst = 0;n_lst < gen_nb_xmlNodePtr_ptr;n_lst++) {
13484 for (n_recover = 0;n_recover < gen_nb_int;n_recover++) {
13485 mem_base = xmlMemBlocks();
13486 doc = gen_xmlDocPtr(n_doc, 0);
13487 sax = gen_xmlSAXHandlerPtr(n_sax, 1);
13488 user_data = gen_userdata(n_user_data, 2);
13489 depth = gen_int(n_depth, 3);
13490 string = gen_const_xmlChar_ptr(n_string, 4);
13491 lst = gen_xmlNodePtr_ptr(n_lst, 5);
13492 recover = gen_int(n_recover, 6);
Daniel Veillarda521d282004-11-09 14:59:59 +000013493
13494#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000013495 if (sax == (xmlSAXHandlerPtr)&xmlDefaultSAXHandler) user_data = NULL;
Daniel Veillarda521d282004-11-09 14:59:59 +000013496#endif
13497
Daniel Veillardce682bc2004-11-05 17:22:25 +000013498
William M. Brackf13f77f2004-11-12 16:03:48 +000013499 ret_val = xmlParseBalancedChunkMemoryRecover(doc, sax, user_data, depth, (const xmlChar *)string, lst, recover);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013500 desret_int(ret_val);
13501 call_tests++;
13502 des_xmlDocPtr(n_doc, doc, 0);
13503 des_xmlSAXHandlerPtr(n_sax, sax, 1);
13504 des_userdata(n_user_data, user_data, 2);
13505 des_int(n_depth, depth, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +000013506 des_const_xmlChar_ptr(n_string, (const xmlChar *)string, 4);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013507 des_xmlNodePtr_ptr(n_lst, lst, 5);
13508 des_int(n_recover, recover, 6);
13509 xmlResetLastError();
13510 if (mem_base != xmlMemBlocks()) {
13511 printf("Leak of %d blocks found in xmlParseBalancedChunkMemoryRecover",
13512 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013513 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013514 printf(" %d", n_doc);
13515 printf(" %d", n_sax);
13516 printf(" %d", n_user_data);
13517 printf(" %d", n_depth);
13518 printf(" %d", n_string);
13519 printf(" %d", n_lst);
13520 printf(" %d", n_recover);
13521 printf("\n");
13522 }
13523 }
13524 }
13525 }
13526 }
13527 }
13528 }
13529 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013530 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013531#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +000013532
Daniel Veillard42595322004-11-08 10:52:06 +000013533 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013534}
13535
13536
13537static int
13538test_xmlParseChunk(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013539 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013540
13541#ifdef LIBXML_PUSH_ENABLED
13542 int mem_base;
13543 int ret_val;
13544 xmlParserCtxtPtr ctxt; /* an XML parser context */
13545 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013546 char * chunk; /* an char array */
Daniel Veillardd93f6252004-11-02 15:53:51 +000013547 int n_chunk;
13548 int size; /* the size in byte of the chunk */
13549 int n_size;
13550 int terminate; /* last chunk indicator */
13551 int n_terminate;
13552
13553 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13554 for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) {
13555 for (n_size = 0;n_size < gen_nb_int;n_size++) {
13556 for (n_terminate = 0;n_terminate < gen_nb_int;n_terminate++) {
13557 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013558 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
13559 chunk = gen_const_char_ptr(n_chunk, 1);
13560 size = gen_int(n_size, 2);
13561 terminate = gen_int(n_terminate, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013562
William M. Brackf13f77f2004-11-12 16:03:48 +000013563 ret_val = xmlParseChunk(ctxt, (const char *)chunk, size, terminate);
Daniel Veillarda521d282004-11-09 14:59:59 +000013564 if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;}
Daniel Veillardd93f6252004-11-02 15:53:51 +000013565 desret_int(ret_val);
13566 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013567 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000013568 des_const_char_ptr(n_chunk, (const char *)chunk, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000013569 des_int(n_size, size, 2);
13570 des_int(n_terminate, terminate, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013571 xmlResetLastError();
13572 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013573 printf("Leak of %d blocks found in xmlParseChunk",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013574 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013575 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013576 printf(" %d", n_ctxt);
13577 printf(" %d", n_chunk);
13578 printf(" %d", n_size);
13579 printf(" %d", n_terminate);
13580 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013581 }
13582 }
13583 }
13584 }
13585 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013586 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013587#endif
13588
Daniel Veillard42595322004-11-08 10:52:06 +000013589 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013590}
13591
13592
13593static int
13594test_xmlParseCtxtExternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013595 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013596
Daniel Veillardce682bc2004-11-05 17:22:25 +000013597 int mem_base;
13598 int ret_val;
13599 xmlParserCtxtPtr ctx; /* the existing parsing context */
13600 int n_ctx;
13601 xmlChar * URL; /* the URL for the entity to load */
13602 int n_URL;
13603 xmlChar * ID; /* the System ID for the entity to load */
13604 int n_ID;
13605 xmlNodePtr * lst; /* the return value for the set of parsed nodes */
13606 int n_lst;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013607
Daniel Veillardce682bc2004-11-05 17:22:25 +000013608 for (n_ctx = 0;n_ctx < gen_nb_xmlParserCtxtPtr;n_ctx++) {
13609 for (n_URL = 0;n_URL < gen_nb_const_xmlChar_ptr;n_URL++) {
13610 for (n_ID = 0;n_ID < gen_nb_const_xmlChar_ptr;n_ID++) {
13611 for (n_lst = 0;n_lst < gen_nb_xmlNodePtr_ptr;n_lst++) {
13612 mem_base = xmlMemBlocks();
13613 ctx = gen_xmlParserCtxtPtr(n_ctx, 0);
13614 URL = gen_const_xmlChar_ptr(n_URL, 1);
13615 ID = gen_const_xmlChar_ptr(n_ID, 2);
13616 lst = gen_xmlNodePtr_ptr(n_lst, 3);
13617
William M. Brackf13f77f2004-11-12 16:03:48 +000013618 ret_val = xmlParseCtxtExternalEntity(ctx, (const xmlChar *)URL, (const xmlChar *)ID, lst);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013619 desret_int(ret_val);
13620 call_tests++;
13621 des_xmlParserCtxtPtr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000013622 des_const_xmlChar_ptr(n_URL, (const xmlChar *)URL, 1);
13623 des_const_xmlChar_ptr(n_ID, (const xmlChar *)ID, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013624 des_xmlNodePtr_ptr(n_lst, lst, 3);
13625 xmlResetLastError();
13626 if (mem_base != xmlMemBlocks()) {
13627 printf("Leak of %d blocks found in xmlParseCtxtExternalEntity",
13628 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013629 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013630 printf(" %d", n_ctx);
13631 printf(" %d", n_URL);
13632 printf(" %d", n_ID);
13633 printf(" %d", n_lst);
13634 printf("\n");
13635 }
13636 }
13637 }
13638 }
13639 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000013640 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013641
Daniel Veillard42595322004-11-08 10:52:06 +000013642 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013643}
13644
13645
13646static int
13647test_xmlParseDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013648 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013649
Daniel Veillarda521d282004-11-09 14:59:59 +000013650#ifdef LIBXML_VALID_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000013651 int mem_base;
13652 xmlDtdPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013653 xmlChar * ExternalID; /* a NAME* containing the External ID of the DTD */
Daniel Veillard34099b42004-11-04 17:34:35 +000013654 int n_ExternalID;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013655 xmlChar * SystemID; /* a NAME* containing the URL to the DTD */
Daniel Veillard34099b42004-11-04 17:34:35 +000013656 int n_SystemID;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013657
Daniel Veillard34099b42004-11-04 17:34:35 +000013658 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
13659 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
13660 mem_base = xmlMemBlocks();
13661 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 0);
13662 SystemID = gen_const_xmlChar_ptr(n_SystemID, 1);
13663
William M. Brackf13f77f2004-11-12 16:03:48 +000013664 ret_val = xmlParseDTD((const xmlChar *)ExternalID, (const xmlChar *)SystemID);
Daniel Veillard34099b42004-11-04 17:34:35 +000013665 desret_xmlDtdPtr(ret_val);
13666 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000013667 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 0);
13668 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 1);
Daniel Veillard34099b42004-11-04 17:34:35 +000013669 xmlResetLastError();
13670 if (mem_base != xmlMemBlocks()) {
13671 printf("Leak of %d blocks found in xmlParseDTD",
13672 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013673 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000013674 printf(" %d", n_ExternalID);
13675 printf(" %d", n_SystemID);
13676 printf("\n");
13677 }
13678 }
13679 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013680 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013681#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000013682
Daniel Veillard42595322004-11-08 10:52:06 +000013683 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013684}
13685
13686
13687static int
13688test_xmlParseDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013689 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013690
Daniel Veillarda521d282004-11-09 14:59:59 +000013691#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard8a32fe42004-11-02 22:10:16 +000013692 int mem_base;
13693 xmlDocPtr ret_val;
13694 xmlChar * cur; /* a pointer to an array of xmlChar */
13695 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013696
Daniel Veillard8a32fe42004-11-02 22:10:16 +000013697 for (n_cur = 0;n_cur < gen_nb_xmlChar_ptr;n_cur++) {
13698 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013699 cur = gen_xmlChar_ptr(n_cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000013700
13701 ret_val = xmlParseDoc(cur);
13702 desret_xmlDocPtr(ret_val);
13703 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013704 des_xmlChar_ptr(n_cur, cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000013705 xmlResetLastError();
13706 if (mem_base != xmlMemBlocks()) {
13707 printf("Leak of %d blocks found in xmlParseDoc",
13708 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013709 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000013710 printf(" %d", n_cur);
13711 printf("\n");
13712 }
13713 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013714 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013715#endif
Daniel Veillard8a32fe42004-11-02 22:10:16 +000013716
Daniel Veillard42595322004-11-08 10:52:06 +000013717 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013718}
13719
13720
13721static int
13722test_xmlParseDocument(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013723 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013724
13725 int mem_base;
13726 int ret_val;
13727 xmlParserCtxtPtr ctxt; /* an XML parser context */
13728 int n_ctxt;
13729
13730 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13731 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013732 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013733
13734 ret_val = xmlParseDocument(ctxt);
Daniel Veillarda521d282004-11-09 14:59:59 +000013735 if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;}
Daniel Veillardd93f6252004-11-02 15:53:51 +000013736 desret_int(ret_val);
13737 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013738 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013739 xmlResetLastError();
13740 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013741 printf("Leak of %d blocks found in xmlParseDocument",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013742 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013743 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013744 printf(" %d", n_ctxt);
13745 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013746 }
13747 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000013748 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013749
Daniel Veillard42595322004-11-08 10:52:06 +000013750 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013751}
13752
13753
13754static int
13755test_xmlParseEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013756 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013757
Daniel Veillarda521d282004-11-09 14:59:59 +000013758#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000013759 int mem_base;
13760 xmlDocPtr ret_val;
13761 const char * filename; /* the filename */
13762 int n_filename;
13763
13764 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
13765 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013766 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013767
13768 ret_val = xmlParseEntity(filename);
13769 desret_xmlDocPtr(ret_val);
13770 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013771 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013772 xmlResetLastError();
13773 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013774 printf("Leak of %d blocks found in xmlParseEntity",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013775 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013776 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013777 printf(" %d", n_filename);
13778 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013779 }
13780 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013781 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013782#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000013783
Daniel Veillard42595322004-11-08 10:52:06 +000013784 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013785}
13786
13787
13788static int
13789test_xmlParseExtParsedEnt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013790 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013791
13792 int mem_base;
13793 int ret_val;
13794 xmlParserCtxtPtr ctxt; /* an XML parser context */
13795 int n_ctxt;
13796
13797 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13798 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013799 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013800
13801 ret_val = xmlParseExtParsedEnt(ctxt);
Daniel Veillarda521d282004-11-09 14:59:59 +000013802 if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;}
Daniel Veillardd93f6252004-11-02 15:53:51 +000013803 desret_int(ret_val);
13804 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013805 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013806 xmlResetLastError();
13807 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013808 printf("Leak of %d blocks found in xmlParseExtParsedEnt",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013809 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013810 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013811 printf(" %d", n_ctxt);
13812 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013813 }
13814 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000013815 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013816
Daniel Veillard42595322004-11-08 10:52:06 +000013817 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013818}
13819
13820
13821static int
13822test_xmlParseExternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013823 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013824
Daniel Veillarda521d282004-11-09 14:59:59 +000013825#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000013826 int mem_base;
13827 int ret_val;
13828 xmlDocPtr doc; /* the document the chunk pertains to */
13829 int n_doc;
13830 xmlSAXHandlerPtr sax; /* the SAX handler bloc (possibly NULL) */
13831 int n_sax;
13832 void * user_data; /* The user data returned on SAX callbacks (possibly NULL) */
13833 int n_user_data;
13834 int depth; /* Used for loop detection, use 0 */
13835 int n_depth;
13836 xmlChar * URL; /* the URL for the entity to load */
13837 int n_URL;
13838 xmlChar * ID; /* the System ID for the entity to load */
13839 int n_ID;
13840 xmlNodePtr * lst; /* the return value for the set of parsed nodes */
13841 int n_lst;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013842
Daniel Veillardce682bc2004-11-05 17:22:25 +000013843 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
13844 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
13845 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
13846 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
13847 for (n_URL = 0;n_URL < gen_nb_const_xmlChar_ptr;n_URL++) {
13848 for (n_ID = 0;n_ID < gen_nb_const_xmlChar_ptr;n_ID++) {
13849 for (n_lst = 0;n_lst < gen_nb_xmlNodePtr_ptr;n_lst++) {
13850 mem_base = xmlMemBlocks();
13851 doc = gen_xmlDocPtr(n_doc, 0);
13852 sax = gen_xmlSAXHandlerPtr(n_sax, 1);
13853 user_data = gen_userdata(n_user_data, 2);
13854 depth = gen_int(n_depth, 3);
13855 URL = gen_const_xmlChar_ptr(n_URL, 4);
13856 ID = gen_const_xmlChar_ptr(n_ID, 5);
13857 lst = gen_xmlNodePtr_ptr(n_lst, 6);
13858
William M. Brackf13f77f2004-11-12 16:03:48 +000013859 ret_val = xmlParseExternalEntity(doc, sax, user_data, depth, (const xmlChar *)URL, (const xmlChar *)ID, lst);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013860 desret_int(ret_val);
13861 call_tests++;
13862 des_xmlDocPtr(n_doc, doc, 0);
13863 des_xmlSAXHandlerPtr(n_sax, sax, 1);
13864 des_userdata(n_user_data, user_data, 2);
13865 des_int(n_depth, depth, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +000013866 des_const_xmlChar_ptr(n_URL, (const xmlChar *)URL, 4);
13867 des_const_xmlChar_ptr(n_ID, (const xmlChar *)ID, 5);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013868 des_xmlNodePtr_ptr(n_lst, lst, 6);
13869 xmlResetLastError();
13870 if (mem_base != xmlMemBlocks()) {
13871 printf("Leak of %d blocks found in xmlParseExternalEntity",
13872 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013873 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013874 printf(" %d", n_doc);
13875 printf(" %d", n_sax);
13876 printf(" %d", n_user_data);
13877 printf(" %d", n_depth);
13878 printf(" %d", n_URL);
13879 printf(" %d", n_ID);
13880 printf(" %d", n_lst);
13881 printf("\n");
13882 }
13883 }
13884 }
13885 }
13886 }
13887 }
13888 }
13889 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013890 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013891#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +000013892
Daniel Veillard42595322004-11-08 10:52:06 +000013893 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013894}
13895
13896
13897static int
13898test_xmlParseFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013899 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013900
Daniel Veillarda521d282004-11-09 14:59:59 +000013901#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000013902 int mem_base;
13903 xmlDocPtr ret_val;
13904 const char * filename; /* the filename */
13905 int n_filename;
13906
13907 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
13908 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013909 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013910
13911 ret_val = xmlParseFile(filename);
13912 desret_xmlDocPtr(ret_val);
13913 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013914 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013915 xmlResetLastError();
13916 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013917 printf("Leak of %d blocks found in xmlParseFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013918 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013919 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013920 printf(" %d", n_filename);
13921 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013922 }
13923 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013924 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013925#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000013926
Daniel Veillard42595322004-11-08 10:52:06 +000013927 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013928}
13929
13930
13931static int
13932test_xmlParseInNodeContext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013933 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013934
Daniel Veillard57b25162004-11-06 14:50:18 +000013935 int mem_base;
13936 xmlParserErrors ret_val;
13937 xmlNodePtr node; /* the context node */
13938 int n_node;
13939 char * data; /* the input string */
13940 int n_data;
13941 int datalen; /* the input string length in bytes */
13942 int n_datalen;
13943 int options; /* a combination of xmlParserOption */
13944 int n_options;
13945 xmlNodePtr * lst; /* the return value for the set of parsed nodes */
13946 int n_lst;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013947
Daniel Veillard57b25162004-11-06 14:50:18 +000013948 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
13949 for (n_data = 0;n_data < gen_nb_const_char_ptr;n_data++) {
13950 for (n_datalen = 0;n_datalen < gen_nb_int;n_datalen++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000013951 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillard57b25162004-11-06 14:50:18 +000013952 for (n_lst = 0;n_lst < gen_nb_xmlNodePtr_ptr;n_lst++) {
13953 mem_base = xmlMemBlocks();
13954 node = gen_xmlNodePtr(n_node, 0);
13955 data = gen_const_char_ptr(n_data, 1);
13956 datalen = gen_int(n_datalen, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000013957 options = gen_parseroptions(n_options, 3);
Daniel Veillard57b25162004-11-06 14:50:18 +000013958 lst = gen_xmlNodePtr_ptr(n_lst, 4);
13959
William M. Brackf13f77f2004-11-12 16:03:48 +000013960 ret_val = xmlParseInNodeContext(node, (const char *)data, datalen, options, lst);
Daniel Veillard57b25162004-11-06 14:50:18 +000013961 desret_xmlParserErrors(ret_val);
13962 call_tests++;
13963 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000013964 des_const_char_ptr(n_data, (const char *)data, 1);
Daniel Veillard57b25162004-11-06 14:50:18 +000013965 des_int(n_datalen, datalen, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000013966 des_parseroptions(n_options, options, 3);
Daniel Veillard57b25162004-11-06 14:50:18 +000013967 des_xmlNodePtr_ptr(n_lst, lst, 4);
13968 xmlResetLastError();
13969 if (mem_base != xmlMemBlocks()) {
13970 printf("Leak of %d blocks found in xmlParseInNodeContext",
13971 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013972 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000013973 printf(" %d", n_node);
13974 printf(" %d", n_data);
13975 printf(" %d", n_datalen);
13976 printf(" %d", n_options);
13977 printf(" %d", n_lst);
13978 printf("\n");
13979 }
13980 }
13981 }
13982 }
13983 }
13984 }
Daniel Veillard57b25162004-11-06 14:50:18 +000013985 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013986
Daniel Veillard42595322004-11-08 10:52:06 +000013987 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013988}
13989
13990
13991static int
13992test_xmlParseMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013993 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013994
Daniel Veillarda521d282004-11-09 14:59:59 +000013995#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000013996 int mem_base;
13997 xmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013998 char * buffer; /* an pointer to a char array */
Daniel Veillardd93f6252004-11-02 15:53:51 +000013999 int n_buffer;
14000 int size; /* the size of the array */
14001 int n_size;
14002
14003 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
14004 for (n_size = 0;n_size < gen_nb_int;n_size++) {
14005 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014006 buffer = gen_const_char_ptr(n_buffer, 0);
14007 size = gen_int(n_size, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014008
William M. Brackf13f77f2004-11-12 16:03:48 +000014009 ret_val = xmlParseMemory((const char *)buffer, size);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014010 desret_xmlDocPtr(ret_val);
14011 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000014012 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000014013 des_int(n_size, size, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014014 xmlResetLastError();
14015 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014016 printf("Leak of %d blocks found in xmlParseMemory",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014017 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014018 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014019 printf(" %d", n_buffer);
14020 printf(" %d", n_size);
14021 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014022 }
14023 }
14024 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014025 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014026#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000014027
Daniel Veillard42595322004-11-08 10:52:06 +000014028 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014029}
14030
14031
Daniel Veillardce682bc2004-11-05 17:22:25 +000014032#define gen_nb_const_xmlParserNodeInfoPtr 1
14033static xmlParserNodeInfoPtr gen_const_xmlParserNodeInfoPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14034 return(NULL);
14035}
14036static void des_const_xmlParserNodeInfoPtr(int no ATTRIBUTE_UNUSED, const xmlParserNodeInfoPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14037}
14038
Daniel Veillardd93f6252004-11-02 15:53:51 +000014039static int
14040test_xmlParserAddNodeInfo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014041 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014042
Daniel Veillardce682bc2004-11-05 17:22:25 +000014043 int mem_base;
14044 xmlParserCtxtPtr ctxt; /* an XML parser context */
14045 int n_ctxt;
14046 xmlParserNodeInfoPtr info; /* a node info sequence pointer */
14047 int n_info;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014048
Daniel Veillardce682bc2004-11-05 17:22:25 +000014049 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
14050 for (n_info = 0;n_info < gen_nb_const_xmlParserNodeInfoPtr;n_info++) {
14051 mem_base = xmlMemBlocks();
14052 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
14053 info = gen_const_xmlParserNodeInfoPtr(n_info, 1);
14054
William M. Brackf13f77f2004-11-12 16:03:48 +000014055 xmlParserAddNodeInfo(ctxt, (const xmlParserNodeInfoPtr)info);
Daniel Veillardce682bc2004-11-05 17:22:25 +000014056 call_tests++;
14057 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000014058 des_const_xmlParserNodeInfoPtr(n_info, (const xmlParserNodeInfoPtr)info, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000014059 xmlResetLastError();
14060 if (mem_base != xmlMemBlocks()) {
14061 printf("Leak of %d blocks found in xmlParserAddNodeInfo",
14062 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014063 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014064 printf(" %d", n_ctxt);
14065 printf(" %d", n_info);
14066 printf("\n");
14067 }
14068 }
14069 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000014070 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014071
Daniel Veillard42595322004-11-08 10:52:06 +000014072 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014073}
14074
14075
Daniel Veillardce682bc2004-11-05 17:22:25 +000014076#define gen_nb_const_xmlParserCtxtPtr 1
14077static xmlParserCtxtPtr gen_const_xmlParserCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14078 return(NULL);
14079}
14080static void des_const_xmlParserCtxtPtr(int no ATTRIBUTE_UNUSED, const xmlParserCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14081}
14082
Daniel Veillarda521d282004-11-09 14:59:59 +000014083#define gen_nb_const_xmlNodePtr 1
14084static xmlNodePtr gen_const_xmlNodePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14085 return(NULL);
14086}
14087static void des_const_xmlNodePtr(int no ATTRIBUTE_UNUSED, const xmlNodePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14088}
14089
Daniel Veillardd93f6252004-11-02 15:53:51 +000014090static int
14091test_xmlParserFindNodeInfo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014092 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014093
William M. Brack094dd862004-11-14 14:28:34 +000014094 int mem_base;
14095 const xmlParserNodeInfo * ret_val;
14096 xmlParserCtxtPtr ctx; /* an XML parser context */
14097 int n_ctx;
14098 xmlNodePtr node; /* an XML node within the tree */
14099 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014100
William M. Brack094dd862004-11-14 14:28:34 +000014101 for (n_ctx = 0;n_ctx < gen_nb_const_xmlParserCtxtPtr;n_ctx++) {
14102 for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) {
14103 mem_base = xmlMemBlocks();
14104 ctx = gen_const_xmlParserCtxtPtr(n_ctx, 0);
14105 node = gen_const_xmlNodePtr(n_node, 1);
14106
14107 ret_val = xmlParserFindNodeInfo((const xmlParserCtxtPtr)ctx, (const xmlNodePtr)node);
14108 desret_const_xmlParserNodeInfo_ptr(ret_val);
14109 call_tests++;
14110 des_const_xmlParserCtxtPtr(n_ctx, (const xmlParserCtxtPtr)ctx, 0);
14111 des_const_xmlNodePtr(n_node, (const xmlNodePtr)node, 1);
14112 xmlResetLastError();
14113 if (mem_base != xmlMemBlocks()) {
14114 printf("Leak of %d blocks found in xmlParserFindNodeInfo",
14115 xmlMemBlocks() - mem_base);
14116 test_ret++;
14117 printf(" %d", n_ctx);
14118 printf(" %d", n_node);
14119 printf("\n");
14120 }
14121 }
14122 }
14123 function_tests++;
14124
Daniel Veillard42595322004-11-08 10:52:06 +000014125 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014126}
14127
14128
Daniel Veillardce682bc2004-11-05 17:22:25 +000014129#define gen_nb_const_xmlParserNodeInfoSeqPtr 1
14130static xmlParserNodeInfoSeqPtr gen_const_xmlParserNodeInfoSeqPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14131 return(NULL);
14132}
14133static void des_const_xmlParserNodeInfoSeqPtr(int no ATTRIBUTE_UNUSED, const xmlParserNodeInfoSeqPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14134}
14135
Daniel Veillardd93f6252004-11-02 15:53:51 +000014136static int
14137test_xmlParserFindNodeInfoIndex(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014138 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014139
William M. Brack094dd862004-11-14 14:28:34 +000014140 int mem_base;
14141 unsigned long ret_val;
14142 xmlParserNodeInfoSeqPtr seq; /* a node info sequence pointer */
14143 int n_seq;
14144 xmlNodePtr node; /* an XML node pointer */
14145 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014146
William M. Brack094dd862004-11-14 14:28:34 +000014147 for (n_seq = 0;n_seq < gen_nb_const_xmlParserNodeInfoSeqPtr;n_seq++) {
14148 for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) {
14149 mem_base = xmlMemBlocks();
14150 seq = gen_const_xmlParserNodeInfoSeqPtr(n_seq, 0);
14151 node = gen_const_xmlNodePtr(n_node, 1);
14152
14153 ret_val = xmlParserFindNodeInfoIndex((const xmlParserNodeInfoSeqPtr)seq, (const xmlNodePtr)node);
14154 desret_unsigned_long(ret_val);
14155 call_tests++;
14156 des_const_xmlParserNodeInfoSeqPtr(n_seq, (const xmlParserNodeInfoSeqPtr)seq, 0);
14157 des_const_xmlNodePtr(n_node, (const xmlNodePtr)node, 1);
14158 xmlResetLastError();
14159 if (mem_base != xmlMemBlocks()) {
14160 printf("Leak of %d blocks found in xmlParserFindNodeInfoIndex",
14161 xmlMemBlocks() - mem_base);
14162 test_ret++;
14163 printf(" %d", n_seq);
14164 printf(" %d", n_node);
14165 printf("\n");
14166 }
14167 }
14168 }
14169 function_tests++;
14170
Daniel Veillard42595322004-11-08 10:52:06 +000014171 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014172}
14173
14174
Daniel Veillardce682bc2004-11-05 17:22:25 +000014175#define gen_nb_xmlParserInputPtr 1
14176static xmlParserInputPtr gen_xmlParserInputPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14177 return(NULL);
14178}
14179static void des_xmlParserInputPtr(int no ATTRIBUTE_UNUSED, xmlParserInputPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14180}
14181
Daniel Veillardd93f6252004-11-02 15:53:51 +000014182static int
14183test_xmlParserInputGrow(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014184 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014185
Daniel Veillardce682bc2004-11-05 17:22:25 +000014186 int mem_base;
14187 int ret_val;
14188 xmlParserInputPtr in; /* an XML parser input */
14189 int n_in;
14190 int len; /* an indicative size for the lookahead */
14191 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014192
Daniel Veillardce682bc2004-11-05 17:22:25 +000014193 for (n_in = 0;n_in < gen_nb_xmlParserInputPtr;n_in++) {
14194 for (n_len = 0;n_len < gen_nb_int;n_len++) {
14195 mem_base = xmlMemBlocks();
14196 in = gen_xmlParserInputPtr(n_in, 0);
14197 len = gen_int(n_len, 1);
14198
14199 ret_val = xmlParserInputGrow(in, len);
14200 desret_int(ret_val);
14201 call_tests++;
14202 des_xmlParserInputPtr(n_in, in, 0);
14203 des_int(n_len, len, 1);
14204 xmlResetLastError();
14205 if (mem_base != xmlMemBlocks()) {
14206 printf("Leak of %d blocks found in xmlParserInputGrow",
14207 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014208 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014209 printf(" %d", n_in);
14210 printf(" %d", n_len);
14211 printf("\n");
14212 }
14213 }
14214 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000014215 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014216
Daniel Veillard42595322004-11-08 10:52:06 +000014217 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014218}
14219
14220
14221static int
14222test_xmlParserInputRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014223 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014224
Daniel Veillardce682bc2004-11-05 17:22:25 +000014225 int mem_base;
14226 int ret_val;
14227 xmlParserInputPtr in; /* an XML parser input */
14228 int n_in;
14229 int len; /* an indicative size for the lookahead */
14230 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014231
Daniel Veillardce682bc2004-11-05 17:22:25 +000014232 for (n_in = 0;n_in < gen_nb_xmlParserInputPtr;n_in++) {
14233 for (n_len = 0;n_len < gen_nb_int;n_len++) {
14234 mem_base = xmlMemBlocks();
14235 in = gen_xmlParserInputPtr(n_in, 0);
14236 len = gen_int(n_len, 1);
14237
14238 ret_val = xmlParserInputRead(in, len);
14239 desret_int(ret_val);
14240 call_tests++;
14241 des_xmlParserInputPtr(n_in, in, 0);
14242 des_int(n_len, len, 1);
14243 xmlResetLastError();
14244 if (mem_base != xmlMemBlocks()) {
14245 printf("Leak of %d blocks found in xmlParserInputRead",
14246 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014247 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014248 printf(" %d", n_in);
14249 printf(" %d", n_len);
14250 printf("\n");
14251 }
14252 }
14253 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000014254 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014255
Daniel Veillard42595322004-11-08 10:52:06 +000014256 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014257}
14258
14259
14260static int
14261test_xmlPedanticParserDefault(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014262 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014263
14264 int mem_base;
14265 int ret_val;
14266 int val; /* int 0 or 1 */
14267 int n_val;
14268
14269 for (n_val = 0;n_val < gen_nb_int;n_val++) {
14270 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014271 val = gen_int(n_val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014272
14273 ret_val = xmlPedanticParserDefault(val);
14274 desret_int(ret_val);
14275 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000014276 des_int(n_val, val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014277 xmlResetLastError();
14278 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014279 printf("Leak of %d blocks found in xmlPedanticParserDefault",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014280 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014281 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014282 printf(" %d", n_val);
14283 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014284 }
14285 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000014286 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014287
Daniel Veillard42595322004-11-08 10:52:06 +000014288 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014289}
14290
14291
14292static int
14293test_xmlReadDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014294 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014295
14296 int mem_base;
14297 xmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014298 xmlChar * cur; /* a pointer to a zero terminated string */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014299 int n_cur;
14300 const char * URL; /* the base URL to use for the document */
14301 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014302 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014303 int n_encoding;
14304 int options; /* a combination of xmlParserOption */
14305 int n_options;
14306
14307 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
14308 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
14309 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000014310 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000014311 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014312 cur = gen_const_xmlChar_ptr(n_cur, 0);
14313 URL = gen_filepath(n_URL, 1);
14314 encoding = gen_const_char_ptr(n_encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000014315 options = gen_parseroptions(n_options, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014316
William M. Brackf13f77f2004-11-12 16:03:48 +000014317 ret_val = xmlReadDoc((const xmlChar *)cur, URL, (const char *)encoding, options);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014318 desret_xmlDocPtr(ret_val);
14319 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000014320 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000014321 des_filepath(n_URL, URL, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000014322 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000014323 des_parseroptions(n_options, options, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014324 xmlResetLastError();
14325 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014326 printf("Leak of %d blocks found in xmlReadDoc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014327 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014328 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014329 printf(" %d", n_cur);
14330 printf(" %d", n_URL);
14331 printf(" %d", n_encoding);
14332 printf(" %d", n_options);
14333 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014334 }
14335 }
14336 }
14337 }
14338 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000014339 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014340
Daniel Veillard42595322004-11-08 10:52:06 +000014341 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014342}
14343
14344
14345static int
14346test_xmlReadFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014347 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014348
14349 int mem_base;
14350 xmlDocPtr ret_val;
14351 const char * filename; /* a file or URL */
14352 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014353 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014354 int n_encoding;
14355 int options; /* a combination of xmlParserOption */
14356 int n_options;
14357
14358 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
14359 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000014360 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000014361 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014362 filename = gen_filepath(n_filename, 0);
14363 encoding = gen_const_char_ptr(n_encoding, 1);
Daniel Veillard6128c012004-11-08 17:16:15 +000014364 options = gen_parseroptions(n_options, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014365
William M. Brackf13f77f2004-11-12 16:03:48 +000014366 ret_val = xmlReadFile(filename, (const char *)encoding, options);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014367 desret_xmlDocPtr(ret_val);
14368 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000014369 des_filepath(n_filename, filename, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000014370 des_const_char_ptr(n_encoding, (const char *)encoding, 1);
Daniel Veillard6128c012004-11-08 17:16:15 +000014371 des_parseroptions(n_options, options, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014372 xmlResetLastError();
14373 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014374 printf("Leak of %d blocks found in xmlReadFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014375 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014376 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014377 printf(" %d", n_filename);
14378 printf(" %d", n_encoding);
14379 printf(" %d", n_options);
14380 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014381 }
14382 }
14383 }
14384 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000014385 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014386
Daniel Veillard42595322004-11-08 10:52:06 +000014387 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014388}
14389
14390
14391static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000014392test_xmlReadMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014393 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014394
14395 int mem_base;
14396 xmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014397 char * buffer; /* a pointer to a char array */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014398 int n_buffer;
14399 int size; /* the size of the array */
14400 int n_size;
14401 const char * URL; /* the base URL to use for the document */
14402 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014403 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014404 int n_encoding;
14405 int options; /* a combination of xmlParserOption */
14406 int n_options;
14407
14408 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
14409 for (n_size = 0;n_size < gen_nb_int;n_size++) {
14410 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
14411 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000014412 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000014413 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014414 buffer = gen_const_char_ptr(n_buffer, 0);
14415 size = gen_int(n_size, 1);
14416 URL = gen_filepath(n_URL, 2);
14417 encoding = gen_const_char_ptr(n_encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000014418 options = gen_parseroptions(n_options, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014419
William M. Brackf13f77f2004-11-12 16:03:48 +000014420 ret_val = xmlReadMemory((const char *)buffer, size, URL, (const char *)encoding, options);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014421 desret_xmlDocPtr(ret_val);
14422 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000014423 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000014424 des_int(n_size, size, 1);
14425 des_filepath(n_URL, URL, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000014426 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000014427 des_parseroptions(n_options, options, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014428 xmlResetLastError();
14429 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014430 printf("Leak of %d blocks found in xmlReadMemory",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014431 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014432 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014433 printf(" %d", n_buffer);
14434 printf(" %d", n_size);
14435 printf(" %d", n_URL);
14436 printf(" %d", n_encoding);
14437 printf(" %d", n_options);
14438 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014439 }
14440 }
14441 }
14442 }
14443 }
14444 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000014445 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014446
Daniel Veillard42595322004-11-08 10:52:06 +000014447 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014448}
14449
14450
14451static int
14452test_xmlRecoverDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014453 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014454
Daniel Veillarda521d282004-11-09 14:59:59 +000014455#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014456 int mem_base;
14457 xmlDocPtr ret_val;
14458 xmlChar * cur; /* a pointer to an array of xmlChar */
14459 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014460
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014461 for (n_cur = 0;n_cur < gen_nb_xmlChar_ptr;n_cur++) {
14462 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014463 cur = gen_xmlChar_ptr(n_cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014464
14465 ret_val = xmlRecoverDoc(cur);
14466 desret_xmlDocPtr(ret_val);
14467 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000014468 des_xmlChar_ptr(n_cur, cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014469 xmlResetLastError();
14470 if (mem_base != xmlMemBlocks()) {
14471 printf("Leak of %d blocks found in xmlRecoverDoc",
14472 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014473 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014474 printf(" %d", n_cur);
14475 printf("\n");
14476 }
14477 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014478 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014479#endif
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014480
Daniel Veillard42595322004-11-08 10:52:06 +000014481 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014482}
14483
14484
14485static int
14486test_xmlRecoverFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014487 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014488
Daniel Veillarda521d282004-11-09 14:59:59 +000014489#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000014490 int mem_base;
14491 xmlDocPtr ret_val;
14492 const char * filename; /* the filename */
14493 int n_filename;
14494
14495 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
14496 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014497 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014498
14499 ret_val = xmlRecoverFile(filename);
14500 desret_xmlDocPtr(ret_val);
14501 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000014502 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014503 xmlResetLastError();
14504 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014505 printf("Leak of %d blocks found in xmlRecoverFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014506 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014507 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014508 printf(" %d", n_filename);
14509 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014510 }
14511 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014512 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014513#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000014514
Daniel Veillard42595322004-11-08 10:52:06 +000014515 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014516}
14517
14518
14519static int
14520test_xmlRecoverMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014521 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014522
Daniel Veillarda521d282004-11-09 14:59:59 +000014523#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000014524 int mem_base;
14525 xmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014526 char * buffer; /* an pointer to a char array */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014527 int n_buffer;
14528 int size; /* the size of the array */
14529 int n_size;
14530
14531 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
14532 for (n_size = 0;n_size < gen_nb_int;n_size++) {
14533 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014534 buffer = gen_const_char_ptr(n_buffer, 0);
14535 size = gen_int(n_size, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014536
William M. Brackf13f77f2004-11-12 16:03:48 +000014537 ret_val = xmlRecoverMemory((const char *)buffer, size);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014538 desret_xmlDocPtr(ret_val);
14539 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000014540 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000014541 des_int(n_size, size, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014542 xmlResetLastError();
14543 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014544 printf("Leak of %d blocks found in xmlRecoverMemory",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014545 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014546 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014547 printf(" %d", n_buffer);
14548 printf(" %d", n_size);
14549 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014550 }
14551 }
14552 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014553 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014554#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000014555
Daniel Veillard42595322004-11-08 10:52:06 +000014556 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014557}
14558
14559
14560static int
14561test_xmlSAXParseDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014562 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014563
Daniel Veillarda521d282004-11-09 14:59:59 +000014564#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014565 int mem_base;
14566 xmlDtdPtr ret_val;
14567 xmlSAXHandlerPtr sax; /* the SAX handler block */
14568 int n_sax;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014569 xmlChar * ExternalID; /* a NAME* containing the External ID of the DTD */
Daniel Veillard34099b42004-11-04 17:34:35 +000014570 int n_ExternalID;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014571 xmlChar * SystemID; /* a NAME* containing the URL to the DTD */
Daniel Veillard34099b42004-11-04 17:34:35 +000014572 int n_SystemID;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014573
Daniel Veillard34099b42004-11-04 17:34:35 +000014574 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14575 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
14576 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
14577 mem_base = xmlMemBlocks();
14578 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14579 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 1);
14580 SystemID = gen_const_xmlChar_ptr(n_SystemID, 2);
14581
William M. Brackf13f77f2004-11-12 16:03:48 +000014582 ret_val = xmlSAXParseDTD(sax, (const xmlChar *)ExternalID, (const xmlChar *)SystemID);
Daniel Veillard34099b42004-11-04 17:34:35 +000014583 desret_xmlDtdPtr(ret_val);
14584 call_tests++;
14585 des_xmlSAXHandlerPtr(n_sax, sax, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000014586 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 1);
14587 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 2);
Daniel Veillard34099b42004-11-04 17:34:35 +000014588 xmlResetLastError();
14589 if (mem_base != xmlMemBlocks()) {
14590 printf("Leak of %d blocks found in xmlSAXParseDTD",
14591 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014592 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014593 printf(" %d", n_sax);
14594 printf(" %d", n_ExternalID);
14595 printf(" %d", n_SystemID);
14596 printf("\n");
14597 }
14598 }
14599 }
14600 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014601 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014602#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014603
Daniel Veillard42595322004-11-08 10:52:06 +000014604 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014605}
14606
14607
14608static int
14609test_xmlSAXParseDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014610 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014611
Daniel Veillarda521d282004-11-09 14:59:59 +000014612#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014613 int mem_base;
14614 xmlDocPtr ret_val;
14615 xmlSAXHandlerPtr sax; /* the SAX handler block */
14616 int n_sax;
14617 xmlChar * cur; /* a pointer to an array of xmlChar */
14618 int n_cur;
14619 int recovery; /* work in recovery mode, i.e. tries to read no Well Formed documents */
14620 int n_recovery;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014621
Daniel Veillard34099b42004-11-04 17:34:35 +000014622 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14623 for (n_cur = 0;n_cur < gen_nb_xmlChar_ptr;n_cur++) {
14624 for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) {
14625 mem_base = xmlMemBlocks();
14626 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14627 cur = gen_xmlChar_ptr(n_cur, 1);
14628 recovery = gen_int(n_recovery, 2);
14629
14630 ret_val = xmlSAXParseDoc(sax, cur, recovery);
14631 desret_xmlDocPtr(ret_val);
14632 call_tests++;
14633 des_xmlSAXHandlerPtr(n_sax, sax, 0);
14634 des_xmlChar_ptr(n_cur, cur, 1);
14635 des_int(n_recovery, recovery, 2);
14636 xmlResetLastError();
14637 if (mem_base != xmlMemBlocks()) {
14638 printf("Leak of %d blocks found in xmlSAXParseDoc",
14639 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014640 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014641 printf(" %d", n_sax);
14642 printf(" %d", n_cur);
14643 printf(" %d", n_recovery);
14644 printf("\n");
14645 }
14646 }
14647 }
14648 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014649 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014650#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014651
Daniel Veillard42595322004-11-08 10:52:06 +000014652 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014653}
14654
14655
14656static int
14657test_xmlSAXParseEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014658 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014659
Daniel Veillarda521d282004-11-09 14:59:59 +000014660#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014661 int mem_base;
14662 xmlDocPtr ret_val;
14663 xmlSAXHandlerPtr sax; /* the SAX handler block */
14664 int n_sax;
14665 const char * filename; /* the filename */
14666 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014667
Daniel Veillard34099b42004-11-04 17:34:35 +000014668 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14669 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
14670 mem_base = xmlMemBlocks();
14671 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14672 filename = gen_filepath(n_filename, 1);
14673
14674 ret_val = xmlSAXParseEntity(sax, filename);
14675 desret_xmlDocPtr(ret_val);
14676 call_tests++;
14677 des_xmlSAXHandlerPtr(n_sax, sax, 0);
14678 des_filepath(n_filename, filename, 1);
14679 xmlResetLastError();
14680 if (mem_base != xmlMemBlocks()) {
14681 printf("Leak of %d blocks found in xmlSAXParseEntity",
14682 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014683 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014684 printf(" %d", n_sax);
14685 printf(" %d", n_filename);
14686 printf("\n");
14687 }
14688 }
14689 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014690 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014691#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014692
Daniel Veillard42595322004-11-08 10:52:06 +000014693 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014694}
14695
14696
14697static int
14698test_xmlSAXParseFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014699 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014700
Daniel Veillarda521d282004-11-09 14:59:59 +000014701#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014702 int mem_base;
14703 xmlDocPtr ret_val;
14704 xmlSAXHandlerPtr sax; /* the SAX handler block */
14705 int n_sax;
14706 const char * filename; /* the filename */
14707 int n_filename;
14708 int recovery; /* work in recovery mode, i.e. tries to read no Well Formed documents */
14709 int n_recovery;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014710
Daniel Veillard34099b42004-11-04 17:34:35 +000014711 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14712 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
14713 for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) {
14714 mem_base = xmlMemBlocks();
14715 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14716 filename = gen_filepath(n_filename, 1);
14717 recovery = gen_int(n_recovery, 2);
14718
14719 ret_val = xmlSAXParseFile(sax, filename, recovery);
14720 desret_xmlDocPtr(ret_val);
14721 call_tests++;
14722 des_xmlSAXHandlerPtr(n_sax, sax, 0);
14723 des_filepath(n_filename, filename, 1);
14724 des_int(n_recovery, recovery, 2);
14725 xmlResetLastError();
14726 if (mem_base != xmlMemBlocks()) {
14727 printf("Leak of %d blocks found in xmlSAXParseFile",
14728 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014729 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014730 printf(" %d", n_sax);
14731 printf(" %d", n_filename);
14732 printf(" %d", n_recovery);
14733 printf("\n");
14734 }
14735 }
14736 }
14737 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014738 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014739#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014740
Daniel Veillard42595322004-11-08 10:52:06 +000014741 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014742}
14743
14744
14745static int
14746test_xmlSAXParseFileWithData(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014747 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014748
Daniel Veillarda521d282004-11-09 14:59:59 +000014749#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014750 int mem_base;
14751 xmlDocPtr ret_val;
14752 xmlSAXHandlerPtr sax; /* the SAX handler block */
14753 int n_sax;
14754 const char * filename; /* the filename */
14755 int n_filename;
14756 int recovery; /* work in recovery mode, i.e. tries to read no Well Formed documents */
14757 int n_recovery;
14758 void * data; /* the userdata */
14759 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014760
Daniel Veillard34099b42004-11-04 17:34:35 +000014761 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14762 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
14763 for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) {
14764 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
14765 mem_base = xmlMemBlocks();
14766 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14767 filename = gen_filepath(n_filename, 1);
14768 recovery = gen_int(n_recovery, 2);
14769 data = gen_userdata(n_data, 3);
14770
14771 ret_val = xmlSAXParseFileWithData(sax, filename, recovery, data);
14772 desret_xmlDocPtr(ret_val);
14773 call_tests++;
14774 des_xmlSAXHandlerPtr(n_sax, sax, 0);
14775 des_filepath(n_filename, filename, 1);
14776 des_int(n_recovery, recovery, 2);
14777 des_userdata(n_data, data, 3);
14778 xmlResetLastError();
14779 if (mem_base != xmlMemBlocks()) {
14780 printf("Leak of %d blocks found in xmlSAXParseFileWithData",
14781 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014782 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014783 printf(" %d", n_sax);
14784 printf(" %d", n_filename);
14785 printf(" %d", n_recovery);
14786 printf(" %d", n_data);
14787 printf("\n");
14788 }
14789 }
14790 }
14791 }
14792 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014793 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014794#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014795
Daniel Veillard42595322004-11-08 10:52:06 +000014796 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014797}
14798
14799
14800static int
14801test_xmlSAXParseMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014802 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014803
Daniel Veillarda521d282004-11-09 14:59:59 +000014804#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014805 int mem_base;
14806 xmlDocPtr ret_val;
14807 xmlSAXHandlerPtr sax; /* the SAX handler block */
14808 int n_sax;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014809 char * buffer; /* an pointer to a char array */
Daniel Veillard34099b42004-11-04 17:34:35 +000014810 int n_buffer;
14811 int size; /* the size of the array */
14812 int n_size;
14813 int recovery; /* work in recovery mode, i.e. tries to read not Well Formed documents */
14814 int n_recovery;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014815
Daniel Veillard34099b42004-11-04 17:34:35 +000014816 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14817 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
14818 for (n_size = 0;n_size < gen_nb_int;n_size++) {
14819 for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) {
14820 mem_base = xmlMemBlocks();
14821 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14822 buffer = gen_const_char_ptr(n_buffer, 1);
14823 size = gen_int(n_size, 2);
14824 recovery = gen_int(n_recovery, 3);
14825
William M. Brackf13f77f2004-11-12 16:03:48 +000014826 ret_val = xmlSAXParseMemory(sax, (const char *)buffer, size, recovery);
Daniel Veillard34099b42004-11-04 17:34:35 +000014827 desret_xmlDocPtr(ret_val);
14828 call_tests++;
14829 des_xmlSAXHandlerPtr(n_sax, sax, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000014830 des_const_char_ptr(n_buffer, (const char *)buffer, 1);
Daniel Veillard34099b42004-11-04 17:34:35 +000014831 des_int(n_size, size, 2);
14832 des_int(n_recovery, recovery, 3);
14833 xmlResetLastError();
14834 if (mem_base != xmlMemBlocks()) {
14835 printf("Leak of %d blocks found in xmlSAXParseMemory",
14836 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014837 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014838 printf(" %d", n_sax);
14839 printf(" %d", n_buffer);
14840 printf(" %d", n_size);
14841 printf(" %d", n_recovery);
14842 printf("\n");
14843 }
14844 }
14845 }
14846 }
14847 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014848 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014849#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014850
Daniel Veillard42595322004-11-08 10:52:06 +000014851 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014852}
14853
14854
14855static int
14856test_xmlSAXParseMemoryWithData(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014857 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014858
Daniel Veillarda521d282004-11-09 14:59:59 +000014859#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014860 int mem_base;
14861 xmlDocPtr ret_val;
14862 xmlSAXHandlerPtr sax; /* the SAX handler block */
14863 int n_sax;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014864 char * buffer; /* an pointer to a char array */
Daniel Veillard34099b42004-11-04 17:34:35 +000014865 int n_buffer;
14866 int size; /* the size of the array */
14867 int n_size;
14868 int recovery; /* work in recovery mode, i.e. tries to read no Well Formed documents */
14869 int n_recovery;
14870 void * data; /* the userdata */
14871 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014872
Daniel Veillard34099b42004-11-04 17:34:35 +000014873 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14874 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
14875 for (n_size = 0;n_size < gen_nb_int;n_size++) {
14876 for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) {
14877 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
14878 mem_base = xmlMemBlocks();
14879 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14880 buffer = gen_const_char_ptr(n_buffer, 1);
14881 size = gen_int(n_size, 2);
14882 recovery = gen_int(n_recovery, 3);
14883 data = gen_userdata(n_data, 4);
14884
William M. Brackf13f77f2004-11-12 16:03:48 +000014885 ret_val = xmlSAXParseMemoryWithData(sax, (const char *)buffer, size, recovery, data);
Daniel Veillard34099b42004-11-04 17:34:35 +000014886 desret_xmlDocPtr(ret_val);
14887 call_tests++;
14888 des_xmlSAXHandlerPtr(n_sax, sax, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000014889 des_const_char_ptr(n_buffer, (const char *)buffer, 1);
Daniel Veillard34099b42004-11-04 17:34:35 +000014890 des_int(n_size, size, 2);
14891 des_int(n_recovery, recovery, 3);
14892 des_userdata(n_data, data, 4);
14893 xmlResetLastError();
14894 if (mem_base != xmlMemBlocks()) {
14895 printf("Leak of %d blocks found in xmlSAXParseMemoryWithData",
14896 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014897 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014898 printf(" %d", n_sax);
14899 printf(" %d", n_buffer);
14900 printf(" %d", n_size);
14901 printf(" %d", n_recovery);
14902 printf(" %d", n_data);
14903 printf("\n");
14904 }
14905 }
14906 }
14907 }
14908 }
14909 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014910 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014911#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014912
Daniel Veillard42595322004-11-08 10:52:06 +000014913 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014914}
14915
14916
14917static int
14918test_xmlSAXUserParseFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014919 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014920
Daniel Veillarda521d282004-11-09 14:59:59 +000014921#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014922 int mem_base;
14923 int ret_val;
14924 xmlSAXHandlerPtr sax; /* a SAX handler */
14925 int n_sax;
14926 void * user_data; /* The user data returned on SAX callbacks */
14927 int n_user_data;
14928 const char * filename; /* a file name */
14929 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014930
Daniel Veillard34099b42004-11-04 17:34:35 +000014931 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14932 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
14933 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
14934 mem_base = xmlMemBlocks();
14935 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14936 user_data = gen_userdata(n_user_data, 1);
14937 filename = gen_filepath(n_filename, 2);
Daniel Veillarda521d282004-11-09 14:59:59 +000014938
14939#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardce244ad2004-11-05 10:03:46 +000014940 if (sax == (xmlSAXHandlerPtr)&xmlDefaultSAXHandler) user_data = NULL;
Daniel Veillarda521d282004-11-09 14:59:59 +000014941#endif
14942
Daniel Veillard34099b42004-11-04 17:34:35 +000014943
14944 ret_val = xmlSAXUserParseFile(sax, user_data, filename);
14945 desret_int(ret_val);
14946 call_tests++;
14947 des_xmlSAXHandlerPtr(n_sax, sax, 0);
14948 des_userdata(n_user_data, user_data, 1);
14949 des_filepath(n_filename, filename, 2);
14950 xmlResetLastError();
14951 if (mem_base != xmlMemBlocks()) {
14952 printf("Leak of %d blocks found in xmlSAXUserParseFile",
14953 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014954 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014955 printf(" %d", n_sax);
14956 printf(" %d", n_user_data);
14957 printf(" %d", n_filename);
14958 printf("\n");
14959 }
14960 }
14961 }
14962 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014963 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014964#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014965
Daniel Veillard42595322004-11-08 10:52:06 +000014966 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014967}
14968
14969
14970static int
14971test_xmlSAXUserParseMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014972 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014973
Daniel Veillarda521d282004-11-09 14:59:59 +000014974#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014975 int mem_base;
14976 int ret_val;
14977 xmlSAXHandlerPtr sax; /* a SAX handler */
14978 int n_sax;
14979 void * user_data; /* The user data returned on SAX callbacks */
14980 int n_user_data;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014981 char * buffer; /* an in-memory XML document input */
Daniel Veillard34099b42004-11-04 17:34:35 +000014982 int n_buffer;
14983 int size; /* the length of the XML document in bytes */
14984 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014985
Daniel Veillard34099b42004-11-04 17:34:35 +000014986 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14987 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
14988 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
14989 for (n_size = 0;n_size < gen_nb_int;n_size++) {
14990 mem_base = xmlMemBlocks();
14991 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14992 user_data = gen_userdata(n_user_data, 1);
14993 buffer = gen_const_char_ptr(n_buffer, 2);
14994 size = gen_int(n_size, 3);
Daniel Veillarda521d282004-11-09 14:59:59 +000014995
14996#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardce244ad2004-11-05 10:03:46 +000014997 if (sax == (xmlSAXHandlerPtr)&xmlDefaultSAXHandler) user_data = NULL;
Daniel Veillarda521d282004-11-09 14:59:59 +000014998#endif
14999
Daniel Veillard34099b42004-11-04 17:34:35 +000015000
William M. Brackf13f77f2004-11-12 16:03:48 +000015001 ret_val = xmlSAXUserParseMemory(sax, user_data, (const char *)buffer, size);
Daniel Veillard34099b42004-11-04 17:34:35 +000015002 desret_int(ret_val);
15003 call_tests++;
15004 des_xmlSAXHandlerPtr(n_sax, sax, 0);
15005 des_userdata(n_user_data, user_data, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000015006 des_const_char_ptr(n_buffer, (const char *)buffer, 2);
Daniel Veillard34099b42004-11-04 17:34:35 +000015007 des_int(n_size, size, 3);
15008 xmlResetLastError();
15009 if (mem_base != xmlMemBlocks()) {
15010 printf("Leak of %d blocks found in xmlSAXUserParseMemory",
15011 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015012 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000015013 printf(" %d", n_sax);
15014 printf(" %d", n_user_data);
15015 printf(" %d", n_buffer);
15016 printf(" %d", n_size);
15017 printf("\n");
15018 }
15019 }
15020 }
15021 }
15022 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015023 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000015024#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000015025
Daniel Veillard42595322004-11-08 10:52:06 +000015026 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015027}
15028
15029
15030static int
15031test_xmlSetExternalEntityLoader(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015032 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015033
15034
15035 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000015036 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015037}
15038
15039
15040static int
15041test_xmlSetFeature(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015042 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015043
Daniel Veillarda521d282004-11-09 14:59:59 +000015044#ifdef LIBXML_LEGACY_ENABLED
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015045 int mem_base;
15046 int ret_val;
15047 xmlParserCtxtPtr ctxt; /* an XML/HTML parser context */
15048 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000015049 char * name; /* the feature name */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015050 int n_name;
15051 void * value; /* pointer to the location of the new value */
15052 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015053
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015054 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15055 for (n_name = 0;n_name < gen_nb_const_char_ptr;n_name++) {
15056 for (n_value = 0;n_value < gen_nb_void_ptr;n_value++) {
15057 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000015058 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15059 name = gen_const_char_ptr(n_name, 1);
15060 value = gen_void_ptr(n_value, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015061
William M. Brackf13f77f2004-11-12 16:03:48 +000015062 ret_val = xmlSetFeature(ctxt, (const char *)name, value);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015063 desret_int(ret_val);
15064 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000015065 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000015066 des_const_char_ptr(n_name, (const char *)name, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000015067 des_void_ptr(n_value, value, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015068 xmlResetLastError();
15069 if (mem_base != xmlMemBlocks()) {
15070 printf("Leak of %d blocks found in xmlSetFeature",
15071 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015072 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015073 printf(" %d", n_ctxt);
15074 printf(" %d", n_name);
15075 printf(" %d", n_value);
15076 printf("\n");
15077 }
15078 }
15079 }
15080 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015081 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000015082#endif
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015083
Daniel Veillard42595322004-11-08 10:52:06 +000015084 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015085}
15086
15087
15088static int
15089test_xmlSetupParserForBuffer(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015090 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015091
Daniel Veillarda521d282004-11-09 14:59:59 +000015092#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000015093 int mem_base;
15094 xmlParserCtxtPtr ctxt; /* an XML parser context */
15095 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000015096 xmlChar * buffer; /* a xmlChar * buffer */
Daniel Veillardd93f6252004-11-02 15:53:51 +000015097 int n_buffer;
15098 const char * filename; /* a file name */
15099 int n_filename;
15100
15101 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15102 for (n_buffer = 0;n_buffer < gen_nb_const_xmlChar_ptr;n_buffer++) {
15103 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
15104 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000015105 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15106 buffer = gen_const_xmlChar_ptr(n_buffer, 1);
15107 filename = gen_filepath(n_filename, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015108
William M. Brackf13f77f2004-11-12 16:03:48 +000015109 xmlSetupParserForBuffer(ctxt, (const xmlChar *)buffer, filename);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015110 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000015111 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000015112 des_const_xmlChar_ptr(n_buffer, (const xmlChar *)buffer, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000015113 des_filepath(n_filename, filename, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015114 xmlResetLastError();
15115 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000015116 printf("Leak of %d blocks found in xmlSetupParserForBuffer",
Daniel Veillardd93f6252004-11-02 15:53:51 +000015117 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015118 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000015119 printf(" %d", n_ctxt);
15120 printf(" %d", n_buffer);
15121 printf(" %d", n_filename);
15122 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000015123 }
15124 }
15125 }
15126 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015127 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000015128#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000015129
Daniel Veillard42595322004-11-08 10:52:06 +000015130 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015131}
15132
15133
15134static int
15135test_xmlStopParser(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015136 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015137
Daniel Veillarda521d282004-11-09 14:59:59 +000015138#ifdef LIBXML_PUSH_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000015139 int mem_base;
15140 xmlParserCtxtPtr ctxt; /* an XML parser context */
15141 int n_ctxt;
15142
15143 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15144 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000015145 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015146
15147 xmlStopParser(ctxt);
15148 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000015149 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015150 xmlResetLastError();
15151 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000015152 printf("Leak of %d blocks found in xmlStopParser",
Daniel Veillardd93f6252004-11-02 15:53:51 +000015153 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015154 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000015155 printf(" %d", n_ctxt);
15156 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000015157 }
15158 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015159 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000015160#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000015161
Daniel Veillard42595322004-11-08 10:52:06 +000015162 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015163}
15164
15165
15166static int
15167test_xmlSubstituteEntitiesDefault(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015168 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015169
15170 int mem_base;
15171 int ret_val;
15172 int val; /* int 0 or 1 */
15173 int n_val;
15174
15175 for (n_val = 0;n_val < gen_nb_int;n_val++) {
15176 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000015177 val = gen_int(n_val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015178
15179 ret_val = xmlSubstituteEntitiesDefault(val);
15180 desret_int(ret_val);
15181 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000015182 des_int(n_val, val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015183 xmlResetLastError();
15184 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000015185 printf("Leak of %d blocks found in xmlSubstituteEntitiesDefault",
Daniel Veillardd93f6252004-11-02 15:53:51 +000015186 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015187 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000015188 printf(" %d", n_val);
15189 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000015190 }
15191 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000015192 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015193
Daniel Veillard42595322004-11-08 10:52:06 +000015194 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015195}
15196
15197static int
15198test_parser(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015199 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015200
William M. Brack094dd862004-11-14 14:28:34 +000015201 if (quiet == 0) printf("Testing parser : 60 of 69 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000015202 test_ret += test_xmlByteConsumed();
15203 test_ret += test_xmlClearNodeInfoSeq();
15204 test_ret += test_xmlClearParserCtxt();
15205 test_ret += test_xmlCreateDocParserCtxt();
15206 test_ret += test_xmlCreatePushParserCtxt();
15207 test_ret += test_xmlCtxtReadDoc();
15208 test_ret += test_xmlCtxtReadFile();
15209 test_ret += test_xmlCtxtReadMemory();
15210 test_ret += test_xmlCtxtReset();
15211 test_ret += test_xmlCtxtResetPush();
15212 test_ret += test_xmlCtxtUseOptions();
15213 test_ret += test_xmlGetExternalEntityLoader();
15214 test_ret += test_xmlGetFeature();
15215 test_ret += test_xmlGetFeaturesList();
15216 test_ret += test_xmlIOParseDTD();
15217 test_ret += test_xmlInitNodeInfoSeq();
15218 test_ret += test_xmlInitParser();
15219 test_ret += test_xmlInitParserCtxt();
15220 test_ret += test_xmlKeepBlanksDefault();
15221 test_ret += test_xmlLineNumbersDefault();
15222 test_ret += test_xmlLoadExternalEntity();
15223 test_ret += test_xmlNewIOInputStream();
15224 test_ret += test_xmlNewParserCtxt();
15225 test_ret += test_xmlParseBalancedChunkMemory();
15226 test_ret += test_xmlParseBalancedChunkMemoryRecover();
15227 test_ret += test_xmlParseChunk();
15228 test_ret += test_xmlParseCtxtExternalEntity();
15229 test_ret += test_xmlParseDTD();
15230 test_ret += test_xmlParseDoc();
15231 test_ret += test_xmlParseDocument();
15232 test_ret += test_xmlParseEntity();
15233 test_ret += test_xmlParseExtParsedEnt();
15234 test_ret += test_xmlParseExternalEntity();
15235 test_ret += test_xmlParseFile();
15236 test_ret += test_xmlParseInNodeContext();
15237 test_ret += test_xmlParseMemory();
15238 test_ret += test_xmlParserAddNodeInfo();
15239 test_ret += test_xmlParserFindNodeInfo();
15240 test_ret += test_xmlParserFindNodeInfoIndex();
15241 test_ret += test_xmlParserInputGrow();
15242 test_ret += test_xmlParserInputRead();
15243 test_ret += test_xmlPedanticParserDefault();
15244 test_ret += test_xmlReadDoc();
15245 test_ret += test_xmlReadFile();
15246 test_ret += test_xmlReadMemory();
15247 test_ret += test_xmlRecoverDoc();
15248 test_ret += test_xmlRecoverFile();
15249 test_ret += test_xmlRecoverMemory();
15250 test_ret += test_xmlSAXParseDTD();
15251 test_ret += test_xmlSAXParseDoc();
15252 test_ret += test_xmlSAXParseEntity();
15253 test_ret += test_xmlSAXParseFile();
15254 test_ret += test_xmlSAXParseFileWithData();
15255 test_ret += test_xmlSAXParseMemory();
15256 test_ret += test_xmlSAXParseMemoryWithData();
15257 test_ret += test_xmlSAXUserParseFile();
15258 test_ret += test_xmlSAXUserParseMemory();
15259 test_ret += test_xmlSetExternalEntityLoader();
15260 test_ret += test_xmlSetFeature();
15261 test_ret += test_xmlSetupParserForBuffer();
15262 test_ret += test_xmlStopParser();
15263 test_ret += test_xmlSubstituteEntitiesDefault();
Daniel Veillardd93f6252004-11-02 15:53:51 +000015264
Daniel Veillard42595322004-11-08 10:52:06 +000015265 if (test_ret != 0)
15266 printf("Module parser: %d errors\n", test_ret);
15267 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015268}
15269
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015270static int
15271test_htmlCreateFileParserCtxt(void) {
15272 int test_ret = 0;
15273
15274#ifdef LIBXML_HTML_ENABLED
15275 int mem_base;
15276 htmlParserCtxtPtr ret_val;
15277 const char * filename; /* the filename */
15278 int n_filename;
15279 char * encoding; /* a free form C string describing the HTML document encoding, or NULL */
15280 int n_encoding;
15281
15282 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
15283 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
15284 mem_base = xmlMemBlocks();
15285 filename = gen_fileoutput(n_filename, 0);
15286 encoding = gen_const_char_ptr(n_encoding, 1);
15287
William M. Brackf13f77f2004-11-12 16:03:48 +000015288 ret_val = htmlCreateFileParserCtxt(filename, (const char *)encoding);
Daniel Veillarda521d282004-11-09 14:59:59 +000015289 desret_htmlParserCtxtPtr(ret_val);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015290 call_tests++;
15291 des_fileoutput(n_filename, filename, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000015292 des_const_char_ptr(n_encoding, (const char *)encoding, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015293 xmlResetLastError();
15294 if (mem_base != xmlMemBlocks()) {
15295 printf("Leak of %d blocks found in htmlCreateFileParserCtxt",
15296 xmlMemBlocks() - mem_base);
15297 test_ret++;
15298 printf(" %d", n_filename);
15299 printf(" %d", n_encoding);
15300 printf("\n");
15301 }
15302 }
15303 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015304 function_tests++;
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015305#endif
15306
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015307 return(test_ret);
15308}
15309
15310
15311static int
15312test_htmlInitAutoClose(void) {
15313 int test_ret = 0;
15314
15315#ifdef LIBXML_HTML_ENABLED
15316 int mem_base;
15317
15318 mem_base = xmlMemBlocks();
15319
15320 htmlInitAutoClose();
15321 call_tests++;
15322 xmlResetLastError();
15323 if (mem_base != xmlMemBlocks()) {
15324 printf("Leak of %d blocks found in htmlInitAutoClose",
15325 xmlMemBlocks() - mem_base);
15326 test_ret++;
15327 printf("\n");
15328 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015329 function_tests++;
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015330#endif
15331
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015332 return(test_ret);
15333}
15334
15335
15336static int
15337test_inputPop(void) {
15338 int test_ret = 0;
15339
15340 int mem_base;
15341 xmlParserInputPtr ret_val;
15342 xmlParserCtxtPtr ctxt; /* an XML parser context */
15343 int n_ctxt;
15344
15345 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15346 mem_base = xmlMemBlocks();
15347 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15348
15349 ret_val = inputPop(ctxt);
15350 desret_xmlParserInputPtr(ret_val);
15351 call_tests++;
15352 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15353 xmlResetLastError();
15354 if (mem_base != xmlMemBlocks()) {
15355 printf("Leak of %d blocks found in inputPop",
15356 xmlMemBlocks() - mem_base);
15357 test_ret++;
15358 printf(" %d", n_ctxt);
15359 printf("\n");
15360 }
15361 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015362 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015363
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015364 return(test_ret);
15365}
15366
15367
15368static int
15369test_inputPush(void) {
15370 int test_ret = 0;
15371
15372 int mem_base;
15373 int ret_val;
15374 xmlParserCtxtPtr ctxt; /* an XML parser context */
15375 int n_ctxt;
15376 xmlParserInputPtr value; /* the parser input */
15377 int n_value;
15378
15379 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15380 for (n_value = 0;n_value < gen_nb_xmlParserInputPtr;n_value++) {
15381 mem_base = xmlMemBlocks();
15382 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15383 value = gen_xmlParserInputPtr(n_value, 1);
15384
15385 ret_val = inputPush(ctxt, value);
15386 desret_int(ret_val);
15387 call_tests++;
15388 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15389 des_xmlParserInputPtr(n_value, value, 1);
15390 xmlResetLastError();
15391 if (mem_base != xmlMemBlocks()) {
15392 printf("Leak of %d blocks found in inputPush",
15393 xmlMemBlocks() - mem_base);
15394 test_ret++;
15395 printf(" %d", n_ctxt);
15396 printf(" %d", n_value);
15397 printf("\n");
15398 }
15399 }
15400 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015401 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015402
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015403 return(test_ret);
15404}
15405
15406
15407static int
15408test_namePop(void) {
15409 int test_ret = 0;
15410
15411 int mem_base;
15412 const xmlChar * ret_val;
15413 xmlParserCtxtPtr ctxt; /* an XML parser context */
15414 int n_ctxt;
15415
15416 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15417 mem_base = xmlMemBlocks();
15418 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15419
15420 ret_val = namePop(ctxt);
15421 desret_const_xmlChar_ptr(ret_val);
15422 call_tests++;
15423 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15424 xmlResetLastError();
15425 if (mem_base != xmlMemBlocks()) {
15426 printf("Leak of %d blocks found in namePop",
15427 xmlMemBlocks() - mem_base);
15428 test_ret++;
15429 printf(" %d", n_ctxt);
15430 printf("\n");
15431 }
15432 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015433 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015434
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015435 return(test_ret);
15436}
15437
15438
15439static int
15440test_namePush(void) {
15441 int test_ret = 0;
15442
15443 int mem_base;
15444 int ret_val;
15445 xmlParserCtxtPtr ctxt; /* an XML parser context */
15446 int n_ctxt;
15447 xmlChar * value; /* the element name */
15448 int n_value;
15449
15450 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15451 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
15452 mem_base = xmlMemBlocks();
15453 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15454 value = gen_const_xmlChar_ptr(n_value, 1);
15455
William M. Brackf13f77f2004-11-12 16:03:48 +000015456 ret_val = namePush(ctxt, (const xmlChar *)value);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015457 desret_int(ret_val);
15458 call_tests++;
15459 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000015460 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015461 xmlResetLastError();
15462 if (mem_base != xmlMemBlocks()) {
15463 printf("Leak of %d blocks found in namePush",
15464 xmlMemBlocks() - mem_base);
15465 test_ret++;
15466 printf(" %d", n_ctxt);
15467 printf(" %d", n_value);
15468 printf("\n");
15469 }
15470 }
15471 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015472 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015473
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015474 return(test_ret);
15475}
15476
15477
15478static int
15479test_nodePop(void) {
15480 int test_ret = 0;
15481
15482 int mem_base;
15483 xmlNodePtr ret_val;
15484 xmlParserCtxtPtr ctxt; /* an XML parser context */
15485 int n_ctxt;
15486
15487 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15488 mem_base = xmlMemBlocks();
15489 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15490
15491 ret_val = nodePop(ctxt);
15492 desret_xmlNodePtr(ret_val);
15493 call_tests++;
15494 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15495 xmlResetLastError();
15496 if (mem_base != xmlMemBlocks()) {
15497 printf("Leak of %d blocks found in nodePop",
15498 xmlMemBlocks() - mem_base);
15499 test_ret++;
15500 printf(" %d", n_ctxt);
15501 printf("\n");
15502 }
15503 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015504 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015505
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015506 return(test_ret);
15507}
15508
15509
15510static int
15511test_nodePush(void) {
15512 int test_ret = 0;
15513
15514 int mem_base;
15515 int ret_val;
15516 xmlParserCtxtPtr ctxt; /* an XML parser context */
15517 int n_ctxt;
15518 xmlNodePtr value; /* the element node */
15519 int n_value;
15520
15521 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15522 for (n_value = 0;n_value < gen_nb_xmlNodePtr;n_value++) {
15523 mem_base = xmlMemBlocks();
15524 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15525 value = gen_xmlNodePtr(n_value, 1);
15526
15527 ret_val = nodePush(ctxt, value);
15528 desret_int(ret_val);
15529 call_tests++;
15530 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15531 des_xmlNodePtr(n_value, value, 1);
15532 xmlResetLastError();
15533 if (mem_base != xmlMemBlocks()) {
15534 printf("Leak of %d blocks found in nodePush",
15535 xmlMemBlocks() - mem_base);
15536 test_ret++;
15537 printf(" %d", n_ctxt);
15538 printf(" %d", n_value);
15539 printf("\n");
15540 }
15541 }
15542 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015543 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015544
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015545 return(test_ret);
15546}
15547
15548
15549static int
15550test_xmlCheckLanguageID(void) {
15551 int test_ret = 0;
15552
15553 int mem_base;
15554 int ret_val;
15555 xmlChar * lang; /* pointer to the string value */
15556 int n_lang;
15557
15558 for (n_lang = 0;n_lang < gen_nb_const_xmlChar_ptr;n_lang++) {
15559 mem_base = xmlMemBlocks();
15560 lang = gen_const_xmlChar_ptr(n_lang, 0);
15561
William M. Brackf13f77f2004-11-12 16:03:48 +000015562 ret_val = xmlCheckLanguageID((const xmlChar *)lang);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015563 desret_int(ret_val);
15564 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000015565 des_const_xmlChar_ptr(n_lang, (const xmlChar *)lang, 0);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015566 xmlResetLastError();
15567 if (mem_base != xmlMemBlocks()) {
15568 printf("Leak of %d blocks found in xmlCheckLanguageID",
15569 xmlMemBlocks() - mem_base);
15570 test_ret++;
15571 printf(" %d", n_lang);
15572 printf("\n");
15573 }
15574 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015575 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015576
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015577 return(test_ret);
15578}
15579
15580
15581static int
15582test_xmlCopyChar(void) {
15583 int test_ret = 0;
15584
15585 int mem_base;
15586 int ret_val;
15587 int len; /* Ignored, compatibility */
15588 int n_len;
15589 xmlChar * out; /* pointer to an array of xmlChar */
15590 int n_out;
15591 int val; /* the char value */
15592 int n_val;
15593
15594 for (n_len = 0;n_len < gen_nb_int;n_len++) {
15595 for (n_out = 0;n_out < gen_nb_xmlChar_ptr;n_out++) {
15596 for (n_val = 0;n_val < gen_nb_int;n_val++) {
15597 mem_base = xmlMemBlocks();
15598 len = gen_int(n_len, 0);
15599 out = gen_xmlChar_ptr(n_out, 1);
15600 val = gen_int(n_val, 2);
15601
15602 ret_val = xmlCopyChar(len, out, val);
15603 desret_int(ret_val);
15604 call_tests++;
15605 des_int(n_len, len, 0);
15606 des_xmlChar_ptr(n_out, out, 1);
15607 des_int(n_val, val, 2);
15608 xmlResetLastError();
15609 if (mem_base != xmlMemBlocks()) {
15610 printf("Leak of %d blocks found in xmlCopyChar",
15611 xmlMemBlocks() - mem_base);
15612 test_ret++;
15613 printf(" %d", n_len);
15614 printf(" %d", n_out);
15615 printf(" %d", n_val);
15616 printf("\n");
15617 }
15618 }
15619 }
15620 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015621 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015622
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015623 return(test_ret);
15624}
15625
15626
15627static int
15628test_xmlCopyCharMultiByte(void) {
15629 int test_ret = 0;
15630
15631 int mem_base;
15632 int ret_val;
15633 xmlChar * out; /* pointer to an array of xmlChar */
15634 int n_out;
15635 int val; /* the char value */
15636 int n_val;
15637
15638 for (n_out = 0;n_out < gen_nb_xmlChar_ptr;n_out++) {
15639 for (n_val = 0;n_val < gen_nb_int;n_val++) {
15640 mem_base = xmlMemBlocks();
15641 out = gen_xmlChar_ptr(n_out, 0);
15642 val = gen_int(n_val, 1);
15643
15644 ret_val = xmlCopyCharMultiByte(out, val);
15645 desret_int(ret_val);
15646 call_tests++;
15647 des_xmlChar_ptr(n_out, out, 0);
15648 des_int(n_val, val, 1);
15649 xmlResetLastError();
15650 if (mem_base != xmlMemBlocks()) {
15651 printf("Leak of %d blocks found in xmlCopyCharMultiByte",
15652 xmlMemBlocks() - mem_base);
15653 test_ret++;
15654 printf(" %d", n_out);
15655 printf(" %d", n_val);
15656 printf("\n");
15657 }
15658 }
15659 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015660 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015661
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015662 return(test_ret);
15663}
15664
15665
15666static int
15667test_xmlCreateEntityParserCtxt(void) {
15668 int test_ret = 0;
15669
15670 int mem_base;
15671 xmlParserCtxtPtr ret_val;
15672 xmlChar * URL; /* the entity URL */
15673 int n_URL;
15674 xmlChar * ID; /* the entity PUBLIC ID */
15675 int n_ID;
15676 xmlChar * base; /* a possible base for the target URI */
15677 int n_base;
15678
15679 for (n_URL = 0;n_URL < gen_nb_const_xmlChar_ptr;n_URL++) {
15680 for (n_ID = 0;n_ID < gen_nb_const_xmlChar_ptr;n_ID++) {
15681 for (n_base = 0;n_base < gen_nb_const_xmlChar_ptr;n_base++) {
15682 mem_base = xmlMemBlocks();
15683 URL = gen_const_xmlChar_ptr(n_URL, 0);
15684 ID = gen_const_xmlChar_ptr(n_ID, 1);
15685 base = gen_const_xmlChar_ptr(n_base, 2);
15686
William M. Brackf13f77f2004-11-12 16:03:48 +000015687 ret_val = xmlCreateEntityParserCtxt((const xmlChar *)URL, (const xmlChar *)ID, (const xmlChar *)base);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015688 desret_xmlParserCtxtPtr(ret_val);
15689 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000015690 des_const_xmlChar_ptr(n_URL, (const xmlChar *)URL, 0);
15691 des_const_xmlChar_ptr(n_ID, (const xmlChar *)ID, 1);
15692 des_const_xmlChar_ptr(n_base, (const xmlChar *)base, 2);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015693 xmlResetLastError();
15694 if (mem_base != xmlMemBlocks()) {
15695 printf("Leak of %d blocks found in xmlCreateEntityParserCtxt",
15696 xmlMemBlocks() - mem_base);
15697 test_ret++;
15698 printf(" %d", n_URL);
15699 printf(" %d", n_ID);
15700 printf(" %d", n_base);
15701 printf("\n");
15702 }
15703 }
15704 }
15705 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015706 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015707
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015708 return(test_ret);
15709}
15710
15711
15712static int
15713test_xmlCreateFileParserCtxt(void) {
15714 int test_ret = 0;
15715
15716 int mem_base;
15717 xmlParserCtxtPtr ret_val;
15718 const char * filename; /* the filename */
15719 int n_filename;
15720
15721 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
15722 mem_base = xmlMemBlocks();
15723 filename = gen_fileoutput(n_filename, 0);
15724
15725 ret_val = xmlCreateFileParserCtxt(filename);
15726 desret_xmlParserCtxtPtr(ret_val);
15727 call_tests++;
15728 des_fileoutput(n_filename, filename, 0);
15729 xmlResetLastError();
15730 if (mem_base != xmlMemBlocks()) {
15731 printf("Leak of %d blocks found in xmlCreateFileParserCtxt",
15732 xmlMemBlocks() - mem_base);
15733 test_ret++;
15734 printf(" %d", n_filename);
15735 printf("\n");
15736 }
15737 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015738 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015739
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015740 return(test_ret);
15741}
15742
15743
15744static int
15745test_xmlCreateMemoryParserCtxt(void) {
15746 int test_ret = 0;
15747
15748 int mem_base;
15749 xmlParserCtxtPtr ret_val;
15750 char * buffer; /* a pointer to a char array */
15751 int n_buffer;
15752 int size; /* the size of the array */
15753 int n_size;
15754
15755 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
15756 for (n_size = 0;n_size < gen_nb_int;n_size++) {
15757 mem_base = xmlMemBlocks();
15758 buffer = gen_const_char_ptr(n_buffer, 0);
15759 size = gen_int(n_size, 1);
15760
William M. Brackf13f77f2004-11-12 16:03:48 +000015761 ret_val = xmlCreateMemoryParserCtxt((const char *)buffer, size);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015762 desret_xmlParserCtxtPtr(ret_val);
15763 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000015764 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015765 des_int(n_size, size, 1);
15766 xmlResetLastError();
15767 if (mem_base != xmlMemBlocks()) {
15768 printf("Leak of %d blocks found in xmlCreateMemoryParserCtxt",
15769 xmlMemBlocks() - mem_base);
15770 test_ret++;
15771 printf(" %d", n_buffer);
15772 printf(" %d", n_size);
15773 printf("\n");
15774 }
15775 }
15776 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015777 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015778
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015779 return(test_ret);
15780}
15781
15782
15783static int
15784test_xmlCreateURLParserCtxt(void) {
15785 int test_ret = 0;
15786
15787 int mem_base;
15788 xmlParserCtxtPtr ret_val;
15789 const char * filename; /* the filename or URL */
15790 int n_filename;
15791 int options; /* a combination of xmlParserOption */
15792 int n_options;
15793
15794 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
15795 for (n_options = 0;n_options < gen_nb_int;n_options++) {
15796 mem_base = xmlMemBlocks();
15797 filename = gen_fileoutput(n_filename, 0);
15798 options = gen_int(n_options, 1);
15799
15800 ret_val = xmlCreateURLParserCtxt(filename, options);
15801 desret_xmlParserCtxtPtr(ret_val);
15802 call_tests++;
15803 des_fileoutput(n_filename, filename, 0);
15804 des_int(n_options, options, 1);
15805 xmlResetLastError();
15806 if (mem_base != xmlMemBlocks()) {
15807 printf("Leak of %d blocks found in xmlCreateURLParserCtxt",
15808 xmlMemBlocks() - mem_base);
15809 test_ret++;
15810 printf(" %d", n_filename);
15811 printf(" %d", n_options);
15812 printf("\n");
15813 }
15814 }
15815 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015816 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015817
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015818 return(test_ret);
15819}
15820
15821
15822static int
15823test_xmlCurrentChar(void) {
15824 int test_ret = 0;
15825
15826 int mem_base;
15827 int ret_val;
15828 xmlParserCtxtPtr ctxt; /* the XML parser context */
15829 int n_ctxt;
15830 int * len; /* pointer to the length of the char read */
15831 int n_len;
15832
15833 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15834 for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
15835 mem_base = xmlMemBlocks();
15836 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15837 len = gen_int_ptr(n_len, 1);
15838
15839 ret_val = xmlCurrentChar(ctxt, len);
15840 desret_int(ret_val);
15841 call_tests++;
15842 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15843 des_int_ptr(n_len, len, 1);
15844 xmlResetLastError();
15845 if (mem_base != xmlMemBlocks()) {
15846 printf("Leak of %d blocks found in xmlCurrentChar",
15847 xmlMemBlocks() - mem_base);
15848 test_ret++;
15849 printf(" %d", n_ctxt);
15850 printf(" %d", n_len);
15851 printf("\n");
15852 }
15853 }
15854 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015855 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015856
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015857 return(test_ret);
15858}
15859
15860
15861static int
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015862test_xmlErrMemory(void) {
15863 int test_ret = 0;
15864
15865 int mem_base;
15866 xmlParserCtxtPtr ctxt; /* an XML parser context */
15867 int n_ctxt;
15868 char * extra; /* extra informations */
15869 int n_extra;
15870
15871 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15872 for (n_extra = 0;n_extra < gen_nb_const_char_ptr;n_extra++) {
15873 mem_base = xmlMemBlocks();
15874 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15875 extra = gen_const_char_ptr(n_extra, 1);
15876
William M. Brackf13f77f2004-11-12 16:03:48 +000015877 xmlErrMemory(ctxt, (const char *)extra);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015878 call_tests++;
15879 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000015880 des_const_char_ptr(n_extra, (const char *)extra, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015881 xmlResetLastError();
15882 if (mem_base != xmlMemBlocks()) {
15883 printf("Leak of %d blocks found in xmlErrMemory",
15884 xmlMemBlocks() - mem_base);
15885 test_ret++;
15886 printf(" %d", n_ctxt);
15887 printf(" %d", n_extra);
15888 printf("\n");
15889 }
15890 }
15891 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015892 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015893
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015894 return(test_ret);
15895}
15896
15897
15898static int
15899test_xmlIsLetter(void) {
15900 int test_ret = 0;
15901
15902 int mem_base;
15903 int ret_val;
15904 int c; /* an unicode character (int) */
15905 int n_c;
15906
15907 for (n_c = 0;n_c < gen_nb_int;n_c++) {
15908 mem_base = xmlMemBlocks();
15909 c = gen_int(n_c, 0);
15910
15911 ret_val = xmlIsLetter(c);
15912 desret_int(ret_val);
15913 call_tests++;
15914 des_int(n_c, c, 0);
15915 xmlResetLastError();
15916 if (mem_base != xmlMemBlocks()) {
15917 printf("Leak of %d blocks found in xmlIsLetter",
15918 xmlMemBlocks() - mem_base);
15919 test_ret++;
15920 printf(" %d", n_c);
15921 printf("\n");
15922 }
15923 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015924 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015925
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015926 return(test_ret);
15927}
15928
15929
15930static int
15931test_xmlNewEntityInputStream(void) {
15932 int test_ret = 0;
15933
15934 int mem_base;
15935 xmlParserInputPtr ret_val;
15936 xmlParserCtxtPtr ctxt; /* an XML parser context */
15937 int n_ctxt;
15938 xmlEntityPtr entity; /* an Entity pointer */
15939 int n_entity;
15940
15941 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15942 for (n_entity = 0;n_entity < gen_nb_xmlEntityPtr;n_entity++) {
15943 mem_base = xmlMemBlocks();
15944 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15945 entity = gen_xmlEntityPtr(n_entity, 1);
15946
15947 ret_val = xmlNewEntityInputStream(ctxt, entity);
15948 desret_xmlParserInputPtr(ret_val);
15949 call_tests++;
15950 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15951 des_xmlEntityPtr(n_entity, entity, 1);
15952 xmlResetLastError();
15953 if (mem_base != xmlMemBlocks()) {
15954 printf("Leak of %d blocks found in xmlNewEntityInputStream",
15955 xmlMemBlocks() - mem_base);
15956 test_ret++;
15957 printf(" %d", n_ctxt);
15958 printf(" %d", n_entity);
15959 printf("\n");
15960 }
15961 }
15962 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015963 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015964
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015965 return(test_ret);
15966}
15967
15968
15969static int
15970test_xmlNewInputFromFile(void) {
15971 int test_ret = 0;
15972
15973 int mem_base;
15974 xmlParserInputPtr ret_val;
15975 xmlParserCtxtPtr ctxt; /* an XML parser context */
15976 int n_ctxt;
15977 const char * filename; /* the filename to use as entity */
15978 int n_filename;
15979
15980 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15981 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
15982 mem_base = xmlMemBlocks();
15983 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15984 filename = gen_filepath(n_filename, 1);
15985
15986 ret_val = xmlNewInputFromFile(ctxt, filename);
15987 desret_xmlParserInputPtr(ret_val);
15988 call_tests++;
15989 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15990 des_filepath(n_filename, filename, 1);
15991 xmlResetLastError();
15992 if (mem_base != xmlMemBlocks()) {
15993 printf("Leak of %d blocks found in xmlNewInputFromFile",
15994 xmlMemBlocks() - mem_base);
15995 test_ret++;
15996 printf(" %d", n_ctxt);
15997 printf(" %d", n_filename);
15998 printf("\n");
15999 }
16000 }
16001 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016002 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016003
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016004 return(test_ret);
16005}
16006
16007
16008static int
16009test_xmlNewInputStream(void) {
16010 int test_ret = 0;
16011
16012 int mem_base;
16013 xmlParserInputPtr ret_val;
16014 xmlParserCtxtPtr ctxt; /* an XML parser context */
16015 int n_ctxt;
16016
16017 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16018 mem_base = xmlMemBlocks();
16019 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16020
16021 ret_val = xmlNewInputStream(ctxt);
16022 desret_xmlParserInputPtr(ret_val);
16023 call_tests++;
16024 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16025 xmlResetLastError();
16026 if (mem_base != xmlMemBlocks()) {
16027 printf("Leak of %d blocks found in xmlNewInputStream",
16028 xmlMemBlocks() - mem_base);
16029 test_ret++;
16030 printf(" %d", n_ctxt);
16031 printf("\n");
16032 }
16033 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016034 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016035
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016036 return(test_ret);
16037}
16038
16039
16040static int
16041test_xmlNewStringInputStream(void) {
16042 int test_ret = 0;
16043
16044 int mem_base;
16045 xmlParserInputPtr ret_val;
16046 xmlParserCtxtPtr ctxt; /* an XML parser context */
16047 int n_ctxt;
16048 xmlChar * buffer; /* an memory buffer */
16049 int n_buffer;
16050
16051 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16052 for (n_buffer = 0;n_buffer < gen_nb_const_xmlChar_ptr;n_buffer++) {
16053 mem_base = xmlMemBlocks();
16054 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16055 buffer = gen_const_xmlChar_ptr(n_buffer, 1);
16056
William M. Brackf13f77f2004-11-12 16:03:48 +000016057 ret_val = xmlNewStringInputStream(ctxt, (const xmlChar *)buffer);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016058 desret_xmlParserInputPtr(ret_val);
16059 call_tests++;
16060 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000016061 des_const_xmlChar_ptr(n_buffer, (const xmlChar *)buffer, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016062 xmlResetLastError();
16063 if (mem_base != xmlMemBlocks()) {
16064 printf("Leak of %d blocks found in xmlNewStringInputStream",
16065 xmlMemBlocks() - mem_base);
16066 test_ret++;
16067 printf(" %d", n_ctxt);
16068 printf(" %d", n_buffer);
16069 printf("\n");
16070 }
16071 }
16072 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016073 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016074
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016075 return(test_ret);
16076}
16077
16078
16079static int
16080test_xmlNextChar(void) {
16081 int test_ret = 0;
16082
16083 int mem_base;
16084 xmlParserCtxtPtr ctxt; /* the XML parser context */
16085 int n_ctxt;
16086
16087 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16088 mem_base = xmlMemBlocks();
16089 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16090
16091 xmlNextChar(ctxt);
16092 call_tests++;
16093 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16094 xmlResetLastError();
16095 if (mem_base != xmlMemBlocks()) {
16096 printf("Leak of %d blocks found in xmlNextChar",
16097 xmlMemBlocks() - mem_base);
16098 test_ret++;
16099 printf(" %d", n_ctxt);
16100 printf("\n");
16101 }
16102 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016103 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016104
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016105 return(test_ret);
16106}
16107
16108
16109static int
16110test_xmlParserInputShrink(void) {
16111 int test_ret = 0;
16112
16113 int mem_base;
16114 xmlParserInputPtr in; /* an XML parser input */
16115 int n_in;
16116
16117 for (n_in = 0;n_in < gen_nb_xmlParserInputPtr;n_in++) {
16118 mem_base = xmlMemBlocks();
16119 in = gen_xmlParserInputPtr(n_in, 0);
16120
16121 xmlParserInputShrink(in);
16122 call_tests++;
16123 des_xmlParserInputPtr(n_in, in, 0);
16124 xmlResetLastError();
16125 if (mem_base != xmlMemBlocks()) {
16126 printf("Leak of %d blocks found in xmlParserInputShrink",
16127 xmlMemBlocks() - mem_base);
16128 test_ret++;
16129 printf(" %d", n_in);
16130 printf("\n");
16131 }
16132 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016133 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016134
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016135 return(test_ret);
16136}
16137
16138
16139static int
16140test_xmlPopInput(void) {
16141 int test_ret = 0;
16142
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016143 int mem_base;
16144 xmlChar ret_val;
16145 xmlParserCtxtPtr ctxt; /* an XML parser context */
16146 int n_ctxt;
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016147
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016148 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16149 mem_base = xmlMemBlocks();
16150 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16151
16152 ret_val = xmlPopInput(ctxt);
16153 desret_xmlChar(ret_val);
16154 call_tests++;
16155 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16156 xmlResetLastError();
16157 if (mem_base != xmlMemBlocks()) {
16158 printf("Leak of %d blocks found in xmlPopInput",
16159 xmlMemBlocks() - mem_base);
16160 test_ret++;
16161 printf(" %d", n_ctxt);
16162 printf("\n");
16163 }
16164 }
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016165 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016166
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016167 return(test_ret);
16168}
16169
16170
16171static int
16172test_xmlPushInput(void) {
16173 int test_ret = 0;
16174
16175 int mem_base;
16176 xmlParserCtxtPtr ctxt; /* an XML parser context */
16177 int n_ctxt;
16178 xmlParserInputPtr input; /* an XML parser input fragment (entity, XML fragment ...). */
16179 int n_input;
16180
16181 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16182 for (n_input = 0;n_input < gen_nb_xmlParserInputPtr;n_input++) {
16183 mem_base = xmlMemBlocks();
16184 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16185 input = gen_xmlParserInputPtr(n_input, 1);
16186
16187 xmlPushInput(ctxt, input);
16188 call_tests++;
16189 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16190 des_xmlParserInputPtr(n_input, input, 1);
16191 xmlResetLastError();
16192 if (mem_base != xmlMemBlocks()) {
16193 printf("Leak of %d blocks found in xmlPushInput",
16194 xmlMemBlocks() - mem_base);
16195 test_ret++;
16196 printf(" %d", n_ctxt);
16197 printf(" %d", n_input);
16198 printf("\n");
16199 }
16200 }
16201 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016202 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016203
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016204 return(test_ret);
16205}
16206
16207
16208static int
16209test_xmlSetEntityReferenceFunc(void) {
16210 int test_ret = 0;
16211
16212
16213 /* missing type support */
16214 return(test_ret);
16215}
16216
16217
16218static int
16219test_xmlSplitQName(void) {
16220 int test_ret = 0;
16221
16222 int mem_base;
16223 xmlChar * ret_val;
16224 xmlParserCtxtPtr ctxt; /* an XML parser context */
16225 int n_ctxt;
16226 xmlChar * name; /* an XML parser context */
16227 int n_name;
16228 xmlChar ** prefix; /* a xmlChar ** */
16229 int n_prefix;
16230
16231 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16232 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
16233 for (n_prefix = 0;n_prefix < gen_nb_xmlChar_ptr_ptr;n_prefix++) {
16234 mem_base = xmlMemBlocks();
16235 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16236 name = gen_const_xmlChar_ptr(n_name, 1);
16237 prefix = gen_xmlChar_ptr_ptr(n_prefix, 2);
16238
William M. Brackf13f77f2004-11-12 16:03:48 +000016239 ret_val = xmlSplitQName(ctxt, (const xmlChar *)name, prefix);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016240 desret_xmlChar_ptr(ret_val);
16241 call_tests++;
16242 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000016243 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016244 des_xmlChar_ptr_ptr(n_prefix, prefix, 2);
16245 xmlResetLastError();
16246 if (mem_base != xmlMemBlocks()) {
16247 printf("Leak of %d blocks found in xmlSplitQName",
16248 xmlMemBlocks() - mem_base);
16249 test_ret++;
16250 printf(" %d", n_ctxt);
16251 printf(" %d", n_name);
16252 printf(" %d", n_prefix);
16253 printf("\n");
16254 }
16255 }
16256 }
16257 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016258 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016259
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016260 return(test_ret);
16261}
16262
16263
16264static int
16265test_xmlStringCurrentChar(void) {
16266 int test_ret = 0;
16267
16268 int mem_base;
16269 int ret_val;
16270 xmlParserCtxtPtr ctxt; /* the XML parser context */
16271 int n_ctxt;
16272 xmlChar * cur; /* pointer to the beginning of the char */
16273 int n_cur;
16274 int * len; /* pointer to the length of the char read */
16275 int n_len;
16276
16277 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16278 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
16279 for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
16280 mem_base = xmlMemBlocks();
16281 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16282 cur = gen_const_xmlChar_ptr(n_cur, 1);
16283 len = gen_int_ptr(n_len, 2);
16284
William M. Brackf13f77f2004-11-12 16:03:48 +000016285 ret_val = xmlStringCurrentChar(ctxt, (const xmlChar *)cur, len);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016286 desret_int(ret_val);
16287 call_tests++;
16288 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000016289 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016290 des_int_ptr(n_len, len, 2);
16291 xmlResetLastError();
16292 if (mem_base != xmlMemBlocks()) {
16293 printf("Leak of %d blocks found in xmlStringCurrentChar",
16294 xmlMemBlocks() - mem_base);
16295 test_ret++;
16296 printf(" %d", n_ctxt);
16297 printf(" %d", n_cur);
16298 printf(" %d", n_len);
16299 printf("\n");
16300 }
16301 }
16302 }
16303 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016304 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016305
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016306 return(test_ret);
16307}
16308
16309
16310static int
16311test_xmlStringDecodeEntities(void) {
16312 int test_ret = 0;
16313
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016314 int mem_base;
16315 xmlChar * ret_val;
16316 xmlParserCtxtPtr ctxt; /* the parser context */
16317 int n_ctxt;
16318 xmlChar * str; /* the input string */
16319 int n_str;
16320 int what; /* combination of XML_SUBSTITUTE_REF and XML_SUBSTITUTE_PEREF */
16321 int n_what;
16322 xmlChar end; /* an end marker xmlChar, 0 if none */
16323 int n_end;
16324 xmlChar end2; /* an end marker xmlChar, 0 if none */
16325 int n_end2;
16326 xmlChar end3; /* an end marker xmlChar, 0 if none */
16327 int n_end3;
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016328
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016329 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16330 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
16331 for (n_what = 0;n_what < gen_nb_int;n_what++) {
16332 for (n_end = 0;n_end < gen_nb_xmlChar;n_end++) {
16333 for (n_end2 = 0;n_end2 < gen_nb_xmlChar;n_end2++) {
16334 for (n_end3 = 0;n_end3 < gen_nb_xmlChar;n_end3++) {
16335 mem_base = xmlMemBlocks();
16336 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16337 str = gen_const_xmlChar_ptr(n_str, 1);
16338 what = gen_int(n_what, 2);
16339 end = gen_xmlChar(n_end, 3);
16340 end2 = gen_xmlChar(n_end2, 4);
16341 end3 = gen_xmlChar(n_end3, 5);
16342
William M. Brackf13f77f2004-11-12 16:03:48 +000016343 ret_val = xmlStringDecodeEntities(ctxt, (const xmlChar *)str, what, end, end2, end3);
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016344 desret_xmlChar_ptr(ret_val);
16345 call_tests++;
16346 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000016347 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016348 des_int(n_what, what, 2);
16349 des_xmlChar(n_end, end, 3);
16350 des_xmlChar(n_end2, end2, 4);
16351 des_xmlChar(n_end3, end3, 5);
16352 xmlResetLastError();
16353 if (mem_base != xmlMemBlocks()) {
16354 printf("Leak of %d blocks found in xmlStringDecodeEntities",
16355 xmlMemBlocks() - mem_base);
16356 test_ret++;
16357 printf(" %d", n_ctxt);
16358 printf(" %d", n_str);
16359 printf(" %d", n_what);
16360 printf(" %d", n_end);
16361 printf(" %d", n_end2);
16362 printf(" %d", n_end3);
16363 printf("\n");
16364 }
16365 }
16366 }
16367 }
16368 }
16369 }
16370 }
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016371 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016372
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016373 return(test_ret);
16374}
16375
16376
16377static int
16378test_xmlStringLenDecodeEntities(void) {
16379 int test_ret = 0;
16380
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016381 int mem_base;
16382 xmlChar * ret_val;
16383 xmlParserCtxtPtr ctxt; /* the parser context */
16384 int n_ctxt;
16385 xmlChar * str; /* the input string */
16386 int n_str;
16387 int len; /* the string length */
16388 int n_len;
16389 int what; /* combination of XML_SUBSTITUTE_REF and XML_SUBSTITUTE_PEREF */
16390 int n_what;
16391 xmlChar end; /* an end marker xmlChar, 0 if none */
16392 int n_end;
16393 xmlChar end2; /* an end marker xmlChar, 0 if none */
16394 int n_end2;
16395 xmlChar end3; /* an end marker xmlChar, 0 if none */
16396 int n_end3;
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016397
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016398 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16399 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
16400 for (n_len = 0;n_len < gen_nb_int;n_len++) {
16401 for (n_what = 0;n_what < gen_nb_int;n_what++) {
16402 for (n_end = 0;n_end < gen_nb_xmlChar;n_end++) {
16403 for (n_end2 = 0;n_end2 < gen_nb_xmlChar;n_end2++) {
16404 for (n_end3 = 0;n_end3 < gen_nb_xmlChar;n_end3++) {
16405 mem_base = xmlMemBlocks();
16406 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16407 str = gen_const_xmlChar_ptr(n_str, 1);
16408 len = gen_int(n_len, 2);
16409 what = gen_int(n_what, 3);
16410 end = gen_xmlChar(n_end, 4);
16411 end2 = gen_xmlChar(n_end2, 5);
16412 end3 = gen_xmlChar(n_end3, 6);
16413
William M. Brackf13f77f2004-11-12 16:03:48 +000016414 ret_val = xmlStringLenDecodeEntities(ctxt, (const xmlChar *)str, len, what, end, end2, end3);
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016415 desret_xmlChar_ptr(ret_val);
16416 call_tests++;
16417 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000016418 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016419 des_int(n_len, len, 2);
16420 des_int(n_what, what, 3);
16421 des_xmlChar(n_end, end, 4);
16422 des_xmlChar(n_end2, end2, 5);
16423 des_xmlChar(n_end3, end3, 6);
16424 xmlResetLastError();
16425 if (mem_base != xmlMemBlocks()) {
16426 printf("Leak of %d blocks found in xmlStringLenDecodeEntities",
16427 xmlMemBlocks() - mem_base);
16428 test_ret++;
16429 printf(" %d", n_ctxt);
16430 printf(" %d", n_str);
16431 printf(" %d", n_len);
16432 printf(" %d", n_what);
16433 printf(" %d", n_end);
16434 printf(" %d", n_end2);
16435 printf(" %d", n_end3);
16436 printf("\n");
16437 }
16438 }
16439 }
16440 }
16441 }
16442 }
16443 }
16444 }
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016445 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016446
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016447 return(test_ret);
16448}
16449
16450
16451static int
16452test_xmlSwitchEncoding(void) {
16453 int test_ret = 0;
16454
16455 int mem_base;
16456 int ret_val;
16457 xmlParserCtxtPtr ctxt; /* the parser context */
16458 int n_ctxt;
16459 xmlCharEncoding enc; /* the encoding value (number) */
16460 int n_enc;
16461
16462 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16463 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
16464 mem_base = xmlMemBlocks();
16465 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16466 enc = gen_xmlCharEncoding(n_enc, 1);
16467
16468 ret_val = xmlSwitchEncoding(ctxt, enc);
16469 desret_int(ret_val);
16470 call_tests++;
16471 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16472 des_xmlCharEncoding(n_enc, enc, 1);
16473 xmlResetLastError();
16474 if (mem_base != xmlMemBlocks()) {
16475 printf("Leak of %d blocks found in xmlSwitchEncoding",
16476 xmlMemBlocks() - mem_base);
16477 test_ret++;
16478 printf(" %d", n_ctxt);
16479 printf(" %d", n_enc);
16480 printf("\n");
16481 }
16482 }
16483 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016484 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016485
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016486 return(test_ret);
16487}
16488
16489
16490static int
16491test_xmlSwitchInputEncoding(void) {
16492 int test_ret = 0;
16493
16494 int mem_base;
16495 int ret_val;
16496 xmlParserCtxtPtr ctxt; /* the parser context */
16497 int n_ctxt;
16498 xmlParserInputPtr input; /* the input stream */
16499 int n_input;
16500 xmlCharEncodingHandlerPtr handler; /* the encoding handler */
16501 int n_handler;
16502
16503 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16504 for (n_input = 0;n_input < gen_nb_xmlParserInputPtr;n_input++) {
16505 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandlerPtr;n_handler++) {
16506 mem_base = xmlMemBlocks();
16507 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16508 input = gen_xmlParserInputPtr(n_input, 1);
16509 handler = gen_xmlCharEncodingHandlerPtr(n_handler, 2);
16510
16511 ret_val = xmlSwitchInputEncoding(ctxt, input, handler);
16512 desret_int(ret_val);
16513 call_tests++;
16514 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16515 des_xmlParserInputPtr(n_input, input, 1);
16516 des_xmlCharEncodingHandlerPtr(n_handler, handler, 2);
16517 xmlResetLastError();
16518 if (mem_base != xmlMemBlocks()) {
16519 printf("Leak of %d blocks found in xmlSwitchInputEncoding",
16520 xmlMemBlocks() - mem_base);
16521 test_ret++;
16522 printf(" %d", n_ctxt);
16523 printf(" %d", n_input);
16524 printf(" %d", n_handler);
16525 printf("\n");
16526 }
16527 }
16528 }
16529 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016530 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016531
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016532 return(test_ret);
16533}
16534
16535
16536static int
16537test_xmlSwitchToEncoding(void) {
16538 int test_ret = 0;
16539
16540 int mem_base;
16541 int ret_val;
16542 xmlParserCtxtPtr ctxt; /* the parser context */
16543 int n_ctxt;
16544 xmlCharEncodingHandlerPtr handler; /* the encoding handler */
16545 int n_handler;
16546
16547 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16548 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandlerPtr;n_handler++) {
16549 mem_base = xmlMemBlocks();
16550 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16551 handler = gen_xmlCharEncodingHandlerPtr(n_handler, 1);
16552
16553 ret_val = xmlSwitchToEncoding(ctxt, handler);
16554 desret_int(ret_val);
16555 call_tests++;
16556 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16557 des_xmlCharEncodingHandlerPtr(n_handler, handler, 1);
16558 xmlResetLastError();
16559 if (mem_base != xmlMemBlocks()) {
16560 printf("Leak of %d blocks found in xmlSwitchToEncoding",
16561 xmlMemBlocks() - mem_base);
16562 test_ret++;
16563 printf(" %d", n_ctxt);
16564 printf(" %d", n_handler);
16565 printf("\n");
16566 }
16567 }
16568 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016569 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016570
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016571 return(test_ret);
16572}
16573
16574static int
16575test_parserInternals(void) {
16576 int test_ret = 0;
16577
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016578 if (quiet == 0) printf("Testing parserInternals : 33 of 90 functions ...\n");
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016579 test_ret += test_htmlCreateFileParserCtxt();
16580 test_ret += test_htmlInitAutoClose();
16581 test_ret += test_inputPop();
16582 test_ret += test_inputPush();
16583 test_ret += test_namePop();
16584 test_ret += test_namePush();
16585 test_ret += test_nodePop();
16586 test_ret += test_nodePush();
16587 test_ret += test_xmlCheckLanguageID();
16588 test_ret += test_xmlCopyChar();
16589 test_ret += test_xmlCopyCharMultiByte();
16590 test_ret += test_xmlCreateEntityParserCtxt();
16591 test_ret += test_xmlCreateFileParserCtxt();
16592 test_ret += test_xmlCreateMemoryParserCtxt();
16593 test_ret += test_xmlCreateURLParserCtxt();
16594 test_ret += test_xmlCurrentChar();
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016595 test_ret += test_xmlErrMemory();
16596 test_ret += test_xmlIsLetter();
16597 test_ret += test_xmlNewEntityInputStream();
16598 test_ret += test_xmlNewInputFromFile();
16599 test_ret += test_xmlNewInputStream();
16600 test_ret += test_xmlNewStringInputStream();
16601 test_ret += test_xmlNextChar();
16602 test_ret += test_xmlParserInputShrink();
16603 test_ret += test_xmlPopInput();
16604 test_ret += test_xmlPushInput();
16605 test_ret += test_xmlSetEntityReferenceFunc();
16606 test_ret += test_xmlSplitQName();
16607 test_ret += test_xmlStringCurrentChar();
16608 test_ret += test_xmlStringDecodeEntities();
16609 test_ret += test_xmlStringLenDecodeEntities();
16610 test_ret += test_xmlSwitchEncoding();
16611 test_ret += test_xmlSwitchInputEncoding();
16612 test_ret += test_xmlSwitchToEncoding();
16613
16614 if (test_ret != 0)
16615 printf("Module parserInternals: %d errors\n", test_ret);
16616 return(test_ret);
16617}
16618
Daniel Veillardd93f6252004-11-02 15:53:51 +000016619static int
16620test_xmlPatternMatch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016621 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016622
Daniel Veillardce682bc2004-11-05 17:22:25 +000016623#ifdef LIBXML_PATTERN_ENABLED
16624 int mem_base;
16625 int ret_val;
16626 xmlPatternPtr comp; /* the precompiled pattern */
16627 int n_comp;
16628 xmlNodePtr node; /* a node */
16629 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016630
Daniel Veillardce682bc2004-11-05 17:22:25 +000016631 for (n_comp = 0;n_comp < gen_nb_xmlPatternPtr;n_comp++) {
16632 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
16633 mem_base = xmlMemBlocks();
16634 comp = gen_xmlPatternPtr(n_comp, 0);
16635 node = gen_xmlNodePtr(n_node, 1);
16636
16637 ret_val = xmlPatternMatch(comp, node);
16638 desret_int(ret_val);
16639 call_tests++;
16640 des_xmlPatternPtr(n_comp, comp, 0);
16641 des_xmlNodePtr(n_node, node, 1);
16642 xmlResetLastError();
16643 if (mem_base != xmlMemBlocks()) {
16644 printf("Leak of %d blocks found in xmlPatternMatch",
16645 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000016646 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000016647 printf(" %d", n_comp);
16648 printf(" %d", n_node);
16649 printf("\n");
16650 }
16651 }
16652 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016653 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000016654#endif
16655
Daniel Veillard42595322004-11-08 10:52:06 +000016656 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016657}
16658
16659
16660static int
16661test_xmlPatterncompile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016662 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016663
16664
16665 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000016666 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016667}
16668
16669static int
16670test_pattern(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016671 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016672
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016673 if (quiet == 0) printf("Testing pattern : 1 of 4 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000016674 test_ret += test_xmlPatternMatch();
16675 test_ret += test_xmlPatterncompile();
Daniel Veillardd93f6252004-11-02 15:53:51 +000016676
Daniel Veillard42595322004-11-08 10:52:06 +000016677 if (test_ret != 0)
16678 printf("Module pattern: %d errors\n", test_ret);
16679 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016680}
Daniel Veillarda521d282004-11-09 14:59:59 +000016681#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000016682
Daniel Veillardce682bc2004-11-05 17:22:25 +000016683#define gen_nb_xmlRelaxNGPtr 1
16684static xmlRelaxNGPtr gen_xmlRelaxNGPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16685 return(NULL);
16686}
16687static void des_xmlRelaxNGPtr(int no ATTRIBUTE_UNUSED, xmlRelaxNGPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16688}
Daniel Veillarda521d282004-11-09 14:59:59 +000016689#endif
16690
Daniel Veillardce682bc2004-11-05 17:22:25 +000016691
Daniel Veillardd93f6252004-11-02 15:53:51 +000016692static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000016693test_xmlRelaxNGDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016694 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016695
Daniel Veillardce682bc2004-11-05 17:22:25 +000016696#ifdef LIBXML_SCHEMAS_ENABLED
16697#ifdef LIBXML_OUTPUT_ENABLED
16698 int mem_base;
16699 FILE * output; /* the file output */
16700 int n_output;
16701 xmlRelaxNGPtr schema; /* a schema structure */
16702 int n_schema;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016703
Daniel Veillardce682bc2004-11-05 17:22:25 +000016704 for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
16705 for (n_schema = 0;n_schema < gen_nb_xmlRelaxNGPtr;n_schema++) {
16706 mem_base = xmlMemBlocks();
16707 output = gen_FILE_ptr(n_output, 0);
16708 schema = gen_xmlRelaxNGPtr(n_schema, 1);
16709
16710 xmlRelaxNGDump(output, schema);
16711 call_tests++;
16712 des_FILE_ptr(n_output, output, 0);
16713 des_xmlRelaxNGPtr(n_schema, schema, 1);
16714 xmlResetLastError();
16715 if (mem_base != xmlMemBlocks()) {
16716 printf("Leak of %d blocks found in xmlRelaxNGDump",
16717 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000016718 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000016719 printf(" %d", n_output);
16720 printf(" %d", n_schema);
16721 printf("\n");
16722 }
16723 }
16724 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016725 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000016726#endif
16727#endif
16728
Daniel Veillard42595322004-11-08 10:52:06 +000016729 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016730}
16731
16732
16733static int
16734test_xmlRelaxNGDumpTree(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016735 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016736
Daniel Veillardce682bc2004-11-05 17:22:25 +000016737#ifdef LIBXML_SCHEMAS_ENABLED
16738#ifdef LIBXML_OUTPUT_ENABLED
16739 int mem_base;
16740 FILE * output; /* the file output */
16741 int n_output;
16742 xmlRelaxNGPtr schema; /* a schema structure */
16743 int n_schema;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016744
Daniel Veillardce682bc2004-11-05 17:22:25 +000016745 for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
16746 for (n_schema = 0;n_schema < gen_nb_xmlRelaxNGPtr;n_schema++) {
16747 mem_base = xmlMemBlocks();
16748 output = gen_FILE_ptr(n_output, 0);
16749 schema = gen_xmlRelaxNGPtr(n_schema, 1);
16750
16751 xmlRelaxNGDumpTree(output, schema);
16752 call_tests++;
16753 des_FILE_ptr(n_output, output, 0);
16754 des_xmlRelaxNGPtr(n_schema, schema, 1);
16755 xmlResetLastError();
16756 if (mem_base != xmlMemBlocks()) {
16757 printf("Leak of %d blocks found in xmlRelaxNGDumpTree",
16758 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000016759 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000016760 printf(" %d", n_output);
16761 printf(" %d", n_schema);
16762 printf("\n");
16763 }
16764 }
16765 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016766 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000016767#endif
16768#endif
16769
Daniel Veillard42595322004-11-08 10:52:06 +000016770 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016771}
16772
Daniel Veillarda521d282004-11-09 14:59:59 +000016773#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000016774
Daniel Veillardce682bc2004-11-05 17:22:25 +000016775#define gen_nb_xmlRelaxNGParserCtxtPtr 1
16776static xmlRelaxNGParserCtxtPtr gen_xmlRelaxNGParserCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16777 return(NULL);
16778}
16779static void des_xmlRelaxNGParserCtxtPtr(int no ATTRIBUTE_UNUSED, xmlRelaxNGParserCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16780}
Daniel Veillarda521d282004-11-09 14:59:59 +000016781#endif
16782
16783#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000016784
16785#define gen_nb_xmlRelaxNGValidityErrorFunc_ptr 1
16786static xmlRelaxNGValidityErrorFunc * gen_xmlRelaxNGValidityErrorFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16787 return(NULL);
16788}
16789static void des_xmlRelaxNGValidityErrorFunc_ptr(int no ATTRIBUTE_UNUSED, xmlRelaxNGValidityErrorFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16790}
Daniel Veillarda521d282004-11-09 14:59:59 +000016791#endif
16792
16793#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000016794
16795#define gen_nb_xmlRelaxNGValidityWarningFunc_ptr 1
16796static xmlRelaxNGValidityWarningFunc * gen_xmlRelaxNGValidityWarningFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16797 return(NULL);
16798}
16799static void des_xmlRelaxNGValidityWarningFunc_ptr(int no ATTRIBUTE_UNUSED, xmlRelaxNGValidityWarningFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16800}
Daniel Veillarda521d282004-11-09 14:59:59 +000016801#endif
16802
16803#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000016804
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000016805#define gen_nb_void_ptr_ptr 1
16806static void ** gen_void_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16807 return(NULL);
16808}
16809static void des_void_ptr_ptr(int no ATTRIBUTE_UNUSED, void ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16810}
Daniel Veillarda521d282004-11-09 14:59:59 +000016811#endif
16812
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000016813
Daniel Veillardd93f6252004-11-02 15:53:51 +000016814static int
16815test_xmlRelaxNGGetParserErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016816 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016817
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000016818#ifdef LIBXML_SCHEMAS_ENABLED
16819 int mem_base;
16820 int ret_val;
16821 xmlRelaxNGParserCtxtPtr ctxt; /* a Relax-NG validation context */
16822 int n_ctxt;
16823 xmlRelaxNGValidityErrorFunc * err; /* the error callback result */
16824 int n_err;
16825 xmlRelaxNGValidityWarningFunc * warn; /* the warning callback result */
16826 int n_warn;
16827 void ** ctx; /* contextual data for the callbacks result */
16828 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016829
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000016830 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGParserCtxtPtr;n_ctxt++) {
16831 for (n_err = 0;n_err < gen_nb_xmlRelaxNGValidityErrorFunc_ptr;n_err++) {
16832 for (n_warn = 0;n_warn < gen_nb_xmlRelaxNGValidityWarningFunc_ptr;n_warn++) {
16833 for (n_ctx = 0;n_ctx < gen_nb_void_ptr_ptr;n_ctx++) {
16834 mem_base = xmlMemBlocks();
16835 ctxt = gen_xmlRelaxNGParserCtxtPtr(n_ctxt, 0);
16836 err = gen_xmlRelaxNGValidityErrorFunc_ptr(n_err, 1);
16837 warn = gen_xmlRelaxNGValidityWarningFunc_ptr(n_warn, 2);
16838 ctx = gen_void_ptr_ptr(n_ctx, 3);
16839
16840 ret_val = xmlRelaxNGGetParserErrors(ctxt, err, warn, ctx);
16841 desret_int(ret_val);
16842 call_tests++;
16843 des_xmlRelaxNGParserCtxtPtr(n_ctxt, ctxt, 0);
16844 des_xmlRelaxNGValidityErrorFunc_ptr(n_err, err, 1);
16845 des_xmlRelaxNGValidityWarningFunc_ptr(n_warn, warn, 2);
16846 des_void_ptr_ptr(n_ctx, ctx, 3);
16847 xmlResetLastError();
16848 if (mem_base != xmlMemBlocks()) {
16849 printf("Leak of %d blocks found in xmlRelaxNGGetParserErrors",
16850 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000016851 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000016852 printf(" %d", n_ctxt);
16853 printf(" %d", n_err);
16854 printf(" %d", n_warn);
16855 printf(" %d", n_ctx);
16856 printf("\n");
16857 }
16858 }
16859 }
16860 }
16861 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016862 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000016863#endif
16864
Daniel Veillard42595322004-11-08 10:52:06 +000016865 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016866}
16867
Daniel Veillarda521d282004-11-09 14:59:59 +000016868#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000016869
Daniel Veillardce682bc2004-11-05 17:22:25 +000016870#define gen_nb_xmlRelaxNGValidCtxtPtr 1
16871static xmlRelaxNGValidCtxtPtr gen_xmlRelaxNGValidCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16872 return(NULL);
16873}
16874static void des_xmlRelaxNGValidCtxtPtr(int no ATTRIBUTE_UNUSED, xmlRelaxNGValidCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16875}
Daniel Veillarda521d282004-11-09 14:59:59 +000016876#endif
16877
Daniel Veillardce682bc2004-11-05 17:22:25 +000016878
Daniel Veillardd93f6252004-11-02 15:53:51 +000016879static int
16880test_xmlRelaxNGGetValidErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016881 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016882
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000016883#ifdef LIBXML_SCHEMAS_ENABLED
16884 int mem_base;
16885 int ret_val;
16886 xmlRelaxNGValidCtxtPtr ctxt; /* a Relax-NG validation context */
16887 int n_ctxt;
16888 xmlRelaxNGValidityErrorFunc * err; /* the error function result */
16889 int n_err;
16890 xmlRelaxNGValidityWarningFunc * warn; /* the warning function result */
16891 int n_warn;
16892 void ** ctx; /* the functions context result */
16893 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016894
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000016895 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
16896 for (n_err = 0;n_err < gen_nb_xmlRelaxNGValidityErrorFunc_ptr;n_err++) {
16897 for (n_warn = 0;n_warn < gen_nb_xmlRelaxNGValidityWarningFunc_ptr;n_warn++) {
16898 for (n_ctx = 0;n_ctx < gen_nb_void_ptr_ptr;n_ctx++) {
16899 mem_base = xmlMemBlocks();
16900 ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
16901 err = gen_xmlRelaxNGValidityErrorFunc_ptr(n_err, 1);
16902 warn = gen_xmlRelaxNGValidityWarningFunc_ptr(n_warn, 2);
16903 ctx = gen_void_ptr_ptr(n_ctx, 3);
16904
16905 ret_val = xmlRelaxNGGetValidErrors(ctxt, err, warn, ctx);
16906 desret_int(ret_val);
16907 call_tests++;
16908 des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
16909 des_xmlRelaxNGValidityErrorFunc_ptr(n_err, err, 1);
16910 des_xmlRelaxNGValidityWarningFunc_ptr(n_warn, warn, 2);
16911 des_void_ptr_ptr(n_ctx, ctx, 3);
16912 xmlResetLastError();
16913 if (mem_base != xmlMemBlocks()) {
16914 printf("Leak of %d blocks found in xmlRelaxNGGetValidErrors",
16915 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000016916 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000016917 printf(" %d", n_ctxt);
16918 printf(" %d", n_err);
16919 printf(" %d", n_warn);
16920 printf(" %d", n_ctx);
16921 printf("\n");
16922 }
16923 }
16924 }
16925 }
16926 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016927 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000016928#endif
16929
Daniel Veillard42595322004-11-08 10:52:06 +000016930 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016931}
16932
16933
16934static int
Daniel Veillard34099b42004-11-04 17:34:35 +000016935test_xmlRelaxNGInitTypes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016936 int test_ret = 0;
Daniel Veillard34099b42004-11-04 17:34:35 +000016937
16938#ifdef LIBXML_SCHEMAS_ENABLED
16939 int mem_base;
16940 int ret_val;
16941
16942 mem_base = xmlMemBlocks();
16943
16944 ret_val = xmlRelaxNGInitTypes();
16945 desret_int(ret_val);
16946 call_tests++;
16947 xmlResetLastError();
16948 if (mem_base != xmlMemBlocks()) {
16949 printf("Leak of %d blocks found in xmlRelaxNGInitTypes",
16950 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000016951 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000016952 printf("\n");
16953 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016954 function_tests++;
Daniel Veillard34099b42004-11-04 17:34:35 +000016955#endif
16956
Daniel Veillard42595322004-11-08 10:52:06 +000016957 return(test_ret);
Daniel Veillard34099b42004-11-04 17:34:35 +000016958}
16959
16960
16961static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000016962test_xmlRelaxNGNewDocParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016963 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016964
Daniel Veillard42595322004-11-08 10:52:06 +000016965#ifdef LIBXML_SCHEMAS_ENABLED
16966 int mem_base;
16967 xmlRelaxNGParserCtxtPtr ret_val;
16968 xmlDocPtr doc; /* a preparsed document tree */
16969 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016970
Daniel Veillard42595322004-11-08 10:52:06 +000016971 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
16972 mem_base = xmlMemBlocks();
16973 doc = gen_xmlDocPtr(n_doc, 0);
16974
16975 ret_val = xmlRelaxNGNewDocParserCtxt(doc);
16976 desret_xmlRelaxNGParserCtxtPtr(ret_val);
16977 call_tests++;
16978 des_xmlDocPtr(n_doc, doc, 0);
16979 xmlResetLastError();
16980 if (mem_base != xmlMemBlocks()) {
16981 printf("Leak of %d blocks found in xmlRelaxNGNewDocParserCtxt",
16982 xmlMemBlocks() - mem_base);
16983 test_ret++;
16984 printf(" %d", n_doc);
16985 printf("\n");
16986 }
16987 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016988 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000016989#endif
16990
Daniel Veillard42595322004-11-08 10:52:06 +000016991 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016992}
16993
16994
16995static int
16996test_xmlRelaxNGNewMemParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016997 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016998
Daniel Veillard42595322004-11-08 10:52:06 +000016999#ifdef LIBXML_SCHEMAS_ENABLED
17000 int mem_base;
17001 xmlRelaxNGParserCtxtPtr ret_val;
17002 char * buffer; /* a pointer to a char array containing the schemas */
17003 int n_buffer;
17004 int size; /* the size of the array */
17005 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017006
Daniel Veillard42595322004-11-08 10:52:06 +000017007 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
17008 for (n_size = 0;n_size < gen_nb_int;n_size++) {
17009 mem_base = xmlMemBlocks();
17010 buffer = gen_const_char_ptr(n_buffer, 0);
17011 size = gen_int(n_size, 1);
17012
William M. Brackf13f77f2004-11-12 16:03:48 +000017013 ret_val = xmlRelaxNGNewMemParserCtxt((const char *)buffer, size);
Daniel Veillard42595322004-11-08 10:52:06 +000017014 desret_xmlRelaxNGParserCtxtPtr(ret_val);
17015 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000017016 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard42595322004-11-08 10:52:06 +000017017 des_int(n_size, size, 1);
17018 xmlResetLastError();
17019 if (mem_base != xmlMemBlocks()) {
17020 printf("Leak of %d blocks found in xmlRelaxNGNewMemParserCtxt",
17021 xmlMemBlocks() - mem_base);
17022 test_ret++;
17023 printf(" %d", n_buffer);
17024 printf(" %d", n_size);
17025 printf("\n");
17026 }
17027 }
17028 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017029 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017030#endif
17031
Daniel Veillard42595322004-11-08 10:52:06 +000017032 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017033}
17034
17035
17036static int
17037test_xmlRelaxNGNewParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017038 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017039
Daniel Veillard42595322004-11-08 10:52:06 +000017040#ifdef LIBXML_SCHEMAS_ENABLED
17041 int mem_base;
17042 xmlRelaxNGParserCtxtPtr ret_val;
17043 char * URL; /* the location of the schema */
17044 int n_URL;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017045
Daniel Veillard42595322004-11-08 10:52:06 +000017046 for (n_URL = 0;n_URL < gen_nb_const_char_ptr;n_URL++) {
17047 mem_base = xmlMemBlocks();
17048 URL = gen_const_char_ptr(n_URL, 0);
17049
William M. Brackf13f77f2004-11-12 16:03:48 +000017050 ret_val = xmlRelaxNGNewParserCtxt((const char *)URL);
Daniel Veillard42595322004-11-08 10:52:06 +000017051 desret_xmlRelaxNGParserCtxtPtr(ret_val);
17052 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000017053 des_const_char_ptr(n_URL, (const char *)URL, 0);
Daniel Veillard42595322004-11-08 10:52:06 +000017054 xmlResetLastError();
17055 if (mem_base != xmlMemBlocks()) {
17056 printf("Leak of %d blocks found in xmlRelaxNGNewParserCtxt",
17057 xmlMemBlocks() - mem_base);
17058 test_ret++;
17059 printf(" %d", n_URL);
17060 printf("\n");
17061 }
17062 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017063 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017064#endif
17065
Daniel Veillard42595322004-11-08 10:52:06 +000017066 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017067}
17068
17069
17070static int
17071test_xmlRelaxNGNewValidCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017072 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017073
17074
17075 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000017076 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017077}
17078
17079
17080static int
17081test_xmlRelaxNGParse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017082 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017083
17084
17085 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000017086 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017087}
17088
17089
17090static int
17091test_xmlRelaxNGSetParserErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017092 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017093
17094
17095 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000017096 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017097}
17098
17099
17100static int
17101test_xmlRelaxNGSetValidErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017102 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017103
17104
17105 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000017106 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017107}
17108
17109
17110static int
17111test_xmlRelaxNGValidateDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017112 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017113
Daniel Veillardce682bc2004-11-05 17:22:25 +000017114#ifdef LIBXML_SCHEMAS_ENABLED
17115 int mem_base;
17116 int ret_val;
17117 xmlRelaxNGValidCtxtPtr ctxt; /* a Relax-NG validation context */
17118 int n_ctxt;
17119 xmlDocPtr doc; /* a parsed document tree */
17120 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017121
Daniel Veillardce682bc2004-11-05 17:22:25 +000017122 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
17123 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
17124 mem_base = xmlMemBlocks();
17125 ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
17126 doc = gen_xmlDocPtr(n_doc, 1);
17127
17128 ret_val = xmlRelaxNGValidateDoc(ctxt, doc);
17129 desret_int(ret_val);
17130 call_tests++;
17131 des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
17132 des_xmlDocPtr(n_doc, doc, 1);
17133 xmlResetLastError();
17134 if (mem_base != xmlMemBlocks()) {
17135 printf("Leak of %d blocks found in xmlRelaxNGValidateDoc",
17136 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017137 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017138 printf(" %d", n_ctxt);
17139 printf(" %d", n_doc);
17140 printf("\n");
17141 }
17142 }
17143 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017144 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017145#endif
17146
Daniel Veillard42595322004-11-08 10:52:06 +000017147 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017148}
17149
17150
17151static int
17152test_xmlRelaxNGValidateFullElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017153 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017154
Daniel Veillardce682bc2004-11-05 17:22:25 +000017155#ifdef LIBXML_SCHEMAS_ENABLED
17156 int mem_base;
17157 int ret_val;
17158 xmlRelaxNGValidCtxtPtr ctxt; /* the validation context */
17159 int n_ctxt;
17160 xmlDocPtr doc; /* a document instance */
17161 int n_doc;
17162 xmlNodePtr elem; /* an element instance */
17163 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017164
Daniel Veillardce682bc2004-11-05 17:22:25 +000017165 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
17166 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
17167 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
17168 mem_base = xmlMemBlocks();
17169 ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
17170 doc = gen_xmlDocPtr(n_doc, 1);
17171 elem = gen_xmlNodePtr(n_elem, 2);
17172
17173 ret_val = xmlRelaxNGValidateFullElement(ctxt, doc, elem);
17174 desret_int(ret_val);
17175 call_tests++;
17176 des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
17177 des_xmlDocPtr(n_doc, doc, 1);
17178 des_xmlNodePtr(n_elem, elem, 2);
17179 xmlResetLastError();
17180 if (mem_base != xmlMemBlocks()) {
17181 printf("Leak of %d blocks found in xmlRelaxNGValidateFullElement",
17182 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017183 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017184 printf(" %d", n_ctxt);
17185 printf(" %d", n_doc);
17186 printf(" %d", n_elem);
17187 printf("\n");
17188 }
17189 }
17190 }
17191 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017192 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017193#endif
17194
Daniel Veillard42595322004-11-08 10:52:06 +000017195 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017196}
17197
17198
17199static int
17200test_xmlRelaxNGValidatePopElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017201 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017202
Daniel Veillardce682bc2004-11-05 17:22:25 +000017203#ifdef LIBXML_SCHEMAS_ENABLED
17204 int mem_base;
17205 int ret_val;
17206 xmlRelaxNGValidCtxtPtr ctxt; /* the RelaxNG validation context */
17207 int n_ctxt;
17208 xmlDocPtr doc; /* a document instance */
17209 int n_doc;
17210 xmlNodePtr elem; /* an element instance */
17211 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017212
Daniel Veillardce682bc2004-11-05 17:22:25 +000017213 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
17214 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
17215 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
17216 mem_base = xmlMemBlocks();
17217 ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
17218 doc = gen_xmlDocPtr(n_doc, 1);
17219 elem = gen_xmlNodePtr(n_elem, 2);
17220
17221 ret_val = xmlRelaxNGValidatePopElement(ctxt, doc, elem);
17222 desret_int(ret_val);
17223 call_tests++;
17224 des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
17225 des_xmlDocPtr(n_doc, doc, 1);
17226 des_xmlNodePtr(n_elem, elem, 2);
17227 xmlResetLastError();
17228 if (mem_base != xmlMemBlocks()) {
17229 printf("Leak of %d blocks found in xmlRelaxNGValidatePopElement",
17230 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017231 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017232 printf(" %d", n_ctxt);
17233 printf(" %d", n_doc);
17234 printf(" %d", n_elem);
17235 printf("\n");
17236 }
17237 }
17238 }
17239 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017240 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017241#endif
17242
Daniel Veillard42595322004-11-08 10:52:06 +000017243 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017244}
17245
17246
17247static int
17248test_xmlRelaxNGValidatePushCData(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017249 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017250
Daniel Veillardce682bc2004-11-05 17:22:25 +000017251#ifdef LIBXML_SCHEMAS_ENABLED
17252 int mem_base;
17253 int ret_val;
17254 xmlRelaxNGValidCtxtPtr ctxt; /* the RelaxNG validation context */
17255 int n_ctxt;
17256 xmlChar * data; /* some character data read */
17257 int n_data;
17258 int len; /* the lenght of the data */
17259 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017260
Daniel Veillardce682bc2004-11-05 17:22:25 +000017261 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
17262 for (n_data = 0;n_data < gen_nb_const_xmlChar_ptr;n_data++) {
17263 for (n_len = 0;n_len < gen_nb_int;n_len++) {
17264 mem_base = xmlMemBlocks();
17265 ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
17266 data = gen_const_xmlChar_ptr(n_data, 1);
17267 len = gen_int(n_len, 2);
17268
William M. Brackf13f77f2004-11-12 16:03:48 +000017269 ret_val = xmlRelaxNGValidatePushCData(ctxt, (const xmlChar *)data, len);
Daniel Veillardce682bc2004-11-05 17:22:25 +000017270 desret_int(ret_val);
17271 call_tests++;
17272 des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000017273 des_const_xmlChar_ptr(n_data, (const xmlChar *)data, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000017274 des_int(n_len, len, 2);
17275 xmlResetLastError();
17276 if (mem_base != xmlMemBlocks()) {
17277 printf("Leak of %d blocks found in xmlRelaxNGValidatePushCData",
17278 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017279 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017280 printf(" %d", n_ctxt);
17281 printf(" %d", n_data);
17282 printf(" %d", n_len);
17283 printf("\n");
17284 }
17285 }
17286 }
17287 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017288 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017289#endif
17290
Daniel Veillard42595322004-11-08 10:52:06 +000017291 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017292}
17293
17294
17295static int
17296test_xmlRelaxNGValidatePushElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017297 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017298
Daniel Veillardce682bc2004-11-05 17:22:25 +000017299#ifdef LIBXML_SCHEMAS_ENABLED
17300 int mem_base;
17301 int ret_val;
17302 xmlRelaxNGValidCtxtPtr ctxt; /* the validation context */
17303 int n_ctxt;
17304 xmlDocPtr doc; /* a document instance */
17305 int n_doc;
17306 xmlNodePtr elem; /* an element instance */
17307 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017308
Daniel Veillardce682bc2004-11-05 17:22:25 +000017309 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
17310 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
17311 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
17312 mem_base = xmlMemBlocks();
17313 ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
17314 doc = gen_xmlDocPtr(n_doc, 1);
17315 elem = gen_xmlNodePtr(n_elem, 2);
17316
17317 ret_val = xmlRelaxNGValidatePushElement(ctxt, doc, elem);
17318 desret_int(ret_val);
17319 call_tests++;
17320 des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
17321 des_xmlDocPtr(n_doc, doc, 1);
17322 des_xmlNodePtr(n_elem, elem, 2);
17323 xmlResetLastError();
17324 if (mem_base != xmlMemBlocks()) {
17325 printf("Leak of %d blocks found in xmlRelaxNGValidatePushElement",
17326 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017327 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017328 printf(" %d", n_ctxt);
17329 printf(" %d", n_doc);
17330 printf(" %d", n_elem);
17331 printf("\n");
17332 }
17333 }
17334 }
17335 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017336 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017337#endif
17338
Daniel Veillard42595322004-11-08 10:52:06 +000017339 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017340}
17341
17342
17343static int
17344test_xmlRelaxParserSetFlag(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017345 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017346
Daniel Veillardce682bc2004-11-05 17:22:25 +000017347#ifdef LIBXML_SCHEMAS_ENABLED
17348 int mem_base;
17349 int ret_val;
17350 xmlRelaxNGParserCtxtPtr ctxt; /* a RelaxNG parser context */
17351 int n_ctxt;
17352 int flags; /* a set of flags values */
17353 int n_flags;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017354
Daniel Veillardce682bc2004-11-05 17:22:25 +000017355 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGParserCtxtPtr;n_ctxt++) {
17356 for (n_flags = 0;n_flags < gen_nb_int;n_flags++) {
17357 mem_base = xmlMemBlocks();
17358 ctxt = gen_xmlRelaxNGParserCtxtPtr(n_ctxt, 0);
17359 flags = gen_int(n_flags, 1);
17360
17361 ret_val = xmlRelaxParserSetFlag(ctxt, flags);
17362 desret_int(ret_val);
17363 call_tests++;
17364 des_xmlRelaxNGParserCtxtPtr(n_ctxt, ctxt, 0);
17365 des_int(n_flags, flags, 1);
17366 xmlResetLastError();
17367 if (mem_base != xmlMemBlocks()) {
17368 printf("Leak of %d blocks found in xmlRelaxParserSetFlag",
17369 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017370 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017371 printf(" %d", n_ctxt);
17372 printf(" %d", n_flags);
17373 printf("\n");
17374 }
17375 }
17376 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017377 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017378#endif
17379
Daniel Veillard42595322004-11-08 10:52:06 +000017380 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017381}
17382
17383static int
17384test_relaxng(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017385 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017386
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017387 if (quiet == 0) printf("Testing relaxng : 14 of 22 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000017388 test_ret += test_xmlRelaxNGDump();
17389 test_ret += test_xmlRelaxNGDumpTree();
17390 test_ret += test_xmlRelaxNGGetParserErrors();
17391 test_ret += test_xmlRelaxNGGetValidErrors();
17392 test_ret += test_xmlRelaxNGInitTypes();
17393 test_ret += test_xmlRelaxNGNewDocParserCtxt();
17394 test_ret += test_xmlRelaxNGNewMemParserCtxt();
17395 test_ret += test_xmlRelaxNGNewParserCtxt();
17396 test_ret += test_xmlRelaxNGNewValidCtxt();
17397 test_ret += test_xmlRelaxNGParse();
17398 test_ret += test_xmlRelaxNGSetParserErrors();
17399 test_ret += test_xmlRelaxNGSetValidErrors();
17400 test_ret += test_xmlRelaxNGValidateDoc();
17401 test_ret += test_xmlRelaxNGValidateFullElement();
17402 test_ret += test_xmlRelaxNGValidatePopElement();
17403 test_ret += test_xmlRelaxNGValidatePushCData();
17404 test_ret += test_xmlRelaxNGValidatePushElement();
17405 test_ret += test_xmlRelaxParserSetFlag();
Daniel Veillardd93f6252004-11-02 15:53:51 +000017406
Daniel Veillard42595322004-11-08 10:52:06 +000017407 if (test_ret != 0)
17408 printf("Module relaxng: %d errors\n", test_ret);
17409 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017410}
17411static int
17412test_schemasInternals(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017413 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017414
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017415 if (quiet == 0) printf("Testing schemasInternals : 0 of 2 functions ...\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017416
Daniel Veillard42595322004-11-08 10:52:06 +000017417 if (test_ret != 0)
17418 printf("Module schemasInternals: %d errors\n", test_ret);
17419 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017420}
17421
17422static int
17423test_xmlAddChild(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017424 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017425
17426 int mem_base;
17427 xmlNodePtr ret_val;
17428 xmlNodePtr parent; /* the parent node */
17429 int n_parent;
17430 xmlNodePtr cur; /* the child node */
17431 int n_cur;
17432
Daniel Veillarda03e3652004-11-02 18:45:30 +000017433 for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000017434 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr_in;n_cur++) {
17435 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017436 parent = gen_xmlNodePtr(n_parent, 0);
17437 cur = gen_xmlNodePtr_in(n_cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017438
17439 ret_val = xmlAddChild(parent, cur);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000017440 if (ret_val == NULL) { xmlFreeNode(cur) ; cur = NULL ; }
Daniel Veillardd93f6252004-11-02 15:53:51 +000017441 desret_xmlNodePtr(ret_val);
17442 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017443 des_xmlNodePtr(n_parent, parent, 0);
17444 des_xmlNodePtr_in(n_cur, cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017445 xmlResetLastError();
17446 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017447 printf("Leak of %d blocks found in xmlAddChild",
Daniel Veillardd93f6252004-11-02 15:53:51 +000017448 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017449 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000017450 printf(" %d", n_parent);
17451 printf(" %d", n_cur);
17452 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017453 }
17454 }
17455 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000017456 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017457
Daniel Veillard42595322004-11-08 10:52:06 +000017458 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017459}
17460
17461
17462static int
17463test_xmlAddChildList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017464 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017465
17466 int mem_base;
17467 xmlNodePtr ret_val;
17468 xmlNodePtr parent; /* the parent node */
17469 int n_parent;
17470 xmlNodePtr cur; /* the first node in the list */
17471 int n_cur;
17472
Daniel Veillarda03e3652004-11-02 18:45:30 +000017473 for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000017474 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr_in;n_cur++) {
17475 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017476 parent = gen_xmlNodePtr(n_parent, 0);
17477 cur = gen_xmlNodePtr_in(n_cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017478
17479 ret_val = xmlAddChildList(parent, cur);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000017480 if (ret_val == NULL) { xmlFreeNodeList(cur) ; cur = NULL ; }
Daniel Veillardd93f6252004-11-02 15:53:51 +000017481 desret_xmlNodePtr(ret_val);
17482 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017483 des_xmlNodePtr(n_parent, parent, 0);
17484 des_xmlNodePtr_in(n_cur, cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017485 xmlResetLastError();
17486 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017487 printf("Leak of %d blocks found in xmlAddChildList",
Daniel Veillardd93f6252004-11-02 15:53:51 +000017488 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017489 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000017490 printf(" %d", n_parent);
17491 printf(" %d", n_cur);
17492 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017493 }
17494 }
17495 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000017496 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017497
Daniel Veillard42595322004-11-08 10:52:06 +000017498 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017499}
17500
17501
17502static int
17503test_xmlAddNextSibling(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017504 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017505
17506 int mem_base;
17507 xmlNodePtr ret_val;
17508 xmlNodePtr cur; /* the child node */
17509 int n_cur;
17510 xmlNodePtr elem; /* the new node */
17511 int n_elem;
17512
17513 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017514 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr_in;n_elem++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000017515 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017516 cur = gen_xmlNodePtr(n_cur, 0);
17517 elem = gen_xmlNodePtr_in(n_elem, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017518
17519 ret_val = xmlAddNextSibling(cur, elem);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000017520 if (ret_val == NULL) { xmlFreeNode(elem) ; elem = NULL ; }
Daniel Veillardd93f6252004-11-02 15:53:51 +000017521 desret_xmlNodePtr(ret_val);
17522 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017523 des_xmlNodePtr(n_cur, cur, 0);
17524 des_xmlNodePtr_in(n_elem, elem, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017525 xmlResetLastError();
17526 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017527 printf("Leak of %d blocks found in xmlAddNextSibling",
Daniel Veillardd93f6252004-11-02 15:53:51 +000017528 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017529 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000017530 printf(" %d", n_cur);
17531 printf(" %d", n_elem);
17532 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017533 }
17534 }
17535 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000017536 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017537
Daniel Veillard42595322004-11-08 10:52:06 +000017538 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017539}
17540
17541
17542static int
17543test_xmlAddPrevSibling(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017544 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017545
17546#ifdef LIBXML_TREE_ENABLED
17547 int mem_base;
17548 xmlNodePtr ret_val;
17549 xmlNodePtr cur; /* the child node */
17550 int n_cur;
17551 xmlNodePtr elem; /* the new node */
17552 int n_elem;
17553
17554 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017555 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr_in;n_elem++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000017556 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017557 cur = gen_xmlNodePtr(n_cur, 0);
17558 elem = gen_xmlNodePtr_in(n_elem, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017559
17560 ret_val = xmlAddPrevSibling(cur, elem);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000017561 if (ret_val == NULL) { xmlFreeNode(elem) ; elem = NULL ; }
Daniel Veillardd93f6252004-11-02 15:53:51 +000017562 desret_xmlNodePtr(ret_val);
17563 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017564 des_xmlNodePtr(n_cur, cur, 0);
17565 des_xmlNodePtr_in(n_elem, elem, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017566 xmlResetLastError();
17567 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017568 printf("Leak of %d blocks found in xmlAddPrevSibling",
Daniel Veillardd93f6252004-11-02 15:53:51 +000017569 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017570 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000017571 printf(" %d", n_cur);
17572 printf(" %d", n_elem);
17573 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017574 }
17575 }
17576 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017577 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017578#endif
17579
Daniel Veillard42595322004-11-08 10:52:06 +000017580 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017581}
17582
17583
17584static int
17585test_xmlAddSibling(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017586 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017587
17588 int mem_base;
17589 xmlNodePtr ret_val;
17590 xmlNodePtr cur; /* the child node */
17591 int n_cur;
17592 xmlNodePtr elem; /* the new node */
17593 int n_elem;
17594
17595 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017596 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr_in;n_elem++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000017597 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017598 cur = gen_xmlNodePtr(n_cur, 0);
17599 elem = gen_xmlNodePtr_in(n_elem, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017600
17601 ret_val = xmlAddSibling(cur, elem);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000017602 if (ret_val == NULL) { xmlFreeNode(elem) ; elem = NULL ; }
Daniel Veillardd93f6252004-11-02 15:53:51 +000017603 desret_xmlNodePtr(ret_val);
17604 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017605 des_xmlNodePtr(n_cur, cur, 0);
17606 des_xmlNodePtr_in(n_elem, elem, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017607 xmlResetLastError();
17608 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017609 printf("Leak of %d blocks found in xmlAddSibling",
Daniel Veillardd93f6252004-11-02 15:53:51 +000017610 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017611 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000017612 printf(" %d", n_cur);
17613 printf(" %d", n_elem);
17614 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017615 }
17616 }
17617 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000017618 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017619
Daniel Veillard42595322004-11-08 10:52:06 +000017620 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017621}
17622
17623
17624static int
17625test_xmlAttrSerializeTxtContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017626 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017627
Daniel Veillarda521d282004-11-09 14:59:59 +000017628#ifdef LIBXML_OUTPUT_ENABLED
Daniel Veillardce244ad2004-11-05 10:03:46 +000017629 int mem_base;
17630 xmlBufferPtr buf; /* the XML buffer output */
17631 int n_buf;
17632 xmlDocPtr doc; /* the document */
17633 int n_doc;
17634 xmlAttrPtr attr; /* the attribute node */
17635 int n_attr;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017636 xmlChar * string; /* the text content */
Daniel Veillardce244ad2004-11-05 10:03:46 +000017637 int n_string;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017638
Daniel Veillardce244ad2004-11-05 10:03:46 +000017639 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
17640 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
17641 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
17642 for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) {
17643 mem_base = xmlMemBlocks();
17644 buf = gen_xmlBufferPtr(n_buf, 0);
17645 doc = gen_xmlDocPtr(n_doc, 1);
17646 attr = gen_xmlAttrPtr(n_attr, 2);
17647 string = gen_const_xmlChar_ptr(n_string, 3);
17648
William M. Brackf13f77f2004-11-12 16:03:48 +000017649 xmlAttrSerializeTxtContent(buf, doc, attr, (const xmlChar *)string);
Daniel Veillardce244ad2004-11-05 10:03:46 +000017650 call_tests++;
17651 des_xmlBufferPtr(n_buf, buf, 0);
17652 des_xmlDocPtr(n_doc, doc, 1);
17653 des_xmlAttrPtr(n_attr, attr, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000017654 des_const_xmlChar_ptr(n_string, (const xmlChar *)string, 3);
Daniel Veillardce244ad2004-11-05 10:03:46 +000017655 xmlResetLastError();
17656 if (mem_base != xmlMemBlocks()) {
17657 printf("Leak of %d blocks found in xmlAttrSerializeTxtContent",
17658 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017659 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000017660 printf(" %d", n_buf);
17661 printf(" %d", n_doc);
17662 printf(" %d", n_attr);
17663 printf(" %d", n_string);
17664 printf("\n");
17665 }
17666 }
17667 }
17668 }
17669 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017670 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000017671#endif
Daniel Veillardce244ad2004-11-05 10:03:46 +000017672
Daniel Veillard42595322004-11-08 10:52:06 +000017673 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017674}
17675
17676
17677static int
17678test_xmlBufferAdd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017679 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017680
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017681 int mem_base;
17682 int ret_val;
17683 xmlBufferPtr buf; /* the buffer to dump */
17684 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017685 xmlChar * str; /* the #xmlChar string */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017686 int n_str;
17687 int len; /* the number of #xmlChar to add */
17688 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017689
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017690 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
17691 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
17692 for (n_len = 0;n_len < gen_nb_int;n_len++) {
17693 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017694 buf = gen_xmlBufferPtr(n_buf, 0);
17695 str = gen_const_xmlChar_ptr(n_str, 1);
17696 len = gen_int(n_len, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017697
William M. Brackf13f77f2004-11-12 16:03:48 +000017698 ret_val = xmlBufferAdd(buf, (const xmlChar *)str, len);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017699 desret_int(ret_val);
17700 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017701 des_xmlBufferPtr(n_buf, buf, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000017702 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000017703 des_int(n_len, len, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017704 xmlResetLastError();
17705 if (mem_base != xmlMemBlocks()) {
17706 printf("Leak of %d blocks found in xmlBufferAdd",
17707 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017708 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017709 printf(" %d", n_buf);
17710 printf(" %d", n_str);
17711 printf(" %d", n_len);
17712 printf("\n");
17713 }
17714 }
17715 }
17716 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000017717 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017718
Daniel Veillard42595322004-11-08 10:52:06 +000017719 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017720}
17721
17722
17723static int
17724test_xmlBufferAddHead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017725 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017726
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017727 int mem_base;
17728 int ret_val;
17729 xmlBufferPtr buf; /* the buffer */
17730 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017731 xmlChar * str; /* the #xmlChar string */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017732 int n_str;
17733 int len; /* the number of #xmlChar to add */
17734 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017735
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017736 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
17737 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
17738 for (n_len = 0;n_len < gen_nb_int;n_len++) {
17739 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017740 buf = gen_xmlBufferPtr(n_buf, 0);
17741 str = gen_const_xmlChar_ptr(n_str, 1);
17742 len = gen_int(n_len, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017743
William M. Brackf13f77f2004-11-12 16:03:48 +000017744 ret_val = xmlBufferAddHead(buf, (const xmlChar *)str, len);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017745 desret_int(ret_val);
17746 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017747 des_xmlBufferPtr(n_buf, buf, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000017748 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000017749 des_int(n_len, len, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017750 xmlResetLastError();
17751 if (mem_base != xmlMemBlocks()) {
17752 printf("Leak of %d blocks found in xmlBufferAddHead",
17753 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017754 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017755 printf(" %d", n_buf);
17756 printf(" %d", n_str);
17757 printf(" %d", n_len);
17758 printf("\n");
17759 }
17760 }
17761 }
17762 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000017763 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017764
Daniel Veillard42595322004-11-08 10:52:06 +000017765 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017766}
17767
17768
17769static int
17770test_xmlBufferCCat(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017771 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017772
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017773 int mem_base;
17774 int ret_val;
17775 xmlBufferPtr buf; /* the buffer to dump */
17776 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017777 char * str; /* the C char string */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017778 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017779
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017780 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
17781 for (n_str = 0;n_str < gen_nb_const_char_ptr;n_str++) {
17782 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017783 buf = gen_xmlBufferPtr(n_buf, 0);
17784 str = gen_const_char_ptr(n_str, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017785
William M. Brackf13f77f2004-11-12 16:03:48 +000017786 ret_val = xmlBufferCCat(buf, (const char *)str);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017787 desret_int(ret_val);
17788 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017789 des_xmlBufferPtr(n_buf, buf, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000017790 des_const_char_ptr(n_str, (const char *)str, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017791 xmlResetLastError();
17792 if (mem_base != xmlMemBlocks()) {
17793 printf("Leak of %d blocks found in xmlBufferCCat",
17794 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017795 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017796 printf(" %d", n_buf);
17797 printf(" %d", n_str);
17798 printf("\n");
17799 }
17800 }
17801 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000017802 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017803
Daniel Veillard42595322004-11-08 10:52:06 +000017804 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017805}
17806
17807
17808static int
17809test_xmlBufferCat(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017810 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017811
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017812 int mem_base;
17813 int ret_val;
17814 xmlBufferPtr buf; /* the buffer to add to */
17815 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017816 xmlChar * str; /* the #xmlChar string */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017817 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017818
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017819 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
17820 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
17821 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017822 buf = gen_xmlBufferPtr(n_buf, 0);
17823 str = gen_const_xmlChar_ptr(n_str, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017824
William M. Brackf13f77f2004-11-12 16:03:48 +000017825 ret_val = xmlBufferCat(buf, (const xmlChar *)str);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017826 desret_int(ret_val);
17827 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017828 des_xmlBufferPtr(n_buf, buf, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000017829 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017830 xmlResetLastError();
17831 if (mem_base != xmlMemBlocks()) {
17832 printf("Leak of %d blocks found in xmlBufferCat",
17833 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017834 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017835 printf(" %d", n_buf);
17836 printf(" %d", n_str);
17837 printf("\n");
17838 }
17839 }
17840 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000017841 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017842
Daniel Veillard42595322004-11-08 10:52:06 +000017843 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017844}
17845
17846
Daniel Veillardce682bc2004-11-05 17:22:25 +000017847#define gen_nb_const_xmlBufferPtr 1
17848static xmlBufferPtr gen_const_xmlBufferPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
17849 return(NULL);
17850}
17851static void des_const_xmlBufferPtr(int no ATTRIBUTE_UNUSED, const xmlBufferPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
17852}
17853
Daniel Veillardd93f6252004-11-02 15:53:51 +000017854static int
17855test_xmlBufferContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017856 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017857
Daniel Veillardce682bc2004-11-05 17:22:25 +000017858 int mem_base;
17859 const xmlChar * ret_val;
17860 xmlBufferPtr buf; /* the buffer */
17861 int n_buf;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017862
Daniel Veillardce682bc2004-11-05 17:22:25 +000017863 for (n_buf = 0;n_buf < gen_nb_const_xmlBufferPtr;n_buf++) {
17864 mem_base = xmlMemBlocks();
17865 buf = gen_const_xmlBufferPtr(n_buf, 0);
17866
William M. Brackf13f77f2004-11-12 16:03:48 +000017867 ret_val = xmlBufferContent((const xmlBufferPtr)buf);
Daniel Veillardce682bc2004-11-05 17:22:25 +000017868 desret_const_xmlChar_ptr(ret_val);
17869 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000017870 des_const_xmlBufferPtr(n_buf, (const xmlBufferPtr)buf, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000017871 xmlResetLastError();
17872 if (mem_base != xmlMemBlocks()) {
17873 printf("Leak of %d blocks found in xmlBufferContent",
17874 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017875 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017876 printf(" %d", n_buf);
17877 printf("\n");
17878 }
17879 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000017880 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017881
Daniel Veillard42595322004-11-08 10:52:06 +000017882 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017883}
17884
17885
17886static int
17887test_xmlBufferCreate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017888 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017889
Daniel Veillard3d95c732004-11-06 22:25:14 +000017890 int mem_base;
17891 xmlBufferPtr ret_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017892
Daniel Veillard3d95c732004-11-06 22:25:14 +000017893 mem_base = xmlMemBlocks();
17894
17895 ret_val = xmlBufferCreate();
17896 desret_xmlBufferPtr(ret_val);
17897 call_tests++;
17898 xmlResetLastError();
17899 if (mem_base != xmlMemBlocks()) {
17900 printf("Leak of %d blocks found in xmlBufferCreate",
17901 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017902 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000017903 printf("\n");
17904 }
Daniel Veillard3d95c732004-11-06 22:25:14 +000017905 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017906
Daniel Veillard42595322004-11-08 10:52:06 +000017907 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017908}
17909
17910
17911static int
17912test_xmlBufferCreateSize(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017913 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017914
17915
17916 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000017917 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017918}
17919
17920
17921static int
17922test_xmlBufferCreateStatic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017923 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017924
17925
17926 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000017927 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017928}
17929
17930
17931static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000017932test_xmlBufferEmpty(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017933 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017934
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017935 int mem_base;
17936 xmlBufferPtr buf; /* the buffer */
17937 int n_buf;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017938
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017939 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
17940 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017941 buf = gen_xmlBufferPtr(n_buf, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017942
17943 xmlBufferEmpty(buf);
17944 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017945 des_xmlBufferPtr(n_buf, buf, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017946 xmlResetLastError();
17947 if (mem_base != xmlMemBlocks()) {
17948 printf("Leak of %d blocks found in xmlBufferEmpty",
17949 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017950 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017951 printf(" %d", n_buf);
17952 printf("\n");
17953 }
17954 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000017955 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017956
Daniel Veillard42595322004-11-08 10:52:06 +000017957 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017958}
17959
17960
17961static int
17962test_xmlBufferGrow(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017963 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017964
Daniel Veillard3d97e662004-11-04 10:49:00 +000017965 int mem_base;
17966 int ret_val;
17967 xmlBufferPtr buf; /* the buffer */
17968 int n_buf;
17969 unsigned int len; /* the minimum free size to allocate */
17970 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017971
Daniel Veillard3d97e662004-11-04 10:49:00 +000017972 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
17973 for (n_len = 0;n_len < gen_nb_unsigned_int;n_len++) {
17974 mem_base = xmlMemBlocks();
17975 buf = gen_xmlBufferPtr(n_buf, 0);
17976 len = gen_unsigned_int(n_len, 1);
17977
17978 ret_val = xmlBufferGrow(buf, len);
17979 desret_int(ret_val);
17980 call_tests++;
17981 des_xmlBufferPtr(n_buf, buf, 0);
17982 des_unsigned_int(n_len, len, 1);
17983 xmlResetLastError();
17984 if (mem_base != xmlMemBlocks()) {
17985 printf("Leak of %d blocks found in xmlBufferGrow",
17986 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017987 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017988 printf(" %d", n_buf);
17989 printf(" %d", n_len);
17990 printf("\n");
17991 }
17992 }
17993 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000017994 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017995
Daniel Veillard42595322004-11-08 10:52:06 +000017996 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017997}
17998
17999
18000static int
18001test_xmlBufferLength(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018002 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018003
Daniel Veillardce682bc2004-11-05 17:22:25 +000018004 int mem_base;
18005 int ret_val;
18006 xmlBufferPtr buf; /* the buffer */
18007 int n_buf;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018008
Daniel Veillardce682bc2004-11-05 17:22:25 +000018009 for (n_buf = 0;n_buf < gen_nb_const_xmlBufferPtr;n_buf++) {
18010 mem_base = xmlMemBlocks();
18011 buf = gen_const_xmlBufferPtr(n_buf, 0);
18012
William M. Brackf13f77f2004-11-12 16:03:48 +000018013 ret_val = xmlBufferLength((const xmlBufferPtr)buf);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018014 desret_int(ret_val);
18015 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000018016 des_const_xmlBufferPtr(n_buf, (const xmlBufferPtr)buf, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018017 xmlResetLastError();
18018 if (mem_base != xmlMemBlocks()) {
18019 printf("Leak of %d blocks found in xmlBufferLength",
18020 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018021 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018022 printf(" %d", n_buf);
18023 printf("\n");
18024 }
18025 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000018026 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018027
Daniel Veillard42595322004-11-08 10:52:06 +000018028 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018029}
18030
18031
18032static int
18033test_xmlBufferResize(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018034 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018035
Daniel Veillard3d97e662004-11-04 10:49:00 +000018036 int mem_base;
18037 int ret_val;
18038 xmlBufferPtr buf; /* the buffer to resize */
18039 int n_buf;
18040 unsigned int size; /* the desired size */
18041 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018042
Daniel Veillard3d97e662004-11-04 10:49:00 +000018043 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18044 for (n_size = 0;n_size < gen_nb_unsigned_int;n_size++) {
18045 mem_base = xmlMemBlocks();
18046 buf = gen_xmlBufferPtr(n_buf, 0);
18047 size = gen_unsigned_int(n_size, 1);
18048
18049 ret_val = xmlBufferResize(buf, size);
18050 desret_int(ret_val);
18051 call_tests++;
18052 des_xmlBufferPtr(n_buf, buf, 0);
18053 des_unsigned_int(n_size, size, 1);
18054 xmlResetLastError();
18055 if (mem_base != xmlMemBlocks()) {
18056 printf("Leak of %d blocks found in xmlBufferResize",
18057 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018058 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018059 printf(" %d", n_buf);
18060 printf(" %d", n_size);
18061 printf("\n");
18062 }
18063 }
18064 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018065 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018066
Daniel Veillard42595322004-11-08 10:52:06 +000018067 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018068}
18069
18070
18071static int
18072test_xmlBufferSetAllocationScheme(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018073 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018074
Daniel Veillard57b25162004-11-06 14:50:18 +000018075 int mem_base;
18076 xmlBufferPtr buf; /* the buffer to tune */
18077 int n_buf;
18078 xmlBufferAllocationScheme scheme; /* allocation scheme to use */
18079 int n_scheme;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018080
Daniel Veillard57b25162004-11-06 14:50:18 +000018081 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18082 for (n_scheme = 0;n_scheme < gen_nb_xmlBufferAllocationScheme;n_scheme++) {
18083 mem_base = xmlMemBlocks();
18084 buf = gen_xmlBufferPtr(n_buf, 0);
18085 scheme = gen_xmlBufferAllocationScheme(n_scheme, 1);
18086
18087 xmlBufferSetAllocationScheme(buf, scheme);
18088 call_tests++;
18089 des_xmlBufferPtr(n_buf, buf, 0);
18090 des_xmlBufferAllocationScheme(n_scheme, scheme, 1);
18091 xmlResetLastError();
18092 if (mem_base != xmlMemBlocks()) {
18093 printf("Leak of %d blocks found in xmlBufferSetAllocationScheme",
18094 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018095 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000018096 printf(" %d", n_buf);
18097 printf(" %d", n_scheme);
18098 printf("\n");
18099 }
18100 }
18101 }
Daniel Veillard57b25162004-11-06 14:50:18 +000018102 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018103
Daniel Veillard42595322004-11-08 10:52:06 +000018104 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018105}
18106
18107
18108static int
18109test_xmlBufferShrink(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018110 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018111
Daniel Veillard3d97e662004-11-04 10:49:00 +000018112 int mem_base;
18113 int ret_val;
18114 xmlBufferPtr buf; /* the buffer to dump */
18115 int n_buf;
18116 unsigned int len; /* the number of xmlChar to remove */
18117 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018118
Daniel Veillard3d97e662004-11-04 10:49:00 +000018119 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18120 for (n_len = 0;n_len < gen_nb_unsigned_int;n_len++) {
18121 mem_base = xmlMemBlocks();
18122 buf = gen_xmlBufferPtr(n_buf, 0);
18123 len = gen_unsigned_int(n_len, 1);
18124
18125 ret_val = xmlBufferShrink(buf, len);
18126 desret_int(ret_val);
18127 call_tests++;
18128 des_xmlBufferPtr(n_buf, buf, 0);
18129 des_unsigned_int(n_len, len, 1);
18130 xmlResetLastError();
18131 if (mem_base != xmlMemBlocks()) {
18132 printf("Leak of %d blocks found in xmlBufferShrink",
18133 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018134 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018135 printf(" %d", n_buf);
18136 printf(" %d", n_len);
18137 printf("\n");
18138 }
18139 }
18140 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018141 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018142
Daniel Veillard42595322004-11-08 10:52:06 +000018143 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018144}
18145
18146
18147static int
18148test_xmlBufferWriteCHAR(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018149 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018150
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018151 int mem_base;
18152 xmlBufferPtr buf; /* the XML buffer */
18153 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018154 xmlChar * string; /* the string to add */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018155 int n_string;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018156
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018157 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18158 for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) {
18159 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018160 buf = gen_xmlBufferPtr(n_buf, 0);
18161 string = gen_const_xmlChar_ptr(n_string, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018162
William M. Brackf13f77f2004-11-12 16:03:48 +000018163 xmlBufferWriteCHAR(buf, (const xmlChar *)string);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018164 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018165 des_xmlBufferPtr(n_buf, buf, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000018166 des_const_xmlChar_ptr(n_string, (const xmlChar *)string, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018167 xmlResetLastError();
18168 if (mem_base != xmlMemBlocks()) {
18169 printf("Leak of %d blocks found in xmlBufferWriteCHAR",
18170 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018171 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018172 printf(" %d", n_buf);
18173 printf(" %d", n_string);
18174 printf("\n");
18175 }
18176 }
18177 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018178 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018179
Daniel Veillard42595322004-11-08 10:52:06 +000018180 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018181}
18182
18183
18184static int
18185test_xmlBufferWriteChar(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018186 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018187
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018188 int mem_base;
18189 xmlBufferPtr buf; /* the XML buffer output */
18190 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018191 char * string; /* the string to add */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018192 int n_string;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018193
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018194 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18195 for (n_string = 0;n_string < gen_nb_const_char_ptr;n_string++) {
18196 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018197 buf = gen_xmlBufferPtr(n_buf, 0);
18198 string = gen_const_char_ptr(n_string, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018199
William M. Brackf13f77f2004-11-12 16:03:48 +000018200 xmlBufferWriteChar(buf, (const char *)string);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018201 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018202 des_xmlBufferPtr(n_buf, buf, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000018203 des_const_char_ptr(n_string, (const char *)string, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018204 xmlResetLastError();
18205 if (mem_base != xmlMemBlocks()) {
18206 printf("Leak of %d blocks found in xmlBufferWriteChar",
18207 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018208 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018209 printf(" %d", n_buf);
18210 printf(" %d", n_string);
18211 printf("\n");
18212 }
18213 }
18214 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018215 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018216
Daniel Veillard42595322004-11-08 10:52:06 +000018217 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018218}
18219
18220
18221static int
18222test_xmlBufferWriteQuotedString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018223 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018224
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018225 int mem_base;
18226 xmlBufferPtr buf; /* the XML buffer output */
18227 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018228 xmlChar * string; /* the string to add */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018229 int n_string;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018230
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018231 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18232 for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) {
18233 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018234 buf = gen_xmlBufferPtr(n_buf, 0);
18235 string = gen_const_xmlChar_ptr(n_string, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018236
William M. Brackf13f77f2004-11-12 16:03:48 +000018237 xmlBufferWriteQuotedString(buf, (const xmlChar *)string);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018238 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018239 des_xmlBufferPtr(n_buf, buf, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000018240 des_const_xmlChar_ptr(n_string, (const xmlChar *)string, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018241 xmlResetLastError();
18242 if (mem_base != xmlMemBlocks()) {
18243 printf("Leak of %d blocks found in xmlBufferWriteQuotedString",
18244 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018245 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018246 printf(" %d", n_buf);
18247 printf(" %d", n_string);
18248 printf("\n");
18249 }
18250 }
18251 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018252 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018253
Daniel Veillard42595322004-11-08 10:52:06 +000018254 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018255}
18256
18257
18258static int
18259test_xmlBuildQName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018260 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018261
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018262 int mem_base;
18263 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018264 xmlChar * ncname; /* the Name */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018265 int n_ncname;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018266 xmlChar * prefix; /* the prefix */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018267 int n_prefix;
18268 xmlChar * memory; /* preallocated memory */
18269 int n_memory;
18270 int len; /* preallocated memory length */
18271 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018272
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018273 for (n_ncname = 0;n_ncname < gen_nb_const_xmlChar_ptr;n_ncname++) {
18274 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
18275 for (n_memory = 0;n_memory < gen_nb_xmlChar_ptr;n_memory++) {
18276 for (n_len = 0;n_len < gen_nb_int;n_len++) {
18277 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018278 ncname = gen_const_xmlChar_ptr(n_ncname, 0);
18279 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
18280 memory = gen_xmlChar_ptr(n_memory, 2);
18281 len = gen_int(n_len, 3);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018282
William M. Brackf13f77f2004-11-12 16:03:48 +000018283 ret_val = xmlBuildQName((const xmlChar *)ncname, (const xmlChar *)prefix, memory, len);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018284 if ((ret_val != NULL) && (ret_val != ncname) &&
18285 (ret_val != prefix) && (ret_val != memory))
18286 xmlFree(ret_val);
18287 ret_val = NULL;
18288 desret_xmlChar_ptr(ret_val);
18289 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000018290 des_const_xmlChar_ptr(n_ncname, (const xmlChar *)ncname, 0);
18291 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000018292 des_xmlChar_ptr(n_memory, memory, 2);
18293 des_int(n_len, len, 3);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018294 xmlResetLastError();
18295 if (mem_base != xmlMemBlocks()) {
18296 printf("Leak of %d blocks found in xmlBuildQName",
18297 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018298 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018299 printf(" %d", n_ncname);
18300 printf(" %d", n_prefix);
18301 printf(" %d", n_memory);
18302 printf(" %d", n_len);
18303 printf("\n");
18304 }
18305 }
18306 }
18307 }
18308 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018309 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018310
Daniel Veillard42595322004-11-08 10:52:06 +000018311 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018312}
18313
18314
18315static int
18316test_xmlCopyDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018317 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018318
18319#ifdef LIBXML_TREE_ENABLED
18320 int mem_base;
18321 xmlDocPtr ret_val;
18322 xmlDocPtr doc; /* the document */
18323 int n_doc;
18324 int recursive; /* if not zero do a recursive copy. */
18325 int n_recursive;
18326
18327 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
18328 for (n_recursive = 0;n_recursive < gen_nb_int;n_recursive++) {
18329 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018330 doc = gen_xmlDocPtr(n_doc, 0);
18331 recursive = gen_int(n_recursive, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018332
18333 ret_val = xmlCopyDoc(doc, recursive);
18334 desret_xmlDocPtr(ret_val);
18335 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018336 des_xmlDocPtr(n_doc, doc, 0);
18337 des_int(n_recursive, recursive, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018338 xmlResetLastError();
18339 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000018340 printf("Leak of %d blocks found in xmlCopyDoc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000018341 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018342 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000018343 printf(" %d", n_doc);
18344 printf(" %d", n_recursive);
18345 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000018346 }
18347 }
18348 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018349 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018350#endif
18351
Daniel Veillard42595322004-11-08 10:52:06 +000018352 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018353}
18354
18355
18356static int
18357test_xmlCopyDtd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018358 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018359
Daniel Veillard27f20102004-11-05 11:50:11 +000018360#ifdef LIBXML_TREE_ENABLED
18361 int mem_base;
18362 xmlDtdPtr ret_val;
18363 xmlDtdPtr dtd; /* the dtd */
18364 int n_dtd;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018365
Daniel Veillard27f20102004-11-05 11:50:11 +000018366 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
18367 mem_base = xmlMemBlocks();
18368 dtd = gen_xmlDtdPtr(n_dtd, 0);
18369
18370 ret_val = xmlCopyDtd(dtd);
18371 desret_xmlDtdPtr(ret_val);
18372 call_tests++;
18373 des_xmlDtdPtr(n_dtd, dtd, 0);
18374 xmlResetLastError();
18375 if (mem_base != xmlMemBlocks()) {
18376 printf("Leak of %d blocks found in xmlCopyDtd",
18377 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018378 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000018379 printf(" %d", n_dtd);
18380 printf("\n");
18381 }
18382 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018383 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000018384#endif
18385
Daniel Veillard42595322004-11-08 10:52:06 +000018386 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018387}
18388
18389
18390static int
18391test_xmlCopyNamespace(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018392 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018393
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018394 int mem_base;
18395 xmlNsPtr ret_val;
18396 xmlNsPtr cur; /* the namespace */
18397 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018398
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018399 for (n_cur = 0;n_cur < gen_nb_xmlNsPtr;n_cur++) {
18400 mem_base = xmlMemBlocks();
18401 cur = gen_xmlNsPtr(n_cur, 0);
18402
18403 ret_val = xmlCopyNamespace(cur);
18404 if (ret_val != NULL) xmlFreeNs(ret_val);
18405 desret_xmlNsPtr(ret_val);
18406 call_tests++;
18407 des_xmlNsPtr(n_cur, cur, 0);
18408 xmlResetLastError();
18409 if (mem_base != xmlMemBlocks()) {
18410 printf("Leak of %d blocks found in xmlCopyNamespace",
18411 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018412 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018413 printf(" %d", n_cur);
18414 printf("\n");
18415 }
18416 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018417 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018418
Daniel Veillard42595322004-11-08 10:52:06 +000018419 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018420}
18421
18422
18423static int
18424test_xmlCopyNamespaceList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018425 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018426
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018427 int mem_base;
18428 xmlNsPtr ret_val;
18429 xmlNsPtr cur; /* the first namespace */
18430 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018431
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018432 for (n_cur = 0;n_cur < gen_nb_xmlNsPtr;n_cur++) {
18433 mem_base = xmlMemBlocks();
18434 cur = gen_xmlNsPtr(n_cur, 0);
18435
18436 ret_val = xmlCopyNamespaceList(cur);
18437 if (ret_val != NULL) xmlFreeNsList(ret_val);
18438 desret_xmlNsPtr(ret_val);
18439 call_tests++;
18440 des_xmlNsPtr(n_cur, cur, 0);
18441 xmlResetLastError();
18442 if (mem_base != xmlMemBlocks()) {
18443 printf("Leak of %d blocks found in xmlCopyNamespaceList",
18444 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018445 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018446 printf(" %d", n_cur);
18447 printf("\n");
18448 }
18449 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018450 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018451
Daniel Veillard42595322004-11-08 10:52:06 +000018452 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018453}
18454
18455
18456static int
18457test_xmlCopyNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018458 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018459
Daniel Veillardce682bc2004-11-05 17:22:25 +000018460 int mem_base;
18461 xmlNodePtr ret_val;
18462 xmlNodePtr node; /* the node */
18463 int n_node;
18464 int extended; /* if 1 do a recursive copy (properties, namespaces and children when applicable) if 2 copy properties and namespaces (when applicable) */
18465 int n_extended;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018466
Daniel Veillardce682bc2004-11-05 17:22:25 +000018467 for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) {
18468 for (n_extended = 0;n_extended < gen_nb_int;n_extended++) {
18469 mem_base = xmlMemBlocks();
18470 node = gen_const_xmlNodePtr(n_node, 0);
18471 extended = gen_int(n_extended, 1);
18472
William M. Brackf13f77f2004-11-12 16:03:48 +000018473 ret_val = xmlCopyNode((const xmlNodePtr)node, extended);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018474 desret_xmlNodePtr(ret_val);
18475 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000018476 des_const_xmlNodePtr(n_node, (const xmlNodePtr)node, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018477 des_int(n_extended, extended, 1);
18478 xmlResetLastError();
18479 if (mem_base != xmlMemBlocks()) {
18480 printf("Leak of %d blocks found in xmlCopyNode",
18481 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018482 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018483 printf(" %d", n_node);
18484 printf(" %d", n_extended);
18485 printf("\n");
18486 }
18487 }
18488 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000018489 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018490
Daniel Veillard42595322004-11-08 10:52:06 +000018491 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018492}
18493
18494
18495static int
18496test_xmlCopyNodeList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018497 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018498
Daniel Veillardce682bc2004-11-05 17:22:25 +000018499 int mem_base;
18500 xmlNodePtr ret_val;
18501 xmlNodePtr node; /* the first node in the list. */
18502 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018503
Daniel Veillardce682bc2004-11-05 17:22:25 +000018504 for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) {
18505 mem_base = xmlMemBlocks();
18506 node = gen_const_xmlNodePtr(n_node, 0);
18507
William M. Brackf13f77f2004-11-12 16:03:48 +000018508 ret_val = xmlCopyNodeList((const xmlNodePtr)node);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018509 desret_xmlNodePtr(ret_val);
18510 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000018511 des_const_xmlNodePtr(n_node, (const xmlNodePtr)node, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018512 xmlResetLastError();
18513 if (mem_base != xmlMemBlocks()) {
18514 printf("Leak of %d blocks found in xmlCopyNodeList",
18515 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018516 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018517 printf(" %d", n_node);
18518 printf("\n");
18519 }
18520 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000018521 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018522
Daniel Veillard42595322004-11-08 10:52:06 +000018523 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018524}
18525
18526
18527static int
18528test_xmlCopyProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018529 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018530
Daniel Veillard57b25162004-11-06 14:50:18 +000018531 int mem_base;
18532 xmlAttrPtr ret_val;
18533 xmlNodePtr target; /* the element where the attribute will be grafted */
18534 int n_target;
18535 xmlAttrPtr cur; /* the attribute */
18536 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018537
Daniel Veillard57b25162004-11-06 14:50:18 +000018538 for (n_target = 0;n_target < gen_nb_xmlNodePtr;n_target++) {
18539 for (n_cur = 0;n_cur < gen_nb_xmlAttrPtr;n_cur++) {
18540 mem_base = xmlMemBlocks();
18541 target = gen_xmlNodePtr(n_target, 0);
18542 cur = gen_xmlAttrPtr(n_cur, 1);
18543
18544 ret_val = xmlCopyProp(target, cur);
18545 desret_xmlAttrPtr(ret_val);
18546 call_tests++;
18547 des_xmlNodePtr(n_target, target, 0);
18548 des_xmlAttrPtr(n_cur, cur, 1);
18549 xmlResetLastError();
18550 if (mem_base != xmlMemBlocks()) {
18551 printf("Leak of %d blocks found in xmlCopyProp",
18552 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018553 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000018554 printf(" %d", n_target);
18555 printf(" %d", n_cur);
18556 printf("\n");
18557 }
18558 }
18559 }
Daniel Veillard57b25162004-11-06 14:50:18 +000018560 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018561
Daniel Veillard42595322004-11-08 10:52:06 +000018562 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018563}
18564
18565
18566static int
18567test_xmlCopyPropList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018568 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018569
Daniel Veillard57b25162004-11-06 14:50:18 +000018570 int mem_base;
18571 xmlAttrPtr ret_val;
18572 xmlNodePtr target; /* the element where the attributes will be grafted */
18573 int n_target;
18574 xmlAttrPtr cur; /* the first attribute */
18575 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018576
Daniel Veillard57b25162004-11-06 14:50:18 +000018577 for (n_target = 0;n_target < gen_nb_xmlNodePtr;n_target++) {
18578 for (n_cur = 0;n_cur < gen_nb_xmlAttrPtr;n_cur++) {
18579 mem_base = xmlMemBlocks();
18580 target = gen_xmlNodePtr(n_target, 0);
18581 cur = gen_xmlAttrPtr(n_cur, 1);
18582
18583 ret_val = xmlCopyPropList(target, cur);
18584 desret_xmlAttrPtr(ret_val);
18585 call_tests++;
18586 des_xmlNodePtr(n_target, target, 0);
18587 des_xmlAttrPtr(n_cur, cur, 1);
18588 xmlResetLastError();
18589 if (mem_base != xmlMemBlocks()) {
18590 printf("Leak of %d blocks found in xmlCopyPropList",
18591 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018592 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000018593 printf(" %d", n_target);
18594 printf(" %d", n_cur);
18595 printf("\n");
18596 }
18597 }
18598 }
Daniel Veillard57b25162004-11-06 14:50:18 +000018599 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018600
Daniel Veillard42595322004-11-08 10:52:06 +000018601 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018602}
18603
18604
18605static int
18606test_xmlCreateIntSubset(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018607 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018608
Daniel Veillard34099b42004-11-04 17:34:35 +000018609 int mem_base;
18610 xmlDtdPtr ret_val;
18611 xmlDocPtr doc; /* the document pointer */
18612 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018613 xmlChar * name; /* the DTD name */
Daniel Veillard34099b42004-11-04 17:34:35 +000018614 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018615 xmlChar * ExternalID; /* the external (PUBLIC) ID */
Daniel Veillard34099b42004-11-04 17:34:35 +000018616 int n_ExternalID;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018617 xmlChar * SystemID; /* the system ID */
Daniel Veillard34099b42004-11-04 17:34:35 +000018618 int n_SystemID;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018619
Daniel Veillard34099b42004-11-04 17:34:35 +000018620 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
18621 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
18622 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
18623 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
18624 mem_base = xmlMemBlocks();
18625 doc = gen_xmlDocPtr(n_doc, 0);
18626 name = gen_const_xmlChar_ptr(n_name, 1);
18627 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 2);
18628 SystemID = gen_const_xmlChar_ptr(n_SystemID, 3);
18629
William M. Brackf13f77f2004-11-12 16:03:48 +000018630 ret_val = xmlCreateIntSubset(doc, (const xmlChar *)name, (const xmlChar *)ExternalID, (const xmlChar *)SystemID);
Daniel Veillard34099b42004-11-04 17:34:35 +000018631 desret_xmlDtdPtr(ret_val);
18632 call_tests++;
18633 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000018634 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
18635 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 2);
18636 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 3);
Daniel Veillard34099b42004-11-04 17:34:35 +000018637 xmlResetLastError();
18638 if (mem_base != xmlMemBlocks()) {
18639 printf("Leak of %d blocks found in xmlCreateIntSubset",
18640 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018641 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000018642 printf(" %d", n_doc);
18643 printf(" %d", n_name);
18644 printf(" %d", n_ExternalID);
18645 printf(" %d", n_SystemID);
18646 printf("\n");
18647 }
18648 }
18649 }
18650 }
18651 }
Daniel Veillard34099b42004-11-04 17:34:35 +000018652 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018653
Daniel Veillard42595322004-11-08 10:52:06 +000018654 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018655}
18656
18657
18658static int
18659test_xmlDocCopyNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018660 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018661
Daniel Veillardce682bc2004-11-05 17:22:25 +000018662 int mem_base;
18663 xmlNodePtr ret_val;
18664 xmlNodePtr node; /* the node */
18665 int n_node;
18666 xmlDocPtr doc; /* the document */
18667 int n_doc;
18668 int extended; /* if 1 do a recursive copy (properties, namespaces and children when applicable) if 2 copy properties and namespaces (when applicable) */
18669 int n_extended;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018670
Daniel Veillardce682bc2004-11-05 17:22:25 +000018671 for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) {
18672 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
18673 for (n_extended = 0;n_extended < gen_nb_int;n_extended++) {
18674 mem_base = xmlMemBlocks();
18675 node = gen_const_xmlNodePtr(n_node, 0);
18676 doc = gen_xmlDocPtr(n_doc, 1);
18677 extended = gen_int(n_extended, 2);
18678
William M. Brackf13f77f2004-11-12 16:03:48 +000018679 ret_val = xmlDocCopyNode((const xmlNodePtr)node, doc, extended);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018680 desret_xmlNodePtr(ret_val);
18681 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000018682 des_const_xmlNodePtr(n_node, (const xmlNodePtr)node, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018683 des_xmlDocPtr(n_doc, doc, 1);
18684 des_int(n_extended, extended, 2);
18685 xmlResetLastError();
18686 if (mem_base != xmlMemBlocks()) {
18687 printf("Leak of %d blocks found in xmlDocCopyNode",
18688 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018689 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018690 printf(" %d", n_node);
18691 printf(" %d", n_doc);
18692 printf(" %d", n_extended);
18693 printf("\n");
18694 }
18695 }
18696 }
18697 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000018698 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018699
Daniel Veillard42595322004-11-08 10:52:06 +000018700 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018701}
18702
18703
18704static int
18705test_xmlDocCopyNodeList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018706 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018707
Daniel Veillardce682bc2004-11-05 17:22:25 +000018708 int mem_base;
18709 xmlNodePtr ret_val;
18710 xmlDocPtr doc; /* the target document */
18711 int n_doc;
18712 xmlNodePtr node; /* the first node in the list. */
18713 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018714
Daniel Veillardce682bc2004-11-05 17:22:25 +000018715 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
18716 for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) {
18717 mem_base = xmlMemBlocks();
18718 doc = gen_xmlDocPtr(n_doc, 0);
18719 node = gen_const_xmlNodePtr(n_node, 1);
18720
William M. Brackf13f77f2004-11-12 16:03:48 +000018721 ret_val = xmlDocCopyNodeList(doc, (const xmlNodePtr)node);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018722 desret_xmlNodePtr(ret_val);
18723 call_tests++;
18724 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000018725 des_const_xmlNodePtr(n_node, (const xmlNodePtr)node, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018726 xmlResetLastError();
18727 if (mem_base != xmlMemBlocks()) {
18728 printf("Leak of %d blocks found in xmlDocCopyNodeList",
18729 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018730 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018731 printf(" %d", n_doc);
18732 printf(" %d", n_node);
18733 printf("\n");
18734 }
18735 }
18736 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000018737 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018738
Daniel Veillard42595322004-11-08 10:52:06 +000018739 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018740}
18741
18742
18743static int
18744test_xmlDocDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018745 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018746
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000018747#ifdef LIBXML_OUTPUT_ENABLED
18748 int mem_base;
18749 int ret_val;
18750 FILE * f; /* the FILE* */
18751 int n_f;
18752 xmlDocPtr cur; /* the document */
18753 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018754
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000018755 for (n_f = 0;n_f < gen_nb_FILE_ptr;n_f++) {
18756 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
18757 mem_base = xmlMemBlocks();
18758 f = gen_FILE_ptr(n_f, 0);
18759 cur = gen_xmlDocPtr(n_cur, 1);
18760
18761 ret_val = xmlDocDump(f, cur);
18762 desret_int(ret_val);
18763 call_tests++;
18764 des_FILE_ptr(n_f, f, 0);
18765 des_xmlDocPtr(n_cur, cur, 1);
18766 xmlResetLastError();
18767 if (mem_base != xmlMemBlocks()) {
18768 printf("Leak of %d blocks found in xmlDocDump",
18769 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018770 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000018771 printf(" %d", n_f);
18772 printf(" %d", n_cur);
18773 printf("\n");
18774 }
18775 }
18776 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018777 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000018778#endif
18779
Daniel Veillard42595322004-11-08 10:52:06 +000018780 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018781}
18782
18783
18784static int
18785test_xmlDocDumpFormatMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018786 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018787
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018788#ifdef LIBXML_OUTPUT_ENABLED
18789 int mem_base;
18790 xmlDocPtr cur; /* the document */
18791 int n_cur;
18792 xmlChar ** mem; /* OUT: the memory pointer */
18793 int n_mem;
18794 int * size; /* OUT: the memory length */
18795 int n_size;
18796 int format; /* should formatting spaces been added */
18797 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018798
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018799 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
18800 for (n_mem = 0;n_mem < gen_nb_xmlChar_ptr_ptr;n_mem++) {
18801 for (n_size = 0;n_size < gen_nb_int_ptr;n_size++) {
18802 for (n_format = 0;n_format < gen_nb_int;n_format++) {
18803 mem_base = xmlMemBlocks();
18804 cur = gen_xmlDocPtr(n_cur, 0);
18805 mem = gen_xmlChar_ptr_ptr(n_mem, 1);
18806 size = gen_int_ptr(n_size, 2);
18807 format = gen_int(n_format, 3);
18808
18809 xmlDocDumpFormatMemory(cur, mem, size, format);
18810 call_tests++;
18811 des_xmlDocPtr(n_cur, cur, 0);
18812 des_xmlChar_ptr_ptr(n_mem, mem, 1);
18813 des_int_ptr(n_size, size, 2);
18814 des_int(n_format, format, 3);
18815 xmlResetLastError();
18816 if (mem_base != xmlMemBlocks()) {
18817 printf("Leak of %d blocks found in xmlDocDumpFormatMemory",
18818 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018819 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018820 printf(" %d", n_cur);
18821 printf(" %d", n_mem);
18822 printf(" %d", n_size);
18823 printf(" %d", n_format);
18824 printf("\n");
18825 }
18826 }
18827 }
18828 }
18829 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018830 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018831#endif
18832
Daniel Veillard42595322004-11-08 10:52:06 +000018833 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018834}
18835
18836
18837static int
18838test_xmlDocDumpFormatMemoryEnc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018839 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018840
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018841#ifdef LIBXML_OUTPUT_ENABLED
18842 int mem_base;
18843 xmlDocPtr out_doc; /* Document to generate XML text from */
18844 int n_out_doc;
18845 xmlChar ** doc_txt_ptr; /* Memory pointer for allocated XML text */
18846 int n_doc_txt_ptr;
18847 int * doc_txt_len; /* Length of the generated XML text */
18848 int n_doc_txt_len;
18849 char * txt_encoding; /* Character encoding to use when generating XML text */
18850 int n_txt_encoding;
18851 int format; /* should formatting spaces been added */
18852 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018853
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018854 for (n_out_doc = 0;n_out_doc < gen_nb_xmlDocPtr;n_out_doc++) {
18855 for (n_doc_txt_ptr = 0;n_doc_txt_ptr < gen_nb_xmlChar_ptr_ptr;n_doc_txt_ptr++) {
18856 for (n_doc_txt_len = 0;n_doc_txt_len < gen_nb_int_ptr;n_doc_txt_len++) {
18857 for (n_txt_encoding = 0;n_txt_encoding < gen_nb_const_char_ptr;n_txt_encoding++) {
18858 for (n_format = 0;n_format < gen_nb_int;n_format++) {
18859 mem_base = xmlMemBlocks();
18860 out_doc = gen_xmlDocPtr(n_out_doc, 0);
18861 doc_txt_ptr = gen_xmlChar_ptr_ptr(n_doc_txt_ptr, 1);
18862 doc_txt_len = gen_int_ptr(n_doc_txt_len, 2);
18863 txt_encoding = gen_const_char_ptr(n_txt_encoding, 3);
18864 format = gen_int(n_format, 4);
18865
William M. Brackf13f77f2004-11-12 16:03:48 +000018866 xmlDocDumpFormatMemoryEnc(out_doc, doc_txt_ptr, doc_txt_len, (const char *)txt_encoding, format);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018867 call_tests++;
18868 des_xmlDocPtr(n_out_doc, out_doc, 0);
18869 des_xmlChar_ptr_ptr(n_doc_txt_ptr, doc_txt_ptr, 1);
18870 des_int_ptr(n_doc_txt_len, doc_txt_len, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000018871 des_const_char_ptr(n_txt_encoding, (const char *)txt_encoding, 3);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018872 des_int(n_format, format, 4);
18873 xmlResetLastError();
18874 if (mem_base != xmlMemBlocks()) {
18875 printf("Leak of %d blocks found in xmlDocDumpFormatMemoryEnc",
18876 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018877 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018878 printf(" %d", n_out_doc);
18879 printf(" %d", n_doc_txt_ptr);
18880 printf(" %d", n_doc_txt_len);
18881 printf(" %d", n_txt_encoding);
18882 printf(" %d", n_format);
18883 printf("\n");
18884 }
18885 }
18886 }
18887 }
18888 }
18889 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018890 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018891#endif
18892
Daniel Veillard42595322004-11-08 10:52:06 +000018893 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018894}
18895
18896
18897static int
18898test_xmlDocDumpMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018899 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018900
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018901#ifdef LIBXML_OUTPUT_ENABLED
18902 int mem_base;
18903 xmlDocPtr cur; /* the document */
18904 int n_cur;
18905 xmlChar ** mem; /* OUT: the memory pointer */
18906 int n_mem;
18907 int * size; /* OUT: the memory length */
18908 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018909
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018910 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
18911 for (n_mem = 0;n_mem < gen_nb_xmlChar_ptr_ptr;n_mem++) {
18912 for (n_size = 0;n_size < gen_nb_int_ptr;n_size++) {
18913 mem_base = xmlMemBlocks();
18914 cur = gen_xmlDocPtr(n_cur, 0);
18915 mem = gen_xmlChar_ptr_ptr(n_mem, 1);
18916 size = gen_int_ptr(n_size, 2);
18917
18918 xmlDocDumpMemory(cur, mem, size);
18919 call_tests++;
18920 des_xmlDocPtr(n_cur, cur, 0);
18921 des_xmlChar_ptr_ptr(n_mem, mem, 1);
18922 des_int_ptr(n_size, size, 2);
18923 xmlResetLastError();
18924 if (mem_base != xmlMemBlocks()) {
18925 printf("Leak of %d blocks found in xmlDocDumpMemory",
18926 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018927 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018928 printf(" %d", n_cur);
18929 printf(" %d", n_mem);
18930 printf(" %d", n_size);
18931 printf("\n");
18932 }
18933 }
18934 }
18935 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018936 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018937#endif
18938
Daniel Veillard42595322004-11-08 10:52:06 +000018939 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018940}
18941
18942
18943static int
18944test_xmlDocDumpMemoryEnc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018945 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018946
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018947#ifdef LIBXML_OUTPUT_ENABLED
18948 int mem_base;
18949 xmlDocPtr out_doc; /* Document to generate XML text from */
18950 int n_out_doc;
18951 xmlChar ** doc_txt_ptr; /* Memory pointer for allocated XML text */
18952 int n_doc_txt_ptr;
18953 int * doc_txt_len; /* Length of the generated XML text */
18954 int n_doc_txt_len;
18955 char * txt_encoding; /* Character encoding to use when generating XML text */
18956 int n_txt_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018957
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018958 for (n_out_doc = 0;n_out_doc < gen_nb_xmlDocPtr;n_out_doc++) {
18959 for (n_doc_txt_ptr = 0;n_doc_txt_ptr < gen_nb_xmlChar_ptr_ptr;n_doc_txt_ptr++) {
18960 for (n_doc_txt_len = 0;n_doc_txt_len < gen_nb_int_ptr;n_doc_txt_len++) {
18961 for (n_txt_encoding = 0;n_txt_encoding < gen_nb_const_char_ptr;n_txt_encoding++) {
18962 mem_base = xmlMemBlocks();
18963 out_doc = gen_xmlDocPtr(n_out_doc, 0);
18964 doc_txt_ptr = gen_xmlChar_ptr_ptr(n_doc_txt_ptr, 1);
18965 doc_txt_len = gen_int_ptr(n_doc_txt_len, 2);
18966 txt_encoding = gen_const_char_ptr(n_txt_encoding, 3);
18967
William M. Brackf13f77f2004-11-12 16:03:48 +000018968 xmlDocDumpMemoryEnc(out_doc, doc_txt_ptr, doc_txt_len, (const char *)txt_encoding);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018969 call_tests++;
18970 des_xmlDocPtr(n_out_doc, out_doc, 0);
18971 des_xmlChar_ptr_ptr(n_doc_txt_ptr, doc_txt_ptr, 1);
18972 des_int_ptr(n_doc_txt_len, doc_txt_len, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000018973 des_const_char_ptr(n_txt_encoding, (const char *)txt_encoding, 3);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018974 xmlResetLastError();
18975 if (mem_base != xmlMemBlocks()) {
18976 printf("Leak of %d blocks found in xmlDocDumpMemoryEnc",
18977 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018978 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018979 printf(" %d", n_out_doc);
18980 printf(" %d", n_doc_txt_ptr);
18981 printf(" %d", n_doc_txt_len);
18982 printf(" %d", n_txt_encoding);
18983 printf("\n");
18984 }
18985 }
18986 }
18987 }
18988 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018989 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018990#endif
18991
Daniel Veillard42595322004-11-08 10:52:06 +000018992 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018993}
18994
18995
18996static int
18997test_xmlDocFormatDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018998 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018999
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019000#ifdef LIBXML_OUTPUT_ENABLED
19001 int mem_base;
19002 int ret_val;
19003 FILE * f; /* the FILE* */
19004 int n_f;
19005 xmlDocPtr cur; /* the document */
19006 int n_cur;
19007 int format; /* should formatting spaces been added */
19008 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019009
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019010 for (n_f = 0;n_f < gen_nb_FILE_ptr;n_f++) {
19011 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
19012 for (n_format = 0;n_format < gen_nb_int;n_format++) {
19013 mem_base = xmlMemBlocks();
19014 f = gen_FILE_ptr(n_f, 0);
19015 cur = gen_xmlDocPtr(n_cur, 1);
19016 format = gen_int(n_format, 2);
19017
19018 ret_val = xmlDocFormatDump(f, cur, format);
19019 desret_int(ret_val);
19020 call_tests++;
19021 des_FILE_ptr(n_f, f, 0);
19022 des_xmlDocPtr(n_cur, cur, 1);
19023 des_int(n_format, format, 2);
19024 xmlResetLastError();
19025 if (mem_base != xmlMemBlocks()) {
19026 printf("Leak of %d blocks found in xmlDocFormatDump",
19027 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019028 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019029 printf(" %d", n_f);
19030 printf(" %d", n_cur);
19031 printf(" %d", n_format);
19032 printf("\n");
19033 }
19034 }
19035 }
19036 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019037 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019038#endif
19039
Daniel Veillard42595322004-11-08 10:52:06 +000019040 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019041}
19042
19043
19044static int
19045test_xmlDocGetRootElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019046 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019047
19048 int mem_base;
19049 xmlNodePtr ret_val;
19050 xmlDocPtr doc; /* the document */
19051 int n_doc;
19052
19053 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19054 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019055 doc = gen_xmlDocPtr(n_doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019056
19057 ret_val = xmlDocGetRootElement(doc);
19058 desret_xmlNodePtr(ret_val);
19059 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019060 des_xmlDocPtr(n_doc, doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019061 xmlResetLastError();
19062 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019063 printf("Leak of %d blocks found in xmlDocGetRootElement",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019064 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019065 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019066 printf(" %d", n_doc);
19067 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019068 }
19069 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019070 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019071
Daniel Veillard42595322004-11-08 10:52:06 +000019072 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019073}
19074
19075
19076static int
19077test_xmlDocSetRootElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019078 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019079
19080#ifdef LIBXML_TREE_ENABLED
19081 int mem_base;
19082 xmlNodePtr ret_val;
19083 xmlDocPtr doc; /* the document */
19084 int n_doc;
19085 xmlNodePtr root; /* the new document root element */
19086 int n_root;
19087
19088 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019089 for (n_root = 0;n_root < gen_nb_xmlNodePtr_in;n_root++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000019090 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019091 doc = gen_xmlDocPtr(n_doc, 0);
19092 root = gen_xmlNodePtr_in(n_root, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019093
19094 ret_val = xmlDocSetRootElement(doc, root);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019095 if (doc == NULL) { xmlFreeNode(root) ; root = NULL ; }
Daniel Veillardd93f6252004-11-02 15:53:51 +000019096 desret_xmlNodePtr(ret_val);
19097 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019098 des_xmlDocPtr(n_doc, doc, 0);
19099 des_xmlNodePtr_in(n_root, root, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019100 xmlResetLastError();
19101 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019102 printf("Leak of %d blocks found in xmlDocSetRootElement",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019103 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019104 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019105 printf(" %d", n_doc);
19106 printf(" %d", n_root);
19107 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019108 }
19109 }
19110 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019111 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019112#endif
19113
Daniel Veillard42595322004-11-08 10:52:06 +000019114 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019115}
19116
19117
19118static int
19119test_xmlElemDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019120 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019121
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019122#ifdef LIBXML_OUTPUT_ENABLED
19123 int mem_base;
19124 FILE * f; /* the FILE * for the output */
19125 int n_f;
19126 xmlDocPtr doc; /* the document */
19127 int n_doc;
19128 xmlNodePtr cur; /* the current node */
19129 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019130
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019131 for (n_f = 0;n_f < gen_nb_FILE_ptr;n_f++) {
19132 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19133 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
19134 mem_base = xmlMemBlocks();
19135 f = gen_FILE_ptr(n_f, 0);
19136 doc = gen_xmlDocPtr(n_doc, 1);
19137 cur = gen_xmlNodePtr(n_cur, 2);
19138
19139 xmlElemDump(f, doc, cur);
19140 call_tests++;
19141 des_FILE_ptr(n_f, f, 0);
19142 des_xmlDocPtr(n_doc, doc, 1);
19143 des_xmlNodePtr(n_cur, cur, 2);
19144 xmlResetLastError();
19145 if (mem_base != xmlMemBlocks()) {
19146 printf("Leak of %d blocks found in xmlElemDump",
19147 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019148 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019149 printf(" %d", n_f);
19150 printf(" %d", n_doc);
19151 printf(" %d", n_cur);
19152 printf("\n");
19153 }
19154 }
19155 }
19156 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019157 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019158#endif
19159
Daniel Veillard42595322004-11-08 10:52:06 +000019160 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019161}
19162
19163
19164static int
19165test_xmlGetBufferAllocationScheme(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019166 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019167
Daniel Veillard57b25162004-11-06 14:50:18 +000019168 int mem_base;
19169 xmlBufferAllocationScheme ret_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019170
Daniel Veillard57b25162004-11-06 14:50:18 +000019171 mem_base = xmlMemBlocks();
19172
19173 ret_val = xmlGetBufferAllocationScheme();
19174 desret_xmlBufferAllocationScheme(ret_val);
19175 call_tests++;
19176 xmlResetLastError();
19177 if (mem_base != xmlMemBlocks()) {
19178 printf("Leak of %d blocks found in xmlGetBufferAllocationScheme",
19179 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019180 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000019181 printf("\n");
19182 }
Daniel Veillard57b25162004-11-06 14:50:18 +000019183 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019184
Daniel Veillard42595322004-11-08 10:52:06 +000019185 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019186}
19187
19188
19189static int
19190test_xmlGetCompressMode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019191 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019192
19193 int mem_base;
19194 int ret_val;
19195
19196 mem_base = xmlMemBlocks();
19197
19198 ret_val = xmlGetCompressMode();
19199 desret_int(ret_val);
19200 call_tests++;
19201 xmlResetLastError();
19202 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019203 printf("Leak of %d blocks found in xmlGetCompressMode",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019204 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019205 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019206 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019207 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019208 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019209
Daniel Veillard42595322004-11-08 10:52:06 +000019210 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019211}
19212
19213
19214static int
19215test_xmlGetDocCompressMode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019216 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019217
19218 int mem_base;
19219 int ret_val;
19220 xmlDocPtr doc; /* the document */
19221 int n_doc;
19222
19223 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19224 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019225 doc = gen_xmlDocPtr(n_doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019226
19227 ret_val = xmlGetDocCompressMode(doc);
19228 desret_int(ret_val);
19229 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019230 des_xmlDocPtr(n_doc, doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019231 xmlResetLastError();
19232 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019233 printf("Leak of %d blocks found in xmlGetDocCompressMode",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019234 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019235 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019236 printf(" %d", n_doc);
19237 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019238 }
19239 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019240 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019241
Daniel Veillard42595322004-11-08 10:52:06 +000019242 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019243}
19244
19245
19246static int
19247test_xmlGetIntSubset(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019248 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019249
Daniel Veillard34099b42004-11-04 17:34:35 +000019250 int mem_base;
19251 xmlDtdPtr ret_val;
19252 xmlDocPtr doc; /* the document pointer */
19253 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019254
Daniel Veillard34099b42004-11-04 17:34:35 +000019255 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19256 mem_base = xmlMemBlocks();
19257 doc = gen_xmlDocPtr(n_doc, 0);
19258
19259 ret_val = xmlGetIntSubset(doc);
19260 desret_xmlDtdPtr(ret_val);
19261 call_tests++;
19262 des_xmlDocPtr(n_doc, doc, 0);
19263 xmlResetLastError();
19264 if (mem_base != xmlMemBlocks()) {
19265 printf("Leak of %d blocks found in xmlGetIntSubset",
19266 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019267 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000019268 printf(" %d", n_doc);
19269 printf("\n");
19270 }
19271 }
Daniel Veillard34099b42004-11-04 17:34:35 +000019272 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019273
Daniel Veillard42595322004-11-08 10:52:06 +000019274 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019275}
19276
19277
19278static int
19279test_xmlGetLastChild(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019280 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019281
19282 int mem_base;
19283 xmlNodePtr ret_val;
19284 xmlNodePtr parent; /* the parent node */
19285 int n_parent;
19286
19287 for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) {
19288 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019289 parent = gen_xmlNodePtr(n_parent, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019290
19291 ret_val = xmlGetLastChild(parent);
19292 desret_xmlNodePtr(ret_val);
19293 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019294 des_xmlNodePtr(n_parent, parent, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019295 xmlResetLastError();
19296 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019297 printf("Leak of %d blocks found in xmlGetLastChild",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019298 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019299 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019300 printf(" %d", n_parent);
19301 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019302 }
19303 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019304 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019305
Daniel Veillard42595322004-11-08 10:52:06 +000019306 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019307}
19308
19309
19310static int
19311test_xmlGetLineNo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019312 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019313
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019314 int mem_base;
19315 long ret_val;
19316 xmlNodePtr node; /* valid node */
19317 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019318
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019319 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19320 mem_base = xmlMemBlocks();
19321 node = gen_xmlNodePtr(n_node, 0);
19322
19323 ret_val = xmlGetLineNo(node);
19324 desret_long(ret_val);
19325 call_tests++;
19326 des_xmlNodePtr(n_node, node, 0);
19327 xmlResetLastError();
19328 if (mem_base != xmlMemBlocks()) {
19329 printf("Leak of %d blocks found in xmlGetLineNo",
19330 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019331 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019332 printf(" %d", n_node);
19333 printf("\n");
19334 }
19335 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019336 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019337
Daniel Veillard42595322004-11-08 10:52:06 +000019338 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019339}
19340
19341
19342static int
19343test_xmlGetNoNsProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019344 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019345
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019346 int mem_base;
19347 xmlChar * ret_val;
19348 xmlNodePtr node; /* the node */
19349 int n_node;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019350 xmlChar * name; /* the attribute name */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019351 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019352
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019353 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19354 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19355 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019356 node = gen_xmlNodePtr(n_node, 0);
19357 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019358
William M. Brackf13f77f2004-11-12 16:03:48 +000019359 ret_val = xmlGetNoNsProp(node, (const xmlChar *)name);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019360 desret_xmlChar_ptr(ret_val);
19361 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019362 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000019363 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019364 xmlResetLastError();
19365 if (mem_base != xmlMemBlocks()) {
19366 printf("Leak of %d blocks found in xmlGetNoNsProp",
19367 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019368 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019369 printf(" %d", n_node);
19370 printf(" %d", n_name);
19371 printf("\n");
19372 }
19373 }
19374 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019375 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019376
Daniel Veillard42595322004-11-08 10:52:06 +000019377 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019378}
19379
19380
19381static int
19382test_xmlGetNodePath(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019383 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019384
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019385#ifdef LIBXML_TREE_ENABLED
19386 int mem_base;
19387 xmlChar * ret_val;
19388 xmlNodePtr node; /* a node */
19389 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019390
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019391 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19392 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019393 node = gen_xmlNodePtr(n_node, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019394
19395 ret_val = xmlGetNodePath(node);
19396 desret_xmlChar_ptr(ret_val);
19397 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019398 des_xmlNodePtr(n_node, node, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019399 xmlResetLastError();
19400 if (mem_base != xmlMemBlocks()) {
19401 printf("Leak of %d blocks found in xmlGetNodePath",
19402 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019403 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019404 printf(" %d", n_node);
19405 printf("\n");
19406 }
19407 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019408 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019409#endif
19410
Daniel Veillard42595322004-11-08 10:52:06 +000019411 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019412}
19413
19414
19415static int
19416test_xmlGetNsList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019417 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019418
19419
19420 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000019421 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019422}
19423
19424
19425static int
19426test_xmlGetNsProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019427 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019428
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019429 int mem_base;
19430 xmlChar * ret_val;
19431 xmlNodePtr node; /* the node */
19432 int n_node;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019433 xmlChar * name; /* the attribute name */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019434 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019435 xmlChar * nameSpace; /* the URI of the namespace */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019436 int n_nameSpace;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019437
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019438 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19439 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19440 for (n_nameSpace = 0;n_nameSpace < gen_nb_const_xmlChar_ptr;n_nameSpace++) {
19441 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019442 node = gen_xmlNodePtr(n_node, 0);
19443 name = gen_const_xmlChar_ptr(n_name, 1);
19444 nameSpace = gen_const_xmlChar_ptr(n_nameSpace, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019445
William M. Brackf13f77f2004-11-12 16:03:48 +000019446 ret_val = xmlGetNsProp(node, (const xmlChar *)name, (const xmlChar *)nameSpace);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019447 desret_xmlChar_ptr(ret_val);
19448 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019449 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000019450 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
19451 des_const_xmlChar_ptr(n_nameSpace, (const xmlChar *)nameSpace, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019452 xmlResetLastError();
19453 if (mem_base != xmlMemBlocks()) {
19454 printf("Leak of %d blocks found in xmlGetNsProp",
19455 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019456 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019457 printf(" %d", n_node);
19458 printf(" %d", n_name);
19459 printf(" %d", n_nameSpace);
19460 printf("\n");
19461 }
19462 }
19463 }
19464 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019465 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019466
Daniel Veillard42595322004-11-08 10:52:06 +000019467 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019468}
19469
19470
19471static int
19472test_xmlGetProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019473 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019474
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019475 int mem_base;
19476 xmlChar * ret_val;
19477 xmlNodePtr node; /* the node */
19478 int n_node;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019479 xmlChar * name; /* the attribute name */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019480 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019481
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019482 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19483 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19484 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019485 node = gen_xmlNodePtr(n_node, 0);
19486 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019487
William M. Brackf13f77f2004-11-12 16:03:48 +000019488 ret_val = xmlGetProp(node, (const xmlChar *)name);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019489 desret_xmlChar_ptr(ret_val);
19490 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019491 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000019492 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019493 xmlResetLastError();
19494 if (mem_base != xmlMemBlocks()) {
19495 printf("Leak of %d blocks found in xmlGetProp",
19496 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019497 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019498 printf(" %d", n_node);
19499 printf(" %d", n_name);
19500 printf("\n");
19501 }
19502 }
19503 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019504 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019505
Daniel Veillard42595322004-11-08 10:52:06 +000019506 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019507}
19508
19509
19510static int
19511test_xmlHasNsProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019512 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019513
Daniel Veillard57b25162004-11-06 14:50:18 +000019514 int mem_base;
19515 xmlAttrPtr ret_val;
19516 xmlNodePtr node; /* the node */
19517 int n_node;
19518 xmlChar * name; /* the attribute name */
19519 int n_name;
19520 xmlChar * nameSpace; /* the URI of the namespace */
19521 int n_nameSpace;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019522
Daniel Veillard57b25162004-11-06 14:50:18 +000019523 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19524 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19525 for (n_nameSpace = 0;n_nameSpace < gen_nb_const_xmlChar_ptr;n_nameSpace++) {
19526 mem_base = xmlMemBlocks();
19527 node = gen_xmlNodePtr(n_node, 0);
19528 name = gen_const_xmlChar_ptr(n_name, 1);
19529 nameSpace = gen_const_xmlChar_ptr(n_nameSpace, 2);
19530
William M. Brackf13f77f2004-11-12 16:03:48 +000019531 ret_val = xmlHasNsProp(node, (const xmlChar *)name, (const xmlChar *)nameSpace);
Daniel Veillard57b25162004-11-06 14:50:18 +000019532 desret_xmlAttrPtr(ret_val);
19533 call_tests++;
19534 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000019535 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
19536 des_const_xmlChar_ptr(n_nameSpace, (const xmlChar *)nameSpace, 2);
Daniel Veillard57b25162004-11-06 14:50:18 +000019537 xmlResetLastError();
19538 if (mem_base != xmlMemBlocks()) {
19539 printf("Leak of %d blocks found in xmlHasNsProp",
19540 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019541 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000019542 printf(" %d", n_node);
19543 printf(" %d", n_name);
19544 printf(" %d", n_nameSpace);
19545 printf("\n");
19546 }
19547 }
19548 }
19549 }
Daniel Veillard57b25162004-11-06 14:50:18 +000019550 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019551
Daniel Veillard42595322004-11-08 10:52:06 +000019552 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019553}
19554
19555
19556static int
19557test_xmlHasProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019558 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019559
Daniel Veillard57b25162004-11-06 14:50:18 +000019560 int mem_base;
19561 xmlAttrPtr ret_val;
19562 xmlNodePtr node; /* the node */
19563 int n_node;
19564 xmlChar * name; /* the attribute name */
19565 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019566
Daniel Veillard57b25162004-11-06 14:50:18 +000019567 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19568 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19569 mem_base = xmlMemBlocks();
19570 node = gen_xmlNodePtr(n_node, 0);
19571 name = gen_const_xmlChar_ptr(n_name, 1);
19572
William M. Brackf13f77f2004-11-12 16:03:48 +000019573 ret_val = xmlHasProp(node, (const xmlChar *)name);
Daniel Veillard57b25162004-11-06 14:50:18 +000019574 desret_xmlAttrPtr(ret_val);
19575 call_tests++;
19576 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000019577 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard57b25162004-11-06 14:50:18 +000019578 xmlResetLastError();
19579 if (mem_base != xmlMemBlocks()) {
19580 printf("Leak of %d blocks found in xmlHasProp",
19581 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019582 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000019583 printf(" %d", n_node);
19584 printf(" %d", n_name);
19585 printf("\n");
19586 }
19587 }
19588 }
Daniel Veillard57b25162004-11-06 14:50:18 +000019589 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019590
Daniel Veillard42595322004-11-08 10:52:06 +000019591 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019592}
19593
19594
19595static int
19596test_xmlIsBlankNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019597 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019598
19599 int mem_base;
19600 int ret_val;
19601 xmlNodePtr node; /* the node */
19602 int n_node;
19603
19604 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19605 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019606 node = gen_xmlNodePtr(n_node, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019607
19608 ret_val = xmlIsBlankNode(node);
19609 desret_int(ret_val);
19610 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019611 des_xmlNodePtr(n_node, node, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019612 xmlResetLastError();
19613 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019614 printf("Leak of %d blocks found in xmlIsBlankNode",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019615 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019616 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019617 printf(" %d", n_node);
19618 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019619 }
19620 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019621 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019622
Daniel Veillard42595322004-11-08 10:52:06 +000019623 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019624}
19625
19626
19627static int
19628test_xmlIsXHTML(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019629 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019630
19631 int mem_base;
19632 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019633 xmlChar * systemID; /* the system identifier */
Daniel Veillardd93f6252004-11-02 15:53:51 +000019634 int n_systemID;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019635 xmlChar * publicID; /* the public identifier */
Daniel Veillardd93f6252004-11-02 15:53:51 +000019636 int n_publicID;
19637
19638 for (n_systemID = 0;n_systemID < gen_nb_const_xmlChar_ptr;n_systemID++) {
19639 for (n_publicID = 0;n_publicID < gen_nb_const_xmlChar_ptr;n_publicID++) {
19640 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019641 systemID = gen_const_xmlChar_ptr(n_systemID, 0);
19642 publicID = gen_const_xmlChar_ptr(n_publicID, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019643
William M. Brackf13f77f2004-11-12 16:03:48 +000019644 ret_val = xmlIsXHTML((const xmlChar *)systemID, (const xmlChar *)publicID);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019645 desret_int(ret_val);
19646 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000019647 des_const_xmlChar_ptr(n_systemID, (const xmlChar *)systemID, 0);
19648 des_const_xmlChar_ptr(n_publicID, (const xmlChar *)publicID, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019649 xmlResetLastError();
19650 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019651 printf("Leak of %d blocks found in xmlIsXHTML",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019652 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019653 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019654 printf(" %d", n_systemID);
19655 printf(" %d", n_publicID);
19656 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019657 }
19658 }
19659 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019660 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019661
Daniel Veillard42595322004-11-08 10:52:06 +000019662 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019663}
19664
19665
19666static int
19667test_xmlNewCDataBlock(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019668 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019669
19670 int mem_base;
19671 xmlNodePtr ret_val;
19672 xmlDocPtr doc; /* the document */
19673 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019674 xmlChar * content; /* the CDATA block content content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000019675 int n_content;
19676 int len; /* the length of the block */
19677 int n_len;
19678
19679 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19680 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
19681 for (n_len = 0;n_len < gen_nb_int;n_len++) {
19682 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019683 doc = gen_xmlDocPtr(n_doc, 0);
19684 content = gen_const_xmlChar_ptr(n_content, 1);
19685 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019686
William M. Brackf13f77f2004-11-12 16:03:48 +000019687 ret_val = xmlNewCDataBlock(doc, (const xmlChar *)content, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019688 desret_xmlNodePtr(ret_val);
19689 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019690 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000019691 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000019692 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019693 xmlResetLastError();
19694 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019695 printf("Leak of %d blocks found in xmlNewCDataBlock",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019696 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019697 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019698 printf(" %d", n_doc);
19699 printf(" %d", n_content);
19700 printf(" %d", n_len);
19701 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019702 }
19703 }
19704 }
19705 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019706 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019707
Daniel Veillard42595322004-11-08 10:52:06 +000019708 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019709}
19710
19711
19712static int
19713test_xmlNewCharRef(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019714 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019715
19716 int mem_base;
19717 xmlNodePtr ret_val;
19718 xmlDocPtr doc; /* the document */
19719 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019720 xmlChar * name; /* the char ref string, starting with # or "&# ... ;" */
Daniel Veillardd93f6252004-11-02 15:53:51 +000019721 int n_name;
19722
19723 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19724 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19725 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019726 doc = gen_xmlDocPtr(n_doc, 0);
19727 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019728
William M. Brackf13f77f2004-11-12 16:03:48 +000019729 ret_val = xmlNewCharRef(doc, (const xmlChar *)name);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019730 desret_xmlNodePtr(ret_val);
19731 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019732 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000019733 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019734 xmlResetLastError();
19735 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019736 printf("Leak of %d blocks found in xmlNewCharRef",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019737 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019738 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019739 printf(" %d", n_doc);
19740 printf(" %d", n_name);
19741 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019742 }
19743 }
19744 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019745 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019746
Daniel Veillard42595322004-11-08 10:52:06 +000019747 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019748}
19749
19750
19751static int
19752test_xmlNewChild(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019753 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019754
Daniel Veillarda521d282004-11-09 14:59:59 +000019755#ifdef LIBXML_TREE_ENABLED
Daniel Veillard27f20102004-11-05 11:50:11 +000019756 int mem_base;
19757 xmlNodePtr ret_val;
19758 xmlNodePtr parent; /* the parent node */
19759 int n_parent;
19760 xmlNsPtr ns; /* a namespace if any */
19761 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019762 xmlChar * name; /* the name of the child */
Daniel Veillard27f20102004-11-05 11:50:11 +000019763 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019764 xmlChar * content; /* the XML content of the child if any. */
Daniel Veillard27f20102004-11-05 11:50:11 +000019765 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019766
Daniel Veillard27f20102004-11-05 11:50:11 +000019767 for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) {
19768 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
19769 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19770 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
19771 mem_base = xmlMemBlocks();
19772 parent = gen_xmlNodePtr(n_parent, 0);
19773 ns = gen_xmlNsPtr(n_ns, 1);
19774 name = gen_const_xmlChar_ptr(n_name, 2);
19775 content = gen_const_xmlChar_ptr(n_content, 3);
19776
William M. Brackf13f77f2004-11-12 16:03:48 +000019777 ret_val = xmlNewChild(parent, ns, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillard27f20102004-11-05 11:50:11 +000019778 desret_xmlNodePtr(ret_val);
19779 call_tests++;
19780 des_xmlNodePtr(n_parent, parent, 0);
19781 des_xmlNsPtr(n_ns, ns, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000019782 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
19783 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 3);
Daniel Veillard27f20102004-11-05 11:50:11 +000019784 xmlResetLastError();
19785 if (mem_base != xmlMemBlocks()) {
19786 printf("Leak of %d blocks found in xmlNewChild",
19787 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019788 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000019789 printf(" %d", n_parent);
19790 printf(" %d", n_ns);
19791 printf(" %d", n_name);
19792 printf(" %d", n_content);
19793 printf("\n");
19794 }
19795 }
19796 }
19797 }
19798 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019799 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000019800#endif
Daniel Veillard27f20102004-11-05 11:50:11 +000019801
Daniel Veillard42595322004-11-08 10:52:06 +000019802 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019803}
19804
19805
19806static int
19807test_xmlNewComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019808 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019809
19810 int mem_base;
19811 xmlNodePtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019812 xmlChar * content; /* the comment content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000019813 int n_content;
19814
19815 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
19816 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019817 content = gen_const_xmlChar_ptr(n_content, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019818
William M. Brackf13f77f2004-11-12 16:03:48 +000019819 ret_val = xmlNewComment((const xmlChar *)content);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019820 desret_xmlNodePtr(ret_val);
19821 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000019822 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019823 xmlResetLastError();
19824 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019825 printf("Leak of %d blocks found in xmlNewComment",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019826 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019827 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019828 printf(" %d", n_content);
19829 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019830 }
19831 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019832 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019833
Daniel Veillard42595322004-11-08 10:52:06 +000019834 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019835}
19836
19837
19838static int
19839test_xmlNewDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019840 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019841
19842 int mem_base;
19843 xmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019844 xmlChar * version; /* xmlChar string giving the version of XML "1.0" */
Daniel Veillardd93f6252004-11-02 15:53:51 +000019845 int n_version;
19846
19847 for (n_version = 0;n_version < gen_nb_const_xmlChar_ptr;n_version++) {
19848 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019849 version = gen_const_xmlChar_ptr(n_version, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019850
William M. Brackf13f77f2004-11-12 16:03:48 +000019851 ret_val = xmlNewDoc((const xmlChar *)version);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019852 desret_xmlDocPtr(ret_val);
19853 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000019854 des_const_xmlChar_ptr(n_version, (const xmlChar *)version, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019855 xmlResetLastError();
19856 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019857 printf("Leak of %d blocks found in xmlNewDoc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019858 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019859 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019860 printf(" %d", n_version);
19861 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019862 }
19863 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019864 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019865
Daniel Veillard42595322004-11-08 10:52:06 +000019866 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019867}
19868
19869
19870static int
19871test_xmlNewDocComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019872 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019873
19874 int mem_base;
19875 xmlNodePtr ret_val;
19876 xmlDocPtr doc; /* the document */
19877 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019878 xmlChar * content; /* the comment content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000019879 int n_content;
19880
19881 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19882 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
19883 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019884 doc = gen_xmlDocPtr(n_doc, 0);
19885 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019886
William M. Brackf13f77f2004-11-12 16:03:48 +000019887 ret_val = xmlNewDocComment(doc, (const xmlChar *)content);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019888 desret_xmlNodePtr(ret_val);
19889 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019890 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000019891 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019892 xmlResetLastError();
19893 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019894 printf("Leak of %d blocks found in xmlNewDocComment",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019895 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019896 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019897 printf(" %d", n_doc);
19898 printf(" %d", n_content);
19899 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019900 }
19901 }
19902 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019903 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019904
Daniel Veillard42595322004-11-08 10:52:06 +000019905 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019906}
19907
19908
19909static int
19910test_xmlNewDocFragment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019911 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019912
19913#ifdef LIBXML_TREE_ENABLED
19914 int mem_base;
19915 xmlNodePtr ret_val;
19916 xmlDocPtr doc; /* the document owning the fragment */
19917 int n_doc;
19918
19919 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19920 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019921 doc = gen_xmlDocPtr(n_doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019922
19923 ret_val = xmlNewDocFragment(doc);
19924 desret_xmlNodePtr(ret_val);
19925 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019926 des_xmlDocPtr(n_doc, doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019927 xmlResetLastError();
19928 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019929 printf("Leak of %d blocks found in xmlNewDocFragment",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019930 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019931 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019932 printf(" %d", n_doc);
19933 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019934 }
19935 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019936 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019937#endif
19938
Daniel Veillard42595322004-11-08 10:52:06 +000019939 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019940}
19941
19942
19943static int
19944test_xmlNewDocNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019945 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019946
Daniel Veillard27f20102004-11-05 11:50:11 +000019947 int mem_base;
19948 xmlNodePtr ret_val;
19949 xmlDocPtr doc; /* the document */
19950 int n_doc;
19951 xmlNsPtr ns; /* namespace if any */
19952 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019953 xmlChar * name; /* the node name */
Daniel Veillard27f20102004-11-05 11:50:11 +000019954 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019955 xmlChar * content; /* the XML text content if any */
Daniel Veillard27f20102004-11-05 11:50:11 +000019956 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019957
Daniel Veillard27f20102004-11-05 11:50:11 +000019958 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19959 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
19960 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19961 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
19962 mem_base = xmlMemBlocks();
19963 doc = gen_xmlDocPtr(n_doc, 0);
19964 ns = gen_xmlNsPtr(n_ns, 1);
19965 name = gen_const_xmlChar_ptr(n_name, 2);
19966 content = gen_const_xmlChar_ptr(n_content, 3);
19967
William M. Brackf13f77f2004-11-12 16:03:48 +000019968 ret_val = xmlNewDocNode(doc, ns, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillard27f20102004-11-05 11:50:11 +000019969 desret_xmlNodePtr(ret_val);
19970 call_tests++;
19971 des_xmlDocPtr(n_doc, doc, 0);
19972 des_xmlNsPtr(n_ns, ns, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000019973 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
19974 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 3);
Daniel Veillard27f20102004-11-05 11:50:11 +000019975 xmlResetLastError();
19976 if (mem_base != xmlMemBlocks()) {
19977 printf("Leak of %d blocks found in xmlNewDocNode",
19978 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019979 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000019980 printf(" %d", n_doc);
19981 printf(" %d", n_ns);
19982 printf(" %d", n_name);
19983 printf(" %d", n_content);
19984 printf("\n");
19985 }
19986 }
19987 }
19988 }
19989 }
Daniel Veillard27f20102004-11-05 11:50:11 +000019990 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019991
Daniel Veillard42595322004-11-08 10:52:06 +000019992 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019993}
19994
19995
19996static int
19997test_xmlNewDocNodeEatName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019998 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019999
Daniel Veillard27f20102004-11-05 11:50:11 +000020000 int mem_base;
20001 xmlNodePtr ret_val;
20002 xmlDocPtr doc; /* the document */
20003 int n_doc;
20004 xmlNsPtr ns; /* namespace if any */
20005 int n_ns;
20006 xmlChar * name; /* the node name */
20007 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020008 xmlChar * content; /* the XML text content if any */
Daniel Veillard27f20102004-11-05 11:50:11 +000020009 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020010
Daniel Veillard27f20102004-11-05 11:50:11 +000020011 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20012 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20013 for (n_name = 0;n_name < gen_nb_eaten_name;n_name++) {
20014 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20015 mem_base = xmlMemBlocks();
20016 doc = gen_xmlDocPtr(n_doc, 0);
20017 ns = gen_xmlNsPtr(n_ns, 1);
20018 name = gen_eaten_name(n_name, 2);
20019 content = gen_const_xmlChar_ptr(n_content, 3);
20020
William M. Brackf13f77f2004-11-12 16:03:48 +000020021 ret_val = xmlNewDocNodeEatName(doc, ns, name, (const xmlChar *)content);
Daniel Veillard27f20102004-11-05 11:50:11 +000020022 desret_xmlNodePtr(ret_val);
20023 call_tests++;
20024 des_xmlDocPtr(n_doc, doc, 0);
20025 des_xmlNsPtr(n_ns, ns, 1);
20026 des_eaten_name(n_name, name, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000020027 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 3);
Daniel Veillard27f20102004-11-05 11:50:11 +000020028 xmlResetLastError();
20029 if (mem_base != xmlMemBlocks()) {
20030 printf("Leak of %d blocks found in xmlNewDocNodeEatName",
20031 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020032 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000020033 printf(" %d", n_doc);
20034 printf(" %d", n_ns);
20035 printf(" %d", n_name);
20036 printf(" %d", n_content);
20037 printf("\n");
20038 }
20039 }
20040 }
20041 }
20042 }
Daniel Veillard27f20102004-11-05 11:50:11 +000020043 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020044
Daniel Veillard42595322004-11-08 10:52:06 +000020045 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020046}
20047
20048
20049static int
20050test_xmlNewDocPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020051 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020052
20053 int mem_base;
20054 xmlNodePtr ret_val;
20055 xmlDocPtr doc; /* the target document */
20056 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020057 xmlChar * name; /* the processing instruction name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020058 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020059 xmlChar * content; /* the PI content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020060 int n_content;
20061
20062 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20063 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20064 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20065 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020066 doc = gen_xmlDocPtr(n_doc, 0);
20067 name = gen_const_xmlChar_ptr(n_name, 1);
20068 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020069
William M. Brackf13f77f2004-11-12 16:03:48 +000020070 ret_val = xmlNewDocPI(doc, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020071 desret_xmlNodePtr(ret_val);
20072 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020073 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020074 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
20075 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020076 xmlResetLastError();
20077 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020078 printf("Leak of %d blocks found in xmlNewDocPI",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020079 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020080 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020081 printf(" %d", n_doc);
20082 printf(" %d", n_name);
20083 printf(" %d", n_content);
20084 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020085 }
20086 }
20087 }
20088 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020089 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020090
Daniel Veillard42595322004-11-08 10:52:06 +000020091 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020092}
20093
20094
20095static int
20096test_xmlNewDocProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020097 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020098
Daniel Veillard57b25162004-11-06 14:50:18 +000020099 int mem_base;
20100 xmlAttrPtr ret_val;
20101 xmlDocPtr doc; /* the document */
20102 int n_doc;
20103 xmlChar * name; /* the name of the attribute */
20104 int n_name;
20105 xmlChar * value; /* the value of the attribute */
20106 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020107
Daniel Veillard57b25162004-11-06 14:50:18 +000020108 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20109 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20110 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
20111 mem_base = xmlMemBlocks();
20112 doc = gen_xmlDocPtr(n_doc, 0);
20113 name = gen_const_xmlChar_ptr(n_name, 1);
20114 value = gen_const_xmlChar_ptr(n_value, 2);
20115
William M. Brackf13f77f2004-11-12 16:03:48 +000020116 ret_val = xmlNewDocProp(doc, (const xmlChar *)name, (const xmlChar *)value);
Daniel Veillard57b25162004-11-06 14:50:18 +000020117 desret_xmlAttrPtr(ret_val);
20118 call_tests++;
20119 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020120 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
20121 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 2);
Daniel Veillard57b25162004-11-06 14:50:18 +000020122 xmlResetLastError();
20123 if (mem_base != xmlMemBlocks()) {
20124 printf("Leak of %d blocks found in xmlNewDocProp",
20125 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020126 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000020127 printf(" %d", n_doc);
20128 printf(" %d", n_name);
20129 printf(" %d", n_value);
20130 printf("\n");
20131 }
20132 }
20133 }
20134 }
Daniel Veillard57b25162004-11-06 14:50:18 +000020135 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020136
Daniel Veillard42595322004-11-08 10:52:06 +000020137 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020138}
20139
20140
20141static int
20142test_xmlNewDocRawNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020143 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020144
Daniel Veillarda521d282004-11-09 14:59:59 +000020145#ifdef LIBXML_TREE_ENABLED
Daniel Veillard27f20102004-11-05 11:50:11 +000020146 int mem_base;
20147 xmlNodePtr ret_val;
20148 xmlDocPtr doc; /* the document */
20149 int n_doc;
20150 xmlNsPtr ns; /* namespace if any */
20151 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020152 xmlChar * name; /* the node name */
Daniel Veillard27f20102004-11-05 11:50:11 +000020153 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020154 xmlChar * content; /* the text content if any */
Daniel Veillard27f20102004-11-05 11:50:11 +000020155 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020156
Daniel Veillard27f20102004-11-05 11:50:11 +000020157 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20158 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20159 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20160 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20161 mem_base = xmlMemBlocks();
20162 doc = gen_xmlDocPtr(n_doc, 0);
20163 ns = gen_xmlNsPtr(n_ns, 1);
20164 name = gen_const_xmlChar_ptr(n_name, 2);
20165 content = gen_const_xmlChar_ptr(n_content, 3);
20166
William M. Brackf13f77f2004-11-12 16:03:48 +000020167 ret_val = xmlNewDocRawNode(doc, ns, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillard27f20102004-11-05 11:50:11 +000020168 desret_xmlNodePtr(ret_val);
20169 call_tests++;
20170 des_xmlDocPtr(n_doc, doc, 0);
20171 des_xmlNsPtr(n_ns, ns, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000020172 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
20173 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 3);
Daniel Veillard27f20102004-11-05 11:50:11 +000020174 xmlResetLastError();
20175 if (mem_base != xmlMemBlocks()) {
20176 printf("Leak of %d blocks found in xmlNewDocRawNode",
20177 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020178 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000020179 printf(" %d", n_doc);
20180 printf(" %d", n_ns);
20181 printf(" %d", n_name);
20182 printf(" %d", n_content);
20183 printf("\n");
20184 }
20185 }
20186 }
20187 }
20188 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020189 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000020190#endif
Daniel Veillard27f20102004-11-05 11:50:11 +000020191
Daniel Veillard42595322004-11-08 10:52:06 +000020192 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020193}
20194
20195
20196static int
20197test_xmlNewDocText(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020198 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020199
20200 int mem_base;
20201 xmlNodePtr ret_val;
20202 xmlDocPtr doc; /* the document */
20203 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020204 xmlChar * content; /* the text content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020205 int n_content;
20206
20207 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20208 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20209 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020210 doc = gen_xmlDocPtr(n_doc, 0);
20211 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020212
William M. Brackf13f77f2004-11-12 16:03:48 +000020213 ret_val = xmlNewDocText(doc, (const xmlChar *)content);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020214 desret_xmlNodePtr(ret_val);
20215 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020216 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020217 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020218 xmlResetLastError();
20219 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020220 printf("Leak of %d blocks found in xmlNewDocText",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020221 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020222 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020223 printf(" %d", n_doc);
20224 printf(" %d", n_content);
20225 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020226 }
20227 }
20228 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020229 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020230
Daniel Veillard42595322004-11-08 10:52:06 +000020231 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020232}
20233
20234
20235static int
20236test_xmlNewDocTextLen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020237 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020238
20239 int mem_base;
20240 xmlNodePtr ret_val;
20241 xmlDocPtr doc; /* the document */
20242 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020243 xmlChar * content; /* the text content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020244 int n_content;
20245 int len; /* the text len. */
20246 int n_len;
20247
20248 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20249 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20250 for (n_len = 0;n_len < gen_nb_int;n_len++) {
20251 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020252 doc = gen_xmlDocPtr(n_doc, 0);
20253 content = gen_const_xmlChar_ptr(n_content, 1);
20254 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020255
William M. Brackf13f77f2004-11-12 16:03:48 +000020256 ret_val = xmlNewDocTextLen(doc, (const xmlChar *)content, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020257 desret_xmlNodePtr(ret_val);
20258 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020259 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020260 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000020261 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020262 xmlResetLastError();
20263 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020264 printf("Leak of %d blocks found in xmlNewDocTextLen",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020265 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020266 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020267 printf(" %d", n_doc);
20268 printf(" %d", n_content);
20269 printf(" %d", n_len);
20270 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020271 }
20272 }
20273 }
20274 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020275 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020276
Daniel Veillard42595322004-11-08 10:52:06 +000020277 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020278}
20279
20280
20281static int
20282test_xmlNewDtd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020283 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020284
Daniel Veillard34099b42004-11-04 17:34:35 +000020285 int mem_base;
20286 xmlDtdPtr ret_val;
20287 xmlDocPtr doc; /* the document pointer */
20288 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020289 xmlChar * name; /* the DTD name */
Daniel Veillard34099b42004-11-04 17:34:35 +000020290 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020291 xmlChar * ExternalID; /* the external ID */
Daniel Veillard34099b42004-11-04 17:34:35 +000020292 int n_ExternalID;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020293 xmlChar * SystemID; /* the system ID */
Daniel Veillard34099b42004-11-04 17:34:35 +000020294 int n_SystemID;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020295
Daniel Veillard34099b42004-11-04 17:34:35 +000020296 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20297 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20298 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
20299 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
20300 mem_base = xmlMemBlocks();
20301 doc = gen_xmlDocPtr(n_doc, 0);
20302 name = gen_const_xmlChar_ptr(n_name, 1);
20303 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 2);
20304 SystemID = gen_const_xmlChar_ptr(n_SystemID, 3);
20305
William M. Brackf13f77f2004-11-12 16:03:48 +000020306 ret_val = xmlNewDtd(doc, (const xmlChar *)name, (const xmlChar *)ExternalID, (const xmlChar *)SystemID);
Daniel Veillard34099b42004-11-04 17:34:35 +000020307 desret_xmlDtdPtr(ret_val);
20308 call_tests++;
20309 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020310 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
20311 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 2);
20312 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 3);
Daniel Veillard34099b42004-11-04 17:34:35 +000020313 xmlResetLastError();
20314 if (mem_base != xmlMemBlocks()) {
20315 printf("Leak of %d blocks found in xmlNewDtd",
20316 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020317 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000020318 printf(" %d", n_doc);
20319 printf(" %d", n_name);
20320 printf(" %d", n_ExternalID);
20321 printf(" %d", n_SystemID);
20322 printf("\n");
20323 }
20324 }
20325 }
20326 }
20327 }
Daniel Veillard34099b42004-11-04 17:34:35 +000020328 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020329
Daniel Veillard42595322004-11-08 10:52:06 +000020330 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020331}
20332
20333
20334static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000020335test_xmlNewNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020336 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020337
Daniel Veillard27f20102004-11-05 11:50:11 +000020338 int mem_base;
20339 xmlNodePtr ret_val;
20340 xmlNsPtr ns; /* namespace if any */
20341 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020342 xmlChar * name; /* the node name */
Daniel Veillard27f20102004-11-05 11:50:11 +000020343 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020344
Daniel Veillard27f20102004-11-05 11:50:11 +000020345 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20346 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20347 mem_base = xmlMemBlocks();
20348 ns = gen_xmlNsPtr(n_ns, 0);
20349 name = gen_const_xmlChar_ptr(n_name, 1);
20350
William M. Brackf13f77f2004-11-12 16:03:48 +000020351 ret_val = xmlNewNode(ns, (const xmlChar *)name);
Daniel Veillard27f20102004-11-05 11:50:11 +000020352 desret_xmlNodePtr(ret_val);
20353 call_tests++;
20354 des_xmlNsPtr(n_ns, ns, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020355 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard27f20102004-11-05 11:50:11 +000020356 xmlResetLastError();
20357 if (mem_base != xmlMemBlocks()) {
20358 printf("Leak of %d blocks found in xmlNewNode",
20359 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020360 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000020361 printf(" %d", n_ns);
20362 printf(" %d", n_name);
20363 printf("\n");
20364 }
20365 }
20366 }
Daniel Veillard27f20102004-11-05 11:50:11 +000020367 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020368
Daniel Veillard42595322004-11-08 10:52:06 +000020369 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020370}
20371
20372
20373static int
20374test_xmlNewNodeEatName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020375 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020376
Daniel Veillard27f20102004-11-05 11:50:11 +000020377 int mem_base;
20378 xmlNodePtr ret_val;
20379 xmlNsPtr ns; /* namespace if any */
20380 int n_ns;
20381 xmlChar * name; /* the node name */
20382 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020383
Daniel Veillard27f20102004-11-05 11:50:11 +000020384 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20385 for (n_name = 0;n_name < gen_nb_eaten_name;n_name++) {
20386 mem_base = xmlMemBlocks();
20387 ns = gen_xmlNsPtr(n_ns, 0);
20388 name = gen_eaten_name(n_name, 1);
20389
20390 ret_val = xmlNewNodeEatName(ns, name);
20391 desret_xmlNodePtr(ret_val);
20392 call_tests++;
20393 des_xmlNsPtr(n_ns, ns, 0);
20394 des_eaten_name(n_name, name, 1);
20395 xmlResetLastError();
20396 if (mem_base != xmlMemBlocks()) {
20397 printf("Leak of %d blocks found in xmlNewNodeEatName",
20398 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020399 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000020400 printf(" %d", n_ns);
20401 printf(" %d", n_name);
20402 printf("\n");
20403 }
20404 }
20405 }
Daniel Veillard27f20102004-11-05 11:50:11 +000020406 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020407
Daniel Veillard42595322004-11-08 10:52:06 +000020408 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020409}
20410
20411
20412static int
20413test_xmlNewNs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020414 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020415
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000020416 int mem_base;
20417 xmlNsPtr ret_val;
20418 xmlNodePtr node; /* the element carrying the namespace */
20419 int n_node;
20420 xmlChar * href; /* the URI associated */
20421 int n_href;
20422 xmlChar * prefix; /* the prefix for the namespace */
20423 int n_prefix;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020424
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000020425 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
20426 for (n_href = 0;n_href < gen_nb_const_xmlChar_ptr;n_href++) {
20427 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
20428 mem_base = xmlMemBlocks();
20429 node = gen_xmlNodePtr(n_node, 0);
20430 href = gen_const_xmlChar_ptr(n_href, 1);
20431 prefix = gen_const_xmlChar_ptr(n_prefix, 2);
20432
William M. Brackf13f77f2004-11-12 16:03:48 +000020433 ret_val = xmlNewNs(node, (const xmlChar *)href, (const xmlChar *)prefix);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000020434 if ((node == NULL) && (ret_val != NULL)) xmlFreeNs(ret_val);
20435 desret_xmlNsPtr(ret_val);
20436 call_tests++;
20437 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020438 des_const_xmlChar_ptr(n_href, (const xmlChar *)href, 1);
20439 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 2);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000020440 xmlResetLastError();
20441 if (mem_base != xmlMemBlocks()) {
20442 printf("Leak of %d blocks found in xmlNewNs",
20443 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020444 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000020445 printf(" %d", n_node);
20446 printf(" %d", n_href);
20447 printf(" %d", n_prefix);
20448 printf("\n");
20449 }
20450 }
20451 }
20452 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000020453 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020454
Daniel Veillard42595322004-11-08 10:52:06 +000020455 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020456}
20457
20458
20459static int
20460test_xmlNewNsProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020461 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020462
Daniel Veillard57b25162004-11-06 14:50:18 +000020463 int mem_base;
20464 xmlAttrPtr ret_val;
20465 xmlNodePtr node; /* the holding node */
20466 int n_node;
20467 xmlNsPtr ns; /* the namespace */
20468 int n_ns;
20469 xmlChar * name; /* the name of the attribute */
20470 int n_name;
20471 xmlChar * value; /* the value of the attribute */
20472 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020473
Daniel Veillard57b25162004-11-06 14:50:18 +000020474 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
20475 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20476 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20477 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
20478 mem_base = xmlMemBlocks();
20479 node = gen_xmlNodePtr(n_node, 0);
20480 ns = gen_xmlNsPtr(n_ns, 1);
20481 name = gen_const_xmlChar_ptr(n_name, 2);
20482 value = gen_const_xmlChar_ptr(n_value, 3);
20483
William M. Brackf13f77f2004-11-12 16:03:48 +000020484 ret_val = xmlNewNsProp(node, ns, (const xmlChar *)name, (const xmlChar *)value);
Daniel Veillard57b25162004-11-06 14:50:18 +000020485 desret_xmlAttrPtr(ret_val);
20486 call_tests++;
20487 des_xmlNodePtr(n_node, node, 0);
20488 des_xmlNsPtr(n_ns, ns, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000020489 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
20490 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 3);
Daniel Veillard57b25162004-11-06 14:50:18 +000020491 xmlResetLastError();
20492 if (mem_base != xmlMemBlocks()) {
20493 printf("Leak of %d blocks found in xmlNewNsProp",
20494 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020495 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000020496 printf(" %d", n_node);
20497 printf(" %d", n_ns);
20498 printf(" %d", n_name);
20499 printf(" %d", n_value);
20500 printf("\n");
20501 }
20502 }
20503 }
20504 }
20505 }
Daniel Veillard57b25162004-11-06 14:50:18 +000020506 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020507
Daniel Veillard42595322004-11-08 10:52:06 +000020508 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020509}
20510
20511
20512static int
20513test_xmlNewNsPropEatName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020514 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020515
Daniel Veillard57b25162004-11-06 14:50:18 +000020516 int mem_base;
20517 xmlAttrPtr ret_val;
20518 xmlNodePtr node; /* the holding node */
20519 int n_node;
20520 xmlNsPtr ns; /* the namespace */
20521 int n_ns;
20522 xmlChar * name; /* the name of the attribute */
20523 int n_name;
20524 xmlChar * value; /* the value of the attribute */
20525 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020526
Daniel Veillard57b25162004-11-06 14:50:18 +000020527 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
20528 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20529 for (n_name = 0;n_name < gen_nb_eaten_name;n_name++) {
20530 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
20531 mem_base = xmlMemBlocks();
20532 node = gen_xmlNodePtr(n_node, 0);
20533 ns = gen_xmlNsPtr(n_ns, 1);
20534 name = gen_eaten_name(n_name, 2);
20535 value = gen_const_xmlChar_ptr(n_value, 3);
20536
William M. Brackf13f77f2004-11-12 16:03:48 +000020537 ret_val = xmlNewNsPropEatName(node, ns, name, (const xmlChar *)value);
Daniel Veillard57b25162004-11-06 14:50:18 +000020538 desret_xmlAttrPtr(ret_val);
20539 call_tests++;
20540 des_xmlNodePtr(n_node, node, 0);
20541 des_xmlNsPtr(n_ns, ns, 1);
20542 des_eaten_name(n_name, name, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000020543 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 3);
Daniel Veillard57b25162004-11-06 14:50:18 +000020544 xmlResetLastError();
20545 if (mem_base != xmlMemBlocks()) {
20546 printf("Leak of %d blocks found in xmlNewNsPropEatName",
20547 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020548 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000020549 printf(" %d", n_node);
20550 printf(" %d", n_ns);
20551 printf(" %d", n_name);
20552 printf(" %d", n_value);
20553 printf("\n");
20554 }
20555 }
20556 }
20557 }
20558 }
Daniel Veillard57b25162004-11-06 14:50:18 +000020559 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020560
Daniel Veillard42595322004-11-08 10:52:06 +000020561 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020562}
20563
20564
20565static int
20566test_xmlNewPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020567 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020568
20569 int mem_base;
20570 xmlNodePtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020571 xmlChar * name; /* the processing instruction name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020572 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020573 xmlChar * content; /* the PI content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020574 int n_content;
20575
20576 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20577 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20578 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020579 name = gen_const_xmlChar_ptr(n_name, 0);
20580 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020581
William M. Brackf13f77f2004-11-12 16:03:48 +000020582 ret_val = xmlNewPI((const xmlChar *)name, (const xmlChar *)content);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020583 desret_xmlNodePtr(ret_val);
20584 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000020585 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
20586 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020587 xmlResetLastError();
20588 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020589 printf("Leak of %d blocks found in xmlNewPI",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020590 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020591 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020592 printf(" %d", n_name);
20593 printf(" %d", n_content);
20594 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020595 }
20596 }
20597 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020598 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020599
Daniel Veillard42595322004-11-08 10:52:06 +000020600 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020601}
20602
20603
20604static int
20605test_xmlNewProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020606 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020607
Daniel Veillarda521d282004-11-09 14:59:59 +000020608#ifdef LIBXML_TREE_ENABLED
Daniel Veillard57b25162004-11-06 14:50:18 +000020609 int mem_base;
20610 xmlAttrPtr ret_val;
20611 xmlNodePtr node; /* the holding node */
20612 int n_node;
20613 xmlChar * name; /* the name of the attribute */
20614 int n_name;
20615 xmlChar * value; /* the value of the attribute */
20616 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020617
Daniel Veillard57b25162004-11-06 14:50:18 +000020618 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
20619 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20620 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
20621 mem_base = xmlMemBlocks();
20622 node = gen_xmlNodePtr(n_node, 0);
20623 name = gen_const_xmlChar_ptr(n_name, 1);
20624 value = gen_const_xmlChar_ptr(n_value, 2);
20625
William M. Brackf13f77f2004-11-12 16:03:48 +000020626 ret_val = xmlNewProp(node, (const xmlChar *)name, (const xmlChar *)value);
Daniel Veillard57b25162004-11-06 14:50:18 +000020627 desret_xmlAttrPtr(ret_val);
20628 call_tests++;
20629 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020630 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
20631 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 2);
Daniel Veillard57b25162004-11-06 14:50:18 +000020632 xmlResetLastError();
20633 if (mem_base != xmlMemBlocks()) {
20634 printf("Leak of %d blocks found in xmlNewProp",
20635 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020636 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000020637 printf(" %d", n_node);
20638 printf(" %d", n_name);
20639 printf(" %d", n_value);
20640 printf("\n");
20641 }
20642 }
20643 }
20644 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020645 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000020646#endif
Daniel Veillard57b25162004-11-06 14:50:18 +000020647
Daniel Veillard42595322004-11-08 10:52:06 +000020648 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020649}
20650
20651
20652static int
20653test_xmlNewReference(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020654 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020655
20656 int mem_base;
20657 xmlNodePtr ret_val;
20658 xmlDocPtr doc; /* the document */
20659 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020660 xmlChar * name; /* the reference name, or the reference string with & and ; */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020661 int n_name;
20662
20663 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20664 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20665 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020666 doc = gen_xmlDocPtr(n_doc, 0);
20667 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020668
William M. Brackf13f77f2004-11-12 16:03:48 +000020669 ret_val = xmlNewReference(doc, (const xmlChar *)name);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020670 desret_xmlNodePtr(ret_val);
20671 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020672 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020673 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020674 xmlResetLastError();
20675 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020676 printf("Leak of %d blocks found in xmlNewReference",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020677 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020678 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020679 printf(" %d", n_doc);
20680 printf(" %d", n_name);
20681 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020682 }
20683 }
20684 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020685 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020686
Daniel Veillard42595322004-11-08 10:52:06 +000020687 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020688}
20689
20690
20691static int
20692test_xmlNewText(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020693 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020694
20695 int mem_base;
20696 xmlNodePtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020697 xmlChar * content; /* the text content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020698 int n_content;
20699
20700 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20701 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020702 content = gen_const_xmlChar_ptr(n_content, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020703
William M. Brackf13f77f2004-11-12 16:03:48 +000020704 ret_val = xmlNewText((const xmlChar *)content);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020705 desret_xmlNodePtr(ret_val);
20706 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000020707 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020708 xmlResetLastError();
20709 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020710 printf("Leak of %d blocks found in xmlNewText",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020711 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020712 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020713 printf(" %d", n_content);
20714 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020715 }
20716 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020717 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020718
Daniel Veillard42595322004-11-08 10:52:06 +000020719 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020720}
20721
20722
20723static int
20724test_xmlNewTextChild(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020725 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020726
Daniel Veillarda521d282004-11-09 14:59:59 +000020727#ifdef LIBXML_TREE_ENABLED
Daniel Veillard27f20102004-11-05 11:50:11 +000020728 int mem_base;
20729 xmlNodePtr ret_val;
20730 xmlNodePtr parent; /* the parent node */
20731 int n_parent;
20732 xmlNsPtr ns; /* a namespace if any */
20733 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020734 xmlChar * name; /* the name of the child */
Daniel Veillard27f20102004-11-05 11:50:11 +000020735 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020736 xmlChar * content; /* the text content of the child if any. */
Daniel Veillard27f20102004-11-05 11:50:11 +000020737 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020738
Daniel Veillard27f20102004-11-05 11:50:11 +000020739 for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) {
20740 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20741 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20742 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20743 mem_base = xmlMemBlocks();
20744 parent = gen_xmlNodePtr(n_parent, 0);
20745 ns = gen_xmlNsPtr(n_ns, 1);
20746 name = gen_const_xmlChar_ptr(n_name, 2);
20747 content = gen_const_xmlChar_ptr(n_content, 3);
20748
William M. Brackf13f77f2004-11-12 16:03:48 +000020749 ret_val = xmlNewTextChild(parent, ns, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillard27f20102004-11-05 11:50:11 +000020750 desret_xmlNodePtr(ret_val);
20751 call_tests++;
20752 des_xmlNodePtr(n_parent, parent, 0);
20753 des_xmlNsPtr(n_ns, ns, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000020754 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
20755 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 3);
Daniel Veillard27f20102004-11-05 11:50:11 +000020756 xmlResetLastError();
20757 if (mem_base != xmlMemBlocks()) {
20758 printf("Leak of %d blocks found in xmlNewTextChild",
20759 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020760 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000020761 printf(" %d", n_parent);
20762 printf(" %d", n_ns);
20763 printf(" %d", n_name);
20764 printf(" %d", n_content);
20765 printf("\n");
20766 }
20767 }
20768 }
20769 }
20770 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020771 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000020772#endif
Daniel Veillard27f20102004-11-05 11:50:11 +000020773
Daniel Veillard42595322004-11-08 10:52:06 +000020774 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020775}
20776
20777
20778static int
20779test_xmlNewTextLen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020780 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020781
20782 int mem_base;
20783 xmlNodePtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020784 xmlChar * content; /* the text content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020785 int n_content;
20786 int len; /* the text len. */
20787 int n_len;
20788
20789 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20790 for (n_len = 0;n_len < gen_nb_int;n_len++) {
20791 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020792 content = gen_const_xmlChar_ptr(n_content, 0);
20793 len = gen_int(n_len, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020794
William M. Brackf13f77f2004-11-12 16:03:48 +000020795 ret_val = xmlNewTextLen((const xmlChar *)content, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020796 desret_xmlNodePtr(ret_val);
20797 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000020798 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000020799 des_int(n_len, len, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020800 xmlResetLastError();
20801 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020802 printf("Leak of %d blocks found in xmlNewTextLen",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020803 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020804 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020805 printf(" %d", n_content);
20806 printf(" %d", n_len);
20807 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020808 }
20809 }
20810 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020811 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020812
Daniel Veillard42595322004-11-08 10:52:06 +000020813 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020814}
20815
20816
20817static int
20818test_xmlNodeAddContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020819 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020820
20821 int mem_base;
20822 xmlNodePtr cur; /* the node being modified */
20823 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020824 xmlChar * content; /* extra content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020825 int n_content;
20826
20827 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
20828 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20829 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020830 cur = gen_xmlNodePtr(n_cur, 0);
20831 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020832
William M. Brackf13f77f2004-11-12 16:03:48 +000020833 xmlNodeAddContent(cur, (const xmlChar *)content);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020834 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020835 des_xmlNodePtr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020836 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020837 xmlResetLastError();
20838 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020839 printf("Leak of %d blocks found in xmlNodeAddContent",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020840 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020841 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020842 printf(" %d", n_cur);
20843 printf(" %d", n_content);
20844 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020845 }
20846 }
20847 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020848 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020849
Daniel Veillard42595322004-11-08 10:52:06 +000020850 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020851}
20852
20853
20854static int
20855test_xmlNodeAddContentLen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020856 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020857
20858 int mem_base;
20859 xmlNodePtr cur; /* the node being modified */
20860 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020861 xmlChar * content; /* extra content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020862 int n_content;
20863 int len; /* the size of @content */
20864 int n_len;
20865
20866 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
20867 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20868 for (n_len = 0;n_len < gen_nb_int;n_len++) {
20869 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020870 cur = gen_xmlNodePtr(n_cur, 0);
20871 content = gen_const_xmlChar_ptr(n_content, 1);
20872 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020873
William M. Brackf13f77f2004-11-12 16:03:48 +000020874 xmlNodeAddContentLen(cur, (const xmlChar *)content, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020875 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020876 des_xmlNodePtr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020877 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000020878 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020879 xmlResetLastError();
20880 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020881 printf("Leak of %d blocks found in xmlNodeAddContentLen",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020882 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020883 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020884 printf(" %d", n_cur);
20885 printf(" %d", n_content);
20886 printf(" %d", n_len);
20887 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020888 }
20889 }
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_xmlNodeBufGetContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020900 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020901
Daniel Veillardd005b9e2004-11-03 17:07:05 +000020902 int mem_base;
20903 int ret_val;
20904 xmlBufferPtr buffer; /* a buffer */
20905 int n_buffer;
20906 xmlNodePtr cur; /* the node being read */
20907 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020908
Daniel Veillardd005b9e2004-11-03 17:07:05 +000020909 for (n_buffer = 0;n_buffer < gen_nb_xmlBufferPtr;n_buffer++) {
20910 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
20911 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020912 buffer = gen_xmlBufferPtr(n_buffer, 0);
20913 cur = gen_xmlNodePtr(n_cur, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000020914
20915 ret_val = xmlNodeBufGetContent(buffer, cur);
20916 desret_int(ret_val);
20917 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020918 des_xmlBufferPtr(n_buffer, buffer, 0);
20919 des_xmlNodePtr(n_cur, cur, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000020920 xmlResetLastError();
20921 if (mem_base != xmlMemBlocks()) {
20922 printf("Leak of %d blocks found in xmlNodeBufGetContent",
20923 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020924 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000020925 printf(" %d", n_buffer);
20926 printf(" %d", n_cur);
20927 printf("\n");
20928 }
20929 }
20930 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020931 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020932
Daniel Veillard42595322004-11-08 10:52:06 +000020933 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020934}
20935
20936
20937static int
20938test_xmlNodeDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020939 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020940
Daniel Veillardd005b9e2004-11-03 17:07:05 +000020941#ifdef LIBXML_OUTPUT_ENABLED
20942 int mem_base;
20943 int ret_val;
20944 xmlBufferPtr buf; /* the XML buffer output */
20945 int n_buf;
20946 xmlDocPtr doc; /* the document */
20947 int n_doc;
20948 xmlNodePtr cur; /* the current node */
20949 int n_cur;
20950 int level; /* the imbrication level for indenting */
20951 int n_level;
20952 int format; /* is formatting allowed */
20953 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020954
Daniel Veillardd005b9e2004-11-03 17:07:05 +000020955 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
20956 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20957 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
20958 for (n_level = 0;n_level < gen_nb_int;n_level++) {
20959 for (n_format = 0;n_format < gen_nb_int;n_format++) {
20960 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020961 buf = gen_xmlBufferPtr(n_buf, 0);
20962 doc = gen_xmlDocPtr(n_doc, 1);
20963 cur = gen_xmlNodePtr(n_cur, 2);
20964 level = gen_int(n_level, 3);
20965 format = gen_int(n_format, 4);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000020966
20967 ret_val = xmlNodeDump(buf, doc, cur, level, format);
20968 desret_int(ret_val);
20969 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020970 des_xmlBufferPtr(n_buf, buf, 0);
20971 des_xmlDocPtr(n_doc, doc, 1);
20972 des_xmlNodePtr(n_cur, cur, 2);
20973 des_int(n_level, level, 3);
20974 des_int(n_format, format, 4);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000020975 xmlResetLastError();
20976 if (mem_base != xmlMemBlocks()) {
20977 printf("Leak of %d blocks found in xmlNodeDump",
20978 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020979 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000020980 printf(" %d", n_buf);
20981 printf(" %d", n_doc);
20982 printf(" %d", n_cur);
20983 printf(" %d", n_level);
20984 printf(" %d", n_format);
20985 printf("\n");
20986 }
20987 }
20988 }
20989 }
20990 }
20991 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020992 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000020993#endif
20994
Daniel Veillard42595322004-11-08 10:52:06 +000020995 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020996}
20997
20998
20999static int
21000test_xmlNodeDumpOutput(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021001 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021002
Daniel Veillard3d97e662004-11-04 10:49:00 +000021003#ifdef LIBXML_OUTPUT_ENABLED
21004 int mem_base;
21005 xmlOutputBufferPtr buf; /* the XML buffer output */
21006 int n_buf;
21007 xmlDocPtr doc; /* the document */
21008 int n_doc;
21009 xmlNodePtr cur; /* the current node */
21010 int n_cur;
21011 int level; /* the imbrication level for indenting */
21012 int n_level;
21013 int format; /* is formatting allowed */
21014 int n_format;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021015 char * encoding; /* an optional encoding string */
Daniel Veillard3d97e662004-11-04 10:49:00 +000021016 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021017
Daniel Veillard3d97e662004-11-04 10:49:00 +000021018 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
21019 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21020 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21021 for (n_level = 0;n_level < gen_nb_int;n_level++) {
21022 for (n_format = 0;n_format < gen_nb_int;n_format++) {
21023 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
21024 mem_base = xmlMemBlocks();
21025 buf = gen_xmlOutputBufferPtr(n_buf, 0);
21026 doc = gen_xmlDocPtr(n_doc, 1);
21027 cur = gen_xmlNodePtr(n_cur, 2);
21028 level = gen_int(n_level, 3);
21029 format = gen_int(n_format, 4);
21030 encoding = gen_const_char_ptr(n_encoding, 5);
21031
William M. Brackf13f77f2004-11-12 16:03:48 +000021032 xmlNodeDumpOutput(buf, doc, cur, level, format, (const char *)encoding);
Daniel Veillard3d97e662004-11-04 10:49:00 +000021033 call_tests++;
21034 des_xmlOutputBufferPtr(n_buf, buf, 0);
21035 des_xmlDocPtr(n_doc, doc, 1);
21036 des_xmlNodePtr(n_cur, cur, 2);
21037 des_int(n_level, level, 3);
21038 des_int(n_format, format, 4);
William M. Brackf13f77f2004-11-12 16:03:48 +000021039 des_const_char_ptr(n_encoding, (const char *)encoding, 5);
Daniel Veillard3d97e662004-11-04 10:49:00 +000021040 xmlResetLastError();
21041 if (mem_base != xmlMemBlocks()) {
21042 printf("Leak of %d blocks found in xmlNodeDumpOutput",
21043 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021044 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021045 printf(" %d", n_buf);
21046 printf(" %d", n_doc);
21047 printf(" %d", n_cur);
21048 printf(" %d", n_level);
21049 printf(" %d", n_format);
21050 printf(" %d", n_encoding);
21051 printf("\n");
21052 }
21053 }
21054 }
21055 }
21056 }
21057 }
21058 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021059 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021060#endif
21061
Daniel Veillard42595322004-11-08 10:52:06 +000021062 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021063}
21064
21065
21066static int
21067test_xmlNodeGetBase(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021068 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021069
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021070 int mem_base;
21071 xmlChar * ret_val;
21072 xmlDocPtr doc; /* the document the node pertains to */
21073 int n_doc;
21074 xmlNodePtr cur; /* the node being checked */
21075 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021076
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021077 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21078 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21079 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021080 doc = gen_xmlDocPtr(n_doc, 0);
21081 cur = gen_xmlNodePtr(n_cur, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021082
21083 ret_val = xmlNodeGetBase(doc, cur);
21084 desret_xmlChar_ptr(ret_val);
21085 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021086 des_xmlDocPtr(n_doc, doc, 0);
21087 des_xmlNodePtr(n_cur, cur, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021088 xmlResetLastError();
21089 if (mem_base != xmlMemBlocks()) {
21090 printf("Leak of %d blocks found in xmlNodeGetBase",
21091 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021092 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021093 printf(" %d", n_doc);
21094 printf(" %d", n_cur);
21095 printf("\n");
21096 }
21097 }
21098 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021099 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021100
Daniel Veillard42595322004-11-08 10:52:06 +000021101 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021102}
21103
21104
21105static int
21106test_xmlNodeGetContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021107 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021108
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021109 int mem_base;
21110 xmlChar * ret_val;
21111 xmlNodePtr cur; /* the node being read */
21112 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021113
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021114 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21115 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021116 cur = gen_xmlNodePtr(n_cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021117
21118 ret_val = xmlNodeGetContent(cur);
21119 desret_xmlChar_ptr(ret_val);
21120 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021121 des_xmlNodePtr(n_cur, cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021122 xmlResetLastError();
21123 if (mem_base != xmlMemBlocks()) {
21124 printf("Leak of %d blocks found in xmlNodeGetContent",
21125 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021126 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021127 printf(" %d", n_cur);
21128 printf("\n");
21129 }
21130 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021131 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021132
Daniel Veillard42595322004-11-08 10:52:06 +000021133 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021134}
21135
21136
21137static int
21138test_xmlNodeGetLang(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021139 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021140
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021141 int mem_base;
21142 xmlChar * ret_val;
21143 xmlNodePtr cur; /* the node being checked */
21144 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021145
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021146 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21147 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021148 cur = gen_xmlNodePtr(n_cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021149
21150 ret_val = xmlNodeGetLang(cur);
21151 desret_xmlChar_ptr(ret_val);
21152 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021153 des_xmlNodePtr(n_cur, cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021154 xmlResetLastError();
21155 if (mem_base != xmlMemBlocks()) {
21156 printf("Leak of %d blocks found in xmlNodeGetLang",
21157 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021158 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021159 printf(" %d", n_cur);
21160 printf("\n");
21161 }
21162 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021163 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021164
Daniel Veillard42595322004-11-08 10:52:06 +000021165 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021166}
21167
21168
21169static int
21170test_xmlNodeGetSpacePreserve(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021171 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021172
21173 int mem_base;
21174 int ret_val;
21175 xmlNodePtr cur; /* the node being checked */
21176 int n_cur;
21177
21178 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21179 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021180 cur = gen_xmlNodePtr(n_cur, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021181
21182 ret_val = xmlNodeGetSpacePreserve(cur);
21183 desret_int(ret_val);
21184 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021185 des_xmlNodePtr(n_cur, cur, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021186 xmlResetLastError();
21187 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021188 printf("Leak of %d blocks found in xmlNodeGetSpacePreserve",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021189 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021190 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021191 printf(" %d", n_cur);
21192 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021193 }
21194 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021195 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021196
Daniel Veillard42595322004-11-08 10:52:06 +000021197 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021198}
21199
21200
21201static int
21202test_xmlNodeIsText(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021203 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021204
21205 int mem_base;
21206 int ret_val;
21207 xmlNodePtr node; /* the node */
21208 int n_node;
21209
21210 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
21211 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021212 node = gen_xmlNodePtr(n_node, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021213
21214 ret_val = xmlNodeIsText(node);
21215 desret_int(ret_val);
21216 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021217 des_xmlNodePtr(n_node, node, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021218 xmlResetLastError();
21219 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021220 printf("Leak of %d blocks found in xmlNodeIsText",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021221 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021222 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021223 printf(" %d", n_node);
21224 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021225 }
21226 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021227 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021228
Daniel Veillard42595322004-11-08 10:52:06 +000021229 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021230}
21231
21232
21233static int
21234test_xmlNodeListGetRawString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021235 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021236
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021237#ifdef LIBXML_TREE_ENABLED
21238 int mem_base;
21239 xmlChar * ret_val;
21240 xmlDocPtr doc; /* the document */
21241 int n_doc;
21242 xmlNodePtr list; /* a Node list */
21243 int n_list;
21244 int inLine; /* should we replace entity contents or show their external form */
21245 int n_inLine;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021246
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021247 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21248 for (n_list = 0;n_list < gen_nb_xmlNodePtr;n_list++) {
21249 for (n_inLine = 0;n_inLine < gen_nb_int;n_inLine++) {
21250 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021251 doc = gen_xmlDocPtr(n_doc, 0);
21252 list = gen_xmlNodePtr(n_list, 1);
21253 inLine = gen_int(n_inLine, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021254
21255 ret_val = xmlNodeListGetRawString(doc, list, inLine);
21256 desret_xmlChar_ptr(ret_val);
21257 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021258 des_xmlDocPtr(n_doc, doc, 0);
21259 des_xmlNodePtr(n_list, list, 1);
21260 des_int(n_inLine, inLine, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021261 xmlResetLastError();
21262 if (mem_base != xmlMemBlocks()) {
21263 printf("Leak of %d blocks found in xmlNodeListGetRawString",
21264 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021265 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021266 printf(" %d", n_doc);
21267 printf(" %d", n_list);
21268 printf(" %d", n_inLine);
21269 printf("\n");
21270 }
21271 }
21272 }
21273 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021274 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021275#endif
21276
Daniel Veillard42595322004-11-08 10:52:06 +000021277 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021278}
21279
21280
21281static int
21282test_xmlNodeListGetString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021283 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021284
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021285 int mem_base;
21286 xmlChar * ret_val;
21287 xmlDocPtr doc; /* the document */
21288 int n_doc;
21289 xmlNodePtr list; /* a Node list */
21290 int n_list;
21291 int inLine; /* should we replace entity contents or show their external form */
21292 int n_inLine;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021293
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021294 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21295 for (n_list = 0;n_list < gen_nb_xmlNodePtr;n_list++) {
21296 for (n_inLine = 0;n_inLine < gen_nb_int;n_inLine++) {
21297 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021298 doc = gen_xmlDocPtr(n_doc, 0);
21299 list = gen_xmlNodePtr(n_list, 1);
21300 inLine = gen_int(n_inLine, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021301
21302 ret_val = xmlNodeListGetString(doc, list, inLine);
21303 desret_xmlChar_ptr(ret_val);
21304 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021305 des_xmlDocPtr(n_doc, doc, 0);
21306 des_xmlNodePtr(n_list, list, 1);
21307 des_int(n_inLine, inLine, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021308 xmlResetLastError();
21309 if (mem_base != xmlMemBlocks()) {
21310 printf("Leak of %d blocks found in xmlNodeListGetString",
21311 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021312 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021313 printf(" %d", n_doc);
21314 printf(" %d", n_list);
21315 printf(" %d", n_inLine);
21316 printf("\n");
21317 }
21318 }
21319 }
21320 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021321 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021322
Daniel Veillard42595322004-11-08 10:52:06 +000021323 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021324}
21325
21326
21327static int
21328test_xmlNodeSetBase(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021329 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021330
21331#ifdef LIBXML_TREE_ENABLED
21332 int mem_base;
21333 xmlNodePtr cur; /* the node being changed */
21334 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021335 xmlChar * uri; /* the new base URI */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021336 int n_uri;
21337
21338 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21339 for (n_uri = 0;n_uri < gen_nb_const_xmlChar_ptr;n_uri++) {
21340 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021341 cur = gen_xmlNodePtr(n_cur, 0);
21342 uri = gen_const_xmlChar_ptr(n_uri, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021343
William M. Brackf13f77f2004-11-12 16:03:48 +000021344 xmlNodeSetBase(cur, (const xmlChar *)uri);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021345 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021346 des_xmlNodePtr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000021347 des_const_xmlChar_ptr(n_uri, (const xmlChar *)uri, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021348 xmlResetLastError();
21349 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021350 printf("Leak of %d blocks found in xmlNodeSetBase",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021351 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021352 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021353 printf(" %d", n_cur);
21354 printf(" %d", n_uri);
21355 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021356 }
21357 }
21358 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021359 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021360#endif
21361
Daniel Veillard42595322004-11-08 10:52:06 +000021362 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021363}
21364
21365
21366static int
21367test_xmlNodeSetContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021368 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021369
21370 int mem_base;
21371 xmlNodePtr cur; /* the node being modified */
21372 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021373 xmlChar * content; /* the new value of the content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021374 int n_content;
21375
21376 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21377 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
21378 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021379 cur = gen_xmlNodePtr(n_cur, 0);
21380 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021381
William M. Brackf13f77f2004-11-12 16:03:48 +000021382 xmlNodeSetContent(cur, (const xmlChar *)content);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021383 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021384 des_xmlNodePtr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000021385 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021386 xmlResetLastError();
21387 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021388 printf("Leak of %d blocks found in xmlNodeSetContent",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021389 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021390 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021391 printf(" %d", n_cur);
21392 printf(" %d", n_content);
21393 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021394 }
21395 }
21396 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021397 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021398
Daniel Veillard42595322004-11-08 10:52:06 +000021399 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021400}
21401
21402
21403static int
21404test_xmlNodeSetContentLen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021405 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021406
21407#ifdef LIBXML_TREE_ENABLED
21408 int mem_base;
21409 xmlNodePtr cur; /* the node being modified */
21410 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021411 xmlChar * content; /* the new value of the content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021412 int n_content;
21413 int len; /* the size of @content */
21414 int n_len;
21415
21416 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21417 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
21418 for (n_len = 0;n_len < gen_nb_int;n_len++) {
21419 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021420 cur = gen_xmlNodePtr(n_cur, 0);
21421 content = gen_const_xmlChar_ptr(n_content, 1);
21422 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021423
William M. Brackf13f77f2004-11-12 16:03:48 +000021424 xmlNodeSetContentLen(cur, (const xmlChar *)content, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021425 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021426 des_xmlNodePtr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000021427 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000021428 des_int(n_len, len, 2);
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 xmlNodeSetContentLen",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021432 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021433 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021434 printf(" %d", n_cur);
21435 printf(" %d", n_content);
21436 printf(" %d", n_len);
21437 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021438 }
21439 }
21440 }
21441 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021442 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021443#endif
21444
Daniel Veillard42595322004-11-08 10:52:06 +000021445 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021446}
21447
21448
21449static int
21450test_xmlNodeSetLang(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021451 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021452
21453#ifdef LIBXML_TREE_ENABLED
21454 int mem_base;
21455 xmlNodePtr cur; /* the node being changed */
21456 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021457 xmlChar * lang; /* the language description */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021458 int n_lang;
21459
21460 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21461 for (n_lang = 0;n_lang < gen_nb_const_xmlChar_ptr;n_lang++) {
21462 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021463 cur = gen_xmlNodePtr(n_cur, 0);
21464 lang = gen_const_xmlChar_ptr(n_lang, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021465
William M. Brackf13f77f2004-11-12 16:03:48 +000021466 xmlNodeSetLang(cur, (const xmlChar *)lang);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021467 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021468 des_xmlNodePtr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000021469 des_const_xmlChar_ptr(n_lang, (const xmlChar *)lang, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021470 xmlResetLastError();
21471 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021472 printf("Leak of %d blocks found in xmlNodeSetLang",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021473 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021474 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021475 printf(" %d", n_cur);
21476 printf(" %d", n_lang);
21477 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021478 }
21479 }
21480 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021481 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021482#endif
21483
Daniel Veillard42595322004-11-08 10:52:06 +000021484 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021485}
21486
21487
21488static int
21489test_xmlNodeSetName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021490 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021491
21492#ifdef LIBXML_TREE_ENABLED
21493 int mem_base;
21494 xmlNodePtr cur; /* the node being changed */
21495 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021496 xmlChar * name; /* the new tag name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021497 int n_name;
21498
21499 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21500 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
21501 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021502 cur = gen_xmlNodePtr(n_cur, 0);
21503 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021504
William M. Brackf13f77f2004-11-12 16:03:48 +000021505 xmlNodeSetName(cur, (const xmlChar *)name);
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_name, (const xmlChar *)name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021509 xmlResetLastError();
21510 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021511 printf("Leak of %d blocks found in xmlNodeSetName",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021512 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021513 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021514 printf(" %d", n_cur);
21515 printf(" %d", n_name);
21516 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021517 }
21518 }
21519 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021520 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021521#endif
21522
Daniel Veillard42595322004-11-08 10:52:06 +000021523 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021524}
21525
21526
21527static int
21528test_xmlNodeSetSpacePreserve(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021529 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021530
21531#ifdef LIBXML_TREE_ENABLED
21532 int mem_base;
21533 xmlNodePtr cur; /* the node being changed */
21534 int n_cur;
21535 int val; /* the xml:space value ("0": default, 1: "preserve") */
21536 int n_val;
21537
21538 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21539 for (n_val = 0;n_val < gen_nb_int;n_val++) {
21540 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021541 cur = gen_xmlNodePtr(n_cur, 0);
21542 val = gen_int(n_val, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021543
21544 xmlNodeSetSpacePreserve(cur, val);
21545 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021546 des_xmlNodePtr(n_cur, cur, 0);
21547 des_int(n_val, val, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021548 xmlResetLastError();
21549 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021550 printf("Leak of %d blocks found in xmlNodeSetSpacePreserve",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021551 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021552 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021553 printf(" %d", n_cur);
21554 printf(" %d", n_val);
21555 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021556 }
21557 }
21558 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021559 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021560#endif
21561
Daniel Veillard42595322004-11-08 10:52:06 +000021562 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021563}
21564
21565
21566static int
21567test_xmlReconciliateNs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021568 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021569
Daniel Veillarda521d282004-11-09 14:59:59 +000021570#ifdef LIBXML_TREE_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000021571 int mem_base;
21572 int ret_val;
21573 xmlDocPtr doc; /* the document */
21574 int n_doc;
21575 xmlNodePtr tree; /* a node defining the subtree to reconciliate */
21576 int n_tree;
21577
21578 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21579 for (n_tree = 0;n_tree < gen_nb_xmlNodePtr;n_tree++) {
21580 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021581 doc = gen_xmlDocPtr(n_doc, 0);
21582 tree = gen_xmlNodePtr(n_tree, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021583
21584 ret_val = xmlReconciliateNs(doc, tree);
21585 desret_int(ret_val);
21586 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021587 des_xmlDocPtr(n_doc, doc, 0);
21588 des_xmlNodePtr(n_tree, tree, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021589 xmlResetLastError();
21590 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021591 printf("Leak of %d blocks found in xmlReconciliateNs",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021592 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021593 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021594 printf(" %d", n_doc);
21595 printf(" %d", n_tree);
21596 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021597 }
21598 }
21599 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021600 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000021601#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000021602
Daniel Veillard42595322004-11-08 10:52:06 +000021603 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021604}
21605
21606
21607static int
21608test_xmlRemoveProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021609 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021610
Daniel Veillardce244ad2004-11-05 10:03:46 +000021611#ifdef LIBXML_TREE_ENABLED
21612 int mem_base;
21613 int ret_val;
21614 xmlAttrPtr cur; /* an attribute */
21615 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021616
Daniel Veillardce244ad2004-11-05 10:03:46 +000021617 for (n_cur = 0;n_cur < gen_nb_xmlAttrPtr;n_cur++) {
21618 mem_base = xmlMemBlocks();
21619 cur = gen_xmlAttrPtr(n_cur, 0);
21620
21621 ret_val = xmlRemoveProp(cur);
21622 cur = NULL;
21623 desret_int(ret_val);
21624 call_tests++;
21625 des_xmlAttrPtr(n_cur, cur, 0);
21626 xmlResetLastError();
21627 if (mem_base != xmlMemBlocks()) {
21628 printf("Leak of %d blocks found in xmlRemoveProp",
21629 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021630 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000021631 printf(" %d", n_cur);
21632 printf("\n");
21633 }
21634 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021635 function_tests++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000021636#endif
21637
Daniel Veillard42595322004-11-08 10:52:06 +000021638 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021639}
21640
21641
21642static int
21643test_xmlReplaceNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021644 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021645
21646#ifdef LIBXML_TREE_ENABLED
21647 int mem_base;
21648 xmlNodePtr ret_val;
21649 xmlNodePtr old; /* the old node */
21650 int n_old;
21651 xmlNodePtr cur; /* the node */
21652 int n_cur;
21653
21654 for (n_old = 0;n_old < gen_nb_xmlNodePtr;n_old++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021655 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr_in;n_cur++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000021656 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021657 old = gen_xmlNodePtr(n_old, 0);
21658 cur = gen_xmlNodePtr_in(n_cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021659
21660 ret_val = xmlReplaceNode(old, cur);
Daniel Veillardce244ad2004-11-05 10:03:46 +000021661 if (cur != NULL) {
21662 xmlUnlinkNode(cur);
Daniel Veillarda03e3652004-11-02 18:45:30 +000021663 xmlFreeNode(cur) ; cur = NULL ; }
Daniel Veillardce244ad2004-11-05 10:03:46 +000021664 if (old != NULL) {
21665 xmlUnlinkNode(old);
21666 xmlFreeNode(old) ; old = NULL ; }
21667 ret_val = NULL;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021668 desret_xmlNodePtr(ret_val);
21669 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021670 des_xmlNodePtr(n_old, old, 0);
21671 des_xmlNodePtr_in(n_cur, cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021672 xmlResetLastError();
21673 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021674 printf("Leak of %d blocks found in xmlReplaceNode",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021675 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021676 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021677 printf(" %d", n_old);
21678 printf(" %d", n_cur);
21679 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021680 }
21681 }
21682 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021683 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021684#endif
21685
Daniel Veillard42595322004-11-08 10:52:06 +000021686 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021687}
21688
21689
21690static int
21691test_xmlSaveFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021692 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021693
21694#ifdef LIBXML_OUTPUT_ENABLED
21695 int mem_base;
21696 int ret_val;
21697 const char * filename; /* the filename (or URL) */
21698 int n_filename;
21699 xmlDocPtr cur; /* the document */
21700 int n_cur;
21701
21702 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
21703 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
21704 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021705 filename = gen_fileoutput(n_filename, 0);
21706 cur = gen_xmlDocPtr(n_cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021707
21708 ret_val = xmlSaveFile(filename, cur);
21709 desret_int(ret_val);
21710 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021711 des_fileoutput(n_filename, filename, 0);
21712 des_xmlDocPtr(n_cur, cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021713 xmlResetLastError();
21714 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021715 printf("Leak of %d blocks found in xmlSaveFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021716 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021717 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021718 printf(" %d", n_filename);
21719 printf(" %d", n_cur);
21720 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021721 }
21722 }
21723 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021724 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021725#endif
21726
Daniel Veillard42595322004-11-08 10:52:06 +000021727 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021728}
21729
21730
21731static int
21732test_xmlSaveFileEnc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021733 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021734
21735#ifdef LIBXML_OUTPUT_ENABLED
21736 int mem_base;
21737 int ret_val;
21738 const char * filename; /* the filename (or URL) */
21739 int n_filename;
21740 xmlDocPtr cur; /* the document */
21741 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021742 char * encoding; /* the name of an encoding (or NULL) */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021743 int n_encoding;
21744
21745 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
21746 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
21747 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
21748 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021749 filename = gen_fileoutput(n_filename, 0);
21750 cur = gen_xmlDocPtr(n_cur, 1);
21751 encoding = gen_const_char_ptr(n_encoding, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021752
William M. Brackf13f77f2004-11-12 16:03:48 +000021753 ret_val = xmlSaveFileEnc(filename, cur, (const char *)encoding);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021754 desret_int(ret_val);
21755 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021756 des_fileoutput(n_filename, filename, 0);
21757 des_xmlDocPtr(n_cur, cur, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000021758 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021759 xmlResetLastError();
21760 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021761 printf("Leak of %d blocks found in xmlSaveFileEnc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021762 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021763 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021764 printf(" %d", n_filename);
21765 printf(" %d", n_cur);
21766 printf(" %d", n_encoding);
21767 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021768 }
21769 }
21770 }
21771 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021772 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021773#endif
21774
Daniel Veillard42595322004-11-08 10:52:06 +000021775 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021776}
21777
21778
21779static int
21780test_xmlSaveFileTo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021781 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021782
Daniel Veillard3d97e662004-11-04 10:49:00 +000021783#ifdef LIBXML_OUTPUT_ENABLED
21784 int mem_base;
21785 int ret_val;
21786 xmlOutputBufferPtr buf; /* an output I/O buffer */
21787 int n_buf;
21788 xmlDocPtr cur; /* the document */
21789 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021790 char * encoding; /* the encoding if any assuming the I/O layer handles the trancoding */
Daniel Veillard3d97e662004-11-04 10:49:00 +000021791 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021792
Daniel Veillard3d97e662004-11-04 10:49:00 +000021793 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
21794 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
21795 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
21796 mem_base = xmlMemBlocks();
21797 buf = gen_xmlOutputBufferPtr(n_buf, 0);
21798 cur = gen_xmlDocPtr(n_cur, 1);
21799 encoding = gen_const_char_ptr(n_encoding, 2);
21800
William M. Brackf13f77f2004-11-12 16:03:48 +000021801 ret_val = xmlSaveFileTo(buf, cur, (const char *)encoding);
Daniel Veillard3d97e662004-11-04 10:49:00 +000021802 buf = NULL;
21803 desret_int(ret_val);
21804 call_tests++;
21805 des_xmlOutputBufferPtr(n_buf, buf, 0);
21806 des_xmlDocPtr(n_cur, cur, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000021807 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +000021808 xmlResetLastError();
21809 if (mem_base != xmlMemBlocks()) {
21810 printf("Leak of %d blocks found in xmlSaveFileTo",
21811 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021812 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021813 printf(" %d", n_buf);
21814 printf(" %d", n_cur);
21815 printf(" %d", n_encoding);
21816 printf("\n");
21817 }
21818 }
21819 }
21820 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021821 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021822#endif
21823
Daniel Veillard42595322004-11-08 10:52:06 +000021824 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021825}
21826
21827
21828static int
21829test_xmlSaveFormatFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021830 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021831
21832#ifdef LIBXML_OUTPUT_ENABLED
21833 int mem_base;
21834 int ret_val;
21835 const char * filename; /* the filename (or URL) */
21836 int n_filename;
21837 xmlDocPtr cur; /* the document */
21838 int n_cur;
21839 int format; /* should formatting spaces been added */
21840 int n_format;
21841
21842 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
21843 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
21844 for (n_format = 0;n_format < gen_nb_int;n_format++) {
21845 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021846 filename = gen_fileoutput(n_filename, 0);
21847 cur = gen_xmlDocPtr(n_cur, 1);
21848 format = gen_int(n_format, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021849
21850 ret_val = xmlSaveFormatFile(filename, cur, format);
21851 desret_int(ret_val);
21852 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021853 des_fileoutput(n_filename, filename, 0);
21854 des_xmlDocPtr(n_cur, cur, 1);
21855 des_int(n_format, format, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021856 xmlResetLastError();
21857 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021858 printf("Leak of %d blocks found in xmlSaveFormatFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021859 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021860 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021861 printf(" %d", n_filename);
21862 printf(" %d", n_cur);
21863 printf(" %d", n_format);
21864 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021865 }
21866 }
21867 }
21868 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021869 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021870#endif
21871
Daniel Veillard42595322004-11-08 10:52:06 +000021872 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021873}
21874
21875
21876static int
21877test_xmlSaveFormatFileEnc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021878 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021879
21880#ifdef LIBXML_OUTPUT_ENABLED
21881 int mem_base;
21882 int ret_val;
21883 const char * filename; /* the filename or URL to output */
21884 int n_filename;
21885 xmlDocPtr cur; /* the document being saved */
21886 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021887 char * encoding; /* the name of the encoding to use or NULL. */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021888 int n_encoding;
21889 int format; /* should formatting spaces be added. */
21890 int n_format;
21891
21892 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
21893 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
21894 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
21895 for (n_format = 0;n_format < gen_nb_int;n_format++) {
21896 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021897 filename = gen_fileoutput(n_filename, 0);
21898 cur = gen_xmlDocPtr(n_cur, 1);
21899 encoding = gen_const_char_ptr(n_encoding, 2);
21900 format = gen_int(n_format, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021901
William M. Brackf13f77f2004-11-12 16:03:48 +000021902 ret_val = xmlSaveFormatFileEnc(filename, cur, (const char *)encoding, format);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021903 desret_int(ret_val);
21904 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021905 des_fileoutput(n_filename, filename, 0);
21906 des_xmlDocPtr(n_cur, cur, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000021907 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +000021908 des_int(n_format, format, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021909 xmlResetLastError();
21910 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021911 printf("Leak of %d blocks found in xmlSaveFormatFileEnc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021912 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021913 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021914 printf(" %d", n_filename);
21915 printf(" %d", n_cur);
21916 printf(" %d", n_encoding);
21917 printf(" %d", n_format);
21918 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021919 }
21920 }
21921 }
21922 }
21923 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021924 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021925#endif
21926
Daniel Veillard42595322004-11-08 10:52:06 +000021927 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021928}
21929
21930
21931static int
21932test_xmlSaveFormatFileTo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021933 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021934
Daniel Veillard3d97e662004-11-04 10:49:00 +000021935#ifdef LIBXML_OUTPUT_ENABLED
21936 int mem_base;
21937 int ret_val;
21938 xmlOutputBufferPtr buf; /* an output I/O buffer */
21939 int n_buf;
21940 xmlDocPtr cur; /* the document */
21941 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021942 char * encoding; /* the encoding if any assuming the I/O layer handles the trancoding */
Daniel Veillard3d97e662004-11-04 10:49:00 +000021943 int n_encoding;
21944 int format; /* should formatting spaces been added */
21945 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021946
Daniel Veillard3d97e662004-11-04 10:49:00 +000021947 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
21948 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
21949 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
21950 for (n_format = 0;n_format < gen_nb_int;n_format++) {
21951 mem_base = xmlMemBlocks();
21952 buf = gen_xmlOutputBufferPtr(n_buf, 0);
21953 cur = gen_xmlDocPtr(n_cur, 1);
21954 encoding = gen_const_char_ptr(n_encoding, 2);
21955 format = gen_int(n_format, 3);
21956
William M. Brackf13f77f2004-11-12 16:03:48 +000021957 ret_val = xmlSaveFormatFileTo(buf, cur, (const char *)encoding, format);
Daniel Veillard3d97e662004-11-04 10:49:00 +000021958 buf = NULL;
21959 desret_int(ret_val);
21960 call_tests++;
21961 des_xmlOutputBufferPtr(n_buf, buf, 0);
21962 des_xmlDocPtr(n_cur, cur, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000021963 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +000021964 des_int(n_format, format, 3);
21965 xmlResetLastError();
21966 if (mem_base != xmlMemBlocks()) {
21967 printf("Leak of %d blocks found in xmlSaveFormatFileTo",
21968 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021969 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021970 printf(" %d", n_buf);
21971 printf(" %d", n_cur);
21972 printf(" %d", n_encoding);
21973 printf(" %d", n_format);
21974 printf("\n");
21975 }
21976 }
21977 }
21978 }
21979 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021980 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021981#endif
21982
Daniel Veillard42595322004-11-08 10:52:06 +000021983 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021984}
21985
21986
21987static int
21988test_xmlSearchNs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021989 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021990
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000021991 int mem_base;
21992 xmlNsPtr ret_val;
21993 xmlDocPtr doc; /* the document */
21994 int n_doc;
21995 xmlNodePtr node; /* the current node */
21996 int n_node;
21997 xmlChar * nameSpace; /* the namespace prefix */
21998 int n_nameSpace;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021999
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022000 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
22001 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22002 for (n_nameSpace = 0;n_nameSpace < gen_nb_const_xmlChar_ptr;n_nameSpace++) {
22003 mem_base = xmlMemBlocks();
22004 doc = gen_xmlDocPtr(n_doc, 0);
22005 node = gen_xmlNodePtr(n_node, 1);
22006 nameSpace = gen_const_xmlChar_ptr(n_nameSpace, 2);
22007
William M. Brackf13f77f2004-11-12 16:03:48 +000022008 ret_val = xmlSearchNs(doc, node, (const xmlChar *)nameSpace);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022009 desret_xmlNsPtr(ret_val);
22010 call_tests++;
22011 des_xmlDocPtr(n_doc, doc, 0);
22012 des_xmlNodePtr(n_node, node, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000022013 des_const_xmlChar_ptr(n_nameSpace, (const xmlChar *)nameSpace, 2);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022014 xmlResetLastError();
22015 if (mem_base != xmlMemBlocks()) {
22016 printf("Leak of %d blocks found in xmlSearchNs",
22017 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022018 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022019 printf(" %d", n_doc);
22020 printf(" %d", n_node);
22021 printf(" %d", n_nameSpace);
22022 printf("\n");
22023 }
22024 }
22025 }
22026 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022027 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022028
Daniel Veillard42595322004-11-08 10:52:06 +000022029 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022030}
22031
22032
22033static int
22034test_xmlSearchNsByHref(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022035 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022036
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022037 int mem_base;
22038 xmlNsPtr ret_val;
22039 xmlDocPtr doc; /* the document */
22040 int n_doc;
22041 xmlNodePtr node; /* the current node */
22042 int n_node;
22043 xmlChar * href; /* the namespace value */
22044 int n_href;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022045
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022046 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
22047 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22048 for (n_href = 0;n_href < gen_nb_const_xmlChar_ptr;n_href++) {
22049 mem_base = xmlMemBlocks();
22050 doc = gen_xmlDocPtr(n_doc, 0);
22051 node = gen_xmlNodePtr(n_node, 1);
22052 href = gen_const_xmlChar_ptr(n_href, 2);
22053
William M. Brackf13f77f2004-11-12 16:03:48 +000022054 ret_val = xmlSearchNsByHref(doc, node, (const xmlChar *)href);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022055 desret_xmlNsPtr(ret_val);
22056 call_tests++;
22057 des_xmlDocPtr(n_doc, doc, 0);
22058 des_xmlNodePtr(n_node, node, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000022059 des_const_xmlChar_ptr(n_href, (const xmlChar *)href, 2);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022060 xmlResetLastError();
22061 if (mem_base != xmlMemBlocks()) {
22062 printf("Leak of %d blocks found in xmlSearchNsByHref",
22063 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022064 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022065 printf(" %d", n_doc);
22066 printf(" %d", n_node);
22067 printf(" %d", n_href);
22068 printf("\n");
22069 }
22070 }
22071 }
22072 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022073 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022074
Daniel Veillard42595322004-11-08 10:52:06 +000022075 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022076}
22077
22078
22079static int
22080test_xmlSetBufferAllocationScheme(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022081 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022082
Daniel Veillard57b25162004-11-06 14:50:18 +000022083 int mem_base;
22084 xmlBufferAllocationScheme scheme; /* allocation method to use */
22085 int n_scheme;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022086
Daniel Veillard57b25162004-11-06 14:50:18 +000022087 for (n_scheme = 0;n_scheme < gen_nb_xmlBufferAllocationScheme;n_scheme++) {
22088 mem_base = xmlMemBlocks();
22089 scheme = gen_xmlBufferAllocationScheme(n_scheme, 0);
22090
22091 xmlSetBufferAllocationScheme(scheme);
22092 call_tests++;
22093 des_xmlBufferAllocationScheme(n_scheme, scheme, 0);
22094 xmlResetLastError();
22095 if (mem_base != xmlMemBlocks()) {
22096 printf("Leak of %d blocks found in xmlSetBufferAllocationScheme",
22097 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022098 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000022099 printf(" %d", n_scheme);
22100 printf("\n");
22101 }
22102 }
Daniel Veillard57b25162004-11-06 14:50:18 +000022103 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022104
Daniel Veillard42595322004-11-08 10:52:06 +000022105 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022106}
22107
22108
22109static int
22110test_xmlSetCompressMode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022111 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022112
22113 int mem_base;
22114 int mode; /* the compression ratio */
22115 int n_mode;
22116
22117 for (n_mode = 0;n_mode < gen_nb_int;n_mode++) {
22118 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022119 mode = gen_int(n_mode, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022120
22121 xmlSetCompressMode(mode);
22122 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022123 des_int(n_mode, mode, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022124 xmlResetLastError();
22125 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022126 printf("Leak of %d blocks found in xmlSetCompressMode",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022127 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022128 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022129 printf(" %d", n_mode);
22130 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022131 }
22132 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000022133 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022134
Daniel Veillard42595322004-11-08 10:52:06 +000022135 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022136}
22137
22138
22139static int
22140test_xmlSetDocCompressMode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022141 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022142
22143 int mem_base;
22144 xmlDocPtr doc; /* the document */
22145 int n_doc;
22146 int mode; /* the compression ratio */
22147 int n_mode;
22148
22149 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
22150 for (n_mode = 0;n_mode < gen_nb_int;n_mode++) {
22151 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022152 doc = gen_xmlDocPtr(n_doc, 0);
22153 mode = gen_int(n_mode, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022154
22155 xmlSetDocCompressMode(doc, mode);
22156 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022157 des_xmlDocPtr(n_doc, doc, 0);
22158 des_int(n_mode, mode, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022159 xmlResetLastError();
22160 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022161 printf("Leak of %d blocks found in xmlSetDocCompressMode",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022162 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022163 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022164 printf(" %d", n_doc);
22165 printf(" %d", n_mode);
22166 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022167 }
22168 }
22169 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000022170 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022171
Daniel Veillard42595322004-11-08 10:52:06 +000022172 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022173}
22174
22175
22176static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000022177test_xmlSetNs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022178 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022179
Daniel Veillard27f20102004-11-05 11:50:11 +000022180 int mem_base;
22181 xmlNodePtr node; /* a node in the document */
22182 int n_node;
22183 xmlNsPtr ns; /* a namespace pointer */
22184 int n_ns;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022185
Daniel Veillard27f20102004-11-05 11:50:11 +000022186 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22187 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
22188 mem_base = xmlMemBlocks();
22189 node = gen_xmlNodePtr(n_node, 0);
22190 ns = gen_xmlNsPtr(n_ns, 1);
22191
22192 xmlSetNs(node, ns);
22193 call_tests++;
22194 des_xmlNodePtr(n_node, node, 0);
22195 des_xmlNsPtr(n_ns, ns, 1);
22196 xmlResetLastError();
22197 if (mem_base != xmlMemBlocks()) {
22198 printf("Leak of %d blocks found in xmlSetNs",
22199 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022200 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000022201 printf(" %d", n_node);
22202 printf(" %d", n_ns);
22203 printf("\n");
22204 }
22205 }
22206 }
Daniel Veillard27f20102004-11-05 11:50:11 +000022207 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022208
Daniel Veillard42595322004-11-08 10:52:06 +000022209 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022210}
22211
22212
22213static int
22214test_xmlSetNsProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022215 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022216
Daniel Veillard57b25162004-11-06 14:50:18 +000022217#ifdef LIBXML_TREE_ENABLED
22218 int mem_base;
22219 xmlAttrPtr ret_val;
22220 xmlNodePtr node; /* the node */
22221 int n_node;
22222 xmlNsPtr ns; /* the namespace definition */
22223 int n_ns;
22224 xmlChar * name; /* the attribute name */
22225 int n_name;
22226 xmlChar * value; /* the attribute value */
22227 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022228
Daniel Veillard57b25162004-11-06 14:50:18 +000022229 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22230 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
22231 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
22232 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22233 mem_base = xmlMemBlocks();
22234 node = gen_xmlNodePtr(n_node, 0);
22235 ns = gen_xmlNsPtr(n_ns, 1);
22236 name = gen_const_xmlChar_ptr(n_name, 2);
22237 value = gen_const_xmlChar_ptr(n_value, 3);
22238
William M. Brackf13f77f2004-11-12 16:03:48 +000022239 ret_val = xmlSetNsProp(node, ns, (const xmlChar *)name, (const xmlChar *)value);
Daniel Veillard57b25162004-11-06 14:50:18 +000022240 desret_xmlAttrPtr(ret_val);
22241 call_tests++;
22242 des_xmlNodePtr(n_node, node, 0);
22243 des_xmlNsPtr(n_ns, ns, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000022244 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
22245 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 3);
Daniel Veillard57b25162004-11-06 14:50:18 +000022246 xmlResetLastError();
22247 if (mem_base != xmlMemBlocks()) {
22248 printf("Leak of %d blocks found in xmlSetNsProp",
22249 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022250 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000022251 printf(" %d", n_node);
22252 printf(" %d", n_ns);
22253 printf(" %d", n_name);
22254 printf(" %d", n_value);
22255 printf("\n");
22256 }
22257 }
22258 }
22259 }
22260 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022261 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +000022262#endif
22263
Daniel Veillard42595322004-11-08 10:52:06 +000022264 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022265}
22266
22267
22268static int
22269test_xmlSetProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022270 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022271
Daniel Veillard57b25162004-11-06 14:50:18 +000022272#ifdef LIBXML_TREE_ENABLED
22273 int mem_base;
22274 xmlAttrPtr ret_val;
22275 xmlNodePtr node; /* the node */
22276 int n_node;
22277 xmlChar * name; /* the attribute name */
22278 int n_name;
22279 xmlChar * value; /* the attribute value */
22280 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022281
Daniel Veillard57b25162004-11-06 14:50:18 +000022282 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22283 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
22284 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22285 mem_base = xmlMemBlocks();
22286 node = gen_xmlNodePtr(n_node, 0);
22287 name = gen_const_xmlChar_ptr(n_name, 1);
22288 value = gen_const_xmlChar_ptr(n_value, 2);
22289
William M. Brackf13f77f2004-11-12 16:03:48 +000022290 ret_val = xmlSetProp(node, (const xmlChar *)name, (const xmlChar *)value);
Daniel Veillard57b25162004-11-06 14:50:18 +000022291 desret_xmlAttrPtr(ret_val);
22292 call_tests++;
22293 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000022294 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
22295 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 2);
Daniel Veillard57b25162004-11-06 14:50:18 +000022296 xmlResetLastError();
22297 if (mem_base != xmlMemBlocks()) {
22298 printf("Leak of %d blocks found in xmlSetProp",
22299 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022300 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000022301 printf(" %d", n_node);
22302 printf(" %d", n_name);
22303 printf(" %d", n_value);
22304 printf("\n");
22305 }
22306 }
22307 }
22308 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022309 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +000022310#endif
22311
Daniel Veillard42595322004-11-08 10:52:06 +000022312 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022313}
22314
22315
22316static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000022317test_xmlSplitQName2(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022318 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022319
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022320 int mem_base;
22321 xmlChar * ret_val;
22322 xmlChar * name; /* the full QName */
22323 int n_name;
22324 xmlChar ** prefix; /* a xmlChar ** */
22325 int n_prefix;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022326
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022327 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
22328 for (n_prefix = 0;n_prefix < gen_nb_xmlChar_ptr_ptr;n_prefix++) {
22329 mem_base = xmlMemBlocks();
22330 name = gen_const_xmlChar_ptr(n_name, 0);
22331 prefix = gen_xmlChar_ptr_ptr(n_prefix, 1);
22332
William M. Brackf13f77f2004-11-12 16:03:48 +000022333 ret_val = xmlSplitQName2((const xmlChar *)name, prefix);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022334 desret_xmlChar_ptr(ret_val);
22335 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000022336 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022337 des_xmlChar_ptr_ptr(n_prefix, prefix, 1);
22338 xmlResetLastError();
22339 if (mem_base != xmlMemBlocks()) {
22340 printf("Leak of %d blocks found in xmlSplitQName2",
22341 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022342 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022343 printf(" %d", n_name);
22344 printf(" %d", n_prefix);
22345 printf("\n");
22346 }
22347 }
22348 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022349 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022350
Daniel Veillard42595322004-11-08 10:52:06 +000022351 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022352}
22353
22354
22355static int
22356test_xmlSplitQName3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022357 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022358
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000022359 int mem_base;
22360 const xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022361 xmlChar * name; /* the full QName */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000022362 int n_name;
22363 int * len; /* an int * */
22364 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022365
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000022366 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
22367 for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
22368 mem_base = xmlMemBlocks();
22369 name = gen_const_xmlChar_ptr(n_name, 0);
22370 len = gen_int_ptr(n_len, 1);
22371
William M. Brackf13f77f2004-11-12 16:03:48 +000022372 ret_val = xmlSplitQName3((const xmlChar *)name, len);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000022373 desret_const_xmlChar_ptr(ret_val);
22374 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000022375 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000022376 des_int_ptr(n_len, len, 1);
22377 xmlResetLastError();
22378 if (mem_base != xmlMemBlocks()) {
22379 printf("Leak of %d blocks found in xmlSplitQName3",
22380 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022381 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000022382 printf(" %d", n_name);
22383 printf(" %d", n_len);
22384 printf("\n");
22385 }
22386 }
22387 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000022388 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022389
Daniel Veillard42595322004-11-08 10:52:06 +000022390 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022391}
22392
22393
22394static int
22395test_xmlStringGetNodeList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022396 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022397
22398 int mem_base;
22399 xmlNodePtr ret_val;
22400 xmlDocPtr doc; /* the document */
22401 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022402 xmlChar * value; /* the value of the attribute */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022403 int n_value;
22404
22405 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
22406 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22407 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022408 doc = gen_xmlDocPtr(n_doc, 0);
22409 value = gen_const_xmlChar_ptr(n_value, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022410
William M. Brackf13f77f2004-11-12 16:03:48 +000022411 ret_val = xmlStringGetNodeList(doc, (const xmlChar *)value);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022412 desret_xmlNodePtr(ret_val);
22413 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022414 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000022415 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022416 xmlResetLastError();
22417 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022418 printf("Leak of %d blocks found in xmlStringGetNodeList",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022419 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022420 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022421 printf(" %d", n_doc);
22422 printf(" %d", n_value);
22423 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022424 }
22425 }
22426 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000022427 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022428
Daniel Veillard42595322004-11-08 10:52:06 +000022429 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022430}
22431
22432
22433static int
22434test_xmlStringLenGetNodeList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022435 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022436
22437 int mem_base;
22438 xmlNodePtr ret_val;
22439 xmlDocPtr doc; /* the document */
22440 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022441 xmlChar * value; /* the value of the text */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022442 int n_value;
22443 int len; /* the length of the string value */
22444 int n_len;
22445
22446 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
22447 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22448 for (n_len = 0;n_len < gen_nb_int;n_len++) {
22449 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022450 doc = gen_xmlDocPtr(n_doc, 0);
22451 value = gen_const_xmlChar_ptr(n_value, 1);
22452 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022453
William M. Brackf13f77f2004-11-12 16:03:48 +000022454 ret_val = xmlStringLenGetNodeList(doc, (const xmlChar *)value, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022455 desret_xmlNodePtr(ret_val);
22456 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022457 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000022458 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000022459 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022460 xmlResetLastError();
22461 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022462 printf("Leak of %d blocks found in xmlStringLenGetNodeList",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022463 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022464 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022465 printf(" %d", n_doc);
22466 printf(" %d", n_value);
22467 printf(" %d", n_len);
22468 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022469 }
22470 }
22471 }
22472 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000022473 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022474
Daniel Veillard42595322004-11-08 10:52:06 +000022475 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022476}
22477
22478
22479static int
22480test_xmlTextConcat(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022481 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022482
22483 int mem_base;
22484 int ret_val;
22485 xmlNodePtr node; /* the node */
22486 int n_node;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022487 xmlChar * content; /* the content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022488 int n_content;
22489 int len; /* @content length */
22490 int n_len;
22491
22492 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22493 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
22494 for (n_len = 0;n_len < gen_nb_int;n_len++) {
22495 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022496 node = gen_xmlNodePtr(n_node, 0);
22497 content = gen_const_xmlChar_ptr(n_content, 1);
22498 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022499
William M. Brackf13f77f2004-11-12 16:03:48 +000022500 ret_val = xmlTextConcat(node, (const xmlChar *)content, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022501 desret_int(ret_val);
22502 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022503 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000022504 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000022505 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022506 xmlResetLastError();
22507 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022508 printf("Leak of %d blocks found in xmlTextConcat",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022509 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022510 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022511 printf(" %d", n_node);
22512 printf(" %d", n_content);
22513 printf(" %d", n_len);
22514 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022515 }
22516 }
22517 }
22518 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000022519 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022520
Daniel Veillard42595322004-11-08 10:52:06 +000022521 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022522}
22523
22524
22525static int
22526test_xmlTextMerge(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022527 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022528
22529 int mem_base;
22530 xmlNodePtr ret_val;
22531 xmlNodePtr first; /* the first text node */
22532 int n_first;
22533 xmlNodePtr second; /* the second text node being merged */
22534 int n_second;
22535
Daniel Veillarda03e3652004-11-02 18:45:30 +000022536 for (n_first = 0;n_first < gen_nb_xmlNodePtr_in;n_first++) {
22537 for (n_second = 0;n_second < gen_nb_xmlNodePtr_in;n_second++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000022538 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022539 first = gen_xmlNodePtr_in(n_first, 0);
22540 second = gen_xmlNodePtr_in(n_second, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022541
22542 ret_val = xmlTextMerge(first, second);
Daniel Veillarda03e3652004-11-02 18:45:30 +000022543 if ((first != NULL) && (first->type != XML_TEXT_NODE)) {
Daniel Veillardce244ad2004-11-05 10:03:46 +000022544 xmlUnlinkNode(second);
Daniel Veillarda03e3652004-11-02 18:45:30 +000022545 xmlFreeNode(second) ; second = NULL ; }
Daniel Veillard8a32fe42004-11-02 22:10:16 +000022546 desret_xmlNodePtr(ret_val);
22547 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022548 des_xmlNodePtr_in(n_first, first, 0);
22549 des_xmlNodePtr_in(n_second, second, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022550 xmlResetLastError();
22551 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022552 printf("Leak of %d blocks found in xmlTextMerge",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022553 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022554 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022555 printf(" %d", n_first);
22556 printf(" %d", n_second);
22557 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022558 }
22559 }
22560 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000022561 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022562
Daniel Veillard42595322004-11-08 10:52:06 +000022563 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022564}
22565
22566
22567static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000022568test_xmlUnsetNsProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022569 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022570
Daniel Veillard27f20102004-11-05 11:50:11 +000022571#ifdef LIBXML_TREE_ENABLED
22572 int mem_base;
22573 int ret_val;
22574 xmlNodePtr node; /* the node */
22575 int n_node;
22576 xmlNsPtr ns; /* the namespace definition */
22577 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022578 xmlChar * name; /* the attribute name */
Daniel Veillard27f20102004-11-05 11:50:11 +000022579 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022580
Daniel Veillard27f20102004-11-05 11:50:11 +000022581 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22582 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
22583 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
22584 mem_base = xmlMemBlocks();
22585 node = gen_xmlNodePtr(n_node, 0);
22586 ns = gen_xmlNsPtr(n_ns, 1);
22587 name = gen_const_xmlChar_ptr(n_name, 2);
22588
William M. Brackf13f77f2004-11-12 16:03:48 +000022589 ret_val = xmlUnsetNsProp(node, ns, (const xmlChar *)name);
Daniel Veillard27f20102004-11-05 11:50:11 +000022590 desret_int(ret_val);
22591 call_tests++;
22592 des_xmlNodePtr(n_node, node, 0);
22593 des_xmlNsPtr(n_ns, ns, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000022594 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
Daniel Veillard27f20102004-11-05 11:50:11 +000022595 xmlResetLastError();
22596 if (mem_base != xmlMemBlocks()) {
22597 printf("Leak of %d blocks found in xmlUnsetNsProp",
22598 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022599 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000022600 printf(" %d", n_node);
22601 printf(" %d", n_ns);
22602 printf(" %d", n_name);
22603 printf("\n");
22604 }
22605 }
22606 }
22607 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022608 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000022609#endif
22610
Daniel Veillard42595322004-11-08 10:52:06 +000022611 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022612}
22613
22614
22615static int
22616test_xmlUnsetProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022617 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022618
22619#ifdef LIBXML_TREE_ENABLED
22620 int mem_base;
22621 int ret_val;
22622 xmlNodePtr node; /* the node */
22623 int n_node;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022624 xmlChar * name; /* the attribute name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022625 int n_name;
22626
22627 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22628 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
22629 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022630 node = gen_xmlNodePtr(n_node, 0);
22631 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022632
William M. Brackf13f77f2004-11-12 16:03:48 +000022633 ret_val = xmlUnsetProp(node, (const xmlChar *)name);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022634 desret_int(ret_val);
22635 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022636 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000022637 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022638 xmlResetLastError();
22639 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022640 printf("Leak of %d blocks found in xmlUnsetProp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022641 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022642 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022643 printf(" %d", n_node);
22644 printf(" %d", n_name);
22645 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022646 }
22647 }
22648 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022649 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022650#endif
22651
Daniel Veillard42595322004-11-08 10:52:06 +000022652 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022653}
22654
22655
22656static int
22657test_xmlValidateNCName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022658 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022659
Daniel Veillarda521d282004-11-09 14:59:59 +000022660#ifdef LIBXML_TREE_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000022661 int mem_base;
22662 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022663 xmlChar * value; /* the value to check */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022664 int n_value;
22665 int space; /* allow spaces in front and end of the string */
22666 int n_space;
22667
22668 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22669 for (n_space = 0;n_space < gen_nb_int;n_space++) {
22670 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022671 value = gen_const_xmlChar_ptr(n_value, 0);
22672 space = gen_int(n_space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022673
William M. Brackf13f77f2004-11-12 16:03:48 +000022674 ret_val = xmlValidateNCName((const xmlChar *)value, space);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022675 desret_int(ret_val);
22676 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000022677 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000022678 des_int(n_space, space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022679 xmlResetLastError();
22680 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022681 printf("Leak of %d blocks found in xmlValidateNCName",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022682 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022683 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022684 printf(" %d", n_value);
22685 printf(" %d", n_space);
22686 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022687 }
22688 }
22689 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022690 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000022691#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000022692
Daniel Veillard42595322004-11-08 10:52:06 +000022693 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022694}
22695
22696
22697static int
22698test_xmlValidateNMToken(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022699 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022700
Daniel Veillarda521d282004-11-09 14:59:59 +000022701#ifdef LIBXML_TREE_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000022702 int mem_base;
22703 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022704 xmlChar * value; /* the value to check */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022705 int n_value;
22706 int space; /* allow spaces in front and end of the string */
22707 int n_space;
22708
22709 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22710 for (n_space = 0;n_space < gen_nb_int;n_space++) {
22711 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022712 value = gen_const_xmlChar_ptr(n_value, 0);
22713 space = gen_int(n_space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022714
William M. Brackf13f77f2004-11-12 16:03:48 +000022715 ret_val = xmlValidateNMToken((const xmlChar *)value, space);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022716 desret_int(ret_val);
22717 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000022718 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000022719 des_int(n_space, space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022720 xmlResetLastError();
22721 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022722 printf("Leak of %d blocks found in xmlValidateNMToken",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022723 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022724 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022725 printf(" %d", n_value);
22726 printf(" %d", n_space);
22727 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022728 }
22729 }
22730 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022731 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000022732#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000022733
Daniel Veillard42595322004-11-08 10:52:06 +000022734 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022735}
22736
22737
22738static int
22739test_xmlValidateName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022740 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022741
Daniel Veillarda521d282004-11-09 14:59:59 +000022742#ifdef LIBXML_TREE_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000022743 int mem_base;
22744 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022745 xmlChar * value; /* the value to check */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022746 int n_value;
22747 int space; /* allow spaces in front and end of the string */
22748 int n_space;
22749
22750 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22751 for (n_space = 0;n_space < gen_nb_int;n_space++) {
22752 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022753 value = gen_const_xmlChar_ptr(n_value, 0);
22754 space = gen_int(n_space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022755
William M. Brackf13f77f2004-11-12 16:03:48 +000022756 ret_val = xmlValidateName((const xmlChar *)value, space);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022757 desret_int(ret_val);
22758 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000022759 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000022760 des_int(n_space, space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022761 xmlResetLastError();
22762 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022763 printf("Leak of %d blocks found in xmlValidateName",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022764 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022765 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022766 printf(" %d", n_value);
22767 printf(" %d", n_space);
22768 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022769 }
22770 }
22771 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022772 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000022773#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000022774
Daniel Veillard42595322004-11-08 10:52:06 +000022775 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022776}
22777
22778
22779static int
22780test_xmlValidateQName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022781 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022782
Daniel Veillarda521d282004-11-09 14:59:59 +000022783#ifdef LIBXML_TREE_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000022784 int mem_base;
22785 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022786 xmlChar * value; /* the value to check */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022787 int n_value;
22788 int space; /* allow spaces in front and end of the string */
22789 int n_space;
22790
22791 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22792 for (n_space = 0;n_space < gen_nb_int;n_space++) {
22793 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022794 value = gen_const_xmlChar_ptr(n_value, 0);
22795 space = gen_int(n_space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022796
William M. Brackf13f77f2004-11-12 16:03:48 +000022797 ret_val = xmlValidateQName((const xmlChar *)value, space);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022798 desret_int(ret_val);
22799 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000022800 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000022801 des_int(n_space, space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022802 xmlResetLastError();
22803 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022804 printf("Leak of %d blocks found in xmlValidateQName",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022805 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022806 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022807 printf(" %d", n_value);
22808 printf(" %d", n_space);
22809 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022810 }
22811 }
22812 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022813 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000022814#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000022815
Daniel Veillard42595322004-11-08 10:52:06 +000022816 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022817}
22818
22819static int
22820test_tree(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022821 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022822
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022823 if (quiet == 0) printf("Testing tree : 129 of 146 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000022824 test_ret += test_xmlAddChild();
22825 test_ret += test_xmlAddChildList();
22826 test_ret += test_xmlAddNextSibling();
22827 test_ret += test_xmlAddPrevSibling();
22828 test_ret += test_xmlAddSibling();
22829 test_ret += test_xmlAttrSerializeTxtContent();
22830 test_ret += test_xmlBufferAdd();
22831 test_ret += test_xmlBufferAddHead();
22832 test_ret += test_xmlBufferCCat();
22833 test_ret += test_xmlBufferCat();
22834 test_ret += test_xmlBufferContent();
22835 test_ret += test_xmlBufferCreate();
22836 test_ret += test_xmlBufferCreateSize();
22837 test_ret += test_xmlBufferCreateStatic();
22838 test_ret += test_xmlBufferEmpty();
22839 test_ret += test_xmlBufferGrow();
22840 test_ret += test_xmlBufferLength();
22841 test_ret += test_xmlBufferResize();
22842 test_ret += test_xmlBufferSetAllocationScheme();
22843 test_ret += test_xmlBufferShrink();
22844 test_ret += test_xmlBufferWriteCHAR();
22845 test_ret += test_xmlBufferWriteChar();
22846 test_ret += test_xmlBufferWriteQuotedString();
22847 test_ret += test_xmlBuildQName();
22848 test_ret += test_xmlCopyDoc();
22849 test_ret += test_xmlCopyDtd();
22850 test_ret += test_xmlCopyNamespace();
22851 test_ret += test_xmlCopyNamespaceList();
22852 test_ret += test_xmlCopyNode();
22853 test_ret += test_xmlCopyNodeList();
22854 test_ret += test_xmlCopyProp();
22855 test_ret += test_xmlCopyPropList();
22856 test_ret += test_xmlCreateIntSubset();
22857 test_ret += test_xmlDocCopyNode();
22858 test_ret += test_xmlDocCopyNodeList();
22859 test_ret += test_xmlDocDump();
22860 test_ret += test_xmlDocDumpFormatMemory();
22861 test_ret += test_xmlDocDumpFormatMemoryEnc();
22862 test_ret += test_xmlDocDumpMemory();
22863 test_ret += test_xmlDocDumpMemoryEnc();
22864 test_ret += test_xmlDocFormatDump();
22865 test_ret += test_xmlDocGetRootElement();
22866 test_ret += test_xmlDocSetRootElement();
22867 test_ret += test_xmlElemDump();
22868 test_ret += test_xmlGetBufferAllocationScheme();
22869 test_ret += test_xmlGetCompressMode();
22870 test_ret += test_xmlGetDocCompressMode();
22871 test_ret += test_xmlGetIntSubset();
22872 test_ret += test_xmlGetLastChild();
22873 test_ret += test_xmlGetLineNo();
22874 test_ret += test_xmlGetNoNsProp();
22875 test_ret += test_xmlGetNodePath();
22876 test_ret += test_xmlGetNsList();
22877 test_ret += test_xmlGetNsProp();
22878 test_ret += test_xmlGetProp();
22879 test_ret += test_xmlHasNsProp();
22880 test_ret += test_xmlHasProp();
22881 test_ret += test_xmlIsBlankNode();
22882 test_ret += test_xmlIsXHTML();
22883 test_ret += test_xmlNewCDataBlock();
22884 test_ret += test_xmlNewCharRef();
22885 test_ret += test_xmlNewChild();
22886 test_ret += test_xmlNewComment();
22887 test_ret += test_xmlNewDoc();
22888 test_ret += test_xmlNewDocComment();
22889 test_ret += test_xmlNewDocFragment();
22890 test_ret += test_xmlNewDocNode();
22891 test_ret += test_xmlNewDocNodeEatName();
22892 test_ret += test_xmlNewDocPI();
22893 test_ret += test_xmlNewDocProp();
22894 test_ret += test_xmlNewDocRawNode();
22895 test_ret += test_xmlNewDocText();
22896 test_ret += test_xmlNewDocTextLen();
22897 test_ret += test_xmlNewDtd();
22898 test_ret += test_xmlNewNode();
22899 test_ret += test_xmlNewNodeEatName();
22900 test_ret += test_xmlNewNs();
22901 test_ret += test_xmlNewNsProp();
22902 test_ret += test_xmlNewNsPropEatName();
22903 test_ret += test_xmlNewPI();
22904 test_ret += test_xmlNewProp();
22905 test_ret += test_xmlNewReference();
22906 test_ret += test_xmlNewText();
22907 test_ret += test_xmlNewTextChild();
22908 test_ret += test_xmlNewTextLen();
22909 test_ret += test_xmlNodeAddContent();
22910 test_ret += test_xmlNodeAddContentLen();
22911 test_ret += test_xmlNodeBufGetContent();
22912 test_ret += test_xmlNodeDump();
22913 test_ret += test_xmlNodeDumpOutput();
22914 test_ret += test_xmlNodeGetBase();
22915 test_ret += test_xmlNodeGetContent();
22916 test_ret += test_xmlNodeGetLang();
22917 test_ret += test_xmlNodeGetSpacePreserve();
22918 test_ret += test_xmlNodeIsText();
22919 test_ret += test_xmlNodeListGetRawString();
22920 test_ret += test_xmlNodeListGetString();
22921 test_ret += test_xmlNodeSetBase();
22922 test_ret += test_xmlNodeSetContent();
22923 test_ret += test_xmlNodeSetContentLen();
22924 test_ret += test_xmlNodeSetLang();
22925 test_ret += test_xmlNodeSetName();
22926 test_ret += test_xmlNodeSetSpacePreserve();
22927 test_ret += test_xmlReconciliateNs();
22928 test_ret += test_xmlRemoveProp();
22929 test_ret += test_xmlReplaceNode();
22930 test_ret += test_xmlSaveFile();
22931 test_ret += test_xmlSaveFileEnc();
22932 test_ret += test_xmlSaveFileTo();
22933 test_ret += test_xmlSaveFormatFile();
22934 test_ret += test_xmlSaveFormatFileEnc();
22935 test_ret += test_xmlSaveFormatFileTo();
22936 test_ret += test_xmlSearchNs();
22937 test_ret += test_xmlSearchNsByHref();
22938 test_ret += test_xmlSetBufferAllocationScheme();
22939 test_ret += test_xmlSetCompressMode();
22940 test_ret += test_xmlSetDocCompressMode();
22941 test_ret += test_xmlSetNs();
22942 test_ret += test_xmlSetNsProp();
22943 test_ret += test_xmlSetProp();
22944 test_ret += test_xmlSplitQName2();
22945 test_ret += test_xmlSplitQName3();
22946 test_ret += test_xmlStringGetNodeList();
22947 test_ret += test_xmlStringLenGetNodeList();
22948 test_ret += test_xmlTextConcat();
22949 test_ret += test_xmlTextMerge();
22950 test_ret += test_xmlUnsetNsProp();
22951 test_ret += test_xmlUnsetProp();
22952 test_ret += test_xmlValidateNCName();
22953 test_ret += test_xmlValidateNMToken();
22954 test_ret += test_xmlValidateName();
22955 test_ret += test_xmlValidateQName();
Daniel Veillardd93f6252004-11-02 15:53:51 +000022956
Daniel Veillard42595322004-11-08 10:52:06 +000022957 if (test_ret != 0)
22958 printf("Module tree: %d errors\n", test_ret);
22959 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022960}
22961
22962static int
22963test_xmlBuildRelativeURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022964 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022965
Daniel Veillard8a32fe42004-11-02 22:10:16 +000022966 int mem_base;
22967 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022968 xmlChar * URI; /* the URI reference under consideration */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000022969 int n_URI;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022970 xmlChar * base; /* the base value */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000022971 int n_base;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022972
Daniel Veillard8a32fe42004-11-02 22:10:16 +000022973 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
22974 for (n_base = 0;n_base < gen_nb_const_xmlChar_ptr;n_base++) {
22975 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022976 URI = gen_const_xmlChar_ptr(n_URI, 0);
22977 base = gen_const_xmlChar_ptr(n_base, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000022978
William M. Brackf13f77f2004-11-12 16:03:48 +000022979 ret_val = xmlBuildRelativeURI((const xmlChar *)URI, (const xmlChar *)base);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000022980 desret_xmlChar_ptr(ret_val);
22981 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000022982 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 0);
22983 des_const_xmlChar_ptr(n_base, (const xmlChar *)base, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000022984 xmlResetLastError();
22985 if (mem_base != xmlMemBlocks()) {
22986 printf("Leak of %d blocks found in xmlBuildRelativeURI",
22987 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022988 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000022989 printf(" %d", n_URI);
22990 printf(" %d", n_base);
22991 printf("\n");
22992 }
22993 }
22994 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000022995 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022996
Daniel Veillard42595322004-11-08 10:52:06 +000022997 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022998}
22999
23000
23001static int
23002test_xmlBuildURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023003 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023004
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023005 int mem_base;
23006 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023007 xmlChar * URI; /* the URI instance found in the document */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023008 int n_URI;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023009 xmlChar * base; /* the base value */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023010 int n_base;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023011
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023012 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
23013 for (n_base = 0;n_base < gen_nb_const_xmlChar_ptr;n_base++) {
23014 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000023015 URI = gen_const_xmlChar_ptr(n_URI, 0);
23016 base = gen_const_xmlChar_ptr(n_base, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023017
William M. Brackf13f77f2004-11-12 16:03:48 +000023018 ret_val = xmlBuildURI((const xmlChar *)URI, (const xmlChar *)base);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023019 desret_xmlChar_ptr(ret_val);
23020 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000023021 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 0);
23022 des_const_xmlChar_ptr(n_base, (const xmlChar *)base, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023023 xmlResetLastError();
23024 if (mem_base != xmlMemBlocks()) {
23025 printf("Leak of %d blocks found in xmlBuildURI",
23026 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023027 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023028 printf(" %d", n_URI);
23029 printf(" %d", n_base);
23030 printf("\n");
23031 }
23032 }
23033 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000023034 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023035
Daniel Veillard42595322004-11-08 10:52:06 +000023036 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023037}
23038
23039
23040static int
23041test_xmlCanonicPath(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023042 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023043
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023044 int mem_base;
23045 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023046 xmlChar * path; /* the resource locator in a filesystem notation */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023047 int n_path;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023048
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023049 for (n_path = 0;n_path < gen_nb_const_xmlChar_ptr;n_path++) {
23050 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000023051 path = gen_const_xmlChar_ptr(n_path, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023052
William M. Brackf13f77f2004-11-12 16:03:48 +000023053 ret_val = xmlCanonicPath((const xmlChar *)path);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023054 desret_xmlChar_ptr(ret_val);
23055 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000023056 des_const_xmlChar_ptr(n_path, (const xmlChar *)path, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023057 xmlResetLastError();
23058 if (mem_base != xmlMemBlocks()) {
23059 printf("Leak of %d blocks found in xmlCanonicPath",
23060 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023061 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023062 printf(" %d", n_path);
23063 printf("\n");
23064 }
23065 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000023066 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023067
Daniel Veillard42595322004-11-08 10:52:06 +000023068 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023069}
23070
23071
23072static int
23073test_xmlCreateURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023074 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023075
23076
23077 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023078 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023079}
23080
23081
23082static int
23083test_xmlNormalizeURIPath(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023084 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023085
Daniel Veillardce682bc2004-11-05 17:22:25 +000023086 int mem_base;
23087 int ret_val;
23088 char * path; /* pointer to the path string */
23089 int n_path;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023090
Daniel Veillardce682bc2004-11-05 17:22:25 +000023091 for (n_path = 0;n_path < gen_nb_char_ptr;n_path++) {
23092 mem_base = xmlMemBlocks();
23093 path = gen_char_ptr(n_path, 0);
23094
23095 ret_val = xmlNormalizeURIPath(path);
23096 desret_int(ret_val);
23097 call_tests++;
23098 des_char_ptr(n_path, path, 0);
23099 xmlResetLastError();
23100 if (mem_base != xmlMemBlocks()) {
23101 printf("Leak of %d blocks found in xmlNormalizeURIPath",
23102 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023103 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023104 printf(" %d", n_path);
23105 printf("\n");
23106 }
23107 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000023108 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023109
Daniel Veillard42595322004-11-08 10:52:06 +000023110 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023111}
23112
23113
23114static int
23115test_xmlParseURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023116 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023117
23118
23119 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023120 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023121}
23122
23123
Daniel Veillardce682bc2004-11-05 17:22:25 +000023124#define gen_nb_xmlURIPtr 1
23125static xmlURIPtr gen_xmlURIPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23126 return(NULL);
23127}
23128static void des_xmlURIPtr(int no ATTRIBUTE_UNUSED, xmlURIPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23129}
23130
Daniel Veillardd93f6252004-11-02 15:53:51 +000023131static int
23132test_xmlParseURIReference(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023133 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023134
Daniel Veillardce682bc2004-11-05 17:22:25 +000023135 int mem_base;
23136 int ret_val;
23137 xmlURIPtr uri; /* pointer to an URI structure */
23138 int n_uri;
23139 char * str; /* the string to analyze */
23140 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023141
Daniel Veillardce682bc2004-11-05 17:22:25 +000023142 for (n_uri = 0;n_uri < gen_nb_xmlURIPtr;n_uri++) {
23143 for (n_str = 0;n_str < gen_nb_const_char_ptr;n_str++) {
23144 mem_base = xmlMemBlocks();
23145 uri = gen_xmlURIPtr(n_uri, 0);
23146 str = gen_const_char_ptr(n_str, 1);
23147
William M. Brackf13f77f2004-11-12 16:03:48 +000023148 ret_val = xmlParseURIReference(uri, (const char *)str);
Daniel Veillardce682bc2004-11-05 17:22:25 +000023149 desret_int(ret_val);
23150 call_tests++;
23151 des_xmlURIPtr(n_uri, uri, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000023152 des_const_char_ptr(n_str, (const char *)str, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000023153 xmlResetLastError();
23154 if (mem_base != xmlMemBlocks()) {
23155 printf("Leak of %d blocks found in xmlParseURIReference",
23156 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023157 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023158 printf(" %d", n_uri);
23159 printf(" %d", n_str);
23160 printf("\n");
23161 }
23162 }
23163 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000023164 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023165
Daniel Veillard42595322004-11-08 10:52:06 +000023166 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023167}
23168
23169
23170static int
23171test_xmlPrintURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023172 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023173
Daniel Veillardce682bc2004-11-05 17:22:25 +000023174 int mem_base;
23175 FILE * stream; /* a FILE* for the output */
23176 int n_stream;
23177 xmlURIPtr uri; /* pointer to an xmlURI */
23178 int n_uri;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023179
Daniel Veillardce682bc2004-11-05 17:22:25 +000023180 for (n_stream = 0;n_stream < gen_nb_FILE_ptr;n_stream++) {
23181 for (n_uri = 0;n_uri < gen_nb_xmlURIPtr;n_uri++) {
23182 mem_base = xmlMemBlocks();
23183 stream = gen_FILE_ptr(n_stream, 0);
23184 uri = gen_xmlURIPtr(n_uri, 1);
23185
23186 xmlPrintURI(stream, uri);
23187 call_tests++;
23188 des_FILE_ptr(n_stream, stream, 0);
23189 des_xmlURIPtr(n_uri, uri, 1);
23190 xmlResetLastError();
23191 if (mem_base != xmlMemBlocks()) {
23192 printf("Leak of %d blocks found in xmlPrintURI",
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_stream);
23196 printf(" %d", n_uri);
23197 printf("\n");
23198 }
23199 }
23200 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000023201 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023202
Daniel Veillard42595322004-11-08 10:52:06 +000023203 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023204}
23205
23206
23207static int
23208test_xmlSaveUri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023209 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023210
Daniel Veillardce682bc2004-11-05 17:22:25 +000023211 int mem_base;
23212 xmlChar * ret_val;
23213 xmlURIPtr uri; /* pointer to an xmlURI */
23214 int n_uri;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023215
Daniel Veillardce682bc2004-11-05 17:22:25 +000023216 for (n_uri = 0;n_uri < gen_nb_xmlURIPtr;n_uri++) {
23217 mem_base = xmlMemBlocks();
23218 uri = gen_xmlURIPtr(n_uri, 0);
23219
23220 ret_val = xmlSaveUri(uri);
23221 desret_xmlChar_ptr(ret_val);
23222 call_tests++;
23223 des_xmlURIPtr(n_uri, uri, 0);
23224 xmlResetLastError();
23225 if (mem_base != xmlMemBlocks()) {
23226 printf("Leak of %d blocks found in xmlSaveUri",
23227 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023228 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023229 printf(" %d", n_uri);
23230 printf("\n");
23231 }
23232 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000023233 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023234
Daniel Veillard42595322004-11-08 10:52:06 +000023235 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023236}
23237
23238
23239static int
23240test_xmlURIEscape(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023241 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023242
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023243 int mem_base;
23244 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023245 xmlChar * str; /* the string of the URI to escape */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023246 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023247
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023248 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
23249 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000023250 str = gen_const_xmlChar_ptr(n_str, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023251
William M. Brackf13f77f2004-11-12 16:03:48 +000023252 ret_val = xmlURIEscape((const xmlChar *)str);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023253 desret_xmlChar_ptr(ret_val);
23254 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000023255 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023256 xmlResetLastError();
23257 if (mem_base != xmlMemBlocks()) {
23258 printf("Leak of %d blocks found in xmlURIEscape",
23259 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023260 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023261 printf(" %d", n_str);
23262 printf("\n");
23263 }
23264 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000023265 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023266
Daniel Veillard42595322004-11-08 10:52:06 +000023267 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023268}
23269
23270
23271static int
23272test_xmlURIEscapeStr(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023273 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023274
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023275 int mem_base;
23276 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023277 xmlChar * str; /* string to escape */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023278 int n_str;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023279 xmlChar * list; /* exception list string of chars not to escape */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023280 int n_list;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023281
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023282 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
23283 for (n_list = 0;n_list < gen_nb_const_xmlChar_ptr;n_list++) {
23284 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000023285 str = gen_const_xmlChar_ptr(n_str, 0);
23286 list = gen_const_xmlChar_ptr(n_list, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023287
William M. Brackf13f77f2004-11-12 16:03:48 +000023288 ret_val = xmlURIEscapeStr((const xmlChar *)str, (const xmlChar *)list);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023289 desret_xmlChar_ptr(ret_val);
23290 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000023291 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
23292 des_const_xmlChar_ptr(n_list, (const xmlChar *)list, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023293 xmlResetLastError();
23294 if (mem_base != xmlMemBlocks()) {
23295 printf("Leak of %d blocks found in xmlURIEscapeStr",
23296 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023297 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023298 printf(" %d", n_str);
23299 printf(" %d", n_list);
23300 printf("\n");
23301 }
23302 }
23303 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000023304 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023305
Daniel Veillard42595322004-11-08 10:52:06 +000023306 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023307}
23308
23309
23310static int
23311test_xmlURIUnescapeString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023312 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023313
23314
23315 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023316 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023317}
23318
23319static int
23320test_uri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023321 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023322
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023323 if (quiet == 0) printf("Testing uri : 9 of 13 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000023324 test_ret += test_xmlBuildRelativeURI();
23325 test_ret += test_xmlBuildURI();
23326 test_ret += test_xmlCanonicPath();
23327 test_ret += test_xmlCreateURI();
23328 test_ret += test_xmlNormalizeURIPath();
23329 test_ret += test_xmlParseURI();
23330 test_ret += test_xmlParseURIReference();
23331 test_ret += test_xmlPrintURI();
23332 test_ret += test_xmlSaveUri();
23333 test_ret += test_xmlURIEscape();
23334 test_ret += test_xmlURIEscapeStr();
23335 test_ret += test_xmlURIUnescapeString();
Daniel Veillardd93f6252004-11-02 15:53:51 +000023336
Daniel Veillard42595322004-11-08 10:52:06 +000023337 if (test_ret != 0)
23338 printf("Module uri: %d errors\n", test_ret);
23339 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023340}
23341
23342static int
23343test_xmlAddAttributeDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023344 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023345
Daniel Veillard42595322004-11-08 10:52:06 +000023346 int mem_base;
23347 xmlAttributePtr ret_val;
23348 xmlValidCtxtPtr ctxt; /* the validation context */
23349 int n_ctxt;
23350 xmlDtdPtr dtd; /* pointer to the DTD */
23351 int n_dtd;
23352 xmlChar * elem; /* the element name */
23353 int n_elem;
23354 xmlChar * name; /* the attribute name */
23355 int n_name;
23356 xmlChar * ns; /* the attribute namespace prefix */
23357 int n_ns;
23358 xmlAttributeType type; /* the attribute type */
23359 int n_type;
23360 xmlAttributeDefault def; /* the attribute default type */
23361 int n_def;
23362 xmlChar * defaultValue; /* the attribute default value */
23363 int n_defaultValue;
23364 xmlEnumerationPtr tree; /* if it's an enumeration, the associated list */
23365 int n_tree;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023366
Daniel Veillard42595322004-11-08 10:52:06 +000023367 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
23368 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
23369 for (n_elem = 0;n_elem < gen_nb_const_xmlChar_ptr;n_elem++) {
23370 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
23371 for (n_ns = 0;n_ns < gen_nb_const_xmlChar_ptr;n_ns++) {
23372 for (n_type = 0;n_type < gen_nb_xmlAttributeType;n_type++) {
23373 for (n_def = 0;n_def < gen_nb_xmlAttributeDefault;n_def++) {
23374 for (n_defaultValue = 0;n_defaultValue < gen_nb_const_xmlChar_ptr;n_defaultValue++) {
23375 for (n_tree = 0;n_tree < gen_nb_xmlEnumerationPtr;n_tree++) {
23376 mem_base = xmlMemBlocks();
23377 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
23378 dtd = gen_xmlDtdPtr(n_dtd, 1);
23379 elem = gen_const_xmlChar_ptr(n_elem, 2);
23380 name = gen_const_xmlChar_ptr(n_name, 3);
23381 ns = gen_const_xmlChar_ptr(n_ns, 4);
23382 type = gen_xmlAttributeType(n_type, 5);
23383 def = gen_xmlAttributeDefault(n_def, 6);
23384 defaultValue = gen_const_xmlChar_ptr(n_defaultValue, 7);
23385 tree = gen_xmlEnumerationPtr(n_tree, 8);
23386
William M. Brackf13f77f2004-11-12 16:03:48 +000023387 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 +000023388 desret_xmlAttributePtr(ret_val);
23389 call_tests++;
23390 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
23391 des_xmlDtdPtr(n_dtd, dtd, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000023392 des_const_xmlChar_ptr(n_elem, (const xmlChar *)elem, 2);
23393 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 3);
23394 des_const_xmlChar_ptr(n_ns, (const xmlChar *)ns, 4);
Daniel Veillard42595322004-11-08 10:52:06 +000023395 des_xmlAttributeType(n_type, type, 5);
23396 des_xmlAttributeDefault(n_def, def, 6);
William M. Brackf13f77f2004-11-12 16:03:48 +000023397 des_const_xmlChar_ptr(n_defaultValue, (const xmlChar *)defaultValue, 7);
Daniel Veillard42595322004-11-08 10:52:06 +000023398 des_xmlEnumerationPtr(n_tree, tree, 8);
23399 xmlResetLastError();
23400 if (mem_base != xmlMemBlocks()) {
23401 printf("Leak of %d blocks found in xmlAddAttributeDecl",
23402 xmlMemBlocks() - mem_base);
23403 test_ret++;
23404 printf(" %d", n_ctxt);
23405 printf(" %d", n_dtd);
23406 printf(" %d", n_elem);
23407 printf(" %d", n_name);
23408 printf(" %d", n_ns);
23409 printf(" %d", n_type);
23410 printf(" %d", n_def);
23411 printf(" %d", n_defaultValue);
23412 printf(" %d", n_tree);
23413 printf("\n");
23414 }
23415 }
23416 }
23417 }
23418 }
23419 }
23420 }
23421 }
23422 }
23423 }
Daniel Veillard42595322004-11-08 10:52:06 +000023424 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023425
Daniel Veillard42595322004-11-08 10:52:06 +000023426 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023427}
23428
23429
23430static int
23431test_xmlAddElementDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023432 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023433
Daniel Veillard42595322004-11-08 10:52:06 +000023434 int mem_base;
23435 xmlElementPtr ret_val;
23436 xmlValidCtxtPtr ctxt; /* the validation context */
23437 int n_ctxt;
23438 xmlDtdPtr dtd; /* pointer to the DTD */
23439 int n_dtd;
23440 xmlChar * name; /* the entity name */
23441 int n_name;
23442 xmlElementTypeVal type; /* the element type */
23443 int n_type;
23444 xmlElementContentPtr content; /* the element content tree or NULL */
23445 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023446
Daniel Veillard42595322004-11-08 10:52:06 +000023447 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
23448 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
23449 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
23450 for (n_type = 0;n_type < gen_nb_xmlElementTypeVal;n_type++) {
23451 for (n_content = 0;n_content < gen_nb_xmlElementContentPtr;n_content++) {
23452 mem_base = xmlMemBlocks();
23453 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
23454 dtd = gen_xmlDtdPtr(n_dtd, 1);
23455 name = gen_const_xmlChar_ptr(n_name, 2);
23456 type = gen_xmlElementTypeVal(n_type, 3);
23457 content = gen_xmlElementContentPtr(n_content, 4);
23458
William M. Brackf13f77f2004-11-12 16:03:48 +000023459 ret_val = xmlAddElementDecl(ctxt, dtd, (const xmlChar *)name, type, content);
Daniel Veillard42595322004-11-08 10:52:06 +000023460 desret_xmlElementPtr(ret_val);
23461 call_tests++;
23462 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
23463 des_xmlDtdPtr(n_dtd, dtd, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000023464 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
Daniel Veillard42595322004-11-08 10:52:06 +000023465 des_xmlElementTypeVal(n_type, type, 3);
23466 des_xmlElementContentPtr(n_content, content, 4);
23467 xmlResetLastError();
23468 if (mem_base != xmlMemBlocks()) {
23469 printf("Leak of %d blocks found in xmlAddElementDecl",
23470 xmlMemBlocks() - mem_base);
23471 test_ret++;
23472 printf(" %d", n_ctxt);
23473 printf(" %d", n_dtd);
23474 printf(" %d", n_name);
23475 printf(" %d", n_type);
23476 printf(" %d", n_content);
23477 printf("\n");
23478 }
23479 }
23480 }
23481 }
23482 }
23483 }
Daniel Veillard42595322004-11-08 10:52:06 +000023484 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023485
Daniel Veillard42595322004-11-08 10:52:06 +000023486 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023487}
23488
23489
23490static int
23491test_xmlAddID(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023492 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023493
23494
23495 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023496 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023497}
23498
23499
23500static int
23501test_xmlAddNotationDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023502 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023503
23504
23505 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023506 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023507}
23508
23509
23510static int
23511test_xmlAddRef(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023512 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023513
23514
23515 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023516 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023517}
23518
23519
Daniel Veillardce682bc2004-11-05 17:22:25 +000023520#define gen_nb_xmlAttributeTablePtr 1
23521static xmlAttributeTablePtr gen_xmlAttributeTablePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23522 return(NULL);
23523}
23524static void des_xmlAttributeTablePtr(int no ATTRIBUTE_UNUSED, xmlAttributeTablePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23525}
23526
Daniel Veillardd93f6252004-11-02 15:53:51 +000023527static int
23528test_xmlCopyAttributeTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023529 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023530
23531
23532 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023533 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023534}
23535
23536
23537static int
23538test_xmlCopyElementContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023539 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023540
William M. Brack094dd862004-11-14 14:28:34 +000023541 int mem_base;
23542 xmlElementContentPtr ret_val;
23543 xmlElementContentPtr cur; /* An element content pointer. */
23544 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023545
William M. Brack094dd862004-11-14 14:28:34 +000023546 for (n_cur = 0;n_cur < gen_nb_xmlElementContentPtr;n_cur++) {
23547 mem_base = xmlMemBlocks();
23548 cur = gen_xmlElementContentPtr(n_cur, 0);
23549
23550 ret_val = xmlCopyElementContent(cur);
23551 desret_xmlElementContentPtr(ret_val);
23552 call_tests++;
23553 des_xmlElementContentPtr(n_cur, cur, 0);
23554 xmlResetLastError();
23555 if (mem_base != xmlMemBlocks()) {
23556 printf("Leak of %d blocks found in xmlCopyElementContent",
23557 xmlMemBlocks() - mem_base);
23558 test_ret++;
23559 printf(" %d", n_cur);
23560 printf("\n");
23561 }
23562 }
23563 function_tests++;
23564
Daniel Veillard42595322004-11-08 10:52:06 +000023565 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023566}
23567
23568
Daniel Veillardce682bc2004-11-05 17:22:25 +000023569#define gen_nb_xmlElementTablePtr 1
23570static xmlElementTablePtr gen_xmlElementTablePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23571 return(NULL);
23572}
23573static void des_xmlElementTablePtr(int no ATTRIBUTE_UNUSED, xmlElementTablePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23574}
23575
Daniel Veillardd93f6252004-11-02 15:53:51 +000023576static int
23577test_xmlCopyElementTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023578 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023579
23580
23581 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023582 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023583}
23584
23585
23586static int
23587test_xmlCopyEnumeration(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023588 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023589
23590
23591 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023592 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023593}
23594
23595
Daniel Veillardce682bc2004-11-05 17:22:25 +000023596#define gen_nb_xmlNotationTablePtr 1
23597static xmlNotationTablePtr gen_xmlNotationTablePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23598 return(NULL);
23599}
23600static void des_xmlNotationTablePtr(int no ATTRIBUTE_UNUSED, xmlNotationTablePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23601}
23602
Daniel Veillardd93f6252004-11-02 15:53:51 +000023603static int
23604test_xmlCopyNotationTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023605 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023606
23607
23608 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023609 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023610}
23611
23612
23613static int
23614test_xmlCreateEnumeration(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023615 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023616
23617
23618 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023619 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023620}
23621
23622
Daniel Veillardce682bc2004-11-05 17:22:25 +000023623#define gen_nb_xmlAttributePtr 1
23624static xmlAttributePtr gen_xmlAttributePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23625 return(NULL);
23626}
23627static void des_xmlAttributePtr(int no ATTRIBUTE_UNUSED, xmlAttributePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23628}
23629
Daniel Veillardd93f6252004-11-02 15:53:51 +000023630static int
23631test_xmlDumpAttributeDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023632 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023633
Daniel Veillardce682bc2004-11-05 17:22:25 +000023634#ifdef LIBXML_OUTPUT_ENABLED
23635 int mem_base;
23636 xmlBufferPtr buf; /* the XML buffer output */
23637 int n_buf;
23638 xmlAttributePtr attr; /* An attribute declaration */
23639 int n_attr;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023640
Daniel Veillardce682bc2004-11-05 17:22:25 +000023641 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
23642 for (n_attr = 0;n_attr < gen_nb_xmlAttributePtr;n_attr++) {
23643 mem_base = xmlMemBlocks();
23644 buf = gen_xmlBufferPtr(n_buf, 0);
23645 attr = gen_xmlAttributePtr(n_attr, 1);
23646
23647 xmlDumpAttributeDecl(buf, attr);
23648 call_tests++;
23649 des_xmlBufferPtr(n_buf, buf, 0);
23650 des_xmlAttributePtr(n_attr, attr, 1);
23651 xmlResetLastError();
23652 if (mem_base != xmlMemBlocks()) {
23653 printf("Leak of %d blocks found in xmlDumpAttributeDecl",
23654 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023655 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023656 printf(" %d", n_buf);
23657 printf(" %d", n_attr);
23658 printf("\n");
23659 }
23660 }
23661 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023662 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023663#endif
23664
Daniel Veillard42595322004-11-08 10:52:06 +000023665 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023666}
23667
23668
23669static int
23670test_xmlDumpAttributeTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023671 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023672
Daniel Veillardce682bc2004-11-05 17:22:25 +000023673#ifdef LIBXML_OUTPUT_ENABLED
23674 int mem_base;
23675 xmlBufferPtr buf; /* the XML buffer output */
23676 int n_buf;
23677 xmlAttributeTablePtr table; /* An attribute table */
23678 int n_table;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023679
Daniel Veillardce682bc2004-11-05 17:22:25 +000023680 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
23681 for (n_table = 0;n_table < gen_nb_xmlAttributeTablePtr;n_table++) {
23682 mem_base = xmlMemBlocks();
23683 buf = gen_xmlBufferPtr(n_buf, 0);
23684 table = gen_xmlAttributeTablePtr(n_table, 1);
23685
23686 xmlDumpAttributeTable(buf, table);
23687 call_tests++;
23688 des_xmlBufferPtr(n_buf, buf, 0);
23689 des_xmlAttributeTablePtr(n_table, table, 1);
23690 xmlResetLastError();
23691 if (mem_base != xmlMemBlocks()) {
23692 printf("Leak of %d blocks found in xmlDumpAttributeTable",
23693 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023694 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023695 printf(" %d", n_buf);
23696 printf(" %d", n_table);
23697 printf("\n");
23698 }
23699 }
23700 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023701 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023702#endif
23703
Daniel Veillard42595322004-11-08 10:52:06 +000023704 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023705}
23706
23707
Daniel Veillardce682bc2004-11-05 17:22:25 +000023708#define gen_nb_xmlElementPtr 1
23709static xmlElementPtr gen_xmlElementPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23710 return(NULL);
23711}
23712static void des_xmlElementPtr(int no ATTRIBUTE_UNUSED, xmlElementPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23713}
23714
Daniel Veillardd93f6252004-11-02 15:53:51 +000023715static int
23716test_xmlDumpElementDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023717 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023718
Daniel Veillardce682bc2004-11-05 17:22:25 +000023719#ifdef LIBXML_OUTPUT_ENABLED
23720 int mem_base;
23721 xmlBufferPtr buf; /* the XML buffer output */
23722 int n_buf;
23723 xmlElementPtr elem; /* An element table */
23724 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023725
Daniel Veillardce682bc2004-11-05 17:22:25 +000023726 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
23727 for (n_elem = 0;n_elem < gen_nb_xmlElementPtr;n_elem++) {
23728 mem_base = xmlMemBlocks();
23729 buf = gen_xmlBufferPtr(n_buf, 0);
23730 elem = gen_xmlElementPtr(n_elem, 1);
23731
23732 xmlDumpElementDecl(buf, elem);
23733 call_tests++;
23734 des_xmlBufferPtr(n_buf, buf, 0);
23735 des_xmlElementPtr(n_elem, elem, 1);
23736 xmlResetLastError();
23737 if (mem_base != xmlMemBlocks()) {
23738 printf("Leak of %d blocks found in xmlDumpElementDecl",
23739 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023740 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023741 printf(" %d", n_buf);
23742 printf(" %d", n_elem);
23743 printf("\n");
23744 }
23745 }
23746 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023747 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023748#endif
23749
Daniel Veillard42595322004-11-08 10:52:06 +000023750 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023751}
23752
23753
23754static int
23755test_xmlDumpElementTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023756 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023757
Daniel Veillardce682bc2004-11-05 17:22:25 +000023758#ifdef LIBXML_OUTPUT_ENABLED
23759 int mem_base;
23760 xmlBufferPtr buf; /* the XML buffer output */
23761 int n_buf;
23762 xmlElementTablePtr table; /* An element table */
23763 int n_table;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023764
Daniel Veillardce682bc2004-11-05 17:22:25 +000023765 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
23766 for (n_table = 0;n_table < gen_nb_xmlElementTablePtr;n_table++) {
23767 mem_base = xmlMemBlocks();
23768 buf = gen_xmlBufferPtr(n_buf, 0);
23769 table = gen_xmlElementTablePtr(n_table, 1);
23770
23771 xmlDumpElementTable(buf, table);
23772 call_tests++;
23773 des_xmlBufferPtr(n_buf, buf, 0);
23774 des_xmlElementTablePtr(n_table, table, 1);
23775 xmlResetLastError();
23776 if (mem_base != xmlMemBlocks()) {
23777 printf("Leak of %d blocks found in xmlDumpElementTable",
23778 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023779 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023780 printf(" %d", n_buf);
23781 printf(" %d", n_table);
23782 printf("\n");
23783 }
23784 }
23785 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023786 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023787#endif
23788
Daniel Veillard42595322004-11-08 10:52:06 +000023789 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023790}
23791
23792
Daniel Veillardce682bc2004-11-05 17:22:25 +000023793#define gen_nb_xmlNotationPtr 1
23794static xmlNotationPtr gen_xmlNotationPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23795 return(NULL);
23796}
23797static void des_xmlNotationPtr(int no ATTRIBUTE_UNUSED, xmlNotationPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23798}
23799
Daniel Veillardd93f6252004-11-02 15:53:51 +000023800static int
23801test_xmlDumpNotationDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023802 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023803
Daniel Veillardce682bc2004-11-05 17:22:25 +000023804#ifdef LIBXML_OUTPUT_ENABLED
23805 int mem_base;
23806 xmlBufferPtr buf; /* the XML buffer output */
23807 int n_buf;
23808 xmlNotationPtr nota; /* A notation declaration */
23809 int n_nota;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023810
Daniel Veillardce682bc2004-11-05 17:22:25 +000023811 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
23812 for (n_nota = 0;n_nota < gen_nb_xmlNotationPtr;n_nota++) {
23813 mem_base = xmlMemBlocks();
23814 buf = gen_xmlBufferPtr(n_buf, 0);
23815 nota = gen_xmlNotationPtr(n_nota, 1);
23816
23817 xmlDumpNotationDecl(buf, nota);
23818 call_tests++;
23819 des_xmlBufferPtr(n_buf, buf, 0);
23820 des_xmlNotationPtr(n_nota, nota, 1);
23821 xmlResetLastError();
23822 if (mem_base != xmlMemBlocks()) {
23823 printf("Leak of %d blocks found in xmlDumpNotationDecl",
23824 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023825 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023826 printf(" %d", n_buf);
23827 printf(" %d", n_nota);
23828 printf("\n");
23829 }
23830 }
23831 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023832 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023833#endif
23834
Daniel Veillard42595322004-11-08 10:52:06 +000023835 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023836}
23837
23838
23839static int
23840test_xmlDumpNotationTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023841 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023842
Daniel Veillardce682bc2004-11-05 17:22:25 +000023843#ifdef LIBXML_OUTPUT_ENABLED
23844 int mem_base;
23845 xmlBufferPtr buf; /* the XML buffer output */
23846 int n_buf;
23847 xmlNotationTablePtr table; /* A notation table */
23848 int n_table;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023849
Daniel Veillardce682bc2004-11-05 17:22:25 +000023850 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
23851 for (n_table = 0;n_table < gen_nb_xmlNotationTablePtr;n_table++) {
23852 mem_base = xmlMemBlocks();
23853 buf = gen_xmlBufferPtr(n_buf, 0);
23854 table = gen_xmlNotationTablePtr(n_table, 1);
23855
23856 xmlDumpNotationTable(buf, table);
23857 call_tests++;
23858 des_xmlBufferPtr(n_buf, buf, 0);
23859 des_xmlNotationTablePtr(n_table, table, 1);
23860 xmlResetLastError();
23861 if (mem_base != xmlMemBlocks()) {
23862 printf("Leak of %d blocks found in xmlDumpNotationTable",
23863 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023864 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023865 printf(" %d", n_buf);
23866 printf(" %d", n_table);
23867 printf("\n");
23868 }
23869 }
23870 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023871 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023872#endif
23873
Daniel Veillard42595322004-11-08 10:52:06 +000023874 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023875}
23876
23877
23878static int
23879test_xmlGetDtdAttrDesc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023880 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023881
Daniel Veillard42595322004-11-08 10:52:06 +000023882 int mem_base;
23883 xmlAttributePtr ret_val;
23884 xmlDtdPtr dtd; /* a pointer to the DtD to search */
23885 int n_dtd;
23886 xmlChar * elem; /* the element name */
23887 int n_elem;
23888 xmlChar * name; /* the attribute name */
23889 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023890
Daniel Veillard42595322004-11-08 10:52:06 +000023891 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
23892 for (n_elem = 0;n_elem < gen_nb_const_xmlChar_ptr;n_elem++) {
23893 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
23894 mem_base = xmlMemBlocks();
23895 dtd = gen_xmlDtdPtr(n_dtd, 0);
23896 elem = gen_const_xmlChar_ptr(n_elem, 1);
23897 name = gen_const_xmlChar_ptr(n_name, 2);
23898
William M. Brackf13f77f2004-11-12 16:03:48 +000023899 ret_val = xmlGetDtdAttrDesc(dtd, (const xmlChar *)elem, (const xmlChar *)name);
Daniel Veillard42595322004-11-08 10:52:06 +000023900 desret_xmlAttributePtr(ret_val);
23901 call_tests++;
23902 des_xmlDtdPtr(n_dtd, dtd, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000023903 des_const_xmlChar_ptr(n_elem, (const xmlChar *)elem, 1);
23904 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
Daniel Veillard42595322004-11-08 10:52:06 +000023905 xmlResetLastError();
23906 if (mem_base != xmlMemBlocks()) {
23907 printf("Leak of %d blocks found in xmlGetDtdAttrDesc",
23908 xmlMemBlocks() - mem_base);
23909 test_ret++;
23910 printf(" %d", n_dtd);
23911 printf(" %d", n_elem);
23912 printf(" %d", n_name);
23913 printf("\n");
23914 }
23915 }
23916 }
23917 }
Daniel Veillard42595322004-11-08 10:52:06 +000023918 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023919
Daniel Veillard42595322004-11-08 10:52:06 +000023920 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023921}
23922
23923
23924static int
23925test_xmlGetDtdElementDesc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023926 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023927
Daniel Veillard42595322004-11-08 10:52:06 +000023928 int mem_base;
23929 xmlElementPtr ret_val;
23930 xmlDtdPtr dtd; /* a pointer to the DtD to search */
23931 int n_dtd;
23932 xmlChar * name; /* the element name */
23933 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023934
Daniel Veillard42595322004-11-08 10:52:06 +000023935 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
23936 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
23937 mem_base = xmlMemBlocks();
23938 dtd = gen_xmlDtdPtr(n_dtd, 0);
23939 name = gen_const_xmlChar_ptr(n_name, 1);
23940
William M. Brackf13f77f2004-11-12 16:03:48 +000023941 ret_val = xmlGetDtdElementDesc(dtd, (const xmlChar *)name);
Daniel Veillard42595322004-11-08 10:52:06 +000023942 desret_xmlElementPtr(ret_val);
23943 call_tests++;
23944 des_xmlDtdPtr(n_dtd, dtd, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000023945 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard42595322004-11-08 10:52:06 +000023946 xmlResetLastError();
23947 if (mem_base != xmlMemBlocks()) {
23948 printf("Leak of %d blocks found in xmlGetDtdElementDesc",
23949 xmlMemBlocks() - mem_base);
23950 test_ret++;
23951 printf(" %d", n_dtd);
23952 printf(" %d", n_name);
23953 printf("\n");
23954 }
23955 }
23956 }
Daniel Veillard42595322004-11-08 10:52:06 +000023957 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023958
Daniel Veillard42595322004-11-08 10:52:06 +000023959 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023960}
23961
23962
23963static int
23964test_xmlGetDtdNotationDesc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023965 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023966
23967
23968 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023969 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023970}
23971
23972
23973static int
23974test_xmlGetDtdQAttrDesc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023975 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023976
Daniel Veillard42595322004-11-08 10:52:06 +000023977 int mem_base;
23978 xmlAttributePtr ret_val;
23979 xmlDtdPtr dtd; /* a pointer to the DtD to search */
23980 int n_dtd;
23981 xmlChar * elem; /* the element name */
23982 int n_elem;
23983 xmlChar * name; /* the attribute name */
23984 int n_name;
23985 xmlChar * prefix; /* the attribute namespace prefix */
23986 int n_prefix;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023987
Daniel Veillard42595322004-11-08 10:52:06 +000023988 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
23989 for (n_elem = 0;n_elem < gen_nb_const_xmlChar_ptr;n_elem++) {
23990 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
23991 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
23992 mem_base = xmlMemBlocks();
23993 dtd = gen_xmlDtdPtr(n_dtd, 0);
23994 elem = gen_const_xmlChar_ptr(n_elem, 1);
23995 name = gen_const_xmlChar_ptr(n_name, 2);
23996 prefix = gen_const_xmlChar_ptr(n_prefix, 3);
23997
William M. Brackf13f77f2004-11-12 16:03:48 +000023998 ret_val = xmlGetDtdQAttrDesc(dtd, (const xmlChar *)elem, (const xmlChar *)name, (const xmlChar *)prefix);
Daniel Veillard42595322004-11-08 10:52:06 +000023999 desret_xmlAttributePtr(ret_val);
24000 call_tests++;
24001 des_xmlDtdPtr(n_dtd, dtd, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000024002 des_const_xmlChar_ptr(n_elem, (const xmlChar *)elem, 1);
24003 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
24004 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 3);
Daniel Veillard42595322004-11-08 10:52:06 +000024005 xmlResetLastError();
24006 if (mem_base != xmlMemBlocks()) {
24007 printf("Leak of %d blocks found in xmlGetDtdQAttrDesc",
24008 xmlMemBlocks() - mem_base);
24009 test_ret++;
24010 printf(" %d", n_dtd);
24011 printf(" %d", n_elem);
24012 printf(" %d", n_name);
24013 printf(" %d", n_prefix);
24014 printf("\n");
24015 }
24016 }
24017 }
24018 }
24019 }
Daniel Veillard42595322004-11-08 10:52:06 +000024020 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024021
Daniel Veillard42595322004-11-08 10:52:06 +000024022 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024023}
24024
24025
24026static int
24027test_xmlGetDtdQElementDesc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024028 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024029
Daniel Veillard42595322004-11-08 10:52:06 +000024030 int mem_base;
24031 xmlElementPtr ret_val;
24032 xmlDtdPtr dtd; /* a pointer to the DtD to search */
24033 int n_dtd;
24034 xmlChar * name; /* the element name */
24035 int n_name;
24036 xmlChar * prefix; /* the element namespace prefix */
24037 int n_prefix;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024038
Daniel Veillard42595322004-11-08 10:52:06 +000024039 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
24040 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24041 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
24042 mem_base = xmlMemBlocks();
24043 dtd = gen_xmlDtdPtr(n_dtd, 0);
24044 name = gen_const_xmlChar_ptr(n_name, 1);
24045 prefix = gen_const_xmlChar_ptr(n_prefix, 2);
24046
William M. Brackf13f77f2004-11-12 16:03:48 +000024047 ret_val = xmlGetDtdQElementDesc(dtd, (const xmlChar *)name, (const xmlChar *)prefix);
Daniel Veillard42595322004-11-08 10:52:06 +000024048 desret_xmlElementPtr(ret_val);
24049 call_tests++;
24050 des_xmlDtdPtr(n_dtd, dtd, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000024051 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
24052 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 2);
Daniel Veillard42595322004-11-08 10:52:06 +000024053 xmlResetLastError();
24054 if (mem_base != xmlMemBlocks()) {
24055 printf("Leak of %d blocks found in xmlGetDtdQElementDesc",
24056 xmlMemBlocks() - mem_base);
24057 test_ret++;
24058 printf(" %d", n_dtd);
24059 printf(" %d", n_name);
24060 printf(" %d", n_prefix);
24061 printf("\n");
24062 }
24063 }
24064 }
24065 }
Daniel Veillard42595322004-11-08 10:52:06 +000024066 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024067
Daniel Veillard42595322004-11-08 10:52:06 +000024068 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024069}
24070
24071
24072static int
24073test_xmlGetID(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024074 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024075
Daniel Veillard57b25162004-11-06 14:50:18 +000024076 int mem_base;
24077 xmlAttrPtr ret_val;
24078 xmlDocPtr doc; /* pointer to the document */
24079 int n_doc;
24080 xmlChar * ID; /* the ID value */
24081 int n_ID;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024082
Daniel Veillard57b25162004-11-06 14:50:18 +000024083 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24084 for (n_ID = 0;n_ID < gen_nb_const_xmlChar_ptr;n_ID++) {
24085 mem_base = xmlMemBlocks();
24086 doc = gen_xmlDocPtr(n_doc, 0);
24087 ID = gen_const_xmlChar_ptr(n_ID, 1);
24088
William M. Brackf13f77f2004-11-12 16:03:48 +000024089 ret_val = xmlGetID(doc, (const xmlChar *)ID);
Daniel Veillard57b25162004-11-06 14:50:18 +000024090 desret_xmlAttrPtr(ret_val);
24091 call_tests++;
24092 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000024093 des_const_xmlChar_ptr(n_ID, (const xmlChar *)ID, 1);
Daniel Veillard57b25162004-11-06 14:50:18 +000024094 xmlResetLastError();
24095 if (mem_base != xmlMemBlocks()) {
24096 printf("Leak of %d blocks found in xmlGetID",
24097 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024098 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000024099 printf(" %d", n_doc);
24100 printf(" %d", n_ID);
24101 printf("\n");
24102 }
24103 }
24104 }
Daniel Veillard57b25162004-11-06 14:50:18 +000024105 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024106
Daniel Veillard42595322004-11-08 10:52:06 +000024107 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024108}
24109
24110
24111static int
24112test_xmlGetRefs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024113 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024114
24115
24116 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000024117 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024118}
24119
24120
24121static int
24122test_xmlIsID(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024123 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024124
Daniel Veillardce244ad2004-11-05 10:03:46 +000024125 int mem_base;
24126 int ret_val;
24127 xmlDocPtr doc; /* the document */
24128 int n_doc;
24129 xmlNodePtr elem; /* the element carrying the attribute */
24130 int n_elem;
24131 xmlAttrPtr attr; /* the attribute */
24132 int n_attr;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024133
Daniel Veillardce244ad2004-11-05 10:03:46 +000024134 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24135 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
24136 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
24137 mem_base = xmlMemBlocks();
24138 doc = gen_xmlDocPtr(n_doc, 0);
24139 elem = gen_xmlNodePtr(n_elem, 1);
24140 attr = gen_xmlAttrPtr(n_attr, 2);
24141
24142 ret_val = xmlIsID(doc, elem, attr);
24143 desret_int(ret_val);
24144 call_tests++;
24145 des_xmlDocPtr(n_doc, doc, 0);
24146 des_xmlNodePtr(n_elem, elem, 1);
24147 des_xmlAttrPtr(n_attr, attr, 2);
24148 xmlResetLastError();
24149 if (mem_base != xmlMemBlocks()) {
24150 printf("Leak of %d blocks found in xmlIsID",
24151 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024152 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000024153 printf(" %d", n_doc);
24154 printf(" %d", n_elem);
24155 printf(" %d", n_attr);
24156 printf("\n");
24157 }
24158 }
24159 }
24160 }
Daniel Veillardce244ad2004-11-05 10:03:46 +000024161 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024162
Daniel Veillard42595322004-11-08 10:52:06 +000024163 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024164}
24165
24166
24167static int
24168test_xmlIsMixedElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024169 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024170
24171 int mem_base;
24172 int ret_val;
24173 xmlDocPtr doc; /* the document */
24174 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024175 xmlChar * name; /* the element name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000024176 int n_name;
24177
24178 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24179 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24180 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000024181 doc = gen_xmlDocPtr(n_doc, 0);
24182 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024183
William M. Brackf13f77f2004-11-12 16:03:48 +000024184 ret_val = xmlIsMixedElement(doc, (const xmlChar *)name);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024185 desret_int(ret_val);
24186 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000024187 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000024188 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024189 xmlResetLastError();
24190 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000024191 printf("Leak of %d blocks found in xmlIsMixedElement",
Daniel Veillardd93f6252004-11-02 15:53:51 +000024192 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024193 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000024194 printf(" %d", n_doc);
24195 printf(" %d", n_name);
24196 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000024197 }
24198 }
24199 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000024200 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024201
Daniel Veillard42595322004-11-08 10:52:06 +000024202 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024203}
24204
24205
24206static int
24207test_xmlIsRef(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024208 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024209
Daniel Veillardce244ad2004-11-05 10:03:46 +000024210 int mem_base;
24211 int ret_val;
24212 xmlDocPtr doc; /* the document */
24213 int n_doc;
24214 xmlNodePtr elem; /* the element carrying the attribute */
24215 int n_elem;
24216 xmlAttrPtr attr; /* the attribute */
24217 int n_attr;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024218
Daniel Veillardce244ad2004-11-05 10:03:46 +000024219 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24220 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
24221 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
24222 mem_base = xmlMemBlocks();
24223 doc = gen_xmlDocPtr(n_doc, 0);
24224 elem = gen_xmlNodePtr(n_elem, 1);
24225 attr = gen_xmlAttrPtr(n_attr, 2);
24226
24227 ret_val = xmlIsRef(doc, elem, attr);
24228 desret_int(ret_val);
24229 call_tests++;
24230 des_xmlDocPtr(n_doc, doc, 0);
24231 des_xmlNodePtr(n_elem, elem, 1);
24232 des_xmlAttrPtr(n_attr, attr, 2);
24233 xmlResetLastError();
24234 if (mem_base != xmlMemBlocks()) {
24235 printf("Leak of %d blocks found in xmlIsRef",
24236 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024237 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000024238 printf(" %d", n_doc);
24239 printf(" %d", n_elem);
24240 printf(" %d", n_attr);
24241 printf("\n");
24242 }
24243 }
24244 }
24245 }
Daniel Veillardce244ad2004-11-05 10:03:46 +000024246 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024247
Daniel Veillard42595322004-11-08 10:52:06 +000024248 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024249}
24250
24251
24252static int
24253test_xmlNewElementContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024254 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024255
William M. Brack094dd862004-11-14 14:28:34 +000024256 int mem_base;
24257 xmlElementContentPtr ret_val;
24258 xmlChar * name; /* the subelement name or NULL */
24259 int n_name;
24260 xmlElementContentType type; /* the type of element content decl */
24261 int n_type;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024262
William M. Brack094dd862004-11-14 14:28:34 +000024263 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24264 for (n_type = 0;n_type < gen_nb_xmlElementContentType;n_type++) {
24265 mem_base = xmlMemBlocks();
24266 name = gen_const_xmlChar_ptr(n_name, 0);
24267 type = gen_xmlElementContentType(n_type, 1);
24268
24269 ret_val = xmlNewElementContent((const xmlChar *)name, type);
24270 desret_xmlElementContentPtr(ret_val);
24271 call_tests++;
24272 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
24273 des_xmlElementContentType(n_type, type, 1);
24274 xmlResetLastError();
24275 if (mem_base != xmlMemBlocks()) {
24276 printf("Leak of %d blocks found in xmlNewElementContent",
24277 xmlMemBlocks() - mem_base);
24278 test_ret++;
24279 printf(" %d", n_name);
24280 printf(" %d", n_type);
24281 printf("\n");
24282 }
24283 }
24284 }
24285 function_tests++;
24286
Daniel Veillard42595322004-11-08 10:52:06 +000024287 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024288}
24289
24290
24291static int
24292test_xmlNewValidCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024293 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024294
24295
24296 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000024297 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024298}
24299
24300
24301static int
24302test_xmlRemoveID(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024303 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024304
Daniel Veillardce244ad2004-11-05 10:03:46 +000024305 int mem_base;
24306 int ret_val;
24307 xmlDocPtr doc; /* the document */
24308 int n_doc;
24309 xmlAttrPtr attr; /* the attribute */
24310 int n_attr;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024311
Daniel Veillardce244ad2004-11-05 10:03:46 +000024312 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24313 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
24314 mem_base = xmlMemBlocks();
24315 doc = gen_xmlDocPtr(n_doc, 0);
24316 attr = gen_xmlAttrPtr(n_attr, 1);
24317
24318 ret_val = xmlRemoveID(doc, attr);
24319 desret_int(ret_val);
24320 call_tests++;
24321 des_xmlDocPtr(n_doc, doc, 0);
24322 des_xmlAttrPtr(n_attr, attr, 1);
24323 xmlResetLastError();
24324 if (mem_base != xmlMemBlocks()) {
24325 printf("Leak of %d blocks found in xmlRemoveID",
24326 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024327 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000024328 printf(" %d", n_doc);
24329 printf(" %d", n_attr);
24330 printf("\n");
24331 }
24332 }
24333 }
Daniel Veillardce244ad2004-11-05 10:03:46 +000024334 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024335
Daniel Veillard42595322004-11-08 10:52:06 +000024336 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024337}
24338
24339
24340static int
24341test_xmlRemoveRef(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024342 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024343
Daniel Veillardce244ad2004-11-05 10:03:46 +000024344 int mem_base;
24345 int ret_val;
24346 xmlDocPtr doc; /* the document */
24347 int n_doc;
24348 xmlAttrPtr attr; /* the attribute */
24349 int n_attr;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024350
Daniel Veillardce244ad2004-11-05 10:03:46 +000024351 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24352 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
24353 mem_base = xmlMemBlocks();
24354 doc = gen_xmlDocPtr(n_doc, 0);
24355 attr = gen_xmlAttrPtr(n_attr, 1);
24356
24357 ret_val = xmlRemoveRef(doc, attr);
24358 desret_int(ret_val);
24359 call_tests++;
24360 des_xmlDocPtr(n_doc, doc, 0);
24361 des_xmlAttrPtr(n_attr, attr, 1);
24362 xmlResetLastError();
24363 if (mem_base != xmlMemBlocks()) {
24364 printf("Leak of %d blocks found in xmlRemoveRef",
24365 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024366 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000024367 printf(" %d", n_doc);
24368 printf(" %d", n_attr);
24369 printf("\n");
24370 }
24371 }
24372 }
Daniel Veillardce244ad2004-11-05 10:03:46 +000024373 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024374
Daniel Veillard42595322004-11-08 10:52:06 +000024375 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024376}
24377
24378
24379static int
24380test_xmlSnprintfElementContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024381 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024382
Daniel Veillardce682bc2004-11-05 17:22:25 +000024383 int mem_base;
24384 char * buf; /* an output buffer */
24385 int n_buf;
24386 int size; /* the buffer size */
24387 int n_size;
24388 xmlElementContentPtr content; /* An element table */
24389 int n_content;
24390 int glob; /* 1 if one must print the englobing parenthesis, 0 otherwise */
24391 int n_glob;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024392
Daniel Veillardce682bc2004-11-05 17:22:25 +000024393 for (n_buf = 0;n_buf < gen_nb_char_ptr;n_buf++) {
24394 for (n_size = 0;n_size < gen_nb_int;n_size++) {
24395 for (n_content = 0;n_content < gen_nb_xmlElementContentPtr;n_content++) {
24396 for (n_glob = 0;n_glob < gen_nb_int;n_glob++) {
24397 mem_base = xmlMemBlocks();
24398 buf = gen_char_ptr(n_buf, 0);
24399 size = gen_int(n_size, 1);
24400 content = gen_xmlElementContentPtr(n_content, 2);
24401 glob = gen_int(n_glob, 3);
24402
24403 xmlSnprintfElementContent(buf, size, content, glob);
24404 call_tests++;
24405 des_char_ptr(n_buf, buf, 0);
24406 des_int(n_size, size, 1);
24407 des_xmlElementContentPtr(n_content, content, 2);
24408 des_int(n_glob, glob, 3);
24409 xmlResetLastError();
24410 if (mem_base != xmlMemBlocks()) {
24411 printf("Leak of %d blocks found in xmlSnprintfElementContent",
24412 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024413 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024414 printf(" %d", n_buf);
24415 printf(" %d", n_size);
24416 printf(" %d", n_content);
24417 printf(" %d", n_glob);
24418 printf("\n");
24419 }
24420 }
24421 }
24422 }
24423 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000024424 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024425
Daniel Veillard42595322004-11-08 10:52:06 +000024426 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024427}
24428
24429
24430static int
24431test_xmlSprintfElementContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024432 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024433
Daniel Veillarda521d282004-11-09 14:59:59 +000024434#ifdef LIBXML_OUTPUT_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000024435 int mem_base;
24436 char * buf; /* an output buffer */
24437 int n_buf;
24438 xmlElementContentPtr content; /* An element table */
24439 int n_content;
24440 int glob; /* 1 if one must print the englobing parenthesis, 0 otherwise */
24441 int n_glob;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024442
Daniel Veillardce682bc2004-11-05 17:22:25 +000024443 for (n_buf = 0;n_buf < gen_nb_char_ptr;n_buf++) {
24444 for (n_content = 0;n_content < gen_nb_xmlElementContentPtr;n_content++) {
24445 for (n_glob = 0;n_glob < gen_nb_int;n_glob++) {
24446 mem_base = xmlMemBlocks();
24447 buf = gen_char_ptr(n_buf, 0);
24448 content = gen_xmlElementContentPtr(n_content, 1);
24449 glob = gen_int(n_glob, 2);
24450
24451 xmlSprintfElementContent(buf, content, glob);
24452 call_tests++;
24453 des_char_ptr(n_buf, buf, 0);
24454 des_xmlElementContentPtr(n_content, content, 1);
24455 des_int(n_glob, glob, 2);
24456 xmlResetLastError();
24457 if (mem_base != xmlMemBlocks()) {
24458 printf("Leak of %d blocks found in xmlSprintfElementContent",
24459 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024460 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024461 printf(" %d", n_buf);
24462 printf(" %d", n_content);
24463 printf(" %d", n_glob);
24464 printf("\n");
24465 }
24466 }
24467 }
24468 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024469 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000024470#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +000024471
Daniel Veillard42595322004-11-08 10:52:06 +000024472 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024473}
24474
24475
24476static int
24477test_xmlValidBuildContentModel(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024478 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024479
Daniel Veillardce682bc2004-11-05 17:22:25 +000024480#ifdef LIBXML_REGEXP_ENABLED
24481 int mem_base;
24482 int ret_val;
24483 xmlValidCtxtPtr ctxt; /* a validation context */
24484 int n_ctxt;
24485 xmlElementPtr elem; /* an element declaration node */
24486 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024487
Daniel Veillardce682bc2004-11-05 17:22:25 +000024488 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
24489 for (n_elem = 0;n_elem < gen_nb_xmlElementPtr;n_elem++) {
24490 mem_base = xmlMemBlocks();
24491 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
24492 elem = gen_xmlElementPtr(n_elem, 1);
24493
24494 ret_val = xmlValidBuildContentModel(ctxt, elem);
24495 desret_int(ret_val);
24496 call_tests++;
24497 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
24498 des_xmlElementPtr(n_elem, elem, 1);
24499 xmlResetLastError();
24500 if (mem_base != xmlMemBlocks()) {
24501 printf("Leak of %d blocks found in xmlValidBuildContentModel",
24502 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024503 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024504 printf(" %d", n_ctxt);
24505 printf(" %d", n_elem);
24506 printf("\n");
24507 }
24508 }
24509 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024510 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024511#endif
24512
Daniel Veillard42595322004-11-08 10:52:06 +000024513 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024514}
24515
24516
24517static int
24518test_xmlValidCtxtNormalizeAttributeValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024519 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024520
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024521#ifdef LIBXML_VALID_ENABLED
24522 int mem_base;
24523 xmlChar * ret_val;
24524 xmlValidCtxtPtr ctxt; /* the validation context or NULL */
24525 int n_ctxt;
24526 xmlDocPtr doc; /* the document */
24527 int n_doc;
24528 xmlNodePtr elem; /* the parent */
24529 int n_elem;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024530 xmlChar * name; /* the attribute name */
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024531 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024532 xmlChar * value; /* the attribute value */
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024533 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024534
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024535 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
24536 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24537 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
24538 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24539 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
24540 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000024541 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
24542 doc = gen_xmlDocPtr(n_doc, 1);
24543 elem = gen_xmlNodePtr(n_elem, 2);
24544 name = gen_const_xmlChar_ptr(n_name, 3);
24545 value = gen_const_xmlChar_ptr(n_value, 4);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024546
William M. Brackf13f77f2004-11-12 16:03:48 +000024547 ret_val = xmlValidCtxtNormalizeAttributeValue(ctxt, doc, elem, (const xmlChar *)name, (const xmlChar *)value);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024548 desret_xmlChar_ptr(ret_val);
24549 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000024550 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
24551 des_xmlDocPtr(n_doc, doc, 1);
24552 des_xmlNodePtr(n_elem, elem, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000024553 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 3);
24554 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 4);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024555 xmlResetLastError();
24556 if (mem_base != xmlMemBlocks()) {
24557 printf("Leak of %d blocks found in xmlValidCtxtNormalizeAttributeValue",
24558 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024559 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024560 printf(" %d", n_ctxt);
24561 printf(" %d", n_doc);
24562 printf(" %d", n_elem);
24563 printf(" %d", n_name);
24564 printf(" %d", n_value);
24565 printf("\n");
24566 }
24567 }
24568 }
24569 }
24570 }
24571 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024572 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024573#endif
24574
Daniel Veillard42595322004-11-08 10:52:06 +000024575 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024576}
24577
24578
Daniel Veillardce682bc2004-11-05 17:22:25 +000024579#define gen_nb_xmlElementContent_ptr 1
24580static xmlElementContent * gen_xmlElementContent_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
24581 return(NULL);
24582}
24583static void des_xmlElementContent_ptr(int no ATTRIBUTE_UNUSED, xmlElementContent * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
24584}
24585
Daniel Veillardd93f6252004-11-02 15:53:51 +000024586static int
24587test_xmlValidGetPotentialChildren(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024588 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024589
Daniel Veillarda521d282004-11-09 14:59:59 +000024590#ifdef LIBXML_VALID_ENABLED
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024591 int mem_base;
24592 int ret_val;
24593 xmlElementContent * ctree; /* an element content tree */
24594 int n_ctree;
24595 xmlChar ** list; /* an array to store the list of child names */
24596 int n_list;
24597 int * len; /* a pointer to the number of element in the list */
24598 int n_len;
24599 int max; /* the size of the array */
24600 int n_max;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024601
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024602 for (n_ctree = 0;n_ctree < gen_nb_xmlElementContent_ptr;n_ctree++) {
24603 for (n_list = 0;n_list < gen_nb_const_xmlChar_ptr_ptr;n_list++) {
24604 for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
24605 for (n_max = 0;n_max < gen_nb_int;n_max++) {
24606 mem_base = xmlMemBlocks();
24607 ctree = gen_xmlElementContent_ptr(n_ctree, 0);
24608 list = gen_const_xmlChar_ptr_ptr(n_list, 1);
24609 len = gen_int_ptr(n_len, 2);
24610 max = gen_int(n_max, 3);
24611
William M. Brackf13f77f2004-11-12 16:03:48 +000024612 ret_val = xmlValidGetPotentialChildren(ctree, (const xmlChar **)list, len, max);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024613 desret_int(ret_val);
24614 call_tests++;
24615 des_xmlElementContent_ptr(n_ctree, ctree, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000024616 des_const_xmlChar_ptr_ptr(n_list, (const xmlChar **)list, 1);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024617 des_int_ptr(n_len, len, 2);
24618 des_int(n_max, max, 3);
24619 xmlResetLastError();
24620 if (mem_base != xmlMemBlocks()) {
24621 printf("Leak of %d blocks found in xmlValidGetPotentialChildren",
24622 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024623 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024624 printf(" %d", n_ctree);
24625 printf(" %d", n_list);
24626 printf(" %d", n_len);
24627 printf(" %d", n_max);
24628 printf("\n");
24629 }
24630 }
24631 }
24632 }
24633 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024634 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000024635#endif
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024636
Daniel Veillard42595322004-11-08 10:52:06 +000024637 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024638}
24639
24640
24641static int
24642test_xmlValidGetValidElements(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024643 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024644
Daniel Veillarda521d282004-11-09 14:59:59 +000024645#ifdef LIBXML_VALID_ENABLED
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024646 int mem_base;
24647 int ret_val;
24648 xmlNode * prev; /* an element to insert after */
24649 int n_prev;
24650 xmlNode * next; /* an element to insert next */
24651 int n_next;
24652 xmlChar ** names; /* an array to store the list of child names */
24653 int n_names;
24654 int max; /* the size of the array */
24655 int n_max;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024656
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024657 for (n_prev = 0;n_prev < gen_nb_xmlNodePtr;n_prev++) {
24658 for (n_next = 0;n_next < gen_nb_xmlNodePtr;n_next++) {
24659 for (n_names = 0;n_names < gen_nb_const_xmlChar_ptr_ptr;n_names++) {
24660 for (n_max = 0;n_max < gen_nb_int;n_max++) {
24661 mem_base = xmlMemBlocks();
24662 prev = gen_xmlNodePtr(n_prev, 0);
24663 next = gen_xmlNodePtr(n_next, 1);
24664 names = gen_const_xmlChar_ptr_ptr(n_names, 2);
24665 max = gen_int(n_max, 3);
24666
William M. Brackf13f77f2004-11-12 16:03:48 +000024667 ret_val = xmlValidGetValidElements(prev, next, (const xmlChar **)names, max);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024668 desret_int(ret_val);
24669 call_tests++;
24670 des_xmlNodePtr(n_prev, prev, 0);
24671 des_xmlNodePtr(n_next, next, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000024672 des_const_xmlChar_ptr_ptr(n_names, (const xmlChar **)names, 2);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024673 des_int(n_max, max, 3);
24674 xmlResetLastError();
24675 if (mem_base != xmlMemBlocks()) {
24676 printf("Leak of %d blocks found in xmlValidGetValidElements",
24677 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024678 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024679 printf(" %d", n_prev);
24680 printf(" %d", n_next);
24681 printf(" %d", n_names);
24682 printf(" %d", n_max);
24683 printf("\n");
24684 }
24685 }
24686 }
24687 }
24688 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024689 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000024690#endif
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024691
Daniel Veillard42595322004-11-08 10:52:06 +000024692 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024693}
24694
24695
24696static int
24697test_xmlValidNormalizeAttributeValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024698 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024699
Daniel Veillard8a32fe42004-11-02 22:10:16 +000024700#ifdef LIBXML_VALID_ENABLED
24701 int mem_base;
24702 xmlChar * ret_val;
24703 xmlDocPtr doc; /* the document */
24704 int n_doc;
24705 xmlNodePtr elem; /* the parent */
24706 int n_elem;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024707 xmlChar * name; /* the attribute name */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000024708 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024709 xmlChar * value; /* the attribute value */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000024710 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024711
Daniel Veillard8a32fe42004-11-02 22:10:16 +000024712 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24713 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
24714 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24715 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
24716 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000024717 doc = gen_xmlDocPtr(n_doc, 0);
24718 elem = gen_xmlNodePtr(n_elem, 1);
24719 name = gen_const_xmlChar_ptr(n_name, 2);
24720 value = gen_const_xmlChar_ptr(n_value, 3);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000024721
William M. Brackf13f77f2004-11-12 16:03:48 +000024722 ret_val = xmlValidNormalizeAttributeValue(doc, elem, (const xmlChar *)name, (const xmlChar *)value);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000024723 desret_xmlChar_ptr(ret_val);
24724 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000024725 des_xmlDocPtr(n_doc, doc, 0);
24726 des_xmlNodePtr(n_elem, elem, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000024727 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
24728 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 3);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000024729 xmlResetLastError();
24730 if (mem_base != xmlMemBlocks()) {
24731 printf("Leak of %d blocks found in xmlValidNormalizeAttributeValue",
24732 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024733 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000024734 printf(" %d", n_doc);
24735 printf(" %d", n_elem);
24736 printf(" %d", n_name);
24737 printf(" %d", n_value);
24738 printf("\n");
24739 }
24740 }
24741 }
24742 }
24743 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024744 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000024745#endif
24746
Daniel Veillard42595322004-11-08 10:52:06 +000024747 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024748}
24749
24750
24751static int
24752test_xmlValidateAttributeDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024753 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024754
Daniel Veillardce682bc2004-11-05 17:22:25 +000024755#ifdef LIBXML_VALID_ENABLED
24756 int mem_base;
24757 int ret_val;
24758 xmlValidCtxtPtr ctxt; /* the validation context */
24759 int n_ctxt;
24760 xmlDocPtr doc; /* a document instance */
24761 int n_doc;
24762 xmlAttributePtr attr; /* an attribute definition */
24763 int n_attr;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024764
Daniel Veillardce682bc2004-11-05 17:22:25 +000024765 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
24766 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24767 for (n_attr = 0;n_attr < gen_nb_xmlAttributePtr;n_attr++) {
24768 mem_base = xmlMemBlocks();
24769 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
24770 doc = gen_xmlDocPtr(n_doc, 1);
24771 attr = gen_xmlAttributePtr(n_attr, 2);
24772
24773 ret_val = xmlValidateAttributeDecl(ctxt, doc, attr);
24774 desret_int(ret_val);
24775 call_tests++;
24776 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
24777 des_xmlDocPtr(n_doc, doc, 1);
24778 des_xmlAttributePtr(n_attr, attr, 2);
24779 xmlResetLastError();
24780 if (mem_base != xmlMemBlocks()) {
24781 printf("Leak of %d blocks found in xmlValidateAttributeDecl",
24782 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024783 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024784 printf(" %d", n_ctxt);
24785 printf(" %d", n_doc);
24786 printf(" %d", n_attr);
24787 printf("\n");
24788 }
24789 }
24790 }
24791 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024792 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024793#endif
24794
Daniel Veillard42595322004-11-08 10:52:06 +000024795 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024796}
24797
24798
24799static int
24800test_xmlValidateAttributeValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024801 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024802
Daniel Veillard57b25162004-11-06 14:50:18 +000024803#ifdef LIBXML_VALID_ENABLED
24804 int mem_base;
24805 int ret_val;
24806 xmlAttributeType type; /* an attribute type */
24807 int n_type;
24808 xmlChar * value; /* an attribute value */
24809 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024810
Daniel Veillard57b25162004-11-06 14:50:18 +000024811 for (n_type = 0;n_type < gen_nb_xmlAttributeType;n_type++) {
24812 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
24813 mem_base = xmlMemBlocks();
24814 type = gen_xmlAttributeType(n_type, 0);
24815 value = gen_const_xmlChar_ptr(n_value, 1);
24816
William M. Brackf13f77f2004-11-12 16:03:48 +000024817 ret_val = xmlValidateAttributeValue(type, (const xmlChar *)value);
Daniel Veillard57b25162004-11-06 14:50:18 +000024818 desret_int(ret_val);
24819 call_tests++;
24820 des_xmlAttributeType(n_type, type, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000024821 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillard57b25162004-11-06 14:50:18 +000024822 xmlResetLastError();
24823 if (mem_base != xmlMemBlocks()) {
24824 printf("Leak of %d blocks found in xmlValidateAttributeValue",
24825 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024826 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000024827 printf(" %d", n_type);
24828 printf(" %d", n_value);
24829 printf("\n");
24830 }
24831 }
24832 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024833 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +000024834#endif
24835
Daniel Veillard42595322004-11-08 10:52:06 +000024836 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024837}
24838
24839
24840static int
24841test_xmlValidateDocument(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024842 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024843
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024844#ifdef LIBXML_VALID_ENABLED
24845 int mem_base;
24846 int ret_val;
24847 xmlValidCtxtPtr ctxt; /* the validation context */
24848 int n_ctxt;
24849 xmlDocPtr doc; /* a document instance */
24850 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024851
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024852 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
24853 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24854 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000024855 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
24856 doc = gen_xmlDocPtr(n_doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024857
24858 ret_val = xmlValidateDocument(ctxt, doc);
24859 desret_int(ret_val);
24860 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000024861 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
24862 des_xmlDocPtr(n_doc, doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024863 xmlResetLastError();
24864 if (mem_base != xmlMemBlocks()) {
24865 printf("Leak of %d blocks found in xmlValidateDocument",
24866 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024867 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024868 printf(" %d", n_ctxt);
24869 printf(" %d", n_doc);
24870 printf("\n");
24871 }
24872 }
24873 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024874 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024875#endif
24876
Daniel Veillard42595322004-11-08 10:52:06 +000024877 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024878}
24879
24880
24881static int
24882test_xmlValidateDocumentFinal(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024883 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024884
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024885#ifdef LIBXML_VALID_ENABLED
24886 int mem_base;
24887 int ret_val;
24888 xmlValidCtxtPtr ctxt; /* the validation context */
24889 int n_ctxt;
24890 xmlDocPtr doc; /* a document instance */
24891 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024892
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024893 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
24894 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24895 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000024896 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
24897 doc = gen_xmlDocPtr(n_doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024898
24899 ret_val = xmlValidateDocumentFinal(ctxt, doc);
24900 desret_int(ret_val);
24901 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000024902 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
24903 des_xmlDocPtr(n_doc, doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024904 xmlResetLastError();
24905 if (mem_base != xmlMemBlocks()) {
24906 printf("Leak of %d blocks found in xmlValidateDocumentFinal",
24907 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024908 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024909 printf(" %d", n_ctxt);
24910 printf(" %d", n_doc);
24911 printf("\n");
24912 }
24913 }
24914 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024915 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024916#endif
24917
Daniel Veillard42595322004-11-08 10:52:06 +000024918 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024919}
24920
24921
24922static int
24923test_xmlValidateDtd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024924 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024925
Daniel Veillard27f20102004-11-05 11:50:11 +000024926#ifdef LIBXML_VALID_ENABLED
24927 int mem_base;
24928 int ret_val;
24929 xmlValidCtxtPtr ctxt; /* the validation context */
24930 int n_ctxt;
24931 xmlDocPtr doc; /* a document instance */
24932 int n_doc;
24933 xmlDtdPtr dtd; /* a dtd instance */
24934 int n_dtd;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024935
Daniel Veillard27f20102004-11-05 11:50:11 +000024936 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
24937 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24938 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
24939 mem_base = xmlMemBlocks();
24940 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
24941 doc = gen_xmlDocPtr(n_doc, 1);
24942 dtd = gen_xmlDtdPtr(n_dtd, 2);
24943
24944 ret_val = xmlValidateDtd(ctxt, doc, dtd);
24945 desret_int(ret_val);
24946 call_tests++;
24947 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
24948 des_xmlDocPtr(n_doc, doc, 1);
24949 des_xmlDtdPtr(n_dtd, dtd, 2);
24950 xmlResetLastError();
24951 if (mem_base != xmlMemBlocks()) {
24952 printf("Leak of %d blocks found in xmlValidateDtd",
24953 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024954 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000024955 printf(" %d", n_ctxt);
24956 printf(" %d", n_doc);
24957 printf(" %d", n_dtd);
24958 printf("\n");
24959 }
24960 }
24961 }
24962 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024963 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000024964#endif
24965
Daniel Veillard42595322004-11-08 10:52:06 +000024966 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024967}
24968
24969
24970static int
24971test_xmlValidateDtdFinal(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024972 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024973
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024974#ifdef LIBXML_VALID_ENABLED
24975 int mem_base;
24976 int ret_val;
24977 xmlValidCtxtPtr ctxt; /* the validation context */
24978 int n_ctxt;
24979 xmlDocPtr doc; /* a document instance */
24980 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024981
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024982 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
24983 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24984 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000024985 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
24986 doc = gen_xmlDocPtr(n_doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024987
24988 ret_val = xmlValidateDtdFinal(ctxt, doc);
24989 desret_int(ret_val);
24990 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000024991 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
24992 des_xmlDocPtr(n_doc, doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024993 xmlResetLastError();
24994 if (mem_base != xmlMemBlocks()) {
24995 printf("Leak of %d blocks found in xmlValidateDtdFinal",
24996 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024997 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024998 printf(" %d", n_ctxt);
24999 printf(" %d", n_doc);
25000 printf("\n");
25001 }
25002 }
25003 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025004 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025005#endif
25006
Daniel Veillard42595322004-11-08 10:52:06 +000025007 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025008}
25009
25010
25011static int
25012test_xmlValidateElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025013 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025014
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025015#ifdef LIBXML_VALID_ENABLED
25016 int mem_base;
25017 int ret_val;
25018 xmlValidCtxtPtr ctxt; /* the validation context */
25019 int n_ctxt;
25020 xmlDocPtr doc; /* a document instance */
25021 int n_doc;
25022 xmlNodePtr elem; /* an element instance */
25023 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025024
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025025 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25026 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25027 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
25028 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025029 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25030 doc = gen_xmlDocPtr(n_doc, 1);
25031 elem = gen_xmlNodePtr(n_elem, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025032
25033 ret_val = xmlValidateElement(ctxt, doc, elem);
25034 desret_int(ret_val);
25035 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025036 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25037 des_xmlDocPtr(n_doc, doc, 1);
25038 des_xmlNodePtr(n_elem, elem, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025039 xmlResetLastError();
25040 if (mem_base != xmlMemBlocks()) {
25041 printf("Leak of %d blocks found in xmlValidateElement",
25042 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025043 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025044 printf(" %d", n_ctxt);
25045 printf(" %d", n_doc);
25046 printf(" %d", n_elem);
25047 printf("\n");
25048 }
25049 }
25050 }
25051 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025052 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025053#endif
25054
Daniel Veillard42595322004-11-08 10:52:06 +000025055 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025056}
25057
25058
25059static int
25060test_xmlValidateElementDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025061 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025062
Daniel Veillardce682bc2004-11-05 17:22:25 +000025063#ifdef LIBXML_VALID_ENABLED
25064 int mem_base;
25065 int ret_val;
25066 xmlValidCtxtPtr ctxt; /* the validation context */
25067 int n_ctxt;
25068 xmlDocPtr doc; /* a document instance */
25069 int n_doc;
25070 xmlElementPtr elem; /* an element definition */
25071 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025072
Daniel Veillardce682bc2004-11-05 17:22:25 +000025073 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25074 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25075 for (n_elem = 0;n_elem < gen_nb_xmlElementPtr;n_elem++) {
25076 mem_base = xmlMemBlocks();
25077 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25078 doc = gen_xmlDocPtr(n_doc, 1);
25079 elem = gen_xmlElementPtr(n_elem, 2);
25080
25081 ret_val = xmlValidateElementDecl(ctxt, doc, elem);
25082 desret_int(ret_val);
25083 call_tests++;
25084 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25085 des_xmlDocPtr(n_doc, doc, 1);
25086 des_xmlElementPtr(n_elem, elem, 2);
25087 xmlResetLastError();
25088 if (mem_base != xmlMemBlocks()) {
25089 printf("Leak of %d blocks found in xmlValidateElementDecl",
25090 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025091 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025092 printf(" %d", n_ctxt);
25093 printf(" %d", n_doc);
25094 printf(" %d", n_elem);
25095 printf("\n");
25096 }
25097 }
25098 }
25099 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025100 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025101#endif
25102
Daniel Veillard42595322004-11-08 10:52:06 +000025103 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025104}
25105
25106
25107static int
25108test_xmlValidateNameValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025109 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025110
25111#ifdef LIBXML_VALID_ENABLED
25112 int mem_base;
25113 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025114 xmlChar * value; /* an Name value */
Daniel Veillardd93f6252004-11-02 15:53:51 +000025115 int n_value;
25116
25117 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25118 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025119 value = gen_const_xmlChar_ptr(n_value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025120
William M. Brackf13f77f2004-11-12 16:03:48 +000025121 ret_val = xmlValidateNameValue((const xmlChar *)value);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025122 desret_int(ret_val);
25123 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000025124 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025125 xmlResetLastError();
25126 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000025127 printf("Leak of %d blocks found in xmlValidateNameValue",
Daniel Veillardd93f6252004-11-02 15:53:51 +000025128 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025129 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000025130 printf(" %d", n_value);
25131 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000025132 }
25133 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025134 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025135#endif
25136
Daniel Veillard42595322004-11-08 10:52:06 +000025137 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025138}
25139
25140
25141static int
25142test_xmlValidateNamesValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025143 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025144
25145#ifdef LIBXML_VALID_ENABLED
25146 int mem_base;
25147 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025148 xmlChar * value; /* an Names value */
Daniel Veillardd93f6252004-11-02 15:53:51 +000025149 int n_value;
25150
25151 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25152 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025153 value = gen_const_xmlChar_ptr(n_value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025154
William M. Brackf13f77f2004-11-12 16:03:48 +000025155 ret_val = xmlValidateNamesValue((const xmlChar *)value);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025156 desret_int(ret_val);
25157 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000025158 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025159 xmlResetLastError();
25160 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000025161 printf("Leak of %d blocks found in xmlValidateNamesValue",
Daniel Veillardd93f6252004-11-02 15:53:51 +000025162 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025163 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000025164 printf(" %d", n_value);
25165 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000025166 }
25167 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025168 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025169#endif
25170
Daniel Veillard42595322004-11-08 10:52:06 +000025171 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025172}
25173
25174
25175static int
25176test_xmlValidateNmtokenValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025177 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025178
25179#ifdef LIBXML_VALID_ENABLED
25180 int mem_base;
25181 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025182 xmlChar * value; /* an Nmtoken value */
Daniel Veillardd93f6252004-11-02 15:53:51 +000025183 int n_value;
25184
25185 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25186 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025187 value = gen_const_xmlChar_ptr(n_value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025188
William M. Brackf13f77f2004-11-12 16:03:48 +000025189 ret_val = xmlValidateNmtokenValue((const xmlChar *)value);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025190 desret_int(ret_val);
25191 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000025192 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025193 xmlResetLastError();
25194 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000025195 printf("Leak of %d blocks found in xmlValidateNmtokenValue",
Daniel Veillardd93f6252004-11-02 15:53:51 +000025196 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025197 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000025198 printf(" %d", n_value);
25199 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000025200 }
25201 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025202 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025203#endif
25204
Daniel Veillard42595322004-11-08 10:52:06 +000025205 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025206}
25207
25208
25209static int
25210test_xmlValidateNmtokensValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025211 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025212
25213#ifdef LIBXML_VALID_ENABLED
25214 int mem_base;
25215 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025216 xmlChar * value; /* an Nmtokens value */
Daniel Veillardd93f6252004-11-02 15:53:51 +000025217 int n_value;
25218
25219 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25220 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025221 value = gen_const_xmlChar_ptr(n_value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025222
William M. Brackf13f77f2004-11-12 16:03:48 +000025223 ret_val = xmlValidateNmtokensValue((const xmlChar *)value);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025224 desret_int(ret_val);
25225 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000025226 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025227 xmlResetLastError();
25228 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000025229 printf("Leak of %d blocks found in xmlValidateNmtokensValue",
Daniel Veillardd93f6252004-11-02 15:53:51 +000025230 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025231 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000025232 printf(" %d", n_value);
25233 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000025234 }
25235 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025236 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025237#endif
25238
Daniel Veillard42595322004-11-08 10:52:06 +000025239 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025240}
25241
25242
25243static int
25244test_xmlValidateNotationDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025245 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025246
Daniel Veillardce682bc2004-11-05 17:22:25 +000025247#ifdef LIBXML_VALID_ENABLED
25248 int mem_base;
25249 int ret_val;
25250 xmlValidCtxtPtr ctxt; /* the validation context */
25251 int n_ctxt;
25252 xmlDocPtr doc; /* a document instance */
25253 int n_doc;
25254 xmlNotationPtr nota; /* a notation definition */
25255 int n_nota;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025256
Daniel Veillardce682bc2004-11-05 17:22:25 +000025257 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25258 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25259 for (n_nota = 0;n_nota < gen_nb_xmlNotationPtr;n_nota++) {
25260 mem_base = xmlMemBlocks();
25261 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25262 doc = gen_xmlDocPtr(n_doc, 1);
25263 nota = gen_xmlNotationPtr(n_nota, 2);
25264
25265 ret_val = xmlValidateNotationDecl(ctxt, doc, nota);
25266 desret_int(ret_val);
25267 call_tests++;
25268 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25269 des_xmlDocPtr(n_doc, doc, 1);
25270 des_xmlNotationPtr(n_nota, nota, 2);
25271 xmlResetLastError();
25272 if (mem_base != xmlMemBlocks()) {
25273 printf("Leak of %d blocks found in xmlValidateNotationDecl",
25274 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025275 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025276 printf(" %d", n_ctxt);
25277 printf(" %d", n_doc);
25278 printf(" %d", n_nota);
25279 printf("\n");
25280 }
25281 }
25282 }
25283 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025284 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025285#endif
25286
Daniel Veillard42595322004-11-08 10:52:06 +000025287 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025288}
25289
25290
25291static int
25292test_xmlValidateNotationUse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025293 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025294
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025295#ifdef LIBXML_VALID_ENABLED
25296 int mem_base;
25297 int ret_val;
25298 xmlValidCtxtPtr ctxt; /* the validation context */
25299 int n_ctxt;
25300 xmlDocPtr doc; /* the document */
25301 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025302 xmlChar * notationName; /* the notation name to check */
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025303 int n_notationName;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025304
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025305 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25306 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25307 for (n_notationName = 0;n_notationName < gen_nb_const_xmlChar_ptr;n_notationName++) {
25308 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025309 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25310 doc = gen_xmlDocPtr(n_doc, 1);
25311 notationName = gen_const_xmlChar_ptr(n_notationName, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025312
William M. Brackf13f77f2004-11-12 16:03:48 +000025313 ret_val = xmlValidateNotationUse(ctxt, doc, (const xmlChar *)notationName);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025314 desret_int(ret_val);
25315 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025316 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25317 des_xmlDocPtr(n_doc, doc, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000025318 des_const_xmlChar_ptr(n_notationName, (const xmlChar *)notationName, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025319 xmlResetLastError();
25320 if (mem_base != xmlMemBlocks()) {
25321 printf("Leak of %d blocks found in xmlValidateNotationUse",
25322 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025323 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025324 printf(" %d", n_ctxt);
25325 printf(" %d", n_doc);
25326 printf(" %d", n_notationName);
25327 printf("\n");
25328 }
25329 }
25330 }
25331 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025332 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025333#endif
25334
Daniel Veillard42595322004-11-08 10:52:06 +000025335 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025336}
25337
25338
25339static int
25340test_xmlValidateOneAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025341 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025342
Daniel Veillardce244ad2004-11-05 10:03:46 +000025343#ifdef LIBXML_VALID_ENABLED
25344 int mem_base;
25345 int ret_val;
25346 xmlValidCtxtPtr ctxt; /* the validation context */
25347 int n_ctxt;
25348 xmlDocPtr doc; /* a document instance */
25349 int n_doc;
25350 xmlNodePtr elem; /* an element instance */
25351 int n_elem;
25352 xmlAttrPtr attr; /* an attribute instance */
25353 int n_attr;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025354 xmlChar * value; /* the attribute value (without entities processing) */
Daniel Veillardce244ad2004-11-05 10:03:46 +000025355 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025356
Daniel Veillardce244ad2004-11-05 10:03:46 +000025357 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25358 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25359 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
25360 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
25361 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25362 mem_base = xmlMemBlocks();
25363 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25364 doc = gen_xmlDocPtr(n_doc, 1);
25365 elem = gen_xmlNodePtr(n_elem, 2);
25366 attr = gen_xmlAttrPtr(n_attr, 3);
25367 value = gen_const_xmlChar_ptr(n_value, 4);
25368
William M. Brackf13f77f2004-11-12 16:03:48 +000025369 ret_val = xmlValidateOneAttribute(ctxt, doc, elem, attr, (const xmlChar *)value);
Daniel Veillardce244ad2004-11-05 10:03:46 +000025370 desret_int(ret_val);
25371 call_tests++;
25372 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25373 des_xmlDocPtr(n_doc, doc, 1);
25374 des_xmlNodePtr(n_elem, elem, 2);
25375 des_xmlAttrPtr(n_attr, attr, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +000025376 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 4);
Daniel Veillardce244ad2004-11-05 10:03:46 +000025377 xmlResetLastError();
25378 if (mem_base != xmlMemBlocks()) {
25379 printf("Leak of %d blocks found in xmlValidateOneAttribute",
25380 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025381 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000025382 printf(" %d", n_ctxt);
25383 printf(" %d", n_doc);
25384 printf(" %d", n_elem);
25385 printf(" %d", n_attr);
25386 printf(" %d", n_value);
25387 printf("\n");
25388 }
25389 }
25390 }
25391 }
25392 }
25393 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025394 function_tests++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000025395#endif
25396
Daniel Veillard42595322004-11-08 10:52:06 +000025397 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025398}
25399
25400
25401static int
25402test_xmlValidateOneElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025403 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025404
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025405#ifdef LIBXML_VALID_ENABLED
25406 int mem_base;
25407 int ret_val;
25408 xmlValidCtxtPtr ctxt; /* the validation context */
25409 int n_ctxt;
25410 xmlDocPtr doc; /* a document instance */
25411 int n_doc;
25412 xmlNodePtr elem; /* an element instance */
25413 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025414
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025415 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25416 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25417 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
25418 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025419 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25420 doc = gen_xmlDocPtr(n_doc, 1);
25421 elem = gen_xmlNodePtr(n_elem, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025422
25423 ret_val = xmlValidateOneElement(ctxt, doc, elem);
25424 desret_int(ret_val);
25425 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025426 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25427 des_xmlDocPtr(n_doc, doc, 1);
25428 des_xmlNodePtr(n_elem, elem, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025429 xmlResetLastError();
25430 if (mem_base != xmlMemBlocks()) {
25431 printf("Leak of %d blocks found in xmlValidateOneElement",
25432 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025433 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025434 printf(" %d", n_ctxt);
25435 printf(" %d", n_doc);
25436 printf(" %d", n_elem);
25437 printf("\n");
25438 }
25439 }
25440 }
25441 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025442 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025443#endif
25444
Daniel Veillard42595322004-11-08 10:52:06 +000025445 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025446}
25447
25448
25449static int
25450test_xmlValidateOneNamespace(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025451 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025452
Daniel Veillard27f20102004-11-05 11:50:11 +000025453#ifdef LIBXML_VALID_ENABLED
25454 int mem_base;
25455 int ret_val;
25456 xmlValidCtxtPtr ctxt; /* the validation context */
25457 int n_ctxt;
25458 xmlDocPtr doc; /* a document instance */
25459 int n_doc;
25460 xmlNodePtr elem; /* an element instance */
25461 int n_elem;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025462 xmlChar * prefix; /* the namespace prefix */
Daniel Veillard27f20102004-11-05 11:50:11 +000025463 int n_prefix;
25464 xmlNsPtr ns; /* an namespace declaration instance */
25465 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025466 xmlChar * value; /* the attribute value (without entities processing) */
Daniel Veillard27f20102004-11-05 11:50:11 +000025467 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025468
Daniel Veillard27f20102004-11-05 11:50:11 +000025469 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25470 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25471 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
25472 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
25473 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
25474 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25475 mem_base = xmlMemBlocks();
25476 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25477 doc = gen_xmlDocPtr(n_doc, 1);
25478 elem = gen_xmlNodePtr(n_elem, 2);
25479 prefix = gen_const_xmlChar_ptr(n_prefix, 3);
25480 ns = gen_xmlNsPtr(n_ns, 4);
25481 value = gen_const_xmlChar_ptr(n_value, 5);
25482
William M. Brackf13f77f2004-11-12 16:03:48 +000025483 ret_val = xmlValidateOneNamespace(ctxt, doc, elem, (const xmlChar *)prefix, ns, (const xmlChar *)value);
Daniel Veillard27f20102004-11-05 11:50:11 +000025484 desret_int(ret_val);
25485 call_tests++;
25486 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25487 des_xmlDocPtr(n_doc, doc, 1);
25488 des_xmlNodePtr(n_elem, elem, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000025489 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 3);
Daniel Veillard27f20102004-11-05 11:50:11 +000025490 des_xmlNsPtr(n_ns, ns, 4);
William M. Brackf13f77f2004-11-12 16:03:48 +000025491 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 5);
Daniel Veillard27f20102004-11-05 11:50:11 +000025492 xmlResetLastError();
25493 if (mem_base != xmlMemBlocks()) {
25494 printf("Leak of %d blocks found in xmlValidateOneNamespace",
25495 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025496 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000025497 printf(" %d", n_ctxt);
25498 printf(" %d", n_doc);
25499 printf(" %d", n_elem);
25500 printf(" %d", n_prefix);
25501 printf(" %d", n_ns);
25502 printf(" %d", n_value);
25503 printf("\n");
25504 }
25505 }
25506 }
25507 }
25508 }
25509 }
25510 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025511 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000025512#endif
25513
Daniel Veillard42595322004-11-08 10:52:06 +000025514 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025515}
25516
25517
25518static int
25519test_xmlValidatePopElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025520 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025521
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025522#ifdef LIBXML_REGEXP_ENABLED
25523 int mem_base;
25524 int ret_val;
25525 xmlValidCtxtPtr ctxt; /* the validation context */
25526 int n_ctxt;
25527 xmlDocPtr doc; /* a document instance */
25528 int n_doc;
25529 xmlNodePtr elem; /* an element instance */
25530 int n_elem;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025531 xmlChar * qname; /* the qualified name as appearing in the serialization */
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025532 int n_qname;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025533
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025534 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25535 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25536 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
25537 for (n_qname = 0;n_qname < gen_nb_const_xmlChar_ptr;n_qname++) {
25538 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025539 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25540 doc = gen_xmlDocPtr(n_doc, 1);
25541 elem = gen_xmlNodePtr(n_elem, 2);
25542 qname = gen_const_xmlChar_ptr(n_qname, 3);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025543
William M. Brackf13f77f2004-11-12 16:03:48 +000025544 ret_val = xmlValidatePopElement(ctxt, doc, elem, (const xmlChar *)qname);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025545 desret_int(ret_val);
25546 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025547 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25548 des_xmlDocPtr(n_doc, doc, 1);
25549 des_xmlNodePtr(n_elem, elem, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000025550 des_const_xmlChar_ptr(n_qname, (const xmlChar *)qname, 3);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025551 xmlResetLastError();
25552 if (mem_base != xmlMemBlocks()) {
25553 printf("Leak of %d blocks found in xmlValidatePopElement",
25554 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025555 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025556 printf(" %d", n_ctxt);
25557 printf(" %d", n_doc);
25558 printf(" %d", n_elem);
25559 printf(" %d", n_qname);
25560 printf("\n");
25561 }
25562 }
25563 }
25564 }
25565 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025566 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025567#endif
25568
Daniel Veillard42595322004-11-08 10:52:06 +000025569 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025570}
25571
25572
25573static int
25574test_xmlValidatePushCData(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025575 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025576
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025577#ifdef LIBXML_REGEXP_ENABLED
25578 int mem_base;
25579 int ret_val;
25580 xmlValidCtxtPtr ctxt; /* the validation context */
25581 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025582 xmlChar * data; /* some character data read */
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025583 int n_data;
25584 int len; /* the lenght of the data */
25585 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025586
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025587 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25588 for (n_data = 0;n_data < gen_nb_const_xmlChar_ptr;n_data++) {
25589 for (n_len = 0;n_len < gen_nb_int;n_len++) {
25590 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025591 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25592 data = gen_const_xmlChar_ptr(n_data, 1);
25593 len = gen_int(n_len, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025594
William M. Brackf13f77f2004-11-12 16:03:48 +000025595 ret_val = xmlValidatePushCData(ctxt, (const xmlChar *)data, len);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025596 desret_int(ret_val);
25597 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025598 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000025599 des_const_xmlChar_ptr(n_data, (const xmlChar *)data, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000025600 des_int(n_len, len, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025601 xmlResetLastError();
25602 if (mem_base != xmlMemBlocks()) {
25603 printf("Leak of %d blocks found in xmlValidatePushCData",
25604 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025605 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025606 printf(" %d", n_ctxt);
25607 printf(" %d", n_data);
25608 printf(" %d", n_len);
25609 printf("\n");
25610 }
25611 }
25612 }
25613 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025614 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025615#endif
25616
Daniel Veillard42595322004-11-08 10:52:06 +000025617 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025618}
25619
25620
25621static int
25622test_xmlValidatePushElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025623 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025624
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025625#ifdef LIBXML_REGEXP_ENABLED
25626 int mem_base;
25627 int ret_val;
25628 xmlValidCtxtPtr ctxt; /* the validation context */
25629 int n_ctxt;
25630 xmlDocPtr doc; /* a document instance */
25631 int n_doc;
25632 xmlNodePtr elem; /* an element instance */
25633 int n_elem;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025634 xmlChar * qname; /* the qualified name as appearing in the serialization */
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025635 int n_qname;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025636
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025637 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25638 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25639 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
25640 for (n_qname = 0;n_qname < gen_nb_const_xmlChar_ptr;n_qname++) {
25641 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025642 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25643 doc = gen_xmlDocPtr(n_doc, 1);
25644 elem = gen_xmlNodePtr(n_elem, 2);
25645 qname = gen_const_xmlChar_ptr(n_qname, 3);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025646
William M. Brackf13f77f2004-11-12 16:03:48 +000025647 ret_val = xmlValidatePushElement(ctxt, doc, elem, (const xmlChar *)qname);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025648 desret_int(ret_val);
25649 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025650 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25651 des_xmlDocPtr(n_doc, doc, 1);
25652 des_xmlNodePtr(n_elem, elem, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000025653 des_const_xmlChar_ptr(n_qname, (const xmlChar *)qname, 3);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025654 xmlResetLastError();
25655 if (mem_base != xmlMemBlocks()) {
25656 printf("Leak of %d blocks found in xmlValidatePushElement",
25657 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025658 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025659 printf(" %d", n_ctxt);
25660 printf(" %d", n_doc);
25661 printf(" %d", n_elem);
25662 printf(" %d", n_qname);
25663 printf("\n");
25664 }
25665 }
25666 }
25667 }
25668 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025669 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025670#endif
25671
Daniel Veillard42595322004-11-08 10:52:06 +000025672 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025673}
25674
25675
25676static int
25677test_xmlValidateRoot(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025678 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025679
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025680#ifdef LIBXML_VALID_ENABLED
25681 int mem_base;
25682 int ret_val;
25683 xmlValidCtxtPtr ctxt; /* the validation context */
25684 int n_ctxt;
25685 xmlDocPtr doc; /* a document instance */
25686 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025687
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025688 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25689 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25690 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025691 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25692 doc = gen_xmlDocPtr(n_doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025693
25694 ret_val = xmlValidateRoot(ctxt, doc);
25695 desret_int(ret_val);
25696 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025697 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25698 des_xmlDocPtr(n_doc, doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025699 xmlResetLastError();
25700 if (mem_base != xmlMemBlocks()) {
25701 printf("Leak of %d blocks found in xmlValidateRoot",
25702 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025703 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025704 printf(" %d", n_ctxt);
25705 printf(" %d", n_doc);
25706 printf("\n");
25707 }
25708 }
25709 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025710 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025711#endif
25712
Daniel Veillard42595322004-11-08 10:52:06 +000025713 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025714}
25715
25716static int
25717test_valid(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025718 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025719
William M. Brack094dd862004-11-14 14:28:34 +000025720 if (quiet == 0) printf("Testing valid : 48 of 67 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000025721 test_ret += test_xmlAddAttributeDecl();
25722 test_ret += test_xmlAddElementDecl();
25723 test_ret += test_xmlAddID();
25724 test_ret += test_xmlAddNotationDecl();
25725 test_ret += test_xmlAddRef();
25726 test_ret += test_xmlCopyAttributeTable();
25727 test_ret += test_xmlCopyElementContent();
25728 test_ret += test_xmlCopyElementTable();
25729 test_ret += test_xmlCopyEnumeration();
25730 test_ret += test_xmlCopyNotationTable();
25731 test_ret += test_xmlCreateEnumeration();
25732 test_ret += test_xmlDumpAttributeDecl();
25733 test_ret += test_xmlDumpAttributeTable();
25734 test_ret += test_xmlDumpElementDecl();
25735 test_ret += test_xmlDumpElementTable();
25736 test_ret += test_xmlDumpNotationDecl();
25737 test_ret += test_xmlDumpNotationTable();
25738 test_ret += test_xmlGetDtdAttrDesc();
25739 test_ret += test_xmlGetDtdElementDesc();
25740 test_ret += test_xmlGetDtdNotationDesc();
25741 test_ret += test_xmlGetDtdQAttrDesc();
25742 test_ret += test_xmlGetDtdQElementDesc();
25743 test_ret += test_xmlGetID();
25744 test_ret += test_xmlGetRefs();
25745 test_ret += test_xmlIsID();
25746 test_ret += test_xmlIsMixedElement();
25747 test_ret += test_xmlIsRef();
25748 test_ret += test_xmlNewElementContent();
25749 test_ret += test_xmlNewValidCtxt();
25750 test_ret += test_xmlRemoveID();
25751 test_ret += test_xmlRemoveRef();
25752 test_ret += test_xmlSnprintfElementContent();
25753 test_ret += test_xmlSprintfElementContent();
25754 test_ret += test_xmlValidBuildContentModel();
25755 test_ret += test_xmlValidCtxtNormalizeAttributeValue();
25756 test_ret += test_xmlValidGetPotentialChildren();
25757 test_ret += test_xmlValidGetValidElements();
25758 test_ret += test_xmlValidNormalizeAttributeValue();
25759 test_ret += test_xmlValidateAttributeDecl();
25760 test_ret += test_xmlValidateAttributeValue();
25761 test_ret += test_xmlValidateDocument();
25762 test_ret += test_xmlValidateDocumentFinal();
25763 test_ret += test_xmlValidateDtd();
25764 test_ret += test_xmlValidateDtdFinal();
25765 test_ret += test_xmlValidateElement();
25766 test_ret += test_xmlValidateElementDecl();
25767 test_ret += test_xmlValidateNameValue();
25768 test_ret += test_xmlValidateNamesValue();
25769 test_ret += test_xmlValidateNmtokenValue();
25770 test_ret += test_xmlValidateNmtokensValue();
25771 test_ret += test_xmlValidateNotationDecl();
25772 test_ret += test_xmlValidateNotationUse();
25773 test_ret += test_xmlValidateOneAttribute();
25774 test_ret += test_xmlValidateOneElement();
25775 test_ret += test_xmlValidateOneNamespace();
25776 test_ret += test_xmlValidatePopElement();
25777 test_ret += test_xmlValidatePushCData();
25778 test_ret += test_xmlValidatePushElement();
25779 test_ret += test_xmlValidateRoot();
Daniel Veillardd93f6252004-11-02 15:53:51 +000025780
Daniel Veillard42595322004-11-08 10:52:06 +000025781 if (test_ret != 0)
25782 printf("Module valid: %d errors\n", test_ret);
25783 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025784}
25785
25786static int
25787test_xmlXIncludeNewContext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025788 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025789
25790
25791 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000025792 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025793}
25794
25795
25796static int
25797test_xmlXIncludeProcess(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025798 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025799
25800#ifdef LIBXML_XINCLUDE_ENABLED
25801 int mem_base;
25802 int ret_val;
25803 xmlDocPtr doc; /* an XML document */
25804 int n_doc;
25805
25806 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25807 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025808 doc = gen_xmlDocPtr(n_doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025809
25810 ret_val = xmlXIncludeProcess(doc);
25811 desret_int(ret_val);
25812 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025813 des_xmlDocPtr(n_doc, doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025814 xmlResetLastError();
25815 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000025816 printf("Leak of %d blocks found in xmlXIncludeProcess",
Daniel Veillardd93f6252004-11-02 15:53:51 +000025817 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025818 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000025819 printf(" %d", n_doc);
25820 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000025821 }
25822 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025823 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025824#endif
25825
Daniel Veillard42595322004-11-08 10:52:06 +000025826 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025827}
25828
25829
25830static int
25831test_xmlXIncludeProcessFlags(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025832 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025833
25834#ifdef LIBXML_XINCLUDE_ENABLED
25835 int mem_base;
25836 int ret_val;
25837 xmlDocPtr doc; /* an XML document */
25838 int n_doc;
25839 int flags; /* a set of xmlParserOption used for parsing XML includes */
25840 int n_flags;
25841
25842 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25843 for (n_flags = 0;n_flags < gen_nb_int;n_flags++) {
25844 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025845 doc = gen_xmlDocPtr(n_doc, 0);
25846 flags = gen_int(n_flags, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025847
25848 ret_val = xmlXIncludeProcessFlags(doc, flags);
25849 desret_int(ret_val);
25850 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025851 des_xmlDocPtr(n_doc, doc, 0);
25852 des_int(n_flags, flags, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025853 xmlResetLastError();
25854 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000025855 printf("Leak of %d blocks found in xmlXIncludeProcessFlags",
Daniel Veillardd93f6252004-11-02 15:53:51 +000025856 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025857 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000025858 printf(" %d", n_doc);
25859 printf(" %d", n_flags);
25860 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000025861 }
25862 }
25863 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025864 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025865#endif
25866
Daniel Veillard42595322004-11-08 10:52:06 +000025867 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025868}
25869
Daniel Veillarda521d282004-11-09 14:59:59 +000025870#ifdef LIBXML_XINCLUDE_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000025871
Daniel Veillardce682bc2004-11-05 17:22:25 +000025872#define gen_nb_xmlXIncludeCtxtPtr 1
25873static xmlXIncludeCtxtPtr gen_xmlXIncludeCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
25874 return(NULL);
25875}
25876static void des_xmlXIncludeCtxtPtr(int no ATTRIBUTE_UNUSED, xmlXIncludeCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
25877}
Daniel Veillarda521d282004-11-09 14:59:59 +000025878#endif
25879
Daniel Veillardce682bc2004-11-05 17:22:25 +000025880
Daniel Veillardd93f6252004-11-02 15:53:51 +000025881static int
25882test_xmlXIncludeProcessNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025883 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025884
Daniel Veillardce682bc2004-11-05 17:22:25 +000025885#ifdef LIBXML_XINCLUDE_ENABLED
25886 int mem_base;
25887 int ret_val;
25888 xmlXIncludeCtxtPtr ctxt; /* an existing XInclude context */
25889 int n_ctxt;
25890 xmlNodePtr node; /* a node in an XML document */
25891 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025892
Daniel Veillardce682bc2004-11-05 17:22:25 +000025893 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXIncludeCtxtPtr;n_ctxt++) {
25894 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
25895 mem_base = xmlMemBlocks();
25896 ctxt = gen_xmlXIncludeCtxtPtr(n_ctxt, 0);
25897 node = gen_xmlNodePtr(n_node, 1);
25898
25899 ret_val = xmlXIncludeProcessNode(ctxt, node);
25900 desret_int(ret_val);
25901 call_tests++;
25902 des_xmlXIncludeCtxtPtr(n_ctxt, ctxt, 0);
25903 des_xmlNodePtr(n_node, node, 1);
25904 xmlResetLastError();
25905 if (mem_base != xmlMemBlocks()) {
25906 printf("Leak of %d blocks found in xmlXIncludeProcessNode",
25907 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025908 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025909 printf(" %d", n_ctxt);
25910 printf(" %d", n_node);
25911 printf("\n");
25912 }
25913 }
25914 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025915 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025916#endif
25917
Daniel Veillard42595322004-11-08 10:52:06 +000025918 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025919}
25920
25921
25922static int
25923test_xmlXIncludeProcessTree(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025924 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025925
25926#ifdef LIBXML_XINCLUDE_ENABLED
25927 int mem_base;
25928 int ret_val;
25929 xmlNodePtr tree; /* a node in an XML document */
25930 int n_tree;
25931
25932 for (n_tree = 0;n_tree < gen_nb_xmlNodePtr;n_tree++) {
25933 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025934 tree = gen_xmlNodePtr(n_tree, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025935
25936 ret_val = xmlXIncludeProcessTree(tree);
25937 desret_int(ret_val);
25938 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025939 des_xmlNodePtr(n_tree, tree, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025940 xmlResetLastError();
25941 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000025942 printf("Leak of %d blocks found in xmlXIncludeProcessTree",
Daniel Veillardd93f6252004-11-02 15:53:51 +000025943 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025944 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000025945 printf(" %d", n_tree);
25946 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000025947 }
25948 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025949 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025950#endif
25951
Daniel Veillard42595322004-11-08 10:52:06 +000025952 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025953}
25954
25955
25956static int
25957test_xmlXIncludeProcessTreeFlags(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025958 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025959
25960#ifdef LIBXML_XINCLUDE_ENABLED
25961 int mem_base;
25962 int ret_val;
25963 xmlNodePtr tree; /* a node in an XML document */
25964 int n_tree;
25965 int flags; /* a set of xmlParserOption used for parsing XML includes */
25966 int n_flags;
25967
25968 for (n_tree = 0;n_tree < gen_nb_xmlNodePtr;n_tree++) {
25969 for (n_flags = 0;n_flags < gen_nb_int;n_flags++) {
25970 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025971 tree = gen_xmlNodePtr(n_tree, 0);
25972 flags = gen_int(n_flags, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025973
25974 ret_val = xmlXIncludeProcessTreeFlags(tree, flags);
25975 desret_int(ret_val);
25976 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025977 des_xmlNodePtr(n_tree, tree, 0);
25978 des_int(n_flags, flags, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025979 xmlResetLastError();
25980 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000025981 printf("Leak of %d blocks found in xmlXIncludeProcessTreeFlags",
Daniel Veillardd93f6252004-11-02 15:53:51 +000025982 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025983 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000025984 printf(" %d", n_tree);
25985 printf(" %d", n_flags);
25986 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000025987 }
25988 }
25989 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025990 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025991#endif
25992
Daniel Veillard42595322004-11-08 10:52:06 +000025993 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025994}
25995
25996
25997static int
25998test_xmlXIncludeSetFlags(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025999 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026000
Daniel Veillardce682bc2004-11-05 17:22:25 +000026001#ifdef LIBXML_XINCLUDE_ENABLED
26002 int mem_base;
26003 int ret_val;
26004 xmlXIncludeCtxtPtr ctxt; /* an XInclude processing context */
26005 int n_ctxt;
26006 int flags; /* a set of xmlParserOption used for parsing XML includes */
26007 int n_flags;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026008
Daniel Veillardce682bc2004-11-05 17:22:25 +000026009 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXIncludeCtxtPtr;n_ctxt++) {
26010 for (n_flags = 0;n_flags < gen_nb_int;n_flags++) {
26011 mem_base = xmlMemBlocks();
26012 ctxt = gen_xmlXIncludeCtxtPtr(n_ctxt, 0);
26013 flags = gen_int(n_flags, 1);
26014
26015 ret_val = xmlXIncludeSetFlags(ctxt, flags);
26016 desret_int(ret_val);
26017 call_tests++;
26018 des_xmlXIncludeCtxtPtr(n_ctxt, ctxt, 0);
26019 des_int(n_flags, flags, 1);
26020 xmlResetLastError();
26021 if (mem_base != xmlMemBlocks()) {
26022 printf("Leak of %d blocks found in xmlXIncludeSetFlags",
26023 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026024 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026025 printf(" %d", n_ctxt);
26026 printf(" %d", n_flags);
26027 printf("\n");
26028 }
26029 }
26030 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026031 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026032#endif
26033
Daniel Veillard42595322004-11-08 10:52:06 +000026034 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026035}
26036
26037static int
26038test_xinclude(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026039 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026040
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026041 if (quiet == 0) printf("Testing xinclude : 6 of 8 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000026042 test_ret += test_xmlXIncludeNewContext();
26043 test_ret += test_xmlXIncludeProcess();
26044 test_ret += test_xmlXIncludeProcessFlags();
26045 test_ret += test_xmlXIncludeProcessNode();
26046 test_ret += test_xmlXIncludeProcessTree();
26047 test_ret += test_xmlXIncludeProcessTreeFlags();
26048 test_ret += test_xmlXIncludeSetFlags();
Daniel Veillardd93f6252004-11-02 15:53:51 +000026049
Daniel Veillard42595322004-11-08 10:52:06 +000026050 if (test_ret != 0)
26051 printf("Module xinclude: %d errors\n", test_ret);
26052 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026053}
26054
26055static int
26056test_xmlAllocOutputBuffer(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026057 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026058
Daniel Veillard3d95c732004-11-06 22:25:14 +000026059#ifdef LIBXML_OUTPUT_ENABLED
26060 int mem_base;
26061 xmlOutputBufferPtr ret_val;
26062 xmlCharEncodingHandlerPtr encoder; /* the encoding converter or NULL */
26063 int n_encoder;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026064
Daniel Veillard3d95c732004-11-06 22:25:14 +000026065 for (n_encoder = 0;n_encoder < gen_nb_xmlCharEncodingHandlerPtr;n_encoder++) {
26066 mem_base = xmlMemBlocks();
26067 encoder = gen_xmlCharEncodingHandlerPtr(n_encoder, 0);
26068
26069 ret_val = xmlAllocOutputBuffer(encoder);
26070 desret_xmlOutputBufferPtr(ret_val);
26071 call_tests++;
26072 des_xmlCharEncodingHandlerPtr(n_encoder, encoder, 0);
26073 xmlResetLastError();
26074 if (mem_base != xmlMemBlocks()) {
26075 printf("Leak of %d blocks found in xmlAllocOutputBuffer",
26076 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026077 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000026078 printf(" %d", n_encoder);
26079 printf("\n");
26080 }
26081 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026082 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000026083#endif
26084
Daniel Veillard42595322004-11-08 10:52:06 +000026085 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026086}
26087
26088
26089static int
26090test_xmlAllocParserInputBuffer(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026091 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026092
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000026093 int mem_base;
26094 xmlParserInputBufferPtr ret_val;
26095 xmlCharEncoding enc; /* the charset encoding if known */
26096 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026097
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000026098 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
26099 mem_base = xmlMemBlocks();
26100 enc = gen_xmlCharEncoding(n_enc, 0);
26101
26102 ret_val = xmlAllocParserInputBuffer(enc);
26103 desret_xmlParserInputBufferPtr(ret_val);
26104 call_tests++;
26105 des_xmlCharEncoding(n_enc, enc, 0);
26106 xmlResetLastError();
26107 if (mem_base != xmlMemBlocks()) {
26108 printf("Leak of %d blocks found in xmlAllocParserInputBuffer",
26109 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026110 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000026111 printf(" %d", n_enc);
26112 printf("\n");
26113 }
26114 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000026115 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026116
Daniel Veillard42595322004-11-08 10:52:06 +000026117 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026118}
26119
26120
26121static int
26122test_xmlCheckFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026123 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026124
26125 int mem_base;
26126 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026127 char * path; /* the path to check */
Daniel Veillardd93f6252004-11-02 15:53:51 +000026128 int n_path;
26129
26130 for (n_path = 0;n_path < gen_nb_const_char_ptr;n_path++) {
26131 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026132 path = gen_const_char_ptr(n_path, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026133
William M. Brackf13f77f2004-11-12 16:03:48 +000026134 ret_val = xmlCheckFilename((const char *)path);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026135 desret_int(ret_val);
26136 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000026137 des_const_char_ptr(n_path, (const char *)path, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026138 xmlResetLastError();
26139 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026140 printf("Leak of %d blocks found in xmlCheckFilename",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026141 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026142 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026143 printf(" %d", n_path);
26144 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026145 }
26146 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000026147 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026148
Daniel Veillard42595322004-11-08 10:52:06 +000026149 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026150}
26151
26152
26153static int
26154test_xmlCheckHTTPInput(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026155 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026156
Daniel Veillard42595322004-11-08 10:52:06 +000026157 int mem_base;
26158 xmlParserInputPtr ret_val;
26159 xmlParserCtxtPtr ctxt; /* an XML parser context */
26160 int n_ctxt;
26161 xmlParserInputPtr ret; /* an XML parser input */
26162 int n_ret;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026163
Daniel Veillard42595322004-11-08 10:52:06 +000026164 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
26165 for (n_ret = 0;n_ret < gen_nb_xmlParserInputPtr;n_ret++) {
26166 mem_base = xmlMemBlocks();
26167 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
26168 ret = gen_xmlParserInputPtr(n_ret, 1);
26169
26170 ret_val = xmlCheckHTTPInput(ctxt, ret);
26171 desret_xmlParserInputPtr(ret_val);
26172 call_tests++;
26173 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
26174 des_xmlParserInputPtr(n_ret, ret, 1);
26175 xmlResetLastError();
26176 if (mem_base != xmlMemBlocks()) {
26177 printf("Leak of %d blocks found in xmlCheckHTTPInput",
26178 xmlMemBlocks() - mem_base);
26179 test_ret++;
26180 printf(" %d", n_ctxt);
26181 printf(" %d", n_ret);
26182 printf("\n");
26183 }
26184 }
26185 }
Daniel Veillard42595322004-11-08 10:52:06 +000026186 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026187
Daniel Veillard42595322004-11-08 10:52:06 +000026188 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026189}
26190
26191
26192static int
26193test_xmlCleanupInputCallbacks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026194 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026195
26196 int mem_base;
26197
26198 mem_base = xmlMemBlocks();
26199
26200 xmlCleanupInputCallbacks();
26201 call_tests++;
26202 xmlResetLastError();
26203 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026204 printf("Leak of %d blocks found in xmlCleanupInputCallbacks",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026205 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026206 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026207 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026208 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000026209 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026210
Daniel Veillard42595322004-11-08 10:52:06 +000026211 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026212}
26213
26214
26215static int
26216test_xmlCleanupOutputCallbacks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026217 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026218
26219#ifdef LIBXML_OUTPUT_ENABLED
26220 int mem_base;
26221
26222 mem_base = xmlMemBlocks();
26223
26224 xmlCleanupOutputCallbacks();
26225 call_tests++;
26226 xmlResetLastError();
26227 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026228 printf("Leak of %d blocks found in xmlCleanupOutputCallbacks",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026229 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026230 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026231 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026232 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026233 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026234#endif
26235
Daniel Veillard42595322004-11-08 10:52:06 +000026236 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026237}
26238
26239
26240static int
26241test_xmlFileClose(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026242 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026243
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026244 int mem_base;
26245 int ret_val;
26246 void * context; /* the I/O context */
26247 int n_context;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026248
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026249 for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
26250 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026251 context = gen_void_ptr(n_context, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026252
26253 ret_val = xmlFileClose(context);
26254 desret_int(ret_val);
26255 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026256 des_void_ptr(n_context, context, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026257 xmlResetLastError();
26258 if (mem_base != xmlMemBlocks()) {
26259 printf("Leak of %d blocks found in xmlFileClose",
26260 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026261 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026262 printf(" %d", n_context);
26263 printf("\n");
26264 }
26265 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000026266 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026267
Daniel Veillard42595322004-11-08 10:52:06 +000026268 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026269}
26270
26271
26272static int
26273test_xmlFileMatch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026274 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026275
26276 int mem_base;
26277 int ret_val;
26278 const char * filename; /* the URI for matching */
26279 int n_filename;
26280
26281 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
26282 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026283 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026284
26285 ret_val = xmlFileMatch(filename);
26286 desret_int(ret_val);
26287 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026288 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026289 xmlResetLastError();
26290 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026291 printf("Leak of %d blocks found in xmlFileMatch",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026292 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026293 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026294 printf(" %d", n_filename);
26295 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026296 }
26297 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000026298 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026299
Daniel Veillard42595322004-11-08 10:52:06 +000026300 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026301}
26302
26303
26304static int
26305test_xmlFileOpen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026306 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026307
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026308 int mem_base;
26309 void * ret_val;
26310 const char * filename; /* the URI for matching */
26311 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026312
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026313 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
26314 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026315 filename = gen_filepath(n_filename, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026316
26317 ret_val = xmlFileOpen(filename);
26318 desret_void_ptr(ret_val);
26319 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026320 des_filepath(n_filename, filename, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026321 xmlResetLastError();
26322 if (mem_base != xmlMemBlocks()) {
26323 printf("Leak of %d blocks found in xmlFileOpen",
26324 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026325 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026326 printf(" %d", n_filename);
26327 printf("\n");
26328 }
26329 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000026330 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026331
Daniel Veillard42595322004-11-08 10:52:06 +000026332 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026333}
26334
26335
26336static int
26337test_xmlFileRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026338 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026339
Daniel Veillardce682bc2004-11-05 17:22:25 +000026340 int mem_base;
26341 int ret_val;
26342 void * context; /* the I/O context */
26343 int n_context;
26344 char * buffer; /* where to drop data */
26345 int n_buffer;
26346 int len; /* number of bytes to write */
26347 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026348
Daniel Veillardce682bc2004-11-05 17:22:25 +000026349 for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
26350 for (n_buffer = 0;n_buffer < gen_nb_char_ptr;n_buffer++) {
26351 for (n_len = 0;n_len < gen_nb_int;n_len++) {
26352 mem_base = xmlMemBlocks();
26353 context = gen_void_ptr(n_context, 0);
26354 buffer = gen_char_ptr(n_buffer, 1);
26355 len = gen_int(n_len, 2);
26356
26357 ret_val = xmlFileRead(context, buffer, len);
26358 desret_int(ret_val);
26359 call_tests++;
26360 des_void_ptr(n_context, context, 0);
26361 des_char_ptr(n_buffer, buffer, 1);
26362 des_int(n_len, len, 2);
26363 xmlResetLastError();
26364 if (mem_base != xmlMemBlocks()) {
26365 printf("Leak of %d blocks found in xmlFileRead",
26366 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026367 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026368 printf(" %d", n_context);
26369 printf(" %d", n_buffer);
26370 printf(" %d", n_len);
26371 printf("\n");
26372 }
26373 }
26374 }
26375 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000026376 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026377
Daniel Veillard42595322004-11-08 10:52:06 +000026378 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026379}
26380
26381
26382static int
26383test_xmlIOFTPClose(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026384 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026385
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026386#ifdef LIBXML_FTP_ENABLED
26387 int mem_base;
26388 int ret_val;
26389 void * context; /* the I/O context */
26390 int n_context;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026391
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026392 for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
26393 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026394 context = gen_void_ptr(n_context, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026395
26396 ret_val = xmlIOFTPClose(context);
26397 desret_int(ret_val);
26398 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026399 des_void_ptr(n_context, context, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026400 xmlResetLastError();
26401 if (mem_base != xmlMemBlocks()) {
26402 printf("Leak of %d blocks found in xmlIOFTPClose",
26403 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026404 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026405 printf(" %d", n_context);
26406 printf("\n");
26407 }
26408 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026409 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026410#endif
26411
Daniel Veillard42595322004-11-08 10:52:06 +000026412 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026413}
26414
26415
26416static int
26417test_xmlIOFTPMatch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026418 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026419
26420#ifdef LIBXML_FTP_ENABLED
26421 int mem_base;
26422 int ret_val;
26423 const char * filename; /* the URI for matching */
26424 int n_filename;
26425
26426 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
26427 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026428 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026429
26430 ret_val = xmlIOFTPMatch(filename);
26431 desret_int(ret_val);
26432 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026433 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026434 xmlResetLastError();
26435 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026436 printf("Leak of %d blocks found in xmlIOFTPMatch",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026437 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026438 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026439 printf(" %d", n_filename);
26440 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026441 }
26442 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026443 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026444#endif
26445
Daniel Veillard42595322004-11-08 10:52:06 +000026446 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026447}
26448
26449
26450static int
26451test_xmlIOFTPOpen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026452 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026453
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026454#ifdef LIBXML_FTP_ENABLED
26455 int mem_base;
26456 void * ret_val;
26457 const char * filename; /* the URI for matching */
26458 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026459
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026460 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
26461 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026462 filename = gen_filepath(n_filename, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026463
26464 ret_val = xmlIOFTPOpen(filename);
26465 desret_void_ptr(ret_val);
26466 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026467 des_filepath(n_filename, filename, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026468 xmlResetLastError();
26469 if (mem_base != xmlMemBlocks()) {
26470 printf("Leak of %d blocks found in xmlIOFTPOpen",
26471 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026472 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026473 printf(" %d", n_filename);
26474 printf("\n");
26475 }
26476 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026477 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026478#endif
26479
Daniel Veillard42595322004-11-08 10:52:06 +000026480 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026481}
26482
26483
26484static int
26485test_xmlIOFTPRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026486 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026487
Daniel Veillardce682bc2004-11-05 17:22:25 +000026488#ifdef LIBXML_FTP_ENABLED
26489 int mem_base;
26490 int ret_val;
26491 void * context; /* the I/O context */
26492 int n_context;
26493 char * buffer; /* where to drop data */
26494 int n_buffer;
26495 int len; /* number of bytes to write */
26496 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026497
Daniel Veillardce682bc2004-11-05 17:22:25 +000026498 for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
26499 for (n_buffer = 0;n_buffer < gen_nb_char_ptr;n_buffer++) {
26500 for (n_len = 0;n_len < gen_nb_int;n_len++) {
26501 mem_base = xmlMemBlocks();
26502 context = gen_void_ptr(n_context, 0);
26503 buffer = gen_char_ptr(n_buffer, 1);
26504 len = gen_int(n_len, 2);
26505
26506 ret_val = xmlIOFTPRead(context, buffer, len);
26507 desret_int(ret_val);
26508 call_tests++;
26509 des_void_ptr(n_context, context, 0);
26510 des_char_ptr(n_buffer, buffer, 1);
26511 des_int(n_len, len, 2);
26512 xmlResetLastError();
26513 if (mem_base != xmlMemBlocks()) {
26514 printf("Leak of %d blocks found in xmlIOFTPRead",
26515 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026516 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026517 printf(" %d", n_context);
26518 printf(" %d", n_buffer);
26519 printf(" %d", n_len);
26520 printf("\n");
26521 }
26522 }
26523 }
26524 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026525 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026526#endif
26527
Daniel Veillard42595322004-11-08 10:52:06 +000026528 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026529}
26530
26531
26532static int
26533test_xmlIOHTTPClose(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026534 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026535
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026536#ifdef LIBXML_HTTP_ENABLED
26537 int mem_base;
26538 int ret_val;
26539 void * context; /* the I/O context */
26540 int n_context;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026541
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026542 for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
26543 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026544 context = gen_void_ptr(n_context, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026545
26546 ret_val = xmlIOHTTPClose(context);
26547 desret_int(ret_val);
26548 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026549 des_void_ptr(n_context, context, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026550 xmlResetLastError();
26551 if (mem_base != xmlMemBlocks()) {
26552 printf("Leak of %d blocks found in xmlIOHTTPClose",
26553 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026554 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026555 printf(" %d", n_context);
26556 printf("\n");
26557 }
26558 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026559 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026560#endif
26561
Daniel Veillard42595322004-11-08 10:52:06 +000026562 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026563}
26564
26565
26566static int
26567test_xmlIOHTTPMatch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026568 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026569
26570#ifdef LIBXML_HTTP_ENABLED
26571 int mem_base;
26572 int ret_val;
26573 const char * filename; /* the URI for matching */
26574 int n_filename;
26575
26576 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
26577 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026578 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026579
26580 ret_val = xmlIOHTTPMatch(filename);
26581 desret_int(ret_val);
26582 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026583 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026584 xmlResetLastError();
26585 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026586 printf("Leak of %d blocks found in xmlIOHTTPMatch",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026587 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026588 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026589 printf(" %d", n_filename);
26590 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026591 }
26592 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026593 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026594#endif
26595
Daniel Veillard42595322004-11-08 10:52:06 +000026596 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026597}
26598
26599
26600static int
26601test_xmlIOHTTPOpen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026602 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026603
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026604#ifdef LIBXML_HTTP_ENABLED
26605 int mem_base;
26606 void * ret_val;
26607 const char * filename; /* the URI for matching */
26608 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026609
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026610 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
26611 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026612 filename = gen_filepath(n_filename, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026613
26614 ret_val = xmlIOHTTPOpen(filename);
26615 desret_void_ptr(ret_val);
26616 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026617 des_filepath(n_filename, filename, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026618 xmlResetLastError();
26619 if (mem_base != xmlMemBlocks()) {
26620 printf("Leak of %d blocks found in xmlIOHTTPOpen",
26621 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026622 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026623 printf(" %d", n_filename);
26624 printf("\n");
26625 }
26626 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026627 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026628#endif
26629
Daniel Veillard42595322004-11-08 10:52:06 +000026630 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026631}
26632
26633
26634static int
26635test_xmlIOHTTPOpenW(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026636 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026637
26638
26639 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000026640 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026641}
26642
26643
26644static int
26645test_xmlIOHTTPRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026646 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026647
Daniel Veillardce682bc2004-11-05 17:22:25 +000026648#ifdef LIBXML_HTTP_ENABLED
26649 int mem_base;
26650 int ret_val;
26651 void * context; /* the I/O context */
26652 int n_context;
26653 char * buffer; /* where to drop data */
26654 int n_buffer;
26655 int len; /* number of bytes to write */
26656 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026657
Daniel Veillardce682bc2004-11-05 17:22:25 +000026658 for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
26659 for (n_buffer = 0;n_buffer < gen_nb_char_ptr;n_buffer++) {
26660 for (n_len = 0;n_len < gen_nb_int;n_len++) {
26661 mem_base = xmlMemBlocks();
26662 context = gen_void_ptr(n_context, 0);
26663 buffer = gen_char_ptr(n_buffer, 1);
26664 len = gen_int(n_len, 2);
26665
26666 ret_val = xmlIOHTTPRead(context, buffer, len);
26667 desret_int(ret_val);
26668 call_tests++;
26669 des_void_ptr(n_context, context, 0);
26670 des_char_ptr(n_buffer, buffer, 1);
26671 des_int(n_len, len, 2);
26672 xmlResetLastError();
26673 if (mem_base != xmlMemBlocks()) {
26674 printf("Leak of %d blocks found in xmlIOHTTPRead",
26675 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026676 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026677 printf(" %d", n_context);
26678 printf(" %d", n_buffer);
26679 printf(" %d", n_len);
26680 printf("\n");
26681 }
26682 }
26683 }
26684 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026685 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026686#endif
26687
Daniel Veillard42595322004-11-08 10:52:06 +000026688 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026689}
26690
26691
26692static int
26693test_xmlNoNetExternalEntityLoader(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026694 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026695
Daniel Veillard42595322004-11-08 10:52:06 +000026696 int mem_base;
26697 xmlParserInputPtr ret_val;
26698 const char * URL; /* the URL for the entity to load */
26699 int n_URL;
26700 char * ID; /* the System ID for the entity to load */
26701 int n_ID;
26702 xmlParserCtxtPtr ctxt; /* the context in which the entity is called or NULL */
26703 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026704
Daniel Veillard42595322004-11-08 10:52:06 +000026705 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
26706 for (n_ID = 0;n_ID < gen_nb_const_char_ptr;n_ID++) {
26707 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
26708 mem_base = xmlMemBlocks();
26709 URL = gen_filepath(n_URL, 0);
26710 ID = gen_const_char_ptr(n_ID, 1);
26711 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 2);
26712
William M. Brackf13f77f2004-11-12 16:03:48 +000026713 ret_val = xmlNoNetExternalEntityLoader(URL, (const char *)ID, ctxt);
Daniel Veillard42595322004-11-08 10:52:06 +000026714 desret_xmlParserInputPtr(ret_val);
26715 call_tests++;
26716 des_filepath(n_URL, URL, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000026717 des_const_char_ptr(n_ID, (const char *)ID, 1);
Daniel Veillard42595322004-11-08 10:52:06 +000026718 des_xmlParserCtxtPtr(n_ctxt, ctxt, 2);
26719 xmlResetLastError();
26720 if (mem_base != xmlMemBlocks()) {
26721 printf("Leak of %d blocks found in xmlNoNetExternalEntityLoader",
26722 xmlMemBlocks() - mem_base);
26723 test_ret++;
26724 printf(" %d", n_URL);
26725 printf(" %d", n_ID);
26726 printf(" %d", n_ctxt);
26727 printf("\n");
26728 }
26729 }
26730 }
26731 }
Daniel Veillard42595322004-11-08 10:52:06 +000026732 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026733
Daniel Veillard42595322004-11-08 10:52:06 +000026734 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026735}
26736
26737
26738static int
26739test_xmlNormalizeWindowsPath(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026740 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026741
Daniel Veillard8a32fe42004-11-02 22:10:16 +000026742 int mem_base;
26743 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026744 xmlChar * path; /* the input file path */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000026745 int n_path;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026746
Daniel Veillard8a32fe42004-11-02 22:10:16 +000026747 for (n_path = 0;n_path < gen_nb_const_xmlChar_ptr;n_path++) {
26748 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026749 path = gen_const_xmlChar_ptr(n_path, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000026750
William M. Brackf13f77f2004-11-12 16:03:48 +000026751 ret_val = xmlNormalizeWindowsPath((const xmlChar *)path);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000026752 desret_xmlChar_ptr(ret_val);
26753 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000026754 des_const_xmlChar_ptr(n_path, (const xmlChar *)path, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000026755 xmlResetLastError();
26756 if (mem_base != xmlMemBlocks()) {
26757 printf("Leak of %d blocks found in xmlNormalizeWindowsPath",
26758 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026759 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000026760 printf(" %d", n_path);
26761 printf("\n");
26762 }
26763 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000026764 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026765
Daniel Veillard42595322004-11-08 10:52:06 +000026766 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026767}
26768
26769
26770static int
26771test_xmlOutputBufferCreateFd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026772 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026773
Daniel Veillard3d95c732004-11-06 22:25:14 +000026774#ifdef LIBXML_OUTPUT_ENABLED
26775 int mem_base;
26776 xmlOutputBufferPtr ret_val;
26777 int fd; /* a file descriptor number */
26778 int n_fd;
26779 xmlCharEncodingHandlerPtr encoder; /* the encoding converter or NULL */
26780 int n_encoder;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026781
Daniel Veillard3d95c732004-11-06 22:25:14 +000026782 for (n_fd = 0;n_fd < gen_nb_int;n_fd++) {
26783 for (n_encoder = 0;n_encoder < gen_nb_xmlCharEncodingHandlerPtr;n_encoder++) {
26784 mem_base = xmlMemBlocks();
26785 fd = gen_int(n_fd, 0);
26786 encoder = gen_xmlCharEncodingHandlerPtr(n_encoder, 1);
26787
26788 ret_val = xmlOutputBufferCreateFd(fd, encoder);
26789 desret_xmlOutputBufferPtr(ret_val);
26790 call_tests++;
26791 des_int(n_fd, fd, 0);
26792 des_xmlCharEncodingHandlerPtr(n_encoder, encoder, 1);
26793 xmlResetLastError();
26794 if (mem_base != xmlMemBlocks()) {
26795 printf("Leak of %d blocks found in xmlOutputBufferCreateFd",
26796 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026797 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000026798 printf(" %d", n_fd);
26799 printf(" %d", n_encoder);
26800 printf("\n");
26801 }
26802 }
26803 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026804 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000026805#endif
26806
Daniel Veillard42595322004-11-08 10:52:06 +000026807 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026808}
26809
26810
26811static int
26812test_xmlOutputBufferCreateFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026813 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026814
Daniel Veillard3d95c732004-11-06 22:25:14 +000026815#ifdef LIBXML_OUTPUT_ENABLED
26816 int mem_base;
26817 xmlOutputBufferPtr ret_val;
26818 FILE * file; /* a FILE* */
26819 int n_file;
26820 xmlCharEncodingHandlerPtr encoder; /* the encoding converter or NULL */
26821 int n_encoder;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026822
Daniel Veillard3d95c732004-11-06 22:25:14 +000026823 for (n_file = 0;n_file < gen_nb_FILE_ptr;n_file++) {
26824 for (n_encoder = 0;n_encoder < gen_nb_xmlCharEncodingHandlerPtr;n_encoder++) {
26825 mem_base = xmlMemBlocks();
26826 file = gen_FILE_ptr(n_file, 0);
26827 encoder = gen_xmlCharEncodingHandlerPtr(n_encoder, 1);
26828
26829 ret_val = xmlOutputBufferCreateFile(file, encoder);
26830 desret_xmlOutputBufferPtr(ret_val);
26831 call_tests++;
26832 des_FILE_ptr(n_file, file, 0);
26833 des_xmlCharEncodingHandlerPtr(n_encoder, encoder, 1);
26834 xmlResetLastError();
26835 if (mem_base != xmlMemBlocks()) {
26836 printf("Leak of %d blocks found in xmlOutputBufferCreateFile",
26837 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026838 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000026839 printf(" %d", n_file);
26840 printf(" %d", n_encoder);
26841 printf("\n");
26842 }
26843 }
26844 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026845 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000026846#endif
26847
Daniel Veillard42595322004-11-08 10:52:06 +000026848 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026849}
26850
26851
26852static int
26853test_xmlOutputBufferCreateFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026854 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026855
Daniel Veillard3d95c732004-11-06 22:25:14 +000026856#ifdef LIBXML_OUTPUT_ENABLED
26857 int mem_base;
26858 xmlOutputBufferPtr ret_val;
26859 const char * URI; /* a C string containing the URI or filename */
26860 int n_URI;
26861 xmlCharEncodingHandlerPtr encoder; /* the encoding converter or NULL */
26862 int n_encoder;
26863 int compression; /* the compression ration (0 none, 9 max). */
26864 int n_compression;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026865
Daniel Veillard42595322004-11-08 10:52:06 +000026866 for (n_URI = 0;n_URI < gen_nb_fileoutput;n_URI++) {
Daniel Veillard3d95c732004-11-06 22:25:14 +000026867 for (n_encoder = 0;n_encoder < gen_nb_xmlCharEncodingHandlerPtr;n_encoder++) {
26868 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
26869 mem_base = xmlMemBlocks();
Daniel Veillard42595322004-11-08 10:52:06 +000026870 URI = gen_fileoutput(n_URI, 0);
Daniel Veillard3d95c732004-11-06 22:25:14 +000026871 encoder = gen_xmlCharEncodingHandlerPtr(n_encoder, 1);
26872 compression = gen_int(n_compression, 2);
26873
26874 ret_val = xmlOutputBufferCreateFilename(URI, encoder, compression);
26875 desret_xmlOutputBufferPtr(ret_val);
26876 call_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000026877 des_fileoutput(n_URI, URI, 0);
Daniel Veillard3d95c732004-11-06 22:25:14 +000026878 des_xmlCharEncodingHandlerPtr(n_encoder, encoder, 1);
26879 des_int(n_compression, compression, 2);
26880 xmlResetLastError();
26881 if (mem_base != xmlMemBlocks()) {
26882 printf("Leak of %d blocks found in xmlOutputBufferCreateFilename",
26883 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026884 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000026885 printf(" %d", n_URI);
26886 printf(" %d", n_encoder);
26887 printf(" %d", n_compression);
26888 printf("\n");
26889 }
26890 }
26891 }
26892 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026893 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000026894#endif
26895
Daniel Veillard42595322004-11-08 10:52:06 +000026896 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026897}
26898
26899
26900static int
26901test_xmlOutputBufferFlush(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026902 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026903
Daniel Veillard3d97e662004-11-04 10:49:00 +000026904#ifdef LIBXML_OUTPUT_ENABLED
26905 int mem_base;
26906 int ret_val;
26907 xmlOutputBufferPtr out; /* a buffered output */
26908 int n_out;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026909
Daniel Veillard3d97e662004-11-04 10:49:00 +000026910 for (n_out = 0;n_out < gen_nb_xmlOutputBufferPtr;n_out++) {
26911 mem_base = xmlMemBlocks();
26912 out = gen_xmlOutputBufferPtr(n_out, 0);
26913
26914 ret_val = xmlOutputBufferFlush(out);
26915 desret_int(ret_val);
26916 call_tests++;
26917 des_xmlOutputBufferPtr(n_out, out, 0);
26918 xmlResetLastError();
26919 if (mem_base != xmlMemBlocks()) {
26920 printf("Leak of %d blocks found in xmlOutputBufferFlush",
26921 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026922 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026923 printf(" %d", n_out);
26924 printf("\n");
26925 }
26926 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026927 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026928#endif
26929
Daniel Veillard42595322004-11-08 10:52:06 +000026930 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026931}
26932
26933
26934static int
26935test_xmlOutputBufferWrite(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026936 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026937
Daniel Veillard3d97e662004-11-04 10:49:00 +000026938#ifdef LIBXML_OUTPUT_ENABLED
26939 int mem_base;
26940 int ret_val;
26941 xmlOutputBufferPtr out; /* a buffered parser output */
26942 int n_out;
26943 int len; /* the size in bytes of the array. */
26944 int n_len;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026945 char * buf; /* an char array */
Daniel Veillard3d97e662004-11-04 10:49:00 +000026946 int n_buf;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026947
Daniel Veillard3d97e662004-11-04 10:49:00 +000026948 for (n_out = 0;n_out < gen_nb_xmlOutputBufferPtr;n_out++) {
26949 for (n_len = 0;n_len < gen_nb_int;n_len++) {
26950 for (n_buf = 0;n_buf < gen_nb_const_char_ptr;n_buf++) {
26951 mem_base = xmlMemBlocks();
26952 out = gen_xmlOutputBufferPtr(n_out, 0);
26953 len = gen_int(n_len, 1);
26954 buf = gen_const_char_ptr(n_buf, 2);
26955
William M. Brackf13f77f2004-11-12 16:03:48 +000026956 ret_val = xmlOutputBufferWrite(out, len, (const char *)buf);
Daniel Veillard3d97e662004-11-04 10:49:00 +000026957 desret_int(ret_val);
26958 call_tests++;
26959 des_xmlOutputBufferPtr(n_out, out, 0);
26960 des_int(n_len, len, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000026961 des_const_char_ptr(n_buf, (const char *)buf, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +000026962 xmlResetLastError();
26963 if (mem_base != xmlMemBlocks()) {
26964 printf("Leak of %d blocks found in xmlOutputBufferWrite",
26965 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026966 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026967 printf(" %d", n_out);
26968 printf(" %d", n_len);
26969 printf(" %d", n_buf);
26970 printf("\n");
26971 }
26972 }
26973 }
26974 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026975 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026976#endif
26977
Daniel Veillard42595322004-11-08 10:52:06 +000026978 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026979}
26980
26981
26982static int
26983test_xmlOutputBufferWriteEscape(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026984 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026985
26986
26987 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000026988 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026989}
26990
26991
26992static int
26993test_xmlOutputBufferWriteString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026994 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026995
Daniel Veillard3d97e662004-11-04 10:49:00 +000026996#ifdef LIBXML_OUTPUT_ENABLED
26997 int mem_base;
26998 int ret_val;
26999 xmlOutputBufferPtr out; /* a buffered parser output */
27000 int n_out;
Daniel Veillardce682bc2004-11-05 17:22:25 +000027001 char * str; /* a zero terminated C string */
Daniel Veillard3d97e662004-11-04 10:49:00 +000027002 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027003
Daniel Veillard3d97e662004-11-04 10:49:00 +000027004 for (n_out = 0;n_out < gen_nb_xmlOutputBufferPtr;n_out++) {
27005 for (n_str = 0;n_str < gen_nb_const_char_ptr;n_str++) {
27006 mem_base = xmlMemBlocks();
27007 out = gen_xmlOutputBufferPtr(n_out, 0);
27008 str = gen_const_char_ptr(n_str, 1);
27009
William M. Brackf13f77f2004-11-12 16:03:48 +000027010 ret_val = xmlOutputBufferWriteString(out, (const char *)str);
Daniel Veillard3d97e662004-11-04 10:49:00 +000027011 desret_int(ret_val);
27012 call_tests++;
27013 des_xmlOutputBufferPtr(n_out, out, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000027014 des_const_char_ptr(n_str, (const char *)str, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000027015 xmlResetLastError();
27016 if (mem_base != xmlMemBlocks()) {
27017 printf("Leak of %d blocks found in xmlOutputBufferWriteString",
27018 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027019 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000027020 printf(" %d", n_out);
27021 printf(" %d", n_str);
27022 printf("\n");
27023 }
27024 }
27025 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027026 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000027027#endif
27028
Daniel Veillard42595322004-11-08 10:52:06 +000027029 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027030}
27031
27032
27033static int
27034test_xmlParserGetDirectory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027035 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027036
27037
27038 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000027039 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027040}
27041
27042
27043static int
27044test_xmlParserInputBufferCreateFd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027045 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027046
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027047 int mem_base;
27048 xmlParserInputBufferPtr ret_val;
27049 int fd; /* a file descriptor number */
27050 int n_fd;
27051 xmlCharEncoding enc; /* the charset encoding if known */
27052 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027053
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027054 for (n_fd = 0;n_fd < gen_nb_int;n_fd++) {
27055 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
27056 mem_base = xmlMemBlocks();
27057 fd = gen_int(n_fd, 0);
27058 enc = gen_xmlCharEncoding(n_enc, 1);
27059 if (fd >= 0) fd = -1;
27060
27061 ret_val = xmlParserInputBufferCreateFd(fd, enc);
27062 desret_xmlParserInputBufferPtr(ret_val);
27063 call_tests++;
27064 des_int(n_fd, fd, 0);
27065 des_xmlCharEncoding(n_enc, enc, 1);
27066 xmlResetLastError();
27067 if (mem_base != xmlMemBlocks()) {
27068 printf("Leak of %d blocks found in xmlParserInputBufferCreateFd",
27069 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027070 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027071 printf(" %d", n_fd);
27072 printf(" %d", n_enc);
27073 printf("\n");
27074 }
27075 }
27076 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027077 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027078
Daniel Veillard42595322004-11-08 10:52:06 +000027079 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027080}
27081
27082
27083static int
27084test_xmlParserInputBufferCreateFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027085 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027086
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027087 int mem_base;
27088 xmlParserInputBufferPtr ret_val;
27089 FILE * file; /* a FILE* */
27090 int n_file;
27091 xmlCharEncoding enc; /* the charset encoding if known */
27092 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027093
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027094 for (n_file = 0;n_file < gen_nb_FILE_ptr;n_file++) {
27095 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
27096 mem_base = xmlMemBlocks();
27097 file = gen_FILE_ptr(n_file, 0);
27098 enc = gen_xmlCharEncoding(n_enc, 1);
27099
27100 ret_val = xmlParserInputBufferCreateFile(file, enc);
27101 desret_xmlParserInputBufferPtr(ret_val);
27102 call_tests++;
27103 des_FILE_ptr(n_file, file, 0);
27104 des_xmlCharEncoding(n_enc, enc, 1);
27105 xmlResetLastError();
27106 if (mem_base != xmlMemBlocks()) {
27107 printf("Leak of %d blocks found in xmlParserInputBufferCreateFile",
27108 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027109 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027110 printf(" %d", n_file);
27111 printf(" %d", n_enc);
27112 printf("\n");
27113 }
27114 }
27115 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027116 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027117
Daniel Veillard42595322004-11-08 10:52:06 +000027118 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027119}
27120
27121
27122static int
27123test_xmlParserInputBufferCreateFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027124 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027125
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027126 int mem_base;
27127 xmlParserInputBufferPtr ret_val;
27128 const char * URI; /* a C string containing the URI or filename */
27129 int n_URI;
27130 xmlCharEncoding enc; /* the charset encoding if known */
27131 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027132
Daniel Veillard42595322004-11-08 10:52:06 +000027133 for (n_URI = 0;n_URI < gen_nb_fileoutput;n_URI++) {
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027134 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
27135 mem_base = xmlMemBlocks();
Daniel Veillard42595322004-11-08 10:52:06 +000027136 URI = gen_fileoutput(n_URI, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027137 enc = gen_xmlCharEncoding(n_enc, 1);
27138
27139 ret_val = xmlParserInputBufferCreateFilename(URI, enc);
27140 desret_xmlParserInputBufferPtr(ret_val);
27141 call_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000027142 des_fileoutput(n_URI, URI, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027143 des_xmlCharEncoding(n_enc, enc, 1);
27144 xmlResetLastError();
27145 if (mem_base != xmlMemBlocks()) {
27146 printf("Leak of %d blocks found in xmlParserInputBufferCreateFilename",
27147 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027148 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027149 printf(" %d", n_URI);
27150 printf(" %d", n_enc);
27151 printf("\n");
27152 }
27153 }
27154 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027155 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027156
Daniel Veillard42595322004-11-08 10:52:06 +000027157 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027158}
27159
27160
27161static int
27162test_xmlParserInputBufferCreateMem(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027163 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027164
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027165 int mem_base;
27166 xmlParserInputBufferPtr ret_val;
27167 char * mem; /* the memory input */
27168 int n_mem;
27169 int size; /* the length of the memory block */
27170 int n_size;
27171 xmlCharEncoding enc; /* the charset encoding if known */
27172 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027173
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027174 for (n_mem = 0;n_mem < gen_nb_const_char_ptr;n_mem++) {
27175 for (n_size = 0;n_size < gen_nb_int;n_size++) {
27176 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
27177 mem_base = xmlMemBlocks();
27178 mem = gen_const_char_ptr(n_mem, 0);
27179 size = gen_int(n_size, 1);
27180 enc = gen_xmlCharEncoding(n_enc, 2);
27181
William M. Brackf13f77f2004-11-12 16:03:48 +000027182 ret_val = xmlParserInputBufferCreateMem((const char *)mem, size, enc);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027183 desret_xmlParserInputBufferPtr(ret_val);
27184 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000027185 des_const_char_ptr(n_mem, (const char *)mem, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027186 des_int(n_size, size, 1);
27187 des_xmlCharEncoding(n_enc, enc, 2);
27188 xmlResetLastError();
27189 if (mem_base != xmlMemBlocks()) {
27190 printf("Leak of %d blocks found in xmlParserInputBufferCreateMem",
27191 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027192 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027193 printf(" %d", n_mem);
27194 printf(" %d", n_size);
27195 printf(" %d", n_enc);
27196 printf("\n");
27197 }
27198 }
27199 }
27200 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027201 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027202
Daniel Veillard42595322004-11-08 10:52:06 +000027203 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027204}
27205
27206
27207static int
27208test_xmlParserInputBufferCreateStatic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027209 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027210
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027211 int mem_base;
27212 xmlParserInputBufferPtr ret_val;
27213 char * mem; /* the memory input */
27214 int n_mem;
27215 int size; /* the length of the memory block */
27216 int n_size;
27217 xmlCharEncoding enc; /* the charset encoding if known */
27218 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027219
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027220 for (n_mem = 0;n_mem < gen_nb_const_char_ptr;n_mem++) {
27221 for (n_size = 0;n_size < gen_nb_int;n_size++) {
27222 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
27223 mem_base = xmlMemBlocks();
27224 mem = gen_const_char_ptr(n_mem, 0);
27225 size = gen_int(n_size, 1);
27226 enc = gen_xmlCharEncoding(n_enc, 2);
27227
William M. Brackf13f77f2004-11-12 16:03:48 +000027228 ret_val = xmlParserInputBufferCreateStatic((const char *)mem, size, enc);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027229 desret_xmlParserInputBufferPtr(ret_val);
27230 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000027231 des_const_char_ptr(n_mem, (const char *)mem, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027232 des_int(n_size, size, 1);
27233 des_xmlCharEncoding(n_enc, enc, 2);
27234 xmlResetLastError();
27235 if (mem_base != xmlMemBlocks()) {
27236 printf("Leak of %d blocks found in xmlParserInputBufferCreateStatic",
27237 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027238 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027239 printf(" %d", n_mem);
27240 printf(" %d", n_size);
27241 printf(" %d", n_enc);
27242 printf("\n");
27243 }
27244 }
27245 }
27246 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027247 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027248
Daniel Veillard42595322004-11-08 10:52:06 +000027249 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027250}
27251
27252
27253static int
27254test_xmlParserInputBufferGrow(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027255 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027256
Daniel Veillard34099b42004-11-04 17:34:35 +000027257 int mem_base;
27258 int ret_val;
27259 xmlParserInputBufferPtr in; /* a buffered parser input */
27260 int n_in;
27261 int len; /* indicative value of the amount of chars to read */
27262 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027263
Daniel Veillard34099b42004-11-04 17:34:35 +000027264 for (n_in = 0;n_in < gen_nb_xmlParserInputBufferPtr;n_in++) {
27265 for (n_len = 0;n_len < gen_nb_int;n_len++) {
27266 mem_base = xmlMemBlocks();
27267 in = gen_xmlParserInputBufferPtr(n_in, 0);
27268 len = gen_int(n_len, 1);
27269
27270 ret_val = xmlParserInputBufferGrow(in, len);
27271 desret_int(ret_val);
27272 call_tests++;
27273 des_xmlParserInputBufferPtr(n_in, in, 0);
27274 des_int(n_len, len, 1);
27275 xmlResetLastError();
27276 if (mem_base != xmlMemBlocks()) {
27277 printf("Leak of %d blocks found in xmlParserInputBufferGrow",
27278 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027279 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000027280 printf(" %d", n_in);
27281 printf(" %d", n_len);
27282 printf("\n");
27283 }
27284 }
27285 }
Daniel Veillard34099b42004-11-04 17:34:35 +000027286 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027287
Daniel Veillard42595322004-11-08 10:52:06 +000027288 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027289}
27290
27291
27292static int
27293test_xmlParserInputBufferPush(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027294 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027295
Daniel Veillard34099b42004-11-04 17:34:35 +000027296 int mem_base;
27297 int ret_val;
27298 xmlParserInputBufferPtr in; /* a buffered parser input */
27299 int n_in;
27300 int len; /* the size in bytes of the array. */
27301 int n_len;
Daniel Veillardce682bc2004-11-05 17:22:25 +000027302 char * buf; /* an char array */
Daniel Veillard34099b42004-11-04 17:34:35 +000027303 int n_buf;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027304
Daniel Veillard34099b42004-11-04 17:34:35 +000027305 for (n_in = 0;n_in < gen_nb_xmlParserInputBufferPtr;n_in++) {
27306 for (n_len = 0;n_len < gen_nb_int;n_len++) {
27307 for (n_buf = 0;n_buf < gen_nb_const_char_ptr;n_buf++) {
27308 mem_base = xmlMemBlocks();
27309 in = gen_xmlParserInputBufferPtr(n_in, 0);
27310 len = gen_int(n_len, 1);
27311 buf = gen_const_char_ptr(n_buf, 2);
27312
William M. Brackf13f77f2004-11-12 16:03:48 +000027313 ret_val = xmlParserInputBufferPush(in, len, (const char *)buf);
Daniel Veillard34099b42004-11-04 17:34:35 +000027314 desret_int(ret_val);
27315 call_tests++;
27316 des_xmlParserInputBufferPtr(n_in, in, 0);
27317 des_int(n_len, len, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000027318 des_const_char_ptr(n_buf, (const char *)buf, 2);
Daniel Veillard34099b42004-11-04 17:34:35 +000027319 xmlResetLastError();
27320 if (mem_base != xmlMemBlocks()) {
27321 printf("Leak of %d blocks found in xmlParserInputBufferPush",
27322 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027323 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000027324 printf(" %d", n_in);
27325 printf(" %d", n_len);
27326 printf(" %d", n_buf);
27327 printf("\n");
27328 }
27329 }
27330 }
27331 }
Daniel Veillard34099b42004-11-04 17:34:35 +000027332 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027333
Daniel Veillard42595322004-11-08 10:52:06 +000027334 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027335}
27336
27337
27338static int
27339test_xmlParserInputBufferRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027340 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027341
Daniel Veillard34099b42004-11-04 17:34:35 +000027342 int mem_base;
27343 int ret_val;
27344 xmlParserInputBufferPtr in; /* a buffered parser input */
27345 int n_in;
27346 int len; /* indicative value of the amount of chars to read */
27347 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027348
Daniel Veillard34099b42004-11-04 17:34:35 +000027349 for (n_in = 0;n_in < gen_nb_xmlParserInputBufferPtr;n_in++) {
27350 for (n_len = 0;n_len < gen_nb_int;n_len++) {
27351 mem_base = xmlMemBlocks();
27352 in = gen_xmlParserInputBufferPtr(n_in, 0);
27353 len = gen_int(n_len, 1);
27354
27355 ret_val = xmlParserInputBufferRead(in, len);
27356 desret_int(ret_val);
27357 call_tests++;
27358 des_xmlParserInputBufferPtr(n_in, in, 0);
27359 des_int(n_len, len, 1);
27360 xmlResetLastError();
27361 if (mem_base != xmlMemBlocks()) {
27362 printf("Leak of %d blocks found in xmlParserInputBufferRead",
27363 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027364 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000027365 printf(" %d", n_in);
27366 printf(" %d", n_len);
27367 printf("\n");
27368 }
27369 }
27370 }
Daniel Veillard34099b42004-11-04 17:34:35 +000027371 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027372
Daniel Veillard42595322004-11-08 10:52:06 +000027373 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027374}
27375
27376
27377static int
27378test_xmlPopInputCallbacks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027379 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027380
27381 int mem_base;
27382 int ret_val;
27383
27384 mem_base = xmlMemBlocks();
27385
27386 ret_val = xmlPopInputCallbacks();
27387 desret_int(ret_val);
27388 call_tests++;
27389 xmlResetLastError();
27390 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000027391 printf("Leak of %d blocks found in xmlPopInputCallbacks",
Daniel Veillardd93f6252004-11-02 15:53:51 +000027392 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027393 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000027394 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000027395 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000027396 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027397
Daniel Veillard42595322004-11-08 10:52:06 +000027398 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027399}
27400
27401
27402static int
27403test_xmlRegisterDefaultInputCallbacks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027404 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027405
27406 int mem_base;
27407
27408 mem_base = xmlMemBlocks();
27409
27410 xmlRegisterDefaultInputCallbacks();
27411 call_tests++;
27412 xmlResetLastError();
27413 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000027414 printf("Leak of %d blocks found in xmlRegisterDefaultInputCallbacks",
Daniel Veillardd93f6252004-11-02 15:53:51 +000027415 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027416 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000027417 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000027418 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000027419 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027420
Daniel Veillard42595322004-11-08 10:52:06 +000027421 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027422}
27423
27424
27425static int
27426test_xmlRegisterDefaultOutputCallbacks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027427 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027428
27429#ifdef LIBXML_OUTPUT_ENABLED
27430 int mem_base;
27431
27432 mem_base = xmlMemBlocks();
27433
27434 xmlRegisterDefaultOutputCallbacks();
27435 call_tests++;
27436 xmlResetLastError();
27437 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000027438 printf("Leak of %d blocks found in xmlRegisterDefaultOutputCallbacks",
Daniel Veillardd93f6252004-11-02 15:53:51 +000027439 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027440 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000027441 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000027442 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027443 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027444#endif
27445
Daniel Veillard42595322004-11-08 10:52:06 +000027446 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027447}
27448
27449
27450static int
27451test_xmlRegisterHTTPPostCallbacks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027452 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027453
27454#ifdef LIBXML_HTTP_ENABLED
27455 int mem_base;
27456
27457 mem_base = xmlMemBlocks();
27458
27459 xmlRegisterHTTPPostCallbacks();
27460 call_tests++;
27461 xmlResetLastError();
27462 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000027463 printf("Leak of %d blocks found in xmlRegisterHTTPPostCallbacks",
Daniel Veillardd93f6252004-11-02 15:53:51 +000027464 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027465 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000027466 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000027467 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027468 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027469#endif
27470
Daniel Veillard42595322004-11-08 10:52:06 +000027471 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027472}
27473
27474static int
27475test_xmlIO(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027476 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027477
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027478 if (quiet == 0) printf("Testing xmlIO : 38 of 47 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000027479 test_ret += test_xmlAllocOutputBuffer();
27480 test_ret += test_xmlAllocParserInputBuffer();
27481 test_ret += test_xmlCheckFilename();
27482 test_ret += test_xmlCheckHTTPInput();
27483 test_ret += test_xmlCleanupInputCallbacks();
27484 test_ret += test_xmlCleanupOutputCallbacks();
27485 test_ret += test_xmlFileClose();
27486 test_ret += test_xmlFileMatch();
27487 test_ret += test_xmlFileOpen();
27488 test_ret += test_xmlFileRead();
27489 test_ret += test_xmlIOFTPClose();
27490 test_ret += test_xmlIOFTPMatch();
27491 test_ret += test_xmlIOFTPOpen();
27492 test_ret += test_xmlIOFTPRead();
27493 test_ret += test_xmlIOHTTPClose();
27494 test_ret += test_xmlIOHTTPMatch();
27495 test_ret += test_xmlIOHTTPOpen();
27496 test_ret += test_xmlIOHTTPOpenW();
27497 test_ret += test_xmlIOHTTPRead();
27498 test_ret += test_xmlNoNetExternalEntityLoader();
27499 test_ret += test_xmlNormalizeWindowsPath();
27500 test_ret += test_xmlOutputBufferCreateFd();
27501 test_ret += test_xmlOutputBufferCreateFile();
27502 test_ret += test_xmlOutputBufferCreateFilename();
27503 test_ret += test_xmlOutputBufferFlush();
27504 test_ret += test_xmlOutputBufferWrite();
27505 test_ret += test_xmlOutputBufferWriteEscape();
27506 test_ret += test_xmlOutputBufferWriteString();
27507 test_ret += test_xmlParserGetDirectory();
27508 test_ret += test_xmlParserInputBufferCreateFd();
27509 test_ret += test_xmlParserInputBufferCreateFile();
27510 test_ret += test_xmlParserInputBufferCreateFilename();
27511 test_ret += test_xmlParserInputBufferCreateMem();
27512 test_ret += test_xmlParserInputBufferCreateStatic();
27513 test_ret += test_xmlParserInputBufferGrow();
27514 test_ret += test_xmlParserInputBufferPush();
27515 test_ret += test_xmlParserInputBufferRead();
27516 test_ret += test_xmlPopInputCallbacks();
27517 test_ret += test_xmlRegisterDefaultInputCallbacks();
27518 test_ret += test_xmlRegisterDefaultOutputCallbacks();
27519 test_ret += test_xmlRegisterHTTPPostCallbacks();
Daniel Veillardd93f6252004-11-02 15:53:51 +000027520
Daniel Veillard42595322004-11-08 10:52:06 +000027521 if (test_ret != 0)
27522 printf("Module xmlIO: %d errors\n", test_ret);
27523 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027524}
Daniel Veillarda521d282004-11-09 14:59:59 +000027525#ifdef LIBXML_AUTOMATA_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000027526
Daniel Veillarda82b1822004-11-08 16:24:57 +000027527#define gen_nb_xmlAutomataPtr 1
27528static xmlAutomataPtr gen_xmlAutomataPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
27529 return(NULL);
27530}
27531static void des_xmlAutomataPtr(int no ATTRIBUTE_UNUSED, xmlAutomataPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
27532}
Daniel Veillarda521d282004-11-09 14:59:59 +000027533#endif
27534
Daniel Veillarda82b1822004-11-08 16:24:57 +000027535
27536static int
27537test_xmlAutomataCompile(void) {
27538 int test_ret = 0;
27539
27540
27541 /* missing type support */
27542 return(test_ret);
27543}
27544
27545
27546static int
27547test_xmlAutomataGetInitState(void) {
27548 int test_ret = 0;
27549
27550
27551 /* missing type support */
27552 return(test_ret);
27553}
27554
27555
27556static int
27557test_xmlAutomataIsDeterminist(void) {
27558 int test_ret = 0;
27559
27560#ifdef LIBXML_AUTOMATA_ENABLED
27561 int mem_base;
27562 int ret_val;
27563 xmlAutomataPtr am; /* an automata */
27564 int n_am;
27565
27566 for (n_am = 0;n_am < gen_nb_xmlAutomataPtr;n_am++) {
27567 mem_base = xmlMemBlocks();
27568 am = gen_xmlAutomataPtr(n_am, 0);
27569
27570 ret_val = xmlAutomataIsDeterminist(am);
27571 desret_int(ret_val);
27572 call_tests++;
27573 des_xmlAutomataPtr(n_am, am, 0);
27574 xmlResetLastError();
27575 if (mem_base != xmlMemBlocks()) {
27576 printf("Leak of %d blocks found in xmlAutomataIsDeterminist",
27577 xmlMemBlocks() - mem_base);
27578 test_ret++;
27579 printf(" %d", n_am);
27580 printf("\n");
27581 }
27582 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027583 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000027584#endif
27585
Daniel Veillarda82b1822004-11-08 16:24:57 +000027586 return(test_ret);
27587}
27588
Daniel Veillarda521d282004-11-09 14:59:59 +000027589#ifdef LIBXML_AUTOMATA_ENABLED
Daniel Veillarda82b1822004-11-08 16:24:57 +000027590
27591#define gen_nb_xmlAutomataStatePtr 1
27592static xmlAutomataStatePtr gen_xmlAutomataStatePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
27593 return(NULL);
27594}
27595static void des_xmlAutomataStatePtr(int no ATTRIBUTE_UNUSED, xmlAutomataStatePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
27596}
Daniel Veillarda521d282004-11-09 14:59:59 +000027597#endif
27598
Daniel Veillarda82b1822004-11-08 16:24:57 +000027599
27600static int
27601test_xmlAutomataNewAllTrans(void) {
27602 int test_ret = 0;
27603
27604
27605 /* missing type support */
27606 return(test_ret);
27607}
27608
27609
27610static int
27611test_xmlAutomataNewCountTrans(void) {
27612 int test_ret = 0;
27613
27614
27615 /* missing type support */
27616 return(test_ret);
27617}
27618
27619
27620static int
27621test_xmlAutomataNewCountTrans2(void) {
27622 int test_ret = 0;
27623
27624
27625 /* missing type support */
27626 return(test_ret);
27627}
27628
27629
27630static int
27631test_xmlAutomataNewCountedTrans(void) {
27632 int test_ret = 0;
27633
27634
27635 /* missing type support */
27636 return(test_ret);
27637}
27638
27639
27640static int
27641test_xmlAutomataNewCounter(void) {
27642 int test_ret = 0;
27643
27644#ifdef LIBXML_AUTOMATA_ENABLED
27645 int mem_base;
27646 int ret_val;
27647 xmlAutomataPtr am; /* an automata */
27648 int n_am;
27649 int min; /* the minimal value on the counter */
27650 int n_min;
27651 int max; /* the maximal value on the counter */
27652 int n_max;
27653
27654 for (n_am = 0;n_am < gen_nb_xmlAutomataPtr;n_am++) {
27655 for (n_min = 0;n_min < gen_nb_int;n_min++) {
27656 for (n_max = 0;n_max < gen_nb_int;n_max++) {
27657 mem_base = xmlMemBlocks();
27658 am = gen_xmlAutomataPtr(n_am, 0);
27659 min = gen_int(n_min, 1);
27660 max = gen_int(n_max, 2);
27661
27662 ret_val = xmlAutomataNewCounter(am, min, max);
27663 desret_int(ret_val);
27664 call_tests++;
27665 des_xmlAutomataPtr(n_am, am, 0);
27666 des_int(n_min, min, 1);
27667 des_int(n_max, max, 2);
27668 xmlResetLastError();
27669 if (mem_base != xmlMemBlocks()) {
27670 printf("Leak of %d blocks found in xmlAutomataNewCounter",
27671 xmlMemBlocks() - mem_base);
27672 test_ret++;
27673 printf(" %d", n_am);
27674 printf(" %d", n_min);
27675 printf(" %d", n_max);
27676 printf("\n");
27677 }
27678 }
27679 }
27680 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027681 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000027682#endif
27683
Daniel Veillarda82b1822004-11-08 16:24:57 +000027684 return(test_ret);
27685}
27686
27687
27688static int
27689test_xmlAutomataNewCounterTrans(void) {
27690 int test_ret = 0;
27691
27692
27693 /* missing type support */
27694 return(test_ret);
27695}
27696
27697
27698static int
27699test_xmlAutomataNewEpsilon(void) {
27700 int test_ret = 0;
27701
27702
27703 /* missing type support */
27704 return(test_ret);
27705}
27706
27707
27708static int
27709test_xmlAutomataNewOnceTrans(void) {
27710 int test_ret = 0;
27711
27712
27713 /* missing type support */
27714 return(test_ret);
27715}
27716
27717
27718static int
27719test_xmlAutomataNewOnceTrans2(void) {
27720 int test_ret = 0;
27721
27722
27723 /* missing type support */
27724 return(test_ret);
27725}
27726
27727
27728static int
27729test_xmlAutomataNewState(void) {
27730 int test_ret = 0;
27731
27732
27733 /* missing type support */
27734 return(test_ret);
27735}
27736
27737
27738static int
27739test_xmlAutomataNewTransition(void) {
27740 int test_ret = 0;
27741
27742
27743 /* missing type support */
27744 return(test_ret);
27745}
27746
27747
27748static int
27749test_xmlAutomataNewTransition2(void) {
27750 int test_ret = 0;
27751
27752
27753 /* missing type support */
27754 return(test_ret);
27755}
27756
27757
27758static int
27759test_xmlAutomataSetFinalState(void) {
27760 int test_ret = 0;
27761
27762#ifdef LIBXML_AUTOMATA_ENABLED
27763 int mem_base;
27764 int ret_val;
27765 xmlAutomataPtr am; /* an automata */
27766 int n_am;
27767 xmlAutomataStatePtr state; /* a state in this automata */
27768 int n_state;
27769
27770 for (n_am = 0;n_am < gen_nb_xmlAutomataPtr;n_am++) {
27771 for (n_state = 0;n_state < gen_nb_xmlAutomataStatePtr;n_state++) {
27772 mem_base = xmlMemBlocks();
27773 am = gen_xmlAutomataPtr(n_am, 0);
27774 state = gen_xmlAutomataStatePtr(n_state, 1);
27775
27776 ret_val = xmlAutomataSetFinalState(am, state);
27777 desret_int(ret_val);
27778 call_tests++;
27779 des_xmlAutomataPtr(n_am, am, 0);
27780 des_xmlAutomataStatePtr(n_state, state, 1);
27781 xmlResetLastError();
27782 if (mem_base != xmlMemBlocks()) {
27783 printf("Leak of %d blocks found in xmlAutomataSetFinalState",
27784 xmlMemBlocks() - mem_base);
27785 test_ret++;
27786 printf(" %d", n_am);
27787 printf(" %d", n_state);
27788 printf("\n");
27789 }
27790 }
27791 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027792 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000027793#endif
27794
Daniel Veillarda82b1822004-11-08 16:24:57 +000027795 return(test_ret);
27796}
27797
27798
27799static int
27800test_xmlNewAutomata(void) {
27801 int test_ret = 0;
27802
27803
27804 /* missing type support */
27805 return(test_ret);
27806}
27807
27808static int
27809test_xmlautomata(void) {
27810 int test_ret = 0;
27811
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027812 if (quiet == 0) printf("Testing xmlautomata : 3 of 18 functions ...\n");
Daniel Veillarda82b1822004-11-08 16:24:57 +000027813 test_ret += test_xmlAutomataCompile();
27814 test_ret += test_xmlAutomataGetInitState();
27815 test_ret += test_xmlAutomataIsDeterminist();
27816 test_ret += test_xmlAutomataNewAllTrans();
27817 test_ret += test_xmlAutomataNewCountTrans();
27818 test_ret += test_xmlAutomataNewCountTrans2();
27819 test_ret += test_xmlAutomataNewCountedTrans();
27820 test_ret += test_xmlAutomataNewCounter();
27821 test_ret += test_xmlAutomataNewCounterTrans();
27822 test_ret += test_xmlAutomataNewEpsilon();
27823 test_ret += test_xmlAutomataNewOnceTrans();
27824 test_ret += test_xmlAutomataNewOnceTrans2();
27825 test_ret += test_xmlAutomataNewState();
27826 test_ret += test_xmlAutomataNewTransition();
27827 test_ret += test_xmlAutomataNewTransition2();
27828 test_ret += test_xmlAutomataSetFinalState();
27829 test_ret += test_xmlNewAutomata();
27830
27831 if (test_ret != 0)
27832 printf("Module xmlautomata: %d errors\n", test_ret);
27833 return(test_ret);
27834}
27835
Daniel Veillardce682bc2004-11-05 17:22:25 +000027836#define gen_nb_xmlGenericErrorFunc_ptr 1
27837static xmlGenericErrorFunc * gen_xmlGenericErrorFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
27838 return(NULL);
27839}
27840static void des_xmlGenericErrorFunc_ptr(int no ATTRIBUTE_UNUSED, xmlGenericErrorFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
27841}
27842
Daniel Veillardd93f6252004-11-02 15:53:51 +000027843static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000027844test_initGenericErrorDefaultFunc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027845 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027846
Daniel Veillardce682bc2004-11-05 17:22:25 +000027847 int mem_base;
27848 xmlGenericErrorFunc * handler; /* the handler */
27849 int n_handler;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027850
Daniel Veillardce682bc2004-11-05 17:22:25 +000027851 for (n_handler = 0;n_handler < gen_nb_xmlGenericErrorFunc_ptr;n_handler++) {
27852 mem_base = xmlMemBlocks();
27853 handler = gen_xmlGenericErrorFunc_ptr(n_handler, 0);
27854
27855 initGenericErrorDefaultFunc(handler);
27856 call_tests++;
27857 des_xmlGenericErrorFunc_ptr(n_handler, handler, 0);
27858 xmlResetLastError();
27859 if (mem_base != xmlMemBlocks()) {
27860 printf("Leak of %d blocks found in initGenericErrorDefaultFunc",
27861 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027862 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000027863 printf(" %d", n_handler);
27864 printf("\n");
27865 }
27866 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000027867 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027868
Daniel Veillard42595322004-11-08 10:52:06 +000027869 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027870}
27871
27872
Daniel Veillardce682bc2004-11-05 17:22:25 +000027873#define gen_nb_xmlErrorPtr 1
27874static xmlErrorPtr gen_xmlErrorPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
27875 return(NULL);
27876}
27877static void des_xmlErrorPtr(int no ATTRIBUTE_UNUSED, xmlErrorPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
27878}
27879
Daniel Veillardd93f6252004-11-02 15:53:51 +000027880static int
27881test_xmlCopyError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027882 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027883
Daniel Veillardce682bc2004-11-05 17:22:25 +000027884 int mem_base;
27885 int ret_val;
27886 xmlErrorPtr from; /* a source error */
27887 int n_from;
27888 xmlErrorPtr to; /* a target error */
27889 int n_to;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027890
Daniel Veillardce682bc2004-11-05 17:22:25 +000027891 for (n_from = 0;n_from < gen_nb_xmlErrorPtr;n_from++) {
27892 for (n_to = 0;n_to < gen_nb_xmlErrorPtr;n_to++) {
27893 mem_base = xmlMemBlocks();
27894 from = gen_xmlErrorPtr(n_from, 0);
27895 to = gen_xmlErrorPtr(n_to, 1);
27896
27897 ret_val = xmlCopyError(from, to);
27898 desret_int(ret_val);
27899 call_tests++;
27900 des_xmlErrorPtr(n_from, from, 0);
27901 des_xmlErrorPtr(n_to, to, 1);
27902 xmlResetLastError();
27903 if (mem_base != xmlMemBlocks()) {
27904 printf("Leak of %d blocks found in xmlCopyError",
27905 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027906 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000027907 printf(" %d", n_from);
27908 printf(" %d", n_to);
27909 printf("\n");
27910 }
27911 }
27912 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000027913 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027914
Daniel Veillard42595322004-11-08 10:52:06 +000027915 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027916}
27917
27918
27919static int
27920test_xmlCtxtGetLastError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027921 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027922
27923
27924 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000027925 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027926}
27927
27928
27929static int
27930test_xmlCtxtResetLastError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027931 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027932
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000027933 int mem_base;
27934 void * ctx; /* an XML parser context */
27935 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027936
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000027937 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
27938 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000027939 ctx = gen_void_ptr(n_ctx, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000027940
27941 xmlCtxtResetLastError(ctx);
27942 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000027943 des_void_ptr(n_ctx, ctx, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000027944 xmlResetLastError();
27945 if (mem_base != xmlMemBlocks()) {
27946 printf("Leak of %d blocks found in xmlCtxtResetLastError",
27947 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027948 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000027949 printf(" %d", n_ctx);
27950 printf("\n");
27951 }
27952 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000027953 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027954
Daniel Veillard42595322004-11-08 10:52:06 +000027955 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027956}
27957
27958
27959static int
27960test_xmlGetLastError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027961 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027962
27963
27964 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000027965 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027966}
27967
27968
27969static int
27970test_xmlParserError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027971 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027972
27973
27974 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000027975 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027976}
27977
27978
27979static int
27980test_xmlParserPrintFileContext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027981 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027982
Daniel Veillardce682bc2004-11-05 17:22:25 +000027983 int mem_base;
27984 xmlParserInputPtr input; /* an xmlParserInputPtr input */
27985 int n_input;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027986
Daniel Veillardce682bc2004-11-05 17:22:25 +000027987 for (n_input = 0;n_input < gen_nb_xmlParserInputPtr;n_input++) {
27988 mem_base = xmlMemBlocks();
27989 input = gen_xmlParserInputPtr(n_input, 0);
27990
27991 xmlParserPrintFileContext(input);
27992 call_tests++;
27993 des_xmlParserInputPtr(n_input, input, 0);
27994 xmlResetLastError();
27995 if (mem_base != xmlMemBlocks()) {
27996 printf("Leak of %d blocks found in xmlParserPrintFileContext",
27997 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027998 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000027999 printf(" %d", n_input);
28000 printf("\n");
28001 }
28002 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000028003 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028004
Daniel Veillard42595322004-11-08 10:52:06 +000028005 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028006}
28007
28008
28009static int
28010test_xmlParserPrintFileInfo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028011 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028012
Daniel Veillardce682bc2004-11-05 17:22:25 +000028013 int mem_base;
28014 xmlParserInputPtr input; /* an xmlParserInputPtr input */
28015 int n_input;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028016
Daniel Veillardce682bc2004-11-05 17:22:25 +000028017 for (n_input = 0;n_input < gen_nb_xmlParserInputPtr;n_input++) {
28018 mem_base = xmlMemBlocks();
28019 input = gen_xmlParserInputPtr(n_input, 0);
28020
28021 xmlParserPrintFileInfo(input);
28022 call_tests++;
28023 des_xmlParserInputPtr(n_input, input, 0);
28024 xmlResetLastError();
28025 if (mem_base != xmlMemBlocks()) {
28026 printf("Leak of %d blocks found in xmlParserPrintFileInfo",
28027 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028028 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028029 printf(" %d", n_input);
28030 printf("\n");
28031 }
28032 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000028033 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028034
Daniel Veillard42595322004-11-08 10:52:06 +000028035 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028036}
28037
28038
28039static int
28040test_xmlParserValidityError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028041 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028042
28043
28044 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028045 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028046}
28047
28048
28049static int
28050test_xmlParserValidityWarning(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028051 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028052
28053
28054 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028055 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028056}
28057
28058
28059static int
28060test_xmlParserWarning(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028061 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028062
28063
28064 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028065 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028066}
28067
28068
28069static int
28070test_xmlResetError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028071 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028072
Daniel Veillardce682bc2004-11-05 17:22:25 +000028073 int mem_base;
28074 xmlErrorPtr err; /* pointer to the error. */
28075 int n_err;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028076
Daniel Veillardce682bc2004-11-05 17:22:25 +000028077 for (n_err = 0;n_err < gen_nb_xmlErrorPtr;n_err++) {
28078 mem_base = xmlMemBlocks();
28079 err = gen_xmlErrorPtr(n_err, 0);
28080
28081 xmlResetError(err);
28082 call_tests++;
28083 des_xmlErrorPtr(n_err, err, 0);
28084 xmlResetLastError();
28085 if (mem_base != xmlMemBlocks()) {
28086 printf("Leak of %d blocks found in xmlResetError",
28087 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028088 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028089 printf(" %d", n_err);
28090 printf("\n");
28091 }
28092 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000028093 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028094
Daniel Veillard42595322004-11-08 10:52:06 +000028095 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028096}
28097
28098
28099static int
28100test_xmlResetLastError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028101 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028102
28103
28104
28105 xmlResetLastError();
28106 call_tests++;
28107 xmlResetLastError();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028108 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028109
Daniel Veillard42595322004-11-08 10:52:06 +000028110 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028111}
28112
28113
28114static int
28115test_xmlSetGenericErrorFunc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028116 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028117
28118
28119 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028120 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028121}
28122
28123
28124static int
28125test_xmlSetStructuredErrorFunc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028126 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028127
28128
28129 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028130 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028131}
28132
28133static int
28134test_xmlerror(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028135 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028136
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028137 if (quiet == 0) printf("Testing xmlerror : 7 of 15 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000028138 test_ret += test_initGenericErrorDefaultFunc();
28139 test_ret += test_xmlCopyError();
28140 test_ret += test_xmlCtxtGetLastError();
28141 test_ret += test_xmlCtxtResetLastError();
28142 test_ret += test_xmlGetLastError();
28143 test_ret += test_xmlParserError();
28144 test_ret += test_xmlParserPrintFileContext();
28145 test_ret += test_xmlParserPrintFileInfo();
28146 test_ret += test_xmlParserValidityError();
28147 test_ret += test_xmlParserValidityWarning();
28148 test_ret += test_xmlParserWarning();
28149 test_ret += test_xmlResetError();
28150 test_ret += test_xmlResetLastError();
28151 test_ret += test_xmlSetGenericErrorFunc();
28152 test_ret += test_xmlSetStructuredErrorFunc();
Daniel Veillardd93f6252004-11-02 15:53:51 +000028153
Daniel Veillard42595322004-11-08 10:52:06 +000028154 if (test_ret != 0)
28155 printf("Module xmlerror: %d errors\n", test_ret);
28156 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028157}
Daniel Veillardd93f6252004-11-02 15:53:51 +000028158
28159static int
28160test_xmlNewTextReader(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028161 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028162
Daniel Veillard34099b42004-11-04 17:34:35 +000028163#ifdef LIBXML_READER_ENABLED
28164 int mem_base;
28165 xmlTextReaderPtr ret_val;
28166 xmlParserInputBufferPtr input; /* the xmlParserInputBufferPtr used to read data */
28167 int n_input;
28168 const char * URI; /* the URI information for the source if available */
28169 int n_URI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028170
Daniel Veillard34099b42004-11-04 17:34:35 +000028171 for (n_input = 0;n_input < gen_nb_xmlParserInputBufferPtr;n_input++) {
28172 for (n_URI = 0;n_URI < gen_nb_filepath;n_URI++) {
28173 mem_base = xmlMemBlocks();
28174 input = gen_xmlParserInputBufferPtr(n_input, 0);
28175 URI = gen_filepath(n_URI, 1);
28176
28177 ret_val = xmlNewTextReader(input, URI);
28178 desret_xmlTextReaderPtr(ret_val);
28179 call_tests++;
28180 des_xmlParserInputBufferPtr(n_input, input, 0);
28181 des_filepath(n_URI, URI, 1);
28182 xmlResetLastError();
28183 if (mem_base != xmlMemBlocks()) {
28184 printf("Leak of %d blocks found in xmlNewTextReader",
28185 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028186 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000028187 printf(" %d", n_input);
28188 printf(" %d", n_URI);
28189 printf("\n");
28190 }
28191 }
28192 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028193 function_tests++;
Daniel Veillard34099b42004-11-04 17:34:35 +000028194#endif
28195
Daniel Veillard42595322004-11-08 10:52:06 +000028196 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028197}
28198
28199
28200static int
28201test_xmlNewTextReaderFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028202 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028203
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028204#ifdef LIBXML_READER_ENABLED
28205 int mem_base;
28206 xmlTextReaderPtr ret_val;
28207 const char * URI; /* the URI of the resource to process */
28208 int n_URI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028209
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028210 for (n_URI = 0;n_URI < gen_nb_filepath;n_URI++) {
28211 mem_base = xmlMemBlocks();
28212 URI = gen_filepath(n_URI, 0);
28213
28214 ret_val = xmlNewTextReaderFilename(URI);
28215 desret_xmlTextReaderPtr(ret_val);
28216 call_tests++;
28217 des_filepath(n_URI, URI, 0);
28218 xmlResetLastError();
28219 if (mem_base != xmlMemBlocks()) {
28220 printf("Leak of %d blocks found in xmlNewTextReaderFilename",
28221 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028222 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028223 printf(" %d", n_URI);
28224 printf("\n");
28225 }
28226 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028227 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028228#endif
28229
Daniel Veillard42595322004-11-08 10:52:06 +000028230 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028231}
28232
28233
28234static int
28235test_xmlReaderForDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028236 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028237
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028238#ifdef LIBXML_READER_ENABLED
28239 int mem_base;
28240 xmlTextReaderPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028241 xmlChar * cur; /* a pointer to a zero terminated string */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028242 int n_cur;
28243 const char * URL; /* the base URL to use for the document */
28244 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028245 char * encoding; /* the document encoding, or NULL */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028246 int n_encoding;
28247 int options; /* a combination of xmlParserOption */
28248 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028249
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028250 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
28251 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
28252 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000028253 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028254 mem_base = xmlMemBlocks();
28255 cur = gen_const_xmlChar_ptr(n_cur, 0);
28256 URL = gen_filepath(n_URL, 1);
28257 encoding = gen_const_char_ptr(n_encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000028258 options = gen_parseroptions(n_options, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028259
William M. Brackf13f77f2004-11-12 16:03:48 +000028260 ret_val = xmlReaderForDoc((const xmlChar *)cur, URL, (const char *)encoding, options);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028261 desret_xmlTextReaderPtr(ret_val);
28262 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000028263 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 0);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028264 des_filepath(n_URL, URL, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000028265 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000028266 des_parseroptions(n_options, options, 3);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028267 xmlResetLastError();
28268 if (mem_base != xmlMemBlocks()) {
28269 printf("Leak of %d blocks found in xmlReaderForDoc",
28270 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028271 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028272 printf(" %d", n_cur);
28273 printf(" %d", n_URL);
28274 printf(" %d", n_encoding);
28275 printf(" %d", n_options);
28276 printf("\n");
28277 }
28278 }
28279 }
28280 }
28281 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028282 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028283#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000028284
Daniel Veillard42595322004-11-08 10:52:06 +000028285 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028286}
28287
28288
28289static int
28290test_xmlReaderForFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028291 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028292
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028293#ifdef LIBXML_READER_ENABLED
28294 int mem_base;
28295 xmlTextReaderPtr ret_val;
28296 const char * filename; /* a file or URL */
28297 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028298 char * encoding; /* the document encoding, or NULL */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028299 int n_encoding;
28300 int options; /* a combination of xmlParserOption */
28301 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028302
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028303 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
28304 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000028305 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028306 mem_base = xmlMemBlocks();
28307 filename = gen_filepath(n_filename, 0);
28308 encoding = gen_const_char_ptr(n_encoding, 1);
Daniel Veillard6128c012004-11-08 17:16:15 +000028309 options = gen_parseroptions(n_options, 2);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028310
William M. Brackf13f77f2004-11-12 16:03:48 +000028311 ret_val = xmlReaderForFile(filename, (const char *)encoding, options);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028312 desret_xmlTextReaderPtr(ret_val);
28313 call_tests++;
28314 des_filepath(n_filename, filename, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000028315 des_const_char_ptr(n_encoding, (const char *)encoding, 1);
Daniel Veillard6128c012004-11-08 17:16:15 +000028316 des_parseroptions(n_options, options, 2);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028317 xmlResetLastError();
28318 if (mem_base != xmlMemBlocks()) {
28319 printf("Leak of %d blocks found in xmlReaderForFile",
28320 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028321 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028322 printf(" %d", n_filename);
28323 printf(" %d", n_encoding);
28324 printf(" %d", n_options);
28325 printf("\n");
28326 }
28327 }
28328 }
28329 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028330 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028331#endif
28332
Daniel Veillard42595322004-11-08 10:52:06 +000028333 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028334}
28335
28336
28337static int
28338test_xmlReaderForMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028339 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028340
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028341#ifdef LIBXML_READER_ENABLED
28342 int mem_base;
28343 xmlTextReaderPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028344 char * buffer; /* a pointer to a char array */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028345 int n_buffer;
28346 int size; /* the size of the array */
28347 int n_size;
28348 const char * URL; /* the base URL to use for the document */
28349 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028350 char * encoding; /* the document encoding, or NULL */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028351 int n_encoding;
28352 int options; /* a combination of xmlParserOption */
28353 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028354
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028355 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
28356 for (n_size = 0;n_size < gen_nb_int;n_size++) {
28357 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
28358 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000028359 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028360 mem_base = xmlMemBlocks();
28361 buffer = gen_const_char_ptr(n_buffer, 0);
28362 size = gen_int(n_size, 1);
28363 URL = gen_filepath(n_URL, 2);
28364 encoding = gen_const_char_ptr(n_encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000028365 options = gen_parseroptions(n_options, 4);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028366
William M. Brackf13f77f2004-11-12 16:03:48 +000028367 ret_val = xmlReaderForMemory((const char *)buffer, size, URL, (const char *)encoding, options);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028368 desret_xmlTextReaderPtr(ret_val);
28369 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000028370 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028371 des_int(n_size, size, 1);
28372 des_filepath(n_URL, URL, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000028373 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000028374 des_parseroptions(n_options, options, 4);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028375 xmlResetLastError();
28376 if (mem_base != xmlMemBlocks()) {
28377 printf("Leak of %d blocks found in xmlReaderForMemory",
28378 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028379 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028380 printf(" %d", n_buffer);
28381 printf(" %d", n_size);
28382 printf(" %d", n_URL);
28383 printf(" %d", n_encoding);
28384 printf(" %d", n_options);
28385 printf("\n");
28386 }
28387 }
28388 }
28389 }
28390 }
28391 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028392 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028393#endif
28394
Daniel Veillard42595322004-11-08 10:52:06 +000028395 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028396}
28397
28398
28399static int
28400test_xmlReaderNewDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028401 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028402
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028403#ifdef LIBXML_READER_ENABLED
28404 int mem_base;
28405 int ret_val;
28406 xmlTextReaderPtr reader; /* an XML reader */
28407 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028408 xmlChar * cur; /* a pointer to a zero terminated string */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028409 int n_cur;
28410 const char * URL; /* the base URL to use for the document */
28411 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028412 char * encoding; /* the document encoding, or NULL */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028413 int n_encoding;
28414 int options; /* a combination of xmlParserOption */
28415 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028416
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028417 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28418 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
28419 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
28420 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000028421 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028422 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028423 reader = gen_xmlTextReaderPtr(n_reader, 0);
28424 cur = gen_const_xmlChar_ptr(n_cur, 1);
28425 URL = gen_filepath(n_URL, 2);
28426 encoding = gen_const_char_ptr(n_encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000028427 options = gen_parseroptions(n_options, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028428
William M. Brackf13f77f2004-11-12 16:03:48 +000028429 ret_val = xmlReaderNewDoc(reader, (const xmlChar *)cur, URL, (const char *)encoding, options);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028430 desret_int(ret_val);
28431 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028432 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000028433 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000028434 des_filepath(n_URL, URL, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000028435 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000028436 des_parseroptions(n_options, options, 4);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028437 xmlResetLastError();
28438 if (mem_base != xmlMemBlocks()) {
28439 printf("Leak of %d blocks found in xmlReaderNewDoc",
28440 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028441 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028442 printf(" %d", n_reader);
28443 printf(" %d", n_cur);
28444 printf(" %d", n_URL);
28445 printf(" %d", n_encoding);
28446 printf(" %d", n_options);
28447 printf("\n");
28448 }
28449 }
28450 }
28451 }
28452 }
28453 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028454 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028455#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000028456
Daniel Veillard42595322004-11-08 10:52:06 +000028457 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028458}
28459
28460
28461static int
28462test_xmlReaderNewFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028463 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028464
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028465#ifdef LIBXML_READER_ENABLED
28466 int mem_base;
28467 int ret_val;
28468 xmlTextReaderPtr reader; /* an XML reader */
28469 int n_reader;
28470 const char * filename; /* a file or URL */
28471 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028472 char * encoding; /* the document encoding, or NULL */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028473 int n_encoding;
28474 int options; /* a combination of xmlParserOption */
28475 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028476
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028477 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28478 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
28479 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000028480 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028481 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028482 reader = gen_xmlTextReaderPtr(n_reader, 0);
28483 filename = gen_filepath(n_filename, 1);
28484 encoding = gen_const_char_ptr(n_encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000028485 options = gen_parseroptions(n_options, 3);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028486
William M. Brackf13f77f2004-11-12 16:03:48 +000028487 ret_val = xmlReaderNewFile(reader, filename, (const char *)encoding, options);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028488 desret_int(ret_val);
28489 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028490 des_xmlTextReaderPtr(n_reader, reader, 0);
28491 des_filepath(n_filename, filename, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000028492 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000028493 des_parseroptions(n_options, options, 3);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028494 xmlResetLastError();
28495 if (mem_base != xmlMemBlocks()) {
28496 printf("Leak of %d blocks found in xmlReaderNewFile",
28497 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028498 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028499 printf(" %d", n_reader);
28500 printf(" %d", n_filename);
28501 printf(" %d", n_encoding);
28502 printf(" %d", n_options);
28503 printf("\n");
28504 }
28505 }
28506 }
28507 }
28508 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028509 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028510#endif
28511
Daniel Veillard42595322004-11-08 10:52:06 +000028512 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028513}
28514
28515
28516static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000028517test_xmlReaderNewMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028518 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028519
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028520#ifdef LIBXML_READER_ENABLED
28521 int mem_base;
28522 int ret_val;
28523 xmlTextReaderPtr reader; /* an XML reader */
28524 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028525 char * buffer; /* a pointer to a char array */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028526 int n_buffer;
28527 int size; /* the size of the array */
28528 int n_size;
28529 const char * URL; /* the base URL to use for the document */
28530 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028531 char * encoding; /* the document encoding, or NULL */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028532 int n_encoding;
28533 int options; /* a combination of xmlParserOption */
28534 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028535
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028536 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28537 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
28538 for (n_size = 0;n_size < gen_nb_int;n_size++) {
28539 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
28540 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000028541 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028542 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028543 reader = gen_xmlTextReaderPtr(n_reader, 0);
28544 buffer = gen_const_char_ptr(n_buffer, 1);
28545 size = gen_int(n_size, 2);
28546 URL = gen_filepath(n_URL, 3);
28547 encoding = gen_const_char_ptr(n_encoding, 4);
Daniel Veillard6128c012004-11-08 17:16:15 +000028548 options = gen_parseroptions(n_options, 5);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028549
William M. Brackf13f77f2004-11-12 16:03:48 +000028550 ret_val = xmlReaderNewMemory(reader, (const char *)buffer, size, URL, (const char *)encoding, options);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028551 desret_int(ret_val);
28552 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028553 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000028554 des_const_char_ptr(n_buffer, (const char *)buffer, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000028555 des_int(n_size, size, 2);
28556 des_filepath(n_URL, URL, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +000028557 des_const_char_ptr(n_encoding, (const char *)encoding, 4);
Daniel Veillard6128c012004-11-08 17:16:15 +000028558 des_parseroptions(n_options, options, 5);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028559 xmlResetLastError();
28560 if (mem_base != xmlMemBlocks()) {
28561 printf("Leak of %d blocks found in xmlReaderNewMemory",
28562 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028563 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028564 printf(" %d", n_reader);
28565 printf(" %d", n_buffer);
28566 printf(" %d", n_size);
28567 printf(" %d", n_URL);
28568 printf(" %d", n_encoding);
28569 printf(" %d", n_options);
28570 printf("\n");
28571 }
28572 }
28573 }
28574 }
28575 }
28576 }
28577 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028578 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028579#endif
28580
Daniel Veillard42595322004-11-08 10:52:06 +000028581 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028582}
28583
28584
28585static int
28586test_xmlReaderNewWalker(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028587 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028588
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028589#ifdef LIBXML_READER_ENABLED
28590 int mem_base;
28591 int ret_val;
28592 xmlTextReaderPtr reader; /* an XML reader */
28593 int n_reader;
28594 xmlDocPtr doc; /* a preparsed document */
28595 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028596
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028597 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28598 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
28599 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028600 reader = gen_xmlTextReaderPtr(n_reader, 0);
28601 doc = gen_xmlDocPtr(n_doc, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028602
28603 ret_val = xmlReaderNewWalker(reader, doc);
28604 desret_int(ret_val);
28605 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028606 des_xmlTextReaderPtr(n_reader, reader, 0);
28607 des_xmlDocPtr(n_doc, doc, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028608 xmlResetLastError();
28609 if (mem_base != xmlMemBlocks()) {
28610 printf("Leak of %d blocks found in xmlReaderNewWalker",
28611 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028612 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028613 printf(" %d", n_reader);
28614 printf(" %d", n_doc);
28615 printf("\n");
28616 }
28617 }
28618 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028619 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028620#endif
28621
Daniel Veillard42595322004-11-08 10:52:06 +000028622 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028623}
28624
28625
28626static int
28627test_xmlReaderWalker(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028628 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028629
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028630#ifdef LIBXML_READER_ENABLED
28631 int mem_base;
28632 xmlTextReaderPtr ret_val;
28633 xmlDocPtr doc; /* a preparsed document */
28634 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028635
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028636 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
28637 mem_base = xmlMemBlocks();
28638 doc = gen_xmlDocPtr(n_doc, 0);
28639
28640 ret_val = xmlReaderWalker(doc);
28641 desret_xmlTextReaderPtr(ret_val);
28642 call_tests++;
28643 des_xmlDocPtr(n_doc, doc, 0);
28644 xmlResetLastError();
28645 if (mem_base != xmlMemBlocks()) {
28646 printf("Leak of %d blocks found in xmlReaderWalker",
28647 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028648 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028649 printf(" %d", n_doc);
28650 printf("\n");
28651 }
28652 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028653 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028654#endif
28655
Daniel Veillard42595322004-11-08 10:52:06 +000028656 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028657}
28658
28659
28660static int
28661test_xmlTextReaderAttributeCount(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028662 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028663
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028664#ifdef LIBXML_READER_ENABLED
28665 int mem_base;
28666 int ret_val;
28667 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
28668 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028669
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028670 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28671 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028672 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028673
28674 ret_val = xmlTextReaderAttributeCount(reader);
28675 desret_int(ret_val);
28676 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028677 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028678 xmlResetLastError();
28679 if (mem_base != xmlMemBlocks()) {
28680 printf("Leak of %d blocks found in xmlTextReaderAttributeCount",
28681 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028682 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028683 printf(" %d", n_reader);
28684 printf("\n");
28685 }
28686 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028687 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028688#endif
28689
Daniel Veillard42595322004-11-08 10:52:06 +000028690 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028691}
28692
28693
28694static int
28695test_xmlTextReaderBaseUri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028696 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028697
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028698#ifdef LIBXML_READER_ENABLED
28699 int mem_base;
28700 xmlChar * ret_val;
28701 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
28702 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028703
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028704 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28705 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028706 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028707
28708 ret_val = xmlTextReaderBaseUri(reader);
28709 desret_xmlChar_ptr(ret_val);
28710 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028711 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028712 xmlResetLastError();
28713 if (mem_base != xmlMemBlocks()) {
28714 printf("Leak of %d blocks found in xmlTextReaderBaseUri",
28715 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028716 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028717 printf(" %d", n_reader);
28718 printf("\n");
28719 }
28720 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028721 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028722#endif
28723
Daniel Veillard42595322004-11-08 10:52:06 +000028724 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028725}
28726
28727
28728static int
28729test_xmlTextReaderClose(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028730 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028731
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028732#ifdef LIBXML_READER_ENABLED
28733 int mem_base;
28734 int ret_val;
28735 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
28736 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028737
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028738 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28739 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028740 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028741
28742 ret_val = xmlTextReaderClose(reader);
28743 desret_int(ret_val);
28744 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028745 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028746 xmlResetLastError();
28747 if (mem_base != xmlMemBlocks()) {
28748 printf("Leak of %d blocks found in xmlTextReaderClose",
28749 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028750 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028751 printf(" %d", n_reader);
28752 printf("\n");
28753 }
28754 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028755 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028756#endif
28757
Daniel Veillard42595322004-11-08 10:52:06 +000028758 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028759}
28760
28761
28762static int
28763test_xmlTextReaderConstBaseUri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028764 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028765
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028766#ifdef LIBXML_READER_ENABLED
28767 int mem_base;
28768 const xmlChar * ret_val;
28769 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
28770 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028771
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028772 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28773 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028774 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028775
28776 ret_val = xmlTextReaderConstBaseUri(reader);
28777 desret_const_xmlChar_ptr(ret_val);
28778 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028779 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028780 xmlResetLastError();
28781 if (mem_base != xmlMemBlocks()) {
28782 printf("Leak of %d blocks found in xmlTextReaderConstBaseUri",
28783 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028784 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028785 printf(" %d", n_reader);
28786 printf("\n");
28787 }
28788 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028789 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028790#endif
28791
Daniel Veillard42595322004-11-08 10:52:06 +000028792 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028793}
28794
28795
28796static int
28797test_xmlTextReaderConstEncoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028798 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028799
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028800#ifdef LIBXML_READER_ENABLED
28801 int mem_base;
28802 const xmlChar * ret_val;
28803 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
28804 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028805
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028806 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28807 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028808 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028809
28810 ret_val = xmlTextReaderConstEncoding(reader);
28811 desret_const_xmlChar_ptr(ret_val);
28812 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028813 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028814 xmlResetLastError();
28815 if (mem_base != xmlMemBlocks()) {
28816 printf("Leak of %d blocks found in xmlTextReaderConstEncoding",
28817 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028818 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028819 printf(" %d", n_reader);
28820 printf("\n");
28821 }
28822 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028823 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028824#endif
28825
Daniel Veillard42595322004-11-08 10:52:06 +000028826 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028827}
28828
28829
28830static int
28831test_xmlTextReaderConstLocalName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028832 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028833
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028834#ifdef LIBXML_READER_ENABLED
28835 int mem_base;
28836 const xmlChar * ret_val;
28837 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
28838 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028839
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028840 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28841 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028842 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028843
28844 ret_val = xmlTextReaderConstLocalName(reader);
28845 desret_const_xmlChar_ptr(ret_val);
28846 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028847 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028848 xmlResetLastError();
28849 if (mem_base != xmlMemBlocks()) {
28850 printf("Leak of %d blocks found in xmlTextReaderConstLocalName",
28851 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028852 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028853 printf(" %d", n_reader);
28854 printf("\n");
28855 }
28856 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028857 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028858#endif
28859
Daniel Veillard42595322004-11-08 10:52:06 +000028860 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028861}
28862
28863
28864static int
28865test_xmlTextReaderConstName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028866 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028867
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028868#ifdef LIBXML_READER_ENABLED
28869 int mem_base;
28870 const xmlChar * ret_val;
28871 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
28872 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028873
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028874 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28875 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028876 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028877
28878 ret_val = xmlTextReaderConstName(reader);
28879 desret_const_xmlChar_ptr(ret_val);
28880 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028881 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028882 xmlResetLastError();
28883 if (mem_base != xmlMemBlocks()) {
28884 printf("Leak of %d blocks found in xmlTextReaderConstName",
28885 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028886 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028887 printf(" %d", n_reader);
28888 printf("\n");
28889 }
28890 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028891 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028892#endif
28893
Daniel Veillard42595322004-11-08 10:52:06 +000028894 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028895}
28896
28897
28898static int
28899test_xmlTextReaderConstNamespaceUri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028900 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028901
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028902#ifdef LIBXML_READER_ENABLED
28903 int mem_base;
28904 const xmlChar * ret_val;
28905 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
28906 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028907
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028908 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28909 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028910 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028911
28912 ret_val = xmlTextReaderConstNamespaceUri(reader);
28913 desret_const_xmlChar_ptr(ret_val);
28914 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028915 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028916 xmlResetLastError();
28917 if (mem_base != xmlMemBlocks()) {
28918 printf("Leak of %d blocks found in xmlTextReaderConstNamespaceUri",
28919 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028920 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028921 printf(" %d", n_reader);
28922 printf("\n");
28923 }
28924 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028925 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028926#endif
28927
Daniel Veillard42595322004-11-08 10:52:06 +000028928 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028929}
28930
28931
28932static int
28933test_xmlTextReaderConstPrefix(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028934 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028935
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028936#ifdef LIBXML_READER_ENABLED
28937 int mem_base;
28938 const xmlChar * ret_val;
28939 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
28940 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028941
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028942 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28943 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028944 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028945
28946 ret_val = xmlTextReaderConstPrefix(reader);
28947 desret_const_xmlChar_ptr(ret_val);
28948 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028949 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028950 xmlResetLastError();
28951 if (mem_base != xmlMemBlocks()) {
28952 printf("Leak of %d blocks found in xmlTextReaderConstPrefix",
28953 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028954 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028955 printf(" %d", n_reader);
28956 printf("\n");
28957 }
28958 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028959 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028960#endif
28961
Daniel Veillard42595322004-11-08 10:52:06 +000028962 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028963}
28964
28965
28966static int
28967test_xmlTextReaderConstString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028968 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028969
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028970#ifdef LIBXML_READER_ENABLED
28971 int mem_base;
28972 const xmlChar * ret_val;
28973 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
28974 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028975 xmlChar * str; /* the string to intern. */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028976 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028977
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028978 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28979 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
28980 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028981 reader = gen_xmlTextReaderPtr(n_reader, 0);
28982 str = gen_const_xmlChar_ptr(n_str, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028983
William M. Brackf13f77f2004-11-12 16:03:48 +000028984 ret_val = xmlTextReaderConstString(reader, (const xmlChar *)str);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028985 desret_const_xmlChar_ptr(ret_val);
28986 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028987 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000028988 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028989 xmlResetLastError();
28990 if (mem_base != xmlMemBlocks()) {
28991 printf("Leak of %d blocks found in xmlTextReaderConstString",
28992 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028993 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028994 printf(" %d", n_reader);
28995 printf(" %d", n_str);
28996 printf("\n");
28997 }
28998 }
28999 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029000 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029001#endif
29002
Daniel Veillard42595322004-11-08 10:52:06 +000029003 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029004}
29005
29006
29007static int
29008test_xmlTextReaderConstValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029009 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029010
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029011#ifdef LIBXML_READER_ENABLED
29012 int mem_base;
29013 const xmlChar * ret_val;
29014 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29015 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029016
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029017 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29018 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029019 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029020
29021 ret_val = xmlTextReaderConstValue(reader);
29022 desret_const_xmlChar_ptr(ret_val);
29023 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029024 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029025 xmlResetLastError();
29026 if (mem_base != xmlMemBlocks()) {
29027 printf("Leak of %d blocks found in xmlTextReaderConstValue",
29028 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029029 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029030 printf(" %d", n_reader);
29031 printf("\n");
29032 }
29033 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029034 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029035#endif
29036
Daniel Veillard42595322004-11-08 10:52:06 +000029037 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029038}
29039
29040
29041static int
29042test_xmlTextReaderConstXmlLang(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029043 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029044
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029045#ifdef LIBXML_READER_ENABLED
29046 int mem_base;
29047 const xmlChar * ret_val;
29048 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29049 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029050
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029051 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29052 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029053 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029054
29055 ret_val = xmlTextReaderConstXmlLang(reader);
29056 desret_const_xmlChar_ptr(ret_val);
29057 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029058 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029059 xmlResetLastError();
29060 if (mem_base != xmlMemBlocks()) {
29061 printf("Leak of %d blocks found in xmlTextReaderConstXmlLang",
29062 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029063 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029064 printf(" %d", n_reader);
29065 printf("\n");
29066 }
29067 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029068 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029069#endif
29070
Daniel Veillard42595322004-11-08 10:52:06 +000029071 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029072}
29073
29074
29075static int
29076test_xmlTextReaderConstXmlVersion(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029077 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029078
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029079#ifdef LIBXML_READER_ENABLED
29080 int mem_base;
29081 const xmlChar * ret_val;
29082 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29083 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029084
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029085 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29086 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029087 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029088
29089 ret_val = xmlTextReaderConstXmlVersion(reader);
29090 desret_const_xmlChar_ptr(ret_val);
29091 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029092 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029093 xmlResetLastError();
29094 if (mem_base != xmlMemBlocks()) {
29095 printf("Leak of %d blocks found in xmlTextReaderConstXmlVersion",
29096 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029097 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029098 printf(" %d", n_reader);
29099 printf("\n");
29100 }
29101 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029102 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029103#endif
29104
Daniel Veillard42595322004-11-08 10:52:06 +000029105 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029106}
29107
29108
29109static int
29110test_xmlTextReaderCurrentDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029111 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029112
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029113#ifdef LIBXML_READER_ENABLED
29114 int mem_base;
29115 xmlDocPtr ret_val;
29116 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29117 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029118
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029119 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29120 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029121 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029122
29123 ret_val = xmlTextReaderCurrentDoc(reader);
29124 desret_xmlDocPtr(ret_val);
29125 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029126 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029127 xmlResetLastError();
29128 if (mem_base != xmlMemBlocks()) {
29129 printf("Leak of %d blocks found in xmlTextReaderCurrentDoc",
29130 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029131 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029132 printf(" %d", n_reader);
29133 printf("\n");
29134 }
29135 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029136 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029137#endif
29138
Daniel Veillard42595322004-11-08 10:52:06 +000029139 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029140}
29141
29142
29143static int
29144test_xmlTextReaderCurrentNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029145 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029146
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029147#ifdef LIBXML_READER_ENABLED
29148 int mem_base;
29149 xmlNodePtr ret_val;
29150 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29151 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029152
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029153 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29154 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029155 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029156
29157 ret_val = xmlTextReaderCurrentNode(reader);
29158 desret_xmlNodePtr(ret_val);
29159 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029160 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029161 xmlResetLastError();
29162 if (mem_base != xmlMemBlocks()) {
29163 printf("Leak of %d blocks found in xmlTextReaderCurrentNode",
29164 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029165 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029166 printf(" %d", n_reader);
29167 printf("\n");
29168 }
29169 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029170 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029171#endif
29172
Daniel Veillard42595322004-11-08 10:52:06 +000029173 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029174}
29175
29176
29177static int
29178test_xmlTextReaderDepth(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029179 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029180
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029181#ifdef LIBXML_READER_ENABLED
29182 int mem_base;
29183 int ret_val;
29184 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29185 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029186
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029187 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29188 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029189 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029190
29191 ret_val = xmlTextReaderDepth(reader);
29192 desret_int(ret_val);
29193 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029194 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029195 xmlResetLastError();
29196 if (mem_base != xmlMemBlocks()) {
29197 printf("Leak of %d blocks found in xmlTextReaderDepth",
29198 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029199 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029200 printf(" %d", n_reader);
29201 printf("\n");
29202 }
29203 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029204 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029205#endif
29206
Daniel Veillard42595322004-11-08 10:52:06 +000029207 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029208}
29209
29210
29211static int
29212test_xmlTextReaderExpand(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029213 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029214
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029215#ifdef LIBXML_READER_ENABLED
29216 int mem_base;
29217 xmlNodePtr ret_val;
29218 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29219 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029220
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029221 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29222 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029223 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029224
29225 ret_val = xmlTextReaderExpand(reader);
29226 desret_xmlNodePtr(ret_val);
29227 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029228 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029229 xmlResetLastError();
29230 if (mem_base != xmlMemBlocks()) {
29231 printf("Leak of %d blocks found in xmlTextReaderExpand",
29232 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029233 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029234 printf(" %d", n_reader);
29235 printf("\n");
29236 }
29237 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029238 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029239#endif
29240
Daniel Veillard42595322004-11-08 10:52:06 +000029241 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029242}
29243
29244
29245static int
29246test_xmlTextReaderGetAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029247 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029248
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029249#ifdef LIBXML_READER_ENABLED
29250 int mem_base;
29251 xmlChar * ret_val;
29252 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29253 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000029254 xmlChar * name; /* the qualified name of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029255 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029256
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029257 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29258 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
29259 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029260 reader = gen_xmlTextReaderPtr(n_reader, 0);
29261 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029262
William M. Brackf13f77f2004-11-12 16:03:48 +000029263 ret_val = xmlTextReaderGetAttribute(reader, (const xmlChar *)name);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029264 desret_xmlChar_ptr(ret_val);
29265 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029266 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000029267 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029268 xmlResetLastError();
29269 if (mem_base != xmlMemBlocks()) {
29270 printf("Leak of %d blocks found in xmlTextReaderGetAttribute",
29271 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029272 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029273 printf(" %d", n_reader);
29274 printf(" %d", n_name);
29275 printf("\n");
29276 }
29277 }
29278 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029279 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029280#endif
29281
Daniel Veillard42595322004-11-08 10:52:06 +000029282 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029283}
29284
29285
29286static int
29287test_xmlTextReaderGetAttributeNo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029288 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029289
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029290#ifdef LIBXML_READER_ENABLED
29291 int mem_base;
29292 xmlChar * ret_val;
29293 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29294 int n_reader;
29295 int no; /* the zero-based index of the attribute relative to the containing element */
29296 int n_no;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029297
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029298 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29299 for (n_no = 0;n_no < gen_nb_int;n_no++) {
29300 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029301 reader = gen_xmlTextReaderPtr(n_reader, 0);
29302 no = gen_int(n_no, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029303
29304 ret_val = xmlTextReaderGetAttributeNo(reader, no);
29305 desret_xmlChar_ptr(ret_val);
29306 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029307 des_xmlTextReaderPtr(n_reader, reader, 0);
29308 des_int(n_no, no, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029309 xmlResetLastError();
29310 if (mem_base != xmlMemBlocks()) {
29311 printf("Leak of %d blocks found in xmlTextReaderGetAttributeNo",
29312 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029313 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029314 printf(" %d", n_reader);
29315 printf(" %d", n_no);
29316 printf("\n");
29317 }
29318 }
29319 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029320 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029321#endif
29322
Daniel Veillard42595322004-11-08 10:52:06 +000029323 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029324}
29325
29326
29327static int
29328test_xmlTextReaderGetAttributeNs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029329 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029330
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029331#ifdef LIBXML_READER_ENABLED
29332 int mem_base;
29333 xmlChar * ret_val;
29334 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29335 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000029336 xmlChar * localName; /* the local name of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029337 int n_localName;
Daniel Veillardce682bc2004-11-05 17:22:25 +000029338 xmlChar * namespaceURI; /* the namespace URI of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029339 int n_namespaceURI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029340
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029341 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29342 for (n_localName = 0;n_localName < gen_nb_const_xmlChar_ptr;n_localName++) {
29343 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
29344 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029345 reader = gen_xmlTextReaderPtr(n_reader, 0);
29346 localName = gen_const_xmlChar_ptr(n_localName, 1);
29347 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029348
William M. Brackf13f77f2004-11-12 16:03:48 +000029349 ret_val = xmlTextReaderGetAttributeNs(reader, (const xmlChar *)localName, (const xmlChar *)namespaceURI);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029350 desret_xmlChar_ptr(ret_val);
29351 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029352 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000029353 des_const_xmlChar_ptr(n_localName, (const xmlChar *)localName, 1);
29354 des_const_xmlChar_ptr(n_namespaceURI, (const xmlChar *)namespaceURI, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029355 xmlResetLastError();
29356 if (mem_base != xmlMemBlocks()) {
29357 printf("Leak of %d blocks found in xmlTextReaderGetAttributeNs",
29358 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029359 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029360 printf(" %d", n_reader);
29361 printf(" %d", n_localName);
29362 printf(" %d", n_namespaceURI);
29363 printf("\n");
29364 }
29365 }
29366 }
29367 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029368 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029369#endif
29370
Daniel Veillard42595322004-11-08 10:52:06 +000029371 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029372}
29373
Daniel Veillarda521d282004-11-09 14:59:59 +000029374#ifdef LIBXML_READER_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000029375
Daniel Veillardce682bc2004-11-05 17:22:25 +000029376#define gen_nb_xmlTextReaderErrorFunc_ptr 1
29377static xmlTextReaderErrorFunc * gen_xmlTextReaderErrorFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
29378 return(NULL);
29379}
29380static void des_xmlTextReaderErrorFunc_ptr(int no ATTRIBUTE_UNUSED, xmlTextReaderErrorFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
29381}
Daniel Veillarda521d282004-11-09 14:59:59 +000029382#endif
29383
Daniel Veillardce682bc2004-11-05 17:22:25 +000029384
Daniel Veillardd93f6252004-11-02 15:53:51 +000029385static int
29386test_xmlTextReaderGetErrorHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029387 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029388
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029389#ifdef LIBXML_READER_ENABLED
29390 int mem_base;
29391 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29392 int n_reader;
29393 xmlTextReaderErrorFunc * f; /* the callback function or NULL is no callback has been registered */
29394 int n_f;
29395 void ** arg; /* a user argument */
29396 int n_arg;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029397
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029398 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29399 for (n_f = 0;n_f < gen_nb_xmlTextReaderErrorFunc_ptr;n_f++) {
29400 for (n_arg = 0;n_arg < gen_nb_void_ptr_ptr;n_arg++) {
29401 mem_base = xmlMemBlocks();
29402 reader = gen_xmlTextReaderPtr(n_reader, 0);
29403 f = gen_xmlTextReaderErrorFunc_ptr(n_f, 1);
29404 arg = gen_void_ptr_ptr(n_arg, 2);
29405
29406 xmlTextReaderGetErrorHandler(reader, f, arg);
29407 call_tests++;
29408 des_xmlTextReaderPtr(n_reader, reader, 0);
29409 des_xmlTextReaderErrorFunc_ptr(n_f, f, 1);
29410 des_void_ptr_ptr(n_arg, arg, 2);
29411 xmlResetLastError();
29412 if (mem_base != xmlMemBlocks()) {
29413 printf("Leak of %d blocks found in xmlTextReaderGetErrorHandler",
29414 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029415 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029416 printf(" %d", n_reader);
29417 printf(" %d", n_f);
29418 printf(" %d", n_arg);
29419 printf("\n");
29420 }
29421 }
29422 }
29423 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029424 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029425#endif
29426
Daniel Veillard42595322004-11-08 10:52:06 +000029427 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029428}
29429
29430
29431static int
29432test_xmlTextReaderGetParserProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029433 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029434
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029435#ifdef LIBXML_READER_ENABLED
29436 int mem_base;
29437 int ret_val;
29438 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29439 int n_reader;
29440 int prop; /* the xmlParserProperties to get */
29441 int n_prop;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029442
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029443 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29444 for (n_prop = 0;n_prop < gen_nb_int;n_prop++) {
29445 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029446 reader = gen_xmlTextReaderPtr(n_reader, 0);
29447 prop = gen_int(n_prop, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029448
29449 ret_val = xmlTextReaderGetParserProp(reader, prop);
29450 desret_int(ret_val);
29451 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029452 des_xmlTextReaderPtr(n_reader, reader, 0);
29453 des_int(n_prop, prop, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029454 xmlResetLastError();
29455 if (mem_base != xmlMemBlocks()) {
29456 printf("Leak of %d blocks found in xmlTextReaderGetParserProp",
29457 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029458 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029459 printf(" %d", n_reader);
29460 printf(" %d", n_prop);
29461 printf("\n");
29462 }
29463 }
29464 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029465 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029466#endif
29467
Daniel Veillard42595322004-11-08 10:52:06 +000029468 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029469}
29470
29471
29472static int
29473test_xmlTextReaderGetRemainder(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029474 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029475
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029476#ifdef LIBXML_READER_ENABLED
29477 int mem_base;
29478 xmlParserInputBufferPtr ret_val;
29479 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29480 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029481
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029482 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29483 mem_base = xmlMemBlocks();
29484 reader = gen_xmlTextReaderPtr(n_reader, 0);
29485
29486 ret_val = xmlTextReaderGetRemainder(reader);
29487 desret_xmlParserInputBufferPtr(ret_val);
29488 call_tests++;
29489 des_xmlTextReaderPtr(n_reader, reader, 0);
29490 xmlResetLastError();
29491 if (mem_base != xmlMemBlocks()) {
29492 printf("Leak of %d blocks found in xmlTextReaderGetRemainder",
29493 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029494 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029495 printf(" %d", n_reader);
29496 printf("\n");
29497 }
29498 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029499 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029500#endif
29501
Daniel Veillard42595322004-11-08 10:52:06 +000029502 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029503}
29504
29505
29506static int
29507test_xmlTextReaderHasAttributes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029508 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029509
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029510#ifdef LIBXML_READER_ENABLED
29511 int mem_base;
29512 int ret_val;
29513 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29514 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029515
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029516 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29517 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029518 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029519
29520 ret_val = xmlTextReaderHasAttributes(reader);
29521 desret_int(ret_val);
29522 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029523 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029524 xmlResetLastError();
29525 if (mem_base != xmlMemBlocks()) {
29526 printf("Leak of %d blocks found in xmlTextReaderHasAttributes",
29527 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029528 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029529 printf(" %d", n_reader);
29530 printf("\n");
29531 }
29532 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029533 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029534#endif
29535
Daniel Veillard42595322004-11-08 10:52:06 +000029536 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029537}
29538
29539
29540static int
29541test_xmlTextReaderHasValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029542 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029543
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029544#ifdef LIBXML_READER_ENABLED
29545 int mem_base;
29546 int ret_val;
29547 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29548 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029549
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029550 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29551 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029552 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029553
29554 ret_val = xmlTextReaderHasValue(reader);
29555 desret_int(ret_val);
29556 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029557 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029558 xmlResetLastError();
29559 if (mem_base != xmlMemBlocks()) {
29560 printf("Leak of %d blocks found in xmlTextReaderHasValue",
29561 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029562 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029563 printf(" %d", n_reader);
29564 printf("\n");
29565 }
29566 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029567 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029568#endif
29569
Daniel Veillard42595322004-11-08 10:52:06 +000029570 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029571}
29572
29573
29574static int
29575test_xmlTextReaderIsDefault(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029576 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029577
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029578#ifdef LIBXML_READER_ENABLED
29579 int mem_base;
29580 int ret_val;
29581 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29582 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029583
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029584 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29585 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029586 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029587
29588 ret_val = xmlTextReaderIsDefault(reader);
29589 desret_int(ret_val);
29590 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029591 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029592 xmlResetLastError();
29593 if (mem_base != xmlMemBlocks()) {
29594 printf("Leak of %d blocks found in xmlTextReaderIsDefault",
29595 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029596 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029597 printf(" %d", n_reader);
29598 printf("\n");
29599 }
29600 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029601 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029602#endif
29603
Daniel Veillard42595322004-11-08 10:52:06 +000029604 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029605}
29606
29607
29608static int
29609test_xmlTextReaderIsEmptyElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029610 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029611
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029612#ifdef LIBXML_READER_ENABLED
29613 int mem_base;
29614 int ret_val;
29615 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29616 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029617
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029618 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29619 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029620 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029621
29622 ret_val = xmlTextReaderIsEmptyElement(reader);
29623 desret_int(ret_val);
29624 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029625 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029626 xmlResetLastError();
29627 if (mem_base != xmlMemBlocks()) {
29628 printf("Leak of %d blocks found in xmlTextReaderIsEmptyElement",
29629 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029630 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029631 printf(" %d", n_reader);
29632 printf("\n");
29633 }
29634 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029635 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029636#endif
29637
Daniel Veillard42595322004-11-08 10:52:06 +000029638 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029639}
29640
29641
29642static int
29643test_xmlTextReaderIsNamespaceDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029644 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029645
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029646#ifdef LIBXML_READER_ENABLED
29647 int mem_base;
29648 int ret_val;
29649 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29650 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029651
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029652 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29653 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029654 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029655
29656 ret_val = xmlTextReaderIsNamespaceDecl(reader);
29657 desret_int(ret_val);
29658 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029659 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029660 xmlResetLastError();
29661 if (mem_base != xmlMemBlocks()) {
29662 printf("Leak of %d blocks found in xmlTextReaderIsNamespaceDecl",
29663 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029664 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029665 printf(" %d", n_reader);
29666 printf("\n");
29667 }
29668 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029669 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029670#endif
29671
Daniel Veillard42595322004-11-08 10:52:06 +000029672 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029673}
29674
29675
29676static int
29677test_xmlTextReaderIsValid(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029678 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029679
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029680#ifdef LIBXML_READER_ENABLED
29681 int mem_base;
29682 int ret_val;
29683 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29684 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029685
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029686 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29687 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029688 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029689
29690 ret_val = xmlTextReaderIsValid(reader);
29691 desret_int(ret_val);
29692 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029693 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029694 xmlResetLastError();
29695 if (mem_base != xmlMemBlocks()) {
29696 printf("Leak of %d blocks found in xmlTextReaderIsValid",
29697 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029698 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029699 printf(" %d", n_reader);
29700 printf("\n");
29701 }
29702 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029703 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029704#endif
29705
Daniel Veillard42595322004-11-08 10:52:06 +000029706 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029707}
29708
29709
29710static int
29711test_xmlTextReaderLocalName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029712 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029713
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029714#ifdef LIBXML_READER_ENABLED
29715 int mem_base;
29716 xmlChar * ret_val;
29717 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29718 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029719
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029720 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29721 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029722 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029723
29724 ret_val = xmlTextReaderLocalName(reader);
29725 desret_xmlChar_ptr(ret_val);
29726 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029727 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029728 xmlResetLastError();
29729 if (mem_base != xmlMemBlocks()) {
29730 printf("Leak of %d blocks found in xmlTextReaderLocalName",
29731 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029732 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029733 printf(" %d", n_reader);
29734 printf("\n");
29735 }
29736 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029737 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029738#endif
29739
Daniel Veillard42595322004-11-08 10:52:06 +000029740 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029741}
29742
Daniel Veillarda521d282004-11-09 14:59:59 +000029743#ifdef LIBXML_READER_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000029744
Daniel Veillardce682bc2004-11-05 17:22:25 +000029745#define gen_nb_xmlTextReaderLocatorPtr 1
29746static xmlTextReaderLocatorPtr gen_xmlTextReaderLocatorPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
29747 return(NULL);
29748}
29749static void des_xmlTextReaderLocatorPtr(int no ATTRIBUTE_UNUSED, xmlTextReaderLocatorPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
29750}
Daniel Veillarda521d282004-11-09 14:59:59 +000029751#endif
29752
Daniel Veillardce682bc2004-11-05 17:22:25 +000029753
Daniel Veillardd93f6252004-11-02 15:53:51 +000029754static int
29755test_xmlTextReaderLocatorBaseURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029756 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029757
Daniel Veillardce682bc2004-11-05 17:22:25 +000029758#ifdef LIBXML_READER_ENABLED
29759 int mem_base;
29760 xmlChar * ret_val;
29761 xmlTextReaderLocatorPtr locator; /* the xmlTextReaderLocatorPtr used */
29762 int n_locator;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029763
Daniel Veillardce682bc2004-11-05 17:22:25 +000029764 for (n_locator = 0;n_locator < gen_nb_xmlTextReaderLocatorPtr;n_locator++) {
29765 mem_base = xmlMemBlocks();
29766 locator = gen_xmlTextReaderLocatorPtr(n_locator, 0);
29767
29768 ret_val = xmlTextReaderLocatorBaseURI(locator);
29769 desret_xmlChar_ptr(ret_val);
29770 call_tests++;
29771 des_xmlTextReaderLocatorPtr(n_locator, locator, 0);
29772 xmlResetLastError();
29773 if (mem_base != xmlMemBlocks()) {
29774 printf("Leak of %d blocks found in xmlTextReaderLocatorBaseURI",
29775 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029776 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000029777 printf(" %d", n_locator);
29778 printf("\n");
29779 }
29780 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029781 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000029782#endif
29783
Daniel Veillard42595322004-11-08 10:52:06 +000029784 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029785}
29786
29787
29788static int
29789test_xmlTextReaderLocatorLineNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029790 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029791
Daniel Veillardce682bc2004-11-05 17:22:25 +000029792#ifdef LIBXML_READER_ENABLED
29793 int mem_base;
29794 int ret_val;
29795 xmlTextReaderLocatorPtr locator; /* the xmlTextReaderLocatorPtr used */
29796 int n_locator;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029797
Daniel Veillardce682bc2004-11-05 17:22:25 +000029798 for (n_locator = 0;n_locator < gen_nb_xmlTextReaderLocatorPtr;n_locator++) {
29799 mem_base = xmlMemBlocks();
29800 locator = gen_xmlTextReaderLocatorPtr(n_locator, 0);
29801
29802 ret_val = xmlTextReaderLocatorLineNumber(locator);
29803 desret_int(ret_val);
29804 call_tests++;
29805 des_xmlTextReaderLocatorPtr(n_locator, locator, 0);
29806 xmlResetLastError();
29807 if (mem_base != xmlMemBlocks()) {
29808 printf("Leak of %d blocks found in xmlTextReaderLocatorLineNumber",
29809 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029810 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000029811 printf(" %d", n_locator);
29812 printf("\n");
29813 }
29814 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029815 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000029816#endif
29817
Daniel Veillard42595322004-11-08 10:52:06 +000029818 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029819}
29820
29821
29822static int
29823test_xmlTextReaderLookupNamespace(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029824 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029825
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029826#ifdef LIBXML_READER_ENABLED
29827 int mem_base;
29828 xmlChar * ret_val;
29829 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29830 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000029831 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 +000029832 int n_prefix;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029833
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029834 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29835 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
29836 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029837 reader = gen_xmlTextReaderPtr(n_reader, 0);
29838 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029839
William M. Brackf13f77f2004-11-12 16:03:48 +000029840 ret_val = xmlTextReaderLookupNamespace(reader, (const xmlChar *)prefix);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029841 desret_xmlChar_ptr(ret_val);
29842 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029843 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000029844 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029845 xmlResetLastError();
29846 if (mem_base != xmlMemBlocks()) {
29847 printf("Leak of %d blocks found in xmlTextReaderLookupNamespace",
29848 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029849 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029850 printf(" %d", n_reader);
29851 printf(" %d", n_prefix);
29852 printf("\n");
29853 }
29854 }
29855 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029856 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029857#endif
29858
Daniel Veillard42595322004-11-08 10:52:06 +000029859 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029860}
29861
29862
29863static int
29864test_xmlTextReaderMoveToAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029865 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029866
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029867#ifdef LIBXML_READER_ENABLED
29868 int mem_base;
29869 int ret_val;
29870 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29871 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000029872 xmlChar * name; /* the qualified name of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029873 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029874
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029875 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29876 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
29877 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029878 reader = gen_xmlTextReaderPtr(n_reader, 0);
29879 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029880
William M. Brackf13f77f2004-11-12 16:03:48 +000029881 ret_val = xmlTextReaderMoveToAttribute(reader, (const xmlChar *)name);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029882 desret_int(ret_val);
29883 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029884 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000029885 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029886 xmlResetLastError();
29887 if (mem_base != xmlMemBlocks()) {
29888 printf("Leak of %d blocks found in xmlTextReaderMoveToAttribute",
29889 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029890 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029891 printf(" %d", n_reader);
29892 printf(" %d", n_name);
29893 printf("\n");
29894 }
29895 }
29896 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029897 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029898#endif
29899
Daniel Veillard42595322004-11-08 10:52:06 +000029900 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029901}
29902
29903
29904static int
29905test_xmlTextReaderMoveToAttributeNo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029906 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029907
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029908#ifdef LIBXML_READER_ENABLED
29909 int mem_base;
29910 int ret_val;
29911 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29912 int n_reader;
29913 int no; /* the zero-based index of the attribute relative to the containing element. */
29914 int n_no;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029915
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029916 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29917 for (n_no = 0;n_no < gen_nb_int;n_no++) {
29918 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029919 reader = gen_xmlTextReaderPtr(n_reader, 0);
29920 no = gen_int(n_no, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029921
29922 ret_val = xmlTextReaderMoveToAttributeNo(reader, no);
29923 desret_int(ret_val);
29924 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029925 des_xmlTextReaderPtr(n_reader, reader, 0);
29926 des_int(n_no, no, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029927 xmlResetLastError();
29928 if (mem_base != xmlMemBlocks()) {
29929 printf("Leak of %d blocks found in xmlTextReaderMoveToAttributeNo",
29930 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029931 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029932 printf(" %d", n_reader);
29933 printf(" %d", n_no);
29934 printf("\n");
29935 }
29936 }
29937 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029938 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029939#endif
29940
Daniel Veillard42595322004-11-08 10:52:06 +000029941 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029942}
29943
29944
29945static int
29946test_xmlTextReaderMoveToAttributeNs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029947 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029948
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029949#ifdef LIBXML_READER_ENABLED
29950 int mem_base;
29951 int ret_val;
29952 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29953 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000029954 xmlChar * localName; /* the local name of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029955 int n_localName;
Daniel Veillardce682bc2004-11-05 17:22:25 +000029956 xmlChar * namespaceURI; /* the namespace URI of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029957 int n_namespaceURI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029958
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029959 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29960 for (n_localName = 0;n_localName < gen_nb_const_xmlChar_ptr;n_localName++) {
29961 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
29962 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029963 reader = gen_xmlTextReaderPtr(n_reader, 0);
29964 localName = gen_const_xmlChar_ptr(n_localName, 1);
29965 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029966
William M. Brackf13f77f2004-11-12 16:03:48 +000029967 ret_val = xmlTextReaderMoveToAttributeNs(reader, (const xmlChar *)localName, (const xmlChar *)namespaceURI);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029968 desret_int(ret_val);
29969 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029970 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000029971 des_const_xmlChar_ptr(n_localName, (const xmlChar *)localName, 1);
29972 des_const_xmlChar_ptr(n_namespaceURI, (const xmlChar *)namespaceURI, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029973 xmlResetLastError();
29974 if (mem_base != xmlMemBlocks()) {
29975 printf("Leak of %d blocks found in xmlTextReaderMoveToAttributeNs",
29976 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029977 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029978 printf(" %d", n_reader);
29979 printf(" %d", n_localName);
29980 printf(" %d", n_namespaceURI);
29981 printf("\n");
29982 }
29983 }
29984 }
29985 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029986 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029987#endif
29988
Daniel Veillard42595322004-11-08 10:52:06 +000029989 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029990}
29991
29992
29993static int
29994test_xmlTextReaderMoveToElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029995 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029996
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029997#ifdef LIBXML_READER_ENABLED
29998 int mem_base;
29999 int ret_val;
30000 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30001 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030002
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030003 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30004 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030005 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030006
30007 ret_val = xmlTextReaderMoveToElement(reader);
30008 desret_int(ret_val);
30009 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030010 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030011 xmlResetLastError();
30012 if (mem_base != xmlMemBlocks()) {
30013 printf("Leak of %d blocks found in xmlTextReaderMoveToElement",
30014 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030015 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030016 printf(" %d", n_reader);
30017 printf("\n");
30018 }
30019 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030020 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030021#endif
30022
Daniel Veillard42595322004-11-08 10:52:06 +000030023 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030024}
30025
30026
30027static int
30028test_xmlTextReaderMoveToFirstAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030029 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030030
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030031#ifdef LIBXML_READER_ENABLED
30032 int mem_base;
30033 int ret_val;
30034 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30035 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030036
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030037 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30038 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030039 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030040
30041 ret_val = xmlTextReaderMoveToFirstAttribute(reader);
30042 desret_int(ret_val);
30043 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030044 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030045 xmlResetLastError();
30046 if (mem_base != xmlMemBlocks()) {
30047 printf("Leak of %d blocks found in xmlTextReaderMoveToFirstAttribute",
30048 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030049 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030050 printf(" %d", n_reader);
30051 printf("\n");
30052 }
30053 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030054 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030055#endif
30056
Daniel Veillard42595322004-11-08 10:52:06 +000030057 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030058}
30059
30060
30061static int
30062test_xmlTextReaderMoveToNextAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030063 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030064
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030065#ifdef LIBXML_READER_ENABLED
30066 int mem_base;
30067 int ret_val;
30068 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30069 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030070
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030071 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30072 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030073 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030074
30075 ret_val = xmlTextReaderMoveToNextAttribute(reader);
30076 desret_int(ret_val);
30077 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030078 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030079 xmlResetLastError();
30080 if (mem_base != xmlMemBlocks()) {
30081 printf("Leak of %d blocks found in xmlTextReaderMoveToNextAttribute",
30082 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030083 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030084 printf(" %d", n_reader);
30085 printf("\n");
30086 }
30087 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030088 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030089#endif
30090
Daniel Veillard42595322004-11-08 10:52:06 +000030091 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030092}
30093
30094
30095static int
30096test_xmlTextReaderName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030097 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030098
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030099#ifdef LIBXML_READER_ENABLED
30100 int mem_base;
30101 xmlChar * ret_val;
30102 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30103 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030104
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030105 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30106 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030107 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030108
30109 ret_val = xmlTextReaderName(reader);
30110 desret_xmlChar_ptr(ret_val);
30111 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030112 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030113 xmlResetLastError();
30114 if (mem_base != xmlMemBlocks()) {
30115 printf("Leak of %d blocks found in xmlTextReaderName",
30116 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030117 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030118 printf(" %d", n_reader);
30119 printf("\n");
30120 }
30121 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030122 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030123#endif
30124
Daniel Veillard42595322004-11-08 10:52:06 +000030125 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030126}
30127
30128
30129static int
30130test_xmlTextReaderNamespaceUri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030131 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030132
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030133#ifdef LIBXML_READER_ENABLED
30134 int mem_base;
30135 xmlChar * ret_val;
30136 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30137 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030138
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030139 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30140 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030141 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030142
30143 ret_val = xmlTextReaderNamespaceUri(reader);
30144 desret_xmlChar_ptr(ret_val);
30145 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030146 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030147 xmlResetLastError();
30148 if (mem_base != xmlMemBlocks()) {
30149 printf("Leak of %d blocks found in xmlTextReaderNamespaceUri",
30150 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030151 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030152 printf(" %d", n_reader);
30153 printf("\n");
30154 }
30155 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030156 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030157#endif
30158
Daniel Veillard42595322004-11-08 10:52:06 +000030159 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030160}
30161
30162
30163static int
30164test_xmlTextReaderNext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030165 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030166
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030167#ifdef LIBXML_READER_ENABLED
30168 int mem_base;
30169 int ret_val;
30170 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30171 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030172
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030173 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30174 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030175 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030176
30177 ret_val = xmlTextReaderNext(reader);
30178 desret_int(ret_val);
30179 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030180 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030181 xmlResetLastError();
30182 if (mem_base != xmlMemBlocks()) {
30183 printf("Leak of %d blocks found in xmlTextReaderNext",
30184 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030185 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030186 printf(" %d", n_reader);
30187 printf("\n");
30188 }
30189 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030190 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030191#endif
30192
Daniel Veillard42595322004-11-08 10:52:06 +000030193 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030194}
30195
30196
30197static int
30198test_xmlTextReaderNextSibling(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030199 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030200
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030201#ifdef LIBXML_READER_ENABLED
30202 int mem_base;
30203 int ret_val;
30204 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30205 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030206
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030207 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30208 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030209 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030210
30211 ret_val = xmlTextReaderNextSibling(reader);
30212 desret_int(ret_val);
30213 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030214 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030215 xmlResetLastError();
30216 if (mem_base != xmlMemBlocks()) {
30217 printf("Leak of %d blocks found in xmlTextReaderNextSibling",
30218 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030219 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030220 printf(" %d", n_reader);
30221 printf("\n");
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_xmlTextReaderNodeType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030233 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030234
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030235#ifdef LIBXML_READER_ENABLED
30236 int mem_base;
30237 int ret_val;
30238 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30239 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030240
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030241 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30242 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030243 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030244
30245 ret_val = xmlTextReaderNodeType(reader);
30246 desret_int(ret_val);
30247 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030248 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030249 xmlResetLastError();
30250 if (mem_base != xmlMemBlocks()) {
30251 printf("Leak of %d blocks found in xmlTextReaderNodeType",
30252 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030253 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030254 printf(" %d", n_reader);
30255 printf("\n");
30256 }
30257 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030258 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030259#endif
30260
Daniel Veillard42595322004-11-08 10:52:06 +000030261 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030262}
30263
30264
30265static int
30266test_xmlTextReaderNormalization(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030267 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030268
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030269#ifdef LIBXML_READER_ENABLED
30270 int mem_base;
30271 int ret_val;
30272 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30273 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030274
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030275 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30276 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030277 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030278
30279 ret_val = xmlTextReaderNormalization(reader);
30280 desret_int(ret_val);
30281 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030282 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030283 xmlResetLastError();
30284 if (mem_base != xmlMemBlocks()) {
30285 printf("Leak of %d blocks found in xmlTextReaderNormalization",
30286 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030287 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030288 printf(" %d", n_reader);
30289 printf("\n");
30290 }
30291 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030292 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030293#endif
30294
Daniel Veillard42595322004-11-08 10:52:06 +000030295 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030296}
30297
30298
30299static int
30300test_xmlTextReaderPrefix(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030301 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030302
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030303#ifdef LIBXML_READER_ENABLED
30304 int mem_base;
30305 xmlChar * ret_val;
30306 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30307 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030308
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030309 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30310 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030311 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030312
30313 ret_val = xmlTextReaderPrefix(reader);
30314 desret_xmlChar_ptr(ret_val);
30315 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030316 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030317 xmlResetLastError();
30318 if (mem_base != xmlMemBlocks()) {
30319 printf("Leak of %d blocks found in xmlTextReaderPrefix",
30320 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030321 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030322 printf(" %d", n_reader);
30323 printf("\n");
30324 }
30325 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030326 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030327#endif
30328
Daniel Veillard42595322004-11-08 10:52:06 +000030329 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030330}
30331
30332
30333static int
30334test_xmlTextReaderPreserve(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030335 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030336
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030337#ifdef LIBXML_READER_ENABLED
30338 int mem_base;
30339 xmlNodePtr ret_val;
30340 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30341 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030342
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030343 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30344 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030345 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030346
30347 ret_val = xmlTextReaderPreserve(reader);
30348 desret_xmlNodePtr(ret_val);
30349 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030350 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030351 xmlResetLastError();
30352 if (mem_base != xmlMemBlocks()) {
30353 printf("Leak of %d blocks found in xmlTextReaderPreserve",
30354 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030355 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030356 printf(" %d", n_reader);
30357 printf("\n");
30358 }
30359 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030360 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030361#endif
30362
Daniel Veillard42595322004-11-08 10:52:06 +000030363 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030364}
30365
30366
30367static int
30368test_xmlTextReaderPreservePattern(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030369 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030370
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030371#ifdef LIBXML_READER_ENABLED
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030372#ifdef LIBXML_PATTERN_ENABLED
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030373 int mem_base;
30374 int ret_val;
30375 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30376 int n_reader;
30377 xmlChar * pattern; /* an XPath subset pattern */
30378 int n_pattern;
30379 xmlChar ** namespaces; /* the prefix definitions, array of [URI, prefix] or NULL */
30380 int n_namespaces;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030381
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030382 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30383 for (n_pattern = 0;n_pattern < gen_nb_const_xmlChar_ptr;n_pattern++) {
30384 for (n_namespaces = 0;n_namespaces < gen_nb_const_xmlChar_ptr_ptr;n_namespaces++) {
30385 mem_base = xmlMemBlocks();
30386 reader = gen_xmlTextReaderPtr(n_reader, 0);
30387 pattern = gen_const_xmlChar_ptr(n_pattern, 1);
30388 namespaces = gen_const_xmlChar_ptr_ptr(n_namespaces, 2);
30389
William M. Brackf13f77f2004-11-12 16:03:48 +000030390 ret_val = xmlTextReaderPreservePattern(reader, (const xmlChar *)pattern, (const xmlChar **)namespaces);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030391 desret_int(ret_val);
30392 call_tests++;
30393 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000030394 des_const_xmlChar_ptr(n_pattern, (const xmlChar *)pattern, 1);
30395 des_const_xmlChar_ptr_ptr(n_namespaces, (const xmlChar **)namespaces, 2);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030396 xmlResetLastError();
30397 if (mem_base != xmlMemBlocks()) {
30398 printf("Leak of %d blocks found in xmlTextReaderPreservePattern",
30399 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030400 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030401 printf(" %d", n_reader);
30402 printf(" %d", n_pattern);
30403 printf(" %d", n_namespaces);
30404 printf("\n");
30405 }
30406 }
30407 }
30408 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030409 function_tests++;
30410#endif
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030411#endif
30412
Daniel Veillard42595322004-11-08 10:52:06 +000030413 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030414}
30415
30416
30417static int
30418test_xmlTextReaderQuoteChar(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030419 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030420
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030421#ifdef LIBXML_READER_ENABLED
30422 int mem_base;
30423 int ret_val;
30424 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30425 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030426
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030427 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30428 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030429 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030430
30431 ret_val = xmlTextReaderQuoteChar(reader);
30432 desret_int(ret_val);
30433 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030434 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030435 xmlResetLastError();
30436 if (mem_base != xmlMemBlocks()) {
30437 printf("Leak of %d blocks found in xmlTextReaderQuoteChar",
30438 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030439 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030440 printf(" %d", n_reader);
30441 printf("\n");
30442 }
30443 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030444 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030445#endif
30446
Daniel Veillard42595322004-11-08 10:52:06 +000030447 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030448}
30449
30450
30451static int
30452test_xmlTextReaderRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030453 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030454
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030455#ifdef LIBXML_READER_ENABLED
30456 int mem_base;
30457 int ret_val;
30458 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30459 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030460
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030461 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30462 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030463 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030464
30465 ret_val = xmlTextReaderRead(reader);
30466 desret_int(ret_val);
30467 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030468 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030469 xmlResetLastError();
30470 if (mem_base != xmlMemBlocks()) {
30471 printf("Leak of %d blocks found in xmlTextReaderRead",
30472 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030473 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030474 printf(" %d", n_reader);
30475 printf("\n");
30476 }
30477 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030478 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030479#endif
30480
Daniel Veillard42595322004-11-08 10:52:06 +000030481 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030482}
30483
30484
30485static int
30486test_xmlTextReaderReadAttributeValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030487 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030488
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030489#ifdef LIBXML_READER_ENABLED
30490 int mem_base;
30491 int ret_val;
30492 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30493 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030494
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030495 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30496 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030497 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030498
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030499 ret_val = xmlTextReaderReadAttributeValue(reader);
30500 desret_int(ret_val);
30501 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030502 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030503 xmlResetLastError();
30504 if (mem_base != xmlMemBlocks()) {
30505 printf("Leak of %d blocks found in xmlTextReaderReadAttributeValue",
30506 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030507 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030508 printf(" %d", n_reader);
30509 printf("\n");
30510 }
30511 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030512 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030513#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000030514
Daniel Veillard42595322004-11-08 10:52:06 +000030515 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030516}
30517
30518
30519static int
30520test_xmlTextReaderReadState(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030521 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030522
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030523#ifdef LIBXML_READER_ENABLED
30524 int mem_base;
30525 int ret_val;
30526 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30527 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030528
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030529 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30530 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030531 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030532
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030533 ret_val = xmlTextReaderReadState(reader);
30534 desret_int(ret_val);
30535 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030536 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030537 xmlResetLastError();
30538 if (mem_base != xmlMemBlocks()) {
30539 printf("Leak of %d blocks found in xmlTextReaderReadState",
30540 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030541 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030542 printf(" %d", n_reader);
30543 printf("\n");
30544 }
30545 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030546 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030547#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000030548
Daniel Veillard42595322004-11-08 10:52:06 +000030549 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030550}
30551
30552
30553static int
30554test_xmlTextReaderRelaxNGSetSchema(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030555 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030556
Daniel Veillardce682bc2004-11-05 17:22:25 +000030557#ifdef LIBXML_READER_ENABLED
30558#ifdef LIBXML_SCHEMAS_ENABLED
30559 int mem_base;
30560 int ret_val;
30561 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30562 int n_reader;
30563 xmlRelaxNGPtr schema; /* a precompiled RelaxNG schema */
30564 int n_schema;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030565
Daniel Veillardce682bc2004-11-05 17:22:25 +000030566 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30567 for (n_schema = 0;n_schema < gen_nb_xmlRelaxNGPtr;n_schema++) {
30568 mem_base = xmlMemBlocks();
30569 reader = gen_xmlTextReaderPtr(n_reader, 0);
30570 schema = gen_xmlRelaxNGPtr(n_schema, 1);
30571
30572 ret_val = xmlTextReaderRelaxNGSetSchema(reader, schema);
30573 desret_int(ret_val);
30574 call_tests++;
30575 des_xmlTextReaderPtr(n_reader, reader, 0);
30576 des_xmlRelaxNGPtr(n_schema, schema, 1);
30577 xmlResetLastError();
30578 if (mem_base != xmlMemBlocks()) {
30579 printf("Leak of %d blocks found in xmlTextReaderRelaxNGSetSchema",
30580 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030581 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030582 printf(" %d", n_reader);
30583 printf(" %d", n_schema);
30584 printf("\n");
30585 }
30586 }
30587 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030588 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030589#endif
30590#endif
30591
Daniel Veillard42595322004-11-08 10:52:06 +000030592 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030593}
30594
30595
30596static int
30597test_xmlTextReaderRelaxNGValidate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030598 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030599
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030600#ifdef LIBXML_READER_ENABLED
30601#ifdef LIBXML_SCHEMAS_ENABLED
30602 int mem_base;
30603 int ret_val;
30604 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30605 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030606 char * rng; /* the path to a RelaxNG schema or NULL */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030607 int n_rng;
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 for (n_rng = 0;n_rng < gen_nb_const_char_ptr;n_rng++) {
30611 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030612 reader = gen_xmlTextReaderPtr(n_reader, 0);
30613 rng = gen_const_char_ptr(n_rng, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030614
William M. Brackf13f77f2004-11-12 16:03:48 +000030615 ret_val = xmlTextReaderRelaxNGValidate(reader, (const char *)rng);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030616 desret_int(ret_val);
30617 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030618 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000030619 des_const_char_ptr(n_rng, (const char *)rng, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030620 xmlResetLastError();
30621 if (mem_base != xmlMemBlocks()) {
30622 printf("Leak of %d blocks found in xmlTextReaderRelaxNGValidate",
30623 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030624 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030625 printf(" %d", n_reader);
30626 printf(" %d", n_rng);
30627 printf("\n");
30628 }
30629 }
30630 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030631 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030632#endif
30633#endif
30634
Daniel Veillard42595322004-11-08 10:52:06 +000030635 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030636}
30637
30638
30639static int
30640test_xmlTextReaderSetErrorHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030641 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030642
30643
30644 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000030645 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030646}
30647
30648
30649static int
30650test_xmlTextReaderSetParserProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030651 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030652
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030653#ifdef LIBXML_READER_ENABLED
30654 int mem_base;
30655 int ret_val;
30656 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30657 int n_reader;
30658 int prop; /* the xmlParserProperties to set */
30659 int n_prop;
30660 int value; /* usually 0 or 1 to (de)activate it */
30661 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030662
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030663 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30664 for (n_prop = 0;n_prop < gen_nb_int;n_prop++) {
30665 for (n_value = 0;n_value < gen_nb_int;n_value++) {
30666 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030667 reader = gen_xmlTextReaderPtr(n_reader, 0);
30668 prop = gen_int(n_prop, 1);
30669 value = gen_int(n_value, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030670
30671 ret_val = xmlTextReaderSetParserProp(reader, prop, value);
30672 desret_int(ret_val);
30673 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030674 des_xmlTextReaderPtr(n_reader, reader, 0);
30675 des_int(n_prop, prop, 1);
30676 des_int(n_value, value, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030677 xmlResetLastError();
30678 if (mem_base != xmlMemBlocks()) {
30679 printf("Leak of %d blocks found in xmlTextReaderSetParserProp",
30680 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030681 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030682 printf(" %d", n_reader);
30683 printf(" %d", n_prop);
30684 printf(" %d", n_value);
30685 printf("\n");
30686 }
30687 }
30688 }
30689 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030690 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030691#endif
30692
Daniel Veillard42595322004-11-08 10:52:06 +000030693 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030694}
30695
30696
30697static int
30698test_xmlTextReaderSetStructuredErrorHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030699 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030700
30701
30702 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000030703 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030704}
30705
30706
30707static int
30708test_xmlTextReaderStandalone(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030709 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030710
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030711#ifdef LIBXML_READER_ENABLED
30712 int mem_base;
30713 int ret_val;
30714 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30715 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030716
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030717 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30718 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030719 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030720
30721 ret_val = xmlTextReaderStandalone(reader);
30722 desret_int(ret_val);
30723 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030724 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030725 xmlResetLastError();
30726 if (mem_base != xmlMemBlocks()) {
30727 printf("Leak of %d blocks found in xmlTextReaderStandalone",
30728 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030729 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030730 printf(" %d", n_reader);
30731 printf("\n");
30732 }
30733 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030734 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030735#endif
30736
Daniel Veillard42595322004-11-08 10:52:06 +000030737 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030738}
30739
30740
30741static int
30742test_xmlTextReaderValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030743 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030744
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030745#ifdef LIBXML_READER_ENABLED
30746 int mem_base;
30747 xmlChar * ret_val;
30748 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30749 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030750
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030751 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30752 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030753 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030754
30755 ret_val = xmlTextReaderValue(reader);
30756 desret_xmlChar_ptr(ret_val);
30757 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030758 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030759 xmlResetLastError();
30760 if (mem_base != xmlMemBlocks()) {
30761 printf("Leak of %d blocks found in xmlTextReaderValue",
30762 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030763 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030764 printf(" %d", n_reader);
30765 printf("\n");
30766 }
30767 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030768 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030769#endif
30770
Daniel Veillard42595322004-11-08 10:52:06 +000030771 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030772}
30773
30774
30775static int
30776test_xmlTextReaderXmlLang(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030777 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030778
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030779#ifdef LIBXML_READER_ENABLED
30780 int mem_base;
30781 xmlChar * ret_val;
30782 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30783 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030784
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030785 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30786 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030787 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030788
30789 ret_val = xmlTextReaderXmlLang(reader);
30790 desret_xmlChar_ptr(ret_val);
30791 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030792 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030793 xmlResetLastError();
30794 if (mem_base != xmlMemBlocks()) {
30795 printf("Leak of %d blocks found in xmlTextReaderXmlLang",
30796 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030797 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030798 printf(" %d", n_reader);
30799 printf("\n");
30800 }
30801 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030802 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030803#endif
30804
Daniel Veillard42595322004-11-08 10:52:06 +000030805 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030806}
30807
30808static int
30809test_xmlreader(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030810 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030811
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030812 if (quiet == 0) printf("Testing xmlreader : 68 of 78 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000030813 test_ret += test_xmlNewTextReader();
30814 test_ret += test_xmlNewTextReaderFilename();
30815 test_ret += test_xmlReaderForDoc();
30816 test_ret += test_xmlReaderForFile();
30817 test_ret += test_xmlReaderForMemory();
30818 test_ret += test_xmlReaderNewDoc();
30819 test_ret += test_xmlReaderNewFile();
30820 test_ret += test_xmlReaderNewMemory();
30821 test_ret += test_xmlReaderNewWalker();
30822 test_ret += test_xmlReaderWalker();
30823 test_ret += test_xmlTextReaderAttributeCount();
30824 test_ret += test_xmlTextReaderBaseUri();
30825 test_ret += test_xmlTextReaderClose();
30826 test_ret += test_xmlTextReaderConstBaseUri();
30827 test_ret += test_xmlTextReaderConstEncoding();
30828 test_ret += test_xmlTextReaderConstLocalName();
30829 test_ret += test_xmlTextReaderConstName();
30830 test_ret += test_xmlTextReaderConstNamespaceUri();
30831 test_ret += test_xmlTextReaderConstPrefix();
30832 test_ret += test_xmlTextReaderConstString();
30833 test_ret += test_xmlTextReaderConstValue();
30834 test_ret += test_xmlTextReaderConstXmlLang();
30835 test_ret += test_xmlTextReaderConstXmlVersion();
30836 test_ret += test_xmlTextReaderCurrentDoc();
30837 test_ret += test_xmlTextReaderCurrentNode();
30838 test_ret += test_xmlTextReaderDepth();
30839 test_ret += test_xmlTextReaderExpand();
30840 test_ret += test_xmlTextReaderGetAttribute();
30841 test_ret += test_xmlTextReaderGetAttributeNo();
30842 test_ret += test_xmlTextReaderGetAttributeNs();
30843 test_ret += test_xmlTextReaderGetErrorHandler();
30844 test_ret += test_xmlTextReaderGetParserProp();
30845 test_ret += test_xmlTextReaderGetRemainder();
30846 test_ret += test_xmlTextReaderHasAttributes();
30847 test_ret += test_xmlTextReaderHasValue();
30848 test_ret += test_xmlTextReaderIsDefault();
30849 test_ret += test_xmlTextReaderIsEmptyElement();
30850 test_ret += test_xmlTextReaderIsNamespaceDecl();
30851 test_ret += test_xmlTextReaderIsValid();
30852 test_ret += test_xmlTextReaderLocalName();
30853 test_ret += test_xmlTextReaderLocatorBaseURI();
30854 test_ret += test_xmlTextReaderLocatorLineNumber();
30855 test_ret += test_xmlTextReaderLookupNamespace();
30856 test_ret += test_xmlTextReaderMoveToAttribute();
30857 test_ret += test_xmlTextReaderMoveToAttributeNo();
30858 test_ret += test_xmlTextReaderMoveToAttributeNs();
30859 test_ret += test_xmlTextReaderMoveToElement();
30860 test_ret += test_xmlTextReaderMoveToFirstAttribute();
30861 test_ret += test_xmlTextReaderMoveToNextAttribute();
30862 test_ret += test_xmlTextReaderName();
30863 test_ret += test_xmlTextReaderNamespaceUri();
30864 test_ret += test_xmlTextReaderNext();
30865 test_ret += test_xmlTextReaderNextSibling();
30866 test_ret += test_xmlTextReaderNodeType();
30867 test_ret += test_xmlTextReaderNormalization();
30868 test_ret += test_xmlTextReaderPrefix();
30869 test_ret += test_xmlTextReaderPreserve();
30870 test_ret += test_xmlTextReaderPreservePattern();
30871 test_ret += test_xmlTextReaderQuoteChar();
30872 test_ret += test_xmlTextReaderRead();
30873 test_ret += test_xmlTextReaderReadAttributeValue();
30874 test_ret += test_xmlTextReaderReadState();
30875 test_ret += test_xmlTextReaderRelaxNGSetSchema();
30876 test_ret += test_xmlTextReaderRelaxNGValidate();
30877 test_ret += test_xmlTextReaderSetErrorHandler();
30878 test_ret += test_xmlTextReaderSetParserProp();
30879 test_ret += test_xmlTextReaderSetStructuredErrorHandler();
30880 test_ret += test_xmlTextReaderStandalone();
30881 test_ret += test_xmlTextReaderValue();
30882 test_ret += test_xmlTextReaderXmlLang();
Daniel Veillardd93f6252004-11-02 15:53:51 +000030883
Daniel Veillard42595322004-11-08 10:52:06 +000030884 if (test_ret != 0)
30885 printf("Module xmlreader: %d errors\n", test_ret);
30886 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030887}
Daniel Veillarda521d282004-11-09 14:59:59 +000030888#ifdef LIBXML_REGEXP_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000030889
Daniel Veillarda82b1822004-11-08 16:24:57 +000030890#define gen_nb_xmlRegExecCtxtPtr 1
30891static xmlRegExecCtxtPtr gen_xmlRegExecCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
30892 return(NULL);
30893}
30894static void des_xmlRegExecCtxtPtr(int no ATTRIBUTE_UNUSED, xmlRegExecCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
30895}
Daniel Veillarda521d282004-11-09 14:59:59 +000030896#endif
30897
Daniel Veillarda82b1822004-11-08 16:24:57 +000030898
30899static int
30900test_xmlRegExecPushString(void) {
30901 int test_ret = 0;
30902
30903#ifdef LIBXML_REGEXP_ENABLED
30904 int mem_base;
30905 int ret_val;
30906 xmlRegExecCtxtPtr exec; /* a regexp execution context or NULL to indicate the end */
30907 int n_exec;
30908 xmlChar * value; /* a string token input */
30909 int n_value;
30910 void * data; /* data associated to the token to reuse in callbacks */
30911 int n_data;
30912
30913 for (n_exec = 0;n_exec < gen_nb_xmlRegExecCtxtPtr;n_exec++) {
30914 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
30915 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
30916 mem_base = xmlMemBlocks();
30917 exec = gen_xmlRegExecCtxtPtr(n_exec, 0);
30918 value = gen_const_xmlChar_ptr(n_value, 1);
30919 data = gen_userdata(n_data, 2);
30920
William M. Brackf13f77f2004-11-12 16:03:48 +000030921 ret_val = xmlRegExecPushString(exec, (const xmlChar *)value, data);
Daniel Veillarda82b1822004-11-08 16:24:57 +000030922 desret_int(ret_val);
30923 call_tests++;
30924 des_xmlRegExecCtxtPtr(n_exec, exec, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000030925 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillarda82b1822004-11-08 16:24:57 +000030926 des_userdata(n_data, data, 2);
30927 xmlResetLastError();
30928 if (mem_base != xmlMemBlocks()) {
30929 printf("Leak of %d blocks found in xmlRegExecPushString",
30930 xmlMemBlocks() - mem_base);
30931 test_ret++;
30932 printf(" %d", n_exec);
30933 printf(" %d", n_value);
30934 printf(" %d", n_data);
30935 printf("\n");
30936 }
30937 }
30938 }
30939 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030940 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000030941#endif
30942
Daniel Veillarda82b1822004-11-08 16:24:57 +000030943 return(test_ret);
30944}
30945
30946
30947static int
30948test_xmlRegExecPushString2(void) {
30949 int test_ret = 0;
30950
30951#ifdef LIBXML_REGEXP_ENABLED
30952 int mem_base;
30953 int ret_val;
30954 xmlRegExecCtxtPtr exec; /* a regexp execution context or NULL to indicate the end */
30955 int n_exec;
30956 xmlChar * value; /* the first string token input */
30957 int n_value;
30958 xmlChar * value2; /* the second string token input */
30959 int n_value2;
30960 void * data; /* data associated to the token to reuse in callbacks */
30961 int n_data;
30962
30963 for (n_exec = 0;n_exec < gen_nb_xmlRegExecCtxtPtr;n_exec++) {
30964 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
30965 for (n_value2 = 0;n_value2 < gen_nb_const_xmlChar_ptr;n_value2++) {
30966 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
30967 mem_base = xmlMemBlocks();
30968 exec = gen_xmlRegExecCtxtPtr(n_exec, 0);
30969 value = gen_const_xmlChar_ptr(n_value, 1);
30970 value2 = gen_const_xmlChar_ptr(n_value2, 2);
30971 data = gen_userdata(n_data, 3);
30972
William M. Brackf13f77f2004-11-12 16:03:48 +000030973 ret_val = xmlRegExecPushString2(exec, (const xmlChar *)value, (const xmlChar *)value2, data);
Daniel Veillarda82b1822004-11-08 16:24:57 +000030974 desret_int(ret_val);
30975 call_tests++;
30976 des_xmlRegExecCtxtPtr(n_exec, exec, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000030977 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
30978 des_const_xmlChar_ptr(n_value2, (const xmlChar *)value2, 2);
Daniel Veillarda82b1822004-11-08 16:24:57 +000030979 des_userdata(n_data, data, 3);
30980 xmlResetLastError();
30981 if (mem_base != xmlMemBlocks()) {
30982 printf("Leak of %d blocks found in xmlRegExecPushString2",
30983 xmlMemBlocks() - mem_base);
30984 test_ret++;
30985 printf(" %d", n_exec);
30986 printf(" %d", n_value);
30987 printf(" %d", n_value2);
30988 printf(" %d", n_data);
30989 printf("\n");
30990 }
30991 }
30992 }
30993 }
30994 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030995 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000030996#endif
30997
Daniel Veillarda82b1822004-11-08 16:24:57 +000030998 return(test_ret);
30999}
31000
Daniel Veillarda521d282004-11-09 14:59:59 +000031001#ifdef LIBXML_REGEXP_ENABLED
Daniel Veillarda82b1822004-11-08 16:24:57 +000031002
31003#define gen_nb_xmlRegexpPtr 1
31004static xmlRegexpPtr gen_xmlRegexpPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31005 return(NULL);
31006}
31007static void des_xmlRegexpPtr(int no ATTRIBUTE_UNUSED, xmlRegexpPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31008}
Daniel Veillarda521d282004-11-09 14:59:59 +000031009#endif
31010
Daniel Veillarda82b1822004-11-08 16:24:57 +000031011
31012static int
31013test_xmlRegNewExecCtxt(void) {
31014 int test_ret = 0;
31015
31016
31017 /* missing type support */
31018 return(test_ret);
31019}
31020
31021
31022static int
31023test_xmlRegexpCompile(void) {
31024 int test_ret = 0;
31025
31026
31027 /* missing type support */
31028 return(test_ret);
31029}
31030
31031
31032static int
31033test_xmlRegexpExec(void) {
31034 int test_ret = 0;
31035
31036#ifdef LIBXML_REGEXP_ENABLED
31037 int mem_base;
31038 int ret_val;
31039 xmlRegexpPtr comp; /* the compiled regular expression */
31040 int n_comp;
31041 xmlChar * content; /* the value to check against the regular expression */
31042 int n_content;
31043
31044 for (n_comp = 0;n_comp < gen_nb_xmlRegexpPtr;n_comp++) {
31045 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
31046 mem_base = xmlMemBlocks();
31047 comp = gen_xmlRegexpPtr(n_comp, 0);
31048 content = gen_const_xmlChar_ptr(n_content, 1);
31049
William M. Brackf13f77f2004-11-12 16:03:48 +000031050 ret_val = xmlRegexpExec(comp, (const xmlChar *)content);
Daniel Veillarda82b1822004-11-08 16:24:57 +000031051 desret_int(ret_val);
31052 call_tests++;
31053 des_xmlRegexpPtr(n_comp, comp, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000031054 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillarda82b1822004-11-08 16:24:57 +000031055 xmlResetLastError();
31056 if (mem_base != xmlMemBlocks()) {
31057 printf("Leak of %d blocks found in xmlRegexpExec",
31058 xmlMemBlocks() - mem_base);
31059 test_ret++;
31060 printf(" %d", n_comp);
31061 printf(" %d", n_content);
31062 printf("\n");
31063 }
31064 }
31065 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031066 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000031067#endif
31068
Daniel Veillarda82b1822004-11-08 16:24:57 +000031069 return(test_ret);
31070}
31071
31072
31073static int
31074test_xmlRegexpIsDeterminist(void) {
31075 int test_ret = 0;
31076
31077#ifdef LIBXML_REGEXP_ENABLED
31078 int mem_base;
31079 int ret_val;
31080 xmlRegexpPtr comp; /* the compiled regular expression */
31081 int n_comp;
31082
31083 for (n_comp = 0;n_comp < gen_nb_xmlRegexpPtr;n_comp++) {
31084 mem_base = xmlMemBlocks();
31085 comp = gen_xmlRegexpPtr(n_comp, 0);
31086
31087 ret_val = xmlRegexpIsDeterminist(comp);
31088 desret_int(ret_val);
31089 call_tests++;
31090 des_xmlRegexpPtr(n_comp, comp, 0);
31091 xmlResetLastError();
31092 if (mem_base != xmlMemBlocks()) {
31093 printf("Leak of %d blocks found in xmlRegexpIsDeterminist",
31094 xmlMemBlocks() - mem_base);
31095 test_ret++;
31096 printf(" %d", n_comp);
31097 printf("\n");
31098 }
31099 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031100 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000031101#endif
31102
Daniel Veillarda82b1822004-11-08 16:24:57 +000031103 return(test_ret);
31104}
31105
31106
31107static int
31108test_xmlRegexpPrint(void) {
31109 int test_ret = 0;
31110
31111#ifdef LIBXML_REGEXP_ENABLED
31112 int mem_base;
31113 FILE * output; /* the file for the output debug */
31114 int n_output;
31115 xmlRegexpPtr regexp; /* the compiled regexp */
31116 int n_regexp;
31117
31118 for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
31119 for (n_regexp = 0;n_regexp < gen_nb_xmlRegexpPtr;n_regexp++) {
31120 mem_base = xmlMemBlocks();
31121 output = gen_FILE_ptr(n_output, 0);
31122 regexp = gen_xmlRegexpPtr(n_regexp, 1);
31123
31124 xmlRegexpPrint(output, regexp);
31125 call_tests++;
31126 des_FILE_ptr(n_output, output, 0);
31127 des_xmlRegexpPtr(n_regexp, regexp, 1);
31128 xmlResetLastError();
31129 if (mem_base != xmlMemBlocks()) {
31130 printf("Leak of %d blocks found in xmlRegexpPrint",
31131 xmlMemBlocks() - mem_base);
31132 test_ret++;
31133 printf(" %d", n_output);
31134 printf(" %d", n_regexp);
31135 printf("\n");
31136 }
31137 }
31138 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031139 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000031140#endif
31141
Daniel Veillarda82b1822004-11-08 16:24:57 +000031142 return(test_ret);
31143}
31144
31145static int
31146test_xmlregexp(void) {
31147 int test_ret = 0;
31148
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031149 if (quiet == 0) printf("Testing xmlregexp : 5 of 9 functions ...\n");
Daniel Veillarda82b1822004-11-08 16:24:57 +000031150 test_ret += test_xmlRegExecPushString();
31151 test_ret += test_xmlRegExecPushString2();
31152 test_ret += test_xmlRegNewExecCtxt();
31153 test_ret += test_xmlRegexpCompile();
31154 test_ret += test_xmlRegexpExec();
31155 test_ret += test_xmlRegexpIsDeterminist();
31156 test_ret += test_xmlRegexpPrint();
31157
31158 if (test_ret != 0)
31159 printf("Module xmlregexp: %d errors\n", test_ret);
31160 return(test_ret);
31161}
Daniel Veillarda521d282004-11-09 14:59:59 +000031162#ifdef LIBXML_OUTPUT_ENABLED
Daniel Veillarda82b1822004-11-08 16:24:57 +000031163
Daniel Veillardce682bc2004-11-05 17:22:25 +000031164#define gen_nb_xmlSaveCtxtPtr 1
31165static xmlSaveCtxtPtr gen_xmlSaveCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31166 return(NULL);
31167}
31168static void des_xmlSaveCtxtPtr(int no ATTRIBUTE_UNUSED, xmlSaveCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31169}
Daniel Veillarda521d282004-11-09 14:59:59 +000031170#endif
31171
Daniel Veillardce682bc2004-11-05 17:22:25 +000031172
Daniel Veillardd93f6252004-11-02 15:53:51 +000031173static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000031174test_xmlSaveClose(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031175 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031176
Daniel Veillardce682bc2004-11-05 17:22:25 +000031177#ifdef LIBXML_OUTPUT_ENABLED
31178 int mem_base;
31179 int ret_val;
31180 xmlSaveCtxtPtr ctxt; /* a document saving context */
31181 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031182
Daniel Veillardce682bc2004-11-05 17:22:25 +000031183 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSaveCtxtPtr;n_ctxt++) {
31184 mem_base = xmlMemBlocks();
31185 ctxt = gen_xmlSaveCtxtPtr(n_ctxt, 0);
31186
31187 ret_val = xmlSaveClose(ctxt);
31188 desret_int(ret_val);
31189 call_tests++;
31190 des_xmlSaveCtxtPtr(n_ctxt, ctxt, 0);
31191 xmlResetLastError();
31192 if (mem_base != xmlMemBlocks()) {
31193 printf("Leak of %d blocks found in xmlSaveClose",
31194 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031195 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031196 printf(" %d", n_ctxt);
31197 printf("\n");
31198 }
31199 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031200 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031201#endif
31202
Daniel Veillard42595322004-11-08 10:52:06 +000031203 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031204}
31205
31206
31207static int
31208test_xmlSaveDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031209 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031210
Daniel Veillardce682bc2004-11-05 17:22:25 +000031211#ifdef LIBXML_OUTPUT_ENABLED
31212 int mem_base;
31213 long ret_val;
31214 xmlSaveCtxtPtr ctxt; /* a document saving context */
31215 int n_ctxt;
31216 xmlDocPtr doc; /* a document */
31217 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031218
Daniel Veillardce682bc2004-11-05 17:22:25 +000031219 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSaveCtxtPtr;n_ctxt++) {
31220 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
31221 mem_base = xmlMemBlocks();
31222 ctxt = gen_xmlSaveCtxtPtr(n_ctxt, 0);
31223 doc = gen_xmlDocPtr(n_doc, 1);
31224
31225 ret_val = xmlSaveDoc(ctxt, doc);
31226 desret_long(ret_val);
31227 call_tests++;
31228 des_xmlSaveCtxtPtr(n_ctxt, ctxt, 0);
31229 des_xmlDocPtr(n_doc, doc, 1);
31230 xmlResetLastError();
31231 if (mem_base != xmlMemBlocks()) {
31232 printf("Leak of %d blocks found in xmlSaveDoc",
31233 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031234 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031235 printf(" %d", n_ctxt);
31236 printf(" %d", n_doc);
31237 printf("\n");
31238 }
31239 }
31240 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031241 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031242#endif
31243
Daniel Veillard42595322004-11-08 10:52:06 +000031244 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031245}
31246
31247
31248static int
31249test_xmlSaveFlush(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031250 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031251
Daniel Veillardce682bc2004-11-05 17:22:25 +000031252#ifdef LIBXML_OUTPUT_ENABLED
31253 int mem_base;
31254 int ret_val;
31255 xmlSaveCtxtPtr ctxt; /* a document saving context */
31256 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031257
Daniel Veillardce682bc2004-11-05 17:22:25 +000031258 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSaveCtxtPtr;n_ctxt++) {
31259 mem_base = xmlMemBlocks();
31260 ctxt = gen_xmlSaveCtxtPtr(n_ctxt, 0);
31261
31262 ret_val = xmlSaveFlush(ctxt);
31263 desret_int(ret_val);
31264 call_tests++;
31265 des_xmlSaveCtxtPtr(n_ctxt, ctxt, 0);
31266 xmlResetLastError();
31267 if (mem_base != xmlMemBlocks()) {
31268 printf("Leak of %d blocks found in xmlSaveFlush",
31269 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031270 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031271 printf(" %d", n_ctxt);
31272 printf("\n");
31273 }
31274 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031275 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031276#endif
31277
Daniel Veillard42595322004-11-08 10:52:06 +000031278 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031279}
31280
31281
31282static int
31283test_xmlSaveSetAttrEscape(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031284 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031285
31286
31287 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031288 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031289}
31290
31291
31292static int
31293test_xmlSaveSetEscape(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031294 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031295
31296
31297 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031298 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031299}
31300
31301
31302static int
31303test_xmlSaveToFd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031304 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031305
31306
31307 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031308 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031309}
31310
31311
31312static int
31313test_xmlSaveToFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031314 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031315
31316
31317 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031318 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031319}
31320
31321
31322static int
31323test_xmlSaveTree(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031324 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031325
Daniel Veillardce682bc2004-11-05 17:22:25 +000031326#ifdef LIBXML_OUTPUT_ENABLED
31327 int mem_base;
31328 long ret_val;
31329 xmlSaveCtxtPtr ctxt; /* a document saving context */
31330 int n_ctxt;
31331 xmlNodePtr node; /* a document */
31332 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031333
Daniel Veillardce682bc2004-11-05 17:22:25 +000031334 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSaveCtxtPtr;n_ctxt++) {
31335 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
31336 mem_base = xmlMemBlocks();
31337 ctxt = gen_xmlSaveCtxtPtr(n_ctxt, 0);
31338 node = gen_xmlNodePtr(n_node, 1);
31339
31340 ret_val = xmlSaveTree(ctxt, node);
31341 desret_long(ret_val);
31342 call_tests++;
31343 des_xmlSaveCtxtPtr(n_ctxt, ctxt, 0);
31344 des_xmlNodePtr(n_node, node, 1);
31345 xmlResetLastError();
31346 if (mem_base != xmlMemBlocks()) {
31347 printf("Leak of %d blocks found in xmlSaveTree",
31348 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031349 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031350 printf(" %d", n_ctxt);
31351 printf(" %d", n_node);
31352 printf("\n");
31353 }
31354 }
31355 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031356 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031357#endif
31358
Daniel Veillard42595322004-11-08 10:52:06 +000031359 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031360}
31361
31362static int
31363test_xmlsave(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031364 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031365
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031366 if (quiet == 0) printf("Testing xmlsave : 4 of 9 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000031367 test_ret += test_xmlSaveClose();
31368 test_ret += test_xmlSaveDoc();
31369 test_ret += test_xmlSaveFlush();
31370 test_ret += test_xmlSaveSetAttrEscape();
31371 test_ret += test_xmlSaveSetEscape();
31372 test_ret += test_xmlSaveToFd();
31373 test_ret += test_xmlSaveToFilename();
31374 test_ret += test_xmlSaveTree();
Daniel Veillardd93f6252004-11-02 15:53:51 +000031375
Daniel Veillard42595322004-11-08 10:52:06 +000031376 if (test_ret != 0)
31377 printf("Module xmlsave: %d errors\n", test_ret);
31378 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031379}
Daniel Veillarda521d282004-11-09 14:59:59 +000031380#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000031381
Daniel Veillardce682bc2004-11-05 17:22:25 +000031382#define gen_nb_xmlSchemaPtr 1
31383static xmlSchemaPtr gen_xmlSchemaPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31384 return(NULL);
31385}
31386static void des_xmlSchemaPtr(int no ATTRIBUTE_UNUSED, xmlSchemaPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31387}
Daniel Veillarda521d282004-11-09 14:59:59 +000031388#endif
31389
Daniel Veillardce682bc2004-11-05 17:22:25 +000031390
Daniel Veillardd93f6252004-11-02 15:53:51 +000031391static int
31392test_xmlSchemaDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031393 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031394
Daniel Veillardce682bc2004-11-05 17:22:25 +000031395#ifdef LIBXML_SCHEMAS_ENABLED
31396#ifdef LIBXML_OUTPUT_ENABLED
31397 int mem_base;
31398 FILE * output; /* the file output */
31399 int n_output;
31400 xmlSchemaPtr schema; /* a schema structure */
31401 int n_schema;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031402
Daniel Veillardce682bc2004-11-05 17:22:25 +000031403 for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
31404 for (n_schema = 0;n_schema < gen_nb_xmlSchemaPtr;n_schema++) {
31405 mem_base = xmlMemBlocks();
31406 output = gen_FILE_ptr(n_output, 0);
31407 schema = gen_xmlSchemaPtr(n_schema, 1);
31408
31409 xmlSchemaDump(output, schema);
31410 call_tests++;
31411 des_FILE_ptr(n_output, output, 0);
31412 des_xmlSchemaPtr(n_schema, schema, 1);
31413 xmlResetLastError();
31414 if (mem_base != xmlMemBlocks()) {
31415 printf("Leak of %d blocks found in xmlSchemaDump",
31416 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031417 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031418 printf(" %d", n_output);
31419 printf(" %d", n_schema);
31420 printf("\n");
31421 }
31422 }
31423 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031424 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031425#endif
31426#endif
31427
Daniel Veillard42595322004-11-08 10:52:06 +000031428 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031429}
31430
Daniel Veillarda521d282004-11-09 14:59:59 +000031431#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000031432
Daniel Veillardce682bc2004-11-05 17:22:25 +000031433#define gen_nb_xmlSchemaParserCtxtPtr 1
31434static xmlSchemaParserCtxtPtr gen_xmlSchemaParserCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31435 return(NULL);
31436}
31437static void des_xmlSchemaParserCtxtPtr(int no ATTRIBUTE_UNUSED, xmlSchemaParserCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31438}
Daniel Veillarda521d282004-11-09 14:59:59 +000031439#endif
31440
31441#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000031442
31443#define gen_nb_xmlSchemaValidityErrorFunc_ptr 1
31444static xmlSchemaValidityErrorFunc * gen_xmlSchemaValidityErrorFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31445 return(NULL);
31446}
31447static void des_xmlSchemaValidityErrorFunc_ptr(int no ATTRIBUTE_UNUSED, xmlSchemaValidityErrorFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31448}
Daniel Veillarda521d282004-11-09 14:59:59 +000031449#endif
31450
31451#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000031452
31453#define gen_nb_xmlSchemaValidityWarningFunc_ptr 1
31454static xmlSchemaValidityWarningFunc * gen_xmlSchemaValidityWarningFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31455 return(NULL);
31456}
31457static void des_xmlSchemaValidityWarningFunc_ptr(int no ATTRIBUTE_UNUSED, xmlSchemaValidityWarningFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31458}
Daniel Veillarda521d282004-11-09 14:59:59 +000031459#endif
31460
Daniel Veillardce682bc2004-11-05 17:22:25 +000031461
Daniel Veillardd93f6252004-11-02 15:53:51 +000031462static int
31463test_xmlSchemaGetParserErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031464 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031465
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000031466#ifdef LIBXML_SCHEMAS_ENABLED
31467 int mem_base;
31468 int ret_val;
31469 xmlSchemaParserCtxtPtr ctxt; /* a XMl-Schema parser context */
31470 int n_ctxt;
31471 xmlSchemaValidityErrorFunc * err; /* the error callback result */
31472 int n_err;
31473 xmlSchemaValidityWarningFunc * warn; /* the warning callback result */
31474 int n_warn;
31475 void ** ctx; /* contextual data for the callbacks result */
31476 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031477
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000031478 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaParserCtxtPtr;n_ctxt++) {
31479 for (n_err = 0;n_err < gen_nb_xmlSchemaValidityErrorFunc_ptr;n_err++) {
31480 for (n_warn = 0;n_warn < gen_nb_xmlSchemaValidityWarningFunc_ptr;n_warn++) {
31481 for (n_ctx = 0;n_ctx < gen_nb_void_ptr_ptr;n_ctx++) {
31482 mem_base = xmlMemBlocks();
31483 ctxt = gen_xmlSchemaParserCtxtPtr(n_ctxt, 0);
31484 err = gen_xmlSchemaValidityErrorFunc_ptr(n_err, 1);
31485 warn = gen_xmlSchemaValidityWarningFunc_ptr(n_warn, 2);
31486 ctx = gen_void_ptr_ptr(n_ctx, 3);
31487
31488 ret_val = xmlSchemaGetParserErrors(ctxt, err, warn, ctx);
31489 desret_int(ret_val);
31490 call_tests++;
31491 des_xmlSchemaParserCtxtPtr(n_ctxt, ctxt, 0);
31492 des_xmlSchemaValidityErrorFunc_ptr(n_err, err, 1);
31493 des_xmlSchemaValidityWarningFunc_ptr(n_warn, warn, 2);
31494 des_void_ptr_ptr(n_ctx, ctx, 3);
31495 xmlResetLastError();
31496 if (mem_base != xmlMemBlocks()) {
31497 printf("Leak of %d blocks found in xmlSchemaGetParserErrors",
31498 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031499 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000031500 printf(" %d", n_ctxt);
31501 printf(" %d", n_err);
31502 printf(" %d", n_warn);
31503 printf(" %d", n_ctx);
31504 printf("\n");
31505 }
31506 }
31507 }
31508 }
31509 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031510 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000031511#endif
31512
Daniel Veillard42595322004-11-08 10:52:06 +000031513 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031514}
31515
Daniel Veillarda521d282004-11-09 14:59:59 +000031516#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000031517
Daniel Veillardce682bc2004-11-05 17:22:25 +000031518#define gen_nb_xmlSchemaValidCtxtPtr 1
31519static xmlSchemaValidCtxtPtr gen_xmlSchemaValidCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31520 return(NULL);
31521}
31522static void des_xmlSchemaValidCtxtPtr(int no ATTRIBUTE_UNUSED, xmlSchemaValidCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31523}
Daniel Veillarda521d282004-11-09 14:59:59 +000031524#endif
31525
Daniel Veillardce682bc2004-11-05 17:22:25 +000031526
Daniel Veillardd93f6252004-11-02 15:53:51 +000031527static int
31528test_xmlSchemaGetValidErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031529 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031530
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000031531#ifdef LIBXML_SCHEMAS_ENABLED
31532 int mem_base;
31533 int ret_val;
31534 xmlSchemaValidCtxtPtr ctxt; /* a XML-Schema validation context */
31535 int n_ctxt;
31536 xmlSchemaValidityErrorFunc * err; /* the error function result */
31537 int n_err;
31538 xmlSchemaValidityWarningFunc * warn; /* the warning function result */
31539 int n_warn;
31540 void ** ctx; /* the functions context result */
31541 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031542
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000031543 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
31544 for (n_err = 0;n_err < gen_nb_xmlSchemaValidityErrorFunc_ptr;n_err++) {
31545 for (n_warn = 0;n_warn < gen_nb_xmlSchemaValidityWarningFunc_ptr;n_warn++) {
31546 for (n_ctx = 0;n_ctx < gen_nb_void_ptr_ptr;n_ctx++) {
31547 mem_base = xmlMemBlocks();
31548 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
31549 err = gen_xmlSchemaValidityErrorFunc_ptr(n_err, 1);
31550 warn = gen_xmlSchemaValidityWarningFunc_ptr(n_warn, 2);
31551 ctx = gen_void_ptr_ptr(n_ctx, 3);
31552
31553 ret_val = xmlSchemaGetValidErrors(ctxt, err, warn, ctx);
31554 desret_int(ret_val);
31555 call_tests++;
31556 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
31557 des_xmlSchemaValidityErrorFunc_ptr(n_err, err, 1);
31558 des_xmlSchemaValidityWarningFunc_ptr(n_warn, warn, 2);
31559 des_void_ptr_ptr(n_ctx, ctx, 3);
31560 xmlResetLastError();
31561 if (mem_base != xmlMemBlocks()) {
31562 printf("Leak of %d blocks found in xmlSchemaGetValidErrors",
31563 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031564 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000031565 printf(" %d", n_ctxt);
31566 printf(" %d", n_err);
31567 printf(" %d", n_warn);
31568 printf(" %d", n_ctx);
31569 printf("\n");
31570 }
31571 }
31572 }
31573 }
31574 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031575 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000031576#endif
31577
Daniel Veillard42595322004-11-08 10:52:06 +000031578 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031579}
31580
31581
31582static int
31583test_xmlSchemaNewDocParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031584 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031585
Daniel Veillard42595322004-11-08 10:52:06 +000031586#ifdef LIBXML_SCHEMAS_ENABLED
31587 int mem_base;
31588 xmlSchemaParserCtxtPtr ret_val;
31589 xmlDocPtr doc; /* a preparsed document tree */
31590 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031591
Daniel Veillard42595322004-11-08 10:52:06 +000031592 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
31593 mem_base = xmlMemBlocks();
31594 doc = gen_xmlDocPtr(n_doc, 0);
31595
31596 ret_val = xmlSchemaNewDocParserCtxt(doc);
31597 desret_xmlSchemaParserCtxtPtr(ret_val);
31598 call_tests++;
31599 des_xmlDocPtr(n_doc, doc, 0);
31600 xmlResetLastError();
31601 if (mem_base != xmlMemBlocks()) {
31602 printf("Leak of %d blocks found in xmlSchemaNewDocParserCtxt",
31603 xmlMemBlocks() - mem_base);
31604 test_ret++;
31605 printf(" %d", n_doc);
31606 printf("\n");
31607 }
31608 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031609 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000031610#endif
31611
Daniel Veillard42595322004-11-08 10:52:06 +000031612 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031613}
31614
31615
31616static int
31617test_xmlSchemaNewMemParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031618 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031619
Daniel Veillard42595322004-11-08 10:52:06 +000031620#ifdef LIBXML_SCHEMAS_ENABLED
31621 int mem_base;
31622 xmlSchemaParserCtxtPtr ret_val;
31623 char * buffer; /* a pointer to a char array containing the schemas */
31624 int n_buffer;
31625 int size; /* the size of the array */
31626 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031627
Daniel Veillard42595322004-11-08 10:52:06 +000031628 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
31629 for (n_size = 0;n_size < gen_nb_int;n_size++) {
31630 mem_base = xmlMemBlocks();
31631 buffer = gen_const_char_ptr(n_buffer, 0);
31632 size = gen_int(n_size, 1);
31633
William M. Brackf13f77f2004-11-12 16:03:48 +000031634 ret_val = xmlSchemaNewMemParserCtxt((const char *)buffer, size);
Daniel Veillard42595322004-11-08 10:52:06 +000031635 desret_xmlSchemaParserCtxtPtr(ret_val);
31636 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000031637 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard42595322004-11-08 10:52:06 +000031638 des_int(n_size, size, 1);
31639 xmlResetLastError();
31640 if (mem_base != xmlMemBlocks()) {
31641 printf("Leak of %d blocks found in xmlSchemaNewMemParserCtxt",
31642 xmlMemBlocks() - mem_base);
31643 test_ret++;
31644 printf(" %d", n_buffer);
31645 printf(" %d", n_size);
31646 printf("\n");
31647 }
31648 }
31649 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031650 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000031651#endif
31652
Daniel Veillard42595322004-11-08 10:52:06 +000031653 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031654}
31655
31656
31657static int
31658test_xmlSchemaNewParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031659 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031660
Daniel Veillard42595322004-11-08 10:52:06 +000031661#ifdef LIBXML_SCHEMAS_ENABLED
31662 int mem_base;
31663 xmlSchemaParserCtxtPtr ret_val;
31664 char * URL; /* the location of the schema */
31665 int n_URL;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031666
Daniel Veillard42595322004-11-08 10:52:06 +000031667 for (n_URL = 0;n_URL < gen_nb_const_char_ptr;n_URL++) {
31668 mem_base = xmlMemBlocks();
31669 URL = gen_const_char_ptr(n_URL, 0);
31670
William M. Brackf13f77f2004-11-12 16:03:48 +000031671 ret_val = xmlSchemaNewParserCtxt((const char *)URL);
Daniel Veillard42595322004-11-08 10:52:06 +000031672 desret_xmlSchemaParserCtxtPtr(ret_val);
31673 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000031674 des_const_char_ptr(n_URL, (const char *)URL, 0);
Daniel Veillard42595322004-11-08 10:52:06 +000031675 xmlResetLastError();
31676 if (mem_base != xmlMemBlocks()) {
31677 printf("Leak of %d blocks found in xmlSchemaNewParserCtxt",
31678 xmlMemBlocks() - mem_base);
31679 test_ret++;
31680 printf(" %d", n_URL);
31681 printf("\n");
31682 }
31683 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031684 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000031685#endif
31686
Daniel Veillard42595322004-11-08 10:52:06 +000031687 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031688}
31689
31690
31691static int
31692test_xmlSchemaNewValidCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031693 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031694
31695
31696 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031697 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031698}
31699
31700
31701static int
31702test_xmlSchemaParse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031703 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031704
31705
31706 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031707 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031708}
31709
31710
31711static int
31712test_xmlSchemaSetParserErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031713 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031714
31715
31716 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031717 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031718}
31719
31720
31721static int
31722test_xmlSchemaSetValidErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031723 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031724
31725
31726 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031727 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031728}
31729
31730
31731static int
31732test_xmlSchemaSetValidOptions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031733 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031734
Daniel Veillardce682bc2004-11-05 17:22:25 +000031735#ifdef LIBXML_SCHEMAS_ENABLED
31736 int mem_base;
31737 int ret_val;
31738 xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */
31739 int n_ctxt;
31740 int options; /* a combination of xmlSchemaValidOption */
31741 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031742
Daniel Veillardce682bc2004-11-05 17:22:25 +000031743 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
31744 for (n_options = 0;n_options < gen_nb_int;n_options++) {
31745 mem_base = xmlMemBlocks();
31746 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
31747 options = gen_int(n_options, 1);
31748
31749 ret_val = xmlSchemaSetValidOptions(ctxt, options);
31750 desret_int(ret_val);
31751 call_tests++;
31752 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
31753 des_int(n_options, options, 1);
31754 xmlResetLastError();
31755 if (mem_base != xmlMemBlocks()) {
31756 printf("Leak of %d blocks found in xmlSchemaSetValidOptions",
31757 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031758 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031759 printf(" %d", n_ctxt);
31760 printf(" %d", n_options);
31761 printf("\n");
31762 }
31763 }
31764 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031765 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031766#endif
31767
Daniel Veillard42595322004-11-08 10:52:06 +000031768 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031769}
31770
31771
31772static int
31773test_xmlSchemaValidCtxtGetOptions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031774 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031775
Daniel Veillardce682bc2004-11-05 17:22:25 +000031776#ifdef LIBXML_SCHEMAS_ENABLED
31777 int mem_base;
31778 int ret_val;
31779 xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */
31780 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031781
Daniel Veillardce682bc2004-11-05 17:22:25 +000031782 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
31783 mem_base = xmlMemBlocks();
31784 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
31785
31786 ret_val = xmlSchemaValidCtxtGetOptions(ctxt);
31787 desret_int(ret_val);
31788 call_tests++;
31789 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
31790 xmlResetLastError();
31791 if (mem_base != xmlMemBlocks()) {
31792 printf("Leak of %d blocks found in xmlSchemaValidCtxtGetOptions",
31793 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031794 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031795 printf(" %d", n_ctxt);
31796 printf("\n");
31797 }
31798 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031799 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031800#endif
31801
Daniel Veillard42595322004-11-08 10:52:06 +000031802 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031803}
31804
31805
31806static int
31807test_xmlSchemaValidateDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031808 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031809
Daniel Veillardce682bc2004-11-05 17:22:25 +000031810#ifdef LIBXML_SCHEMAS_ENABLED
31811 int mem_base;
31812 int ret_val;
31813 xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */
31814 int n_ctxt;
31815 xmlDocPtr doc; /* a parsed document tree */
31816 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031817
Daniel Veillardce682bc2004-11-05 17:22:25 +000031818 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
31819 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
31820 mem_base = xmlMemBlocks();
31821 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
31822 doc = gen_xmlDocPtr(n_doc, 1);
31823
31824 ret_val = xmlSchemaValidateDoc(ctxt, doc);
31825 desret_int(ret_val);
31826 call_tests++;
31827 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
31828 des_xmlDocPtr(n_doc, doc, 1);
31829 xmlResetLastError();
31830 if (mem_base != xmlMemBlocks()) {
31831 printf("Leak of %d blocks found in xmlSchemaValidateDoc",
31832 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031833 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031834 printf(" %d", n_ctxt);
31835 printf(" %d", n_doc);
31836 printf("\n");
31837 }
31838 }
31839 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031840 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031841#endif
31842
Daniel Veillard42595322004-11-08 10:52:06 +000031843 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031844}
31845
31846
31847static int
31848test_xmlSchemaValidateOneElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031849 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031850
Daniel Veillardce682bc2004-11-05 17:22:25 +000031851#ifdef LIBXML_SCHEMAS_ENABLED
31852 int mem_base;
31853 int ret_val;
31854 xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */
31855 int n_ctxt;
31856 xmlNodePtr elem; /* an element node */
31857 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031858
Daniel Veillardce682bc2004-11-05 17:22:25 +000031859 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
31860 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
31861 mem_base = xmlMemBlocks();
31862 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
31863 elem = gen_xmlNodePtr(n_elem, 1);
31864
31865 ret_val = xmlSchemaValidateOneElement(ctxt, elem);
31866 desret_int(ret_val);
31867 call_tests++;
31868 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
31869 des_xmlNodePtr(n_elem, elem, 1);
31870 xmlResetLastError();
31871 if (mem_base != xmlMemBlocks()) {
31872 printf("Leak of %d blocks found in xmlSchemaValidateOneElement",
31873 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031874 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031875 printf(" %d", n_ctxt);
31876 printf(" %d", n_elem);
31877 printf("\n");
31878 }
31879 }
31880 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031881 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031882#endif
31883
Daniel Veillard42595322004-11-08 10:52:06 +000031884 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031885}
31886
31887
31888static int
31889test_xmlSchemaValidateStream(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031890 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031891
Daniel Veillardce682bc2004-11-05 17:22:25 +000031892#ifdef LIBXML_SCHEMAS_ENABLED
31893 int mem_base;
31894 int ret_val;
31895 xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */
31896 int n_ctxt;
31897 xmlParserInputBufferPtr input; /* the input to use for reading the data */
31898 int n_input;
31899 xmlCharEncoding enc; /* an optional encoding information */
31900 int n_enc;
31901 xmlSAXHandlerPtr sax; /* a SAX handler for the resulting events */
31902 int n_sax;
31903 void * user_data; /* the context to provide to the SAX handler. */
31904 int n_user_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031905
Daniel Veillardce682bc2004-11-05 17:22:25 +000031906 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
31907 for (n_input = 0;n_input < gen_nb_xmlParserInputBufferPtr;n_input++) {
31908 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
31909 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
31910 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
31911 mem_base = xmlMemBlocks();
31912 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
31913 input = gen_xmlParserInputBufferPtr(n_input, 1);
31914 enc = gen_xmlCharEncoding(n_enc, 2);
31915 sax = gen_xmlSAXHandlerPtr(n_sax, 3);
31916 user_data = gen_userdata(n_user_data, 4);
31917
31918 ret_val = xmlSchemaValidateStream(ctxt, input, enc, sax, user_data);
31919 desret_int(ret_val);
31920 call_tests++;
31921 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
31922 des_xmlParserInputBufferPtr(n_input, input, 1);
31923 des_xmlCharEncoding(n_enc, enc, 2);
31924 des_xmlSAXHandlerPtr(n_sax, sax, 3);
31925 des_userdata(n_user_data, user_data, 4);
31926 xmlResetLastError();
31927 if (mem_base != xmlMemBlocks()) {
31928 printf("Leak of %d blocks found in xmlSchemaValidateStream",
31929 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031930 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031931 printf(" %d", n_ctxt);
31932 printf(" %d", n_input);
31933 printf(" %d", n_enc);
31934 printf(" %d", n_sax);
31935 printf(" %d", n_user_data);
31936 printf("\n");
31937 }
31938 }
31939 }
31940 }
31941 }
31942 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031943 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031944#endif
31945
Daniel Veillard42595322004-11-08 10:52:06 +000031946 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031947}
31948
31949static int
31950test_xmlschemas(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031951 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031952
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031953 if (quiet == 0) printf("Testing xmlschemas : 11 of 18 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000031954 test_ret += test_xmlSchemaDump();
31955 test_ret += test_xmlSchemaGetParserErrors();
31956 test_ret += test_xmlSchemaGetValidErrors();
31957 test_ret += test_xmlSchemaNewDocParserCtxt();
31958 test_ret += test_xmlSchemaNewMemParserCtxt();
31959 test_ret += test_xmlSchemaNewParserCtxt();
31960 test_ret += test_xmlSchemaNewValidCtxt();
31961 test_ret += test_xmlSchemaParse();
31962 test_ret += test_xmlSchemaSetParserErrors();
31963 test_ret += test_xmlSchemaSetValidErrors();
31964 test_ret += test_xmlSchemaSetValidOptions();
31965 test_ret += test_xmlSchemaValidCtxtGetOptions();
31966 test_ret += test_xmlSchemaValidateDoc();
31967 test_ret += test_xmlSchemaValidateOneElement();
31968 test_ret += test_xmlSchemaValidateStream();
Daniel Veillardd93f6252004-11-02 15:53:51 +000031969
Daniel Veillard42595322004-11-08 10:52:06 +000031970 if (test_ret != 0)
31971 printf("Module xmlschemas: %d errors\n", test_ret);
31972 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031973}
Daniel Veillarda521d282004-11-09 14:59:59 +000031974#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000031975
Daniel Veillardce682bc2004-11-05 17:22:25 +000031976#define gen_nb_xmlSchemaFacetPtr 1
31977static xmlSchemaFacetPtr gen_xmlSchemaFacetPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31978 return(NULL);
31979}
31980static void des_xmlSchemaFacetPtr(int no ATTRIBUTE_UNUSED, xmlSchemaFacetPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31981}
Daniel Veillarda521d282004-11-09 14:59:59 +000031982#endif
31983
31984#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000031985
31986#define gen_nb_xmlSchemaTypePtr 1
31987static xmlSchemaTypePtr gen_xmlSchemaTypePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31988 return(NULL);
31989}
31990static void des_xmlSchemaTypePtr(int no ATTRIBUTE_UNUSED, xmlSchemaTypePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31991}
Daniel Veillarda521d282004-11-09 14:59:59 +000031992#endif
31993
Daniel Veillardce682bc2004-11-05 17:22:25 +000031994
Daniel Veillardd93f6252004-11-02 15:53:51 +000031995static int
31996test_xmlSchemaCheckFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031997 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031998
Daniel Veillardce682bc2004-11-05 17:22:25 +000031999#ifdef LIBXML_SCHEMAS_ENABLED
32000 int mem_base;
32001 int ret_val;
32002 xmlSchemaFacetPtr facet; /* the facet */
32003 int n_facet;
32004 xmlSchemaTypePtr typeDecl; /* the schema type definition */
32005 int n_typeDecl;
32006 xmlSchemaParserCtxtPtr ctxt; /* the schema parser context or NULL */
32007 int n_ctxt;
32008 xmlChar * name; /* name of the type */
32009 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032010
Daniel Veillardce682bc2004-11-05 17:22:25 +000032011 for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) {
32012 for (n_typeDecl = 0;n_typeDecl < gen_nb_xmlSchemaTypePtr;n_typeDecl++) {
32013 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaParserCtxtPtr;n_ctxt++) {
32014 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
32015 mem_base = xmlMemBlocks();
32016 facet = gen_xmlSchemaFacetPtr(n_facet, 0);
32017 typeDecl = gen_xmlSchemaTypePtr(n_typeDecl, 1);
32018 ctxt = gen_xmlSchemaParserCtxtPtr(n_ctxt, 2);
32019 name = gen_const_xmlChar_ptr(n_name, 3);
32020
William M. Brackf13f77f2004-11-12 16:03:48 +000032021 ret_val = xmlSchemaCheckFacet(facet, typeDecl, ctxt, (const xmlChar *)name);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032022 desret_int(ret_val);
32023 call_tests++;
32024 des_xmlSchemaFacetPtr(n_facet, facet, 0);
32025 des_xmlSchemaTypePtr(n_typeDecl, typeDecl, 1);
32026 des_xmlSchemaParserCtxtPtr(n_ctxt, ctxt, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000032027 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 3);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032028 xmlResetLastError();
32029 if (mem_base != xmlMemBlocks()) {
32030 printf("Leak of %d blocks found in xmlSchemaCheckFacet",
32031 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032032 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032033 printf(" %d", n_facet);
32034 printf(" %d", n_typeDecl);
32035 printf(" %d", n_ctxt);
32036 printf(" %d", n_name);
32037 printf("\n");
32038 }
32039 }
32040 }
32041 }
32042 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032043 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032044#endif
32045
Daniel Veillard42595322004-11-08 10:52:06 +000032046 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032047}
32048
32049
32050static int
32051test_xmlSchemaCleanupTypes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032052 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032053
32054#ifdef LIBXML_SCHEMAS_ENABLED
32055 int mem_base;
32056
32057 mem_base = xmlMemBlocks();
32058
32059 xmlSchemaCleanupTypes();
32060 call_tests++;
32061 xmlResetLastError();
32062 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000032063 printf("Leak of %d blocks found in xmlSchemaCleanupTypes",
Daniel Veillardd93f6252004-11-02 15:53:51 +000032064 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032065 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000032066 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000032067 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032068 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032069#endif
32070
Daniel Veillard42595322004-11-08 10:52:06 +000032071 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032072}
32073
32074
32075static int
32076test_xmlSchemaCollapseString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032077 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032078
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032079#ifdef LIBXML_SCHEMAS_ENABLED
32080 int mem_base;
32081 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032082 xmlChar * value; /* a value */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032083 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032084
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032085 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
32086 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000032087 value = gen_const_xmlChar_ptr(n_value, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032088
William M. Brackf13f77f2004-11-12 16:03:48 +000032089 ret_val = xmlSchemaCollapseString((const xmlChar *)value);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032090 desret_xmlChar_ptr(ret_val);
32091 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000032092 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032093 xmlResetLastError();
32094 if (mem_base != xmlMemBlocks()) {
32095 printf("Leak of %d blocks found in xmlSchemaCollapseString",
32096 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032097 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032098 printf(" %d", n_value);
32099 printf("\n");
32100 }
32101 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032102 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032103#endif
32104
Daniel Veillard42595322004-11-08 10:52:06 +000032105 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032106}
32107
Daniel Veillarda521d282004-11-09 14:59:59 +000032108#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000032109
Daniel Veillardce682bc2004-11-05 17:22:25 +000032110#define gen_nb_xmlSchemaValPtr 1
32111static xmlSchemaValPtr gen_xmlSchemaValPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32112 return(NULL);
32113}
32114static void des_xmlSchemaValPtr(int no ATTRIBUTE_UNUSED, xmlSchemaValPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32115}
Daniel Veillarda521d282004-11-09 14:59:59 +000032116#endif
32117
Daniel Veillardce682bc2004-11-05 17:22:25 +000032118
Daniel Veillardd93f6252004-11-02 15:53:51 +000032119static int
32120test_xmlSchemaCompareValues(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032121 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032122
Daniel Veillardce682bc2004-11-05 17:22:25 +000032123#ifdef LIBXML_SCHEMAS_ENABLED
32124 int mem_base;
32125 int ret_val;
32126 xmlSchemaValPtr x; /* a first value */
32127 int n_x;
32128 xmlSchemaValPtr y; /* a second value */
32129 int n_y;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032130
Daniel Veillardce682bc2004-11-05 17:22:25 +000032131 for (n_x = 0;n_x < gen_nb_xmlSchemaValPtr;n_x++) {
32132 for (n_y = 0;n_y < gen_nb_xmlSchemaValPtr;n_y++) {
32133 mem_base = xmlMemBlocks();
32134 x = gen_xmlSchemaValPtr(n_x, 0);
32135 y = gen_xmlSchemaValPtr(n_y, 1);
32136
32137 ret_val = xmlSchemaCompareValues(x, y);
32138 desret_int(ret_val);
32139 call_tests++;
32140 des_xmlSchemaValPtr(n_x, x, 0);
32141 des_xmlSchemaValPtr(n_y, y, 1);
32142 xmlResetLastError();
32143 if (mem_base != xmlMemBlocks()) {
32144 printf("Leak of %d blocks found in xmlSchemaCompareValues",
32145 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032146 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032147 printf(" %d", n_x);
32148 printf(" %d", n_y);
32149 printf("\n");
32150 }
32151 }
32152 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032153 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032154#endif
32155
Daniel Veillard42595322004-11-08 10:52:06 +000032156 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032157}
32158
32159
32160static int
32161test_xmlSchemaGetBuiltInListSimpleTypeItemType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032162 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032163
Daniel Veillard42595322004-11-08 10:52:06 +000032164#ifdef LIBXML_SCHEMAS_ENABLED
32165 int mem_base;
32166 xmlSchemaTypePtr ret_val;
32167 xmlSchemaTypePtr type; /* the built-in simple type. */
32168 int n_type;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032169
Daniel Veillard42595322004-11-08 10:52:06 +000032170 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
32171 mem_base = xmlMemBlocks();
32172 type = gen_xmlSchemaTypePtr(n_type, 0);
32173
32174 ret_val = xmlSchemaGetBuiltInListSimpleTypeItemType(type);
32175 desret_xmlSchemaTypePtr(ret_val);
32176 call_tests++;
32177 des_xmlSchemaTypePtr(n_type, type, 0);
32178 xmlResetLastError();
32179 if (mem_base != xmlMemBlocks()) {
32180 printf("Leak of %d blocks found in xmlSchemaGetBuiltInListSimpleTypeItemType",
32181 xmlMemBlocks() - mem_base);
32182 test_ret++;
32183 printf(" %d", n_type);
32184 printf("\n");
32185 }
32186 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032187 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032188#endif
32189
Daniel Veillard42595322004-11-08 10:52:06 +000032190 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032191}
32192
32193
32194static int
32195test_xmlSchemaGetBuiltInType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032196 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032197
Daniel Veillard42595322004-11-08 10:52:06 +000032198#ifdef LIBXML_SCHEMAS_ENABLED
32199 xmlSchemaTypePtr ret_val;
32200 xmlSchemaValType type; /* the type of the built in type */
32201 int n_type;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032202
Daniel Veillard42595322004-11-08 10:52:06 +000032203 for (n_type = 0;n_type < gen_nb_xmlSchemaValType;n_type++) {
32204 type = gen_xmlSchemaValType(n_type, 0);
32205
32206 ret_val = xmlSchemaGetBuiltInType(type);
32207 desret_xmlSchemaTypePtr(ret_val);
32208 call_tests++;
32209 des_xmlSchemaValType(n_type, type, 0);
32210 xmlResetLastError();
32211 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032212 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032213#endif
32214
Daniel Veillard42595322004-11-08 10:52:06 +000032215 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032216}
32217
32218
32219static int
32220test_xmlSchemaGetFacetValueAsULong(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032221 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032222
William M. Brack094dd862004-11-14 14:28:34 +000032223#ifdef LIBXML_SCHEMAS_ENABLED
32224 int mem_base;
32225 unsigned long ret_val;
32226 xmlSchemaFacetPtr facet; /* an schemas type facet */
32227 int n_facet;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032228
William M. Brack094dd862004-11-14 14:28:34 +000032229 for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) {
32230 mem_base = xmlMemBlocks();
32231 facet = gen_xmlSchemaFacetPtr(n_facet, 0);
32232
32233 ret_val = xmlSchemaGetFacetValueAsULong(facet);
32234 desret_unsigned_long(ret_val);
32235 call_tests++;
32236 des_xmlSchemaFacetPtr(n_facet, facet, 0);
32237 xmlResetLastError();
32238 if (mem_base != xmlMemBlocks()) {
32239 printf("Leak of %d blocks found in xmlSchemaGetFacetValueAsULong",
32240 xmlMemBlocks() - mem_base);
32241 test_ret++;
32242 printf(" %d", n_facet);
32243 printf("\n");
32244 }
32245 }
32246 function_tests++;
32247#endif
32248
Daniel Veillard42595322004-11-08 10:52:06 +000032249 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032250}
32251
32252
32253static int
32254test_xmlSchemaGetPredefinedType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032255 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032256
Daniel Veillard42595322004-11-08 10:52:06 +000032257#ifdef LIBXML_SCHEMAS_ENABLED
32258 int mem_base;
32259 xmlSchemaTypePtr ret_val;
32260 xmlChar * name; /* the type name */
32261 int n_name;
32262 xmlChar * ns; /* the URI of the namespace usually "http://www.w3.org/2001/XMLSchema" */
32263 int n_ns;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032264
Daniel Veillard42595322004-11-08 10:52:06 +000032265 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
32266 for (n_ns = 0;n_ns < gen_nb_const_xmlChar_ptr;n_ns++) {
32267 mem_base = xmlMemBlocks();
32268 name = gen_const_xmlChar_ptr(n_name, 0);
32269 ns = gen_const_xmlChar_ptr(n_ns, 1);
32270
William M. Brackf13f77f2004-11-12 16:03:48 +000032271 ret_val = xmlSchemaGetPredefinedType((const xmlChar *)name, (const xmlChar *)ns);
Daniel Veillard42595322004-11-08 10:52:06 +000032272 desret_xmlSchemaTypePtr(ret_val);
32273 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000032274 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
32275 des_const_xmlChar_ptr(n_ns, (const xmlChar *)ns, 1);
Daniel Veillard42595322004-11-08 10:52:06 +000032276 xmlResetLastError();
32277 if (mem_base != xmlMemBlocks()) {
32278 printf("Leak of %d blocks found in xmlSchemaGetPredefinedType",
32279 xmlMemBlocks() - mem_base);
32280 test_ret++;
32281 printf(" %d", n_name);
32282 printf(" %d", n_ns);
32283 printf("\n");
32284 }
32285 }
32286 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032287 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032288#endif
32289
Daniel Veillard42595322004-11-08 10:52:06 +000032290 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032291}
32292
32293
32294static int
32295test_xmlSchemaInitTypes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032296 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032297
32298#ifdef LIBXML_SCHEMAS_ENABLED
32299
32300
32301 xmlSchemaInitTypes();
32302 call_tests++;
32303 xmlResetLastError();
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032304 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032305#endif
32306
Daniel Veillard42595322004-11-08 10:52:06 +000032307 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032308}
32309
32310
32311static int
32312test_xmlSchemaIsBuiltInTypeFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032313 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032314
Daniel Veillardce682bc2004-11-05 17:22:25 +000032315#ifdef LIBXML_SCHEMAS_ENABLED
32316 int mem_base;
32317 int ret_val;
32318 xmlSchemaTypePtr type; /* the built-in type */
32319 int n_type;
32320 int facetType; /* the facet type */
32321 int n_facetType;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032322
Daniel Veillardce682bc2004-11-05 17:22:25 +000032323 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
32324 for (n_facetType = 0;n_facetType < gen_nb_int;n_facetType++) {
32325 mem_base = xmlMemBlocks();
32326 type = gen_xmlSchemaTypePtr(n_type, 0);
32327 facetType = gen_int(n_facetType, 1);
32328
32329 ret_val = xmlSchemaIsBuiltInTypeFacet(type, facetType);
32330 desret_int(ret_val);
32331 call_tests++;
32332 des_xmlSchemaTypePtr(n_type, type, 0);
32333 des_int(n_facetType, facetType, 1);
32334 xmlResetLastError();
32335 if (mem_base != xmlMemBlocks()) {
32336 printf("Leak of %d blocks found in xmlSchemaIsBuiltInTypeFacet",
32337 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032338 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032339 printf(" %d", n_type);
32340 printf(" %d", n_facetType);
32341 printf("\n");
32342 }
32343 }
32344 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032345 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032346#endif
32347
Daniel Veillard42595322004-11-08 10:52:06 +000032348 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032349}
32350
32351
32352static int
32353test_xmlSchemaNewFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032354 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032355
32356
32357 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000032358 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032359}
32360
Daniel Veillarda521d282004-11-09 14:59:59 +000032361#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000032362
Daniel Veillardce682bc2004-11-05 17:22:25 +000032363#define gen_nb_xmlSchemaValPtr_ptr 1
32364static xmlSchemaValPtr * gen_xmlSchemaValPtr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32365 return(NULL);
32366}
32367static void des_xmlSchemaValPtr_ptr(int no ATTRIBUTE_UNUSED, xmlSchemaValPtr * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32368}
Daniel Veillarda521d282004-11-09 14:59:59 +000032369#endif
32370
Daniel Veillardce682bc2004-11-05 17:22:25 +000032371
Daniel Veillardd93f6252004-11-02 15:53:51 +000032372static int
32373test_xmlSchemaValPredefTypeNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032374 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032375
Daniel Veillardce682bc2004-11-05 17:22:25 +000032376#ifdef LIBXML_SCHEMAS_ENABLED
32377 int mem_base;
32378 int ret_val;
32379 xmlSchemaTypePtr type; /* the predefined type */
32380 int n_type;
32381 xmlChar * value; /* the value to check */
32382 int n_value;
32383 xmlSchemaValPtr * val; /* the return computed value */
32384 int n_val;
32385 xmlNodePtr node; /* the node containing the value */
32386 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032387
Daniel Veillardce682bc2004-11-05 17:22:25 +000032388 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
32389 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
32390 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr_ptr;n_val++) {
32391 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
32392 mem_base = xmlMemBlocks();
32393 type = gen_xmlSchemaTypePtr(n_type, 0);
32394 value = gen_const_xmlChar_ptr(n_value, 1);
32395 val = gen_xmlSchemaValPtr_ptr(n_val, 2);
32396 node = gen_xmlNodePtr(n_node, 3);
32397
William M. Brackf13f77f2004-11-12 16:03:48 +000032398 ret_val = xmlSchemaValPredefTypeNode(type, (const xmlChar *)value, val, node);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032399 desret_int(ret_val);
32400 call_tests++;
32401 des_xmlSchemaTypePtr(n_type, type, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000032402 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032403 des_xmlSchemaValPtr_ptr(n_val, val, 2);
32404 des_xmlNodePtr(n_node, node, 3);
32405 xmlResetLastError();
32406 if (mem_base != xmlMemBlocks()) {
32407 printf("Leak of %d blocks found in xmlSchemaValPredefTypeNode",
32408 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032409 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032410 printf(" %d", n_type);
32411 printf(" %d", n_value);
32412 printf(" %d", n_val);
32413 printf(" %d", n_node);
32414 printf("\n");
32415 }
32416 }
32417 }
32418 }
32419 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032420 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032421#endif
32422
Daniel Veillard42595322004-11-08 10:52:06 +000032423 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032424}
32425
32426
32427static int
32428test_xmlSchemaValPredefTypeNodeNoNorm(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032429 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032430
Daniel Veillardce682bc2004-11-05 17:22:25 +000032431#ifdef LIBXML_SCHEMAS_ENABLED
32432 int mem_base;
32433 int ret_val;
32434 xmlSchemaTypePtr type; /* the predefined type */
32435 int n_type;
32436 xmlChar * value; /* the value to check */
32437 int n_value;
32438 xmlSchemaValPtr * val; /* the return computed value */
32439 int n_val;
32440 xmlNodePtr node; /* the node containing the value */
32441 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032442
Daniel Veillardce682bc2004-11-05 17:22:25 +000032443 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
32444 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
32445 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr_ptr;n_val++) {
32446 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
32447 mem_base = xmlMemBlocks();
32448 type = gen_xmlSchemaTypePtr(n_type, 0);
32449 value = gen_const_xmlChar_ptr(n_value, 1);
32450 val = gen_xmlSchemaValPtr_ptr(n_val, 2);
32451 node = gen_xmlNodePtr(n_node, 3);
32452
William M. Brackf13f77f2004-11-12 16:03:48 +000032453 ret_val = xmlSchemaValPredefTypeNodeNoNorm(type, (const xmlChar *)value, val, node);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032454 desret_int(ret_val);
32455 call_tests++;
32456 des_xmlSchemaTypePtr(n_type, type, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000032457 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032458 des_xmlSchemaValPtr_ptr(n_val, val, 2);
32459 des_xmlNodePtr(n_node, node, 3);
32460 xmlResetLastError();
32461 if (mem_base != xmlMemBlocks()) {
32462 printf("Leak of %d blocks found in xmlSchemaValPredefTypeNodeNoNorm",
32463 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032464 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032465 printf(" %d", n_type);
32466 printf(" %d", n_value);
32467 printf(" %d", n_val);
32468 printf(" %d", n_node);
32469 printf("\n");
32470 }
32471 }
32472 }
32473 }
32474 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032475 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032476#endif
32477
Daniel Veillard42595322004-11-08 10:52:06 +000032478 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032479}
32480
32481
32482static int
32483test_xmlSchemaValidateFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032484 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032485
Daniel Veillardce682bc2004-11-05 17:22:25 +000032486#ifdef LIBXML_SCHEMAS_ENABLED
32487 int mem_base;
32488 int ret_val;
32489 xmlSchemaTypePtr base; /* the base type */
32490 int n_base;
32491 xmlSchemaFacetPtr facet; /* the facet to check */
32492 int n_facet;
32493 xmlChar * value; /* the lexical repr of the value to validate */
32494 int n_value;
32495 xmlSchemaValPtr val; /* the precomputed value */
32496 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032497
Daniel Veillardce682bc2004-11-05 17:22:25 +000032498 for (n_base = 0;n_base < gen_nb_xmlSchemaTypePtr;n_base++) {
32499 for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) {
32500 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
32501 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr;n_val++) {
32502 mem_base = xmlMemBlocks();
32503 base = gen_xmlSchemaTypePtr(n_base, 0);
32504 facet = gen_xmlSchemaFacetPtr(n_facet, 1);
32505 value = gen_const_xmlChar_ptr(n_value, 2);
32506 val = gen_xmlSchemaValPtr(n_val, 3);
32507
William M. Brackf13f77f2004-11-12 16:03:48 +000032508 ret_val = xmlSchemaValidateFacet(base, facet, (const xmlChar *)value, val);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032509 desret_int(ret_val);
32510 call_tests++;
32511 des_xmlSchemaTypePtr(n_base, base, 0);
32512 des_xmlSchemaFacetPtr(n_facet, facet, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000032513 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032514 des_xmlSchemaValPtr(n_val, val, 3);
32515 xmlResetLastError();
32516 if (mem_base != xmlMemBlocks()) {
32517 printf("Leak of %d blocks found in xmlSchemaValidateFacet",
32518 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032519 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032520 printf(" %d", n_base);
32521 printf(" %d", n_facet);
32522 printf(" %d", n_value);
32523 printf(" %d", n_val);
32524 printf("\n");
32525 }
32526 }
32527 }
32528 }
32529 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032530 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032531#endif
32532
Daniel Veillard42595322004-11-08 10:52:06 +000032533 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032534}
32535
32536
32537static int
32538test_xmlSchemaValidateLengthFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032539 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032540
Daniel Veillardce682bc2004-11-05 17:22:25 +000032541#ifdef LIBXML_SCHEMAS_ENABLED
32542 int mem_base;
32543 int ret_val;
32544 xmlSchemaTypePtr type; /* the built-in type */
32545 int n_type;
32546 xmlSchemaFacetPtr facet; /* the facet to check */
32547 int n_facet;
32548 xmlChar * value; /* the lexical repr. of the value to be validated */
32549 int n_value;
32550 xmlSchemaValPtr val; /* the precomputed value */
32551 int n_val;
32552 unsigned long * length; /* the actual length of the value */
32553 int n_length;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032554
Daniel Veillardce682bc2004-11-05 17:22:25 +000032555 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
32556 for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) {
32557 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
32558 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr;n_val++) {
32559 for (n_length = 0;n_length < gen_nb_unsigned_long_ptr;n_length++) {
32560 mem_base = xmlMemBlocks();
32561 type = gen_xmlSchemaTypePtr(n_type, 0);
32562 facet = gen_xmlSchemaFacetPtr(n_facet, 1);
32563 value = gen_const_xmlChar_ptr(n_value, 2);
32564 val = gen_xmlSchemaValPtr(n_val, 3);
32565 length = gen_unsigned_long_ptr(n_length, 4);
32566
William M. Brackf13f77f2004-11-12 16:03:48 +000032567 ret_val = xmlSchemaValidateLengthFacet(type, facet, (const xmlChar *)value, val, length);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032568 desret_int(ret_val);
32569 call_tests++;
32570 des_xmlSchemaTypePtr(n_type, type, 0);
32571 des_xmlSchemaFacetPtr(n_facet, facet, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000032572 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032573 des_xmlSchemaValPtr(n_val, val, 3);
32574 des_unsigned_long_ptr(n_length, length, 4);
32575 xmlResetLastError();
32576 if (mem_base != xmlMemBlocks()) {
32577 printf("Leak of %d blocks found in xmlSchemaValidateLengthFacet",
32578 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032579 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032580 printf(" %d", n_type);
32581 printf(" %d", n_facet);
32582 printf(" %d", n_value);
32583 printf(" %d", n_val);
32584 printf(" %d", n_length);
32585 printf("\n");
32586 }
32587 }
32588 }
32589 }
32590 }
32591 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032592 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032593#endif
32594
Daniel Veillard42595322004-11-08 10:52:06 +000032595 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032596}
32597
32598
32599static int
32600test_xmlSchemaValidateListSimpleTypeFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032601 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032602
Daniel Veillardce682bc2004-11-05 17:22:25 +000032603#ifdef LIBXML_SCHEMAS_ENABLED
32604 int mem_base;
32605 int ret_val;
32606 xmlSchemaFacetPtr facet; /* the facet to check */
32607 int n_facet;
32608 xmlChar * value; /* the lexical repr of the value to validate */
32609 int n_value;
32610 unsigned long actualLen; /* the number of list items */
32611 int n_actualLen;
32612 unsigned long * expectedLen; /* the resulting expected number of list items */
32613 int n_expectedLen;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032614
Daniel Veillardce682bc2004-11-05 17:22:25 +000032615 for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) {
32616 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
32617 for (n_actualLen = 0;n_actualLen < gen_nb_unsigned_long;n_actualLen++) {
32618 for (n_expectedLen = 0;n_expectedLen < gen_nb_unsigned_long_ptr;n_expectedLen++) {
32619 mem_base = xmlMemBlocks();
32620 facet = gen_xmlSchemaFacetPtr(n_facet, 0);
32621 value = gen_const_xmlChar_ptr(n_value, 1);
32622 actualLen = gen_unsigned_long(n_actualLen, 2);
32623 expectedLen = gen_unsigned_long_ptr(n_expectedLen, 3);
32624
William M. Brackf13f77f2004-11-12 16:03:48 +000032625 ret_val = xmlSchemaValidateListSimpleTypeFacet(facet, (const xmlChar *)value, actualLen, expectedLen);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032626 desret_int(ret_val);
32627 call_tests++;
32628 des_xmlSchemaFacetPtr(n_facet, facet, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000032629 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032630 des_unsigned_long(n_actualLen, actualLen, 2);
32631 des_unsigned_long_ptr(n_expectedLen, expectedLen, 3);
32632 xmlResetLastError();
32633 if (mem_base != xmlMemBlocks()) {
32634 printf("Leak of %d blocks found in xmlSchemaValidateListSimpleTypeFacet",
32635 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032636 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032637 printf(" %d", n_facet);
32638 printf(" %d", n_value);
32639 printf(" %d", n_actualLen);
32640 printf(" %d", n_expectedLen);
32641 printf("\n");
32642 }
32643 }
32644 }
32645 }
32646 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032647 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032648#endif
32649
Daniel Veillard42595322004-11-08 10:52:06 +000032650 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032651}
32652
32653
32654static int
32655test_xmlSchemaValidatePredefinedType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032656 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032657
Daniel Veillardce682bc2004-11-05 17:22:25 +000032658#ifdef LIBXML_SCHEMAS_ENABLED
32659 int mem_base;
32660 int ret_val;
32661 xmlSchemaTypePtr type; /* the predefined type */
32662 int n_type;
32663 xmlChar * value; /* the value to check */
32664 int n_value;
32665 xmlSchemaValPtr * val; /* the return computed value */
32666 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032667
Daniel Veillardce682bc2004-11-05 17:22:25 +000032668 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
32669 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
32670 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr_ptr;n_val++) {
32671 mem_base = xmlMemBlocks();
32672 type = gen_xmlSchemaTypePtr(n_type, 0);
32673 value = gen_const_xmlChar_ptr(n_value, 1);
32674 val = gen_xmlSchemaValPtr_ptr(n_val, 2);
32675
William M. Brackf13f77f2004-11-12 16:03:48 +000032676 ret_val = xmlSchemaValidatePredefinedType(type, (const xmlChar *)value, val);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032677 desret_int(ret_val);
32678 call_tests++;
32679 des_xmlSchemaTypePtr(n_type, type, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000032680 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032681 des_xmlSchemaValPtr_ptr(n_val, val, 2);
32682 xmlResetLastError();
32683 if (mem_base != xmlMemBlocks()) {
32684 printf("Leak of %d blocks found in xmlSchemaValidatePredefinedType",
32685 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032686 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032687 printf(" %d", n_type);
32688 printf(" %d", n_value);
32689 printf(" %d", n_val);
32690 printf("\n");
32691 }
32692 }
32693 }
32694 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032695 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032696#endif
32697
Daniel Veillard42595322004-11-08 10:52:06 +000032698 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032699}
32700
32701static int
32702test_xmlschemastypes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032703 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032704
William M. Brack094dd862004-11-14 14:28:34 +000032705 if (quiet == 0) printf("Testing xmlschemastypes : 16 of 19 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000032706 test_ret += test_xmlSchemaCheckFacet();
32707 test_ret += test_xmlSchemaCleanupTypes();
32708 test_ret += test_xmlSchemaCollapseString();
32709 test_ret += test_xmlSchemaCompareValues();
32710 test_ret += test_xmlSchemaGetBuiltInListSimpleTypeItemType();
32711 test_ret += test_xmlSchemaGetBuiltInType();
32712 test_ret += test_xmlSchemaGetFacetValueAsULong();
32713 test_ret += test_xmlSchemaGetPredefinedType();
32714 test_ret += test_xmlSchemaInitTypes();
32715 test_ret += test_xmlSchemaIsBuiltInTypeFacet();
32716 test_ret += test_xmlSchemaNewFacet();
32717 test_ret += test_xmlSchemaValPredefTypeNode();
32718 test_ret += test_xmlSchemaValPredefTypeNodeNoNorm();
32719 test_ret += test_xmlSchemaValidateFacet();
32720 test_ret += test_xmlSchemaValidateLengthFacet();
32721 test_ret += test_xmlSchemaValidateListSimpleTypeFacet();
32722 test_ret += test_xmlSchemaValidatePredefinedType();
Daniel Veillardd93f6252004-11-02 15:53:51 +000032723
Daniel Veillard42595322004-11-08 10:52:06 +000032724 if (test_ret != 0)
32725 printf("Module xmlschemastypes: %d errors\n", test_ret);
32726 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032727}
32728
32729static int
32730test_xmlCharStrdup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032731 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032732
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032733 int mem_base;
32734 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032735 char * cur; /* the input char * */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032736 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032737
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032738 for (n_cur = 0;n_cur < gen_nb_const_char_ptr;n_cur++) {
32739 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000032740 cur = gen_const_char_ptr(n_cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032741
William M. Brackf13f77f2004-11-12 16:03:48 +000032742 ret_val = xmlCharStrdup((const char *)cur);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032743 desret_xmlChar_ptr(ret_val);
32744 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000032745 des_const_char_ptr(n_cur, (const char *)cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032746 xmlResetLastError();
32747 if (mem_base != xmlMemBlocks()) {
32748 printf("Leak of %d blocks found in xmlCharStrdup",
32749 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032750 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032751 printf(" %d", n_cur);
32752 printf("\n");
32753 }
32754 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000032755 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032756
Daniel Veillard42595322004-11-08 10:52:06 +000032757 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032758}
32759
32760
32761static int
32762test_xmlCharStrndup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032763 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032764
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032765 int mem_base;
32766 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032767 char * cur; /* the input char * */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032768 int n_cur;
32769 int len; /* the len of @cur */
32770 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032771
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032772 for (n_cur = 0;n_cur < gen_nb_const_char_ptr;n_cur++) {
32773 for (n_len = 0;n_len < gen_nb_int;n_len++) {
32774 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000032775 cur = gen_const_char_ptr(n_cur, 0);
32776 len = gen_int(n_len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032777
William M. Brackf13f77f2004-11-12 16:03:48 +000032778 ret_val = xmlCharStrndup((const char *)cur, len);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032779 desret_xmlChar_ptr(ret_val);
32780 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000032781 des_const_char_ptr(n_cur, (const char *)cur, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000032782 des_int(n_len, len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032783 xmlResetLastError();
32784 if (mem_base != xmlMemBlocks()) {
32785 printf("Leak of %d blocks found in xmlCharStrndup",
32786 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032787 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032788 printf(" %d", n_cur);
32789 printf(" %d", n_len);
32790 printf("\n");
32791 }
32792 }
32793 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000032794 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032795
Daniel Veillard42595322004-11-08 10:52:06 +000032796 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032797}
32798
32799
32800static int
32801test_xmlCheckUTF8(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032802 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032803
Daniel Veillardce682bc2004-11-05 17:22:25 +000032804 int mem_base;
32805 int ret_val;
32806 unsigned char * utf; /* Pointer to putative UTF-8 encoded string. */
32807 int n_utf;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032808
Daniel Veillardce682bc2004-11-05 17:22:25 +000032809 for (n_utf = 0;n_utf < gen_nb_const_unsigned_char_ptr;n_utf++) {
32810 mem_base = xmlMemBlocks();
32811 utf = gen_const_unsigned_char_ptr(n_utf, 0);
32812
William M. Brackf13f77f2004-11-12 16:03:48 +000032813 ret_val = xmlCheckUTF8((const unsigned char *)utf);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032814 desret_int(ret_val);
32815 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000032816 des_const_unsigned_char_ptr(n_utf, (const unsigned char *)utf, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032817 xmlResetLastError();
32818 if (mem_base != xmlMemBlocks()) {
32819 printf("Leak of %d blocks found in xmlCheckUTF8",
32820 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032821 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032822 printf(" %d", n_utf);
32823 printf("\n");
32824 }
32825 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000032826 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032827
Daniel Veillard42595322004-11-08 10:52:06 +000032828 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032829}
32830
32831
32832static int
32833test_xmlGetUTF8Char(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032834 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032835
Daniel Veillardce682bc2004-11-05 17:22:25 +000032836 int mem_base;
32837 int ret_val;
32838 unsigned char * utf; /* a sequence of UTF-8 encoded bytes */
32839 int n_utf;
32840 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. */
32841 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032842
Daniel Veillardce682bc2004-11-05 17:22:25 +000032843 for (n_utf = 0;n_utf < gen_nb_const_unsigned_char_ptr;n_utf++) {
32844 for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
32845 mem_base = xmlMemBlocks();
32846 utf = gen_const_unsigned_char_ptr(n_utf, 0);
32847 len = gen_int_ptr(n_len, 1);
32848
William M. Brackf13f77f2004-11-12 16:03:48 +000032849 ret_val = xmlGetUTF8Char((const unsigned char *)utf, len);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032850 desret_int(ret_val);
32851 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000032852 des_const_unsigned_char_ptr(n_utf, (const unsigned char *)utf, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032853 des_int_ptr(n_len, len, 1);
32854 xmlResetLastError();
32855 if (mem_base != xmlMemBlocks()) {
32856 printf("Leak of %d blocks found in xmlGetUTF8Char",
32857 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032858 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032859 printf(" %d", n_utf);
32860 printf(" %d", n_len);
32861 printf("\n");
32862 }
32863 }
32864 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000032865 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032866
Daniel Veillard42595322004-11-08 10:52:06 +000032867 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032868}
32869
32870
32871static int
32872test_xmlStrEqual(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032873 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032874
32875 int mem_base;
32876 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032877 xmlChar * str1; /* the first xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000032878 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032879 xmlChar * str2; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000032880 int n_str2;
32881
32882 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
32883 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
32884 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000032885 str1 = gen_const_xmlChar_ptr(n_str1, 0);
32886 str2 = gen_const_xmlChar_ptr(n_str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032887
William M. Brackf13f77f2004-11-12 16:03:48 +000032888 ret_val = xmlStrEqual((const xmlChar *)str1, (const xmlChar *)str2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032889 desret_int(ret_val);
32890 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000032891 des_const_xmlChar_ptr(n_str1, (const xmlChar *)str1, 0);
32892 des_const_xmlChar_ptr(n_str2, (const xmlChar *)str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032893 xmlResetLastError();
32894 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000032895 printf("Leak of %d blocks found in xmlStrEqual",
Daniel Veillardd93f6252004-11-02 15:53:51 +000032896 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032897 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000032898 printf(" %d", n_str1);
32899 printf(" %d", n_str2);
32900 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000032901 }
32902 }
32903 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000032904 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032905
Daniel Veillard42595322004-11-08 10:52:06 +000032906 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032907}
32908
32909
32910static int
32911test_xmlStrPrintf(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032912 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032913
32914
32915 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000032916 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032917}
32918
32919
32920static int
32921test_xmlStrQEqual(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032922 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032923
32924 int mem_base;
32925 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032926 xmlChar * pref; /* the prefix of the QName */
Daniel Veillardd93f6252004-11-02 15:53:51 +000032927 int n_pref;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032928 xmlChar * name; /* the localname of the QName */
Daniel Veillardd93f6252004-11-02 15:53:51 +000032929 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032930 xmlChar * str; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000032931 int n_str;
32932
32933 for (n_pref = 0;n_pref < gen_nb_const_xmlChar_ptr;n_pref++) {
32934 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
32935 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
32936 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000032937 pref = gen_const_xmlChar_ptr(n_pref, 0);
32938 name = gen_const_xmlChar_ptr(n_name, 1);
32939 str = gen_const_xmlChar_ptr(n_str, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032940
William M. Brackf13f77f2004-11-12 16:03:48 +000032941 ret_val = xmlStrQEqual((const xmlChar *)pref, (const xmlChar *)name, (const xmlChar *)str);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032942 desret_int(ret_val);
32943 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000032944 des_const_xmlChar_ptr(n_pref, (const xmlChar *)pref, 0);
32945 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
32946 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032947 xmlResetLastError();
32948 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000032949 printf("Leak of %d blocks found in xmlStrQEqual",
Daniel Veillardd93f6252004-11-02 15:53:51 +000032950 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032951 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000032952 printf(" %d", n_pref);
32953 printf(" %d", n_name);
32954 printf(" %d", n_str);
32955 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000032956 }
32957 }
32958 }
32959 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000032960 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032961
Daniel Veillard42595322004-11-08 10:52:06 +000032962 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032963}
32964
32965
32966static int
32967test_xmlStrVPrintf(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032968 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032969
32970
32971 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000032972 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032973}
32974
32975
32976static int
32977test_xmlStrcasecmp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032978 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032979
32980 int mem_base;
32981 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032982 xmlChar * str1; /* the first xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000032983 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032984 xmlChar * str2; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000032985 int n_str2;
32986
32987 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
32988 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
32989 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000032990 str1 = gen_const_xmlChar_ptr(n_str1, 0);
32991 str2 = gen_const_xmlChar_ptr(n_str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032992
William M. Brackf13f77f2004-11-12 16:03:48 +000032993 ret_val = xmlStrcasecmp((const xmlChar *)str1, (const xmlChar *)str2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032994 desret_int(ret_val);
32995 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000032996 des_const_xmlChar_ptr(n_str1, (const xmlChar *)str1, 0);
32997 des_const_xmlChar_ptr(n_str2, (const xmlChar *)str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032998 xmlResetLastError();
32999 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033000 printf("Leak of %d blocks found in xmlStrcasecmp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033001 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033002 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033003 printf(" %d", n_str1);
33004 printf(" %d", n_str2);
33005 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033006 }
33007 }
33008 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033009 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033010
Daniel Veillard42595322004-11-08 10:52:06 +000033011 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033012}
33013
33014
33015static int
33016test_xmlStrcasestr(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033017 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033018
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033019 int mem_base;
33020 const xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033021 xmlChar * str; /* the xmlChar * array (haystack) */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033022 int n_str;
33023 xmlChar * val; /* the xmlChar to search (needle) */
33024 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033025
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033026 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
33027 for (n_val = 0;n_val < gen_nb_xmlChar_ptr;n_val++) {
33028 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033029 str = gen_const_xmlChar_ptr(n_str, 0);
33030 val = gen_xmlChar_ptr(n_val, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033031
William M. Brackf13f77f2004-11-12 16:03:48 +000033032 ret_val = xmlStrcasestr((const xmlChar *)str, val);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033033 desret_const_xmlChar_ptr(ret_val);
33034 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033035 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000033036 des_xmlChar_ptr(n_val, val, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033037 xmlResetLastError();
33038 if (mem_base != xmlMemBlocks()) {
33039 printf("Leak of %d blocks found in xmlStrcasestr",
33040 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033041 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033042 printf(" %d", n_str);
33043 printf(" %d", n_val);
33044 printf("\n");
33045 }
33046 }
33047 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033048 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033049
Daniel Veillard42595322004-11-08 10:52:06 +000033050 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033051}
33052
33053
33054static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000033055test_xmlStrchr(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033056 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033057
Daniel Veillardf2a36f92004-11-08 17:55:01 +000033058 int mem_base;
33059 const xmlChar * ret_val;
33060 xmlChar * str; /* the xmlChar * array */
33061 int n_str;
33062 xmlChar val; /* the xmlChar to search */
33063 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033064
Daniel Veillardf2a36f92004-11-08 17:55:01 +000033065 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
33066 for (n_val = 0;n_val < gen_nb_xmlChar;n_val++) {
33067 mem_base = xmlMemBlocks();
33068 str = gen_const_xmlChar_ptr(n_str, 0);
33069 val = gen_xmlChar(n_val, 1);
33070
William M. Brackf13f77f2004-11-12 16:03:48 +000033071 ret_val = xmlStrchr((const xmlChar *)str, val);
Daniel Veillardf2a36f92004-11-08 17:55:01 +000033072 desret_const_xmlChar_ptr(ret_val);
33073 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033074 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillardf2a36f92004-11-08 17:55:01 +000033075 des_xmlChar(n_val, val, 1);
33076 xmlResetLastError();
33077 if (mem_base != xmlMemBlocks()) {
33078 printf("Leak of %d blocks found in xmlStrchr",
33079 xmlMemBlocks() - mem_base);
33080 test_ret++;
33081 printf(" %d", n_str);
33082 printf(" %d", n_val);
33083 printf("\n");
33084 }
33085 }
33086 }
Daniel Veillardf2a36f92004-11-08 17:55:01 +000033087 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033088
Daniel Veillard42595322004-11-08 10:52:06 +000033089 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033090}
33091
33092
33093static int
33094test_xmlStrcmp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033095 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033096
33097 int mem_base;
33098 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033099 xmlChar * str1; /* the first xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033100 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033101 xmlChar * str2; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033102 int n_str2;
33103
33104 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
33105 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
33106 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033107 str1 = gen_const_xmlChar_ptr(n_str1, 0);
33108 str2 = gen_const_xmlChar_ptr(n_str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033109
William M. Brackf13f77f2004-11-12 16:03:48 +000033110 ret_val = xmlStrcmp((const xmlChar *)str1, (const xmlChar *)str2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033111 desret_int(ret_val);
33112 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033113 des_const_xmlChar_ptr(n_str1, (const xmlChar *)str1, 0);
33114 des_const_xmlChar_ptr(n_str2, (const xmlChar *)str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033115 xmlResetLastError();
33116 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033117 printf("Leak of %d blocks found in xmlStrcmp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033118 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033119 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033120 printf(" %d", n_str1);
33121 printf(" %d", n_str2);
33122 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033123 }
33124 }
33125 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033126 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033127
Daniel Veillard42595322004-11-08 10:52:06 +000033128 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033129}
33130
33131
33132static int
33133test_xmlStrdup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033134 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033135
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033136 int mem_base;
33137 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033138 xmlChar * cur; /* the input xmlChar * */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033139 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033140
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033141 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
33142 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033143 cur = gen_const_xmlChar_ptr(n_cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033144
William M. Brackf13f77f2004-11-12 16:03:48 +000033145 ret_val = xmlStrdup((const xmlChar *)cur);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033146 desret_xmlChar_ptr(ret_val);
33147 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033148 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033149 xmlResetLastError();
33150 if (mem_base != xmlMemBlocks()) {
33151 printf("Leak of %d blocks found in xmlStrdup",
33152 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033153 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033154 printf(" %d", n_cur);
33155 printf("\n");
33156 }
33157 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033158 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033159
Daniel Veillard42595322004-11-08 10:52:06 +000033160 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033161}
33162
33163
33164static int
33165test_xmlStrlen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033166 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033167
33168 int mem_base;
33169 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033170 xmlChar * str; /* the xmlChar * array */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033171 int n_str;
33172
33173 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
33174 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033175 str = gen_const_xmlChar_ptr(n_str, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033176
William M. Brackf13f77f2004-11-12 16:03:48 +000033177 ret_val = xmlStrlen((const xmlChar *)str);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033178 desret_int(ret_val);
33179 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033180 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033181 xmlResetLastError();
33182 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033183 printf("Leak of %d blocks found in xmlStrlen",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033184 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033185 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033186 printf(" %d", n_str);
33187 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033188 }
33189 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033190 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033191
Daniel Veillard42595322004-11-08 10:52:06 +000033192 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033193}
33194
33195
33196static int
33197test_xmlStrncasecmp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033198 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033199
33200 int mem_base;
33201 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033202 xmlChar * str1; /* the first xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033203 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033204 xmlChar * str2; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033205 int n_str2;
33206 int len; /* the max comparison length */
33207 int n_len;
33208
33209 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
33210 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
33211 for (n_len = 0;n_len < gen_nb_int;n_len++) {
33212 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033213 str1 = gen_const_xmlChar_ptr(n_str1, 0);
33214 str2 = gen_const_xmlChar_ptr(n_str2, 1);
33215 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033216
William M. Brackf13f77f2004-11-12 16:03:48 +000033217 ret_val = xmlStrncasecmp((const xmlChar *)str1, (const xmlChar *)str2, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033218 desret_int(ret_val);
33219 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033220 des_const_xmlChar_ptr(n_str1, (const xmlChar *)str1, 0);
33221 des_const_xmlChar_ptr(n_str2, (const xmlChar *)str2, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000033222 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033223 xmlResetLastError();
33224 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033225 printf("Leak of %d blocks found in xmlStrncasecmp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033226 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033227 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033228 printf(" %d", n_str1);
33229 printf(" %d", n_str2);
33230 printf(" %d", n_len);
33231 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033232 }
33233 }
33234 }
33235 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033236 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033237
Daniel Veillard42595322004-11-08 10:52:06 +000033238 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033239}
33240
33241
33242static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000033243test_xmlStrncatNew(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033244 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033245
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033246 int mem_base;
33247 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033248 xmlChar * str1; /* first xmlChar string */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033249 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033250 xmlChar * str2; /* second xmlChar string */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033251 int n_str2;
33252 int len; /* the len of @str2 */
33253 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033254
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033255 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
33256 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
33257 for (n_len = 0;n_len < gen_nb_int;n_len++) {
33258 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033259 str1 = gen_const_xmlChar_ptr(n_str1, 0);
33260 str2 = gen_const_xmlChar_ptr(n_str2, 1);
33261 len = gen_int(n_len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033262
William M. Brackf13f77f2004-11-12 16:03:48 +000033263 ret_val = xmlStrncatNew((const xmlChar *)str1, (const xmlChar *)str2, len);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033264 desret_xmlChar_ptr(ret_val);
33265 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033266 des_const_xmlChar_ptr(n_str1, (const xmlChar *)str1, 0);
33267 des_const_xmlChar_ptr(n_str2, (const xmlChar *)str2, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000033268 des_int(n_len, len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033269 xmlResetLastError();
33270 if (mem_base != xmlMemBlocks()) {
33271 printf("Leak of %d blocks found in xmlStrncatNew",
33272 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033273 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033274 printf(" %d", n_str1);
33275 printf(" %d", n_str2);
33276 printf(" %d", n_len);
33277 printf("\n");
33278 }
33279 }
33280 }
33281 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033282 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033283
Daniel Veillard42595322004-11-08 10:52:06 +000033284 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033285}
33286
33287
33288static int
33289test_xmlStrncmp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033290 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033291
33292 int mem_base;
33293 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033294 xmlChar * str1; /* the first xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033295 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033296 xmlChar * str2; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033297 int n_str2;
33298 int len; /* the max comparison length */
33299 int n_len;
33300
33301 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
33302 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
33303 for (n_len = 0;n_len < gen_nb_int;n_len++) {
33304 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033305 str1 = gen_const_xmlChar_ptr(n_str1, 0);
33306 str2 = gen_const_xmlChar_ptr(n_str2, 1);
33307 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033308
William M. Brackf13f77f2004-11-12 16:03:48 +000033309 ret_val = xmlStrncmp((const xmlChar *)str1, (const xmlChar *)str2, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033310 desret_int(ret_val);
33311 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033312 des_const_xmlChar_ptr(n_str1, (const xmlChar *)str1, 0);
33313 des_const_xmlChar_ptr(n_str2, (const xmlChar *)str2, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000033314 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033315 xmlResetLastError();
33316 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033317 printf("Leak of %d blocks found in xmlStrncmp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033318 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033319 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033320 printf(" %d", n_str1);
33321 printf(" %d", n_str2);
33322 printf(" %d", n_len);
33323 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033324 }
33325 }
33326 }
33327 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033328 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033329
Daniel Veillard42595322004-11-08 10:52:06 +000033330 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033331}
33332
33333
33334static int
33335test_xmlStrndup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033336 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033337
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033338 int mem_base;
33339 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033340 xmlChar * cur; /* the input xmlChar * */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033341 int n_cur;
33342 int len; /* the len of @cur */
33343 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033344
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033345 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
33346 for (n_len = 0;n_len < gen_nb_int;n_len++) {
33347 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033348 cur = gen_const_xmlChar_ptr(n_cur, 0);
33349 len = gen_int(n_len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033350
William M. Brackf13f77f2004-11-12 16:03:48 +000033351 ret_val = xmlStrndup((const xmlChar *)cur, len);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033352 desret_xmlChar_ptr(ret_val);
33353 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033354 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000033355 des_int(n_len, len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033356 xmlResetLastError();
33357 if (mem_base != xmlMemBlocks()) {
33358 printf("Leak of %d blocks found in xmlStrndup",
33359 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033360 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033361 printf(" %d", n_cur);
33362 printf(" %d", n_len);
33363 printf("\n");
33364 }
33365 }
33366 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033367 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033368
Daniel Veillard42595322004-11-08 10:52:06 +000033369 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033370}
33371
33372
33373static int
33374test_xmlStrstr(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033375 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033376
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033377 int mem_base;
33378 const xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033379 xmlChar * str; /* the xmlChar * array (haystack) */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033380 int n_str;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033381 xmlChar * val; /* the xmlChar to search (needle) */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033382 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033383
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033384 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
33385 for (n_val = 0;n_val < gen_nb_const_xmlChar_ptr;n_val++) {
33386 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033387 str = gen_const_xmlChar_ptr(n_str, 0);
33388 val = gen_const_xmlChar_ptr(n_val, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033389
William M. Brackf13f77f2004-11-12 16:03:48 +000033390 ret_val = xmlStrstr((const xmlChar *)str, (const xmlChar *)val);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033391 desret_const_xmlChar_ptr(ret_val);
33392 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033393 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
33394 des_const_xmlChar_ptr(n_val, (const xmlChar *)val, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033395 xmlResetLastError();
33396 if (mem_base != xmlMemBlocks()) {
33397 printf("Leak of %d blocks found in xmlStrstr",
33398 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033399 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033400 printf(" %d", n_str);
33401 printf(" %d", n_val);
33402 printf("\n");
33403 }
33404 }
33405 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033406 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033407
Daniel Veillard42595322004-11-08 10:52:06 +000033408 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033409}
33410
33411
33412static int
33413test_xmlStrsub(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033414 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033415
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033416 int mem_base;
33417 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033418 xmlChar * str; /* the xmlChar * array (haystack) */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033419 int n_str;
33420 int start; /* the index of the first char (zero based) */
33421 int n_start;
33422 int len; /* the length of the substring */
33423 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033424
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033425 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
33426 for (n_start = 0;n_start < gen_nb_int;n_start++) {
33427 for (n_len = 0;n_len < gen_nb_int;n_len++) {
33428 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033429 str = gen_const_xmlChar_ptr(n_str, 0);
33430 start = gen_int(n_start, 1);
33431 len = gen_int(n_len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033432
William M. Brackf13f77f2004-11-12 16:03:48 +000033433 ret_val = xmlStrsub((const xmlChar *)str, start, len);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033434 desret_xmlChar_ptr(ret_val);
33435 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033436 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000033437 des_int(n_start, start, 1);
33438 des_int(n_len, len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033439 xmlResetLastError();
33440 if (mem_base != xmlMemBlocks()) {
33441 printf("Leak of %d blocks found in xmlStrsub",
33442 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033443 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033444 printf(" %d", n_str);
33445 printf(" %d", n_start);
33446 printf(" %d", n_len);
33447 printf("\n");
33448 }
33449 }
33450 }
33451 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033452 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033453
Daniel Veillard42595322004-11-08 10:52:06 +000033454 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033455}
33456
33457
33458static int
33459test_xmlUTF8Charcmp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033460 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033461
33462 int mem_base;
33463 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033464 xmlChar * utf1; /* pointer to first UTF8 char */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033465 int n_utf1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033466 xmlChar * utf2; /* pointer to second UTF8 char */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033467 int n_utf2;
33468
33469 for (n_utf1 = 0;n_utf1 < gen_nb_const_xmlChar_ptr;n_utf1++) {
33470 for (n_utf2 = 0;n_utf2 < gen_nb_const_xmlChar_ptr;n_utf2++) {
33471 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033472 utf1 = gen_const_xmlChar_ptr(n_utf1, 0);
33473 utf2 = gen_const_xmlChar_ptr(n_utf2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033474
William M. Brackf13f77f2004-11-12 16:03:48 +000033475 ret_val = xmlUTF8Charcmp((const xmlChar *)utf1, (const xmlChar *)utf2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033476 desret_int(ret_val);
33477 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033478 des_const_xmlChar_ptr(n_utf1, (const xmlChar *)utf1, 0);
33479 des_const_xmlChar_ptr(n_utf2, (const xmlChar *)utf2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033480 xmlResetLastError();
33481 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033482 printf("Leak of %d blocks found in xmlUTF8Charcmp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033483 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033484 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033485 printf(" %d", n_utf1);
33486 printf(" %d", n_utf2);
33487 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033488 }
33489 }
33490 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033491 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033492
Daniel Veillard42595322004-11-08 10:52:06 +000033493 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033494}
33495
33496
33497static int
33498test_xmlUTF8Size(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033499 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033500
33501 int mem_base;
33502 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033503 xmlChar * utf; /* pointer to the UTF8 character */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033504 int n_utf;
33505
33506 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
33507 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033508 utf = gen_const_xmlChar_ptr(n_utf, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033509
William M. Brackf13f77f2004-11-12 16:03:48 +000033510 ret_val = xmlUTF8Size((const xmlChar *)utf);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033511 desret_int(ret_val);
33512 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033513 des_const_xmlChar_ptr(n_utf, (const xmlChar *)utf, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033514 xmlResetLastError();
33515 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033516 printf("Leak of %d blocks found in xmlUTF8Size",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033517 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033518 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033519 printf(" %d", n_utf);
33520 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033521 }
33522 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033523 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033524
Daniel Veillard42595322004-11-08 10:52:06 +000033525 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033526}
33527
33528
33529static int
33530test_xmlUTF8Strlen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033531 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033532
33533 int mem_base;
33534 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033535 xmlChar * utf; /* a sequence of UTF-8 encoded bytes */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033536 int n_utf;
33537
33538 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
33539 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033540 utf = gen_const_xmlChar_ptr(n_utf, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033541
William M. Brackf13f77f2004-11-12 16:03:48 +000033542 ret_val = xmlUTF8Strlen((const xmlChar *)utf);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033543 desret_int(ret_val);
33544 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033545 des_const_xmlChar_ptr(n_utf, (const xmlChar *)utf, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033546 xmlResetLastError();
33547 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033548 printf("Leak of %d blocks found in xmlUTF8Strlen",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033549 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033550 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033551 printf(" %d", n_utf);
33552 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033553 }
33554 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033555 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033556
Daniel Veillard42595322004-11-08 10:52:06 +000033557 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033558}
33559
33560
33561static int
33562test_xmlUTF8Strloc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033563 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033564
33565 int mem_base;
33566 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033567 xmlChar * utf; /* the input UTF8 * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033568 int n_utf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033569 xmlChar * utfchar; /* the UTF8 character to be found */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033570 int n_utfchar;
33571
33572 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
33573 for (n_utfchar = 0;n_utfchar < gen_nb_const_xmlChar_ptr;n_utfchar++) {
33574 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033575 utf = gen_const_xmlChar_ptr(n_utf, 0);
33576 utfchar = gen_const_xmlChar_ptr(n_utfchar, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033577
William M. Brackf13f77f2004-11-12 16:03:48 +000033578 ret_val = xmlUTF8Strloc((const xmlChar *)utf, (const xmlChar *)utfchar);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033579 desret_int(ret_val);
33580 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033581 des_const_xmlChar_ptr(n_utf, (const xmlChar *)utf, 0);
33582 des_const_xmlChar_ptr(n_utfchar, (const xmlChar *)utfchar, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033583 xmlResetLastError();
33584 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033585 printf("Leak of %d blocks found in xmlUTF8Strloc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033586 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033587 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033588 printf(" %d", n_utf);
33589 printf(" %d", n_utfchar);
33590 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033591 }
33592 }
33593 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033594 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033595
Daniel Veillard42595322004-11-08 10:52:06 +000033596 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033597}
33598
33599
33600static int
33601test_xmlUTF8Strndup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033602 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033603
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033604 int mem_base;
33605 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033606 xmlChar * utf; /* the input UTF8 * */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033607 int n_utf;
33608 int len; /* the len of @utf (in chars) */
33609 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033610
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033611 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
33612 for (n_len = 0;n_len < gen_nb_int;n_len++) {
33613 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033614 utf = gen_const_xmlChar_ptr(n_utf, 0);
33615 len = gen_int(n_len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033616
William M. Brackf13f77f2004-11-12 16:03:48 +000033617 ret_val = xmlUTF8Strndup((const xmlChar *)utf, len);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033618 desret_xmlChar_ptr(ret_val);
33619 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033620 des_const_xmlChar_ptr(n_utf, (const xmlChar *)utf, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000033621 des_int(n_len, len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033622 xmlResetLastError();
33623 if (mem_base != xmlMemBlocks()) {
33624 printf("Leak of %d blocks found in xmlUTF8Strndup",
33625 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033626 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033627 printf(" %d", n_utf);
33628 printf(" %d", n_len);
33629 printf("\n");
33630 }
33631 }
33632 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033633 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033634
Daniel Veillard42595322004-11-08 10:52:06 +000033635 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033636}
33637
33638
33639static int
33640test_xmlUTF8Strpos(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033641 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033642
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033643 int mem_base;
33644 const xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033645 xmlChar * utf; /* the input UTF8 * */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033646 int n_utf;
33647 int pos; /* the position of the desired UTF8 char (in chars) */
33648 int n_pos;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033649
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033650 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
33651 for (n_pos = 0;n_pos < gen_nb_int;n_pos++) {
33652 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033653 utf = gen_const_xmlChar_ptr(n_utf, 0);
33654 pos = gen_int(n_pos, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033655
William M. Brackf13f77f2004-11-12 16:03:48 +000033656 ret_val = xmlUTF8Strpos((const xmlChar *)utf, pos);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033657 desret_const_xmlChar_ptr(ret_val);
33658 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033659 des_const_xmlChar_ptr(n_utf, (const xmlChar *)utf, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000033660 des_int(n_pos, pos, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033661 xmlResetLastError();
33662 if (mem_base != xmlMemBlocks()) {
33663 printf("Leak of %d blocks found in xmlUTF8Strpos",
33664 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033665 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033666 printf(" %d", n_utf);
33667 printf(" %d", n_pos);
33668 printf("\n");
33669 }
33670 }
33671 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033672 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033673
Daniel Veillard42595322004-11-08 10:52:06 +000033674 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033675}
33676
33677
33678static int
33679test_xmlUTF8Strsize(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033680 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033681
33682 int mem_base;
33683 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033684 xmlChar * utf; /* a sequence of UTF-8 encoded bytes */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033685 int n_utf;
33686 int len; /* the number of characters in the array */
33687 int n_len;
33688
33689 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
33690 for (n_len = 0;n_len < gen_nb_int;n_len++) {
33691 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033692 utf = gen_const_xmlChar_ptr(n_utf, 0);
33693 len = gen_int(n_len, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033694
William M. Brackf13f77f2004-11-12 16:03:48 +000033695 ret_val = xmlUTF8Strsize((const xmlChar *)utf, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033696 desret_int(ret_val);
33697 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033698 des_const_xmlChar_ptr(n_utf, (const xmlChar *)utf, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000033699 des_int(n_len, len, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033700 xmlResetLastError();
33701 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033702 printf("Leak of %d blocks found in xmlUTF8Strsize",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033703 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033704 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033705 printf(" %d", n_utf);
33706 printf(" %d", n_len);
33707 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033708 }
33709 }
33710 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033711 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033712
Daniel Veillard42595322004-11-08 10:52:06 +000033713 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033714}
33715
33716
33717static int
33718test_xmlUTF8Strsub(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033719 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033720
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033721 int mem_base;
33722 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033723 xmlChar * utf; /* a sequence of UTF-8 encoded bytes */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033724 int n_utf;
33725 int start; /* relative pos of first char */
33726 int n_start;
33727 int len; /* total number to copy */
33728 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033729
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033730 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
33731 for (n_start = 0;n_start < gen_nb_int;n_start++) {
33732 for (n_len = 0;n_len < gen_nb_int;n_len++) {
33733 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033734 utf = gen_const_xmlChar_ptr(n_utf, 0);
33735 start = gen_int(n_start, 1);
33736 len = gen_int(n_len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033737
William M. Brackf13f77f2004-11-12 16:03:48 +000033738 ret_val = xmlUTF8Strsub((const xmlChar *)utf, start, len);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033739 desret_xmlChar_ptr(ret_val);
33740 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033741 des_const_xmlChar_ptr(n_utf, (const xmlChar *)utf, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000033742 des_int(n_start, start, 1);
33743 des_int(n_len, len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033744 xmlResetLastError();
33745 if (mem_base != xmlMemBlocks()) {
33746 printf("Leak of %d blocks found in xmlUTF8Strsub",
33747 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033748 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033749 printf(" %d", n_utf);
33750 printf(" %d", n_start);
33751 printf(" %d", n_len);
33752 printf("\n");
33753 }
33754 }
33755 }
33756 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033757 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033758
Daniel Veillard42595322004-11-08 10:52:06 +000033759 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033760}
33761
33762static int
33763test_xmlstring(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033764 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033765
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033766 if (quiet == 0) printf("Testing xmlstring : 26 of 30 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000033767 test_ret += test_xmlCharStrdup();
33768 test_ret += test_xmlCharStrndup();
33769 test_ret += test_xmlCheckUTF8();
33770 test_ret += test_xmlGetUTF8Char();
33771 test_ret += test_xmlStrEqual();
33772 test_ret += test_xmlStrPrintf();
33773 test_ret += test_xmlStrQEqual();
33774 test_ret += test_xmlStrVPrintf();
33775 test_ret += test_xmlStrcasecmp();
33776 test_ret += test_xmlStrcasestr();
33777 test_ret += test_xmlStrchr();
33778 test_ret += test_xmlStrcmp();
33779 test_ret += test_xmlStrdup();
33780 test_ret += test_xmlStrlen();
33781 test_ret += test_xmlStrncasecmp();
33782 test_ret += test_xmlStrncatNew();
33783 test_ret += test_xmlStrncmp();
33784 test_ret += test_xmlStrndup();
33785 test_ret += test_xmlStrstr();
33786 test_ret += test_xmlStrsub();
33787 test_ret += test_xmlUTF8Charcmp();
33788 test_ret += test_xmlUTF8Size();
33789 test_ret += test_xmlUTF8Strlen();
33790 test_ret += test_xmlUTF8Strloc();
33791 test_ret += test_xmlUTF8Strndup();
33792 test_ret += test_xmlUTF8Strpos();
33793 test_ret += test_xmlUTF8Strsize();
33794 test_ret += test_xmlUTF8Strsub();
Daniel Veillardd93f6252004-11-02 15:53:51 +000033795
Daniel Veillard42595322004-11-08 10:52:06 +000033796 if (test_ret != 0)
33797 printf("Module xmlstring: %d errors\n", test_ret);
33798 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033799}
33800
33801static int
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033802test_xmlUCSIsAegeanNumbers(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033803 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033804
33805#ifdef LIBXML_UNICODE_ENABLED
33806 int mem_base;
33807 int ret_val;
33808 int code; /* UCS code point */
33809 int n_code;
33810
33811 for (n_code = 0;n_code < gen_nb_int;n_code++) {
33812 mem_base = xmlMemBlocks();
33813 code = gen_int(n_code, 0);
33814
33815 ret_val = xmlUCSIsAegeanNumbers(code);
33816 desret_int(ret_val);
33817 call_tests++;
33818 des_int(n_code, code, 0);
33819 xmlResetLastError();
33820 if (mem_base != xmlMemBlocks()) {
33821 printf("Leak of %d blocks found in xmlUCSIsAegeanNumbers",
33822 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033823 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033824 printf(" %d", n_code);
33825 printf("\n");
33826 }
33827 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033828 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033829#endif
33830
Daniel Veillard42595322004-11-08 10:52:06 +000033831 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033832}
33833
33834
33835static int
33836test_xmlUCSIsAlphabeticPresentationForms(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033837 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033838
33839#ifdef LIBXML_UNICODE_ENABLED
33840 int mem_base;
33841 int ret_val;
33842 int code; /* UCS code point */
33843 int n_code;
33844
33845 for (n_code = 0;n_code < gen_nb_int;n_code++) {
33846 mem_base = xmlMemBlocks();
33847 code = gen_int(n_code, 0);
33848
33849 ret_val = xmlUCSIsAlphabeticPresentationForms(code);
33850 desret_int(ret_val);
33851 call_tests++;
33852 des_int(n_code, code, 0);
33853 xmlResetLastError();
33854 if (mem_base != xmlMemBlocks()) {
33855 printf("Leak of %d blocks found in xmlUCSIsAlphabeticPresentationForms",
33856 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033857 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033858 printf(" %d", n_code);
33859 printf("\n");
33860 }
33861 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033862 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033863#endif
33864
Daniel Veillard42595322004-11-08 10:52:06 +000033865 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033866}
33867
33868
33869static int
33870test_xmlUCSIsArabic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033871 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033872
33873#ifdef LIBXML_UNICODE_ENABLED
33874 int mem_base;
33875 int ret_val;
33876 int code; /* UCS code point */
33877 int n_code;
33878
33879 for (n_code = 0;n_code < gen_nb_int;n_code++) {
33880 mem_base = xmlMemBlocks();
33881 code = gen_int(n_code, 0);
33882
33883 ret_val = xmlUCSIsArabic(code);
33884 desret_int(ret_val);
33885 call_tests++;
33886 des_int(n_code, code, 0);
33887 xmlResetLastError();
33888 if (mem_base != xmlMemBlocks()) {
33889 printf("Leak of %d blocks found in xmlUCSIsArabic",
33890 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033891 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033892 printf(" %d", n_code);
33893 printf("\n");
33894 }
33895 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033896 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033897#endif
33898
Daniel Veillard42595322004-11-08 10:52:06 +000033899 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033900}
33901
33902
33903static int
33904test_xmlUCSIsArabicPresentationFormsA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033905 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033906
33907#ifdef LIBXML_UNICODE_ENABLED
33908 int mem_base;
33909 int ret_val;
33910 int code; /* UCS code point */
33911 int n_code;
33912
33913 for (n_code = 0;n_code < gen_nb_int;n_code++) {
33914 mem_base = xmlMemBlocks();
33915 code = gen_int(n_code, 0);
33916
33917 ret_val = xmlUCSIsArabicPresentationFormsA(code);
33918 desret_int(ret_val);
33919 call_tests++;
33920 des_int(n_code, code, 0);
33921 xmlResetLastError();
33922 if (mem_base != xmlMemBlocks()) {
33923 printf("Leak of %d blocks found in xmlUCSIsArabicPresentationFormsA",
33924 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033925 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033926 printf(" %d", n_code);
33927 printf("\n");
33928 }
33929 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033930 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033931#endif
33932
Daniel Veillard42595322004-11-08 10:52:06 +000033933 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033934}
33935
33936
33937static int
33938test_xmlUCSIsArabicPresentationFormsB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033939 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033940
33941#ifdef LIBXML_UNICODE_ENABLED
33942 int mem_base;
33943 int ret_val;
33944 int code; /* UCS code point */
33945 int n_code;
33946
33947 for (n_code = 0;n_code < gen_nb_int;n_code++) {
33948 mem_base = xmlMemBlocks();
33949 code = gen_int(n_code, 0);
33950
33951 ret_val = xmlUCSIsArabicPresentationFormsB(code);
33952 desret_int(ret_val);
33953 call_tests++;
33954 des_int(n_code, code, 0);
33955 xmlResetLastError();
33956 if (mem_base != xmlMemBlocks()) {
33957 printf("Leak of %d blocks found in xmlUCSIsArabicPresentationFormsB",
33958 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033959 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033960 printf(" %d", n_code);
33961 printf("\n");
33962 }
33963 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033964 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033965#endif
33966
Daniel Veillard42595322004-11-08 10:52:06 +000033967 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033968}
33969
33970
33971static int
33972test_xmlUCSIsArmenian(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033973 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033974
33975#ifdef LIBXML_UNICODE_ENABLED
33976 int mem_base;
33977 int ret_val;
33978 int code; /* UCS code point */
33979 int n_code;
33980
33981 for (n_code = 0;n_code < gen_nb_int;n_code++) {
33982 mem_base = xmlMemBlocks();
33983 code = gen_int(n_code, 0);
33984
33985 ret_val = xmlUCSIsArmenian(code);
33986 desret_int(ret_val);
33987 call_tests++;
33988 des_int(n_code, code, 0);
33989 xmlResetLastError();
33990 if (mem_base != xmlMemBlocks()) {
33991 printf("Leak of %d blocks found in xmlUCSIsArmenian",
33992 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033993 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033994 printf(" %d", n_code);
33995 printf("\n");
33996 }
33997 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033998 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033999#endif
34000
Daniel Veillard42595322004-11-08 10:52:06 +000034001 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034002}
34003
34004
34005static int
34006test_xmlUCSIsArrows(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034007 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034008
34009#ifdef LIBXML_UNICODE_ENABLED
34010 int mem_base;
34011 int ret_val;
34012 int code; /* UCS code point */
34013 int n_code;
34014
34015 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34016 mem_base = xmlMemBlocks();
34017 code = gen_int(n_code, 0);
34018
34019 ret_val = xmlUCSIsArrows(code);
34020 desret_int(ret_val);
34021 call_tests++;
34022 des_int(n_code, code, 0);
34023 xmlResetLastError();
34024 if (mem_base != xmlMemBlocks()) {
34025 printf("Leak of %d blocks found in xmlUCSIsArrows",
34026 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034027 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034028 printf(" %d", n_code);
34029 printf("\n");
34030 }
34031 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034032 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034033#endif
34034
Daniel Veillard42595322004-11-08 10:52:06 +000034035 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034036}
34037
34038
34039static int
34040test_xmlUCSIsBasicLatin(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034041 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034042
34043#ifdef LIBXML_UNICODE_ENABLED
34044 int mem_base;
34045 int ret_val;
34046 int code; /* UCS code point */
34047 int n_code;
34048
34049 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34050 mem_base = xmlMemBlocks();
34051 code = gen_int(n_code, 0);
34052
34053 ret_val = xmlUCSIsBasicLatin(code);
34054 desret_int(ret_val);
34055 call_tests++;
34056 des_int(n_code, code, 0);
34057 xmlResetLastError();
34058 if (mem_base != xmlMemBlocks()) {
34059 printf("Leak of %d blocks found in xmlUCSIsBasicLatin",
34060 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034061 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034062 printf(" %d", n_code);
34063 printf("\n");
34064 }
34065 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034066 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034067#endif
34068
Daniel Veillard42595322004-11-08 10:52:06 +000034069 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034070}
34071
34072
34073static int
34074test_xmlUCSIsBengali(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034075 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034076
34077#ifdef LIBXML_UNICODE_ENABLED
34078 int mem_base;
34079 int ret_val;
34080 int code; /* UCS code point */
34081 int n_code;
34082
34083 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34084 mem_base = xmlMemBlocks();
34085 code = gen_int(n_code, 0);
34086
34087 ret_val = xmlUCSIsBengali(code);
34088 desret_int(ret_val);
34089 call_tests++;
34090 des_int(n_code, code, 0);
34091 xmlResetLastError();
34092 if (mem_base != xmlMemBlocks()) {
34093 printf("Leak of %d blocks found in xmlUCSIsBengali",
34094 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034095 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034096 printf(" %d", n_code);
34097 printf("\n");
34098 }
34099 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034100 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034101#endif
34102
Daniel Veillard42595322004-11-08 10:52:06 +000034103 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034104}
34105
34106
34107static int
34108test_xmlUCSIsBlock(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034109 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034110
34111#ifdef LIBXML_UNICODE_ENABLED
34112 int mem_base;
34113 int ret_val;
34114 int code; /* UCS code point */
34115 int n_code;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034116 char * block; /* UCS block name */
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034117 int n_block;
34118
34119 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34120 for (n_block = 0;n_block < gen_nb_const_char_ptr;n_block++) {
34121 mem_base = xmlMemBlocks();
34122 code = gen_int(n_code, 0);
34123 block = gen_const_char_ptr(n_block, 1);
34124
William M. Brackf13f77f2004-11-12 16:03:48 +000034125 ret_val = xmlUCSIsBlock(code, (const char *)block);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034126 desret_int(ret_val);
34127 call_tests++;
34128 des_int(n_code, code, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000034129 des_const_char_ptr(n_block, (const char *)block, 1);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034130 xmlResetLastError();
34131 if (mem_base != xmlMemBlocks()) {
34132 printf("Leak of %d blocks found in xmlUCSIsBlock",
34133 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034134 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034135 printf(" %d", n_code);
34136 printf(" %d", n_block);
34137 printf("\n");
34138 }
34139 }
34140 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034141 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034142#endif
34143
Daniel Veillard42595322004-11-08 10:52:06 +000034144 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034145}
34146
34147
34148static int
34149test_xmlUCSIsBlockElements(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034150 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034151
34152#ifdef LIBXML_UNICODE_ENABLED
34153 int mem_base;
34154 int ret_val;
34155 int code; /* UCS code point */
34156 int n_code;
34157
34158 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34159 mem_base = xmlMemBlocks();
34160 code = gen_int(n_code, 0);
34161
34162 ret_val = xmlUCSIsBlockElements(code);
34163 desret_int(ret_val);
34164 call_tests++;
34165 des_int(n_code, code, 0);
34166 xmlResetLastError();
34167 if (mem_base != xmlMemBlocks()) {
34168 printf("Leak of %d blocks found in xmlUCSIsBlockElements",
34169 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034170 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034171 printf(" %d", n_code);
34172 printf("\n");
34173 }
34174 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034175 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034176#endif
34177
Daniel Veillard42595322004-11-08 10:52:06 +000034178 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034179}
34180
34181
34182static int
34183test_xmlUCSIsBopomofo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034184 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034185
34186#ifdef LIBXML_UNICODE_ENABLED
34187 int mem_base;
34188 int ret_val;
34189 int code; /* UCS code point */
34190 int n_code;
34191
34192 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34193 mem_base = xmlMemBlocks();
34194 code = gen_int(n_code, 0);
34195
34196 ret_val = xmlUCSIsBopomofo(code);
34197 desret_int(ret_val);
34198 call_tests++;
34199 des_int(n_code, code, 0);
34200 xmlResetLastError();
34201 if (mem_base != xmlMemBlocks()) {
34202 printf("Leak of %d blocks found in xmlUCSIsBopomofo",
34203 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034204 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034205 printf(" %d", n_code);
34206 printf("\n");
34207 }
34208 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034209 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034210#endif
34211
Daniel Veillard42595322004-11-08 10:52:06 +000034212 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034213}
34214
34215
34216static int
34217test_xmlUCSIsBopomofoExtended(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034218 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034219
34220#ifdef LIBXML_UNICODE_ENABLED
34221 int mem_base;
34222 int ret_val;
34223 int code; /* UCS code point */
34224 int n_code;
34225
34226 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34227 mem_base = xmlMemBlocks();
34228 code = gen_int(n_code, 0);
34229
34230 ret_val = xmlUCSIsBopomofoExtended(code);
34231 desret_int(ret_val);
34232 call_tests++;
34233 des_int(n_code, code, 0);
34234 xmlResetLastError();
34235 if (mem_base != xmlMemBlocks()) {
34236 printf("Leak of %d blocks found in xmlUCSIsBopomofoExtended",
34237 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034238 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034239 printf(" %d", n_code);
34240 printf("\n");
34241 }
34242 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034243 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034244#endif
34245
Daniel Veillard42595322004-11-08 10:52:06 +000034246 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034247}
34248
34249
34250static int
34251test_xmlUCSIsBoxDrawing(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034252 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034253
34254#ifdef LIBXML_UNICODE_ENABLED
34255 int mem_base;
34256 int ret_val;
34257 int code; /* UCS code point */
34258 int n_code;
34259
34260 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34261 mem_base = xmlMemBlocks();
34262 code = gen_int(n_code, 0);
34263
34264 ret_val = xmlUCSIsBoxDrawing(code);
34265 desret_int(ret_val);
34266 call_tests++;
34267 des_int(n_code, code, 0);
34268 xmlResetLastError();
34269 if (mem_base != xmlMemBlocks()) {
34270 printf("Leak of %d blocks found in xmlUCSIsBoxDrawing",
34271 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034272 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034273 printf(" %d", n_code);
34274 printf("\n");
34275 }
34276 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034277 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034278#endif
34279
Daniel Veillard42595322004-11-08 10:52:06 +000034280 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034281}
34282
34283
34284static int
34285test_xmlUCSIsBraillePatterns(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034286 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034287
34288#ifdef LIBXML_UNICODE_ENABLED
34289 int mem_base;
34290 int ret_val;
34291 int code; /* UCS code point */
34292 int n_code;
34293
34294 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34295 mem_base = xmlMemBlocks();
34296 code = gen_int(n_code, 0);
34297
34298 ret_val = xmlUCSIsBraillePatterns(code);
34299 desret_int(ret_val);
34300 call_tests++;
34301 des_int(n_code, code, 0);
34302 xmlResetLastError();
34303 if (mem_base != xmlMemBlocks()) {
34304 printf("Leak of %d blocks found in xmlUCSIsBraillePatterns",
34305 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034306 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034307 printf(" %d", n_code);
34308 printf("\n");
34309 }
34310 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034311 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034312#endif
34313
Daniel Veillard42595322004-11-08 10:52:06 +000034314 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034315}
34316
34317
34318static int
34319test_xmlUCSIsBuhid(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034320 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034321
34322#ifdef LIBXML_UNICODE_ENABLED
34323 int mem_base;
34324 int ret_val;
34325 int code; /* UCS code point */
34326 int n_code;
34327
34328 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34329 mem_base = xmlMemBlocks();
34330 code = gen_int(n_code, 0);
34331
34332 ret_val = xmlUCSIsBuhid(code);
34333 desret_int(ret_val);
34334 call_tests++;
34335 des_int(n_code, code, 0);
34336 xmlResetLastError();
34337 if (mem_base != xmlMemBlocks()) {
34338 printf("Leak of %d blocks found in xmlUCSIsBuhid",
34339 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034340 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034341 printf(" %d", n_code);
34342 printf("\n");
34343 }
34344 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034345 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034346#endif
34347
Daniel Veillard42595322004-11-08 10:52:06 +000034348 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034349}
34350
34351
34352static int
34353test_xmlUCSIsByzantineMusicalSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034354 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034355
34356#ifdef LIBXML_UNICODE_ENABLED
34357 int mem_base;
34358 int ret_val;
34359 int code; /* UCS code point */
34360 int n_code;
34361
34362 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34363 mem_base = xmlMemBlocks();
34364 code = gen_int(n_code, 0);
34365
34366 ret_val = xmlUCSIsByzantineMusicalSymbols(code);
34367 desret_int(ret_val);
34368 call_tests++;
34369 des_int(n_code, code, 0);
34370 xmlResetLastError();
34371 if (mem_base != xmlMemBlocks()) {
34372 printf("Leak of %d blocks found in xmlUCSIsByzantineMusicalSymbols",
34373 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034374 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034375 printf(" %d", n_code);
34376 printf("\n");
34377 }
34378 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034379 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034380#endif
34381
Daniel Veillard42595322004-11-08 10:52:06 +000034382 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034383}
34384
34385
34386static int
34387test_xmlUCSIsCJKCompatibility(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034388 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034389
34390#ifdef LIBXML_UNICODE_ENABLED
34391 int mem_base;
34392 int ret_val;
34393 int code; /* UCS code point */
34394 int n_code;
34395
34396 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34397 mem_base = xmlMemBlocks();
34398 code = gen_int(n_code, 0);
34399
34400 ret_val = xmlUCSIsCJKCompatibility(code);
34401 desret_int(ret_val);
34402 call_tests++;
34403 des_int(n_code, code, 0);
34404 xmlResetLastError();
34405 if (mem_base != xmlMemBlocks()) {
34406 printf("Leak of %d blocks found in xmlUCSIsCJKCompatibility",
34407 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034408 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034409 printf(" %d", n_code);
34410 printf("\n");
34411 }
34412 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034413 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034414#endif
34415
Daniel Veillard42595322004-11-08 10:52:06 +000034416 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034417}
34418
34419
34420static int
34421test_xmlUCSIsCJKCompatibilityForms(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034422 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034423
34424#ifdef LIBXML_UNICODE_ENABLED
34425 int mem_base;
34426 int ret_val;
34427 int code; /* UCS code point */
34428 int n_code;
34429
34430 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34431 mem_base = xmlMemBlocks();
34432 code = gen_int(n_code, 0);
34433
34434 ret_val = xmlUCSIsCJKCompatibilityForms(code);
34435 desret_int(ret_val);
34436 call_tests++;
34437 des_int(n_code, code, 0);
34438 xmlResetLastError();
34439 if (mem_base != xmlMemBlocks()) {
34440 printf("Leak of %d blocks found in xmlUCSIsCJKCompatibilityForms",
34441 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034442 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034443 printf(" %d", n_code);
34444 printf("\n");
34445 }
34446 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034447 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034448#endif
34449
Daniel Veillard42595322004-11-08 10:52:06 +000034450 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034451}
34452
34453
34454static int
34455test_xmlUCSIsCJKCompatibilityIdeographs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034456 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034457
34458#ifdef LIBXML_UNICODE_ENABLED
34459 int mem_base;
34460 int ret_val;
34461 int code; /* UCS code point */
34462 int n_code;
34463
34464 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34465 mem_base = xmlMemBlocks();
34466 code = gen_int(n_code, 0);
34467
34468 ret_val = xmlUCSIsCJKCompatibilityIdeographs(code);
34469 desret_int(ret_val);
34470 call_tests++;
34471 des_int(n_code, code, 0);
34472 xmlResetLastError();
34473 if (mem_base != xmlMemBlocks()) {
34474 printf("Leak of %d blocks found in xmlUCSIsCJKCompatibilityIdeographs",
34475 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034476 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034477 printf(" %d", n_code);
34478 printf("\n");
34479 }
34480 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034481 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034482#endif
34483
Daniel Veillard42595322004-11-08 10:52:06 +000034484 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034485}
34486
34487
34488static int
34489test_xmlUCSIsCJKCompatibilityIdeographsSupplement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034490 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034491
34492#ifdef LIBXML_UNICODE_ENABLED
34493 int mem_base;
34494 int ret_val;
34495 int code; /* UCS code point */
34496 int n_code;
34497
34498 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34499 mem_base = xmlMemBlocks();
34500 code = gen_int(n_code, 0);
34501
34502 ret_val = xmlUCSIsCJKCompatibilityIdeographsSupplement(code);
34503 desret_int(ret_val);
34504 call_tests++;
34505 des_int(n_code, code, 0);
34506 xmlResetLastError();
34507 if (mem_base != xmlMemBlocks()) {
34508 printf("Leak of %d blocks found in xmlUCSIsCJKCompatibilityIdeographsSupplement",
34509 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034510 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034511 printf(" %d", n_code);
34512 printf("\n");
34513 }
34514 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034515 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034516#endif
34517
Daniel Veillard42595322004-11-08 10:52:06 +000034518 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034519}
34520
34521
34522static int
34523test_xmlUCSIsCJKRadicalsSupplement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034524 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034525
34526#ifdef LIBXML_UNICODE_ENABLED
34527 int mem_base;
34528 int ret_val;
34529 int code; /* UCS code point */
34530 int n_code;
34531
34532 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34533 mem_base = xmlMemBlocks();
34534 code = gen_int(n_code, 0);
34535
34536 ret_val = xmlUCSIsCJKRadicalsSupplement(code);
34537 desret_int(ret_val);
34538 call_tests++;
34539 des_int(n_code, code, 0);
34540 xmlResetLastError();
34541 if (mem_base != xmlMemBlocks()) {
34542 printf("Leak of %d blocks found in xmlUCSIsCJKRadicalsSupplement",
34543 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034544 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034545 printf(" %d", n_code);
34546 printf("\n");
34547 }
34548 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034549 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034550#endif
34551
Daniel Veillard42595322004-11-08 10:52:06 +000034552 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034553}
34554
34555
34556static int
34557test_xmlUCSIsCJKSymbolsandPunctuation(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034558 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034559
34560#ifdef LIBXML_UNICODE_ENABLED
34561 int mem_base;
34562 int ret_val;
34563 int code; /* UCS code point */
34564 int n_code;
34565
34566 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34567 mem_base = xmlMemBlocks();
34568 code = gen_int(n_code, 0);
34569
34570 ret_val = xmlUCSIsCJKSymbolsandPunctuation(code);
34571 desret_int(ret_val);
34572 call_tests++;
34573 des_int(n_code, code, 0);
34574 xmlResetLastError();
34575 if (mem_base != xmlMemBlocks()) {
34576 printf("Leak of %d blocks found in xmlUCSIsCJKSymbolsandPunctuation",
34577 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034578 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034579 printf(" %d", n_code);
34580 printf("\n");
34581 }
34582 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034583 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034584#endif
34585
Daniel Veillard42595322004-11-08 10:52:06 +000034586 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034587}
34588
34589
34590static int
34591test_xmlUCSIsCJKUnifiedIdeographs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034592 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034593
34594#ifdef LIBXML_UNICODE_ENABLED
34595 int mem_base;
34596 int ret_val;
34597 int code; /* UCS code point */
34598 int n_code;
34599
34600 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34601 mem_base = xmlMemBlocks();
34602 code = gen_int(n_code, 0);
34603
34604 ret_val = xmlUCSIsCJKUnifiedIdeographs(code);
34605 desret_int(ret_val);
34606 call_tests++;
34607 des_int(n_code, code, 0);
34608 xmlResetLastError();
34609 if (mem_base != xmlMemBlocks()) {
34610 printf("Leak of %d blocks found in xmlUCSIsCJKUnifiedIdeographs",
34611 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034612 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034613 printf(" %d", n_code);
34614 printf("\n");
34615 }
34616 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034617 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034618#endif
34619
Daniel Veillard42595322004-11-08 10:52:06 +000034620 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034621}
34622
34623
34624static int
34625test_xmlUCSIsCJKUnifiedIdeographsExtensionA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034626 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034627
34628#ifdef LIBXML_UNICODE_ENABLED
34629 int mem_base;
34630 int ret_val;
34631 int code; /* UCS code point */
34632 int n_code;
34633
34634 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34635 mem_base = xmlMemBlocks();
34636 code = gen_int(n_code, 0);
34637
34638 ret_val = xmlUCSIsCJKUnifiedIdeographsExtensionA(code);
34639 desret_int(ret_val);
34640 call_tests++;
34641 des_int(n_code, code, 0);
34642 xmlResetLastError();
34643 if (mem_base != xmlMemBlocks()) {
34644 printf("Leak of %d blocks found in xmlUCSIsCJKUnifiedIdeographsExtensionA",
34645 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034646 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034647 printf(" %d", n_code);
34648 printf("\n");
34649 }
34650 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034651 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034652#endif
34653
Daniel Veillard42595322004-11-08 10:52:06 +000034654 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034655}
34656
34657
34658static int
34659test_xmlUCSIsCJKUnifiedIdeographsExtensionB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034660 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034661
34662#ifdef LIBXML_UNICODE_ENABLED
34663 int mem_base;
34664 int ret_val;
34665 int code; /* UCS code point */
34666 int n_code;
34667
34668 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34669 mem_base = xmlMemBlocks();
34670 code = gen_int(n_code, 0);
34671
34672 ret_val = xmlUCSIsCJKUnifiedIdeographsExtensionB(code);
34673 desret_int(ret_val);
34674 call_tests++;
34675 des_int(n_code, code, 0);
34676 xmlResetLastError();
34677 if (mem_base != xmlMemBlocks()) {
34678 printf("Leak of %d blocks found in xmlUCSIsCJKUnifiedIdeographsExtensionB",
34679 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034680 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034681 printf(" %d", n_code);
34682 printf("\n");
34683 }
34684 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034685 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034686#endif
34687
Daniel Veillard42595322004-11-08 10:52:06 +000034688 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034689}
34690
34691
34692static int
34693test_xmlUCSIsCat(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034694 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034695
34696#ifdef LIBXML_UNICODE_ENABLED
34697 int mem_base;
34698 int ret_val;
34699 int code; /* UCS code point */
34700 int n_code;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034701 char * cat; /* UCS Category name */
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034702 int n_cat;
34703
34704 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34705 for (n_cat = 0;n_cat < gen_nb_const_char_ptr;n_cat++) {
34706 mem_base = xmlMemBlocks();
34707 code = gen_int(n_code, 0);
34708 cat = gen_const_char_ptr(n_cat, 1);
34709
William M. Brackf13f77f2004-11-12 16:03:48 +000034710 ret_val = xmlUCSIsCat(code, (const char *)cat);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034711 desret_int(ret_val);
34712 call_tests++;
34713 des_int(n_code, code, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000034714 des_const_char_ptr(n_cat, (const char *)cat, 1);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034715 xmlResetLastError();
34716 if (mem_base != xmlMemBlocks()) {
34717 printf("Leak of %d blocks found in xmlUCSIsCat",
34718 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034719 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034720 printf(" %d", n_code);
34721 printf(" %d", n_cat);
34722 printf("\n");
34723 }
34724 }
34725 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034726 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034727#endif
34728
Daniel Veillard42595322004-11-08 10:52:06 +000034729 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034730}
34731
34732
34733static int
34734test_xmlUCSIsCatC(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034735 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034736
34737#ifdef LIBXML_UNICODE_ENABLED
34738 int mem_base;
34739 int ret_val;
34740 int code; /* UCS code point */
34741 int n_code;
34742
34743 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34744 mem_base = xmlMemBlocks();
34745 code = gen_int(n_code, 0);
34746
34747 ret_val = xmlUCSIsCatC(code);
34748 desret_int(ret_val);
34749 call_tests++;
34750 des_int(n_code, code, 0);
34751 xmlResetLastError();
34752 if (mem_base != xmlMemBlocks()) {
34753 printf("Leak of %d blocks found in xmlUCSIsCatC",
34754 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034755 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034756 printf(" %d", n_code);
34757 printf("\n");
34758 }
34759 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034760 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034761#endif
34762
Daniel Veillard42595322004-11-08 10:52:06 +000034763 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034764}
34765
34766
34767static int
34768test_xmlUCSIsCatCc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034769 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034770
34771#ifdef LIBXML_UNICODE_ENABLED
34772 int mem_base;
34773 int ret_val;
34774 int code; /* UCS code point */
34775 int n_code;
34776
34777 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34778 mem_base = xmlMemBlocks();
34779 code = gen_int(n_code, 0);
34780
34781 ret_val = xmlUCSIsCatCc(code);
34782 desret_int(ret_val);
34783 call_tests++;
34784 des_int(n_code, code, 0);
34785 xmlResetLastError();
34786 if (mem_base != xmlMemBlocks()) {
34787 printf("Leak of %d blocks found in xmlUCSIsCatCc",
34788 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034789 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034790 printf(" %d", n_code);
34791 printf("\n");
34792 }
34793 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034794 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034795#endif
34796
Daniel Veillard42595322004-11-08 10:52:06 +000034797 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034798}
34799
34800
34801static int
34802test_xmlUCSIsCatCf(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034803 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034804
34805#ifdef LIBXML_UNICODE_ENABLED
34806 int mem_base;
34807 int ret_val;
34808 int code; /* UCS code point */
34809 int n_code;
34810
34811 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34812 mem_base = xmlMemBlocks();
34813 code = gen_int(n_code, 0);
34814
34815 ret_val = xmlUCSIsCatCf(code);
34816 desret_int(ret_val);
34817 call_tests++;
34818 des_int(n_code, code, 0);
34819 xmlResetLastError();
34820 if (mem_base != xmlMemBlocks()) {
34821 printf("Leak of %d blocks found in xmlUCSIsCatCf",
34822 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034823 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034824 printf(" %d", n_code);
34825 printf("\n");
34826 }
34827 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034828 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034829#endif
34830
Daniel Veillard42595322004-11-08 10:52:06 +000034831 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034832}
34833
34834
34835static int
34836test_xmlUCSIsCatCo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034837 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034838
34839#ifdef LIBXML_UNICODE_ENABLED
34840 int mem_base;
34841 int ret_val;
34842 int code; /* UCS code point */
34843 int n_code;
34844
34845 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34846 mem_base = xmlMemBlocks();
34847 code = gen_int(n_code, 0);
34848
34849 ret_val = xmlUCSIsCatCo(code);
34850 desret_int(ret_val);
34851 call_tests++;
34852 des_int(n_code, code, 0);
34853 xmlResetLastError();
34854 if (mem_base != xmlMemBlocks()) {
34855 printf("Leak of %d blocks found in xmlUCSIsCatCo",
34856 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034857 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034858 printf(" %d", n_code);
34859 printf("\n");
34860 }
34861 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034862 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034863#endif
34864
Daniel Veillard42595322004-11-08 10:52:06 +000034865 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034866}
34867
34868
34869static int
34870test_xmlUCSIsCatCs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034871 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034872
34873#ifdef LIBXML_UNICODE_ENABLED
34874 int mem_base;
34875 int ret_val;
34876 int code; /* UCS code point */
34877 int n_code;
34878
34879 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34880 mem_base = xmlMemBlocks();
34881 code = gen_int(n_code, 0);
34882
34883 ret_val = xmlUCSIsCatCs(code);
34884 desret_int(ret_val);
34885 call_tests++;
34886 des_int(n_code, code, 0);
34887 xmlResetLastError();
34888 if (mem_base != xmlMemBlocks()) {
34889 printf("Leak of %d blocks found in xmlUCSIsCatCs",
34890 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034891 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034892 printf(" %d", n_code);
34893 printf("\n");
34894 }
34895 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034896 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034897#endif
34898
Daniel Veillard42595322004-11-08 10:52:06 +000034899 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034900}
34901
34902
34903static int
34904test_xmlUCSIsCatL(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034905 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034906
34907#ifdef LIBXML_UNICODE_ENABLED
34908 int mem_base;
34909 int ret_val;
34910 int code; /* UCS code point */
34911 int n_code;
34912
34913 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34914 mem_base = xmlMemBlocks();
34915 code = gen_int(n_code, 0);
34916
34917 ret_val = xmlUCSIsCatL(code);
34918 desret_int(ret_val);
34919 call_tests++;
34920 des_int(n_code, code, 0);
34921 xmlResetLastError();
34922 if (mem_base != xmlMemBlocks()) {
34923 printf("Leak of %d blocks found in xmlUCSIsCatL",
34924 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034925 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034926 printf(" %d", n_code);
34927 printf("\n");
34928 }
34929 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034930 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034931#endif
34932
Daniel Veillard42595322004-11-08 10:52:06 +000034933 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034934}
34935
34936
34937static int
34938test_xmlUCSIsCatLl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034939 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034940
34941#ifdef LIBXML_UNICODE_ENABLED
34942 int mem_base;
34943 int ret_val;
34944 int code; /* UCS code point */
34945 int n_code;
34946
34947 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34948 mem_base = xmlMemBlocks();
34949 code = gen_int(n_code, 0);
34950
34951 ret_val = xmlUCSIsCatLl(code);
34952 desret_int(ret_val);
34953 call_tests++;
34954 des_int(n_code, code, 0);
34955 xmlResetLastError();
34956 if (mem_base != xmlMemBlocks()) {
34957 printf("Leak of %d blocks found in xmlUCSIsCatLl",
34958 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034959 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034960 printf(" %d", n_code);
34961 printf("\n");
34962 }
34963 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034964 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034965#endif
34966
Daniel Veillard42595322004-11-08 10:52:06 +000034967 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034968}
34969
34970
34971static int
34972test_xmlUCSIsCatLm(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034973 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034974
34975#ifdef LIBXML_UNICODE_ENABLED
34976 int mem_base;
34977 int ret_val;
34978 int code; /* UCS code point */
34979 int n_code;
34980
34981 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34982 mem_base = xmlMemBlocks();
34983 code = gen_int(n_code, 0);
34984
34985 ret_val = xmlUCSIsCatLm(code);
34986 desret_int(ret_val);
34987 call_tests++;
34988 des_int(n_code, code, 0);
34989 xmlResetLastError();
34990 if (mem_base != xmlMemBlocks()) {
34991 printf("Leak of %d blocks found in xmlUCSIsCatLm",
34992 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034993 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034994 printf(" %d", n_code);
34995 printf("\n");
34996 }
34997 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034998 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034999#endif
35000
Daniel Veillard42595322004-11-08 10:52:06 +000035001 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035002}
35003
35004
35005static int
35006test_xmlUCSIsCatLo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035007 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035008
35009#ifdef LIBXML_UNICODE_ENABLED
35010 int mem_base;
35011 int ret_val;
35012 int code; /* UCS code point */
35013 int n_code;
35014
35015 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35016 mem_base = xmlMemBlocks();
35017 code = gen_int(n_code, 0);
35018
35019 ret_val = xmlUCSIsCatLo(code);
35020 desret_int(ret_val);
35021 call_tests++;
35022 des_int(n_code, code, 0);
35023 xmlResetLastError();
35024 if (mem_base != xmlMemBlocks()) {
35025 printf("Leak of %d blocks found in xmlUCSIsCatLo",
35026 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035027 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035028 printf(" %d", n_code);
35029 printf("\n");
35030 }
35031 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035032 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035033#endif
35034
Daniel Veillard42595322004-11-08 10:52:06 +000035035 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035036}
35037
35038
35039static int
35040test_xmlUCSIsCatLt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035041 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035042
35043#ifdef LIBXML_UNICODE_ENABLED
35044 int mem_base;
35045 int ret_val;
35046 int code; /* UCS code point */
35047 int n_code;
35048
35049 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35050 mem_base = xmlMemBlocks();
35051 code = gen_int(n_code, 0);
35052
35053 ret_val = xmlUCSIsCatLt(code);
35054 desret_int(ret_val);
35055 call_tests++;
35056 des_int(n_code, code, 0);
35057 xmlResetLastError();
35058 if (mem_base != xmlMemBlocks()) {
35059 printf("Leak of %d blocks found in xmlUCSIsCatLt",
35060 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035061 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035062 printf(" %d", n_code);
35063 printf("\n");
35064 }
35065 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035066 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035067#endif
35068
Daniel Veillard42595322004-11-08 10:52:06 +000035069 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035070}
35071
35072
35073static int
35074test_xmlUCSIsCatLu(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035075 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035076
35077#ifdef LIBXML_UNICODE_ENABLED
35078 int mem_base;
35079 int ret_val;
35080 int code; /* UCS code point */
35081 int n_code;
35082
35083 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35084 mem_base = xmlMemBlocks();
35085 code = gen_int(n_code, 0);
35086
35087 ret_val = xmlUCSIsCatLu(code);
35088 desret_int(ret_val);
35089 call_tests++;
35090 des_int(n_code, code, 0);
35091 xmlResetLastError();
35092 if (mem_base != xmlMemBlocks()) {
35093 printf("Leak of %d blocks found in xmlUCSIsCatLu",
35094 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035095 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035096 printf(" %d", n_code);
35097 printf("\n");
35098 }
35099 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035100 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035101#endif
35102
Daniel Veillard42595322004-11-08 10:52:06 +000035103 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035104}
35105
35106
35107static int
35108test_xmlUCSIsCatM(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035109 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035110
35111#ifdef LIBXML_UNICODE_ENABLED
35112 int mem_base;
35113 int ret_val;
35114 int code; /* UCS code point */
35115 int n_code;
35116
35117 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35118 mem_base = xmlMemBlocks();
35119 code = gen_int(n_code, 0);
35120
35121 ret_val = xmlUCSIsCatM(code);
35122 desret_int(ret_val);
35123 call_tests++;
35124 des_int(n_code, code, 0);
35125 xmlResetLastError();
35126 if (mem_base != xmlMemBlocks()) {
35127 printf("Leak of %d blocks found in xmlUCSIsCatM",
35128 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035129 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035130 printf(" %d", n_code);
35131 printf("\n");
35132 }
35133 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035134 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035135#endif
35136
Daniel Veillard42595322004-11-08 10:52:06 +000035137 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035138}
35139
35140
35141static int
35142test_xmlUCSIsCatMc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035143 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035144
35145#ifdef LIBXML_UNICODE_ENABLED
35146 int mem_base;
35147 int ret_val;
35148 int code; /* UCS code point */
35149 int n_code;
35150
35151 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35152 mem_base = xmlMemBlocks();
35153 code = gen_int(n_code, 0);
35154
35155 ret_val = xmlUCSIsCatMc(code);
35156 desret_int(ret_val);
35157 call_tests++;
35158 des_int(n_code, code, 0);
35159 xmlResetLastError();
35160 if (mem_base != xmlMemBlocks()) {
35161 printf("Leak of %d blocks found in xmlUCSIsCatMc",
35162 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035163 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035164 printf(" %d", n_code);
35165 printf("\n");
35166 }
35167 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035168 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035169#endif
35170
Daniel Veillard42595322004-11-08 10:52:06 +000035171 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035172}
35173
35174
35175static int
35176test_xmlUCSIsCatMe(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035177 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035178
35179#ifdef LIBXML_UNICODE_ENABLED
35180 int mem_base;
35181 int ret_val;
35182 int code; /* UCS code point */
35183 int n_code;
35184
35185 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35186 mem_base = xmlMemBlocks();
35187 code = gen_int(n_code, 0);
35188
35189 ret_val = xmlUCSIsCatMe(code);
35190 desret_int(ret_val);
35191 call_tests++;
35192 des_int(n_code, code, 0);
35193 xmlResetLastError();
35194 if (mem_base != xmlMemBlocks()) {
35195 printf("Leak of %d blocks found in xmlUCSIsCatMe",
35196 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035197 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035198 printf(" %d", n_code);
35199 printf("\n");
35200 }
35201 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035202 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035203#endif
35204
Daniel Veillard42595322004-11-08 10:52:06 +000035205 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035206}
35207
35208
35209static int
35210test_xmlUCSIsCatMn(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035211 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035212
35213#ifdef LIBXML_UNICODE_ENABLED
35214 int mem_base;
35215 int ret_val;
35216 int code; /* UCS code point */
35217 int n_code;
35218
35219 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35220 mem_base = xmlMemBlocks();
35221 code = gen_int(n_code, 0);
35222
35223 ret_val = xmlUCSIsCatMn(code);
35224 desret_int(ret_val);
35225 call_tests++;
35226 des_int(n_code, code, 0);
35227 xmlResetLastError();
35228 if (mem_base != xmlMemBlocks()) {
35229 printf("Leak of %d blocks found in xmlUCSIsCatMn",
35230 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035231 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035232 printf(" %d", n_code);
35233 printf("\n");
35234 }
35235 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035236 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035237#endif
35238
Daniel Veillard42595322004-11-08 10:52:06 +000035239 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035240}
35241
35242
35243static int
35244test_xmlUCSIsCatN(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035245 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035246
35247#ifdef LIBXML_UNICODE_ENABLED
35248 int mem_base;
35249 int ret_val;
35250 int code; /* UCS code point */
35251 int n_code;
35252
35253 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35254 mem_base = xmlMemBlocks();
35255 code = gen_int(n_code, 0);
35256
35257 ret_val = xmlUCSIsCatN(code);
35258 desret_int(ret_val);
35259 call_tests++;
35260 des_int(n_code, code, 0);
35261 xmlResetLastError();
35262 if (mem_base != xmlMemBlocks()) {
35263 printf("Leak of %d blocks found in xmlUCSIsCatN",
35264 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035265 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035266 printf(" %d", n_code);
35267 printf("\n");
35268 }
35269 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035270 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035271#endif
35272
Daniel Veillard42595322004-11-08 10:52:06 +000035273 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035274}
35275
35276
35277static int
35278test_xmlUCSIsCatNd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035279 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035280
35281#ifdef LIBXML_UNICODE_ENABLED
35282 int mem_base;
35283 int ret_val;
35284 int code; /* UCS code point */
35285 int n_code;
35286
35287 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35288 mem_base = xmlMemBlocks();
35289 code = gen_int(n_code, 0);
35290
35291 ret_val = xmlUCSIsCatNd(code);
35292 desret_int(ret_val);
35293 call_tests++;
35294 des_int(n_code, code, 0);
35295 xmlResetLastError();
35296 if (mem_base != xmlMemBlocks()) {
35297 printf("Leak of %d blocks found in xmlUCSIsCatNd",
35298 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035299 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035300 printf(" %d", n_code);
35301 printf("\n");
35302 }
35303 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035304 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035305#endif
35306
Daniel Veillard42595322004-11-08 10:52:06 +000035307 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035308}
35309
35310
35311static int
35312test_xmlUCSIsCatNl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035313 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035314
35315#ifdef LIBXML_UNICODE_ENABLED
35316 int mem_base;
35317 int ret_val;
35318 int code; /* UCS code point */
35319 int n_code;
35320
35321 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35322 mem_base = xmlMemBlocks();
35323 code = gen_int(n_code, 0);
35324
35325 ret_val = xmlUCSIsCatNl(code);
35326 desret_int(ret_val);
35327 call_tests++;
35328 des_int(n_code, code, 0);
35329 xmlResetLastError();
35330 if (mem_base != xmlMemBlocks()) {
35331 printf("Leak of %d blocks found in xmlUCSIsCatNl",
35332 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035333 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035334 printf(" %d", n_code);
35335 printf("\n");
35336 }
35337 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035338 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035339#endif
35340
Daniel Veillard42595322004-11-08 10:52:06 +000035341 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035342}
35343
35344
35345static int
35346test_xmlUCSIsCatNo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035347 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035348
35349#ifdef LIBXML_UNICODE_ENABLED
35350 int mem_base;
35351 int ret_val;
35352 int code; /* UCS code point */
35353 int n_code;
35354
35355 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35356 mem_base = xmlMemBlocks();
35357 code = gen_int(n_code, 0);
35358
35359 ret_val = xmlUCSIsCatNo(code);
35360 desret_int(ret_val);
35361 call_tests++;
35362 des_int(n_code, code, 0);
35363 xmlResetLastError();
35364 if (mem_base != xmlMemBlocks()) {
35365 printf("Leak of %d blocks found in xmlUCSIsCatNo",
35366 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035367 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035368 printf(" %d", n_code);
35369 printf("\n");
35370 }
35371 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035372 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035373#endif
35374
Daniel Veillard42595322004-11-08 10:52:06 +000035375 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035376}
35377
35378
35379static int
35380test_xmlUCSIsCatP(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035381 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035382
35383#ifdef LIBXML_UNICODE_ENABLED
35384 int mem_base;
35385 int ret_val;
35386 int code; /* UCS code point */
35387 int n_code;
35388
35389 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35390 mem_base = xmlMemBlocks();
35391 code = gen_int(n_code, 0);
35392
35393 ret_val = xmlUCSIsCatP(code);
35394 desret_int(ret_val);
35395 call_tests++;
35396 des_int(n_code, code, 0);
35397 xmlResetLastError();
35398 if (mem_base != xmlMemBlocks()) {
35399 printf("Leak of %d blocks found in xmlUCSIsCatP",
35400 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035401 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035402 printf(" %d", n_code);
35403 printf("\n");
35404 }
35405 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035406 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035407#endif
35408
Daniel Veillard42595322004-11-08 10:52:06 +000035409 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035410}
35411
35412
35413static int
35414test_xmlUCSIsCatPc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035415 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035416
35417#ifdef LIBXML_UNICODE_ENABLED
35418 int mem_base;
35419 int ret_val;
35420 int code; /* UCS code point */
35421 int n_code;
35422
35423 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35424 mem_base = xmlMemBlocks();
35425 code = gen_int(n_code, 0);
35426
35427 ret_val = xmlUCSIsCatPc(code);
35428 desret_int(ret_val);
35429 call_tests++;
35430 des_int(n_code, code, 0);
35431 xmlResetLastError();
35432 if (mem_base != xmlMemBlocks()) {
35433 printf("Leak of %d blocks found in xmlUCSIsCatPc",
35434 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035435 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035436 printf(" %d", n_code);
35437 printf("\n");
35438 }
35439 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035440 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035441#endif
35442
Daniel Veillard42595322004-11-08 10:52:06 +000035443 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035444}
35445
35446
35447static int
35448test_xmlUCSIsCatPd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035449 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035450
35451#ifdef LIBXML_UNICODE_ENABLED
35452 int mem_base;
35453 int ret_val;
35454 int code; /* UCS code point */
35455 int n_code;
35456
35457 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35458 mem_base = xmlMemBlocks();
35459 code = gen_int(n_code, 0);
35460
35461 ret_val = xmlUCSIsCatPd(code);
35462 desret_int(ret_val);
35463 call_tests++;
35464 des_int(n_code, code, 0);
35465 xmlResetLastError();
35466 if (mem_base != xmlMemBlocks()) {
35467 printf("Leak of %d blocks found in xmlUCSIsCatPd",
35468 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035469 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035470 printf(" %d", n_code);
35471 printf("\n");
35472 }
35473 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035474 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035475#endif
35476
Daniel Veillard42595322004-11-08 10:52:06 +000035477 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035478}
35479
35480
35481static int
35482test_xmlUCSIsCatPe(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035483 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035484
35485#ifdef LIBXML_UNICODE_ENABLED
35486 int mem_base;
35487 int ret_val;
35488 int code; /* UCS code point */
35489 int n_code;
35490
35491 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35492 mem_base = xmlMemBlocks();
35493 code = gen_int(n_code, 0);
35494
35495 ret_val = xmlUCSIsCatPe(code);
35496 desret_int(ret_val);
35497 call_tests++;
35498 des_int(n_code, code, 0);
35499 xmlResetLastError();
35500 if (mem_base != xmlMemBlocks()) {
35501 printf("Leak of %d blocks found in xmlUCSIsCatPe",
35502 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035503 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035504 printf(" %d", n_code);
35505 printf("\n");
35506 }
35507 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035508 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035509#endif
35510
Daniel Veillard42595322004-11-08 10:52:06 +000035511 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035512}
35513
35514
35515static int
35516test_xmlUCSIsCatPf(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035517 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035518
35519#ifdef LIBXML_UNICODE_ENABLED
35520 int mem_base;
35521 int ret_val;
35522 int code; /* UCS code point */
35523 int n_code;
35524
35525 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35526 mem_base = xmlMemBlocks();
35527 code = gen_int(n_code, 0);
35528
35529 ret_val = xmlUCSIsCatPf(code);
35530 desret_int(ret_val);
35531 call_tests++;
35532 des_int(n_code, code, 0);
35533 xmlResetLastError();
35534 if (mem_base != xmlMemBlocks()) {
35535 printf("Leak of %d blocks found in xmlUCSIsCatPf",
35536 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035537 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035538 printf(" %d", n_code);
35539 printf("\n");
35540 }
35541 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035542 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035543#endif
35544
Daniel Veillard42595322004-11-08 10:52:06 +000035545 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035546}
35547
35548
35549static int
35550test_xmlUCSIsCatPi(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035551 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035552
35553#ifdef LIBXML_UNICODE_ENABLED
35554 int mem_base;
35555 int ret_val;
35556 int code; /* UCS code point */
35557 int n_code;
35558
35559 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35560 mem_base = xmlMemBlocks();
35561 code = gen_int(n_code, 0);
35562
35563 ret_val = xmlUCSIsCatPi(code);
35564 desret_int(ret_val);
35565 call_tests++;
35566 des_int(n_code, code, 0);
35567 xmlResetLastError();
35568 if (mem_base != xmlMemBlocks()) {
35569 printf("Leak of %d blocks found in xmlUCSIsCatPi",
35570 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035571 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035572 printf(" %d", n_code);
35573 printf("\n");
35574 }
35575 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035576 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035577#endif
35578
Daniel Veillard42595322004-11-08 10:52:06 +000035579 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035580}
35581
35582
35583static int
35584test_xmlUCSIsCatPo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035585 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035586
35587#ifdef LIBXML_UNICODE_ENABLED
35588 int mem_base;
35589 int ret_val;
35590 int code; /* UCS code point */
35591 int n_code;
35592
35593 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35594 mem_base = xmlMemBlocks();
35595 code = gen_int(n_code, 0);
35596
35597 ret_val = xmlUCSIsCatPo(code);
35598 desret_int(ret_val);
35599 call_tests++;
35600 des_int(n_code, code, 0);
35601 xmlResetLastError();
35602 if (mem_base != xmlMemBlocks()) {
35603 printf("Leak of %d blocks found in xmlUCSIsCatPo",
35604 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035605 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035606 printf(" %d", n_code);
35607 printf("\n");
35608 }
35609 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035610 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035611#endif
35612
Daniel Veillard42595322004-11-08 10:52:06 +000035613 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035614}
35615
35616
35617static int
35618test_xmlUCSIsCatPs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035619 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035620
35621#ifdef LIBXML_UNICODE_ENABLED
35622 int mem_base;
35623 int ret_val;
35624 int code; /* UCS code point */
35625 int n_code;
35626
35627 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35628 mem_base = xmlMemBlocks();
35629 code = gen_int(n_code, 0);
35630
35631 ret_val = xmlUCSIsCatPs(code);
35632 desret_int(ret_val);
35633 call_tests++;
35634 des_int(n_code, code, 0);
35635 xmlResetLastError();
35636 if (mem_base != xmlMemBlocks()) {
35637 printf("Leak of %d blocks found in xmlUCSIsCatPs",
35638 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035639 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035640 printf(" %d", n_code);
35641 printf("\n");
35642 }
35643 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035644 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035645#endif
35646
Daniel Veillard42595322004-11-08 10:52:06 +000035647 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035648}
35649
35650
35651static int
35652test_xmlUCSIsCatS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035653 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035654
35655#ifdef LIBXML_UNICODE_ENABLED
35656 int mem_base;
35657 int ret_val;
35658 int code; /* UCS code point */
35659 int n_code;
35660
35661 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35662 mem_base = xmlMemBlocks();
35663 code = gen_int(n_code, 0);
35664
35665 ret_val = xmlUCSIsCatS(code);
35666 desret_int(ret_val);
35667 call_tests++;
35668 des_int(n_code, code, 0);
35669 xmlResetLastError();
35670 if (mem_base != xmlMemBlocks()) {
35671 printf("Leak of %d blocks found in xmlUCSIsCatS",
35672 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035673 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035674 printf(" %d", n_code);
35675 printf("\n");
35676 }
35677 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035678 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035679#endif
35680
Daniel Veillard42595322004-11-08 10:52:06 +000035681 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035682}
35683
35684
35685static int
35686test_xmlUCSIsCatSc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035687 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035688
35689#ifdef LIBXML_UNICODE_ENABLED
35690 int mem_base;
35691 int ret_val;
35692 int code; /* UCS code point */
35693 int n_code;
35694
35695 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35696 mem_base = xmlMemBlocks();
35697 code = gen_int(n_code, 0);
35698
35699 ret_val = xmlUCSIsCatSc(code);
35700 desret_int(ret_val);
35701 call_tests++;
35702 des_int(n_code, code, 0);
35703 xmlResetLastError();
35704 if (mem_base != xmlMemBlocks()) {
35705 printf("Leak of %d blocks found in xmlUCSIsCatSc",
35706 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035707 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035708 printf(" %d", n_code);
35709 printf("\n");
35710 }
35711 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035712 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035713#endif
35714
Daniel Veillard42595322004-11-08 10:52:06 +000035715 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035716}
35717
35718
35719static int
35720test_xmlUCSIsCatSk(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035721 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035722
35723#ifdef LIBXML_UNICODE_ENABLED
35724 int mem_base;
35725 int ret_val;
35726 int code; /* UCS code point */
35727 int n_code;
35728
35729 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35730 mem_base = xmlMemBlocks();
35731 code = gen_int(n_code, 0);
35732
35733 ret_val = xmlUCSIsCatSk(code);
35734 desret_int(ret_val);
35735 call_tests++;
35736 des_int(n_code, code, 0);
35737 xmlResetLastError();
35738 if (mem_base != xmlMemBlocks()) {
35739 printf("Leak of %d blocks found in xmlUCSIsCatSk",
35740 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035741 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035742 printf(" %d", n_code);
35743 printf("\n");
35744 }
35745 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035746 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035747#endif
35748
Daniel Veillard42595322004-11-08 10:52:06 +000035749 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035750}
35751
35752
35753static int
35754test_xmlUCSIsCatSm(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035755 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035756
35757#ifdef LIBXML_UNICODE_ENABLED
35758 int mem_base;
35759 int ret_val;
35760 int code; /* UCS code point */
35761 int n_code;
35762
35763 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35764 mem_base = xmlMemBlocks();
35765 code = gen_int(n_code, 0);
35766
35767 ret_val = xmlUCSIsCatSm(code);
35768 desret_int(ret_val);
35769 call_tests++;
35770 des_int(n_code, code, 0);
35771 xmlResetLastError();
35772 if (mem_base != xmlMemBlocks()) {
35773 printf("Leak of %d blocks found in xmlUCSIsCatSm",
35774 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035775 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035776 printf(" %d", n_code);
35777 printf("\n");
35778 }
35779 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035780 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035781#endif
35782
Daniel Veillard42595322004-11-08 10:52:06 +000035783 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035784}
35785
35786
35787static int
35788test_xmlUCSIsCatSo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035789 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035790
35791#ifdef LIBXML_UNICODE_ENABLED
35792 int mem_base;
35793 int ret_val;
35794 int code; /* UCS code point */
35795 int n_code;
35796
35797 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35798 mem_base = xmlMemBlocks();
35799 code = gen_int(n_code, 0);
35800
35801 ret_val = xmlUCSIsCatSo(code);
35802 desret_int(ret_val);
35803 call_tests++;
35804 des_int(n_code, code, 0);
35805 xmlResetLastError();
35806 if (mem_base != xmlMemBlocks()) {
35807 printf("Leak of %d blocks found in xmlUCSIsCatSo",
35808 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035809 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035810 printf(" %d", n_code);
35811 printf("\n");
35812 }
35813 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035814 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035815#endif
35816
Daniel Veillard42595322004-11-08 10:52:06 +000035817 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035818}
35819
35820
35821static int
35822test_xmlUCSIsCatZ(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035823 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035824
35825#ifdef LIBXML_UNICODE_ENABLED
35826 int mem_base;
35827 int ret_val;
35828 int code; /* UCS code point */
35829 int n_code;
35830
35831 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35832 mem_base = xmlMemBlocks();
35833 code = gen_int(n_code, 0);
35834
35835 ret_val = xmlUCSIsCatZ(code);
35836 desret_int(ret_val);
35837 call_tests++;
35838 des_int(n_code, code, 0);
35839 xmlResetLastError();
35840 if (mem_base != xmlMemBlocks()) {
35841 printf("Leak of %d blocks found in xmlUCSIsCatZ",
35842 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035843 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035844 printf(" %d", n_code);
35845 printf("\n");
35846 }
35847 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035848 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035849#endif
35850
Daniel Veillard42595322004-11-08 10:52:06 +000035851 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035852}
35853
35854
35855static int
35856test_xmlUCSIsCatZl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035857 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035858
35859#ifdef LIBXML_UNICODE_ENABLED
35860 int mem_base;
35861 int ret_val;
35862 int code; /* UCS code point */
35863 int n_code;
35864
35865 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35866 mem_base = xmlMemBlocks();
35867 code = gen_int(n_code, 0);
35868
35869 ret_val = xmlUCSIsCatZl(code);
35870 desret_int(ret_val);
35871 call_tests++;
35872 des_int(n_code, code, 0);
35873 xmlResetLastError();
35874 if (mem_base != xmlMemBlocks()) {
35875 printf("Leak of %d blocks found in xmlUCSIsCatZl",
35876 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035877 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035878 printf(" %d", n_code);
35879 printf("\n");
35880 }
35881 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035882 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035883#endif
35884
Daniel Veillard42595322004-11-08 10:52:06 +000035885 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035886}
35887
35888
35889static int
35890test_xmlUCSIsCatZp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035891 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035892
35893#ifdef LIBXML_UNICODE_ENABLED
35894 int mem_base;
35895 int ret_val;
35896 int code; /* UCS code point */
35897 int n_code;
35898
35899 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35900 mem_base = xmlMemBlocks();
35901 code = gen_int(n_code, 0);
35902
35903 ret_val = xmlUCSIsCatZp(code);
35904 desret_int(ret_val);
35905 call_tests++;
35906 des_int(n_code, code, 0);
35907 xmlResetLastError();
35908 if (mem_base != xmlMemBlocks()) {
35909 printf("Leak of %d blocks found in xmlUCSIsCatZp",
35910 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035911 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035912 printf(" %d", n_code);
35913 printf("\n");
35914 }
35915 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035916 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035917#endif
35918
Daniel Veillard42595322004-11-08 10:52:06 +000035919 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035920}
35921
35922
35923static int
35924test_xmlUCSIsCatZs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035925 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035926
35927#ifdef LIBXML_UNICODE_ENABLED
35928 int mem_base;
35929 int ret_val;
35930 int code; /* UCS code point */
35931 int n_code;
35932
35933 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35934 mem_base = xmlMemBlocks();
35935 code = gen_int(n_code, 0);
35936
35937 ret_val = xmlUCSIsCatZs(code);
35938 desret_int(ret_val);
35939 call_tests++;
35940 des_int(n_code, code, 0);
35941 xmlResetLastError();
35942 if (mem_base != xmlMemBlocks()) {
35943 printf("Leak of %d blocks found in xmlUCSIsCatZs",
35944 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035945 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035946 printf(" %d", n_code);
35947 printf("\n");
35948 }
35949 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035950 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035951#endif
35952
Daniel Veillard42595322004-11-08 10:52:06 +000035953 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035954}
35955
35956
35957static int
35958test_xmlUCSIsCherokee(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035959 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035960
35961#ifdef LIBXML_UNICODE_ENABLED
35962 int mem_base;
35963 int ret_val;
35964 int code; /* UCS code point */
35965 int n_code;
35966
35967 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35968 mem_base = xmlMemBlocks();
35969 code = gen_int(n_code, 0);
35970
35971 ret_val = xmlUCSIsCherokee(code);
35972 desret_int(ret_val);
35973 call_tests++;
35974 des_int(n_code, code, 0);
35975 xmlResetLastError();
35976 if (mem_base != xmlMemBlocks()) {
35977 printf("Leak of %d blocks found in xmlUCSIsCherokee",
35978 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035979 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035980 printf(" %d", n_code);
35981 printf("\n");
35982 }
35983 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035984 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035985#endif
35986
Daniel Veillard42595322004-11-08 10:52:06 +000035987 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035988}
35989
35990
35991static int
35992test_xmlUCSIsCombiningDiacriticalMarks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035993 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035994
35995#ifdef LIBXML_UNICODE_ENABLED
35996 int mem_base;
35997 int ret_val;
35998 int code; /* UCS code point */
35999 int n_code;
36000
36001 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36002 mem_base = xmlMemBlocks();
36003 code = gen_int(n_code, 0);
36004
36005 ret_val = xmlUCSIsCombiningDiacriticalMarks(code);
36006 desret_int(ret_val);
36007 call_tests++;
36008 des_int(n_code, code, 0);
36009 xmlResetLastError();
36010 if (mem_base != xmlMemBlocks()) {
36011 printf("Leak of %d blocks found in xmlUCSIsCombiningDiacriticalMarks",
36012 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036013 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036014 printf(" %d", n_code);
36015 printf("\n");
36016 }
36017 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036018 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036019#endif
36020
Daniel Veillard42595322004-11-08 10:52:06 +000036021 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036022}
36023
36024
36025static int
36026test_xmlUCSIsCombiningDiacriticalMarksforSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036027 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036028
36029#ifdef LIBXML_UNICODE_ENABLED
36030 int mem_base;
36031 int ret_val;
36032 int code; /* UCS code point */
36033 int n_code;
36034
36035 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36036 mem_base = xmlMemBlocks();
36037 code = gen_int(n_code, 0);
36038
36039 ret_val = xmlUCSIsCombiningDiacriticalMarksforSymbols(code);
36040 desret_int(ret_val);
36041 call_tests++;
36042 des_int(n_code, code, 0);
36043 xmlResetLastError();
36044 if (mem_base != xmlMemBlocks()) {
36045 printf("Leak of %d blocks found in xmlUCSIsCombiningDiacriticalMarksforSymbols",
36046 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036047 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036048 printf(" %d", n_code);
36049 printf("\n");
36050 }
36051 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036052 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036053#endif
36054
Daniel Veillard42595322004-11-08 10:52:06 +000036055 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036056}
36057
36058
36059static int
36060test_xmlUCSIsCombiningHalfMarks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036061 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036062
36063#ifdef LIBXML_UNICODE_ENABLED
36064 int mem_base;
36065 int ret_val;
36066 int code; /* UCS code point */
36067 int n_code;
36068
36069 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36070 mem_base = xmlMemBlocks();
36071 code = gen_int(n_code, 0);
36072
36073 ret_val = xmlUCSIsCombiningHalfMarks(code);
36074 desret_int(ret_val);
36075 call_tests++;
36076 des_int(n_code, code, 0);
36077 xmlResetLastError();
36078 if (mem_base != xmlMemBlocks()) {
36079 printf("Leak of %d blocks found in xmlUCSIsCombiningHalfMarks",
36080 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036081 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036082 printf(" %d", n_code);
36083 printf("\n");
36084 }
36085 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036086 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036087#endif
36088
Daniel Veillard42595322004-11-08 10:52:06 +000036089 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036090}
36091
36092
36093static int
36094test_xmlUCSIsCombiningMarksforSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036095 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036096
36097#ifdef LIBXML_UNICODE_ENABLED
36098 int mem_base;
36099 int ret_val;
36100 int code; /* UCS code point */
36101 int n_code;
36102
36103 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36104 mem_base = xmlMemBlocks();
36105 code = gen_int(n_code, 0);
36106
36107 ret_val = xmlUCSIsCombiningMarksforSymbols(code);
36108 desret_int(ret_val);
36109 call_tests++;
36110 des_int(n_code, code, 0);
36111 xmlResetLastError();
36112 if (mem_base != xmlMemBlocks()) {
36113 printf("Leak of %d blocks found in xmlUCSIsCombiningMarksforSymbols",
36114 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036115 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036116 printf(" %d", n_code);
36117 printf("\n");
36118 }
36119 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036120 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036121#endif
36122
Daniel Veillard42595322004-11-08 10:52:06 +000036123 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036124}
36125
36126
36127static int
36128test_xmlUCSIsControlPictures(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036129 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036130
36131#ifdef LIBXML_UNICODE_ENABLED
36132 int mem_base;
36133 int ret_val;
36134 int code; /* UCS code point */
36135 int n_code;
36136
36137 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36138 mem_base = xmlMemBlocks();
36139 code = gen_int(n_code, 0);
36140
36141 ret_val = xmlUCSIsControlPictures(code);
36142 desret_int(ret_val);
36143 call_tests++;
36144 des_int(n_code, code, 0);
36145 xmlResetLastError();
36146 if (mem_base != xmlMemBlocks()) {
36147 printf("Leak of %d blocks found in xmlUCSIsControlPictures",
36148 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036149 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036150 printf(" %d", n_code);
36151 printf("\n");
36152 }
36153 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036154 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036155#endif
36156
Daniel Veillard42595322004-11-08 10:52:06 +000036157 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036158}
36159
36160
36161static int
36162test_xmlUCSIsCurrencySymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036163 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036164
36165#ifdef LIBXML_UNICODE_ENABLED
36166 int mem_base;
36167 int ret_val;
36168 int code; /* UCS code point */
36169 int n_code;
36170
36171 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36172 mem_base = xmlMemBlocks();
36173 code = gen_int(n_code, 0);
36174
36175 ret_val = xmlUCSIsCurrencySymbols(code);
36176 desret_int(ret_val);
36177 call_tests++;
36178 des_int(n_code, code, 0);
36179 xmlResetLastError();
36180 if (mem_base != xmlMemBlocks()) {
36181 printf("Leak of %d blocks found in xmlUCSIsCurrencySymbols",
36182 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036183 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036184 printf(" %d", n_code);
36185 printf("\n");
36186 }
36187 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036188 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036189#endif
36190
Daniel Veillard42595322004-11-08 10:52:06 +000036191 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036192}
36193
36194
36195static int
36196test_xmlUCSIsCypriotSyllabary(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036197 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036198
36199#ifdef LIBXML_UNICODE_ENABLED
36200 int mem_base;
36201 int ret_val;
36202 int code; /* UCS code point */
36203 int n_code;
36204
36205 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36206 mem_base = xmlMemBlocks();
36207 code = gen_int(n_code, 0);
36208
36209 ret_val = xmlUCSIsCypriotSyllabary(code);
36210 desret_int(ret_val);
36211 call_tests++;
36212 des_int(n_code, code, 0);
36213 xmlResetLastError();
36214 if (mem_base != xmlMemBlocks()) {
36215 printf("Leak of %d blocks found in xmlUCSIsCypriotSyllabary",
36216 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036217 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036218 printf(" %d", n_code);
36219 printf("\n");
36220 }
36221 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036222 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036223#endif
36224
Daniel Veillard42595322004-11-08 10:52:06 +000036225 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036226}
36227
36228
36229static int
36230test_xmlUCSIsCyrillic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036231 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036232
36233#ifdef LIBXML_UNICODE_ENABLED
36234 int mem_base;
36235 int ret_val;
36236 int code; /* UCS code point */
36237 int n_code;
36238
36239 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36240 mem_base = xmlMemBlocks();
36241 code = gen_int(n_code, 0);
36242
36243 ret_val = xmlUCSIsCyrillic(code);
36244 desret_int(ret_val);
36245 call_tests++;
36246 des_int(n_code, code, 0);
36247 xmlResetLastError();
36248 if (mem_base != xmlMemBlocks()) {
36249 printf("Leak of %d blocks found in xmlUCSIsCyrillic",
36250 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036251 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036252 printf(" %d", n_code);
36253 printf("\n");
36254 }
36255 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036256 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036257#endif
36258
Daniel Veillard42595322004-11-08 10:52:06 +000036259 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036260}
36261
36262
36263static int
36264test_xmlUCSIsCyrillicSupplement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036265 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036266
36267#ifdef LIBXML_UNICODE_ENABLED
36268 int mem_base;
36269 int ret_val;
36270 int code; /* UCS code point */
36271 int n_code;
36272
36273 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36274 mem_base = xmlMemBlocks();
36275 code = gen_int(n_code, 0);
36276
36277 ret_val = xmlUCSIsCyrillicSupplement(code);
36278 desret_int(ret_val);
36279 call_tests++;
36280 des_int(n_code, code, 0);
36281 xmlResetLastError();
36282 if (mem_base != xmlMemBlocks()) {
36283 printf("Leak of %d blocks found in xmlUCSIsCyrillicSupplement",
36284 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036285 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036286 printf(" %d", n_code);
36287 printf("\n");
36288 }
36289 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036290 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036291#endif
36292
Daniel Veillard42595322004-11-08 10:52:06 +000036293 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036294}
36295
36296
36297static int
36298test_xmlUCSIsDeseret(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036299 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036300
36301#ifdef LIBXML_UNICODE_ENABLED
36302 int mem_base;
36303 int ret_val;
36304 int code; /* UCS code point */
36305 int n_code;
36306
36307 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36308 mem_base = xmlMemBlocks();
36309 code = gen_int(n_code, 0);
36310
36311 ret_val = xmlUCSIsDeseret(code);
36312 desret_int(ret_val);
36313 call_tests++;
36314 des_int(n_code, code, 0);
36315 xmlResetLastError();
36316 if (mem_base != xmlMemBlocks()) {
36317 printf("Leak of %d blocks found in xmlUCSIsDeseret",
36318 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036319 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036320 printf(" %d", n_code);
36321 printf("\n");
36322 }
36323 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036324 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036325#endif
36326
Daniel Veillard42595322004-11-08 10:52:06 +000036327 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036328}
36329
36330
36331static int
36332test_xmlUCSIsDevanagari(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036333 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036334
36335#ifdef LIBXML_UNICODE_ENABLED
36336 int mem_base;
36337 int ret_val;
36338 int code; /* UCS code point */
36339 int n_code;
36340
36341 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36342 mem_base = xmlMemBlocks();
36343 code = gen_int(n_code, 0);
36344
36345 ret_val = xmlUCSIsDevanagari(code);
36346 desret_int(ret_val);
36347 call_tests++;
36348 des_int(n_code, code, 0);
36349 xmlResetLastError();
36350 if (mem_base != xmlMemBlocks()) {
36351 printf("Leak of %d blocks found in xmlUCSIsDevanagari",
36352 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036353 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036354 printf(" %d", n_code);
36355 printf("\n");
36356 }
36357 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036358 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036359#endif
36360
Daniel Veillard42595322004-11-08 10:52:06 +000036361 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036362}
36363
36364
36365static int
36366test_xmlUCSIsDingbats(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036367 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036368
36369#ifdef LIBXML_UNICODE_ENABLED
36370 int mem_base;
36371 int ret_val;
36372 int code; /* UCS code point */
36373 int n_code;
36374
36375 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36376 mem_base = xmlMemBlocks();
36377 code = gen_int(n_code, 0);
36378
36379 ret_val = xmlUCSIsDingbats(code);
36380 desret_int(ret_val);
36381 call_tests++;
36382 des_int(n_code, code, 0);
36383 xmlResetLastError();
36384 if (mem_base != xmlMemBlocks()) {
36385 printf("Leak of %d blocks found in xmlUCSIsDingbats",
36386 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036387 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036388 printf(" %d", n_code);
36389 printf("\n");
36390 }
36391 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036392 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036393#endif
36394
Daniel Veillard42595322004-11-08 10:52:06 +000036395 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036396}
36397
36398
36399static int
36400test_xmlUCSIsEnclosedAlphanumerics(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036401 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036402
36403#ifdef LIBXML_UNICODE_ENABLED
36404 int mem_base;
36405 int ret_val;
36406 int code; /* UCS code point */
36407 int n_code;
36408
36409 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36410 mem_base = xmlMemBlocks();
36411 code = gen_int(n_code, 0);
36412
36413 ret_val = xmlUCSIsEnclosedAlphanumerics(code);
36414 desret_int(ret_val);
36415 call_tests++;
36416 des_int(n_code, code, 0);
36417 xmlResetLastError();
36418 if (mem_base != xmlMemBlocks()) {
36419 printf("Leak of %d blocks found in xmlUCSIsEnclosedAlphanumerics",
36420 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036421 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036422 printf(" %d", n_code);
36423 printf("\n");
36424 }
36425 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036426 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036427#endif
36428
Daniel Veillard42595322004-11-08 10:52:06 +000036429 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036430}
36431
36432
36433static int
36434test_xmlUCSIsEnclosedCJKLettersandMonths(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036435 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036436
36437#ifdef LIBXML_UNICODE_ENABLED
36438 int mem_base;
36439 int ret_val;
36440 int code; /* UCS code point */
36441 int n_code;
36442
36443 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36444 mem_base = xmlMemBlocks();
36445 code = gen_int(n_code, 0);
36446
36447 ret_val = xmlUCSIsEnclosedCJKLettersandMonths(code);
36448 desret_int(ret_val);
36449 call_tests++;
36450 des_int(n_code, code, 0);
36451 xmlResetLastError();
36452 if (mem_base != xmlMemBlocks()) {
36453 printf("Leak of %d blocks found in xmlUCSIsEnclosedCJKLettersandMonths",
36454 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036455 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036456 printf(" %d", n_code);
36457 printf("\n");
36458 }
36459 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036460 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036461#endif
36462
Daniel Veillard42595322004-11-08 10:52:06 +000036463 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036464}
36465
36466
36467static int
36468test_xmlUCSIsEthiopic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036469 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036470
36471#ifdef LIBXML_UNICODE_ENABLED
36472 int mem_base;
36473 int ret_val;
36474 int code; /* UCS code point */
36475 int n_code;
36476
36477 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36478 mem_base = xmlMemBlocks();
36479 code = gen_int(n_code, 0);
36480
36481 ret_val = xmlUCSIsEthiopic(code);
36482 desret_int(ret_val);
36483 call_tests++;
36484 des_int(n_code, code, 0);
36485 xmlResetLastError();
36486 if (mem_base != xmlMemBlocks()) {
36487 printf("Leak of %d blocks found in xmlUCSIsEthiopic",
36488 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036489 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036490 printf(" %d", n_code);
36491 printf("\n");
36492 }
36493 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036494 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036495#endif
36496
Daniel Veillard42595322004-11-08 10:52:06 +000036497 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036498}
36499
36500
36501static int
36502test_xmlUCSIsGeneralPunctuation(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036503 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036504
36505#ifdef LIBXML_UNICODE_ENABLED
36506 int mem_base;
36507 int ret_val;
36508 int code; /* UCS code point */
36509 int n_code;
36510
36511 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36512 mem_base = xmlMemBlocks();
36513 code = gen_int(n_code, 0);
36514
36515 ret_val = xmlUCSIsGeneralPunctuation(code);
36516 desret_int(ret_val);
36517 call_tests++;
36518 des_int(n_code, code, 0);
36519 xmlResetLastError();
36520 if (mem_base != xmlMemBlocks()) {
36521 printf("Leak of %d blocks found in xmlUCSIsGeneralPunctuation",
36522 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036523 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036524 printf(" %d", n_code);
36525 printf("\n");
36526 }
36527 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036528 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036529#endif
36530
Daniel Veillard42595322004-11-08 10:52:06 +000036531 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036532}
36533
36534
36535static int
36536test_xmlUCSIsGeometricShapes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036537 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036538
36539#ifdef LIBXML_UNICODE_ENABLED
36540 int mem_base;
36541 int ret_val;
36542 int code; /* UCS code point */
36543 int n_code;
36544
36545 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36546 mem_base = xmlMemBlocks();
36547 code = gen_int(n_code, 0);
36548
36549 ret_val = xmlUCSIsGeometricShapes(code);
36550 desret_int(ret_val);
36551 call_tests++;
36552 des_int(n_code, code, 0);
36553 xmlResetLastError();
36554 if (mem_base != xmlMemBlocks()) {
36555 printf("Leak of %d blocks found in xmlUCSIsGeometricShapes",
36556 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036557 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036558 printf(" %d", n_code);
36559 printf("\n");
36560 }
36561 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036562 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036563#endif
36564
Daniel Veillard42595322004-11-08 10:52:06 +000036565 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036566}
36567
36568
36569static int
36570test_xmlUCSIsGeorgian(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036571 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036572
36573#ifdef LIBXML_UNICODE_ENABLED
36574 int mem_base;
36575 int ret_val;
36576 int code; /* UCS code point */
36577 int n_code;
36578
36579 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36580 mem_base = xmlMemBlocks();
36581 code = gen_int(n_code, 0);
36582
36583 ret_val = xmlUCSIsGeorgian(code);
36584 desret_int(ret_val);
36585 call_tests++;
36586 des_int(n_code, code, 0);
36587 xmlResetLastError();
36588 if (mem_base != xmlMemBlocks()) {
36589 printf("Leak of %d blocks found in xmlUCSIsGeorgian",
36590 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036591 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036592 printf(" %d", n_code);
36593 printf("\n");
36594 }
36595 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036596 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036597#endif
36598
Daniel Veillard42595322004-11-08 10:52:06 +000036599 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036600}
36601
36602
36603static int
36604test_xmlUCSIsGothic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036605 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036606
36607#ifdef LIBXML_UNICODE_ENABLED
36608 int mem_base;
36609 int ret_val;
36610 int code; /* UCS code point */
36611 int n_code;
36612
36613 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36614 mem_base = xmlMemBlocks();
36615 code = gen_int(n_code, 0);
36616
36617 ret_val = xmlUCSIsGothic(code);
36618 desret_int(ret_val);
36619 call_tests++;
36620 des_int(n_code, code, 0);
36621 xmlResetLastError();
36622 if (mem_base != xmlMemBlocks()) {
36623 printf("Leak of %d blocks found in xmlUCSIsGothic",
36624 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036625 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036626 printf(" %d", n_code);
36627 printf("\n");
36628 }
36629 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036630 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036631#endif
36632
Daniel Veillard42595322004-11-08 10:52:06 +000036633 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036634}
36635
36636
36637static int
36638test_xmlUCSIsGreek(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036639 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036640
36641#ifdef LIBXML_UNICODE_ENABLED
36642 int mem_base;
36643 int ret_val;
36644 int code; /* UCS code point */
36645 int n_code;
36646
36647 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36648 mem_base = xmlMemBlocks();
36649 code = gen_int(n_code, 0);
36650
36651 ret_val = xmlUCSIsGreek(code);
36652 desret_int(ret_val);
36653 call_tests++;
36654 des_int(n_code, code, 0);
36655 xmlResetLastError();
36656 if (mem_base != xmlMemBlocks()) {
36657 printf("Leak of %d blocks found in xmlUCSIsGreek",
36658 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036659 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036660 printf(" %d", n_code);
36661 printf("\n");
36662 }
36663 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036664 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036665#endif
36666
Daniel Veillard42595322004-11-08 10:52:06 +000036667 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036668}
36669
36670
36671static int
36672test_xmlUCSIsGreekExtended(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036673 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036674
36675#ifdef LIBXML_UNICODE_ENABLED
36676 int mem_base;
36677 int ret_val;
36678 int code; /* UCS code point */
36679 int n_code;
36680
36681 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36682 mem_base = xmlMemBlocks();
36683 code = gen_int(n_code, 0);
36684
36685 ret_val = xmlUCSIsGreekExtended(code);
36686 desret_int(ret_val);
36687 call_tests++;
36688 des_int(n_code, code, 0);
36689 xmlResetLastError();
36690 if (mem_base != xmlMemBlocks()) {
36691 printf("Leak of %d blocks found in xmlUCSIsGreekExtended",
36692 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036693 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036694 printf(" %d", n_code);
36695 printf("\n");
36696 }
36697 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036698 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036699#endif
36700
Daniel Veillard42595322004-11-08 10:52:06 +000036701 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036702}
36703
36704
36705static int
36706test_xmlUCSIsGreekandCoptic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036707 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036708
36709#ifdef LIBXML_UNICODE_ENABLED
36710 int mem_base;
36711 int ret_val;
36712 int code; /* UCS code point */
36713 int n_code;
36714
36715 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36716 mem_base = xmlMemBlocks();
36717 code = gen_int(n_code, 0);
36718
36719 ret_val = xmlUCSIsGreekandCoptic(code);
36720 desret_int(ret_val);
36721 call_tests++;
36722 des_int(n_code, code, 0);
36723 xmlResetLastError();
36724 if (mem_base != xmlMemBlocks()) {
36725 printf("Leak of %d blocks found in xmlUCSIsGreekandCoptic",
36726 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036727 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036728 printf(" %d", n_code);
36729 printf("\n");
36730 }
36731 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036732 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036733#endif
36734
Daniel Veillard42595322004-11-08 10:52:06 +000036735 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036736}
36737
36738
36739static int
36740test_xmlUCSIsGujarati(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036741 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036742
36743#ifdef LIBXML_UNICODE_ENABLED
36744 int mem_base;
36745 int ret_val;
36746 int code; /* UCS code point */
36747 int n_code;
36748
36749 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36750 mem_base = xmlMemBlocks();
36751 code = gen_int(n_code, 0);
36752
36753 ret_val = xmlUCSIsGujarati(code);
36754 desret_int(ret_val);
36755 call_tests++;
36756 des_int(n_code, code, 0);
36757 xmlResetLastError();
36758 if (mem_base != xmlMemBlocks()) {
36759 printf("Leak of %d blocks found in xmlUCSIsGujarati",
36760 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036761 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036762 printf(" %d", n_code);
36763 printf("\n");
36764 }
36765 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036766 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036767#endif
36768
Daniel Veillard42595322004-11-08 10:52:06 +000036769 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036770}
36771
36772
36773static int
36774test_xmlUCSIsGurmukhi(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036775 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036776
36777#ifdef LIBXML_UNICODE_ENABLED
36778 int mem_base;
36779 int ret_val;
36780 int code; /* UCS code point */
36781 int n_code;
36782
36783 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36784 mem_base = xmlMemBlocks();
36785 code = gen_int(n_code, 0);
36786
36787 ret_val = xmlUCSIsGurmukhi(code);
36788 desret_int(ret_val);
36789 call_tests++;
36790 des_int(n_code, code, 0);
36791 xmlResetLastError();
36792 if (mem_base != xmlMemBlocks()) {
36793 printf("Leak of %d blocks found in xmlUCSIsGurmukhi",
36794 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036795 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036796 printf(" %d", n_code);
36797 printf("\n");
36798 }
36799 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036800 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036801#endif
36802
Daniel Veillard42595322004-11-08 10:52:06 +000036803 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036804}
36805
36806
36807static int
36808test_xmlUCSIsHalfwidthandFullwidthForms(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036809 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036810
36811#ifdef LIBXML_UNICODE_ENABLED
36812 int mem_base;
36813 int ret_val;
36814 int code; /* UCS code point */
36815 int n_code;
36816
36817 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36818 mem_base = xmlMemBlocks();
36819 code = gen_int(n_code, 0);
36820
36821 ret_val = xmlUCSIsHalfwidthandFullwidthForms(code);
36822 desret_int(ret_val);
36823 call_tests++;
36824 des_int(n_code, code, 0);
36825 xmlResetLastError();
36826 if (mem_base != xmlMemBlocks()) {
36827 printf("Leak of %d blocks found in xmlUCSIsHalfwidthandFullwidthForms",
36828 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036829 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036830 printf(" %d", n_code);
36831 printf("\n");
36832 }
36833 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036834 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036835#endif
36836
Daniel Veillard42595322004-11-08 10:52:06 +000036837 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036838}
36839
36840
36841static int
36842test_xmlUCSIsHangulCompatibilityJamo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036843 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036844
36845#ifdef LIBXML_UNICODE_ENABLED
36846 int mem_base;
36847 int ret_val;
36848 int code; /* UCS code point */
36849 int n_code;
36850
36851 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36852 mem_base = xmlMemBlocks();
36853 code = gen_int(n_code, 0);
36854
36855 ret_val = xmlUCSIsHangulCompatibilityJamo(code);
36856 desret_int(ret_val);
36857 call_tests++;
36858 des_int(n_code, code, 0);
36859 xmlResetLastError();
36860 if (mem_base != xmlMemBlocks()) {
36861 printf("Leak of %d blocks found in xmlUCSIsHangulCompatibilityJamo",
36862 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036863 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036864 printf(" %d", n_code);
36865 printf("\n");
36866 }
36867 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036868 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036869#endif
36870
Daniel Veillard42595322004-11-08 10:52:06 +000036871 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036872}
36873
36874
36875static int
36876test_xmlUCSIsHangulJamo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036877 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036878
36879#ifdef LIBXML_UNICODE_ENABLED
36880 int mem_base;
36881 int ret_val;
36882 int code; /* UCS code point */
36883 int n_code;
36884
36885 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36886 mem_base = xmlMemBlocks();
36887 code = gen_int(n_code, 0);
36888
36889 ret_val = xmlUCSIsHangulJamo(code);
36890 desret_int(ret_val);
36891 call_tests++;
36892 des_int(n_code, code, 0);
36893 xmlResetLastError();
36894 if (mem_base != xmlMemBlocks()) {
36895 printf("Leak of %d blocks found in xmlUCSIsHangulJamo",
36896 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036897 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036898 printf(" %d", n_code);
36899 printf("\n");
36900 }
36901 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036902 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036903#endif
36904
Daniel Veillard42595322004-11-08 10:52:06 +000036905 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036906}
36907
36908
36909static int
36910test_xmlUCSIsHangulSyllables(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036911 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036912
36913#ifdef LIBXML_UNICODE_ENABLED
36914 int mem_base;
36915 int ret_val;
36916 int code; /* UCS code point */
36917 int n_code;
36918
36919 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36920 mem_base = xmlMemBlocks();
36921 code = gen_int(n_code, 0);
36922
36923 ret_val = xmlUCSIsHangulSyllables(code);
36924 desret_int(ret_val);
36925 call_tests++;
36926 des_int(n_code, code, 0);
36927 xmlResetLastError();
36928 if (mem_base != xmlMemBlocks()) {
36929 printf("Leak of %d blocks found in xmlUCSIsHangulSyllables",
36930 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036931 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036932 printf(" %d", n_code);
36933 printf("\n");
36934 }
36935 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036936 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036937#endif
36938
Daniel Veillard42595322004-11-08 10:52:06 +000036939 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036940}
36941
36942
36943static int
36944test_xmlUCSIsHanunoo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036945 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036946
36947#ifdef LIBXML_UNICODE_ENABLED
36948 int mem_base;
36949 int ret_val;
36950 int code; /* UCS code point */
36951 int n_code;
36952
36953 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36954 mem_base = xmlMemBlocks();
36955 code = gen_int(n_code, 0);
36956
36957 ret_val = xmlUCSIsHanunoo(code);
36958 desret_int(ret_val);
36959 call_tests++;
36960 des_int(n_code, code, 0);
36961 xmlResetLastError();
36962 if (mem_base != xmlMemBlocks()) {
36963 printf("Leak of %d blocks found in xmlUCSIsHanunoo",
36964 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036965 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036966 printf(" %d", n_code);
36967 printf("\n");
36968 }
36969 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036970 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036971#endif
36972
Daniel Veillard42595322004-11-08 10:52:06 +000036973 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036974}
36975
36976
36977static int
36978test_xmlUCSIsHebrew(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036979 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036980
36981#ifdef LIBXML_UNICODE_ENABLED
36982 int mem_base;
36983 int ret_val;
36984 int code; /* UCS code point */
36985 int n_code;
36986
36987 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36988 mem_base = xmlMemBlocks();
36989 code = gen_int(n_code, 0);
36990
36991 ret_val = xmlUCSIsHebrew(code);
36992 desret_int(ret_val);
36993 call_tests++;
36994 des_int(n_code, code, 0);
36995 xmlResetLastError();
36996 if (mem_base != xmlMemBlocks()) {
36997 printf("Leak of %d blocks found in xmlUCSIsHebrew",
36998 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036999 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037000 printf(" %d", n_code);
37001 printf("\n");
37002 }
37003 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037004 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037005#endif
37006
Daniel Veillard42595322004-11-08 10:52:06 +000037007 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037008}
37009
37010
37011static int
37012test_xmlUCSIsHighPrivateUseSurrogates(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037013 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037014
37015#ifdef LIBXML_UNICODE_ENABLED
37016 int mem_base;
37017 int ret_val;
37018 int code; /* UCS code point */
37019 int n_code;
37020
37021 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37022 mem_base = xmlMemBlocks();
37023 code = gen_int(n_code, 0);
37024
37025 ret_val = xmlUCSIsHighPrivateUseSurrogates(code);
37026 desret_int(ret_val);
37027 call_tests++;
37028 des_int(n_code, code, 0);
37029 xmlResetLastError();
37030 if (mem_base != xmlMemBlocks()) {
37031 printf("Leak of %d blocks found in xmlUCSIsHighPrivateUseSurrogates",
37032 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037033 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037034 printf(" %d", n_code);
37035 printf("\n");
37036 }
37037 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037038 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037039#endif
37040
Daniel Veillard42595322004-11-08 10:52:06 +000037041 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037042}
37043
37044
37045static int
37046test_xmlUCSIsHighSurrogates(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037047 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037048
37049#ifdef LIBXML_UNICODE_ENABLED
37050 int mem_base;
37051 int ret_val;
37052 int code; /* UCS code point */
37053 int n_code;
37054
37055 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37056 mem_base = xmlMemBlocks();
37057 code = gen_int(n_code, 0);
37058
37059 ret_val = xmlUCSIsHighSurrogates(code);
37060 desret_int(ret_val);
37061 call_tests++;
37062 des_int(n_code, code, 0);
37063 xmlResetLastError();
37064 if (mem_base != xmlMemBlocks()) {
37065 printf("Leak of %d blocks found in xmlUCSIsHighSurrogates",
37066 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037067 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037068 printf(" %d", n_code);
37069 printf("\n");
37070 }
37071 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037072 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037073#endif
37074
Daniel Veillard42595322004-11-08 10:52:06 +000037075 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037076}
37077
37078
37079static int
37080test_xmlUCSIsHiragana(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037081 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037082
37083#ifdef LIBXML_UNICODE_ENABLED
37084 int mem_base;
37085 int ret_val;
37086 int code; /* UCS code point */
37087 int n_code;
37088
37089 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37090 mem_base = xmlMemBlocks();
37091 code = gen_int(n_code, 0);
37092
37093 ret_val = xmlUCSIsHiragana(code);
37094 desret_int(ret_val);
37095 call_tests++;
37096 des_int(n_code, code, 0);
37097 xmlResetLastError();
37098 if (mem_base != xmlMemBlocks()) {
37099 printf("Leak of %d blocks found in xmlUCSIsHiragana",
37100 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037101 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037102 printf(" %d", n_code);
37103 printf("\n");
37104 }
37105 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037106 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037107#endif
37108
Daniel Veillard42595322004-11-08 10:52:06 +000037109 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037110}
37111
37112
37113static int
37114test_xmlUCSIsIPAExtensions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037115 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037116
37117#ifdef LIBXML_UNICODE_ENABLED
37118 int mem_base;
37119 int ret_val;
37120 int code; /* UCS code point */
37121 int n_code;
37122
37123 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37124 mem_base = xmlMemBlocks();
37125 code = gen_int(n_code, 0);
37126
37127 ret_val = xmlUCSIsIPAExtensions(code);
37128 desret_int(ret_val);
37129 call_tests++;
37130 des_int(n_code, code, 0);
37131 xmlResetLastError();
37132 if (mem_base != xmlMemBlocks()) {
37133 printf("Leak of %d blocks found in xmlUCSIsIPAExtensions",
37134 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037135 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037136 printf(" %d", n_code);
37137 printf("\n");
37138 }
37139 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037140 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037141#endif
37142
Daniel Veillard42595322004-11-08 10:52:06 +000037143 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037144}
37145
37146
37147static int
37148test_xmlUCSIsIdeographicDescriptionCharacters(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037149 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037150
37151#ifdef LIBXML_UNICODE_ENABLED
37152 int mem_base;
37153 int ret_val;
37154 int code; /* UCS code point */
37155 int n_code;
37156
37157 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37158 mem_base = xmlMemBlocks();
37159 code = gen_int(n_code, 0);
37160
37161 ret_val = xmlUCSIsIdeographicDescriptionCharacters(code);
37162 desret_int(ret_val);
37163 call_tests++;
37164 des_int(n_code, code, 0);
37165 xmlResetLastError();
37166 if (mem_base != xmlMemBlocks()) {
37167 printf("Leak of %d blocks found in xmlUCSIsIdeographicDescriptionCharacters",
37168 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037169 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037170 printf(" %d", n_code);
37171 printf("\n");
37172 }
37173 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037174 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037175#endif
37176
Daniel Veillard42595322004-11-08 10:52:06 +000037177 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037178}
37179
37180
37181static int
37182test_xmlUCSIsKanbun(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037183 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037184
37185#ifdef LIBXML_UNICODE_ENABLED
37186 int mem_base;
37187 int ret_val;
37188 int code; /* UCS code point */
37189 int n_code;
37190
37191 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37192 mem_base = xmlMemBlocks();
37193 code = gen_int(n_code, 0);
37194
37195 ret_val = xmlUCSIsKanbun(code);
37196 desret_int(ret_val);
37197 call_tests++;
37198 des_int(n_code, code, 0);
37199 xmlResetLastError();
37200 if (mem_base != xmlMemBlocks()) {
37201 printf("Leak of %d blocks found in xmlUCSIsKanbun",
37202 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037203 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037204 printf(" %d", n_code);
37205 printf("\n");
37206 }
37207 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037208 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037209#endif
37210
Daniel Veillard42595322004-11-08 10:52:06 +000037211 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037212}
37213
37214
37215static int
37216test_xmlUCSIsKangxiRadicals(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037217 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037218
37219#ifdef LIBXML_UNICODE_ENABLED
37220 int mem_base;
37221 int ret_val;
37222 int code; /* UCS code point */
37223 int n_code;
37224
37225 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37226 mem_base = xmlMemBlocks();
37227 code = gen_int(n_code, 0);
37228
37229 ret_val = xmlUCSIsKangxiRadicals(code);
37230 desret_int(ret_val);
37231 call_tests++;
37232 des_int(n_code, code, 0);
37233 xmlResetLastError();
37234 if (mem_base != xmlMemBlocks()) {
37235 printf("Leak of %d blocks found in xmlUCSIsKangxiRadicals",
37236 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037237 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037238 printf(" %d", n_code);
37239 printf("\n");
37240 }
37241 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037242 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037243#endif
37244
Daniel Veillard42595322004-11-08 10:52:06 +000037245 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037246}
37247
37248
37249static int
37250test_xmlUCSIsKannada(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037251 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037252
37253#ifdef LIBXML_UNICODE_ENABLED
37254 int mem_base;
37255 int ret_val;
37256 int code; /* UCS code point */
37257 int n_code;
37258
37259 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37260 mem_base = xmlMemBlocks();
37261 code = gen_int(n_code, 0);
37262
37263 ret_val = xmlUCSIsKannada(code);
37264 desret_int(ret_val);
37265 call_tests++;
37266 des_int(n_code, code, 0);
37267 xmlResetLastError();
37268 if (mem_base != xmlMemBlocks()) {
37269 printf("Leak of %d blocks found in xmlUCSIsKannada",
37270 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037271 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037272 printf(" %d", n_code);
37273 printf("\n");
37274 }
37275 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037276 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037277#endif
37278
Daniel Veillard42595322004-11-08 10:52:06 +000037279 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037280}
37281
37282
37283static int
37284test_xmlUCSIsKatakana(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037285 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037286
37287#ifdef LIBXML_UNICODE_ENABLED
37288 int mem_base;
37289 int ret_val;
37290 int code; /* UCS code point */
37291 int n_code;
37292
37293 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37294 mem_base = xmlMemBlocks();
37295 code = gen_int(n_code, 0);
37296
37297 ret_val = xmlUCSIsKatakana(code);
37298 desret_int(ret_val);
37299 call_tests++;
37300 des_int(n_code, code, 0);
37301 xmlResetLastError();
37302 if (mem_base != xmlMemBlocks()) {
37303 printf("Leak of %d blocks found in xmlUCSIsKatakana",
37304 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037305 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037306 printf(" %d", n_code);
37307 printf("\n");
37308 }
37309 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037310 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037311#endif
37312
Daniel Veillard42595322004-11-08 10:52:06 +000037313 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037314}
37315
37316
37317static int
37318test_xmlUCSIsKatakanaPhoneticExtensions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037319 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037320
37321#ifdef LIBXML_UNICODE_ENABLED
37322 int mem_base;
37323 int ret_val;
37324 int code; /* UCS code point */
37325 int n_code;
37326
37327 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37328 mem_base = xmlMemBlocks();
37329 code = gen_int(n_code, 0);
37330
37331 ret_val = xmlUCSIsKatakanaPhoneticExtensions(code);
37332 desret_int(ret_val);
37333 call_tests++;
37334 des_int(n_code, code, 0);
37335 xmlResetLastError();
37336 if (mem_base != xmlMemBlocks()) {
37337 printf("Leak of %d blocks found in xmlUCSIsKatakanaPhoneticExtensions",
37338 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037339 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037340 printf(" %d", n_code);
37341 printf("\n");
37342 }
37343 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037344 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037345#endif
37346
Daniel Veillard42595322004-11-08 10:52:06 +000037347 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037348}
37349
37350
37351static int
37352test_xmlUCSIsKhmer(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037353 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037354
37355#ifdef LIBXML_UNICODE_ENABLED
37356 int mem_base;
37357 int ret_val;
37358 int code; /* UCS code point */
37359 int n_code;
37360
37361 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37362 mem_base = xmlMemBlocks();
37363 code = gen_int(n_code, 0);
37364
37365 ret_val = xmlUCSIsKhmer(code);
37366 desret_int(ret_val);
37367 call_tests++;
37368 des_int(n_code, code, 0);
37369 xmlResetLastError();
37370 if (mem_base != xmlMemBlocks()) {
37371 printf("Leak of %d blocks found in xmlUCSIsKhmer",
37372 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037373 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037374 printf(" %d", n_code);
37375 printf("\n");
37376 }
37377 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037378 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037379#endif
37380
Daniel Veillard42595322004-11-08 10:52:06 +000037381 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037382}
37383
37384
37385static int
37386test_xmlUCSIsKhmerSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037387 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037388
37389#ifdef LIBXML_UNICODE_ENABLED
37390 int mem_base;
37391 int ret_val;
37392 int code; /* UCS code point */
37393 int n_code;
37394
37395 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37396 mem_base = xmlMemBlocks();
37397 code = gen_int(n_code, 0);
37398
37399 ret_val = xmlUCSIsKhmerSymbols(code);
37400 desret_int(ret_val);
37401 call_tests++;
37402 des_int(n_code, code, 0);
37403 xmlResetLastError();
37404 if (mem_base != xmlMemBlocks()) {
37405 printf("Leak of %d blocks found in xmlUCSIsKhmerSymbols",
37406 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037407 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037408 printf(" %d", n_code);
37409 printf("\n");
37410 }
37411 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037412 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037413#endif
37414
Daniel Veillard42595322004-11-08 10:52:06 +000037415 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037416}
37417
37418
37419static int
37420test_xmlUCSIsLao(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037421 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037422
37423#ifdef LIBXML_UNICODE_ENABLED
37424 int mem_base;
37425 int ret_val;
37426 int code; /* UCS code point */
37427 int n_code;
37428
37429 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37430 mem_base = xmlMemBlocks();
37431 code = gen_int(n_code, 0);
37432
37433 ret_val = xmlUCSIsLao(code);
37434 desret_int(ret_val);
37435 call_tests++;
37436 des_int(n_code, code, 0);
37437 xmlResetLastError();
37438 if (mem_base != xmlMemBlocks()) {
37439 printf("Leak of %d blocks found in xmlUCSIsLao",
37440 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037441 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037442 printf(" %d", n_code);
37443 printf("\n");
37444 }
37445 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037446 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037447#endif
37448
Daniel Veillard42595322004-11-08 10:52:06 +000037449 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037450}
37451
37452
37453static int
37454test_xmlUCSIsLatin1Supplement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037455 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037456
37457#ifdef LIBXML_UNICODE_ENABLED
37458 int mem_base;
37459 int ret_val;
37460 int code; /* UCS code point */
37461 int n_code;
37462
37463 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37464 mem_base = xmlMemBlocks();
37465 code = gen_int(n_code, 0);
37466
37467 ret_val = xmlUCSIsLatin1Supplement(code);
37468 desret_int(ret_val);
37469 call_tests++;
37470 des_int(n_code, code, 0);
37471 xmlResetLastError();
37472 if (mem_base != xmlMemBlocks()) {
37473 printf("Leak of %d blocks found in xmlUCSIsLatin1Supplement",
37474 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037475 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037476 printf(" %d", n_code);
37477 printf("\n");
37478 }
37479 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037480 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037481#endif
37482
Daniel Veillard42595322004-11-08 10:52:06 +000037483 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037484}
37485
37486
37487static int
37488test_xmlUCSIsLatinExtendedA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037489 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037490
37491#ifdef LIBXML_UNICODE_ENABLED
37492 int mem_base;
37493 int ret_val;
37494 int code; /* UCS code point */
37495 int n_code;
37496
37497 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37498 mem_base = xmlMemBlocks();
37499 code = gen_int(n_code, 0);
37500
37501 ret_val = xmlUCSIsLatinExtendedA(code);
37502 desret_int(ret_val);
37503 call_tests++;
37504 des_int(n_code, code, 0);
37505 xmlResetLastError();
37506 if (mem_base != xmlMemBlocks()) {
37507 printf("Leak of %d blocks found in xmlUCSIsLatinExtendedA",
37508 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037509 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037510 printf(" %d", n_code);
37511 printf("\n");
37512 }
37513 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037514 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037515#endif
37516
Daniel Veillard42595322004-11-08 10:52:06 +000037517 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037518}
37519
37520
37521static int
37522test_xmlUCSIsLatinExtendedAdditional(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037523 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037524
37525#ifdef LIBXML_UNICODE_ENABLED
37526 int mem_base;
37527 int ret_val;
37528 int code; /* UCS code point */
37529 int n_code;
37530
37531 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37532 mem_base = xmlMemBlocks();
37533 code = gen_int(n_code, 0);
37534
37535 ret_val = xmlUCSIsLatinExtendedAdditional(code);
37536 desret_int(ret_val);
37537 call_tests++;
37538 des_int(n_code, code, 0);
37539 xmlResetLastError();
37540 if (mem_base != xmlMemBlocks()) {
37541 printf("Leak of %d blocks found in xmlUCSIsLatinExtendedAdditional",
37542 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037543 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037544 printf(" %d", n_code);
37545 printf("\n");
37546 }
37547 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037548 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037549#endif
37550
Daniel Veillard42595322004-11-08 10:52:06 +000037551 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037552}
37553
37554
37555static int
37556test_xmlUCSIsLatinExtendedB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037557 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037558
37559#ifdef LIBXML_UNICODE_ENABLED
37560 int mem_base;
37561 int ret_val;
37562 int code; /* UCS code point */
37563 int n_code;
37564
37565 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37566 mem_base = xmlMemBlocks();
37567 code = gen_int(n_code, 0);
37568
37569 ret_val = xmlUCSIsLatinExtendedB(code);
37570 desret_int(ret_val);
37571 call_tests++;
37572 des_int(n_code, code, 0);
37573 xmlResetLastError();
37574 if (mem_base != xmlMemBlocks()) {
37575 printf("Leak of %d blocks found in xmlUCSIsLatinExtendedB",
37576 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037577 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037578 printf(" %d", n_code);
37579 printf("\n");
37580 }
37581 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037582 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037583#endif
37584
Daniel Veillard42595322004-11-08 10:52:06 +000037585 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037586}
37587
37588
37589static int
37590test_xmlUCSIsLetterlikeSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037591 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037592
37593#ifdef LIBXML_UNICODE_ENABLED
37594 int mem_base;
37595 int ret_val;
37596 int code; /* UCS code point */
37597 int n_code;
37598
37599 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37600 mem_base = xmlMemBlocks();
37601 code = gen_int(n_code, 0);
37602
37603 ret_val = xmlUCSIsLetterlikeSymbols(code);
37604 desret_int(ret_val);
37605 call_tests++;
37606 des_int(n_code, code, 0);
37607 xmlResetLastError();
37608 if (mem_base != xmlMemBlocks()) {
37609 printf("Leak of %d blocks found in xmlUCSIsLetterlikeSymbols",
37610 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037611 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037612 printf(" %d", n_code);
37613 printf("\n");
37614 }
37615 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037616 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037617#endif
37618
Daniel Veillard42595322004-11-08 10:52:06 +000037619 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037620}
37621
37622
37623static int
37624test_xmlUCSIsLimbu(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037625 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037626
37627#ifdef LIBXML_UNICODE_ENABLED
37628 int mem_base;
37629 int ret_val;
37630 int code; /* UCS code point */
37631 int n_code;
37632
37633 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37634 mem_base = xmlMemBlocks();
37635 code = gen_int(n_code, 0);
37636
37637 ret_val = xmlUCSIsLimbu(code);
37638 desret_int(ret_val);
37639 call_tests++;
37640 des_int(n_code, code, 0);
37641 xmlResetLastError();
37642 if (mem_base != xmlMemBlocks()) {
37643 printf("Leak of %d blocks found in xmlUCSIsLimbu",
37644 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037645 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037646 printf(" %d", n_code);
37647 printf("\n");
37648 }
37649 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037650 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037651#endif
37652
Daniel Veillard42595322004-11-08 10:52:06 +000037653 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037654}
37655
37656
37657static int
37658test_xmlUCSIsLinearBIdeograms(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037659 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037660
37661#ifdef LIBXML_UNICODE_ENABLED
37662 int mem_base;
37663 int ret_val;
37664 int code; /* UCS code point */
37665 int n_code;
37666
37667 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37668 mem_base = xmlMemBlocks();
37669 code = gen_int(n_code, 0);
37670
37671 ret_val = xmlUCSIsLinearBIdeograms(code);
37672 desret_int(ret_val);
37673 call_tests++;
37674 des_int(n_code, code, 0);
37675 xmlResetLastError();
37676 if (mem_base != xmlMemBlocks()) {
37677 printf("Leak of %d blocks found in xmlUCSIsLinearBIdeograms",
37678 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037679 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037680 printf(" %d", n_code);
37681 printf("\n");
37682 }
37683 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037684 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037685#endif
37686
Daniel Veillard42595322004-11-08 10:52:06 +000037687 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037688}
37689
37690
37691static int
37692test_xmlUCSIsLinearBSyllabary(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037693 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037694
37695#ifdef LIBXML_UNICODE_ENABLED
37696 int mem_base;
37697 int ret_val;
37698 int code; /* UCS code point */
37699 int n_code;
37700
37701 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37702 mem_base = xmlMemBlocks();
37703 code = gen_int(n_code, 0);
37704
37705 ret_val = xmlUCSIsLinearBSyllabary(code);
37706 desret_int(ret_val);
37707 call_tests++;
37708 des_int(n_code, code, 0);
37709 xmlResetLastError();
37710 if (mem_base != xmlMemBlocks()) {
37711 printf("Leak of %d blocks found in xmlUCSIsLinearBSyllabary",
37712 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037713 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037714 printf(" %d", n_code);
37715 printf("\n");
37716 }
37717 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037718 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037719#endif
37720
Daniel Veillard42595322004-11-08 10:52:06 +000037721 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037722}
37723
37724
37725static int
37726test_xmlUCSIsLowSurrogates(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037727 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037728
37729#ifdef LIBXML_UNICODE_ENABLED
37730 int mem_base;
37731 int ret_val;
37732 int code; /* UCS code point */
37733 int n_code;
37734
37735 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37736 mem_base = xmlMemBlocks();
37737 code = gen_int(n_code, 0);
37738
37739 ret_val = xmlUCSIsLowSurrogates(code);
37740 desret_int(ret_val);
37741 call_tests++;
37742 des_int(n_code, code, 0);
37743 xmlResetLastError();
37744 if (mem_base != xmlMemBlocks()) {
37745 printf("Leak of %d blocks found in xmlUCSIsLowSurrogates",
37746 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037747 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037748 printf(" %d", n_code);
37749 printf("\n");
37750 }
37751 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037752 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037753#endif
37754
Daniel Veillard42595322004-11-08 10:52:06 +000037755 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037756}
37757
37758
37759static int
37760test_xmlUCSIsMalayalam(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037761 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037762
37763#ifdef LIBXML_UNICODE_ENABLED
37764 int mem_base;
37765 int ret_val;
37766 int code; /* UCS code point */
37767 int n_code;
37768
37769 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37770 mem_base = xmlMemBlocks();
37771 code = gen_int(n_code, 0);
37772
37773 ret_val = xmlUCSIsMalayalam(code);
37774 desret_int(ret_val);
37775 call_tests++;
37776 des_int(n_code, code, 0);
37777 xmlResetLastError();
37778 if (mem_base != xmlMemBlocks()) {
37779 printf("Leak of %d blocks found in xmlUCSIsMalayalam",
37780 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037781 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037782 printf(" %d", n_code);
37783 printf("\n");
37784 }
37785 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037786 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037787#endif
37788
Daniel Veillard42595322004-11-08 10:52:06 +000037789 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037790}
37791
37792
37793static int
37794test_xmlUCSIsMathematicalAlphanumericSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037795 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037796
37797#ifdef LIBXML_UNICODE_ENABLED
37798 int mem_base;
37799 int ret_val;
37800 int code; /* UCS code point */
37801 int n_code;
37802
37803 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37804 mem_base = xmlMemBlocks();
37805 code = gen_int(n_code, 0);
37806
37807 ret_val = xmlUCSIsMathematicalAlphanumericSymbols(code);
37808 desret_int(ret_val);
37809 call_tests++;
37810 des_int(n_code, code, 0);
37811 xmlResetLastError();
37812 if (mem_base != xmlMemBlocks()) {
37813 printf("Leak of %d blocks found in xmlUCSIsMathematicalAlphanumericSymbols",
37814 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037815 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037816 printf(" %d", n_code);
37817 printf("\n");
37818 }
37819 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037820 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037821#endif
37822
Daniel Veillard42595322004-11-08 10:52:06 +000037823 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037824}
37825
37826
37827static int
37828test_xmlUCSIsMathematicalOperators(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037829 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037830
37831#ifdef LIBXML_UNICODE_ENABLED
37832 int mem_base;
37833 int ret_val;
37834 int code; /* UCS code point */
37835 int n_code;
37836
37837 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37838 mem_base = xmlMemBlocks();
37839 code = gen_int(n_code, 0);
37840
37841 ret_val = xmlUCSIsMathematicalOperators(code);
37842 desret_int(ret_val);
37843 call_tests++;
37844 des_int(n_code, code, 0);
37845 xmlResetLastError();
37846 if (mem_base != xmlMemBlocks()) {
37847 printf("Leak of %d blocks found in xmlUCSIsMathematicalOperators",
37848 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037849 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037850 printf(" %d", n_code);
37851 printf("\n");
37852 }
37853 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037854 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037855#endif
37856
Daniel Veillard42595322004-11-08 10:52:06 +000037857 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037858}
37859
37860
37861static int
37862test_xmlUCSIsMiscellaneousMathematicalSymbolsA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037863 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037864
37865#ifdef LIBXML_UNICODE_ENABLED
37866 int mem_base;
37867 int ret_val;
37868 int code; /* UCS code point */
37869 int n_code;
37870
37871 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37872 mem_base = xmlMemBlocks();
37873 code = gen_int(n_code, 0);
37874
37875 ret_val = xmlUCSIsMiscellaneousMathematicalSymbolsA(code);
37876 desret_int(ret_val);
37877 call_tests++;
37878 des_int(n_code, code, 0);
37879 xmlResetLastError();
37880 if (mem_base != xmlMemBlocks()) {
37881 printf("Leak of %d blocks found in xmlUCSIsMiscellaneousMathematicalSymbolsA",
37882 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037883 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037884 printf(" %d", n_code);
37885 printf("\n");
37886 }
37887 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037888 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037889#endif
37890
Daniel Veillard42595322004-11-08 10:52:06 +000037891 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037892}
37893
37894
37895static int
37896test_xmlUCSIsMiscellaneousMathematicalSymbolsB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037897 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037898
37899#ifdef LIBXML_UNICODE_ENABLED
37900 int mem_base;
37901 int ret_val;
37902 int code; /* UCS code point */
37903 int n_code;
37904
37905 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37906 mem_base = xmlMemBlocks();
37907 code = gen_int(n_code, 0);
37908
37909 ret_val = xmlUCSIsMiscellaneousMathematicalSymbolsB(code);
37910 desret_int(ret_val);
37911 call_tests++;
37912 des_int(n_code, code, 0);
37913 xmlResetLastError();
37914 if (mem_base != xmlMemBlocks()) {
37915 printf("Leak of %d blocks found in xmlUCSIsMiscellaneousMathematicalSymbolsB",
37916 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037917 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037918 printf(" %d", n_code);
37919 printf("\n");
37920 }
37921 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037922 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037923#endif
37924
Daniel Veillard42595322004-11-08 10:52:06 +000037925 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037926}
37927
37928
37929static int
37930test_xmlUCSIsMiscellaneousSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037931 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037932
37933#ifdef LIBXML_UNICODE_ENABLED
37934 int mem_base;
37935 int ret_val;
37936 int code; /* UCS code point */
37937 int n_code;
37938
37939 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37940 mem_base = xmlMemBlocks();
37941 code = gen_int(n_code, 0);
37942
37943 ret_val = xmlUCSIsMiscellaneousSymbols(code);
37944 desret_int(ret_val);
37945 call_tests++;
37946 des_int(n_code, code, 0);
37947 xmlResetLastError();
37948 if (mem_base != xmlMemBlocks()) {
37949 printf("Leak of %d blocks found in xmlUCSIsMiscellaneousSymbols",
37950 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037951 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037952 printf(" %d", n_code);
37953 printf("\n");
37954 }
37955 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037956 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037957#endif
37958
Daniel Veillard42595322004-11-08 10:52:06 +000037959 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037960}
37961
37962
37963static int
37964test_xmlUCSIsMiscellaneousSymbolsandArrows(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037965 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037966
37967#ifdef LIBXML_UNICODE_ENABLED
37968 int mem_base;
37969 int ret_val;
37970 int code; /* UCS code point */
37971 int n_code;
37972
37973 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37974 mem_base = xmlMemBlocks();
37975 code = gen_int(n_code, 0);
37976
37977 ret_val = xmlUCSIsMiscellaneousSymbolsandArrows(code);
37978 desret_int(ret_val);
37979 call_tests++;
37980 des_int(n_code, code, 0);
37981 xmlResetLastError();
37982 if (mem_base != xmlMemBlocks()) {
37983 printf("Leak of %d blocks found in xmlUCSIsMiscellaneousSymbolsandArrows",
37984 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037985 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037986 printf(" %d", n_code);
37987 printf("\n");
37988 }
37989 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037990 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037991#endif
37992
Daniel Veillard42595322004-11-08 10:52:06 +000037993 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037994}
37995
37996
37997static int
37998test_xmlUCSIsMiscellaneousTechnical(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037999 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038000
38001#ifdef LIBXML_UNICODE_ENABLED
38002 int mem_base;
38003 int ret_val;
38004 int code; /* UCS code point */
38005 int n_code;
38006
38007 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38008 mem_base = xmlMemBlocks();
38009 code = gen_int(n_code, 0);
38010
38011 ret_val = xmlUCSIsMiscellaneousTechnical(code);
38012 desret_int(ret_val);
38013 call_tests++;
38014 des_int(n_code, code, 0);
38015 xmlResetLastError();
38016 if (mem_base != xmlMemBlocks()) {
38017 printf("Leak of %d blocks found in xmlUCSIsMiscellaneousTechnical",
38018 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038019 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038020 printf(" %d", n_code);
38021 printf("\n");
38022 }
38023 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038024 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038025#endif
38026
Daniel Veillard42595322004-11-08 10:52:06 +000038027 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038028}
38029
38030
38031static int
38032test_xmlUCSIsMongolian(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038033 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038034
38035#ifdef LIBXML_UNICODE_ENABLED
38036 int mem_base;
38037 int ret_val;
38038 int code; /* UCS code point */
38039 int n_code;
38040
38041 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38042 mem_base = xmlMemBlocks();
38043 code = gen_int(n_code, 0);
38044
38045 ret_val = xmlUCSIsMongolian(code);
38046 desret_int(ret_val);
38047 call_tests++;
38048 des_int(n_code, code, 0);
38049 xmlResetLastError();
38050 if (mem_base != xmlMemBlocks()) {
38051 printf("Leak of %d blocks found in xmlUCSIsMongolian",
38052 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038053 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038054 printf(" %d", n_code);
38055 printf("\n");
38056 }
38057 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038058 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038059#endif
38060
Daniel Veillard42595322004-11-08 10:52:06 +000038061 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038062}
38063
38064
38065static int
38066test_xmlUCSIsMusicalSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038067 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038068
38069#ifdef LIBXML_UNICODE_ENABLED
38070 int mem_base;
38071 int ret_val;
38072 int code; /* UCS code point */
38073 int n_code;
38074
38075 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38076 mem_base = xmlMemBlocks();
38077 code = gen_int(n_code, 0);
38078
38079 ret_val = xmlUCSIsMusicalSymbols(code);
38080 desret_int(ret_val);
38081 call_tests++;
38082 des_int(n_code, code, 0);
38083 xmlResetLastError();
38084 if (mem_base != xmlMemBlocks()) {
38085 printf("Leak of %d blocks found in xmlUCSIsMusicalSymbols",
38086 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038087 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038088 printf(" %d", n_code);
38089 printf("\n");
38090 }
38091 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038092 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038093#endif
38094
Daniel Veillard42595322004-11-08 10:52:06 +000038095 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038096}
38097
38098
38099static int
38100test_xmlUCSIsMyanmar(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038101 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038102
38103#ifdef LIBXML_UNICODE_ENABLED
38104 int mem_base;
38105 int ret_val;
38106 int code; /* UCS code point */
38107 int n_code;
38108
38109 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38110 mem_base = xmlMemBlocks();
38111 code = gen_int(n_code, 0);
38112
38113 ret_val = xmlUCSIsMyanmar(code);
38114 desret_int(ret_val);
38115 call_tests++;
38116 des_int(n_code, code, 0);
38117 xmlResetLastError();
38118 if (mem_base != xmlMemBlocks()) {
38119 printf("Leak of %d blocks found in xmlUCSIsMyanmar",
38120 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038121 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038122 printf(" %d", n_code);
38123 printf("\n");
38124 }
38125 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038126 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038127#endif
38128
Daniel Veillard42595322004-11-08 10:52:06 +000038129 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038130}
38131
38132
38133static int
38134test_xmlUCSIsNumberForms(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038135 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038136
38137#ifdef LIBXML_UNICODE_ENABLED
38138 int mem_base;
38139 int ret_val;
38140 int code; /* UCS code point */
38141 int n_code;
38142
38143 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38144 mem_base = xmlMemBlocks();
38145 code = gen_int(n_code, 0);
38146
38147 ret_val = xmlUCSIsNumberForms(code);
38148 desret_int(ret_val);
38149 call_tests++;
38150 des_int(n_code, code, 0);
38151 xmlResetLastError();
38152 if (mem_base != xmlMemBlocks()) {
38153 printf("Leak of %d blocks found in xmlUCSIsNumberForms",
38154 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038155 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038156 printf(" %d", n_code);
38157 printf("\n");
38158 }
38159 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038160 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038161#endif
38162
Daniel Veillard42595322004-11-08 10:52:06 +000038163 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038164}
38165
38166
38167static int
38168test_xmlUCSIsOgham(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038169 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038170
38171#ifdef LIBXML_UNICODE_ENABLED
38172 int mem_base;
38173 int ret_val;
38174 int code; /* UCS code point */
38175 int n_code;
38176
38177 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38178 mem_base = xmlMemBlocks();
38179 code = gen_int(n_code, 0);
38180
38181 ret_val = xmlUCSIsOgham(code);
38182 desret_int(ret_val);
38183 call_tests++;
38184 des_int(n_code, code, 0);
38185 xmlResetLastError();
38186 if (mem_base != xmlMemBlocks()) {
38187 printf("Leak of %d blocks found in xmlUCSIsOgham",
38188 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038189 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038190 printf(" %d", n_code);
38191 printf("\n");
38192 }
38193 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038194 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038195#endif
38196
Daniel Veillard42595322004-11-08 10:52:06 +000038197 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038198}
38199
38200
38201static int
38202test_xmlUCSIsOldItalic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038203 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038204
38205#ifdef LIBXML_UNICODE_ENABLED
38206 int mem_base;
38207 int ret_val;
38208 int code; /* UCS code point */
38209 int n_code;
38210
38211 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38212 mem_base = xmlMemBlocks();
38213 code = gen_int(n_code, 0);
38214
38215 ret_val = xmlUCSIsOldItalic(code);
38216 desret_int(ret_val);
38217 call_tests++;
38218 des_int(n_code, code, 0);
38219 xmlResetLastError();
38220 if (mem_base != xmlMemBlocks()) {
38221 printf("Leak of %d blocks found in xmlUCSIsOldItalic",
38222 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038223 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038224 printf(" %d", n_code);
38225 printf("\n");
38226 }
38227 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038228 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038229#endif
38230
Daniel Veillard42595322004-11-08 10:52:06 +000038231 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038232}
38233
38234
38235static int
38236test_xmlUCSIsOpticalCharacterRecognition(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038237 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038238
38239#ifdef LIBXML_UNICODE_ENABLED
38240 int mem_base;
38241 int ret_val;
38242 int code; /* UCS code point */
38243 int n_code;
38244
38245 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38246 mem_base = xmlMemBlocks();
38247 code = gen_int(n_code, 0);
38248
38249 ret_val = xmlUCSIsOpticalCharacterRecognition(code);
38250 desret_int(ret_val);
38251 call_tests++;
38252 des_int(n_code, code, 0);
38253 xmlResetLastError();
38254 if (mem_base != xmlMemBlocks()) {
38255 printf("Leak of %d blocks found in xmlUCSIsOpticalCharacterRecognition",
38256 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038257 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038258 printf(" %d", n_code);
38259 printf("\n");
38260 }
38261 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038262 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038263#endif
38264
Daniel Veillard42595322004-11-08 10:52:06 +000038265 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038266}
38267
38268
38269static int
38270test_xmlUCSIsOriya(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038271 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038272
38273#ifdef LIBXML_UNICODE_ENABLED
38274 int mem_base;
38275 int ret_val;
38276 int code; /* UCS code point */
38277 int n_code;
38278
38279 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38280 mem_base = xmlMemBlocks();
38281 code = gen_int(n_code, 0);
38282
38283 ret_val = xmlUCSIsOriya(code);
38284 desret_int(ret_val);
38285 call_tests++;
38286 des_int(n_code, code, 0);
38287 xmlResetLastError();
38288 if (mem_base != xmlMemBlocks()) {
38289 printf("Leak of %d blocks found in xmlUCSIsOriya",
38290 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038291 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038292 printf(" %d", n_code);
38293 printf("\n");
38294 }
38295 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038296 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038297#endif
38298
Daniel Veillard42595322004-11-08 10:52:06 +000038299 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038300}
38301
38302
38303static int
38304test_xmlUCSIsOsmanya(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038305 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038306
38307#ifdef LIBXML_UNICODE_ENABLED
38308 int mem_base;
38309 int ret_val;
38310 int code; /* UCS code point */
38311 int n_code;
38312
38313 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38314 mem_base = xmlMemBlocks();
38315 code = gen_int(n_code, 0);
38316
38317 ret_val = xmlUCSIsOsmanya(code);
38318 desret_int(ret_val);
38319 call_tests++;
38320 des_int(n_code, code, 0);
38321 xmlResetLastError();
38322 if (mem_base != xmlMemBlocks()) {
38323 printf("Leak of %d blocks found in xmlUCSIsOsmanya",
38324 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038325 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038326 printf(" %d", n_code);
38327 printf("\n");
38328 }
38329 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038330 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038331#endif
38332
Daniel Veillard42595322004-11-08 10:52:06 +000038333 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038334}
38335
38336
38337static int
38338test_xmlUCSIsPhoneticExtensions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038339 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038340
38341#ifdef LIBXML_UNICODE_ENABLED
38342 int mem_base;
38343 int ret_val;
38344 int code; /* UCS code point */
38345 int n_code;
38346
38347 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38348 mem_base = xmlMemBlocks();
38349 code = gen_int(n_code, 0);
38350
38351 ret_val = xmlUCSIsPhoneticExtensions(code);
38352 desret_int(ret_val);
38353 call_tests++;
38354 des_int(n_code, code, 0);
38355 xmlResetLastError();
38356 if (mem_base != xmlMemBlocks()) {
38357 printf("Leak of %d blocks found in xmlUCSIsPhoneticExtensions",
38358 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038359 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038360 printf(" %d", n_code);
38361 printf("\n");
38362 }
38363 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038364 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038365#endif
38366
Daniel Veillard42595322004-11-08 10:52:06 +000038367 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038368}
38369
38370
38371static int
38372test_xmlUCSIsPrivateUse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038373 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038374
38375#ifdef LIBXML_UNICODE_ENABLED
38376 int mem_base;
38377 int ret_val;
38378 int code; /* UCS code point */
38379 int n_code;
38380
38381 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38382 mem_base = xmlMemBlocks();
38383 code = gen_int(n_code, 0);
38384
38385 ret_val = xmlUCSIsPrivateUse(code);
38386 desret_int(ret_val);
38387 call_tests++;
38388 des_int(n_code, code, 0);
38389 xmlResetLastError();
38390 if (mem_base != xmlMemBlocks()) {
38391 printf("Leak of %d blocks found in xmlUCSIsPrivateUse",
38392 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038393 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038394 printf(" %d", n_code);
38395 printf("\n");
38396 }
38397 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038398 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038399#endif
38400
Daniel Veillard42595322004-11-08 10:52:06 +000038401 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038402}
38403
38404
38405static int
38406test_xmlUCSIsPrivateUseArea(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038407 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038408
38409#ifdef LIBXML_UNICODE_ENABLED
38410 int mem_base;
38411 int ret_val;
38412 int code; /* UCS code point */
38413 int n_code;
38414
38415 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38416 mem_base = xmlMemBlocks();
38417 code = gen_int(n_code, 0);
38418
38419 ret_val = xmlUCSIsPrivateUseArea(code);
38420 desret_int(ret_val);
38421 call_tests++;
38422 des_int(n_code, code, 0);
38423 xmlResetLastError();
38424 if (mem_base != xmlMemBlocks()) {
38425 printf("Leak of %d blocks found in xmlUCSIsPrivateUseArea",
38426 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038427 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038428 printf(" %d", n_code);
38429 printf("\n");
38430 }
38431 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038432 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038433#endif
38434
Daniel Veillard42595322004-11-08 10:52:06 +000038435 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038436}
38437
38438
38439static int
38440test_xmlUCSIsRunic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038441 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038442
38443#ifdef LIBXML_UNICODE_ENABLED
38444 int mem_base;
38445 int ret_val;
38446 int code; /* UCS code point */
38447 int n_code;
38448
38449 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38450 mem_base = xmlMemBlocks();
38451 code = gen_int(n_code, 0);
38452
38453 ret_val = xmlUCSIsRunic(code);
38454 desret_int(ret_val);
38455 call_tests++;
38456 des_int(n_code, code, 0);
38457 xmlResetLastError();
38458 if (mem_base != xmlMemBlocks()) {
38459 printf("Leak of %d blocks found in xmlUCSIsRunic",
38460 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038461 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038462 printf(" %d", n_code);
38463 printf("\n");
38464 }
38465 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038466 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038467#endif
38468
Daniel Veillard42595322004-11-08 10:52:06 +000038469 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038470}
38471
38472
38473static int
38474test_xmlUCSIsShavian(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038475 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038476
38477#ifdef LIBXML_UNICODE_ENABLED
38478 int mem_base;
38479 int ret_val;
38480 int code; /* UCS code point */
38481 int n_code;
38482
38483 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38484 mem_base = xmlMemBlocks();
38485 code = gen_int(n_code, 0);
38486
38487 ret_val = xmlUCSIsShavian(code);
38488 desret_int(ret_val);
38489 call_tests++;
38490 des_int(n_code, code, 0);
38491 xmlResetLastError();
38492 if (mem_base != xmlMemBlocks()) {
38493 printf("Leak of %d blocks found in xmlUCSIsShavian",
38494 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038495 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038496 printf(" %d", n_code);
38497 printf("\n");
38498 }
38499 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038500 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038501#endif
38502
Daniel Veillard42595322004-11-08 10:52:06 +000038503 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038504}
38505
38506
38507static int
38508test_xmlUCSIsSinhala(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038509 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038510
38511#ifdef LIBXML_UNICODE_ENABLED
38512 int mem_base;
38513 int ret_val;
38514 int code; /* UCS code point */
38515 int n_code;
38516
38517 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38518 mem_base = xmlMemBlocks();
38519 code = gen_int(n_code, 0);
38520
38521 ret_val = xmlUCSIsSinhala(code);
38522 desret_int(ret_val);
38523 call_tests++;
38524 des_int(n_code, code, 0);
38525 xmlResetLastError();
38526 if (mem_base != xmlMemBlocks()) {
38527 printf("Leak of %d blocks found in xmlUCSIsSinhala",
38528 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038529 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038530 printf(" %d", n_code);
38531 printf("\n");
38532 }
38533 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038534 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038535#endif
38536
Daniel Veillard42595322004-11-08 10:52:06 +000038537 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038538}
38539
38540
38541static int
38542test_xmlUCSIsSmallFormVariants(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038543 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038544
38545#ifdef LIBXML_UNICODE_ENABLED
38546 int mem_base;
38547 int ret_val;
38548 int code; /* UCS code point */
38549 int n_code;
38550
38551 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38552 mem_base = xmlMemBlocks();
38553 code = gen_int(n_code, 0);
38554
38555 ret_val = xmlUCSIsSmallFormVariants(code);
38556 desret_int(ret_val);
38557 call_tests++;
38558 des_int(n_code, code, 0);
38559 xmlResetLastError();
38560 if (mem_base != xmlMemBlocks()) {
38561 printf("Leak of %d blocks found in xmlUCSIsSmallFormVariants",
38562 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038563 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038564 printf(" %d", n_code);
38565 printf("\n");
38566 }
38567 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038568 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038569#endif
38570
Daniel Veillard42595322004-11-08 10:52:06 +000038571 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038572}
38573
38574
38575static int
38576test_xmlUCSIsSpacingModifierLetters(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038577 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038578
38579#ifdef LIBXML_UNICODE_ENABLED
38580 int mem_base;
38581 int ret_val;
38582 int code; /* UCS code point */
38583 int n_code;
38584
38585 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38586 mem_base = xmlMemBlocks();
38587 code = gen_int(n_code, 0);
38588
38589 ret_val = xmlUCSIsSpacingModifierLetters(code);
38590 desret_int(ret_val);
38591 call_tests++;
38592 des_int(n_code, code, 0);
38593 xmlResetLastError();
38594 if (mem_base != xmlMemBlocks()) {
38595 printf("Leak of %d blocks found in xmlUCSIsSpacingModifierLetters",
38596 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038597 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038598 printf(" %d", n_code);
38599 printf("\n");
38600 }
38601 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038602 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038603#endif
38604
Daniel Veillard42595322004-11-08 10:52:06 +000038605 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038606}
38607
38608
38609static int
38610test_xmlUCSIsSpecials(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038611 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038612
38613#ifdef LIBXML_UNICODE_ENABLED
38614 int mem_base;
38615 int ret_val;
38616 int code; /* UCS code point */
38617 int n_code;
38618
38619 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38620 mem_base = xmlMemBlocks();
38621 code = gen_int(n_code, 0);
38622
38623 ret_val = xmlUCSIsSpecials(code);
38624 desret_int(ret_val);
38625 call_tests++;
38626 des_int(n_code, code, 0);
38627 xmlResetLastError();
38628 if (mem_base != xmlMemBlocks()) {
38629 printf("Leak of %d blocks found in xmlUCSIsSpecials",
38630 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038631 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038632 printf(" %d", n_code);
38633 printf("\n");
38634 }
38635 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038636 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038637#endif
38638
Daniel Veillard42595322004-11-08 10:52:06 +000038639 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038640}
38641
38642
38643static int
38644test_xmlUCSIsSuperscriptsandSubscripts(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038645 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038646
38647#ifdef LIBXML_UNICODE_ENABLED
38648 int mem_base;
38649 int ret_val;
38650 int code; /* UCS code point */
38651 int n_code;
38652
38653 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38654 mem_base = xmlMemBlocks();
38655 code = gen_int(n_code, 0);
38656
38657 ret_val = xmlUCSIsSuperscriptsandSubscripts(code);
38658 desret_int(ret_val);
38659 call_tests++;
38660 des_int(n_code, code, 0);
38661 xmlResetLastError();
38662 if (mem_base != xmlMemBlocks()) {
38663 printf("Leak of %d blocks found in xmlUCSIsSuperscriptsandSubscripts",
38664 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038665 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038666 printf(" %d", n_code);
38667 printf("\n");
38668 }
38669 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038670 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038671#endif
38672
Daniel Veillard42595322004-11-08 10:52:06 +000038673 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038674}
38675
38676
38677static int
38678test_xmlUCSIsSupplementalArrowsA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038679 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038680
38681#ifdef LIBXML_UNICODE_ENABLED
38682 int mem_base;
38683 int ret_val;
38684 int code; /* UCS code point */
38685 int n_code;
38686
38687 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38688 mem_base = xmlMemBlocks();
38689 code = gen_int(n_code, 0);
38690
38691 ret_val = xmlUCSIsSupplementalArrowsA(code);
38692 desret_int(ret_val);
38693 call_tests++;
38694 des_int(n_code, code, 0);
38695 xmlResetLastError();
38696 if (mem_base != xmlMemBlocks()) {
38697 printf("Leak of %d blocks found in xmlUCSIsSupplementalArrowsA",
38698 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038699 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038700 printf(" %d", n_code);
38701 printf("\n");
38702 }
38703 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038704 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038705#endif
38706
Daniel Veillard42595322004-11-08 10:52:06 +000038707 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038708}
38709
38710
38711static int
38712test_xmlUCSIsSupplementalArrowsB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038713 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038714
38715#ifdef LIBXML_UNICODE_ENABLED
38716 int mem_base;
38717 int ret_val;
38718 int code; /* UCS code point */
38719 int n_code;
38720
38721 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38722 mem_base = xmlMemBlocks();
38723 code = gen_int(n_code, 0);
38724
38725 ret_val = xmlUCSIsSupplementalArrowsB(code);
38726 desret_int(ret_val);
38727 call_tests++;
38728 des_int(n_code, code, 0);
38729 xmlResetLastError();
38730 if (mem_base != xmlMemBlocks()) {
38731 printf("Leak of %d blocks found in xmlUCSIsSupplementalArrowsB",
38732 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038733 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038734 printf(" %d", n_code);
38735 printf("\n");
38736 }
38737 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038738 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038739#endif
38740
Daniel Veillard42595322004-11-08 10:52:06 +000038741 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038742}
38743
38744
38745static int
38746test_xmlUCSIsSupplementalMathematicalOperators(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038747 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038748
38749#ifdef LIBXML_UNICODE_ENABLED
38750 int mem_base;
38751 int ret_val;
38752 int code; /* UCS code point */
38753 int n_code;
38754
38755 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38756 mem_base = xmlMemBlocks();
38757 code = gen_int(n_code, 0);
38758
38759 ret_val = xmlUCSIsSupplementalMathematicalOperators(code);
38760 desret_int(ret_val);
38761 call_tests++;
38762 des_int(n_code, code, 0);
38763 xmlResetLastError();
38764 if (mem_base != xmlMemBlocks()) {
38765 printf("Leak of %d blocks found in xmlUCSIsSupplementalMathematicalOperators",
38766 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038767 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038768 printf(" %d", n_code);
38769 printf("\n");
38770 }
38771 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038772 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038773#endif
38774
Daniel Veillard42595322004-11-08 10:52:06 +000038775 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038776}
38777
38778
38779static int
38780test_xmlUCSIsSupplementaryPrivateUseAreaA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038781 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038782
38783#ifdef LIBXML_UNICODE_ENABLED
38784 int mem_base;
38785 int ret_val;
38786 int code; /* UCS code point */
38787 int n_code;
38788
38789 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38790 mem_base = xmlMemBlocks();
38791 code = gen_int(n_code, 0);
38792
38793 ret_val = xmlUCSIsSupplementaryPrivateUseAreaA(code);
38794 desret_int(ret_val);
38795 call_tests++;
38796 des_int(n_code, code, 0);
38797 xmlResetLastError();
38798 if (mem_base != xmlMemBlocks()) {
38799 printf("Leak of %d blocks found in xmlUCSIsSupplementaryPrivateUseAreaA",
38800 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038801 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038802 printf(" %d", n_code);
38803 printf("\n");
38804 }
38805 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038806 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038807#endif
38808
Daniel Veillard42595322004-11-08 10:52:06 +000038809 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038810}
38811
38812
38813static int
38814test_xmlUCSIsSupplementaryPrivateUseAreaB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038815 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038816
38817#ifdef LIBXML_UNICODE_ENABLED
38818 int mem_base;
38819 int ret_val;
38820 int code; /* UCS code point */
38821 int n_code;
38822
38823 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38824 mem_base = xmlMemBlocks();
38825 code = gen_int(n_code, 0);
38826
38827 ret_val = xmlUCSIsSupplementaryPrivateUseAreaB(code);
38828 desret_int(ret_val);
38829 call_tests++;
38830 des_int(n_code, code, 0);
38831 xmlResetLastError();
38832 if (mem_base != xmlMemBlocks()) {
38833 printf("Leak of %d blocks found in xmlUCSIsSupplementaryPrivateUseAreaB",
38834 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038835 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038836 printf(" %d", n_code);
38837 printf("\n");
38838 }
38839 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038840 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038841#endif
38842
Daniel Veillard42595322004-11-08 10:52:06 +000038843 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038844}
38845
38846
38847static int
38848test_xmlUCSIsSyriac(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038849 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038850
38851#ifdef LIBXML_UNICODE_ENABLED
38852 int mem_base;
38853 int ret_val;
38854 int code; /* UCS code point */
38855 int n_code;
38856
38857 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38858 mem_base = xmlMemBlocks();
38859 code = gen_int(n_code, 0);
38860
38861 ret_val = xmlUCSIsSyriac(code);
38862 desret_int(ret_val);
38863 call_tests++;
38864 des_int(n_code, code, 0);
38865 xmlResetLastError();
38866 if (mem_base != xmlMemBlocks()) {
38867 printf("Leak of %d blocks found in xmlUCSIsSyriac",
38868 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038869 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038870 printf(" %d", n_code);
38871 printf("\n");
38872 }
38873 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038874 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038875#endif
38876
Daniel Veillard42595322004-11-08 10:52:06 +000038877 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038878}
38879
38880
38881static int
38882test_xmlUCSIsTagalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038883 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038884
38885#ifdef LIBXML_UNICODE_ENABLED
38886 int mem_base;
38887 int ret_val;
38888 int code; /* UCS code point */
38889 int n_code;
38890
38891 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38892 mem_base = xmlMemBlocks();
38893 code = gen_int(n_code, 0);
38894
38895 ret_val = xmlUCSIsTagalog(code);
38896 desret_int(ret_val);
38897 call_tests++;
38898 des_int(n_code, code, 0);
38899 xmlResetLastError();
38900 if (mem_base != xmlMemBlocks()) {
38901 printf("Leak of %d blocks found in xmlUCSIsTagalog",
38902 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038903 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038904 printf(" %d", n_code);
38905 printf("\n");
38906 }
38907 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038908 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038909#endif
38910
Daniel Veillard42595322004-11-08 10:52:06 +000038911 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038912}
38913
38914
38915static int
38916test_xmlUCSIsTagbanwa(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038917 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038918
38919#ifdef LIBXML_UNICODE_ENABLED
38920 int mem_base;
38921 int ret_val;
38922 int code; /* UCS code point */
38923 int n_code;
38924
38925 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38926 mem_base = xmlMemBlocks();
38927 code = gen_int(n_code, 0);
38928
38929 ret_val = xmlUCSIsTagbanwa(code);
38930 desret_int(ret_val);
38931 call_tests++;
38932 des_int(n_code, code, 0);
38933 xmlResetLastError();
38934 if (mem_base != xmlMemBlocks()) {
38935 printf("Leak of %d blocks found in xmlUCSIsTagbanwa",
38936 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038937 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038938 printf(" %d", n_code);
38939 printf("\n");
38940 }
38941 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038942 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038943#endif
38944
Daniel Veillard42595322004-11-08 10:52:06 +000038945 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038946}
38947
38948
38949static int
38950test_xmlUCSIsTags(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038951 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038952
38953#ifdef LIBXML_UNICODE_ENABLED
38954 int mem_base;
38955 int ret_val;
38956 int code; /* UCS code point */
38957 int n_code;
38958
38959 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38960 mem_base = xmlMemBlocks();
38961 code = gen_int(n_code, 0);
38962
38963 ret_val = xmlUCSIsTags(code);
38964 desret_int(ret_val);
38965 call_tests++;
38966 des_int(n_code, code, 0);
38967 xmlResetLastError();
38968 if (mem_base != xmlMemBlocks()) {
38969 printf("Leak of %d blocks found in xmlUCSIsTags",
38970 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038971 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038972 printf(" %d", n_code);
38973 printf("\n");
38974 }
38975 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038976 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038977#endif
38978
Daniel Veillard42595322004-11-08 10:52:06 +000038979 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038980}
38981
38982
38983static int
38984test_xmlUCSIsTaiLe(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038985 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038986
38987#ifdef LIBXML_UNICODE_ENABLED
38988 int mem_base;
38989 int ret_val;
38990 int code; /* UCS code point */
38991 int n_code;
38992
38993 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38994 mem_base = xmlMemBlocks();
38995 code = gen_int(n_code, 0);
38996
38997 ret_val = xmlUCSIsTaiLe(code);
38998 desret_int(ret_val);
38999 call_tests++;
39000 des_int(n_code, code, 0);
39001 xmlResetLastError();
39002 if (mem_base != xmlMemBlocks()) {
39003 printf("Leak of %d blocks found in xmlUCSIsTaiLe",
39004 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039005 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039006 printf(" %d", n_code);
39007 printf("\n");
39008 }
39009 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039010 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039011#endif
39012
Daniel Veillard42595322004-11-08 10:52:06 +000039013 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039014}
39015
39016
39017static int
39018test_xmlUCSIsTaiXuanJingSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039019 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039020
39021#ifdef LIBXML_UNICODE_ENABLED
39022 int mem_base;
39023 int ret_val;
39024 int code; /* UCS code point */
39025 int n_code;
39026
39027 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39028 mem_base = xmlMemBlocks();
39029 code = gen_int(n_code, 0);
39030
39031 ret_val = xmlUCSIsTaiXuanJingSymbols(code);
39032 desret_int(ret_val);
39033 call_tests++;
39034 des_int(n_code, code, 0);
39035 xmlResetLastError();
39036 if (mem_base != xmlMemBlocks()) {
39037 printf("Leak of %d blocks found in xmlUCSIsTaiXuanJingSymbols",
39038 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039039 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039040 printf(" %d", n_code);
39041 printf("\n");
39042 }
39043 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039044 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039045#endif
39046
Daniel Veillard42595322004-11-08 10:52:06 +000039047 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039048}
39049
39050
39051static int
39052test_xmlUCSIsTamil(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039053 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039054
39055#ifdef LIBXML_UNICODE_ENABLED
39056 int mem_base;
39057 int ret_val;
39058 int code; /* UCS code point */
39059 int n_code;
39060
39061 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39062 mem_base = xmlMemBlocks();
39063 code = gen_int(n_code, 0);
39064
39065 ret_val = xmlUCSIsTamil(code);
39066 desret_int(ret_val);
39067 call_tests++;
39068 des_int(n_code, code, 0);
39069 xmlResetLastError();
39070 if (mem_base != xmlMemBlocks()) {
39071 printf("Leak of %d blocks found in xmlUCSIsTamil",
39072 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039073 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039074 printf(" %d", n_code);
39075 printf("\n");
39076 }
39077 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039078 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039079#endif
39080
Daniel Veillard42595322004-11-08 10:52:06 +000039081 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039082}
39083
39084
39085static int
39086test_xmlUCSIsTelugu(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039087 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039088
39089#ifdef LIBXML_UNICODE_ENABLED
39090 int mem_base;
39091 int ret_val;
39092 int code; /* UCS code point */
39093 int n_code;
39094
39095 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39096 mem_base = xmlMemBlocks();
39097 code = gen_int(n_code, 0);
39098
39099 ret_val = xmlUCSIsTelugu(code);
39100 desret_int(ret_val);
39101 call_tests++;
39102 des_int(n_code, code, 0);
39103 xmlResetLastError();
39104 if (mem_base != xmlMemBlocks()) {
39105 printf("Leak of %d blocks found in xmlUCSIsTelugu",
39106 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039107 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039108 printf(" %d", n_code);
39109 printf("\n");
39110 }
39111 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039112 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039113#endif
39114
Daniel Veillard42595322004-11-08 10:52:06 +000039115 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039116}
39117
39118
39119static int
39120test_xmlUCSIsThaana(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039121 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039122
39123#ifdef LIBXML_UNICODE_ENABLED
39124 int mem_base;
39125 int ret_val;
39126 int code; /* UCS code point */
39127 int n_code;
39128
39129 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39130 mem_base = xmlMemBlocks();
39131 code = gen_int(n_code, 0);
39132
39133 ret_val = xmlUCSIsThaana(code);
39134 desret_int(ret_val);
39135 call_tests++;
39136 des_int(n_code, code, 0);
39137 xmlResetLastError();
39138 if (mem_base != xmlMemBlocks()) {
39139 printf("Leak of %d blocks found in xmlUCSIsThaana",
39140 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039141 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039142 printf(" %d", n_code);
39143 printf("\n");
39144 }
39145 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039146 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039147#endif
39148
Daniel Veillard42595322004-11-08 10:52:06 +000039149 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039150}
39151
39152
39153static int
39154test_xmlUCSIsThai(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039155 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039156
39157#ifdef LIBXML_UNICODE_ENABLED
39158 int mem_base;
39159 int ret_val;
39160 int code; /* UCS code point */
39161 int n_code;
39162
39163 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39164 mem_base = xmlMemBlocks();
39165 code = gen_int(n_code, 0);
39166
39167 ret_val = xmlUCSIsThai(code);
39168 desret_int(ret_val);
39169 call_tests++;
39170 des_int(n_code, code, 0);
39171 xmlResetLastError();
39172 if (mem_base != xmlMemBlocks()) {
39173 printf("Leak of %d blocks found in xmlUCSIsThai",
39174 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039175 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039176 printf(" %d", n_code);
39177 printf("\n");
39178 }
39179 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039180 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039181#endif
39182
Daniel Veillard42595322004-11-08 10:52:06 +000039183 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039184}
39185
39186
39187static int
39188test_xmlUCSIsTibetan(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039189 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039190
39191#ifdef LIBXML_UNICODE_ENABLED
39192 int mem_base;
39193 int ret_val;
39194 int code; /* UCS code point */
39195 int n_code;
39196
39197 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39198 mem_base = xmlMemBlocks();
39199 code = gen_int(n_code, 0);
39200
39201 ret_val = xmlUCSIsTibetan(code);
39202 desret_int(ret_val);
39203 call_tests++;
39204 des_int(n_code, code, 0);
39205 xmlResetLastError();
39206 if (mem_base != xmlMemBlocks()) {
39207 printf("Leak of %d blocks found in xmlUCSIsTibetan",
39208 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039209 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039210 printf(" %d", n_code);
39211 printf("\n");
39212 }
39213 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039214 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039215#endif
39216
Daniel Veillard42595322004-11-08 10:52:06 +000039217 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039218}
39219
39220
39221static int
39222test_xmlUCSIsUgaritic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039223 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039224
39225#ifdef LIBXML_UNICODE_ENABLED
39226 int mem_base;
39227 int ret_val;
39228 int code; /* UCS code point */
39229 int n_code;
39230
39231 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39232 mem_base = xmlMemBlocks();
39233 code = gen_int(n_code, 0);
39234
39235 ret_val = xmlUCSIsUgaritic(code);
39236 desret_int(ret_val);
39237 call_tests++;
39238 des_int(n_code, code, 0);
39239 xmlResetLastError();
39240 if (mem_base != xmlMemBlocks()) {
39241 printf("Leak of %d blocks found in xmlUCSIsUgaritic",
39242 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039243 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039244 printf(" %d", n_code);
39245 printf("\n");
39246 }
39247 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039248 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039249#endif
39250
Daniel Veillard42595322004-11-08 10:52:06 +000039251 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039252}
39253
39254
39255static int
39256test_xmlUCSIsUnifiedCanadianAboriginalSyllabics(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039257 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039258
39259#ifdef LIBXML_UNICODE_ENABLED
39260 int mem_base;
39261 int ret_val;
39262 int code; /* UCS code point */
39263 int n_code;
39264
39265 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39266 mem_base = xmlMemBlocks();
39267 code = gen_int(n_code, 0);
39268
39269 ret_val = xmlUCSIsUnifiedCanadianAboriginalSyllabics(code);
39270 desret_int(ret_val);
39271 call_tests++;
39272 des_int(n_code, code, 0);
39273 xmlResetLastError();
39274 if (mem_base != xmlMemBlocks()) {
39275 printf("Leak of %d blocks found in xmlUCSIsUnifiedCanadianAboriginalSyllabics",
39276 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039277 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039278 printf(" %d", n_code);
39279 printf("\n");
39280 }
39281 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039282 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039283#endif
39284
Daniel Veillard42595322004-11-08 10:52:06 +000039285 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039286}
39287
39288
39289static int
39290test_xmlUCSIsVariationSelectors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039291 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039292
39293#ifdef LIBXML_UNICODE_ENABLED
39294 int mem_base;
39295 int ret_val;
39296 int code; /* UCS code point */
39297 int n_code;
39298
39299 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39300 mem_base = xmlMemBlocks();
39301 code = gen_int(n_code, 0);
39302
39303 ret_val = xmlUCSIsVariationSelectors(code);
39304 desret_int(ret_val);
39305 call_tests++;
39306 des_int(n_code, code, 0);
39307 xmlResetLastError();
39308 if (mem_base != xmlMemBlocks()) {
39309 printf("Leak of %d blocks found in xmlUCSIsVariationSelectors",
39310 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039311 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039312 printf(" %d", n_code);
39313 printf("\n");
39314 }
39315 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039316 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039317#endif
39318
Daniel Veillard42595322004-11-08 10:52:06 +000039319 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039320}
39321
39322
39323static int
39324test_xmlUCSIsVariationSelectorsSupplement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039325 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039326
39327#ifdef LIBXML_UNICODE_ENABLED
39328 int mem_base;
39329 int ret_val;
39330 int code; /* UCS code point */
39331 int n_code;
39332
39333 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39334 mem_base = xmlMemBlocks();
39335 code = gen_int(n_code, 0);
39336
39337 ret_val = xmlUCSIsVariationSelectorsSupplement(code);
39338 desret_int(ret_val);
39339 call_tests++;
39340 des_int(n_code, code, 0);
39341 xmlResetLastError();
39342 if (mem_base != xmlMemBlocks()) {
39343 printf("Leak of %d blocks found in xmlUCSIsVariationSelectorsSupplement",
39344 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039345 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039346 printf(" %d", n_code);
39347 printf("\n");
39348 }
39349 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039350 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039351#endif
39352
Daniel Veillard42595322004-11-08 10:52:06 +000039353 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039354}
39355
39356
39357static int
39358test_xmlUCSIsYiRadicals(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039359 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039360
39361#ifdef LIBXML_UNICODE_ENABLED
39362 int mem_base;
39363 int ret_val;
39364 int code; /* UCS code point */
39365 int n_code;
39366
39367 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39368 mem_base = xmlMemBlocks();
39369 code = gen_int(n_code, 0);
39370
39371 ret_val = xmlUCSIsYiRadicals(code);
39372 desret_int(ret_val);
39373 call_tests++;
39374 des_int(n_code, code, 0);
39375 xmlResetLastError();
39376 if (mem_base != xmlMemBlocks()) {
39377 printf("Leak of %d blocks found in xmlUCSIsYiRadicals",
39378 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039379 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039380 printf(" %d", n_code);
39381 printf("\n");
39382 }
39383 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039384 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039385#endif
39386
Daniel Veillard42595322004-11-08 10:52:06 +000039387 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039388}
39389
39390
39391static int
39392test_xmlUCSIsYiSyllables(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039393 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039394
39395#ifdef LIBXML_UNICODE_ENABLED
39396 int mem_base;
39397 int ret_val;
39398 int code; /* UCS code point */
39399 int n_code;
39400
39401 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39402 mem_base = xmlMemBlocks();
39403 code = gen_int(n_code, 0);
39404
39405 ret_val = xmlUCSIsYiSyllables(code);
39406 desret_int(ret_val);
39407 call_tests++;
39408 des_int(n_code, code, 0);
39409 xmlResetLastError();
39410 if (mem_base != xmlMemBlocks()) {
39411 printf("Leak of %d blocks found in xmlUCSIsYiSyllables",
39412 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039413 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039414 printf(" %d", n_code);
39415 printf("\n");
39416 }
39417 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039418 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039419#endif
39420
Daniel Veillard42595322004-11-08 10:52:06 +000039421 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039422}
39423
39424
39425static int
39426test_xmlUCSIsYijingHexagramSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039427 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039428
39429#ifdef LIBXML_UNICODE_ENABLED
39430 int mem_base;
39431 int ret_val;
39432 int code; /* UCS code point */
39433 int n_code;
39434
39435 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39436 mem_base = xmlMemBlocks();
39437 code = gen_int(n_code, 0);
39438
39439 ret_val = xmlUCSIsYijingHexagramSymbols(code);
39440 desret_int(ret_val);
39441 call_tests++;
39442 des_int(n_code, code, 0);
39443 xmlResetLastError();
39444 if (mem_base != xmlMemBlocks()) {
39445 printf("Leak of %d blocks found in xmlUCSIsYijingHexagramSymbols",
39446 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039447 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039448 printf(" %d", n_code);
39449 printf("\n");
39450 }
39451 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039452 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039453#endif
39454
Daniel Veillard42595322004-11-08 10:52:06 +000039455 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039456}
39457
39458static int
39459test_xmlunicode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039460 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039461
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039462 if (quiet == 0) printf("Testing xmlunicode : 166 of 166 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000039463 test_ret += test_xmlUCSIsAegeanNumbers();
39464 test_ret += test_xmlUCSIsAlphabeticPresentationForms();
39465 test_ret += test_xmlUCSIsArabic();
39466 test_ret += test_xmlUCSIsArabicPresentationFormsA();
39467 test_ret += test_xmlUCSIsArabicPresentationFormsB();
39468 test_ret += test_xmlUCSIsArmenian();
39469 test_ret += test_xmlUCSIsArrows();
39470 test_ret += test_xmlUCSIsBasicLatin();
39471 test_ret += test_xmlUCSIsBengali();
39472 test_ret += test_xmlUCSIsBlock();
39473 test_ret += test_xmlUCSIsBlockElements();
39474 test_ret += test_xmlUCSIsBopomofo();
39475 test_ret += test_xmlUCSIsBopomofoExtended();
39476 test_ret += test_xmlUCSIsBoxDrawing();
39477 test_ret += test_xmlUCSIsBraillePatterns();
39478 test_ret += test_xmlUCSIsBuhid();
39479 test_ret += test_xmlUCSIsByzantineMusicalSymbols();
39480 test_ret += test_xmlUCSIsCJKCompatibility();
39481 test_ret += test_xmlUCSIsCJKCompatibilityForms();
39482 test_ret += test_xmlUCSIsCJKCompatibilityIdeographs();
39483 test_ret += test_xmlUCSIsCJKCompatibilityIdeographsSupplement();
39484 test_ret += test_xmlUCSIsCJKRadicalsSupplement();
39485 test_ret += test_xmlUCSIsCJKSymbolsandPunctuation();
39486 test_ret += test_xmlUCSIsCJKUnifiedIdeographs();
39487 test_ret += test_xmlUCSIsCJKUnifiedIdeographsExtensionA();
39488 test_ret += test_xmlUCSIsCJKUnifiedIdeographsExtensionB();
39489 test_ret += test_xmlUCSIsCat();
39490 test_ret += test_xmlUCSIsCatC();
39491 test_ret += test_xmlUCSIsCatCc();
39492 test_ret += test_xmlUCSIsCatCf();
39493 test_ret += test_xmlUCSIsCatCo();
39494 test_ret += test_xmlUCSIsCatCs();
39495 test_ret += test_xmlUCSIsCatL();
39496 test_ret += test_xmlUCSIsCatLl();
39497 test_ret += test_xmlUCSIsCatLm();
39498 test_ret += test_xmlUCSIsCatLo();
39499 test_ret += test_xmlUCSIsCatLt();
39500 test_ret += test_xmlUCSIsCatLu();
39501 test_ret += test_xmlUCSIsCatM();
39502 test_ret += test_xmlUCSIsCatMc();
39503 test_ret += test_xmlUCSIsCatMe();
39504 test_ret += test_xmlUCSIsCatMn();
39505 test_ret += test_xmlUCSIsCatN();
39506 test_ret += test_xmlUCSIsCatNd();
39507 test_ret += test_xmlUCSIsCatNl();
39508 test_ret += test_xmlUCSIsCatNo();
39509 test_ret += test_xmlUCSIsCatP();
39510 test_ret += test_xmlUCSIsCatPc();
39511 test_ret += test_xmlUCSIsCatPd();
39512 test_ret += test_xmlUCSIsCatPe();
39513 test_ret += test_xmlUCSIsCatPf();
39514 test_ret += test_xmlUCSIsCatPi();
39515 test_ret += test_xmlUCSIsCatPo();
39516 test_ret += test_xmlUCSIsCatPs();
39517 test_ret += test_xmlUCSIsCatS();
39518 test_ret += test_xmlUCSIsCatSc();
39519 test_ret += test_xmlUCSIsCatSk();
39520 test_ret += test_xmlUCSIsCatSm();
39521 test_ret += test_xmlUCSIsCatSo();
39522 test_ret += test_xmlUCSIsCatZ();
39523 test_ret += test_xmlUCSIsCatZl();
39524 test_ret += test_xmlUCSIsCatZp();
39525 test_ret += test_xmlUCSIsCatZs();
39526 test_ret += test_xmlUCSIsCherokee();
39527 test_ret += test_xmlUCSIsCombiningDiacriticalMarks();
39528 test_ret += test_xmlUCSIsCombiningDiacriticalMarksforSymbols();
39529 test_ret += test_xmlUCSIsCombiningHalfMarks();
39530 test_ret += test_xmlUCSIsCombiningMarksforSymbols();
39531 test_ret += test_xmlUCSIsControlPictures();
39532 test_ret += test_xmlUCSIsCurrencySymbols();
39533 test_ret += test_xmlUCSIsCypriotSyllabary();
39534 test_ret += test_xmlUCSIsCyrillic();
39535 test_ret += test_xmlUCSIsCyrillicSupplement();
39536 test_ret += test_xmlUCSIsDeseret();
39537 test_ret += test_xmlUCSIsDevanagari();
39538 test_ret += test_xmlUCSIsDingbats();
39539 test_ret += test_xmlUCSIsEnclosedAlphanumerics();
39540 test_ret += test_xmlUCSIsEnclosedCJKLettersandMonths();
39541 test_ret += test_xmlUCSIsEthiopic();
39542 test_ret += test_xmlUCSIsGeneralPunctuation();
39543 test_ret += test_xmlUCSIsGeometricShapes();
39544 test_ret += test_xmlUCSIsGeorgian();
39545 test_ret += test_xmlUCSIsGothic();
39546 test_ret += test_xmlUCSIsGreek();
39547 test_ret += test_xmlUCSIsGreekExtended();
39548 test_ret += test_xmlUCSIsGreekandCoptic();
39549 test_ret += test_xmlUCSIsGujarati();
39550 test_ret += test_xmlUCSIsGurmukhi();
39551 test_ret += test_xmlUCSIsHalfwidthandFullwidthForms();
39552 test_ret += test_xmlUCSIsHangulCompatibilityJamo();
39553 test_ret += test_xmlUCSIsHangulJamo();
39554 test_ret += test_xmlUCSIsHangulSyllables();
39555 test_ret += test_xmlUCSIsHanunoo();
39556 test_ret += test_xmlUCSIsHebrew();
39557 test_ret += test_xmlUCSIsHighPrivateUseSurrogates();
39558 test_ret += test_xmlUCSIsHighSurrogates();
39559 test_ret += test_xmlUCSIsHiragana();
39560 test_ret += test_xmlUCSIsIPAExtensions();
39561 test_ret += test_xmlUCSIsIdeographicDescriptionCharacters();
39562 test_ret += test_xmlUCSIsKanbun();
39563 test_ret += test_xmlUCSIsKangxiRadicals();
39564 test_ret += test_xmlUCSIsKannada();
39565 test_ret += test_xmlUCSIsKatakana();
39566 test_ret += test_xmlUCSIsKatakanaPhoneticExtensions();
39567 test_ret += test_xmlUCSIsKhmer();
39568 test_ret += test_xmlUCSIsKhmerSymbols();
39569 test_ret += test_xmlUCSIsLao();
39570 test_ret += test_xmlUCSIsLatin1Supplement();
39571 test_ret += test_xmlUCSIsLatinExtendedA();
39572 test_ret += test_xmlUCSIsLatinExtendedAdditional();
39573 test_ret += test_xmlUCSIsLatinExtendedB();
39574 test_ret += test_xmlUCSIsLetterlikeSymbols();
39575 test_ret += test_xmlUCSIsLimbu();
39576 test_ret += test_xmlUCSIsLinearBIdeograms();
39577 test_ret += test_xmlUCSIsLinearBSyllabary();
39578 test_ret += test_xmlUCSIsLowSurrogates();
39579 test_ret += test_xmlUCSIsMalayalam();
39580 test_ret += test_xmlUCSIsMathematicalAlphanumericSymbols();
39581 test_ret += test_xmlUCSIsMathematicalOperators();
39582 test_ret += test_xmlUCSIsMiscellaneousMathematicalSymbolsA();
39583 test_ret += test_xmlUCSIsMiscellaneousMathematicalSymbolsB();
39584 test_ret += test_xmlUCSIsMiscellaneousSymbols();
39585 test_ret += test_xmlUCSIsMiscellaneousSymbolsandArrows();
39586 test_ret += test_xmlUCSIsMiscellaneousTechnical();
39587 test_ret += test_xmlUCSIsMongolian();
39588 test_ret += test_xmlUCSIsMusicalSymbols();
39589 test_ret += test_xmlUCSIsMyanmar();
39590 test_ret += test_xmlUCSIsNumberForms();
39591 test_ret += test_xmlUCSIsOgham();
39592 test_ret += test_xmlUCSIsOldItalic();
39593 test_ret += test_xmlUCSIsOpticalCharacterRecognition();
39594 test_ret += test_xmlUCSIsOriya();
39595 test_ret += test_xmlUCSIsOsmanya();
39596 test_ret += test_xmlUCSIsPhoneticExtensions();
39597 test_ret += test_xmlUCSIsPrivateUse();
39598 test_ret += test_xmlUCSIsPrivateUseArea();
39599 test_ret += test_xmlUCSIsRunic();
39600 test_ret += test_xmlUCSIsShavian();
39601 test_ret += test_xmlUCSIsSinhala();
39602 test_ret += test_xmlUCSIsSmallFormVariants();
39603 test_ret += test_xmlUCSIsSpacingModifierLetters();
39604 test_ret += test_xmlUCSIsSpecials();
39605 test_ret += test_xmlUCSIsSuperscriptsandSubscripts();
39606 test_ret += test_xmlUCSIsSupplementalArrowsA();
39607 test_ret += test_xmlUCSIsSupplementalArrowsB();
39608 test_ret += test_xmlUCSIsSupplementalMathematicalOperators();
39609 test_ret += test_xmlUCSIsSupplementaryPrivateUseAreaA();
39610 test_ret += test_xmlUCSIsSupplementaryPrivateUseAreaB();
39611 test_ret += test_xmlUCSIsSyriac();
39612 test_ret += test_xmlUCSIsTagalog();
39613 test_ret += test_xmlUCSIsTagbanwa();
39614 test_ret += test_xmlUCSIsTags();
39615 test_ret += test_xmlUCSIsTaiLe();
39616 test_ret += test_xmlUCSIsTaiXuanJingSymbols();
39617 test_ret += test_xmlUCSIsTamil();
39618 test_ret += test_xmlUCSIsTelugu();
39619 test_ret += test_xmlUCSIsThaana();
39620 test_ret += test_xmlUCSIsThai();
39621 test_ret += test_xmlUCSIsTibetan();
39622 test_ret += test_xmlUCSIsUgaritic();
39623 test_ret += test_xmlUCSIsUnifiedCanadianAboriginalSyllabics();
39624 test_ret += test_xmlUCSIsVariationSelectors();
39625 test_ret += test_xmlUCSIsVariationSelectorsSupplement();
39626 test_ret += test_xmlUCSIsYiRadicals();
39627 test_ret += test_xmlUCSIsYiSyllables();
39628 test_ret += test_xmlUCSIsYijingHexagramSymbols();
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039629
Daniel Veillard42595322004-11-08 10:52:06 +000039630 if (test_ret != 0)
39631 printf("Module xmlunicode: %d errors\n", test_ret);
39632 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039633}
39634
39635static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000039636test_xmlNewTextWriter(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039637 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039638
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039639#ifdef LIBXML_WRITER_ENABLED
39640 int mem_base;
39641 xmlTextWriterPtr ret_val;
39642 xmlOutputBufferPtr out; /* an xmlOutputBufferPtr */
39643 int n_out;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039644
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039645 for (n_out = 0;n_out < gen_nb_xmlOutputBufferPtr;n_out++) {
39646 mem_base = xmlMemBlocks();
39647 out = gen_xmlOutputBufferPtr(n_out, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000039648
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039649 ret_val = xmlNewTextWriter(out);
39650 if (ret_val != NULL) out = NULL;
39651 desret_xmlTextWriterPtr(ret_val);
39652 call_tests++;
39653 des_xmlOutputBufferPtr(n_out, out, 0);
39654 xmlResetLastError();
39655 if (mem_base != xmlMemBlocks()) {
39656 printf("Leak of %d blocks found in xmlNewTextWriter",
39657 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039658 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039659 printf(" %d", n_out);
39660 printf("\n");
39661 }
39662 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039663 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039664#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000039665
Daniel Veillard42595322004-11-08 10:52:06 +000039666 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000039667}
39668
39669
39670static int
39671test_xmlNewTextWriterFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039672 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039673
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039674#ifdef LIBXML_WRITER_ENABLED
39675 int mem_base;
39676 xmlTextWriterPtr ret_val;
39677 const char * uri; /* the URI of the resource for the output */
39678 int n_uri;
39679 int compression; /* compress the output? */
39680 int n_compression;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039681
Daniel Veillard42595322004-11-08 10:52:06 +000039682 for (n_uri = 0;n_uri < gen_nb_fileoutput;n_uri++) {
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039683 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
39684 mem_base = xmlMemBlocks();
Daniel Veillard42595322004-11-08 10:52:06 +000039685 uri = gen_fileoutput(n_uri, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039686 compression = gen_int(n_compression, 1);
39687
39688 ret_val = xmlNewTextWriterFilename(uri, compression);
39689 desret_xmlTextWriterPtr(ret_val);
39690 call_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000039691 des_fileoutput(n_uri, uri, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039692 des_int(n_compression, compression, 1);
39693 xmlResetLastError();
39694 if (mem_base != xmlMemBlocks()) {
39695 printf("Leak of %d blocks found in xmlNewTextWriterFilename",
39696 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039697 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039698 printf(" %d", n_uri);
39699 printf(" %d", n_compression);
39700 printf("\n");
39701 }
39702 }
39703 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039704 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039705#endif
39706
Daniel Veillard42595322004-11-08 10:52:06 +000039707 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000039708}
39709
39710
39711static int
39712test_xmlNewTextWriterMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039713 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039714
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039715#ifdef LIBXML_WRITER_ENABLED
39716 int mem_base;
39717 xmlTextWriterPtr ret_val;
39718 xmlBufferPtr buf; /* xmlBufferPtr */
39719 int n_buf;
39720 int compression; /* compress the output? */
39721 int n_compression;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039722
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039723 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
39724 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
39725 mem_base = xmlMemBlocks();
39726 buf = gen_xmlBufferPtr(n_buf, 0);
39727 compression = gen_int(n_compression, 1);
39728
39729 ret_val = xmlNewTextWriterMemory(buf, compression);
39730 desret_xmlTextWriterPtr(ret_val);
39731 call_tests++;
39732 des_xmlBufferPtr(n_buf, buf, 0);
39733 des_int(n_compression, compression, 1);
39734 xmlResetLastError();
39735 if (mem_base != xmlMemBlocks()) {
39736 printf("Leak of %d blocks found in xmlNewTextWriterMemory",
39737 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039738 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039739 printf(" %d", n_buf);
39740 printf(" %d", n_compression);
39741 printf("\n");
39742 }
39743 }
39744 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039745 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039746#endif
39747
Daniel Veillard42595322004-11-08 10:52:06 +000039748 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000039749}
39750
39751
39752static int
39753test_xmlNewTextWriterPushParser(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039754 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039755
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039756#ifdef LIBXML_WRITER_ENABLED
39757 int mem_base;
39758 xmlTextWriterPtr ret_val;
39759 xmlParserCtxtPtr ctxt; /* xmlParserCtxtPtr to hold the new XML document tree */
39760 int n_ctxt;
39761 int compression; /* compress the output? */
39762 int n_compression;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039763
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039764 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
39765 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
39766 mem_base = xmlMemBlocks();
39767 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
39768 compression = gen_int(n_compression, 1);
39769
39770 ret_val = xmlNewTextWriterPushParser(ctxt, compression);
Daniel Veillarda521d282004-11-09 14:59:59 +000039771 if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;} if (ret_val != NULL) ctxt = NULL;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039772 desret_xmlTextWriterPtr(ret_val);
39773 call_tests++;
39774 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
39775 des_int(n_compression, compression, 1);
39776 xmlResetLastError();
39777 if (mem_base != xmlMemBlocks()) {
39778 printf("Leak of %d blocks found in xmlNewTextWriterPushParser",
39779 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039780 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039781 printf(" %d", n_ctxt);
39782 printf(" %d", n_compression);
39783 printf("\n");
39784 }
39785 }
39786 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039787 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039788#endif
39789
Daniel Veillard42595322004-11-08 10:52:06 +000039790 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000039791}
39792
39793
39794static int
39795test_xmlNewTextWriterTree(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039796 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039797
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039798#ifdef LIBXML_WRITER_ENABLED
39799 int mem_base;
39800 xmlTextWriterPtr ret_val;
39801 xmlDocPtr doc; /* xmlDocPtr */
39802 int n_doc;
39803 xmlNodePtr node; /* xmlNodePtr or NULL for doc->children */
39804 int n_node;
39805 int compression; /* compress the output? */
39806 int n_compression;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039807
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039808 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
39809 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
39810 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
39811 mem_base = xmlMemBlocks();
39812 doc = gen_xmlDocPtr(n_doc, 0);
39813 node = gen_xmlNodePtr(n_node, 1);
39814 compression = gen_int(n_compression, 2);
39815
39816 ret_val = xmlNewTextWriterTree(doc, node, compression);
39817 desret_xmlTextWriterPtr(ret_val);
39818 call_tests++;
39819 des_xmlDocPtr(n_doc, doc, 0);
39820 des_xmlNodePtr(n_node, node, 1);
39821 des_int(n_compression, compression, 2);
39822 xmlResetLastError();
39823 if (mem_base != xmlMemBlocks()) {
39824 printf("Leak of %d blocks found in xmlNewTextWriterTree",
39825 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039826 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039827 printf(" %d", n_doc);
39828 printf(" %d", n_node);
39829 printf(" %d", n_compression);
39830 printf("\n");
39831 }
39832 }
39833 }
39834 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039835 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039836#endif
39837
Daniel Veillard42595322004-11-08 10:52:06 +000039838 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000039839}
39840
39841
39842static int
39843test_xmlTextWriterEndAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039844 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039845
Daniel Veillarde43cc572004-11-03 11:50:29 +000039846#ifdef LIBXML_WRITER_ENABLED
39847 int mem_base;
39848 int ret_val;
39849 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
39850 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039851
Daniel Veillarde43cc572004-11-03 11:50:29 +000039852 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
39853 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000039854 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000039855
39856 ret_val = xmlTextWriterEndAttribute(writer);
39857 desret_int(ret_val);
39858 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000039859 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000039860 xmlResetLastError();
39861 if (mem_base != xmlMemBlocks()) {
39862 printf("Leak of %d blocks found in xmlTextWriterEndAttribute",
39863 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039864 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000039865 printf(" %d", n_writer);
39866 printf("\n");
39867 }
39868 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039869 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000039870#endif
39871
Daniel Veillard42595322004-11-08 10:52:06 +000039872 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000039873}
39874
39875
39876static int
39877test_xmlTextWriterEndCDATA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039878 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039879
Daniel Veillarde43cc572004-11-03 11:50:29 +000039880#ifdef LIBXML_WRITER_ENABLED
39881 int mem_base;
39882 int ret_val;
39883 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
39884 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039885
Daniel Veillarde43cc572004-11-03 11:50:29 +000039886 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
39887 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000039888 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000039889
39890 ret_val = xmlTextWriterEndCDATA(writer);
39891 desret_int(ret_val);
39892 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000039893 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000039894 xmlResetLastError();
39895 if (mem_base != xmlMemBlocks()) {
39896 printf("Leak of %d blocks found in xmlTextWriterEndCDATA",
39897 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039898 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000039899 printf(" %d", n_writer);
39900 printf("\n");
39901 }
39902 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039903 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000039904#endif
39905
Daniel Veillard42595322004-11-08 10:52:06 +000039906 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000039907}
39908
39909
39910static int
39911test_xmlTextWriterEndComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039912 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039913
Daniel Veillarde43cc572004-11-03 11:50:29 +000039914#ifdef LIBXML_WRITER_ENABLED
39915 int mem_base;
39916 int ret_val;
39917 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
39918 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039919
Daniel Veillarde43cc572004-11-03 11:50:29 +000039920 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
39921 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000039922 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000039923
39924 ret_val = xmlTextWriterEndComment(writer);
39925 desret_int(ret_val);
39926 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000039927 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000039928 xmlResetLastError();
39929 if (mem_base != xmlMemBlocks()) {
39930 printf("Leak of %d blocks found in xmlTextWriterEndComment",
39931 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039932 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000039933 printf(" %d", n_writer);
39934 printf("\n");
39935 }
39936 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039937 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000039938#endif
39939
Daniel Veillard42595322004-11-08 10:52:06 +000039940 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000039941}
39942
39943
39944static int
39945test_xmlTextWriterEndDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039946 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039947
Daniel Veillarde43cc572004-11-03 11:50:29 +000039948#ifdef LIBXML_WRITER_ENABLED
39949 int mem_base;
39950 int ret_val;
39951 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
39952 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039953
Daniel Veillarde43cc572004-11-03 11:50:29 +000039954 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
39955 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000039956 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000039957
39958 ret_val = xmlTextWriterEndDTD(writer);
39959 desret_int(ret_val);
39960 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000039961 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000039962 xmlResetLastError();
39963 if (mem_base != xmlMemBlocks()) {
39964 printf("Leak of %d blocks found in xmlTextWriterEndDTD",
39965 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039966 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000039967 printf(" %d", n_writer);
39968 printf("\n");
39969 }
39970 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039971 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000039972#endif
39973
Daniel Veillard42595322004-11-08 10:52:06 +000039974 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000039975}
39976
39977
39978static int
39979test_xmlTextWriterEndDTDAttlist(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039980 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039981
Daniel Veillarde43cc572004-11-03 11:50:29 +000039982#ifdef LIBXML_WRITER_ENABLED
39983 int mem_base;
39984 int ret_val;
39985 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
39986 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039987
Daniel Veillarde43cc572004-11-03 11:50:29 +000039988 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
39989 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000039990 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000039991
39992 ret_val = xmlTextWriterEndDTDAttlist(writer);
39993 desret_int(ret_val);
39994 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000039995 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000039996 xmlResetLastError();
39997 if (mem_base != xmlMemBlocks()) {
39998 printf("Leak of %d blocks found in xmlTextWriterEndDTDAttlist",
39999 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040000 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040001 printf(" %d", n_writer);
40002 printf("\n");
40003 }
40004 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040005 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040006#endif
40007
Daniel Veillard42595322004-11-08 10:52:06 +000040008 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040009}
40010
40011
40012static int
40013test_xmlTextWriterEndDTDElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040014 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040015
Daniel Veillarde43cc572004-11-03 11:50:29 +000040016#ifdef LIBXML_WRITER_ENABLED
40017 int mem_base;
40018 int ret_val;
40019 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40020 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040021
Daniel Veillarde43cc572004-11-03 11:50:29 +000040022 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40023 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040024 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040025
40026 ret_val = xmlTextWriterEndDTDElement(writer);
40027 desret_int(ret_val);
40028 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040029 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040030 xmlResetLastError();
40031 if (mem_base != xmlMemBlocks()) {
40032 printf("Leak of %d blocks found in xmlTextWriterEndDTDElement",
40033 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040034 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040035 printf(" %d", n_writer);
40036 printf("\n");
40037 }
40038 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040039 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040040#endif
40041
Daniel Veillard42595322004-11-08 10:52:06 +000040042 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040043}
40044
40045
40046static int
40047test_xmlTextWriterEndDTDEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040048 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040049
Daniel Veillarde43cc572004-11-03 11:50:29 +000040050#ifdef LIBXML_WRITER_ENABLED
40051 int mem_base;
40052 int ret_val;
40053 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40054 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040055
Daniel Veillarde43cc572004-11-03 11:50:29 +000040056 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40057 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040058 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040059
40060 ret_val = xmlTextWriterEndDTDEntity(writer);
40061 desret_int(ret_val);
40062 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040063 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040064 xmlResetLastError();
40065 if (mem_base != xmlMemBlocks()) {
40066 printf("Leak of %d blocks found in xmlTextWriterEndDTDEntity",
40067 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040068 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040069 printf(" %d", n_writer);
40070 printf("\n");
40071 }
40072 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040073 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040074#endif
40075
Daniel Veillard42595322004-11-08 10:52:06 +000040076 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040077}
40078
40079
40080static int
40081test_xmlTextWriterEndDocument(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040082 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040083
Daniel Veillarde43cc572004-11-03 11:50:29 +000040084#ifdef LIBXML_WRITER_ENABLED
40085 int mem_base;
40086 int ret_val;
40087 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40088 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040089
Daniel Veillarde43cc572004-11-03 11:50:29 +000040090 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40091 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040092 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040093
40094 ret_val = xmlTextWriterEndDocument(writer);
40095 desret_int(ret_val);
40096 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040097 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040098 xmlResetLastError();
40099 if (mem_base != xmlMemBlocks()) {
40100 printf("Leak of %d blocks found in xmlTextWriterEndDocument",
40101 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040102 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040103 printf(" %d", n_writer);
40104 printf("\n");
40105 }
40106 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040107 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040108#endif
40109
Daniel Veillard42595322004-11-08 10:52:06 +000040110 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040111}
40112
40113
40114static int
40115test_xmlTextWriterEndElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040116 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040117
Daniel Veillarde43cc572004-11-03 11:50:29 +000040118#ifdef LIBXML_WRITER_ENABLED
40119 int mem_base;
40120 int ret_val;
40121 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40122 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040123
Daniel Veillarde43cc572004-11-03 11:50:29 +000040124 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40125 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040126 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040127
40128 ret_val = xmlTextWriterEndElement(writer);
40129 desret_int(ret_val);
40130 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040131 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040132 xmlResetLastError();
40133 if (mem_base != xmlMemBlocks()) {
40134 printf("Leak of %d blocks found in xmlTextWriterEndElement",
40135 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040136 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040137 printf(" %d", n_writer);
40138 printf("\n");
40139 }
40140 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040141 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040142#endif
40143
Daniel Veillard42595322004-11-08 10:52:06 +000040144 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040145}
40146
40147
40148static int
40149test_xmlTextWriterEndPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040150 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040151
Daniel Veillarde43cc572004-11-03 11:50:29 +000040152#ifdef LIBXML_WRITER_ENABLED
40153 int mem_base;
40154 int ret_val;
40155 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40156 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040157
Daniel Veillarde43cc572004-11-03 11:50:29 +000040158 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40159 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040160 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040161
40162 ret_val = xmlTextWriterEndPI(writer);
40163 desret_int(ret_val);
40164 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040165 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040166 xmlResetLastError();
40167 if (mem_base != xmlMemBlocks()) {
40168 printf("Leak of %d blocks found in xmlTextWriterEndPI",
40169 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040170 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040171 printf(" %d", n_writer);
40172 printf("\n");
40173 }
40174 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040175 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040176#endif
40177
Daniel Veillard42595322004-11-08 10:52:06 +000040178 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040179}
40180
40181
40182static int
40183test_xmlTextWriterFlush(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040184 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040185
Daniel Veillarde43cc572004-11-03 11:50:29 +000040186#ifdef LIBXML_WRITER_ENABLED
40187 int mem_base;
40188 int ret_val;
40189 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40190 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040191
Daniel Veillarde43cc572004-11-03 11:50:29 +000040192 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40193 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040194 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040195
40196 ret_val = xmlTextWriterFlush(writer);
40197 desret_int(ret_val);
40198 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040199 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040200 xmlResetLastError();
40201 if (mem_base != xmlMemBlocks()) {
40202 printf("Leak of %d blocks found in xmlTextWriterFlush",
40203 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040204 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040205 printf(" %d", n_writer);
40206 printf("\n");
40207 }
40208 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040209 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040210#endif
40211
Daniel Veillard42595322004-11-08 10:52:06 +000040212 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040213}
40214
40215
40216static int
40217test_xmlTextWriterFullEndElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040218 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040219
Daniel Veillarde43cc572004-11-03 11:50:29 +000040220#ifdef LIBXML_WRITER_ENABLED
40221 int mem_base;
40222 int ret_val;
40223 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40224 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040225
Daniel Veillarde43cc572004-11-03 11:50:29 +000040226 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40227 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040228 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040229
40230 ret_val = xmlTextWriterFullEndElement(writer);
40231 desret_int(ret_val);
40232 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040233 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040234 xmlResetLastError();
40235 if (mem_base != xmlMemBlocks()) {
40236 printf("Leak of %d blocks found in xmlTextWriterFullEndElement",
40237 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040238 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040239 printf(" %d", n_writer);
40240 printf("\n");
40241 }
40242 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040243 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040244#endif
40245
Daniel Veillard42595322004-11-08 10:52:06 +000040246 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040247}
40248
40249
40250static int
40251test_xmlTextWriterSetIndent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040252 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040253
Daniel Veillarde43cc572004-11-03 11:50:29 +000040254#ifdef LIBXML_WRITER_ENABLED
40255 int mem_base;
40256 int ret_val;
40257 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40258 int n_writer;
40259 int indent; /* do indentation? */
40260 int n_indent;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040261
Daniel Veillarde43cc572004-11-03 11:50:29 +000040262 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40263 for (n_indent = 0;n_indent < gen_nb_int;n_indent++) {
40264 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040265 writer = gen_xmlTextWriterPtr(n_writer, 0);
40266 indent = gen_int(n_indent, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040267
40268 ret_val = xmlTextWriterSetIndent(writer, indent);
40269 desret_int(ret_val);
40270 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040271 des_xmlTextWriterPtr(n_writer, writer, 0);
40272 des_int(n_indent, indent, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040273 xmlResetLastError();
40274 if (mem_base != xmlMemBlocks()) {
40275 printf("Leak of %d blocks found in xmlTextWriterSetIndent",
40276 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040277 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040278 printf(" %d", n_writer);
40279 printf(" %d", n_indent);
40280 printf("\n");
40281 }
40282 }
40283 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040284 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040285#endif
40286
Daniel Veillard42595322004-11-08 10:52:06 +000040287 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040288}
40289
40290
40291static int
40292test_xmlTextWriterSetIndentString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040293 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040294
Daniel Veillarde43cc572004-11-03 11:50:29 +000040295#ifdef LIBXML_WRITER_ENABLED
40296 int mem_base;
40297 int ret_val;
40298 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40299 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040300 xmlChar * str; /* the xmlChar string */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040301 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040302
Daniel Veillarde43cc572004-11-03 11:50:29 +000040303 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40304 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
40305 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040306 writer = gen_xmlTextWriterPtr(n_writer, 0);
40307 str = gen_const_xmlChar_ptr(n_str, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040308
William M. Brackf13f77f2004-11-12 16:03:48 +000040309 ret_val = xmlTextWriterSetIndentString(writer, (const xmlChar *)str);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040310 desret_int(ret_val);
40311 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040312 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000040313 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040314 xmlResetLastError();
40315 if (mem_base != xmlMemBlocks()) {
40316 printf("Leak of %d blocks found in xmlTextWriterSetIndentString",
40317 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040318 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040319 printf(" %d", n_writer);
40320 printf(" %d", n_str);
40321 printf("\n");
40322 }
40323 }
40324 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040325 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040326#endif
40327
Daniel Veillard42595322004-11-08 10:52:06 +000040328 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040329}
40330
40331
40332static int
40333test_xmlTextWriterStartAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040334 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040335
Daniel Veillarde43cc572004-11-03 11:50:29 +000040336#ifdef LIBXML_WRITER_ENABLED
40337 int mem_base;
40338 int ret_val;
40339 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40340 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040341 xmlChar * name; /* element name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040342 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040343
Daniel Veillarde43cc572004-11-03 11:50:29 +000040344 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40345 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
40346 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040347 writer = gen_xmlTextWriterPtr(n_writer, 0);
40348 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040349
William M. Brackf13f77f2004-11-12 16:03:48 +000040350 ret_val = xmlTextWriterStartAttribute(writer, (const xmlChar *)name);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040351 desret_int(ret_val);
40352 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040353 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000040354 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040355 xmlResetLastError();
40356 if (mem_base != xmlMemBlocks()) {
40357 printf("Leak of %d blocks found in xmlTextWriterStartAttribute",
40358 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040359 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040360 printf(" %d", n_writer);
40361 printf(" %d", n_name);
40362 printf("\n");
40363 }
40364 }
40365 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040366 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040367#endif
40368
Daniel Veillard42595322004-11-08 10:52:06 +000040369 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040370}
40371
40372
40373static int
40374test_xmlTextWriterStartAttributeNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040375 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040376
Daniel Veillarde43cc572004-11-03 11:50:29 +000040377#ifdef LIBXML_WRITER_ENABLED
40378 int mem_base;
40379 int ret_val;
40380 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40381 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040382 xmlChar * prefix; /* namespace prefix or NULL */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040383 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040384 xmlChar * name; /* element local name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040385 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040386 xmlChar * namespaceURI; /* namespace URI or NULL */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040387 int n_namespaceURI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040388
Daniel Veillarde43cc572004-11-03 11:50:29 +000040389 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40390 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
40391 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
40392 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
40393 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040394 writer = gen_xmlTextWriterPtr(n_writer, 0);
40395 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
40396 name = gen_const_xmlChar_ptr(n_name, 2);
40397 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040398
William M. Brackf13f77f2004-11-12 16:03:48 +000040399 ret_val = xmlTextWriterStartAttributeNS(writer, (const xmlChar *)prefix, (const xmlChar *)name, (const xmlChar *)namespaceURI);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040400 desret_int(ret_val);
40401 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040402 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000040403 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
40404 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
40405 des_const_xmlChar_ptr(n_namespaceURI, (const xmlChar *)namespaceURI, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040406 xmlResetLastError();
40407 if (mem_base != xmlMemBlocks()) {
40408 printf("Leak of %d blocks found in xmlTextWriterStartAttributeNS",
40409 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040410 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040411 printf(" %d", n_writer);
40412 printf(" %d", n_prefix);
40413 printf(" %d", n_name);
40414 printf(" %d", n_namespaceURI);
40415 printf("\n");
40416 }
40417 }
40418 }
40419 }
40420 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040421 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040422#endif
40423
Daniel Veillard42595322004-11-08 10:52:06 +000040424 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040425}
40426
40427
40428static int
40429test_xmlTextWriterStartCDATA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040430 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040431
Daniel Veillarde43cc572004-11-03 11:50:29 +000040432#ifdef LIBXML_WRITER_ENABLED
40433 int mem_base;
40434 int ret_val;
40435 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40436 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040437
Daniel Veillarde43cc572004-11-03 11:50:29 +000040438 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40439 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040440 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040441
40442 ret_val = xmlTextWriterStartCDATA(writer);
40443 desret_int(ret_val);
40444 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040445 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040446 xmlResetLastError();
40447 if (mem_base != xmlMemBlocks()) {
40448 printf("Leak of %d blocks found in xmlTextWriterStartCDATA",
40449 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040450 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040451 printf(" %d", n_writer);
40452 printf("\n");
40453 }
40454 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040455 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040456#endif
40457
Daniel Veillard42595322004-11-08 10:52:06 +000040458 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040459}
40460
40461
40462static int
40463test_xmlTextWriterStartComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040464 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040465
Daniel Veillarde43cc572004-11-03 11:50:29 +000040466#ifdef LIBXML_WRITER_ENABLED
40467 int mem_base;
40468 int ret_val;
40469 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40470 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040471
Daniel Veillarde43cc572004-11-03 11:50:29 +000040472 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40473 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040474 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040475
40476 ret_val = xmlTextWriterStartComment(writer);
40477 desret_int(ret_val);
40478 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040479 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040480 xmlResetLastError();
40481 if (mem_base != xmlMemBlocks()) {
40482 printf("Leak of %d blocks found in xmlTextWriterStartComment",
40483 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040484 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040485 printf(" %d", n_writer);
40486 printf("\n");
40487 }
40488 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040489 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040490#endif
40491
Daniel Veillard42595322004-11-08 10:52:06 +000040492 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040493}
40494
40495
40496static int
40497test_xmlTextWriterStartDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040498 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040499
Daniel Veillarde43cc572004-11-03 11:50:29 +000040500#ifdef LIBXML_WRITER_ENABLED
40501 int mem_base;
40502 int ret_val;
40503 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40504 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040505 xmlChar * name; /* the name of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040506 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040507 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040508 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040509 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040510 int n_sysid;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040511
Daniel Veillarde43cc572004-11-03 11:50:29 +000040512 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40513 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
40514 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
40515 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
40516 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040517 writer = gen_xmlTextWriterPtr(n_writer, 0);
40518 name = gen_const_xmlChar_ptr(n_name, 1);
40519 pubid = gen_const_xmlChar_ptr(n_pubid, 2);
40520 sysid = gen_const_xmlChar_ptr(n_sysid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040521
William M. Brackf13f77f2004-11-12 16:03:48 +000040522 ret_val = xmlTextWriterStartDTD(writer, (const xmlChar *)name, (const xmlChar *)pubid, (const xmlChar *)sysid);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040523 desret_int(ret_val);
40524 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040525 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000040526 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
40527 des_const_xmlChar_ptr(n_pubid, (const xmlChar *)pubid, 2);
40528 des_const_xmlChar_ptr(n_sysid, (const xmlChar *)sysid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040529 xmlResetLastError();
40530 if (mem_base != xmlMemBlocks()) {
40531 printf("Leak of %d blocks found in xmlTextWriterStartDTD",
40532 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040533 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040534 printf(" %d", n_writer);
40535 printf(" %d", n_name);
40536 printf(" %d", n_pubid);
40537 printf(" %d", n_sysid);
40538 printf("\n");
40539 }
40540 }
40541 }
40542 }
40543 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040544 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040545#endif
40546
Daniel Veillard42595322004-11-08 10:52:06 +000040547 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040548}
40549
40550
40551static int
40552test_xmlTextWriterStartDTDAttlist(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040553 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040554
Daniel Veillarde43cc572004-11-03 11:50:29 +000040555#ifdef LIBXML_WRITER_ENABLED
40556 int mem_base;
40557 int ret_val;
40558 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40559 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040560 xmlChar * name; /* the name of the DTD ATTLIST */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040561 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040562
Daniel Veillarde43cc572004-11-03 11:50:29 +000040563 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40564 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
40565 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040566 writer = gen_xmlTextWriterPtr(n_writer, 0);
40567 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040568
William M. Brackf13f77f2004-11-12 16:03:48 +000040569 ret_val = xmlTextWriterStartDTDAttlist(writer, (const xmlChar *)name);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040570 desret_int(ret_val);
40571 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040572 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000040573 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040574 xmlResetLastError();
40575 if (mem_base != xmlMemBlocks()) {
40576 printf("Leak of %d blocks found in xmlTextWriterStartDTDAttlist",
40577 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040578 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040579 printf(" %d", n_writer);
40580 printf(" %d", n_name);
40581 printf("\n");
40582 }
40583 }
40584 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040585 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040586#endif
40587
Daniel Veillard42595322004-11-08 10:52:06 +000040588 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040589}
40590
40591
40592static int
40593test_xmlTextWriterStartDTDElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040594 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040595
Daniel Veillarde43cc572004-11-03 11:50:29 +000040596#ifdef LIBXML_WRITER_ENABLED
40597 int mem_base;
40598 int ret_val;
40599 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40600 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040601 xmlChar * name; /* the name of the DTD element */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040602 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040603
Daniel Veillarde43cc572004-11-03 11:50:29 +000040604 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40605 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
40606 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040607 writer = gen_xmlTextWriterPtr(n_writer, 0);
40608 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040609
William M. Brackf13f77f2004-11-12 16:03:48 +000040610 ret_val = xmlTextWriterStartDTDElement(writer, (const xmlChar *)name);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040611 desret_int(ret_val);
40612 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040613 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000040614 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040615 xmlResetLastError();
40616 if (mem_base != xmlMemBlocks()) {
40617 printf("Leak of %d blocks found in xmlTextWriterStartDTDElement",
40618 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040619 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040620 printf(" %d", n_writer);
40621 printf(" %d", n_name);
40622 printf("\n");
40623 }
40624 }
40625 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040626 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040627#endif
40628
Daniel Veillard42595322004-11-08 10:52:06 +000040629 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040630}
40631
40632
40633static int
40634test_xmlTextWriterStartDTDEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040635 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040636
Daniel Veillarde43cc572004-11-03 11:50:29 +000040637#ifdef LIBXML_WRITER_ENABLED
40638 int mem_base;
40639 int ret_val;
40640 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40641 int n_writer;
40642 int pe; /* TRUE if this is a parameter entity, FALSE if not */
40643 int n_pe;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040644 xmlChar * name; /* the name of the DTD ATTLIST */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040645 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040646
Daniel Veillarde43cc572004-11-03 11:50:29 +000040647 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40648 for (n_pe = 0;n_pe < gen_nb_int;n_pe++) {
40649 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
40650 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040651 writer = gen_xmlTextWriterPtr(n_writer, 0);
40652 pe = gen_int(n_pe, 1);
40653 name = gen_const_xmlChar_ptr(n_name, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040654
William M. Brackf13f77f2004-11-12 16:03:48 +000040655 ret_val = xmlTextWriterStartDTDEntity(writer, pe, (const xmlChar *)name);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040656 desret_int(ret_val);
40657 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040658 des_xmlTextWriterPtr(n_writer, writer, 0);
40659 des_int(n_pe, pe, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000040660 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040661 xmlResetLastError();
40662 if (mem_base != xmlMemBlocks()) {
40663 printf("Leak of %d blocks found in xmlTextWriterStartDTDEntity",
40664 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040665 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040666 printf(" %d", n_writer);
40667 printf(" %d", n_pe);
40668 printf(" %d", n_name);
40669 printf("\n");
40670 }
40671 }
40672 }
40673 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040674 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040675#endif
40676
Daniel Veillard42595322004-11-08 10:52:06 +000040677 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040678}
40679
40680
40681static int
40682test_xmlTextWriterStartDocument(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040683 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040684
Daniel Veillarde43cc572004-11-03 11:50:29 +000040685#ifdef LIBXML_WRITER_ENABLED
40686 int mem_base;
40687 int ret_val;
40688 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40689 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040690 char * version; /* the xml version ("1.0") or NULL for default ("1.0") */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040691 int n_version;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040692 char * encoding; /* the encoding or NULL for default */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040693 int n_encoding;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040694 char * standalone; /* "yes" or "no" or NULL for default */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040695 int n_standalone;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040696
Daniel Veillarde43cc572004-11-03 11:50:29 +000040697 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40698 for (n_version = 0;n_version < gen_nb_const_char_ptr;n_version++) {
40699 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
40700 for (n_standalone = 0;n_standalone < gen_nb_const_char_ptr;n_standalone++) {
40701 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040702 writer = gen_xmlTextWriterPtr(n_writer, 0);
40703 version = gen_const_char_ptr(n_version, 1);
40704 encoding = gen_const_char_ptr(n_encoding, 2);
40705 standalone = gen_const_char_ptr(n_standalone, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040706
William M. Brackf13f77f2004-11-12 16:03:48 +000040707 ret_val = xmlTextWriterStartDocument(writer, (const char *)version, (const char *)encoding, (const char *)standalone);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040708 desret_int(ret_val);
40709 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040710 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000040711 des_const_char_ptr(n_version, (const char *)version, 1);
40712 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
40713 des_const_char_ptr(n_standalone, (const char *)standalone, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040714 xmlResetLastError();
40715 if (mem_base != xmlMemBlocks()) {
40716 printf("Leak of %d blocks found in xmlTextWriterStartDocument",
40717 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040718 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040719 printf(" %d", n_writer);
40720 printf(" %d", n_version);
40721 printf(" %d", n_encoding);
40722 printf(" %d", n_standalone);
40723 printf("\n");
40724 }
40725 }
40726 }
40727 }
40728 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040729 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040730#endif
40731
Daniel Veillard42595322004-11-08 10:52:06 +000040732 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040733}
40734
40735
40736static int
40737test_xmlTextWriterStartElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040738 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040739
Daniel Veillarde43cc572004-11-03 11:50:29 +000040740#ifdef LIBXML_WRITER_ENABLED
40741 int mem_base;
40742 int ret_val;
40743 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40744 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040745 xmlChar * name; /* element name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040746 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040747
Daniel Veillarde43cc572004-11-03 11:50:29 +000040748 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40749 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
40750 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040751 writer = gen_xmlTextWriterPtr(n_writer, 0);
40752 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040753
William M. Brackf13f77f2004-11-12 16:03:48 +000040754 ret_val = xmlTextWriterStartElement(writer, (const xmlChar *)name);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040755 desret_int(ret_val);
40756 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040757 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000040758 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040759 xmlResetLastError();
40760 if (mem_base != xmlMemBlocks()) {
40761 printf("Leak of %d blocks found in xmlTextWriterStartElement",
40762 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040763 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040764 printf(" %d", n_writer);
40765 printf(" %d", n_name);
40766 printf("\n");
40767 }
40768 }
40769 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040770 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040771#endif
40772
Daniel Veillard42595322004-11-08 10:52:06 +000040773 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040774}
40775
40776
40777static int
40778test_xmlTextWriterStartElementNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040779 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040780
Daniel Veillarde43cc572004-11-03 11:50:29 +000040781#ifdef LIBXML_WRITER_ENABLED
40782 int mem_base;
40783 int ret_val;
40784 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40785 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040786 xmlChar * prefix; /* namespace prefix or NULL */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040787 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040788 xmlChar * name; /* element local name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040789 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040790 xmlChar * namespaceURI; /* namespace URI or NULL */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040791 int n_namespaceURI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040792
Daniel Veillarde43cc572004-11-03 11:50:29 +000040793 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40794 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
40795 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
40796 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
40797 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040798 writer = gen_xmlTextWriterPtr(n_writer, 0);
40799 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
40800 name = gen_const_xmlChar_ptr(n_name, 2);
40801 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040802
William M. Brackf13f77f2004-11-12 16:03:48 +000040803 ret_val = xmlTextWriterStartElementNS(writer, (const xmlChar *)prefix, (const xmlChar *)name, (const xmlChar *)namespaceURI);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040804 desret_int(ret_val);
40805 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040806 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000040807 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
40808 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
40809 des_const_xmlChar_ptr(n_namespaceURI, (const xmlChar *)namespaceURI, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040810 xmlResetLastError();
40811 if (mem_base != xmlMemBlocks()) {
40812 printf("Leak of %d blocks found in xmlTextWriterStartElementNS",
40813 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040814 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040815 printf(" %d", n_writer);
40816 printf(" %d", n_prefix);
40817 printf(" %d", n_name);
40818 printf(" %d", n_namespaceURI);
40819 printf("\n");
40820 }
40821 }
40822 }
40823 }
40824 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040825 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040826#endif
40827
Daniel Veillard42595322004-11-08 10:52:06 +000040828 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040829}
40830
40831
40832static int
40833test_xmlTextWriterStartPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040834 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040835
Daniel Veillarde43cc572004-11-03 11:50:29 +000040836#ifdef LIBXML_WRITER_ENABLED
40837 int mem_base;
40838 int ret_val;
40839 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40840 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040841 xmlChar * target; /* PI target */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040842 int n_target;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040843
Daniel Veillarde43cc572004-11-03 11:50:29 +000040844 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40845 for (n_target = 0;n_target < gen_nb_const_xmlChar_ptr;n_target++) {
40846 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040847 writer = gen_xmlTextWriterPtr(n_writer, 0);
40848 target = gen_const_xmlChar_ptr(n_target, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040849
William M. Brackf13f77f2004-11-12 16:03:48 +000040850 ret_val = xmlTextWriterStartPI(writer, (const xmlChar *)target);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040851 desret_int(ret_val);
40852 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040853 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000040854 des_const_xmlChar_ptr(n_target, (const xmlChar *)target, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040855 xmlResetLastError();
40856 if (mem_base != xmlMemBlocks()) {
40857 printf("Leak of %d blocks found in xmlTextWriterStartPI",
40858 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040859 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040860 printf(" %d", n_writer);
40861 printf(" %d", n_target);
40862 printf("\n");
40863 }
40864 }
40865 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040866 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040867#endif
40868
Daniel Veillard42595322004-11-08 10:52:06 +000040869 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040870}
40871
40872
40873static int
40874test_xmlTextWriterWriteAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040875 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040876
Daniel Veillarde43cc572004-11-03 11:50:29 +000040877#ifdef LIBXML_WRITER_ENABLED
40878 int mem_base;
40879 int ret_val;
40880 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40881 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040882 xmlChar * name; /* attribute name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040883 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040884 xmlChar * content; /* attribute content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040885 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040886
Daniel Veillarde43cc572004-11-03 11:50:29 +000040887 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40888 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
40889 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
40890 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040891 writer = gen_xmlTextWriterPtr(n_writer, 0);
40892 name = gen_const_xmlChar_ptr(n_name, 1);
40893 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040894
William M. Brackf13f77f2004-11-12 16:03:48 +000040895 ret_val = xmlTextWriterWriteAttribute(writer, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040896 desret_int(ret_val);
40897 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040898 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000040899 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
40900 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040901 xmlResetLastError();
40902 if (mem_base != xmlMemBlocks()) {
40903 printf("Leak of %d blocks found in xmlTextWriterWriteAttribute",
40904 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040905 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040906 printf(" %d", n_writer);
40907 printf(" %d", n_name);
40908 printf(" %d", n_content);
40909 printf("\n");
40910 }
40911 }
40912 }
40913 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040914 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040915#endif
40916
Daniel Veillard42595322004-11-08 10:52:06 +000040917 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040918}
40919
40920
40921static int
40922test_xmlTextWriterWriteAttributeNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040923 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040924
Daniel Veillarde43cc572004-11-03 11:50:29 +000040925#ifdef LIBXML_WRITER_ENABLED
40926 int mem_base;
40927 int ret_val;
40928 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40929 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040930 xmlChar * prefix; /* namespace prefix */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040931 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040932 xmlChar * name; /* attribute local name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040933 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040934 xmlChar * namespaceURI; /* namespace URI */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040935 int n_namespaceURI;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040936 xmlChar * content; /* attribute content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040937 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040938
Daniel Veillarde43cc572004-11-03 11:50:29 +000040939 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40940 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
40941 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
40942 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
40943 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
40944 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040945 writer = gen_xmlTextWriterPtr(n_writer, 0);
40946 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
40947 name = gen_const_xmlChar_ptr(n_name, 2);
40948 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 3);
40949 content = gen_const_xmlChar_ptr(n_content, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040950
William M. Brackf13f77f2004-11-12 16:03:48 +000040951 ret_val = xmlTextWriterWriteAttributeNS(writer, (const xmlChar *)prefix, (const xmlChar *)name, (const xmlChar *)namespaceURI, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040952 desret_int(ret_val);
40953 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040954 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000040955 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
40956 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
40957 des_const_xmlChar_ptr(n_namespaceURI, (const xmlChar *)namespaceURI, 3);
40958 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040959 xmlResetLastError();
40960 if (mem_base != xmlMemBlocks()) {
40961 printf("Leak of %d blocks found in xmlTextWriterWriteAttributeNS",
40962 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040963 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040964 printf(" %d", n_writer);
40965 printf(" %d", n_prefix);
40966 printf(" %d", n_name);
40967 printf(" %d", n_namespaceURI);
40968 printf(" %d", n_content);
40969 printf("\n");
40970 }
40971 }
40972 }
40973 }
40974 }
40975 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040976 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040977#endif
40978
Daniel Veillard42595322004-11-08 10:52:06 +000040979 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040980}
40981
40982
40983static int
40984test_xmlTextWriterWriteBase64(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040985 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040986
Daniel Veillarde43cc572004-11-03 11:50:29 +000040987#ifdef LIBXML_WRITER_ENABLED
40988 int mem_base;
40989 int ret_val;
40990 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40991 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040992 char * data; /* binary data */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040993 int n_data;
40994 int start; /* the position within the data of the first byte to encode */
40995 int n_start;
40996 int len; /* the number of bytes to encode */
40997 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040998
Daniel Veillarde43cc572004-11-03 11:50:29 +000040999 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41000 for (n_data = 0;n_data < gen_nb_const_char_ptr;n_data++) {
41001 for (n_start = 0;n_start < gen_nb_int;n_start++) {
41002 for (n_len = 0;n_len < gen_nb_int;n_len++) {
41003 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041004 writer = gen_xmlTextWriterPtr(n_writer, 0);
41005 data = gen_const_char_ptr(n_data, 1);
41006 start = gen_int(n_start, 2);
41007 len = gen_int(n_len, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041008
William M. Brackf13f77f2004-11-12 16:03:48 +000041009 ret_val = xmlTextWriterWriteBase64(writer, (const char *)data, start, len);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041010 desret_int(ret_val);
41011 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041012 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041013 des_const_char_ptr(n_data, (const char *)data, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000041014 des_int(n_start, start, 2);
41015 des_int(n_len, len, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041016 xmlResetLastError();
41017 if (mem_base != xmlMemBlocks()) {
41018 printf("Leak of %d blocks found in xmlTextWriterWriteBase64",
41019 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041020 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041021 printf(" %d", n_writer);
41022 printf(" %d", n_data);
41023 printf(" %d", n_start);
41024 printf(" %d", n_len);
41025 printf("\n");
41026 }
41027 }
41028 }
41029 }
41030 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041031 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041032#endif
41033
Daniel Veillard42595322004-11-08 10:52:06 +000041034 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041035}
41036
41037
41038static int
41039test_xmlTextWriterWriteBinHex(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041040 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041041
Daniel Veillarde43cc572004-11-03 11:50:29 +000041042#ifdef LIBXML_WRITER_ENABLED
41043 int mem_base;
41044 int ret_val;
41045 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41046 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041047 char * data; /* binary data */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041048 int n_data;
41049 int start; /* the position within the data of the first byte to encode */
41050 int n_start;
41051 int len; /* the number of bytes to encode */
41052 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041053
Daniel Veillarde43cc572004-11-03 11:50:29 +000041054 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41055 for (n_data = 0;n_data < gen_nb_const_char_ptr;n_data++) {
41056 for (n_start = 0;n_start < gen_nb_int;n_start++) {
41057 for (n_len = 0;n_len < gen_nb_int;n_len++) {
41058 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041059 writer = gen_xmlTextWriterPtr(n_writer, 0);
41060 data = gen_const_char_ptr(n_data, 1);
41061 start = gen_int(n_start, 2);
41062 len = gen_int(n_len, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041063
William M. Brackf13f77f2004-11-12 16:03:48 +000041064 ret_val = xmlTextWriterWriteBinHex(writer, (const char *)data, start, len);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041065 desret_int(ret_val);
41066 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041067 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041068 des_const_char_ptr(n_data, (const char *)data, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000041069 des_int(n_start, start, 2);
41070 des_int(n_len, len, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041071 xmlResetLastError();
41072 if (mem_base != xmlMemBlocks()) {
41073 printf("Leak of %d blocks found in xmlTextWriterWriteBinHex",
41074 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041075 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041076 printf(" %d", n_writer);
41077 printf(" %d", n_data);
41078 printf(" %d", n_start);
41079 printf(" %d", n_len);
41080 printf("\n");
41081 }
41082 }
41083 }
41084 }
41085 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041086 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041087#endif
41088
Daniel Veillard42595322004-11-08 10:52:06 +000041089 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041090}
41091
41092
41093static int
41094test_xmlTextWriterWriteCDATA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041095 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041096
Daniel Veillarde43cc572004-11-03 11:50:29 +000041097#ifdef LIBXML_WRITER_ENABLED
41098 int mem_base;
41099 int ret_val;
41100 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41101 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041102 xmlChar * content; /* CDATA content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041103 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041104
Daniel Veillarde43cc572004-11-03 11:50:29 +000041105 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41106 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41107 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041108 writer = gen_xmlTextWriterPtr(n_writer, 0);
41109 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041110
William M. Brackf13f77f2004-11-12 16:03:48 +000041111 ret_val = xmlTextWriterWriteCDATA(writer, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041112 desret_int(ret_val);
41113 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041114 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041115 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041116 xmlResetLastError();
41117 if (mem_base != xmlMemBlocks()) {
41118 printf("Leak of %d blocks found in xmlTextWriterWriteCDATA",
41119 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041120 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041121 printf(" %d", n_writer);
41122 printf(" %d", n_content);
41123 printf("\n");
41124 }
41125 }
41126 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041127 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041128#endif
41129
Daniel Veillard42595322004-11-08 10:52:06 +000041130 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041131}
41132
41133
41134static int
41135test_xmlTextWriterWriteComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041136 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041137
Daniel Veillarde43cc572004-11-03 11:50:29 +000041138#ifdef LIBXML_WRITER_ENABLED
41139 int mem_base;
41140 int ret_val;
41141 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41142 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041143 xmlChar * content; /* comment string */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041144 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041145
Daniel Veillarde43cc572004-11-03 11:50:29 +000041146 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41147 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41148 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041149 writer = gen_xmlTextWriterPtr(n_writer, 0);
41150 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041151
William M. Brackf13f77f2004-11-12 16:03:48 +000041152 ret_val = xmlTextWriterWriteComment(writer, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041153 desret_int(ret_val);
41154 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041155 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041156 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041157 xmlResetLastError();
41158 if (mem_base != xmlMemBlocks()) {
41159 printf("Leak of %d blocks found in xmlTextWriterWriteComment",
41160 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041161 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041162 printf(" %d", n_writer);
41163 printf(" %d", n_content);
41164 printf("\n");
41165 }
41166 }
41167 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041168 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041169#endif
41170
Daniel Veillard42595322004-11-08 10:52:06 +000041171 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041172}
41173
41174
41175static int
41176test_xmlTextWriterWriteDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041177 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041178
Daniel Veillarde43cc572004-11-03 11:50:29 +000041179#ifdef LIBXML_WRITER_ENABLED
41180 int mem_base;
41181 int ret_val;
41182 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41183 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041184 xmlChar * name; /* the name of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041185 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041186 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041187 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041188 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041189 int n_sysid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041190 xmlChar * subset; /* string content of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041191 int n_subset;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041192
Daniel Veillarde43cc572004-11-03 11:50:29 +000041193 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41194 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41195 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
41196 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
41197 for (n_subset = 0;n_subset < gen_nb_const_xmlChar_ptr;n_subset++) {
41198 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041199 writer = gen_xmlTextWriterPtr(n_writer, 0);
41200 name = gen_const_xmlChar_ptr(n_name, 1);
41201 pubid = gen_const_xmlChar_ptr(n_pubid, 2);
41202 sysid = gen_const_xmlChar_ptr(n_sysid, 3);
41203 subset = gen_const_xmlChar_ptr(n_subset, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041204
William M. Brackf13f77f2004-11-12 16:03:48 +000041205 ret_val = xmlTextWriterWriteDTD(writer, (const xmlChar *)name, (const xmlChar *)pubid, (const xmlChar *)sysid, (const xmlChar *)subset);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041206 desret_int(ret_val);
41207 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041208 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041209 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
41210 des_const_xmlChar_ptr(n_pubid, (const xmlChar *)pubid, 2);
41211 des_const_xmlChar_ptr(n_sysid, (const xmlChar *)sysid, 3);
41212 des_const_xmlChar_ptr(n_subset, (const xmlChar *)subset, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041213 xmlResetLastError();
41214 if (mem_base != xmlMemBlocks()) {
41215 printf("Leak of %d blocks found in xmlTextWriterWriteDTD",
41216 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041217 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041218 printf(" %d", n_writer);
41219 printf(" %d", n_name);
41220 printf(" %d", n_pubid);
41221 printf(" %d", n_sysid);
41222 printf(" %d", n_subset);
41223 printf("\n");
41224 }
41225 }
41226 }
41227 }
41228 }
41229 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041230 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041231#endif
41232
Daniel Veillard42595322004-11-08 10:52:06 +000041233 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041234}
41235
41236
41237static int
41238test_xmlTextWriterWriteDTDAttlist(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041239 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041240
Daniel Veillarde43cc572004-11-03 11:50:29 +000041241#ifdef LIBXML_WRITER_ENABLED
41242 int mem_base;
41243 int ret_val;
41244 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41245 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041246 xmlChar * name; /* the name of the DTD ATTLIST */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041247 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041248 xmlChar * content; /* content of the ATTLIST */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041249 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041250
Daniel Veillarde43cc572004-11-03 11:50:29 +000041251 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41252 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41253 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41254 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041255 writer = gen_xmlTextWriterPtr(n_writer, 0);
41256 name = gen_const_xmlChar_ptr(n_name, 1);
41257 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041258
William M. Brackf13f77f2004-11-12 16:03:48 +000041259 ret_val = xmlTextWriterWriteDTDAttlist(writer, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041260 desret_int(ret_val);
41261 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041262 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041263 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
41264 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041265 xmlResetLastError();
41266 if (mem_base != xmlMemBlocks()) {
41267 printf("Leak of %d blocks found in xmlTextWriterWriteDTDAttlist",
41268 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041269 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041270 printf(" %d", n_writer);
41271 printf(" %d", n_name);
41272 printf(" %d", n_content);
41273 printf("\n");
41274 }
41275 }
41276 }
41277 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041278 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041279#endif
41280
Daniel Veillard42595322004-11-08 10:52:06 +000041281 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041282}
41283
41284
41285static int
41286test_xmlTextWriterWriteDTDElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041287 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041288
Daniel Veillarde43cc572004-11-03 11:50:29 +000041289#ifdef LIBXML_WRITER_ENABLED
41290 int mem_base;
41291 int ret_val;
41292 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41293 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041294 xmlChar * name; /* the name of the DTD element */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041295 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041296 xmlChar * content; /* content of the element */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041297 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041298
Daniel Veillarde43cc572004-11-03 11:50:29 +000041299 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41300 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41301 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41302 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041303 writer = gen_xmlTextWriterPtr(n_writer, 0);
41304 name = gen_const_xmlChar_ptr(n_name, 1);
41305 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041306
William M. Brackf13f77f2004-11-12 16:03:48 +000041307 ret_val = xmlTextWriterWriteDTDElement(writer, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041308 desret_int(ret_val);
41309 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041310 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041311 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
41312 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041313 xmlResetLastError();
41314 if (mem_base != xmlMemBlocks()) {
41315 printf("Leak of %d blocks found in xmlTextWriterWriteDTDElement",
41316 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041317 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041318 printf(" %d", n_writer);
41319 printf(" %d", n_name);
41320 printf(" %d", n_content);
41321 printf("\n");
41322 }
41323 }
41324 }
41325 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041326 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041327#endif
41328
Daniel Veillard42595322004-11-08 10:52:06 +000041329 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041330}
41331
41332
41333static int
41334test_xmlTextWriterWriteDTDEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041335 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041336
Daniel Veillarde43cc572004-11-03 11:50:29 +000041337#ifdef LIBXML_WRITER_ENABLED
41338 int mem_base;
41339 int ret_val;
41340 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41341 int n_writer;
41342 int pe; /* TRUE if this is a parameter entity, FALSE if not */
41343 int n_pe;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041344 xmlChar * name; /* the name of the DTD entity */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041345 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041346 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041347 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041348 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041349 int n_sysid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041350 xmlChar * ndataid; /* the xml notation name. */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041351 int n_ndataid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041352 xmlChar * content; /* content of the entity */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041353 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041354
Daniel Veillarde43cc572004-11-03 11:50:29 +000041355 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41356 for (n_pe = 0;n_pe < gen_nb_int;n_pe++) {
41357 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41358 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
41359 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
41360 for (n_ndataid = 0;n_ndataid < gen_nb_const_xmlChar_ptr;n_ndataid++) {
41361 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41362 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041363 writer = gen_xmlTextWriterPtr(n_writer, 0);
41364 pe = gen_int(n_pe, 1);
41365 name = gen_const_xmlChar_ptr(n_name, 2);
41366 pubid = gen_const_xmlChar_ptr(n_pubid, 3);
41367 sysid = gen_const_xmlChar_ptr(n_sysid, 4);
41368 ndataid = gen_const_xmlChar_ptr(n_ndataid, 5);
41369 content = gen_const_xmlChar_ptr(n_content, 6);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041370
William M. Brackf13f77f2004-11-12 16:03:48 +000041371 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 +000041372 desret_int(ret_val);
41373 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041374 des_xmlTextWriterPtr(n_writer, writer, 0);
41375 des_int(n_pe, pe, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000041376 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
41377 des_const_xmlChar_ptr(n_pubid, (const xmlChar *)pubid, 3);
41378 des_const_xmlChar_ptr(n_sysid, (const xmlChar *)sysid, 4);
41379 des_const_xmlChar_ptr(n_ndataid, (const xmlChar *)ndataid, 5);
41380 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 6);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041381 xmlResetLastError();
41382 if (mem_base != xmlMemBlocks()) {
41383 printf("Leak of %d blocks found in xmlTextWriterWriteDTDEntity",
41384 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041385 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041386 printf(" %d", n_writer);
41387 printf(" %d", n_pe);
41388 printf(" %d", n_name);
41389 printf(" %d", n_pubid);
41390 printf(" %d", n_sysid);
41391 printf(" %d", n_ndataid);
41392 printf(" %d", n_content);
41393 printf("\n");
41394 }
41395 }
41396 }
41397 }
41398 }
41399 }
41400 }
41401 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041402 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041403#endif
41404
Daniel Veillard42595322004-11-08 10:52:06 +000041405 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041406}
41407
41408
41409static int
41410test_xmlTextWriterWriteDTDExternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041411 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041412
Daniel Veillarde43cc572004-11-03 11:50:29 +000041413#ifdef LIBXML_WRITER_ENABLED
41414 int mem_base;
41415 int ret_val;
41416 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41417 int n_writer;
41418 int pe; /* TRUE if this is a parameter entity, FALSE if not */
41419 int n_pe;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041420 xmlChar * name; /* the name of the DTD entity */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041421 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041422 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041423 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041424 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041425 int n_sysid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041426 xmlChar * ndataid; /* the xml notation name. */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041427 int n_ndataid;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041428
Daniel Veillarde43cc572004-11-03 11:50:29 +000041429 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41430 for (n_pe = 0;n_pe < gen_nb_int;n_pe++) {
41431 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41432 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
41433 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
41434 for (n_ndataid = 0;n_ndataid < gen_nb_const_xmlChar_ptr;n_ndataid++) {
41435 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041436 writer = gen_xmlTextWriterPtr(n_writer, 0);
41437 pe = gen_int(n_pe, 1);
41438 name = gen_const_xmlChar_ptr(n_name, 2);
41439 pubid = gen_const_xmlChar_ptr(n_pubid, 3);
41440 sysid = gen_const_xmlChar_ptr(n_sysid, 4);
41441 ndataid = gen_const_xmlChar_ptr(n_ndataid, 5);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041442
William M. Brackf13f77f2004-11-12 16:03:48 +000041443 ret_val = xmlTextWriterWriteDTDExternalEntity(writer, pe, (const xmlChar *)name, (const xmlChar *)pubid, (const xmlChar *)sysid, (const xmlChar *)ndataid);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041444 desret_int(ret_val);
41445 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041446 des_xmlTextWriterPtr(n_writer, writer, 0);
41447 des_int(n_pe, pe, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000041448 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
41449 des_const_xmlChar_ptr(n_pubid, (const xmlChar *)pubid, 3);
41450 des_const_xmlChar_ptr(n_sysid, (const xmlChar *)sysid, 4);
41451 des_const_xmlChar_ptr(n_ndataid, (const xmlChar *)ndataid, 5);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041452 xmlResetLastError();
41453 if (mem_base != xmlMemBlocks()) {
41454 printf("Leak of %d blocks found in xmlTextWriterWriteDTDExternalEntity",
41455 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041456 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041457 printf(" %d", n_writer);
41458 printf(" %d", n_pe);
41459 printf(" %d", n_name);
41460 printf(" %d", n_pubid);
41461 printf(" %d", n_sysid);
41462 printf(" %d", n_ndataid);
41463 printf("\n");
41464 }
41465 }
41466 }
41467 }
41468 }
41469 }
41470 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041471 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041472#endif
41473
Daniel Veillard42595322004-11-08 10:52:06 +000041474 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041475}
41476
41477
41478static int
41479test_xmlTextWriterWriteDTDExternalEntityContents(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041480 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041481
Daniel Veillarde43cc572004-11-03 11:50:29 +000041482#ifdef LIBXML_WRITER_ENABLED
41483 int mem_base;
41484 int ret_val;
41485 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41486 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041487 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041488 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041489 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041490 int n_sysid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041491 xmlChar * ndataid; /* the xml notation name. */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041492 int n_ndataid;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041493
Daniel Veillarde43cc572004-11-03 11:50:29 +000041494 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41495 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
41496 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
41497 for (n_ndataid = 0;n_ndataid < gen_nb_const_xmlChar_ptr;n_ndataid++) {
41498 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041499 writer = gen_xmlTextWriterPtr(n_writer, 0);
41500 pubid = gen_const_xmlChar_ptr(n_pubid, 1);
41501 sysid = gen_const_xmlChar_ptr(n_sysid, 2);
41502 ndataid = gen_const_xmlChar_ptr(n_ndataid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041503
William M. Brackf13f77f2004-11-12 16:03:48 +000041504 ret_val = xmlTextWriterWriteDTDExternalEntityContents(writer, (const xmlChar *)pubid, (const xmlChar *)sysid, (const xmlChar *)ndataid);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041505 desret_int(ret_val);
41506 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041507 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041508 des_const_xmlChar_ptr(n_pubid, (const xmlChar *)pubid, 1);
41509 des_const_xmlChar_ptr(n_sysid, (const xmlChar *)sysid, 2);
41510 des_const_xmlChar_ptr(n_ndataid, (const xmlChar *)ndataid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041511 xmlResetLastError();
41512 if (mem_base != xmlMemBlocks()) {
41513 printf("Leak of %d blocks found in xmlTextWriterWriteDTDExternalEntityContents",
41514 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041515 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041516 printf(" %d", n_writer);
41517 printf(" %d", n_pubid);
41518 printf(" %d", n_sysid);
41519 printf(" %d", n_ndataid);
41520 printf("\n");
41521 }
41522 }
41523 }
41524 }
41525 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041526 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041527#endif
41528
Daniel Veillard42595322004-11-08 10:52:06 +000041529 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041530}
41531
41532
41533static int
41534test_xmlTextWriterWriteDTDInternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041535 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041536
Daniel Veillarde43cc572004-11-03 11:50:29 +000041537#ifdef LIBXML_WRITER_ENABLED
41538 int mem_base;
41539 int ret_val;
41540 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41541 int n_writer;
41542 int pe; /* TRUE if this is a parameter entity, FALSE if not */
41543 int n_pe;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041544 xmlChar * name; /* the name of the DTD entity */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041545 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041546 xmlChar * content; /* content of the entity */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041547 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041548
Daniel Veillarde43cc572004-11-03 11:50:29 +000041549 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41550 for (n_pe = 0;n_pe < gen_nb_int;n_pe++) {
41551 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41552 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41553 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041554 writer = gen_xmlTextWriterPtr(n_writer, 0);
41555 pe = gen_int(n_pe, 1);
41556 name = gen_const_xmlChar_ptr(n_name, 2);
41557 content = gen_const_xmlChar_ptr(n_content, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041558
William M. Brackf13f77f2004-11-12 16:03:48 +000041559 ret_val = xmlTextWriterWriteDTDInternalEntity(writer, pe, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041560 desret_int(ret_val);
41561 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041562 des_xmlTextWriterPtr(n_writer, writer, 0);
41563 des_int(n_pe, pe, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000041564 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
41565 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041566 xmlResetLastError();
41567 if (mem_base != xmlMemBlocks()) {
41568 printf("Leak of %d blocks found in xmlTextWriterWriteDTDInternalEntity",
41569 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041570 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041571 printf(" %d", n_writer);
41572 printf(" %d", n_pe);
41573 printf(" %d", n_name);
41574 printf(" %d", n_content);
41575 printf("\n");
41576 }
41577 }
41578 }
41579 }
41580 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041581 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041582#endif
41583
Daniel Veillard42595322004-11-08 10:52:06 +000041584 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041585}
41586
41587
41588static int
41589test_xmlTextWriterWriteDTDNotation(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041590 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041591
Daniel Veillarde43cc572004-11-03 11:50:29 +000041592#ifdef LIBXML_WRITER_ENABLED
41593 int mem_base;
41594 int ret_val;
41595 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41596 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041597 xmlChar * name; /* the name of the xml notation */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041598 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041599 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041600 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041601 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041602 int n_sysid;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041603
Daniel Veillarde43cc572004-11-03 11:50:29 +000041604 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41605 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41606 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
41607 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
41608 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041609 writer = gen_xmlTextWriterPtr(n_writer, 0);
41610 name = gen_const_xmlChar_ptr(n_name, 1);
41611 pubid = gen_const_xmlChar_ptr(n_pubid, 2);
41612 sysid = gen_const_xmlChar_ptr(n_sysid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041613
William M. Brackf13f77f2004-11-12 16:03:48 +000041614 ret_val = xmlTextWriterWriteDTDNotation(writer, (const xmlChar *)name, (const xmlChar *)pubid, (const xmlChar *)sysid);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041615 desret_int(ret_val);
41616 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041617 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041618 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
41619 des_const_xmlChar_ptr(n_pubid, (const xmlChar *)pubid, 2);
41620 des_const_xmlChar_ptr(n_sysid, (const xmlChar *)sysid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041621 xmlResetLastError();
41622 if (mem_base != xmlMemBlocks()) {
41623 printf("Leak of %d blocks found in xmlTextWriterWriteDTDNotation",
41624 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041625 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041626 printf(" %d", n_writer);
41627 printf(" %d", n_name);
41628 printf(" %d", n_pubid);
41629 printf(" %d", n_sysid);
41630 printf("\n");
41631 }
41632 }
41633 }
41634 }
41635 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041636 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041637#endif
41638
Daniel Veillard42595322004-11-08 10:52:06 +000041639 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041640}
41641
41642
41643static int
41644test_xmlTextWriterWriteElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041645 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041646
Daniel Veillarde43cc572004-11-03 11:50:29 +000041647#ifdef LIBXML_WRITER_ENABLED
41648 int mem_base;
41649 int ret_val;
41650 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41651 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041652 xmlChar * name; /* element name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041653 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041654 xmlChar * content; /* element content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041655 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041656
Daniel Veillarde43cc572004-11-03 11:50:29 +000041657 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41658 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41659 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41660 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041661 writer = gen_xmlTextWriterPtr(n_writer, 0);
41662 name = gen_const_xmlChar_ptr(n_name, 1);
41663 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041664
William M. Brackf13f77f2004-11-12 16:03:48 +000041665 ret_val = xmlTextWriterWriteElement(writer, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041666 desret_int(ret_val);
41667 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041668 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041669 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
41670 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041671 xmlResetLastError();
41672 if (mem_base != xmlMemBlocks()) {
41673 printf("Leak of %d blocks found in xmlTextWriterWriteElement",
41674 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041675 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041676 printf(" %d", n_writer);
41677 printf(" %d", n_name);
41678 printf(" %d", n_content);
41679 printf("\n");
41680 }
41681 }
41682 }
41683 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041684 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041685#endif
41686
Daniel Veillard42595322004-11-08 10:52:06 +000041687 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041688}
41689
41690
41691static int
41692test_xmlTextWriterWriteElementNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041693 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041694
Daniel Veillarde43cc572004-11-03 11:50:29 +000041695#ifdef LIBXML_WRITER_ENABLED
41696 int mem_base;
41697 int ret_val;
41698 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41699 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041700 xmlChar * prefix; /* namespace prefix */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041701 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041702 xmlChar * name; /* element local name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041703 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041704 xmlChar * namespaceURI; /* namespace URI */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041705 int n_namespaceURI;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041706 xmlChar * content; /* element content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041707 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041708
Daniel Veillarde43cc572004-11-03 11:50:29 +000041709 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41710 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
41711 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41712 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
41713 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41714 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041715 writer = gen_xmlTextWriterPtr(n_writer, 0);
41716 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
41717 name = gen_const_xmlChar_ptr(n_name, 2);
41718 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 3);
41719 content = gen_const_xmlChar_ptr(n_content, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041720
William M. Brackf13f77f2004-11-12 16:03:48 +000041721 ret_val = xmlTextWriterWriteElementNS(writer, (const xmlChar *)prefix, (const xmlChar *)name, (const xmlChar *)namespaceURI, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041722 desret_int(ret_val);
41723 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041724 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041725 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
41726 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
41727 des_const_xmlChar_ptr(n_namespaceURI, (const xmlChar *)namespaceURI, 3);
41728 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041729 xmlResetLastError();
41730 if (mem_base != xmlMemBlocks()) {
41731 printf("Leak of %d blocks found in xmlTextWriterWriteElementNS",
41732 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041733 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041734 printf(" %d", n_writer);
41735 printf(" %d", n_prefix);
41736 printf(" %d", n_name);
41737 printf(" %d", n_namespaceURI);
41738 printf(" %d", n_content);
41739 printf("\n");
41740 }
41741 }
41742 }
41743 }
41744 }
41745 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041746 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041747#endif
41748
Daniel Veillard42595322004-11-08 10:52:06 +000041749 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041750}
41751
41752
41753static int
41754test_xmlTextWriterWriteFormatAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041755 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041756
41757
41758 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000041759 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041760}
41761
41762
41763static int
41764test_xmlTextWriterWriteFormatAttributeNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041765 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041766
41767
41768 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000041769 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041770}
41771
41772
41773static int
41774test_xmlTextWriterWriteFormatCDATA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041775 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041776
41777
41778 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000041779 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041780}
41781
41782
41783static int
41784test_xmlTextWriterWriteFormatComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041785 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041786
41787
41788 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000041789 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041790}
41791
41792
41793static int
41794test_xmlTextWriterWriteFormatDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041795 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041796
41797
41798 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000041799 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041800}
41801
41802
41803static int
41804test_xmlTextWriterWriteFormatDTDAttlist(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041805 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041806
41807
41808 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000041809 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041810}
41811
41812
41813static int
41814test_xmlTextWriterWriteFormatDTDElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041815 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041816
41817
41818 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000041819 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041820}
41821
41822
41823static int
41824test_xmlTextWriterWriteFormatDTDInternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041825 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041826
41827
41828 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000041829 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041830}
41831
41832
41833static int
41834test_xmlTextWriterWriteFormatElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041835 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041836
41837
41838 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000041839 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041840}
41841
41842
41843static int
41844test_xmlTextWriterWriteFormatElementNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041845 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041846
41847
41848 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000041849 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041850}
41851
41852
41853static int
41854test_xmlTextWriterWriteFormatPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041855 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041856
41857
41858 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000041859 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041860}
41861
41862
41863static int
41864test_xmlTextWriterWriteFormatRaw(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041865 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041866
41867
41868 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000041869 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041870}
41871
41872
41873static int
41874test_xmlTextWriterWriteFormatString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041875 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041876
41877
41878 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000041879 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041880}
41881
41882
41883static int
41884test_xmlTextWriterWritePI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041885 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041886
Daniel Veillarde43cc572004-11-03 11:50:29 +000041887#ifdef LIBXML_WRITER_ENABLED
41888 int mem_base;
41889 int ret_val;
41890 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41891 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041892 xmlChar * target; /* PI target */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041893 int n_target;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041894 xmlChar * content; /* PI content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041895 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041896
Daniel Veillarde43cc572004-11-03 11:50:29 +000041897 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41898 for (n_target = 0;n_target < gen_nb_const_xmlChar_ptr;n_target++) {
41899 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41900 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041901 writer = gen_xmlTextWriterPtr(n_writer, 0);
41902 target = gen_const_xmlChar_ptr(n_target, 1);
41903 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041904
William M. Brackf13f77f2004-11-12 16:03:48 +000041905 ret_val = xmlTextWriterWritePI(writer, (const xmlChar *)target, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041906 desret_int(ret_val);
41907 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041908 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041909 des_const_xmlChar_ptr(n_target, (const xmlChar *)target, 1);
41910 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041911 xmlResetLastError();
41912 if (mem_base != xmlMemBlocks()) {
41913 printf("Leak of %d blocks found in xmlTextWriterWritePI",
41914 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041915 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041916 printf(" %d", n_writer);
41917 printf(" %d", n_target);
41918 printf(" %d", n_content);
41919 printf("\n");
41920 }
41921 }
41922 }
41923 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041924 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041925#endif
41926
Daniel Veillard42595322004-11-08 10:52:06 +000041927 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041928}
41929
41930
41931static int
41932test_xmlTextWriterWriteRaw(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041933 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041934
Daniel Veillarde43cc572004-11-03 11:50:29 +000041935#ifdef LIBXML_WRITER_ENABLED
41936 int mem_base;
41937 int ret_val;
41938 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41939 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041940 xmlChar * content; /* text string */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041941 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041942
Daniel Veillarde43cc572004-11-03 11:50:29 +000041943 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41944 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41945 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041946 writer = gen_xmlTextWriterPtr(n_writer, 0);
41947 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041948
William M. Brackf13f77f2004-11-12 16:03:48 +000041949 ret_val = xmlTextWriterWriteRaw(writer, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041950 desret_int(ret_val);
41951 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041952 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041953 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041954 xmlResetLastError();
41955 if (mem_base != xmlMemBlocks()) {
41956 printf("Leak of %d blocks found in xmlTextWriterWriteRaw",
41957 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041958 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041959 printf(" %d", n_writer);
41960 printf(" %d", n_content);
41961 printf("\n");
41962 }
41963 }
41964 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041965 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041966#endif
41967
Daniel Veillard42595322004-11-08 10:52:06 +000041968 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041969}
41970
41971
41972static int
41973test_xmlTextWriterWriteRawLen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041974 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041975
Daniel Veillarde43cc572004-11-03 11:50:29 +000041976#ifdef LIBXML_WRITER_ENABLED
41977 int mem_base;
41978 int ret_val;
41979 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41980 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041981 xmlChar * content; /* text string */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041982 int n_content;
41983 int len; /* length of the text string */
41984 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041985
Daniel Veillarde43cc572004-11-03 11:50:29 +000041986 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41987 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41988 for (n_len = 0;n_len < gen_nb_int;n_len++) {
41989 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041990 writer = gen_xmlTextWriterPtr(n_writer, 0);
41991 content = gen_const_xmlChar_ptr(n_content, 1);
41992 len = gen_int(n_len, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041993
William M. Brackf13f77f2004-11-12 16:03:48 +000041994 ret_val = xmlTextWriterWriteRawLen(writer, (const xmlChar *)content, len);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041995 desret_int(ret_val);
41996 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041997 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041998 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000041999 des_int(n_len, len, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042000 xmlResetLastError();
42001 if (mem_base != xmlMemBlocks()) {
42002 printf("Leak of %d blocks found in xmlTextWriterWriteRawLen",
42003 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042004 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042005 printf(" %d", n_writer);
42006 printf(" %d", n_content);
42007 printf(" %d", n_len);
42008 printf("\n");
42009 }
42010 }
42011 }
42012 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042013 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042014#endif
42015
Daniel Veillard42595322004-11-08 10:52:06 +000042016 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042017}
42018
42019
42020static int
42021test_xmlTextWriterWriteString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042022 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042023
Daniel Veillarde43cc572004-11-03 11:50:29 +000042024#ifdef LIBXML_WRITER_ENABLED
42025 int mem_base;
42026 int ret_val;
42027 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42028 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042029 xmlChar * content; /* text string */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042030 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042031
Daniel Veillarde43cc572004-11-03 11:50:29 +000042032 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42033 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
42034 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042035 writer = gen_xmlTextWriterPtr(n_writer, 0);
42036 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042037
William M. Brackf13f77f2004-11-12 16:03:48 +000042038 ret_val = xmlTextWriterWriteString(writer, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042039 desret_int(ret_val);
42040 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042041 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000042042 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042043 xmlResetLastError();
42044 if (mem_base != xmlMemBlocks()) {
42045 printf("Leak of %d blocks found in xmlTextWriterWriteString",
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_content);
42050 printf("\n");
42051 }
42052 }
42053 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042054 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042055#endif
42056
Daniel Veillard42595322004-11-08 10:52:06 +000042057 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042058}
42059
42060
42061static int
42062test_xmlTextWriterWriteVFormatAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042063 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042064
42065
42066 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042067 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042068}
42069
42070
42071static int
42072test_xmlTextWriterWriteVFormatAttributeNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042073 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042074
42075
42076 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042077 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042078}
42079
42080
42081static int
42082test_xmlTextWriterWriteVFormatCDATA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042083 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042084
42085
42086 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042087 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042088}
42089
42090
42091static int
42092test_xmlTextWriterWriteVFormatComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042093 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042094
42095
42096 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042097 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042098}
42099
42100
42101static int
42102test_xmlTextWriterWriteVFormatDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042103 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042104
42105
42106 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042107 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042108}
42109
42110
42111static int
42112test_xmlTextWriterWriteVFormatDTDAttlist(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042113 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042114
42115
42116 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042117 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042118}
42119
42120
42121static int
42122test_xmlTextWriterWriteVFormatDTDElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042123 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042124
42125
42126 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042127 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042128}
42129
42130
42131static int
42132test_xmlTextWriterWriteVFormatDTDInternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042133 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042134
42135
42136 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042137 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042138}
42139
42140
42141static int
42142test_xmlTextWriterWriteVFormatElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042143 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042144
42145
42146 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042147 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042148}
42149
42150
42151static int
42152test_xmlTextWriterWriteVFormatElementNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042153 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042154
42155
42156 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042157 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042158}
42159
42160
42161static int
42162test_xmlTextWriterWriteVFormatPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042163 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042164
42165
42166 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042167 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042168}
42169
42170
42171static int
42172test_xmlTextWriterWriteVFormatRaw(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042173 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042174
42175
42176 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042177 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042178}
42179
42180
42181static int
42182test_xmlTextWriterWriteVFormatString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042183 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042184
42185
42186 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042187 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042188}
42189
42190static int
42191test_xmlwriter(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042192 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042193
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042194 if (quiet == 0) printf("Testing xmlwriter : 51 of 79 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000042195 test_ret += test_xmlNewTextWriter();
42196 test_ret += test_xmlNewTextWriterFilename();
42197 test_ret += test_xmlNewTextWriterMemory();
42198 test_ret += test_xmlNewTextWriterPushParser();
42199 test_ret += test_xmlNewTextWriterTree();
42200 test_ret += test_xmlTextWriterEndAttribute();
42201 test_ret += test_xmlTextWriterEndCDATA();
42202 test_ret += test_xmlTextWriterEndComment();
42203 test_ret += test_xmlTextWriterEndDTD();
42204 test_ret += test_xmlTextWriterEndDTDAttlist();
42205 test_ret += test_xmlTextWriterEndDTDElement();
42206 test_ret += test_xmlTextWriterEndDTDEntity();
42207 test_ret += test_xmlTextWriterEndDocument();
42208 test_ret += test_xmlTextWriterEndElement();
42209 test_ret += test_xmlTextWriterEndPI();
42210 test_ret += test_xmlTextWriterFlush();
42211 test_ret += test_xmlTextWriterFullEndElement();
42212 test_ret += test_xmlTextWriterSetIndent();
42213 test_ret += test_xmlTextWriterSetIndentString();
42214 test_ret += test_xmlTextWriterStartAttribute();
42215 test_ret += test_xmlTextWriterStartAttributeNS();
42216 test_ret += test_xmlTextWriterStartCDATA();
42217 test_ret += test_xmlTextWriterStartComment();
42218 test_ret += test_xmlTextWriterStartDTD();
42219 test_ret += test_xmlTextWriterStartDTDAttlist();
42220 test_ret += test_xmlTextWriterStartDTDElement();
42221 test_ret += test_xmlTextWriterStartDTDEntity();
42222 test_ret += test_xmlTextWriterStartDocument();
42223 test_ret += test_xmlTextWriterStartElement();
42224 test_ret += test_xmlTextWriterStartElementNS();
42225 test_ret += test_xmlTextWriterStartPI();
42226 test_ret += test_xmlTextWriterWriteAttribute();
42227 test_ret += test_xmlTextWriterWriteAttributeNS();
42228 test_ret += test_xmlTextWriterWriteBase64();
42229 test_ret += test_xmlTextWriterWriteBinHex();
42230 test_ret += test_xmlTextWriterWriteCDATA();
42231 test_ret += test_xmlTextWriterWriteComment();
42232 test_ret += test_xmlTextWriterWriteDTD();
42233 test_ret += test_xmlTextWriterWriteDTDAttlist();
42234 test_ret += test_xmlTextWriterWriteDTDElement();
42235 test_ret += test_xmlTextWriterWriteDTDEntity();
42236 test_ret += test_xmlTextWriterWriteDTDExternalEntity();
42237 test_ret += test_xmlTextWriterWriteDTDExternalEntityContents();
42238 test_ret += test_xmlTextWriterWriteDTDInternalEntity();
42239 test_ret += test_xmlTextWriterWriteDTDNotation();
42240 test_ret += test_xmlTextWriterWriteElement();
42241 test_ret += test_xmlTextWriterWriteElementNS();
42242 test_ret += test_xmlTextWriterWriteFormatAttribute();
42243 test_ret += test_xmlTextWriterWriteFormatAttributeNS();
42244 test_ret += test_xmlTextWriterWriteFormatCDATA();
42245 test_ret += test_xmlTextWriterWriteFormatComment();
42246 test_ret += test_xmlTextWriterWriteFormatDTD();
42247 test_ret += test_xmlTextWriterWriteFormatDTDAttlist();
42248 test_ret += test_xmlTextWriterWriteFormatDTDElement();
42249 test_ret += test_xmlTextWriterWriteFormatDTDInternalEntity();
42250 test_ret += test_xmlTextWriterWriteFormatElement();
42251 test_ret += test_xmlTextWriterWriteFormatElementNS();
42252 test_ret += test_xmlTextWriterWriteFormatPI();
42253 test_ret += test_xmlTextWriterWriteFormatRaw();
42254 test_ret += test_xmlTextWriterWriteFormatString();
42255 test_ret += test_xmlTextWriterWritePI();
42256 test_ret += test_xmlTextWriterWriteRaw();
42257 test_ret += test_xmlTextWriterWriteRawLen();
42258 test_ret += test_xmlTextWriterWriteString();
42259 test_ret += test_xmlTextWriterWriteVFormatAttribute();
42260 test_ret += test_xmlTextWriterWriteVFormatAttributeNS();
42261 test_ret += test_xmlTextWriterWriteVFormatCDATA();
42262 test_ret += test_xmlTextWriterWriteVFormatComment();
42263 test_ret += test_xmlTextWriterWriteVFormatDTD();
42264 test_ret += test_xmlTextWriterWriteVFormatDTDAttlist();
42265 test_ret += test_xmlTextWriterWriteVFormatDTDElement();
42266 test_ret += test_xmlTextWriterWriteVFormatDTDInternalEntity();
42267 test_ret += test_xmlTextWriterWriteVFormatElement();
42268 test_ret += test_xmlTextWriterWriteVFormatElementNS();
42269 test_ret += test_xmlTextWriterWriteVFormatPI();
42270 test_ret += test_xmlTextWriterWriteVFormatRaw();
42271 test_ret += test_xmlTextWriterWriteVFormatString();
Daniel Veillardd93f6252004-11-02 15:53:51 +000042272
Daniel Veillard42595322004-11-08 10:52:06 +000042273 if (test_ret != 0)
42274 printf("Module xmlwriter: %d errors\n", test_ret);
42275 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042276}
42277
42278static int
42279test_xmlXPathCastBooleanToNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042280 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042281
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042282#ifdef LIBXML_XPATH_ENABLED
42283 int mem_base;
42284 double ret_val;
42285 int val; /* a boolean */
42286 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042287
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042288 for (n_val = 0;n_val < gen_nb_int;n_val++) {
42289 mem_base = xmlMemBlocks();
42290 val = gen_int(n_val, 0);
42291
42292 ret_val = xmlXPathCastBooleanToNumber(val);
42293 desret_double(ret_val);
42294 call_tests++;
42295 des_int(n_val, val, 0);
42296 xmlResetLastError();
42297 if (mem_base != xmlMemBlocks()) {
42298 printf("Leak of %d blocks found in xmlXPathCastBooleanToNumber",
42299 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042300 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042301 printf(" %d", n_val);
42302 printf("\n");
42303 }
42304 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042305 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042306#endif
42307
Daniel Veillard42595322004-11-08 10:52:06 +000042308 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042309}
42310
42311
42312static int
42313test_xmlXPathCastBooleanToString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042314 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042315
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042316#ifdef LIBXML_XPATH_ENABLED
42317 int mem_base;
42318 xmlChar * ret_val;
42319 int val; /* a boolean */
42320 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042321
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042322 for (n_val = 0;n_val < gen_nb_int;n_val++) {
42323 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042324 val = gen_int(n_val, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042325
42326 ret_val = xmlXPathCastBooleanToString(val);
42327 desret_xmlChar_ptr(ret_val);
42328 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042329 des_int(n_val, val, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042330 xmlResetLastError();
42331 if (mem_base != xmlMemBlocks()) {
42332 printf("Leak of %d blocks found in xmlXPathCastBooleanToString",
42333 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042334 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042335 printf(" %d", n_val);
42336 printf("\n");
42337 }
42338 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042339 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042340#endif
42341
Daniel Veillard42595322004-11-08 10:52:06 +000042342 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042343}
42344
42345
42346static int
42347test_xmlXPathCastNodeSetToBoolean(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042348 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042349
Daniel Veillardce682bc2004-11-05 17:22:25 +000042350#ifdef LIBXML_XPATH_ENABLED
42351 int mem_base;
42352 int ret_val;
42353 xmlNodeSetPtr ns; /* a node-set */
42354 int n_ns;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042355
Daniel Veillardce682bc2004-11-05 17:22:25 +000042356 for (n_ns = 0;n_ns < gen_nb_xmlNodeSetPtr;n_ns++) {
42357 mem_base = xmlMemBlocks();
42358 ns = gen_xmlNodeSetPtr(n_ns, 0);
42359
42360 ret_val = xmlXPathCastNodeSetToBoolean(ns);
42361 desret_int(ret_val);
42362 call_tests++;
42363 des_xmlNodeSetPtr(n_ns, ns, 0);
42364 xmlResetLastError();
42365 if (mem_base != xmlMemBlocks()) {
42366 printf("Leak of %d blocks found in xmlXPathCastNodeSetToBoolean",
42367 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042368 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042369 printf(" %d", n_ns);
42370 printf("\n");
42371 }
42372 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042373 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042374#endif
42375
Daniel Veillard42595322004-11-08 10:52:06 +000042376 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042377}
42378
42379
42380static int
42381test_xmlXPathCastNodeSetToNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042382 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042383
Daniel Veillardce682bc2004-11-05 17:22:25 +000042384#ifdef LIBXML_XPATH_ENABLED
42385 int mem_base;
42386 double ret_val;
42387 xmlNodeSetPtr ns; /* a node-set */
42388 int n_ns;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042389
Daniel Veillardce682bc2004-11-05 17:22:25 +000042390 for (n_ns = 0;n_ns < gen_nb_xmlNodeSetPtr;n_ns++) {
42391 mem_base = xmlMemBlocks();
42392 ns = gen_xmlNodeSetPtr(n_ns, 0);
42393
42394 ret_val = xmlXPathCastNodeSetToNumber(ns);
42395 desret_double(ret_val);
42396 call_tests++;
42397 des_xmlNodeSetPtr(n_ns, ns, 0);
42398 xmlResetLastError();
42399 if (mem_base != xmlMemBlocks()) {
42400 printf("Leak of %d blocks found in xmlXPathCastNodeSetToNumber",
42401 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042402 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042403 printf(" %d", n_ns);
42404 printf("\n");
42405 }
42406 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042407 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042408#endif
42409
Daniel Veillard42595322004-11-08 10:52:06 +000042410 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042411}
42412
42413
42414static int
42415test_xmlXPathCastNodeSetToString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042416 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042417
Daniel Veillardce682bc2004-11-05 17:22:25 +000042418#ifdef LIBXML_XPATH_ENABLED
42419 int mem_base;
42420 xmlChar * ret_val;
42421 xmlNodeSetPtr ns; /* a node-set */
42422 int n_ns;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042423
Daniel Veillardce682bc2004-11-05 17:22:25 +000042424 for (n_ns = 0;n_ns < gen_nb_xmlNodeSetPtr;n_ns++) {
42425 mem_base = xmlMemBlocks();
42426 ns = gen_xmlNodeSetPtr(n_ns, 0);
42427
42428 ret_val = xmlXPathCastNodeSetToString(ns);
42429 desret_xmlChar_ptr(ret_val);
42430 call_tests++;
42431 des_xmlNodeSetPtr(n_ns, ns, 0);
42432 xmlResetLastError();
42433 if (mem_base != xmlMemBlocks()) {
42434 printf("Leak of %d blocks found in xmlXPathCastNodeSetToString",
42435 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042436 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042437 printf(" %d", n_ns);
42438 printf("\n");
42439 }
42440 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042441 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042442#endif
42443
Daniel Veillard42595322004-11-08 10:52:06 +000042444 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042445}
42446
42447
42448static int
42449test_xmlXPathCastNodeToNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042450 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042451
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042452#ifdef LIBXML_XPATH_ENABLED
42453 int mem_base;
42454 double ret_val;
42455 xmlNodePtr node; /* a node */
42456 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042457
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042458 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
42459 mem_base = xmlMemBlocks();
42460 node = gen_xmlNodePtr(n_node, 0);
42461
42462 ret_val = xmlXPathCastNodeToNumber(node);
42463 desret_double(ret_val);
42464 call_tests++;
42465 des_xmlNodePtr(n_node, node, 0);
42466 xmlResetLastError();
42467 if (mem_base != xmlMemBlocks()) {
42468 printf("Leak of %d blocks found in xmlXPathCastNodeToNumber",
42469 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042470 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042471 printf(" %d", n_node);
42472 printf("\n");
42473 }
42474 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042475 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042476#endif
42477
Daniel Veillard42595322004-11-08 10:52:06 +000042478 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042479}
42480
42481
42482static int
42483test_xmlXPathCastNodeToString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042484 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042485
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042486#ifdef LIBXML_XPATH_ENABLED
42487 int mem_base;
42488 xmlChar * ret_val;
42489 xmlNodePtr node; /* a node */
42490 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042491
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042492 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
42493 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042494 node = gen_xmlNodePtr(n_node, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042495
42496 ret_val = xmlXPathCastNodeToString(node);
42497 desret_xmlChar_ptr(ret_val);
42498 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042499 des_xmlNodePtr(n_node, node, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042500 xmlResetLastError();
42501 if (mem_base != xmlMemBlocks()) {
42502 printf("Leak of %d blocks found in xmlXPathCastNodeToString",
42503 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042504 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042505 printf(" %d", n_node);
42506 printf("\n");
42507 }
42508 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042509 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042510#endif
42511
Daniel Veillard42595322004-11-08 10:52:06 +000042512 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042513}
42514
42515
42516static int
42517test_xmlXPathCastNumberToBoolean(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042518 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042519
Daniel Veillard3d95c732004-11-06 22:25:14 +000042520#ifdef LIBXML_XPATH_ENABLED
42521 int mem_base;
42522 int ret_val;
42523 double val; /* a number */
42524 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042525
Daniel Veillard3d95c732004-11-06 22:25:14 +000042526 for (n_val = 0;n_val < gen_nb_double;n_val++) {
42527 mem_base = xmlMemBlocks();
42528 val = gen_double(n_val, 0);
42529
42530 ret_val = xmlXPathCastNumberToBoolean(val);
42531 desret_int(ret_val);
42532 call_tests++;
42533 des_double(n_val, val, 0);
42534 xmlResetLastError();
42535 if (mem_base != xmlMemBlocks()) {
42536 printf("Leak of %d blocks found in xmlXPathCastNumberToBoolean",
42537 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042538 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000042539 printf(" %d", n_val);
42540 printf("\n");
42541 }
42542 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042543 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000042544#endif
42545
Daniel Veillard42595322004-11-08 10:52:06 +000042546 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042547}
42548
42549
42550static int
42551test_xmlXPathCastNumberToString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042552 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042553
Daniel Veillard3d95c732004-11-06 22:25:14 +000042554#ifdef LIBXML_XPATH_ENABLED
42555 int mem_base;
42556 xmlChar * ret_val;
42557 double val; /* a number */
42558 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042559
Daniel Veillard3d95c732004-11-06 22:25:14 +000042560 for (n_val = 0;n_val < gen_nb_double;n_val++) {
42561 mem_base = xmlMemBlocks();
42562 val = gen_double(n_val, 0);
42563
42564 ret_val = xmlXPathCastNumberToString(val);
42565 desret_xmlChar_ptr(ret_val);
42566 call_tests++;
42567 des_double(n_val, val, 0);
42568 xmlResetLastError();
42569 if (mem_base != xmlMemBlocks()) {
42570 printf("Leak of %d blocks found in xmlXPathCastNumberToString",
42571 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042572 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000042573 printf(" %d", n_val);
42574 printf("\n");
42575 }
42576 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042577 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000042578#endif
42579
Daniel Veillard42595322004-11-08 10:52:06 +000042580 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042581}
42582
42583
42584static int
42585test_xmlXPathCastStringToBoolean(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042586 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042587
42588#ifdef LIBXML_XPATH_ENABLED
42589 int mem_base;
42590 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042591 xmlChar * val; /* a string */
Daniel Veillardd93f6252004-11-02 15:53:51 +000042592 int n_val;
42593
42594 for (n_val = 0;n_val < gen_nb_const_xmlChar_ptr;n_val++) {
42595 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042596 val = gen_const_xmlChar_ptr(n_val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042597
William M. Brackf13f77f2004-11-12 16:03:48 +000042598 ret_val = xmlXPathCastStringToBoolean((const xmlChar *)val);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042599 desret_int(ret_val);
42600 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000042601 des_const_xmlChar_ptr(n_val, (const xmlChar *)val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042602 xmlResetLastError();
42603 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000042604 printf("Leak of %d blocks found in xmlXPathCastStringToBoolean",
Daniel Veillardd93f6252004-11-02 15:53:51 +000042605 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042606 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000042607 printf(" %d", n_val);
42608 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000042609 }
42610 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042611 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042612#endif
42613
Daniel Veillard42595322004-11-08 10:52:06 +000042614 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042615}
42616
42617
42618static int
42619test_xmlXPathCastStringToNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042620 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042621
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042622#ifdef LIBXML_XPATH_ENABLED
42623 int mem_base;
42624 double ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042625 xmlChar * val; /* a string */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042626 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042627
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042628 for (n_val = 0;n_val < gen_nb_const_xmlChar_ptr;n_val++) {
42629 mem_base = xmlMemBlocks();
42630 val = gen_const_xmlChar_ptr(n_val, 0);
42631
William M. Brackf13f77f2004-11-12 16:03:48 +000042632 ret_val = xmlXPathCastStringToNumber((const xmlChar *)val);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042633 desret_double(ret_val);
42634 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000042635 des_const_xmlChar_ptr(n_val, (const xmlChar *)val, 0);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042636 xmlResetLastError();
42637 if (mem_base != xmlMemBlocks()) {
42638 printf("Leak of %d blocks found in xmlXPathCastStringToNumber",
42639 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042640 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042641 printf(" %d", n_val);
42642 printf("\n");
42643 }
42644 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042645 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042646#endif
42647
Daniel Veillard42595322004-11-08 10:52:06 +000042648 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042649}
42650
42651
42652static int
42653test_xmlXPathCastToBoolean(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042654 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042655
Daniel Veillardd005b9e2004-11-03 17:07:05 +000042656#ifdef LIBXML_XPATH_ENABLED
42657 int mem_base;
42658 int ret_val;
42659 xmlXPathObjectPtr val; /* an XPath object */
42660 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042661
Daniel Veillardd005b9e2004-11-03 17:07:05 +000042662 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
42663 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042664 val = gen_xmlXPathObjectPtr(n_val, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000042665
42666 ret_val = xmlXPathCastToBoolean(val);
42667 desret_int(ret_val);
42668 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042669 des_xmlXPathObjectPtr(n_val, val, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000042670 xmlResetLastError();
42671 if (mem_base != xmlMemBlocks()) {
42672 printf("Leak of %d blocks found in xmlXPathCastToBoolean",
42673 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042674 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000042675 printf(" %d", n_val);
42676 printf("\n");
42677 }
42678 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042679 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000042680#endif
42681
Daniel Veillard42595322004-11-08 10:52:06 +000042682 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042683}
42684
42685
42686static int
42687test_xmlXPathCastToNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042688 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042689
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042690#ifdef LIBXML_XPATH_ENABLED
42691 int mem_base;
42692 double ret_val;
42693 xmlXPathObjectPtr val; /* an XPath object */
42694 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042695
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042696 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
42697 mem_base = xmlMemBlocks();
42698 val = gen_xmlXPathObjectPtr(n_val, 0);
42699
42700 ret_val = xmlXPathCastToNumber(val);
42701 desret_double(ret_val);
42702 call_tests++;
42703 des_xmlXPathObjectPtr(n_val, val, 0);
42704 xmlResetLastError();
42705 if (mem_base != xmlMemBlocks()) {
42706 printf("Leak of %d blocks found in xmlXPathCastToNumber",
42707 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042708 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042709 printf(" %d", n_val);
42710 printf("\n");
42711 }
42712 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042713 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042714#endif
42715
Daniel Veillard42595322004-11-08 10:52:06 +000042716 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042717}
42718
42719
42720static int
42721test_xmlXPathCastToString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042722 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042723
Daniel Veillardd005b9e2004-11-03 17:07:05 +000042724#ifdef LIBXML_XPATH_ENABLED
42725 int mem_base;
42726 xmlChar * ret_val;
42727 xmlXPathObjectPtr val; /* an XPath object */
42728 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042729
Daniel Veillardd005b9e2004-11-03 17:07:05 +000042730 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
42731 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042732 val = gen_xmlXPathObjectPtr(n_val, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000042733
42734 ret_val = xmlXPathCastToString(val);
42735 desret_xmlChar_ptr(ret_val);
42736 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042737 des_xmlXPathObjectPtr(n_val, val, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000042738 xmlResetLastError();
42739 if (mem_base != xmlMemBlocks()) {
42740 printf("Leak of %d blocks found in xmlXPathCastToString",
42741 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042742 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000042743 printf(" %d", n_val);
42744 printf("\n");
42745 }
42746 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042747 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000042748#endif
42749
Daniel Veillard42595322004-11-08 10:52:06 +000042750 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042751}
42752
42753
42754static int
42755test_xmlXPathCmpNodes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042756 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042757
42758#ifdef LIBXML_XPATH_ENABLED
42759 int mem_base;
42760 int ret_val;
42761 xmlNodePtr node1; /* the first node */
42762 int n_node1;
42763 xmlNodePtr node2; /* the second node */
42764 int n_node2;
42765
42766 for (n_node1 = 0;n_node1 < gen_nb_xmlNodePtr;n_node1++) {
42767 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
42768 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042769 node1 = gen_xmlNodePtr(n_node1, 0);
42770 node2 = gen_xmlNodePtr(n_node2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042771
42772 ret_val = xmlXPathCmpNodes(node1, node2);
42773 desret_int(ret_val);
42774 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042775 des_xmlNodePtr(n_node1, node1, 0);
42776 des_xmlNodePtr(n_node2, node2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042777 xmlResetLastError();
42778 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000042779 printf("Leak of %d blocks found in xmlXPathCmpNodes",
Daniel Veillardd93f6252004-11-02 15:53:51 +000042780 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042781 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000042782 printf(" %d", n_node1);
42783 printf(" %d", n_node2);
42784 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000042785 }
42786 }
42787 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042788 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042789#endif
42790
Daniel Veillard42595322004-11-08 10:52:06 +000042791 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042792}
42793
42794
42795static int
42796test_xmlXPathCompile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042797 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042798
42799
42800 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042801 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042802}
42803
Daniel Veillarda521d282004-11-09 14:59:59 +000042804#ifdef LIBXML_XPATH_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000042805
Daniel Veillardce682bc2004-11-05 17:22:25 +000042806#define gen_nb_xmlXPathCompExprPtr 1
42807static xmlXPathCompExprPtr gen_xmlXPathCompExprPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
42808 return(NULL);
42809}
42810static void des_xmlXPathCompExprPtr(int no ATTRIBUTE_UNUSED, xmlXPathCompExprPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
42811}
Daniel Veillarda521d282004-11-09 14:59:59 +000042812#endif
42813
42814#ifdef LIBXML_XPATH_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000042815
42816#define gen_nb_xmlXPathContextPtr 1
42817static xmlXPathContextPtr gen_xmlXPathContextPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
42818 return(NULL);
42819}
42820static void des_xmlXPathContextPtr(int no ATTRIBUTE_UNUSED, xmlXPathContextPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
42821}
Daniel Veillarda521d282004-11-09 14:59:59 +000042822#endif
42823
Daniel Veillardce682bc2004-11-05 17:22:25 +000042824
Daniel Veillardd93f6252004-11-02 15:53:51 +000042825static int
42826test_xmlXPathCompiledEval(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042827 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042828
Daniel Veillardce682bc2004-11-05 17:22:25 +000042829#ifdef LIBXML_XPATH_ENABLED
42830 int mem_base;
42831 xmlXPathObjectPtr ret_val;
42832 xmlXPathCompExprPtr comp; /* the compiled XPath expression */
42833 int n_comp;
42834 xmlXPathContextPtr ctx; /* the XPath context */
42835 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042836
Daniel Veillardce682bc2004-11-05 17:22:25 +000042837 for (n_comp = 0;n_comp < gen_nb_xmlXPathCompExprPtr;n_comp++) {
42838 for (n_ctx = 0;n_ctx < gen_nb_xmlXPathContextPtr;n_ctx++) {
42839 mem_base = xmlMemBlocks();
42840 comp = gen_xmlXPathCompExprPtr(n_comp, 0);
42841 ctx = gen_xmlXPathContextPtr(n_ctx, 1);
42842
42843 ret_val = xmlXPathCompiledEval(comp, ctx);
42844 desret_xmlXPathObjectPtr(ret_val);
42845 call_tests++;
42846 des_xmlXPathCompExprPtr(n_comp, comp, 0);
42847 des_xmlXPathContextPtr(n_ctx, ctx, 1);
42848 xmlResetLastError();
42849 if (mem_base != xmlMemBlocks()) {
42850 printf("Leak of %d blocks found in xmlXPathCompiledEval",
42851 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042852 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042853 printf(" %d", n_comp);
42854 printf(" %d", n_ctx);
42855 printf("\n");
42856 }
42857 }
42858 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042859 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042860#endif
42861
Daniel Veillard42595322004-11-08 10:52:06 +000042862 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042863}
42864
42865
42866static int
42867test_xmlXPathConvertBoolean(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042868 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042869
Daniel Veillard3d97e662004-11-04 10:49:00 +000042870#ifdef LIBXML_XPATH_ENABLED
42871 int mem_base;
42872 xmlXPathObjectPtr ret_val;
42873 xmlXPathObjectPtr val; /* an XPath object */
42874 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042875
Daniel Veillard3d97e662004-11-04 10:49:00 +000042876 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
42877 mem_base = xmlMemBlocks();
42878 val = gen_xmlXPathObjectPtr(n_val, 0);
42879
42880 ret_val = xmlXPathConvertBoolean(val);
42881 val = NULL;
42882 desret_xmlXPathObjectPtr(ret_val);
42883 call_tests++;
42884 des_xmlXPathObjectPtr(n_val, val, 0);
42885 xmlResetLastError();
42886 if (mem_base != xmlMemBlocks()) {
42887 printf("Leak of %d blocks found in xmlXPathConvertBoolean",
42888 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042889 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042890 printf(" %d", n_val);
42891 printf("\n");
42892 }
42893 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042894 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042895#endif
42896
Daniel Veillard42595322004-11-08 10:52:06 +000042897 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042898}
42899
42900
42901static int
42902test_xmlXPathConvertNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042903 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042904
Daniel Veillard3d97e662004-11-04 10:49:00 +000042905#ifdef LIBXML_XPATH_ENABLED
42906 int mem_base;
42907 xmlXPathObjectPtr ret_val;
42908 xmlXPathObjectPtr val; /* an XPath object */
42909 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042910
Daniel Veillard3d97e662004-11-04 10:49:00 +000042911 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
42912 mem_base = xmlMemBlocks();
42913 val = gen_xmlXPathObjectPtr(n_val, 0);
42914
42915 ret_val = xmlXPathConvertNumber(val);
42916 val = NULL;
42917 desret_xmlXPathObjectPtr(ret_val);
42918 call_tests++;
42919 des_xmlXPathObjectPtr(n_val, val, 0);
42920 xmlResetLastError();
42921 if (mem_base != xmlMemBlocks()) {
42922 printf("Leak of %d blocks found in xmlXPathConvertNumber",
42923 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042924 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042925 printf(" %d", n_val);
42926 printf("\n");
42927 }
42928 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042929 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042930#endif
42931
Daniel Veillard42595322004-11-08 10:52:06 +000042932 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042933}
42934
42935
42936static int
42937test_xmlXPathConvertString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042938 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042939
Daniel Veillard3d97e662004-11-04 10:49:00 +000042940#ifdef LIBXML_XPATH_ENABLED
42941 int mem_base;
42942 xmlXPathObjectPtr ret_val;
42943 xmlXPathObjectPtr val; /* an XPath object */
42944 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042945
Daniel Veillard3d97e662004-11-04 10:49:00 +000042946 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
42947 mem_base = xmlMemBlocks();
42948 val = gen_xmlXPathObjectPtr(n_val, 0);
42949
42950 ret_val = xmlXPathConvertString(val);
42951 val = NULL;
42952 desret_xmlXPathObjectPtr(ret_val);
42953 call_tests++;
42954 des_xmlXPathObjectPtr(n_val, val, 0);
42955 xmlResetLastError();
42956 if (mem_base != xmlMemBlocks()) {
42957 printf("Leak of %d blocks found in xmlXPathConvertString",
42958 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042959 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042960 printf(" %d", n_val);
42961 printf("\n");
42962 }
42963 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042964 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042965#endif
42966
Daniel Veillard42595322004-11-08 10:52:06 +000042967 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042968}
42969
42970
42971static int
42972test_xmlXPathCtxtCompile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042973 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042974
42975
42976 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042977 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042978}
42979
42980
42981static int
42982test_xmlXPathEval(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042983 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042984
Daniel Veillardce682bc2004-11-05 17:22:25 +000042985#ifdef LIBXML_XPATH_ENABLED
42986 int mem_base;
42987 xmlXPathObjectPtr ret_val;
42988 xmlChar * str; /* the XPath expression */
42989 int n_str;
42990 xmlXPathContextPtr ctx; /* the XPath context */
42991 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042992
Daniel Veillardce682bc2004-11-05 17:22:25 +000042993 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
42994 for (n_ctx = 0;n_ctx < gen_nb_xmlXPathContextPtr;n_ctx++) {
42995 mem_base = xmlMemBlocks();
42996 str = gen_const_xmlChar_ptr(n_str, 0);
42997 ctx = gen_xmlXPathContextPtr(n_ctx, 1);
42998
William M. Brackf13f77f2004-11-12 16:03:48 +000042999 ret_val = xmlXPathEval((const xmlChar *)str, ctx);
Daniel Veillardce682bc2004-11-05 17:22:25 +000043000 desret_xmlXPathObjectPtr(ret_val);
43001 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000043002 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000043003 des_xmlXPathContextPtr(n_ctx, ctx, 1);
43004 xmlResetLastError();
43005 if (mem_base != xmlMemBlocks()) {
43006 printf("Leak of %d blocks found in xmlXPathEval",
43007 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043008 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043009 printf(" %d", n_str);
43010 printf(" %d", n_ctx);
43011 printf("\n");
43012 }
43013 }
43014 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043015 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043016#endif
43017
Daniel Veillard42595322004-11-08 10:52:06 +000043018 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043019}
43020
43021
43022static int
43023test_xmlXPathEvalExpression(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043024 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043025
Daniel Veillardce682bc2004-11-05 17:22:25 +000043026#ifdef LIBXML_XPATH_ENABLED
43027 int mem_base;
43028 xmlXPathObjectPtr ret_val;
43029 xmlChar * str; /* the XPath expression */
43030 int n_str;
43031 xmlXPathContextPtr ctxt; /* the XPath context */
43032 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043033
Daniel Veillardce682bc2004-11-05 17:22:25 +000043034 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
43035 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
43036 mem_base = xmlMemBlocks();
43037 str = gen_const_xmlChar_ptr(n_str, 0);
43038 ctxt = gen_xmlXPathContextPtr(n_ctxt, 1);
43039
William M. Brackf13f77f2004-11-12 16:03:48 +000043040 ret_val = xmlXPathEvalExpression((const xmlChar *)str, ctxt);
Daniel Veillardce682bc2004-11-05 17:22:25 +000043041 desret_xmlXPathObjectPtr(ret_val);
43042 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000043043 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000043044 des_xmlXPathContextPtr(n_ctxt, ctxt, 1);
43045 xmlResetLastError();
43046 if (mem_base != xmlMemBlocks()) {
43047 printf("Leak of %d blocks found in xmlXPathEvalExpression",
43048 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043049 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043050 printf(" %d", n_str);
43051 printf(" %d", n_ctxt);
43052 printf("\n");
43053 }
43054 }
43055 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043056 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043057#endif
43058
Daniel Veillard42595322004-11-08 10:52:06 +000043059 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043060}
43061
43062
43063static int
43064test_xmlXPathEvalPredicate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043065 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043066
Daniel Veillardce682bc2004-11-05 17:22:25 +000043067#ifdef LIBXML_XPATH_ENABLED
43068 int mem_base;
43069 int ret_val;
43070 xmlXPathContextPtr ctxt; /* the XPath context */
43071 int n_ctxt;
43072 xmlXPathObjectPtr res; /* the Predicate Expression evaluation result */
43073 int n_res;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043074
Daniel Veillardce682bc2004-11-05 17:22:25 +000043075 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
43076 for (n_res = 0;n_res < gen_nb_xmlXPathObjectPtr;n_res++) {
43077 mem_base = xmlMemBlocks();
43078 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
43079 res = gen_xmlXPathObjectPtr(n_res, 1);
43080
43081 ret_val = xmlXPathEvalPredicate(ctxt, res);
43082 desret_int(ret_val);
43083 call_tests++;
43084 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
43085 des_xmlXPathObjectPtr(n_res, res, 1);
43086 xmlResetLastError();
43087 if (mem_base != xmlMemBlocks()) {
43088 printf("Leak of %d blocks found in xmlXPathEvalPredicate",
43089 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043090 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043091 printf(" %d", n_ctxt);
43092 printf(" %d", n_res);
43093 printf("\n");
43094 }
43095 }
43096 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043097 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043098#endif
43099
Daniel Veillard42595322004-11-08 10:52:06 +000043100 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043101}
43102
43103
43104static int
43105test_xmlXPathInit(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043106 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043107
43108#ifdef LIBXML_XPATH_ENABLED
43109 int mem_base;
43110
43111 mem_base = xmlMemBlocks();
43112
43113 xmlXPathInit();
43114 call_tests++;
43115 xmlResetLastError();
43116 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000043117 printf("Leak of %d blocks found in xmlXPathInit",
Daniel Veillardd93f6252004-11-02 15:53:51 +000043118 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043119 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000043120 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000043121 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043122 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043123#endif
43124
Daniel Veillard42595322004-11-08 10:52:06 +000043125 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043126}
43127
43128
43129static int
43130test_xmlXPathIsInf(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043131 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043132
Daniel Veillard3d95c732004-11-06 22:25:14 +000043133#ifdef LIBXML_XPATH_ENABLED
43134 int mem_base;
43135 int ret_val;
43136 double val; /* a double value */
43137 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043138
Daniel Veillard3d95c732004-11-06 22:25:14 +000043139 for (n_val = 0;n_val < gen_nb_double;n_val++) {
43140 mem_base = xmlMemBlocks();
43141 val = gen_double(n_val, 0);
43142
43143 ret_val = xmlXPathIsInf(val);
43144 desret_int(ret_val);
43145 call_tests++;
43146 des_double(n_val, val, 0);
43147 xmlResetLastError();
43148 if (mem_base != xmlMemBlocks()) {
43149 printf("Leak of %d blocks found in xmlXPathIsInf",
43150 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043151 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000043152 printf(" %d", n_val);
43153 printf("\n");
43154 }
43155 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043156 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000043157#endif
43158
Daniel Veillard42595322004-11-08 10:52:06 +000043159 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043160}
43161
43162
43163static int
43164test_xmlXPathIsNaN(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043165 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043166
Daniel Veillard3d95c732004-11-06 22:25:14 +000043167#ifdef LIBXML_XPATH_ENABLED
43168 int mem_base;
43169 int ret_val;
43170 double val; /* a double value */
43171 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043172
Daniel Veillard3d95c732004-11-06 22:25:14 +000043173 for (n_val = 0;n_val < gen_nb_double;n_val++) {
43174 mem_base = xmlMemBlocks();
43175 val = gen_double(n_val, 0);
43176
43177 ret_val = xmlXPathIsNaN(val);
43178 desret_int(ret_val);
43179 call_tests++;
43180 des_double(n_val, val, 0);
43181 xmlResetLastError();
43182 if (mem_base != xmlMemBlocks()) {
43183 printf("Leak of %d blocks found in xmlXPathIsNaN",
43184 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043185 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000043186 printf(" %d", n_val);
43187 printf("\n");
43188 }
43189 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043190 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000043191#endif
43192
Daniel Veillard42595322004-11-08 10:52:06 +000043193 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043194}
43195
43196
43197static int
43198test_xmlXPathNewContext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043199 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043200
43201
43202 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000043203 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043204}
43205
43206
43207static int
43208test_xmlXPathNodeSetCreate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043209 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043210
Daniel Veillardf2a36f92004-11-08 17:55:01 +000043211#ifdef LIBXML_XPATH_ENABLED
43212 int mem_base;
43213 xmlNodeSetPtr ret_val;
43214 xmlNodePtr val; /* an initial xmlNodePtr, or NULL */
43215 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043216
Daniel Veillardf2a36f92004-11-08 17:55:01 +000043217 for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
43218 mem_base = xmlMemBlocks();
43219 val = gen_xmlNodePtr(n_val, 0);
43220
43221 ret_val = xmlXPathNodeSetCreate(val);
43222 desret_xmlNodeSetPtr(ret_val);
43223 call_tests++;
43224 des_xmlNodePtr(n_val, val, 0);
43225 xmlResetLastError();
43226 if (mem_base != xmlMemBlocks()) {
43227 printf("Leak of %d blocks found in xmlXPathNodeSetCreate",
43228 xmlMemBlocks() - mem_base);
43229 test_ret++;
43230 printf(" %d", n_val);
43231 printf("\n");
43232 }
43233 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043234 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000043235#endif
43236
Daniel Veillard42595322004-11-08 10:52:06 +000043237 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043238}
43239
43240
43241static int
43242test_xmlXPathObjectCopy(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043243 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043244
Daniel Veillard3d97e662004-11-04 10:49:00 +000043245#ifdef LIBXML_XPATH_ENABLED
43246 int mem_base;
43247 xmlXPathObjectPtr ret_val;
43248 xmlXPathObjectPtr val; /* the original object */
43249 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043250
Daniel Veillard3d97e662004-11-04 10:49:00 +000043251 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
43252 mem_base = xmlMemBlocks();
43253 val = gen_xmlXPathObjectPtr(n_val, 0);
43254
43255 ret_val = xmlXPathObjectCopy(val);
43256 desret_xmlXPathObjectPtr(ret_val);
43257 call_tests++;
43258 des_xmlXPathObjectPtr(n_val, val, 0);
43259 xmlResetLastError();
43260 if (mem_base != xmlMemBlocks()) {
43261 printf("Leak of %d blocks found in xmlXPathObjectCopy",
43262 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043263 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043264 printf(" %d", n_val);
43265 printf("\n");
43266 }
43267 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043268 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043269#endif
43270
Daniel Veillard42595322004-11-08 10:52:06 +000043271 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043272}
43273
43274
43275static int
43276test_xmlXPathOrderDocElems(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043277 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043278
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043279#ifdef LIBXML_XPATH_ENABLED
43280 int mem_base;
43281 long ret_val;
43282 xmlDocPtr doc; /* an input document */
43283 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043284
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043285 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
43286 mem_base = xmlMemBlocks();
43287 doc = gen_xmlDocPtr(n_doc, 0);
43288
43289 ret_val = xmlXPathOrderDocElems(doc);
43290 desret_long(ret_val);
43291 call_tests++;
43292 des_xmlDocPtr(n_doc, doc, 0);
43293 xmlResetLastError();
43294 if (mem_base != xmlMemBlocks()) {
43295 printf("Leak of %d blocks found in xmlXPathOrderDocElems",
43296 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043297 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043298 printf(" %d", n_doc);
43299 printf("\n");
43300 }
43301 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043302 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043303#endif
43304
Daniel Veillard42595322004-11-08 10:52:06 +000043305 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043306}
43307
43308static int
43309test_xpath(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043310 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043311
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043312 if (quiet == 0) printf("Testing xpath : 28 of 36 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000043313 test_ret += test_xmlXPathCastBooleanToNumber();
43314 test_ret += test_xmlXPathCastBooleanToString();
43315 test_ret += test_xmlXPathCastNodeSetToBoolean();
43316 test_ret += test_xmlXPathCastNodeSetToNumber();
43317 test_ret += test_xmlXPathCastNodeSetToString();
43318 test_ret += test_xmlXPathCastNodeToNumber();
43319 test_ret += test_xmlXPathCastNodeToString();
43320 test_ret += test_xmlXPathCastNumberToBoolean();
43321 test_ret += test_xmlXPathCastNumberToString();
43322 test_ret += test_xmlXPathCastStringToBoolean();
43323 test_ret += test_xmlXPathCastStringToNumber();
43324 test_ret += test_xmlXPathCastToBoolean();
43325 test_ret += test_xmlXPathCastToNumber();
43326 test_ret += test_xmlXPathCastToString();
43327 test_ret += test_xmlXPathCmpNodes();
43328 test_ret += test_xmlXPathCompile();
43329 test_ret += test_xmlXPathCompiledEval();
43330 test_ret += test_xmlXPathConvertBoolean();
43331 test_ret += test_xmlXPathConvertNumber();
43332 test_ret += test_xmlXPathConvertString();
43333 test_ret += test_xmlXPathCtxtCompile();
43334 test_ret += test_xmlXPathEval();
43335 test_ret += test_xmlXPathEvalExpression();
43336 test_ret += test_xmlXPathEvalPredicate();
43337 test_ret += test_xmlXPathInit();
43338 test_ret += test_xmlXPathIsInf();
43339 test_ret += test_xmlXPathIsNaN();
43340 test_ret += test_xmlXPathNewContext();
43341 test_ret += test_xmlXPathNodeSetCreate();
43342 test_ret += test_xmlXPathObjectCopy();
43343 test_ret += test_xmlXPathOrderDocElems();
Daniel Veillardd93f6252004-11-02 15:53:51 +000043344
Daniel Veillard42595322004-11-08 10:52:06 +000043345 if (test_ret != 0)
43346 printf("Module xpath: %d errors\n", test_ret);
43347 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043348}
Daniel Veillarda521d282004-11-09 14:59:59 +000043349#ifdef LIBXML_XPATH_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000043350
Daniel Veillarda82b1822004-11-08 16:24:57 +000043351#define gen_nb_xmlXPathParserContextPtr 1
43352static xmlXPathParserContextPtr gen_xmlXPathParserContextPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
43353 return(NULL);
43354}
43355static void des_xmlXPathParserContextPtr(int no ATTRIBUTE_UNUSED, xmlXPathParserContextPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
43356}
Daniel Veillarda521d282004-11-09 14:59:59 +000043357#endif
43358
Daniel Veillarda82b1822004-11-08 16:24:57 +000043359
43360static int
43361test_valuePop(void) {
43362 int test_ret = 0;
43363
43364#ifdef LIBXML_XPATH_ENABLED
43365 int mem_base;
43366 xmlXPathObjectPtr ret_val;
43367 xmlXPathParserContextPtr ctxt; /* an XPath evaluation context */
43368 int n_ctxt;
43369
43370 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43371 mem_base = xmlMemBlocks();
43372 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43373
43374 ret_val = valuePop(ctxt);
43375 desret_xmlXPathObjectPtr(ret_val);
43376 call_tests++;
43377 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43378 xmlResetLastError();
43379 if (mem_base != xmlMemBlocks()) {
43380 printf("Leak of %d blocks found in valuePop",
43381 xmlMemBlocks() - mem_base);
43382 test_ret++;
43383 printf(" %d", n_ctxt);
43384 printf("\n");
43385 }
43386 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043387 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000043388#endif
43389
Daniel Veillarda82b1822004-11-08 16:24:57 +000043390 return(test_ret);
43391}
43392
43393
43394static int
43395test_valuePush(void) {
43396 int test_ret = 0;
43397
43398#ifdef LIBXML_XPATH_ENABLED
43399 int mem_base;
43400 int ret_val;
43401 xmlXPathParserContextPtr ctxt; /* an XPath evaluation context */
43402 int n_ctxt;
43403 xmlXPathObjectPtr value; /* the XPath object */
43404 int n_value;
43405
43406 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43407 for (n_value = 0;n_value < gen_nb_xmlXPathObjectPtr;n_value++) {
43408 mem_base = xmlMemBlocks();
43409 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43410 value = gen_xmlXPathObjectPtr(n_value, 1);
43411
43412 ret_val = valuePush(ctxt, value);
43413 desret_int(ret_val);
43414 call_tests++;
43415 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43416 des_xmlXPathObjectPtr(n_value, value, 1);
43417 xmlResetLastError();
43418 if (mem_base != xmlMemBlocks()) {
43419 printf("Leak of %d blocks found in valuePush",
43420 xmlMemBlocks() - mem_base);
43421 test_ret++;
43422 printf(" %d", n_ctxt);
43423 printf(" %d", n_value);
43424 printf("\n");
43425 }
43426 }
43427 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043428 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000043429#endif
43430
Daniel Veillarda82b1822004-11-08 16:24:57 +000043431 return(test_ret);
43432}
43433
43434
43435static int
43436test_xmlXPathAddValues(void) {
43437 int test_ret = 0;
43438
43439#ifdef LIBXML_XPATH_ENABLED
43440 int mem_base;
43441 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
43442 int n_ctxt;
43443
43444 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43445 mem_base = xmlMemBlocks();
43446 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43447
43448 xmlXPathAddValues(ctxt);
43449 call_tests++;
43450 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43451 xmlResetLastError();
43452 if (mem_base != xmlMemBlocks()) {
43453 printf("Leak of %d blocks found in xmlXPathAddValues",
43454 xmlMemBlocks() - mem_base);
43455 test_ret++;
43456 printf(" %d", n_ctxt);
43457 printf("\n");
43458 }
43459 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043460 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000043461#endif
43462
Daniel Veillarda82b1822004-11-08 16:24:57 +000043463 return(test_ret);
43464}
43465
43466
43467static int
43468test_xmlXPathBooleanFunction(void) {
43469 int test_ret = 0;
43470
43471#ifdef LIBXML_XPATH_ENABLED
43472 int mem_base;
43473 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
43474 int n_ctxt;
43475 int nargs; /* the number of arguments */
43476 int n_nargs;
43477
43478 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43479 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
43480 mem_base = xmlMemBlocks();
43481 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43482 nargs = gen_int(n_nargs, 1);
43483
43484 xmlXPathBooleanFunction(ctxt, nargs);
43485 call_tests++;
43486 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43487 des_int(n_nargs, nargs, 1);
43488 xmlResetLastError();
43489 if (mem_base != xmlMemBlocks()) {
43490 printf("Leak of %d blocks found in xmlXPathBooleanFunction",
43491 xmlMemBlocks() - mem_base);
43492 test_ret++;
43493 printf(" %d", n_ctxt);
43494 printf(" %d", n_nargs);
43495 printf("\n");
43496 }
43497 }
43498 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043499 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000043500#endif
43501
Daniel Veillarda82b1822004-11-08 16:24:57 +000043502 return(test_ret);
43503}
43504
43505
43506static int
43507test_xmlXPathCeilingFunction(void) {
43508 int test_ret = 0;
43509
43510#ifdef LIBXML_XPATH_ENABLED
43511 int mem_base;
43512 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
43513 int n_ctxt;
43514 int nargs; /* the number of arguments */
43515 int n_nargs;
43516
43517 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43518 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
43519 mem_base = xmlMemBlocks();
43520 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43521 nargs = gen_int(n_nargs, 1);
43522
43523 xmlXPathCeilingFunction(ctxt, nargs);
43524 call_tests++;
43525 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43526 des_int(n_nargs, nargs, 1);
43527 xmlResetLastError();
43528 if (mem_base != xmlMemBlocks()) {
43529 printf("Leak of %d blocks found in xmlXPathCeilingFunction",
43530 xmlMemBlocks() - mem_base);
43531 test_ret++;
43532 printf(" %d", n_ctxt);
43533 printf(" %d", n_nargs);
43534 printf("\n");
43535 }
43536 }
43537 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043538 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000043539#endif
43540
Daniel Veillarda82b1822004-11-08 16:24:57 +000043541 return(test_ret);
43542}
43543
43544
43545static int
43546test_xmlXPathCompareValues(void) {
43547 int test_ret = 0;
43548
43549#ifdef LIBXML_XPATH_ENABLED
43550 int mem_base;
43551 int ret_val;
43552 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
43553 int n_ctxt;
43554 int inf; /* less than (1) or greater than (0) */
43555 int n_inf;
43556 int strict; /* is the comparison strict */
43557 int n_strict;
43558
43559 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43560 for (n_inf = 0;n_inf < gen_nb_int;n_inf++) {
43561 for (n_strict = 0;n_strict < gen_nb_int;n_strict++) {
43562 mem_base = xmlMemBlocks();
43563 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43564 inf = gen_int(n_inf, 1);
43565 strict = gen_int(n_strict, 2);
43566
43567 ret_val = xmlXPathCompareValues(ctxt, inf, strict);
43568 desret_int(ret_val);
43569 call_tests++;
43570 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43571 des_int(n_inf, inf, 1);
43572 des_int(n_strict, strict, 2);
43573 xmlResetLastError();
43574 if (mem_base != xmlMemBlocks()) {
43575 printf("Leak of %d blocks found in xmlXPathCompareValues",
43576 xmlMemBlocks() - mem_base);
43577 test_ret++;
43578 printf(" %d", n_ctxt);
43579 printf(" %d", n_inf);
43580 printf(" %d", n_strict);
43581 printf("\n");
43582 }
43583 }
43584 }
43585 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043586 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000043587#endif
43588
Daniel Veillarda82b1822004-11-08 16:24:57 +000043589 return(test_ret);
43590}
43591
43592
43593static int
43594test_xmlXPathConcatFunction(void) {
43595 int test_ret = 0;
43596
43597#ifdef LIBXML_XPATH_ENABLED
43598 int mem_base;
43599 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
43600 int n_ctxt;
43601 int nargs; /* the number of arguments */
43602 int n_nargs;
43603
43604 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43605 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
43606 mem_base = xmlMemBlocks();
43607 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43608 nargs = gen_int(n_nargs, 1);
43609
43610 xmlXPathConcatFunction(ctxt, nargs);
43611 call_tests++;
43612 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43613 des_int(n_nargs, nargs, 1);
43614 xmlResetLastError();
43615 if (mem_base != xmlMemBlocks()) {
43616 printf("Leak of %d blocks found in xmlXPathConcatFunction",
43617 xmlMemBlocks() - mem_base);
43618 test_ret++;
43619 printf(" %d", n_ctxt);
43620 printf(" %d", n_nargs);
43621 printf("\n");
43622 }
43623 }
43624 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043625 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000043626#endif
43627
Daniel Veillarda82b1822004-11-08 16:24:57 +000043628 return(test_ret);
43629}
43630
43631
43632static int
43633test_xmlXPathContainsFunction(void) {
43634 int test_ret = 0;
43635
43636#ifdef LIBXML_XPATH_ENABLED
43637 int mem_base;
43638 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
43639 int n_ctxt;
43640 int nargs; /* the number of arguments */
43641 int n_nargs;
43642
43643 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43644 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
43645 mem_base = xmlMemBlocks();
43646 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43647 nargs = gen_int(n_nargs, 1);
43648
43649 xmlXPathContainsFunction(ctxt, nargs);
43650 call_tests++;
43651 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43652 des_int(n_nargs, nargs, 1);
43653 xmlResetLastError();
43654 if (mem_base != xmlMemBlocks()) {
43655 printf("Leak of %d blocks found in xmlXPathContainsFunction",
43656 xmlMemBlocks() - mem_base);
43657 test_ret++;
43658 printf(" %d", n_ctxt);
43659 printf(" %d", n_nargs);
43660 printf("\n");
43661 }
43662 }
43663 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043664 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000043665#endif
43666
Daniel Veillarda82b1822004-11-08 16:24:57 +000043667 return(test_ret);
43668}
43669
43670
43671static int
43672test_xmlXPathCountFunction(void) {
43673 int test_ret = 0;
43674
43675#ifdef LIBXML_XPATH_ENABLED
43676 int mem_base;
43677 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
43678 int n_ctxt;
43679 int nargs; /* the number of arguments */
43680 int n_nargs;
43681
43682 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43683 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
43684 mem_base = xmlMemBlocks();
43685 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43686 nargs = gen_int(n_nargs, 1);
43687
43688 xmlXPathCountFunction(ctxt, nargs);
43689 call_tests++;
43690 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43691 des_int(n_nargs, nargs, 1);
43692 xmlResetLastError();
43693 if (mem_base != xmlMemBlocks()) {
43694 printf("Leak of %d blocks found in xmlXPathCountFunction",
43695 xmlMemBlocks() - mem_base);
43696 test_ret++;
43697 printf(" %d", n_ctxt);
43698 printf(" %d", n_nargs);
43699 printf("\n");
43700 }
43701 }
43702 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043703 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000043704#endif
43705
Daniel Veillarda82b1822004-11-08 16:24:57 +000043706 return(test_ret);
43707}
43708
43709
43710static int
43711test_xmlXPathDebugDumpCompExpr(void) {
43712 int test_ret = 0;
43713
43714#ifdef LIBXML_XPATH_ENABLED
43715#ifdef LIBXML_DEBUG_ENABLED
43716 int mem_base;
43717 FILE * output; /* the FILE * for the output */
43718 int n_output;
43719 xmlXPathCompExprPtr comp; /* the precompiled XPath expression */
43720 int n_comp;
43721 int depth; /* the indentation level. */
43722 int n_depth;
43723
43724 for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
43725 for (n_comp = 0;n_comp < gen_nb_xmlXPathCompExprPtr;n_comp++) {
43726 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
43727 mem_base = xmlMemBlocks();
43728 output = gen_FILE_ptr(n_output, 0);
43729 comp = gen_xmlXPathCompExprPtr(n_comp, 1);
43730 depth = gen_int(n_depth, 2);
43731
43732 xmlXPathDebugDumpCompExpr(output, comp, depth);
43733 call_tests++;
43734 des_FILE_ptr(n_output, output, 0);
43735 des_xmlXPathCompExprPtr(n_comp, comp, 1);
43736 des_int(n_depth, depth, 2);
43737 xmlResetLastError();
43738 if (mem_base != xmlMemBlocks()) {
43739 printf("Leak of %d blocks found in xmlXPathDebugDumpCompExpr",
43740 xmlMemBlocks() - mem_base);
43741 test_ret++;
43742 printf(" %d", n_output);
43743 printf(" %d", n_comp);
43744 printf(" %d", n_depth);
43745 printf("\n");
43746 }
43747 }
43748 }
43749 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043750 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000043751#endif
43752#endif
43753
Daniel Veillarda82b1822004-11-08 16:24:57 +000043754 return(test_ret);
43755}
43756
43757
43758static int
43759test_xmlXPathDebugDumpObject(void) {
43760 int test_ret = 0;
43761
43762#ifdef LIBXML_XPATH_ENABLED
43763#ifdef LIBXML_DEBUG_ENABLED
43764 int mem_base;
43765 FILE * output; /* the FILE * to dump the output */
43766 int n_output;
43767 xmlXPathObjectPtr cur; /* the object to inspect */
43768 int n_cur;
43769 int depth; /* indentation level */
43770 int n_depth;
43771
43772 for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
43773 for (n_cur = 0;n_cur < gen_nb_xmlXPathObjectPtr;n_cur++) {
43774 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
43775 mem_base = xmlMemBlocks();
43776 output = gen_FILE_ptr(n_output, 0);
43777 cur = gen_xmlXPathObjectPtr(n_cur, 1);
43778 depth = gen_int(n_depth, 2);
43779
43780 xmlXPathDebugDumpObject(output, cur, depth);
43781 call_tests++;
43782 des_FILE_ptr(n_output, output, 0);
43783 des_xmlXPathObjectPtr(n_cur, cur, 1);
43784 des_int(n_depth, depth, 2);
43785 xmlResetLastError();
43786 if (mem_base != xmlMemBlocks()) {
43787 printf("Leak of %d blocks found in xmlXPathDebugDumpObject",
43788 xmlMemBlocks() - mem_base);
43789 test_ret++;
43790 printf(" %d", n_output);
43791 printf(" %d", n_cur);
43792 printf(" %d", n_depth);
43793 printf("\n");
43794 }
43795 }
43796 }
43797 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043798 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000043799#endif
43800#endif
43801
Daniel Veillarda82b1822004-11-08 16:24:57 +000043802 return(test_ret);
43803}
43804
43805
43806static int
43807test_xmlXPathDifference(void) {
43808 int test_ret = 0;
43809
Daniel Veillardf2a36f92004-11-08 17:55:01 +000043810#ifdef LIBXML_XPATH_ENABLED
43811 int mem_base;
43812 xmlNodeSetPtr ret_val;
43813 xmlNodeSetPtr nodes1; /* a node-set */
43814 int n_nodes1;
43815 xmlNodeSetPtr nodes2; /* a node-set */
43816 int n_nodes2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000043817
Daniel Veillardf2a36f92004-11-08 17:55:01 +000043818 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
43819 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
43820 mem_base = xmlMemBlocks();
43821 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
43822 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
43823
43824 ret_val = xmlXPathDifference(nodes1, nodes2);
43825 desret_xmlNodeSetPtr(ret_val);
43826 call_tests++;
43827 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
43828 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
43829 xmlResetLastError();
43830 if (mem_base != xmlMemBlocks()) {
43831 printf("Leak of %d blocks found in xmlXPathDifference",
43832 xmlMemBlocks() - mem_base);
43833 test_ret++;
43834 printf(" %d", n_nodes1);
43835 printf(" %d", n_nodes2);
43836 printf("\n");
43837 }
43838 }
43839 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043840 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000043841#endif
43842
Daniel Veillarda82b1822004-11-08 16:24:57 +000043843 return(test_ret);
43844}
43845
43846
43847static int
43848test_xmlXPathDistinct(void) {
43849 int test_ret = 0;
43850
Daniel Veillardf2a36f92004-11-08 17:55:01 +000043851#ifdef LIBXML_XPATH_ENABLED
43852 int mem_base;
43853 xmlNodeSetPtr ret_val;
43854 xmlNodeSetPtr nodes; /* a node-set */
43855 int n_nodes;
Daniel Veillarda82b1822004-11-08 16:24:57 +000043856
Daniel Veillardf2a36f92004-11-08 17:55:01 +000043857 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
43858 mem_base = xmlMemBlocks();
43859 nodes = gen_xmlNodeSetPtr(n_nodes, 0);
43860
43861 ret_val = xmlXPathDistinct(nodes);
43862 desret_xmlNodeSetPtr(ret_val);
43863 call_tests++;
43864 des_xmlNodeSetPtr(n_nodes, nodes, 0);
43865 xmlResetLastError();
43866 if (mem_base != xmlMemBlocks()) {
43867 printf("Leak of %d blocks found in xmlXPathDistinct",
43868 xmlMemBlocks() - mem_base);
43869 test_ret++;
43870 printf(" %d", n_nodes);
43871 printf("\n");
43872 }
43873 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043874 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000043875#endif
43876
Daniel Veillarda82b1822004-11-08 16:24:57 +000043877 return(test_ret);
43878}
43879
43880
43881static int
43882test_xmlXPathDistinctSorted(void) {
43883 int test_ret = 0;
43884
Daniel Veillardf2a36f92004-11-08 17:55:01 +000043885#ifdef LIBXML_XPATH_ENABLED
43886 int mem_base;
43887 xmlNodeSetPtr ret_val;
43888 xmlNodeSetPtr nodes; /* a node-set, sorted by document order */
43889 int n_nodes;
Daniel Veillarda82b1822004-11-08 16:24:57 +000043890
Daniel Veillardf2a36f92004-11-08 17:55:01 +000043891 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
43892 mem_base = xmlMemBlocks();
43893 nodes = gen_xmlNodeSetPtr(n_nodes, 0);
43894
43895 ret_val = xmlXPathDistinctSorted(nodes);
43896 desret_xmlNodeSetPtr(ret_val);
43897 call_tests++;
43898 des_xmlNodeSetPtr(n_nodes, nodes, 0);
43899 xmlResetLastError();
43900 if (mem_base != xmlMemBlocks()) {
43901 printf("Leak of %d blocks found in xmlXPathDistinctSorted",
43902 xmlMemBlocks() - mem_base);
43903 test_ret++;
43904 printf(" %d", n_nodes);
43905 printf("\n");
43906 }
43907 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043908 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000043909#endif
43910
Daniel Veillarda82b1822004-11-08 16:24:57 +000043911 return(test_ret);
43912}
43913
43914
43915static int
43916test_xmlXPathDivValues(void) {
43917 int test_ret = 0;
43918
43919#ifdef LIBXML_XPATH_ENABLED
43920 int mem_base;
43921 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
43922 int n_ctxt;
43923
43924 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43925 mem_base = xmlMemBlocks();
43926 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43927
43928 xmlXPathDivValues(ctxt);
43929 call_tests++;
43930 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43931 xmlResetLastError();
43932 if (mem_base != xmlMemBlocks()) {
43933 printf("Leak of %d blocks found in xmlXPathDivValues",
43934 xmlMemBlocks() - mem_base);
43935 test_ret++;
43936 printf(" %d", n_ctxt);
43937 printf("\n");
43938 }
43939 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043940 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000043941#endif
43942
Daniel Veillarda82b1822004-11-08 16:24:57 +000043943 return(test_ret);
43944}
43945
43946
43947static int
43948test_xmlXPathEqualValues(void) {
43949 int test_ret = 0;
43950
43951#ifdef LIBXML_XPATH_ENABLED
43952 int mem_base;
43953 int ret_val;
43954 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
43955 int n_ctxt;
43956
43957 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43958 mem_base = xmlMemBlocks();
43959 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43960
43961 ret_val = xmlXPathEqualValues(ctxt);
43962 desret_int(ret_val);
43963 call_tests++;
43964 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43965 xmlResetLastError();
43966 if (mem_base != xmlMemBlocks()) {
43967 printf("Leak of %d blocks found in xmlXPathEqualValues",
43968 xmlMemBlocks() - mem_base);
43969 test_ret++;
43970 printf(" %d", n_ctxt);
43971 printf("\n");
43972 }
43973 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043974 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000043975#endif
43976
Daniel Veillarda82b1822004-11-08 16:24:57 +000043977 return(test_ret);
43978}
43979
43980
43981static int
43982test_xmlXPathErr(void) {
43983 int test_ret = 0;
43984
43985#ifdef LIBXML_XPATH_ENABLED
43986 int mem_base;
43987 xmlXPathParserContextPtr ctxt; /* a XPath parser context */
43988 int n_ctxt;
43989 int error; /* the error code */
43990 int n_error;
43991
43992 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43993 for (n_error = 0;n_error < gen_nb_int;n_error++) {
43994 mem_base = xmlMemBlocks();
43995 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43996 error = gen_int(n_error, 1);
43997
43998 xmlXPathErr(ctxt, error);
43999 call_tests++;
44000 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44001 des_int(n_error, error, 1);
44002 xmlResetLastError();
44003 if (mem_base != xmlMemBlocks()) {
44004 printf("Leak of %d blocks found in xmlXPathErr",
44005 xmlMemBlocks() - mem_base);
44006 test_ret++;
44007 printf(" %d", n_ctxt);
44008 printf(" %d", n_error);
44009 printf("\n");
44010 }
44011 }
44012 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044013 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044014#endif
44015
Daniel Veillarda82b1822004-11-08 16:24:57 +000044016 return(test_ret);
44017}
44018
44019
44020static int
44021test_xmlXPathEvalExpr(void) {
44022 int test_ret = 0;
44023
44024#ifdef LIBXML_XPATH_ENABLED
44025 int mem_base;
44026 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44027 int n_ctxt;
44028
44029 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44030 mem_base = xmlMemBlocks();
44031 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44032
44033 xmlXPathEvalExpr(ctxt);
44034 call_tests++;
44035 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44036 xmlResetLastError();
44037 if (mem_base != xmlMemBlocks()) {
44038 printf("Leak of %d blocks found in xmlXPathEvalExpr",
44039 xmlMemBlocks() - mem_base);
44040 test_ret++;
44041 printf(" %d", n_ctxt);
44042 printf("\n");
44043 }
44044 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044045 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044046#endif
44047
Daniel Veillarda82b1822004-11-08 16:24:57 +000044048 return(test_ret);
44049}
44050
44051
44052static int
44053test_xmlXPathEvaluatePredicateResult(void) {
44054 int test_ret = 0;
44055
44056#ifdef LIBXML_XPATH_ENABLED
44057 int mem_base;
44058 int ret_val;
44059 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44060 int n_ctxt;
44061 xmlXPathObjectPtr res; /* the Predicate Expression evaluation result */
44062 int n_res;
44063
44064 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44065 for (n_res = 0;n_res < gen_nb_xmlXPathObjectPtr;n_res++) {
44066 mem_base = xmlMemBlocks();
44067 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44068 res = gen_xmlXPathObjectPtr(n_res, 1);
44069
44070 ret_val = xmlXPathEvaluatePredicateResult(ctxt, res);
44071 desret_int(ret_val);
44072 call_tests++;
44073 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44074 des_xmlXPathObjectPtr(n_res, res, 1);
44075 xmlResetLastError();
44076 if (mem_base != xmlMemBlocks()) {
44077 printf("Leak of %d blocks found in xmlXPathEvaluatePredicateResult",
44078 xmlMemBlocks() - mem_base);
44079 test_ret++;
44080 printf(" %d", n_ctxt);
44081 printf(" %d", n_res);
44082 printf("\n");
44083 }
44084 }
44085 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044086 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044087#endif
44088
Daniel Veillarda82b1822004-11-08 16:24:57 +000044089 return(test_ret);
44090}
44091
44092
44093static int
44094test_xmlXPathFalseFunction(void) {
44095 int test_ret = 0;
44096
44097#ifdef LIBXML_XPATH_ENABLED
44098 int mem_base;
44099 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44100 int n_ctxt;
44101 int nargs; /* the number of arguments */
44102 int n_nargs;
44103
44104 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44105 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44106 mem_base = xmlMemBlocks();
44107 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44108 nargs = gen_int(n_nargs, 1);
44109
44110 xmlXPathFalseFunction(ctxt, nargs);
44111 call_tests++;
44112 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44113 des_int(n_nargs, nargs, 1);
44114 xmlResetLastError();
44115 if (mem_base != xmlMemBlocks()) {
44116 printf("Leak of %d blocks found in xmlXPathFalseFunction",
44117 xmlMemBlocks() - mem_base);
44118 test_ret++;
44119 printf(" %d", n_ctxt);
44120 printf(" %d", n_nargs);
44121 printf("\n");
44122 }
44123 }
44124 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044125 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044126#endif
44127
Daniel Veillarda82b1822004-11-08 16:24:57 +000044128 return(test_ret);
44129}
44130
44131
44132static int
44133test_xmlXPathFloorFunction(void) {
44134 int test_ret = 0;
44135
44136#ifdef LIBXML_XPATH_ENABLED
44137 int mem_base;
44138 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44139 int n_ctxt;
44140 int nargs; /* the number of arguments */
44141 int n_nargs;
44142
44143 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44144 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44145 mem_base = xmlMemBlocks();
44146 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44147 nargs = gen_int(n_nargs, 1);
44148
44149 xmlXPathFloorFunction(ctxt, nargs);
44150 call_tests++;
44151 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44152 des_int(n_nargs, nargs, 1);
44153 xmlResetLastError();
44154 if (mem_base != xmlMemBlocks()) {
44155 printf("Leak of %d blocks found in xmlXPathFloorFunction",
44156 xmlMemBlocks() - mem_base);
44157 test_ret++;
44158 printf(" %d", n_ctxt);
44159 printf(" %d", n_nargs);
44160 printf("\n");
44161 }
44162 }
44163 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044164 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044165#endif
44166
Daniel Veillarda82b1822004-11-08 16:24:57 +000044167 return(test_ret);
44168}
44169
44170
44171static int
44172test_xmlXPathFunctionLookup(void) {
44173 int test_ret = 0;
44174
44175
44176 /* missing type support */
44177 return(test_ret);
44178}
44179
44180
44181static int
44182test_xmlXPathFunctionLookupNS(void) {
44183 int test_ret = 0;
44184
44185
44186 /* missing type support */
44187 return(test_ret);
44188}
44189
44190
44191static int
44192test_xmlXPathHasSameNodes(void) {
44193 int test_ret = 0;
44194
44195#ifdef LIBXML_XPATH_ENABLED
44196 int mem_base;
44197 int ret_val;
44198 xmlNodeSetPtr nodes1; /* a node-set */
44199 int n_nodes1;
44200 xmlNodeSetPtr nodes2; /* a node-set */
44201 int n_nodes2;
44202
44203 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
44204 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
44205 mem_base = xmlMemBlocks();
44206 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
44207 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
44208
44209 ret_val = xmlXPathHasSameNodes(nodes1, nodes2);
44210 desret_int(ret_val);
44211 call_tests++;
44212 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
44213 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
44214 xmlResetLastError();
44215 if (mem_base != xmlMemBlocks()) {
44216 printf("Leak of %d blocks found in xmlXPathHasSameNodes",
44217 xmlMemBlocks() - mem_base);
44218 test_ret++;
44219 printf(" %d", n_nodes1);
44220 printf(" %d", n_nodes2);
44221 printf("\n");
44222 }
44223 }
44224 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044225 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044226#endif
44227
Daniel Veillarda82b1822004-11-08 16:24:57 +000044228 return(test_ret);
44229}
44230
44231
44232static int
44233test_xmlXPathIdFunction(void) {
44234 int test_ret = 0;
44235
44236#ifdef LIBXML_XPATH_ENABLED
44237 int mem_base;
44238 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44239 int n_ctxt;
44240 int nargs; /* the number of arguments */
44241 int n_nargs;
44242
44243 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44244 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44245 mem_base = xmlMemBlocks();
44246 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44247 nargs = gen_int(n_nargs, 1);
44248
44249 xmlXPathIdFunction(ctxt, nargs);
44250 call_tests++;
44251 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44252 des_int(n_nargs, nargs, 1);
44253 xmlResetLastError();
44254 if (mem_base != xmlMemBlocks()) {
44255 printf("Leak of %d blocks found in xmlXPathIdFunction",
44256 xmlMemBlocks() - mem_base);
44257 test_ret++;
44258 printf(" %d", n_ctxt);
44259 printf(" %d", n_nargs);
44260 printf("\n");
44261 }
44262 }
44263 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044264 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044265#endif
44266
Daniel Veillarda82b1822004-11-08 16:24:57 +000044267 return(test_ret);
44268}
44269
44270
44271static int
44272test_xmlXPathIntersection(void) {
44273 int test_ret = 0;
44274
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044275#ifdef LIBXML_XPATH_ENABLED
44276 int mem_base;
44277 xmlNodeSetPtr ret_val;
44278 xmlNodeSetPtr nodes1; /* a node-set */
44279 int n_nodes1;
44280 xmlNodeSetPtr nodes2; /* a node-set */
44281 int n_nodes2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044282
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044283 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
44284 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
44285 mem_base = xmlMemBlocks();
44286 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
44287 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
44288
44289 ret_val = xmlXPathIntersection(nodes1, nodes2);
44290 desret_xmlNodeSetPtr(ret_val);
44291 call_tests++;
44292 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
44293 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
44294 xmlResetLastError();
44295 if (mem_base != xmlMemBlocks()) {
44296 printf("Leak of %d blocks found in xmlXPathIntersection",
44297 xmlMemBlocks() - mem_base);
44298 test_ret++;
44299 printf(" %d", n_nodes1);
44300 printf(" %d", n_nodes2);
44301 printf("\n");
44302 }
44303 }
44304 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044305 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044306#endif
44307
Daniel Veillarda82b1822004-11-08 16:24:57 +000044308 return(test_ret);
44309}
44310
44311
44312static int
44313test_xmlXPathIsNodeType(void) {
44314 int test_ret = 0;
44315
44316#ifdef LIBXML_XPATH_ENABLED
44317 int mem_base;
44318 int ret_val;
44319 xmlChar * name; /* a name string */
44320 int n_name;
44321
44322 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
44323 mem_base = xmlMemBlocks();
44324 name = gen_const_xmlChar_ptr(n_name, 0);
44325
William M. Brackf13f77f2004-11-12 16:03:48 +000044326 ret_val = xmlXPathIsNodeType((const xmlChar *)name);
Daniel Veillarda82b1822004-11-08 16:24:57 +000044327 desret_int(ret_val);
44328 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000044329 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
Daniel Veillarda82b1822004-11-08 16:24:57 +000044330 xmlResetLastError();
44331 if (mem_base != xmlMemBlocks()) {
44332 printf("Leak of %d blocks found in xmlXPathIsNodeType",
44333 xmlMemBlocks() - mem_base);
44334 test_ret++;
44335 printf(" %d", n_name);
44336 printf("\n");
44337 }
44338 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044339 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044340#endif
44341
Daniel Veillarda82b1822004-11-08 16:24:57 +000044342 return(test_ret);
44343}
44344
44345
44346static int
44347test_xmlXPathLangFunction(void) {
44348 int test_ret = 0;
44349
44350#ifdef LIBXML_XPATH_ENABLED
44351 int mem_base;
44352 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44353 int n_ctxt;
44354 int nargs; /* the number of arguments */
44355 int n_nargs;
44356
44357 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44358 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44359 mem_base = xmlMemBlocks();
44360 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44361 nargs = gen_int(n_nargs, 1);
44362
44363 xmlXPathLangFunction(ctxt, nargs);
44364 call_tests++;
44365 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44366 des_int(n_nargs, nargs, 1);
44367 xmlResetLastError();
44368 if (mem_base != xmlMemBlocks()) {
44369 printf("Leak of %d blocks found in xmlXPathLangFunction",
44370 xmlMemBlocks() - mem_base);
44371 test_ret++;
44372 printf(" %d", n_ctxt);
44373 printf(" %d", n_nargs);
44374 printf("\n");
44375 }
44376 }
44377 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044378 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044379#endif
44380
Daniel Veillarda82b1822004-11-08 16:24:57 +000044381 return(test_ret);
44382}
44383
44384
44385static int
44386test_xmlXPathLastFunction(void) {
44387 int test_ret = 0;
44388
44389#ifdef LIBXML_XPATH_ENABLED
44390 int mem_base;
44391 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44392 int n_ctxt;
44393 int nargs; /* the number of arguments */
44394 int n_nargs;
44395
44396 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44397 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44398 mem_base = xmlMemBlocks();
44399 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44400 nargs = gen_int(n_nargs, 1);
44401
44402 xmlXPathLastFunction(ctxt, nargs);
44403 call_tests++;
44404 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44405 des_int(n_nargs, nargs, 1);
44406 xmlResetLastError();
44407 if (mem_base != xmlMemBlocks()) {
44408 printf("Leak of %d blocks found in xmlXPathLastFunction",
44409 xmlMemBlocks() - mem_base);
44410 test_ret++;
44411 printf(" %d", n_ctxt);
44412 printf(" %d", n_nargs);
44413 printf("\n");
44414 }
44415 }
44416 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044417 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044418#endif
44419
Daniel Veillarda82b1822004-11-08 16:24:57 +000044420 return(test_ret);
44421}
44422
44423
44424static int
44425test_xmlXPathLeading(void) {
44426 int test_ret = 0;
44427
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044428#ifdef LIBXML_XPATH_ENABLED
44429 int mem_base;
44430 xmlNodeSetPtr ret_val;
44431 xmlNodeSetPtr nodes1; /* a node-set */
44432 int n_nodes1;
44433 xmlNodeSetPtr nodes2; /* a node-set */
44434 int n_nodes2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044435
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044436 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
44437 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
44438 mem_base = xmlMemBlocks();
44439 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
44440 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
44441
44442 ret_val = xmlXPathLeading(nodes1, nodes2);
44443 desret_xmlNodeSetPtr(ret_val);
44444 call_tests++;
44445 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
44446 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
44447 xmlResetLastError();
44448 if (mem_base != xmlMemBlocks()) {
44449 printf("Leak of %d blocks found in xmlXPathLeading",
44450 xmlMemBlocks() - mem_base);
44451 test_ret++;
44452 printf(" %d", n_nodes1);
44453 printf(" %d", n_nodes2);
44454 printf("\n");
44455 }
44456 }
44457 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044458 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044459#endif
44460
Daniel Veillarda82b1822004-11-08 16:24:57 +000044461 return(test_ret);
44462}
44463
44464
44465static int
44466test_xmlXPathLeadingSorted(void) {
44467 int test_ret = 0;
44468
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044469#ifdef LIBXML_XPATH_ENABLED
44470 int mem_base;
44471 xmlNodeSetPtr ret_val;
44472 xmlNodeSetPtr nodes1; /* a node-set, sorted by document order */
44473 int n_nodes1;
44474 xmlNodeSetPtr nodes2; /* a node-set, sorted by document order */
44475 int n_nodes2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044476
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044477 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
44478 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
44479 mem_base = xmlMemBlocks();
44480 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
44481 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
44482
44483 ret_val = xmlXPathLeadingSorted(nodes1, nodes2);
44484 desret_xmlNodeSetPtr(ret_val);
44485 call_tests++;
44486 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
44487 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
44488 xmlResetLastError();
44489 if (mem_base != xmlMemBlocks()) {
44490 printf("Leak of %d blocks found in xmlXPathLeadingSorted",
44491 xmlMemBlocks() - mem_base);
44492 test_ret++;
44493 printf(" %d", n_nodes1);
44494 printf(" %d", n_nodes2);
44495 printf("\n");
44496 }
44497 }
44498 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044499 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044500#endif
44501
Daniel Veillarda82b1822004-11-08 16:24:57 +000044502 return(test_ret);
44503}
44504
44505
44506static int
44507test_xmlXPathLocalNameFunction(void) {
44508 int test_ret = 0;
44509
44510#ifdef LIBXML_XPATH_ENABLED
44511 int mem_base;
44512 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44513 int n_ctxt;
44514 int nargs; /* the number of arguments */
44515 int n_nargs;
44516
44517 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44518 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44519 mem_base = xmlMemBlocks();
44520 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44521 nargs = gen_int(n_nargs, 1);
44522
44523 xmlXPathLocalNameFunction(ctxt, nargs);
44524 call_tests++;
44525 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44526 des_int(n_nargs, nargs, 1);
44527 xmlResetLastError();
44528 if (mem_base != xmlMemBlocks()) {
44529 printf("Leak of %d blocks found in xmlXPathLocalNameFunction",
44530 xmlMemBlocks() - mem_base);
44531 test_ret++;
44532 printf(" %d", n_ctxt);
44533 printf(" %d", n_nargs);
44534 printf("\n");
44535 }
44536 }
44537 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044538 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044539#endif
44540
Daniel Veillarda82b1822004-11-08 16:24:57 +000044541 return(test_ret);
44542}
44543
44544
44545static int
44546test_xmlXPathModValues(void) {
44547 int test_ret = 0;
44548
44549#ifdef LIBXML_XPATH_ENABLED
44550 int mem_base;
44551 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44552 int n_ctxt;
44553
44554 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44555 mem_base = xmlMemBlocks();
44556 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44557
44558 xmlXPathModValues(ctxt);
44559 call_tests++;
44560 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44561 xmlResetLastError();
44562 if (mem_base != xmlMemBlocks()) {
44563 printf("Leak of %d blocks found in xmlXPathModValues",
44564 xmlMemBlocks() - mem_base);
44565 test_ret++;
44566 printf(" %d", n_ctxt);
44567 printf("\n");
44568 }
44569 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044570 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044571#endif
44572
Daniel Veillarda82b1822004-11-08 16:24:57 +000044573 return(test_ret);
44574}
44575
44576
44577static int
44578test_xmlXPathMultValues(void) {
44579 int test_ret = 0;
44580
44581#ifdef LIBXML_XPATH_ENABLED
44582 int mem_base;
44583 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44584 int n_ctxt;
44585
44586 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44587 mem_base = xmlMemBlocks();
44588 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44589
44590 xmlXPathMultValues(ctxt);
44591 call_tests++;
44592 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44593 xmlResetLastError();
44594 if (mem_base != xmlMemBlocks()) {
44595 printf("Leak of %d blocks found in xmlXPathMultValues",
44596 xmlMemBlocks() - mem_base);
44597 test_ret++;
44598 printf(" %d", n_ctxt);
44599 printf("\n");
44600 }
44601 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044602 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044603#endif
44604
Daniel Veillarda82b1822004-11-08 16:24:57 +000044605 return(test_ret);
44606}
44607
44608
44609static int
44610test_xmlXPathNamespaceURIFunction(void) {
44611 int test_ret = 0;
44612
44613#ifdef LIBXML_XPATH_ENABLED
44614 int mem_base;
44615 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44616 int n_ctxt;
44617 int nargs; /* the number of arguments */
44618 int n_nargs;
44619
44620 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44621 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44622 mem_base = xmlMemBlocks();
44623 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44624 nargs = gen_int(n_nargs, 1);
44625
44626 xmlXPathNamespaceURIFunction(ctxt, nargs);
44627 call_tests++;
44628 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44629 des_int(n_nargs, nargs, 1);
44630 xmlResetLastError();
44631 if (mem_base != xmlMemBlocks()) {
44632 printf("Leak of %d blocks found in xmlXPathNamespaceURIFunction",
44633 xmlMemBlocks() - mem_base);
44634 test_ret++;
44635 printf(" %d", n_ctxt);
44636 printf(" %d", n_nargs);
44637 printf("\n");
44638 }
44639 }
44640 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044641 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044642#endif
44643
Daniel Veillarda82b1822004-11-08 16:24:57 +000044644 return(test_ret);
44645}
44646
44647
44648static int
44649test_xmlXPathNewBoolean(void) {
44650 int test_ret = 0;
44651
44652#ifdef LIBXML_XPATH_ENABLED
44653 int mem_base;
44654 xmlXPathObjectPtr ret_val;
44655 int val; /* the boolean value */
44656 int n_val;
44657
44658 for (n_val = 0;n_val < gen_nb_int;n_val++) {
44659 mem_base = xmlMemBlocks();
44660 val = gen_int(n_val, 0);
44661
44662 ret_val = xmlXPathNewBoolean(val);
44663 desret_xmlXPathObjectPtr(ret_val);
44664 call_tests++;
44665 des_int(n_val, val, 0);
44666 xmlResetLastError();
44667 if (mem_base != xmlMemBlocks()) {
44668 printf("Leak of %d blocks found in xmlXPathNewBoolean",
44669 xmlMemBlocks() - mem_base);
44670 test_ret++;
44671 printf(" %d", n_val);
44672 printf("\n");
44673 }
44674 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044675 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044676#endif
44677
Daniel Veillarda82b1822004-11-08 16:24:57 +000044678 return(test_ret);
44679}
44680
44681
44682static int
44683test_xmlXPathNewCString(void) {
44684 int test_ret = 0;
44685
44686#ifdef LIBXML_XPATH_ENABLED
44687 int mem_base;
44688 xmlXPathObjectPtr ret_val;
44689 char * val; /* the char * value */
44690 int n_val;
44691
44692 for (n_val = 0;n_val < gen_nb_const_char_ptr;n_val++) {
44693 mem_base = xmlMemBlocks();
44694 val = gen_const_char_ptr(n_val, 0);
44695
William M. Brackf13f77f2004-11-12 16:03:48 +000044696 ret_val = xmlXPathNewCString((const char *)val);
Daniel Veillarda82b1822004-11-08 16:24:57 +000044697 desret_xmlXPathObjectPtr(ret_val);
44698 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000044699 des_const_char_ptr(n_val, (const char *)val, 0);
Daniel Veillarda82b1822004-11-08 16:24:57 +000044700 xmlResetLastError();
44701 if (mem_base != xmlMemBlocks()) {
44702 printf("Leak of %d blocks found in xmlXPathNewCString",
44703 xmlMemBlocks() - mem_base);
44704 test_ret++;
44705 printf(" %d", n_val);
44706 printf("\n");
44707 }
44708 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044709 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044710#endif
44711
Daniel Veillarda82b1822004-11-08 16:24:57 +000044712 return(test_ret);
44713}
44714
44715
44716static int
44717test_xmlXPathNewFloat(void) {
44718 int test_ret = 0;
44719
44720#ifdef LIBXML_XPATH_ENABLED
44721 int mem_base;
44722 xmlXPathObjectPtr ret_val;
44723 double val; /* the double value */
44724 int n_val;
44725
44726 for (n_val = 0;n_val < gen_nb_double;n_val++) {
44727 mem_base = xmlMemBlocks();
44728 val = gen_double(n_val, 0);
44729
44730 ret_val = xmlXPathNewFloat(val);
44731 desret_xmlXPathObjectPtr(ret_val);
44732 call_tests++;
44733 des_double(n_val, val, 0);
44734 xmlResetLastError();
44735 if (mem_base != xmlMemBlocks()) {
44736 printf("Leak of %d blocks found in xmlXPathNewFloat",
44737 xmlMemBlocks() - mem_base);
44738 test_ret++;
44739 printf(" %d", n_val);
44740 printf("\n");
44741 }
44742 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044743 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044744#endif
44745
Daniel Veillarda82b1822004-11-08 16:24:57 +000044746 return(test_ret);
44747}
44748
44749
44750static int
44751test_xmlXPathNewNodeSet(void) {
44752 int test_ret = 0;
44753
44754#ifdef LIBXML_XPATH_ENABLED
44755 int mem_base;
44756 xmlXPathObjectPtr ret_val;
44757 xmlNodePtr val; /* the NodePtr value */
44758 int n_val;
44759
44760 for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
44761 mem_base = xmlMemBlocks();
44762 val = gen_xmlNodePtr(n_val, 0);
44763
44764 ret_val = xmlXPathNewNodeSet(val);
44765 desret_xmlXPathObjectPtr(ret_val);
44766 call_tests++;
44767 des_xmlNodePtr(n_val, val, 0);
44768 xmlResetLastError();
44769 if (mem_base != xmlMemBlocks()) {
44770 printf("Leak of %d blocks found in xmlXPathNewNodeSet",
44771 xmlMemBlocks() - mem_base);
44772 test_ret++;
44773 printf(" %d", n_val);
44774 printf("\n");
44775 }
44776 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044777 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044778#endif
44779
Daniel Veillarda82b1822004-11-08 16:24:57 +000044780 return(test_ret);
44781}
44782
44783
44784static int
44785test_xmlXPathNewNodeSetList(void) {
44786 int test_ret = 0;
44787
44788#ifdef LIBXML_XPATH_ENABLED
44789 int mem_base;
44790 xmlXPathObjectPtr ret_val;
44791 xmlNodeSetPtr val; /* an existing NodeSet */
44792 int n_val;
44793
44794 for (n_val = 0;n_val < gen_nb_xmlNodeSetPtr;n_val++) {
44795 mem_base = xmlMemBlocks();
44796 val = gen_xmlNodeSetPtr(n_val, 0);
44797
44798 ret_val = xmlXPathNewNodeSetList(val);
44799 desret_xmlXPathObjectPtr(ret_val);
44800 call_tests++;
44801 des_xmlNodeSetPtr(n_val, val, 0);
44802 xmlResetLastError();
44803 if (mem_base != xmlMemBlocks()) {
44804 printf("Leak of %d blocks found in xmlXPathNewNodeSetList",
44805 xmlMemBlocks() - mem_base);
44806 test_ret++;
44807 printf(" %d", n_val);
44808 printf("\n");
44809 }
44810 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044811 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044812#endif
44813
Daniel Veillarda82b1822004-11-08 16:24:57 +000044814 return(test_ret);
44815}
44816
44817
44818static int
44819test_xmlXPathNewParserContext(void) {
44820 int test_ret = 0;
44821
44822
44823 /* missing type support */
44824 return(test_ret);
44825}
44826
44827
44828static int
44829test_xmlXPathNewString(void) {
44830 int test_ret = 0;
44831
44832#ifdef LIBXML_XPATH_ENABLED
44833 int mem_base;
44834 xmlXPathObjectPtr ret_val;
44835 xmlChar * val; /* the xmlChar * value */
44836 int n_val;
44837
44838 for (n_val = 0;n_val < gen_nb_const_xmlChar_ptr;n_val++) {
44839 mem_base = xmlMemBlocks();
44840 val = gen_const_xmlChar_ptr(n_val, 0);
44841
William M. Brackf13f77f2004-11-12 16:03:48 +000044842 ret_val = xmlXPathNewString((const xmlChar *)val);
Daniel Veillarda82b1822004-11-08 16:24:57 +000044843 desret_xmlXPathObjectPtr(ret_val);
44844 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000044845 des_const_xmlChar_ptr(n_val, (const xmlChar *)val, 0);
Daniel Veillarda82b1822004-11-08 16:24:57 +000044846 xmlResetLastError();
44847 if (mem_base != xmlMemBlocks()) {
44848 printf("Leak of %d blocks found in xmlXPathNewString",
44849 xmlMemBlocks() - mem_base);
44850 test_ret++;
44851 printf(" %d", n_val);
44852 printf("\n");
44853 }
44854 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044855 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044856#endif
44857
Daniel Veillarda82b1822004-11-08 16:24:57 +000044858 return(test_ret);
44859}
44860
44861
44862static int
44863test_xmlXPathNextAncestor(void) {
44864 int test_ret = 0;
44865
44866#ifdef LIBXML_XPATH_ENABLED
44867 int mem_base;
44868 xmlNodePtr ret_val;
44869 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44870 int n_ctxt;
44871 xmlNodePtr cur; /* the current node in the traversal */
44872 int n_cur;
44873
44874 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44875 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
44876 mem_base = xmlMemBlocks();
44877 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44878 cur = gen_xmlNodePtr(n_cur, 1);
44879
44880 ret_val = xmlXPathNextAncestor(ctxt, cur);
44881 desret_xmlNodePtr(ret_val);
44882 call_tests++;
44883 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44884 des_xmlNodePtr(n_cur, cur, 1);
44885 xmlResetLastError();
44886 if (mem_base != xmlMemBlocks()) {
44887 printf("Leak of %d blocks found in xmlXPathNextAncestor",
44888 xmlMemBlocks() - mem_base);
44889 test_ret++;
44890 printf(" %d", n_ctxt);
44891 printf(" %d", n_cur);
44892 printf("\n");
44893 }
44894 }
44895 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044896 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044897#endif
44898
Daniel Veillarda82b1822004-11-08 16:24:57 +000044899 return(test_ret);
44900}
44901
44902
44903static int
44904test_xmlXPathNextAncestorOrSelf(void) {
44905 int test_ret = 0;
44906
44907#ifdef LIBXML_XPATH_ENABLED
44908 int mem_base;
44909 xmlNodePtr ret_val;
44910 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44911 int n_ctxt;
44912 xmlNodePtr cur; /* the current node in the traversal */
44913 int n_cur;
44914
44915 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44916 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
44917 mem_base = xmlMemBlocks();
44918 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44919 cur = gen_xmlNodePtr(n_cur, 1);
44920
44921 ret_val = xmlXPathNextAncestorOrSelf(ctxt, cur);
44922 desret_xmlNodePtr(ret_val);
44923 call_tests++;
44924 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44925 des_xmlNodePtr(n_cur, cur, 1);
44926 xmlResetLastError();
44927 if (mem_base != xmlMemBlocks()) {
44928 printf("Leak of %d blocks found in xmlXPathNextAncestorOrSelf",
44929 xmlMemBlocks() - mem_base);
44930 test_ret++;
44931 printf(" %d", n_ctxt);
44932 printf(" %d", n_cur);
44933 printf("\n");
44934 }
44935 }
44936 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044937 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044938#endif
44939
Daniel Veillarda82b1822004-11-08 16:24:57 +000044940 return(test_ret);
44941}
44942
44943
44944static int
44945test_xmlXPathNextAttribute(void) {
44946 int test_ret = 0;
44947
44948#ifdef LIBXML_XPATH_ENABLED
44949 int mem_base;
44950 xmlNodePtr ret_val;
44951 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44952 int n_ctxt;
44953 xmlNodePtr cur; /* the current attribute in the traversal */
44954 int n_cur;
44955
44956 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44957 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
44958 mem_base = xmlMemBlocks();
44959 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44960 cur = gen_xmlNodePtr(n_cur, 1);
44961
44962 ret_val = xmlXPathNextAttribute(ctxt, cur);
44963 desret_xmlNodePtr(ret_val);
44964 call_tests++;
44965 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44966 des_xmlNodePtr(n_cur, cur, 1);
44967 xmlResetLastError();
44968 if (mem_base != xmlMemBlocks()) {
44969 printf("Leak of %d blocks found in xmlXPathNextAttribute",
44970 xmlMemBlocks() - mem_base);
44971 test_ret++;
44972 printf(" %d", n_ctxt);
44973 printf(" %d", n_cur);
44974 printf("\n");
44975 }
44976 }
44977 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044978 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044979#endif
44980
Daniel Veillarda82b1822004-11-08 16:24:57 +000044981 return(test_ret);
44982}
44983
44984
44985static int
44986test_xmlXPathNextChild(void) {
44987 int test_ret = 0;
44988
44989#ifdef LIBXML_XPATH_ENABLED
44990 int mem_base;
44991 xmlNodePtr ret_val;
44992 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44993 int n_ctxt;
44994 xmlNodePtr cur; /* the current node in the traversal */
44995 int n_cur;
44996
44997 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44998 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
44999 mem_base = xmlMemBlocks();
45000 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45001 cur = gen_xmlNodePtr(n_cur, 1);
45002
45003 ret_val = xmlXPathNextChild(ctxt, cur);
45004 desret_xmlNodePtr(ret_val);
45005 call_tests++;
45006 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45007 des_xmlNodePtr(n_cur, cur, 1);
45008 xmlResetLastError();
45009 if (mem_base != xmlMemBlocks()) {
45010 printf("Leak of %d blocks found in xmlXPathNextChild",
45011 xmlMemBlocks() - mem_base);
45012 test_ret++;
45013 printf(" %d", n_ctxt);
45014 printf(" %d", n_cur);
45015 printf("\n");
45016 }
45017 }
45018 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045019 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045020#endif
45021
Daniel Veillarda82b1822004-11-08 16:24:57 +000045022 return(test_ret);
45023}
45024
45025
45026static int
45027test_xmlXPathNextDescendant(void) {
45028 int test_ret = 0;
45029
45030#ifdef LIBXML_XPATH_ENABLED
45031 int mem_base;
45032 xmlNodePtr ret_val;
45033 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45034 int n_ctxt;
45035 xmlNodePtr cur; /* the current node in the traversal */
45036 int n_cur;
45037
45038 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45039 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45040 mem_base = xmlMemBlocks();
45041 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45042 cur = gen_xmlNodePtr(n_cur, 1);
45043
45044 ret_val = xmlXPathNextDescendant(ctxt, cur);
45045 desret_xmlNodePtr(ret_val);
45046 call_tests++;
45047 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45048 des_xmlNodePtr(n_cur, cur, 1);
45049 xmlResetLastError();
45050 if (mem_base != xmlMemBlocks()) {
45051 printf("Leak of %d blocks found in xmlXPathNextDescendant",
45052 xmlMemBlocks() - mem_base);
45053 test_ret++;
45054 printf(" %d", n_ctxt);
45055 printf(" %d", n_cur);
45056 printf("\n");
45057 }
45058 }
45059 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045060 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045061#endif
45062
Daniel Veillarda82b1822004-11-08 16:24:57 +000045063 return(test_ret);
45064}
45065
45066
45067static int
45068test_xmlXPathNextDescendantOrSelf(void) {
45069 int test_ret = 0;
45070
45071#ifdef LIBXML_XPATH_ENABLED
45072 int mem_base;
45073 xmlNodePtr ret_val;
45074 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45075 int n_ctxt;
45076 xmlNodePtr cur; /* the current node in the traversal */
45077 int n_cur;
45078
45079 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45080 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45081 mem_base = xmlMemBlocks();
45082 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45083 cur = gen_xmlNodePtr(n_cur, 1);
45084
45085 ret_val = xmlXPathNextDescendantOrSelf(ctxt, cur);
45086 desret_xmlNodePtr(ret_val);
45087 call_tests++;
45088 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45089 des_xmlNodePtr(n_cur, cur, 1);
45090 xmlResetLastError();
45091 if (mem_base != xmlMemBlocks()) {
45092 printf("Leak of %d blocks found in xmlXPathNextDescendantOrSelf",
45093 xmlMemBlocks() - mem_base);
45094 test_ret++;
45095 printf(" %d", n_ctxt);
45096 printf(" %d", n_cur);
45097 printf("\n");
45098 }
45099 }
45100 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045101 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045102#endif
45103
Daniel Veillarda82b1822004-11-08 16:24:57 +000045104 return(test_ret);
45105}
45106
45107
45108static int
45109test_xmlXPathNextFollowing(void) {
45110 int test_ret = 0;
45111
45112#ifdef LIBXML_XPATH_ENABLED
45113 int mem_base;
45114 xmlNodePtr ret_val;
45115 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45116 int n_ctxt;
45117 xmlNodePtr cur; /* the current node in the traversal */
45118 int n_cur;
45119
45120 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45121 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45122 mem_base = xmlMemBlocks();
45123 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45124 cur = gen_xmlNodePtr(n_cur, 1);
45125
45126 ret_val = xmlXPathNextFollowing(ctxt, cur);
45127 desret_xmlNodePtr(ret_val);
45128 call_tests++;
45129 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45130 des_xmlNodePtr(n_cur, cur, 1);
45131 xmlResetLastError();
45132 if (mem_base != xmlMemBlocks()) {
45133 printf("Leak of %d blocks found in xmlXPathNextFollowing",
45134 xmlMemBlocks() - mem_base);
45135 test_ret++;
45136 printf(" %d", n_ctxt);
45137 printf(" %d", n_cur);
45138 printf("\n");
45139 }
45140 }
45141 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045142 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045143#endif
45144
Daniel Veillarda82b1822004-11-08 16:24:57 +000045145 return(test_ret);
45146}
45147
45148
45149static int
45150test_xmlXPathNextFollowingSibling(void) {
45151 int test_ret = 0;
45152
45153#ifdef LIBXML_XPATH_ENABLED
45154 int mem_base;
45155 xmlNodePtr ret_val;
45156 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45157 int n_ctxt;
45158 xmlNodePtr cur; /* the current node in the traversal */
45159 int n_cur;
45160
45161 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45162 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45163 mem_base = xmlMemBlocks();
45164 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45165 cur = gen_xmlNodePtr(n_cur, 1);
45166
45167 ret_val = xmlXPathNextFollowingSibling(ctxt, cur);
45168 desret_xmlNodePtr(ret_val);
45169 call_tests++;
45170 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45171 des_xmlNodePtr(n_cur, cur, 1);
45172 xmlResetLastError();
45173 if (mem_base != xmlMemBlocks()) {
45174 printf("Leak of %d blocks found in xmlXPathNextFollowingSibling",
45175 xmlMemBlocks() - mem_base);
45176 test_ret++;
45177 printf(" %d", n_ctxt);
45178 printf(" %d", n_cur);
45179 printf("\n");
45180 }
45181 }
45182 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045183 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045184#endif
45185
Daniel Veillarda82b1822004-11-08 16:24:57 +000045186 return(test_ret);
45187}
45188
45189
45190static int
45191test_xmlXPathNextNamespace(void) {
45192 int test_ret = 0;
45193
45194#ifdef LIBXML_XPATH_ENABLED
45195 int mem_base;
45196 xmlNodePtr ret_val;
45197 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45198 int n_ctxt;
45199 xmlNodePtr cur; /* the current attribute in the traversal */
45200 int n_cur;
45201
45202 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45203 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45204 mem_base = xmlMemBlocks();
45205 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45206 cur = gen_xmlNodePtr(n_cur, 1);
45207
45208 ret_val = xmlXPathNextNamespace(ctxt, cur);
45209 desret_xmlNodePtr(ret_val);
45210 call_tests++;
45211 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45212 des_xmlNodePtr(n_cur, cur, 1);
45213 xmlResetLastError();
45214 if (mem_base != xmlMemBlocks()) {
45215 printf("Leak of %d blocks found in xmlXPathNextNamespace",
45216 xmlMemBlocks() - mem_base);
45217 test_ret++;
45218 printf(" %d", n_ctxt);
45219 printf(" %d", n_cur);
45220 printf("\n");
45221 }
45222 }
45223 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045224 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045225#endif
45226
Daniel Veillarda82b1822004-11-08 16:24:57 +000045227 return(test_ret);
45228}
45229
45230
45231static int
45232test_xmlXPathNextParent(void) {
45233 int test_ret = 0;
45234
45235#ifdef LIBXML_XPATH_ENABLED
45236 int mem_base;
45237 xmlNodePtr ret_val;
45238 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45239 int n_ctxt;
45240 xmlNodePtr cur; /* the current node in the traversal */
45241 int n_cur;
45242
45243 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45244 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45245 mem_base = xmlMemBlocks();
45246 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45247 cur = gen_xmlNodePtr(n_cur, 1);
45248
45249 ret_val = xmlXPathNextParent(ctxt, cur);
45250 desret_xmlNodePtr(ret_val);
45251 call_tests++;
45252 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45253 des_xmlNodePtr(n_cur, cur, 1);
45254 xmlResetLastError();
45255 if (mem_base != xmlMemBlocks()) {
45256 printf("Leak of %d blocks found in xmlXPathNextParent",
45257 xmlMemBlocks() - mem_base);
45258 test_ret++;
45259 printf(" %d", n_ctxt);
45260 printf(" %d", n_cur);
45261 printf("\n");
45262 }
45263 }
45264 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045265 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045266#endif
45267
Daniel Veillarda82b1822004-11-08 16:24:57 +000045268 return(test_ret);
45269}
45270
45271
45272static int
45273test_xmlXPathNextPreceding(void) {
45274 int test_ret = 0;
45275
45276#ifdef LIBXML_XPATH_ENABLED
45277 int mem_base;
45278 xmlNodePtr ret_val;
45279 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45280 int n_ctxt;
45281 xmlNodePtr cur; /* the current node in the traversal */
45282 int n_cur;
45283
45284 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45285 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45286 mem_base = xmlMemBlocks();
45287 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45288 cur = gen_xmlNodePtr(n_cur, 1);
45289
45290 ret_val = xmlXPathNextPreceding(ctxt, cur);
45291 desret_xmlNodePtr(ret_val);
45292 call_tests++;
45293 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45294 des_xmlNodePtr(n_cur, cur, 1);
45295 xmlResetLastError();
45296 if (mem_base != xmlMemBlocks()) {
45297 printf("Leak of %d blocks found in xmlXPathNextPreceding",
45298 xmlMemBlocks() - mem_base);
45299 test_ret++;
45300 printf(" %d", n_ctxt);
45301 printf(" %d", n_cur);
45302 printf("\n");
45303 }
45304 }
45305 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045306 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045307#endif
45308
Daniel Veillarda82b1822004-11-08 16:24:57 +000045309 return(test_ret);
45310}
45311
45312
45313static int
45314test_xmlXPathNextPrecedingSibling(void) {
45315 int test_ret = 0;
45316
45317#ifdef LIBXML_XPATH_ENABLED
45318 int mem_base;
45319 xmlNodePtr ret_val;
45320 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45321 int n_ctxt;
45322 xmlNodePtr cur; /* the current node in the traversal */
45323 int n_cur;
45324
45325 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45326 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45327 mem_base = xmlMemBlocks();
45328 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45329 cur = gen_xmlNodePtr(n_cur, 1);
45330
45331 ret_val = xmlXPathNextPrecedingSibling(ctxt, cur);
45332 desret_xmlNodePtr(ret_val);
45333 call_tests++;
45334 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45335 des_xmlNodePtr(n_cur, cur, 1);
45336 xmlResetLastError();
45337 if (mem_base != xmlMemBlocks()) {
45338 printf("Leak of %d blocks found in xmlXPathNextPrecedingSibling",
45339 xmlMemBlocks() - mem_base);
45340 test_ret++;
45341 printf(" %d", n_ctxt);
45342 printf(" %d", n_cur);
45343 printf("\n");
45344 }
45345 }
45346 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045347 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045348#endif
45349
Daniel Veillarda82b1822004-11-08 16:24:57 +000045350 return(test_ret);
45351}
45352
45353
45354static int
45355test_xmlXPathNextSelf(void) {
45356 int test_ret = 0;
45357
45358#ifdef LIBXML_XPATH_ENABLED
45359 int mem_base;
45360 xmlNodePtr ret_val;
45361 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45362 int n_ctxt;
45363 xmlNodePtr cur; /* the current node in the traversal */
45364 int n_cur;
45365
45366 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45367 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45368 mem_base = xmlMemBlocks();
45369 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45370 cur = gen_xmlNodePtr(n_cur, 1);
45371
45372 ret_val = xmlXPathNextSelf(ctxt, cur);
45373 desret_xmlNodePtr(ret_val);
45374 call_tests++;
45375 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45376 des_xmlNodePtr(n_cur, cur, 1);
45377 xmlResetLastError();
45378 if (mem_base != xmlMemBlocks()) {
45379 printf("Leak of %d blocks found in xmlXPathNextSelf",
45380 xmlMemBlocks() - mem_base);
45381 test_ret++;
45382 printf(" %d", n_ctxt);
45383 printf(" %d", n_cur);
45384 printf("\n");
45385 }
45386 }
45387 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045388 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045389#endif
45390
Daniel Veillarda82b1822004-11-08 16:24:57 +000045391 return(test_ret);
45392}
45393
45394
45395static int
45396test_xmlXPathNodeLeading(void) {
45397 int test_ret = 0;
45398
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045399#ifdef LIBXML_XPATH_ENABLED
45400 int mem_base;
45401 xmlNodeSetPtr ret_val;
45402 xmlNodeSetPtr nodes; /* a node-set */
45403 int n_nodes;
45404 xmlNodePtr node; /* a node */
45405 int n_node;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045406
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045407 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
45408 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
45409 mem_base = xmlMemBlocks();
45410 nodes = gen_xmlNodeSetPtr(n_nodes, 0);
45411 node = gen_xmlNodePtr(n_node, 1);
45412
45413 ret_val = xmlXPathNodeLeading(nodes, node);
45414 desret_xmlNodeSetPtr(ret_val);
45415 call_tests++;
45416 des_xmlNodeSetPtr(n_nodes, nodes, 0);
45417 des_xmlNodePtr(n_node, node, 1);
45418 xmlResetLastError();
45419 if (mem_base != xmlMemBlocks()) {
45420 printf("Leak of %d blocks found in xmlXPathNodeLeading",
45421 xmlMemBlocks() - mem_base);
45422 test_ret++;
45423 printf(" %d", n_nodes);
45424 printf(" %d", n_node);
45425 printf("\n");
45426 }
45427 }
45428 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045429 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045430#endif
45431
Daniel Veillarda82b1822004-11-08 16:24:57 +000045432 return(test_ret);
45433}
45434
45435
45436static int
45437test_xmlXPathNodeLeadingSorted(void) {
45438 int test_ret = 0;
45439
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045440#ifdef LIBXML_XPATH_ENABLED
45441 int mem_base;
45442 xmlNodeSetPtr ret_val;
45443 xmlNodeSetPtr nodes; /* a node-set, sorted by document order */
45444 int n_nodes;
45445 xmlNodePtr node; /* a node */
45446 int n_node;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045447
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045448 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
45449 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
45450 mem_base = xmlMemBlocks();
45451 nodes = gen_xmlNodeSetPtr(n_nodes, 0);
45452 node = gen_xmlNodePtr(n_node, 1);
45453
45454 ret_val = xmlXPathNodeLeadingSorted(nodes, node);
45455 desret_xmlNodeSetPtr(ret_val);
45456 call_tests++;
45457 des_xmlNodeSetPtr(n_nodes, nodes, 0);
45458 des_xmlNodePtr(n_node, node, 1);
45459 xmlResetLastError();
45460 if (mem_base != xmlMemBlocks()) {
45461 printf("Leak of %d blocks found in xmlXPathNodeLeadingSorted",
45462 xmlMemBlocks() - mem_base);
45463 test_ret++;
45464 printf(" %d", n_nodes);
45465 printf(" %d", n_node);
45466 printf("\n");
45467 }
45468 }
45469 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045470 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045471#endif
45472
Daniel Veillarda82b1822004-11-08 16:24:57 +000045473 return(test_ret);
45474}
45475
45476
45477static int
45478test_xmlXPathNodeSetAdd(void) {
45479 int test_ret = 0;
45480
45481#ifdef LIBXML_XPATH_ENABLED
45482 int mem_base;
45483 xmlNodeSetPtr cur; /* the initial node set */
45484 int n_cur;
45485 xmlNodePtr val; /* a new xmlNodePtr */
45486 int n_val;
45487
45488 for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
45489 for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
45490 mem_base = xmlMemBlocks();
45491 cur = gen_xmlNodeSetPtr(n_cur, 0);
45492 val = gen_xmlNodePtr(n_val, 1);
45493
45494 xmlXPathNodeSetAdd(cur, val);
45495 call_tests++;
45496 des_xmlNodeSetPtr(n_cur, cur, 0);
45497 des_xmlNodePtr(n_val, val, 1);
45498 xmlResetLastError();
45499 if (mem_base != xmlMemBlocks()) {
45500 printf("Leak of %d blocks found in xmlXPathNodeSetAdd",
45501 xmlMemBlocks() - mem_base);
45502 test_ret++;
45503 printf(" %d", n_cur);
45504 printf(" %d", n_val);
45505 printf("\n");
45506 }
45507 }
45508 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045509 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045510#endif
45511
Daniel Veillarda82b1822004-11-08 16:24:57 +000045512 return(test_ret);
45513}
45514
45515
45516static int
45517test_xmlXPathNodeSetAddNs(void) {
45518 int test_ret = 0;
45519
45520#ifdef LIBXML_XPATH_ENABLED
45521 int mem_base;
45522 xmlNodeSetPtr cur; /* the initial node set */
45523 int n_cur;
45524 xmlNodePtr node; /* the hosting node */
45525 int n_node;
45526 xmlNsPtr ns; /* a the namespace node */
45527 int n_ns;
45528
45529 for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
45530 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
45531 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
45532 mem_base = xmlMemBlocks();
45533 cur = gen_xmlNodeSetPtr(n_cur, 0);
45534 node = gen_xmlNodePtr(n_node, 1);
45535 ns = gen_xmlNsPtr(n_ns, 2);
45536
45537 xmlXPathNodeSetAddNs(cur, node, ns);
45538 call_tests++;
45539 des_xmlNodeSetPtr(n_cur, cur, 0);
45540 des_xmlNodePtr(n_node, node, 1);
45541 des_xmlNsPtr(n_ns, ns, 2);
45542 xmlResetLastError();
45543 if (mem_base != xmlMemBlocks()) {
45544 printf("Leak of %d blocks found in xmlXPathNodeSetAddNs",
45545 xmlMemBlocks() - mem_base);
45546 test_ret++;
45547 printf(" %d", n_cur);
45548 printf(" %d", n_node);
45549 printf(" %d", n_ns);
45550 printf("\n");
45551 }
45552 }
45553 }
45554 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045555 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045556#endif
45557
Daniel Veillarda82b1822004-11-08 16:24:57 +000045558 return(test_ret);
45559}
45560
45561
45562static int
45563test_xmlXPathNodeSetAddUnique(void) {
45564 int test_ret = 0;
45565
45566#ifdef LIBXML_XPATH_ENABLED
45567 int mem_base;
45568 xmlNodeSetPtr cur; /* the initial node set */
45569 int n_cur;
45570 xmlNodePtr val; /* a new xmlNodePtr */
45571 int n_val;
45572
45573 for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
45574 for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
45575 mem_base = xmlMemBlocks();
45576 cur = gen_xmlNodeSetPtr(n_cur, 0);
45577 val = gen_xmlNodePtr(n_val, 1);
45578
45579 xmlXPathNodeSetAddUnique(cur, val);
45580 call_tests++;
45581 des_xmlNodeSetPtr(n_cur, cur, 0);
45582 des_xmlNodePtr(n_val, val, 1);
45583 xmlResetLastError();
45584 if (mem_base != xmlMemBlocks()) {
45585 printf("Leak of %d blocks found in xmlXPathNodeSetAddUnique",
45586 xmlMemBlocks() - mem_base);
45587 test_ret++;
45588 printf(" %d", n_cur);
45589 printf(" %d", n_val);
45590 printf("\n");
45591 }
45592 }
45593 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045594 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045595#endif
45596
Daniel Veillarda82b1822004-11-08 16:24:57 +000045597 return(test_ret);
45598}
45599
45600
45601static int
45602test_xmlXPathNodeSetContains(void) {
45603 int test_ret = 0;
45604
45605#ifdef LIBXML_XPATH_ENABLED
45606 int mem_base;
45607 int ret_val;
45608 xmlNodeSetPtr cur; /* the node-set */
45609 int n_cur;
45610 xmlNodePtr val; /* the node */
45611 int n_val;
45612
45613 for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
45614 for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
45615 mem_base = xmlMemBlocks();
45616 cur = gen_xmlNodeSetPtr(n_cur, 0);
45617 val = gen_xmlNodePtr(n_val, 1);
45618
45619 ret_val = xmlXPathNodeSetContains(cur, val);
45620 desret_int(ret_val);
45621 call_tests++;
45622 des_xmlNodeSetPtr(n_cur, cur, 0);
45623 des_xmlNodePtr(n_val, val, 1);
45624 xmlResetLastError();
45625 if (mem_base != xmlMemBlocks()) {
45626 printf("Leak of %d blocks found in xmlXPathNodeSetContains",
45627 xmlMemBlocks() - mem_base);
45628 test_ret++;
45629 printf(" %d", n_cur);
45630 printf(" %d", n_val);
45631 printf("\n");
45632 }
45633 }
45634 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045635 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045636#endif
45637
Daniel Veillarda82b1822004-11-08 16:24:57 +000045638 return(test_ret);
45639}
45640
45641
45642static int
45643test_xmlXPathNodeSetDel(void) {
45644 int test_ret = 0;
45645
45646#ifdef LIBXML_XPATH_ENABLED
45647 int mem_base;
45648 xmlNodeSetPtr cur; /* the initial node set */
45649 int n_cur;
45650 xmlNodePtr val; /* an xmlNodePtr */
45651 int n_val;
45652
45653 for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
45654 for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
45655 mem_base = xmlMemBlocks();
45656 cur = gen_xmlNodeSetPtr(n_cur, 0);
45657 val = gen_xmlNodePtr(n_val, 1);
45658
45659 xmlXPathNodeSetDel(cur, val);
45660 call_tests++;
45661 des_xmlNodeSetPtr(n_cur, cur, 0);
45662 des_xmlNodePtr(n_val, val, 1);
45663 xmlResetLastError();
45664 if (mem_base != xmlMemBlocks()) {
45665 printf("Leak of %d blocks found in xmlXPathNodeSetDel",
45666 xmlMemBlocks() - mem_base);
45667 test_ret++;
45668 printf(" %d", n_cur);
45669 printf(" %d", n_val);
45670 printf("\n");
45671 }
45672 }
45673 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045674 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045675#endif
45676
Daniel Veillarda82b1822004-11-08 16:24:57 +000045677 return(test_ret);
45678}
45679
45680
45681static int
45682test_xmlXPathNodeSetMerge(void) {
45683 int test_ret = 0;
45684
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045685#ifdef LIBXML_XPATH_ENABLED
45686 int mem_base;
45687 xmlNodeSetPtr ret_val;
45688 xmlNodeSetPtr val1; /* the first NodeSet or NULL */
45689 int n_val1;
45690 xmlNodeSetPtr val2; /* the second NodeSet */
45691 int n_val2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045692
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045693 for (n_val1 = 0;n_val1 < gen_nb_xmlNodeSetPtr;n_val1++) {
45694 for (n_val2 = 0;n_val2 < gen_nb_xmlNodeSetPtr;n_val2++) {
45695 mem_base = xmlMemBlocks();
45696 val1 = gen_xmlNodeSetPtr(n_val1, 0);
45697 val2 = gen_xmlNodeSetPtr(n_val2, 1);
45698
45699 ret_val = xmlXPathNodeSetMerge(val1, val2);
45700 desret_xmlNodeSetPtr(ret_val);
45701 call_tests++;
45702 des_xmlNodeSetPtr(n_val1, val1, 0);
45703 des_xmlNodeSetPtr(n_val2, val2, 1);
45704 xmlResetLastError();
45705 if (mem_base != xmlMemBlocks()) {
45706 printf("Leak of %d blocks found in xmlXPathNodeSetMerge",
45707 xmlMemBlocks() - mem_base);
45708 test_ret++;
45709 printf(" %d", n_val1);
45710 printf(" %d", n_val2);
45711 printf("\n");
45712 }
45713 }
45714 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045715 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045716#endif
45717
Daniel Veillarda82b1822004-11-08 16:24:57 +000045718 return(test_ret);
45719}
45720
45721
45722static int
45723test_xmlXPathNodeSetRemove(void) {
45724 int test_ret = 0;
45725
45726#ifdef LIBXML_XPATH_ENABLED
45727 int mem_base;
45728 xmlNodeSetPtr cur; /* the initial node set */
45729 int n_cur;
45730 int val; /* the index to remove */
45731 int n_val;
45732
45733 for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
45734 for (n_val = 0;n_val < gen_nb_int;n_val++) {
45735 mem_base = xmlMemBlocks();
45736 cur = gen_xmlNodeSetPtr(n_cur, 0);
45737 val = gen_int(n_val, 1);
45738
45739 xmlXPathNodeSetRemove(cur, val);
45740 call_tests++;
45741 des_xmlNodeSetPtr(n_cur, cur, 0);
45742 des_int(n_val, val, 1);
45743 xmlResetLastError();
45744 if (mem_base != xmlMemBlocks()) {
45745 printf("Leak of %d blocks found in xmlXPathNodeSetRemove",
45746 xmlMemBlocks() - mem_base);
45747 test_ret++;
45748 printf(" %d", n_cur);
45749 printf(" %d", n_val);
45750 printf("\n");
45751 }
45752 }
45753 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045754 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045755#endif
45756
Daniel Veillarda82b1822004-11-08 16:24:57 +000045757 return(test_ret);
45758}
45759
45760
45761static int
45762test_xmlXPathNodeSetSort(void) {
45763 int test_ret = 0;
45764
45765#ifdef LIBXML_XPATH_ENABLED
45766 int mem_base;
45767 xmlNodeSetPtr set; /* the node set */
45768 int n_set;
45769
45770 for (n_set = 0;n_set < gen_nb_xmlNodeSetPtr;n_set++) {
45771 mem_base = xmlMemBlocks();
45772 set = gen_xmlNodeSetPtr(n_set, 0);
45773
45774 xmlXPathNodeSetSort(set);
45775 call_tests++;
45776 des_xmlNodeSetPtr(n_set, set, 0);
45777 xmlResetLastError();
45778 if (mem_base != xmlMemBlocks()) {
45779 printf("Leak of %d blocks found in xmlXPathNodeSetSort",
45780 xmlMemBlocks() - mem_base);
45781 test_ret++;
45782 printf(" %d", n_set);
45783 printf("\n");
45784 }
45785 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045786 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045787#endif
45788
Daniel Veillarda82b1822004-11-08 16:24:57 +000045789 return(test_ret);
45790}
45791
45792
45793static int
45794test_xmlXPathNodeTrailing(void) {
45795 int test_ret = 0;
45796
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045797#ifdef LIBXML_XPATH_ENABLED
45798 int mem_base;
45799 xmlNodeSetPtr ret_val;
45800 xmlNodeSetPtr nodes; /* a node-set */
45801 int n_nodes;
45802 xmlNodePtr node; /* a node */
45803 int n_node;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045804
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045805 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
45806 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
45807 mem_base = xmlMemBlocks();
45808 nodes = gen_xmlNodeSetPtr(n_nodes, 0);
45809 node = gen_xmlNodePtr(n_node, 1);
45810
45811 ret_val = xmlXPathNodeTrailing(nodes, node);
45812 desret_xmlNodeSetPtr(ret_val);
45813 call_tests++;
45814 des_xmlNodeSetPtr(n_nodes, nodes, 0);
45815 des_xmlNodePtr(n_node, node, 1);
45816 xmlResetLastError();
45817 if (mem_base != xmlMemBlocks()) {
45818 printf("Leak of %d blocks found in xmlXPathNodeTrailing",
45819 xmlMemBlocks() - mem_base);
45820 test_ret++;
45821 printf(" %d", n_nodes);
45822 printf(" %d", n_node);
45823 printf("\n");
45824 }
45825 }
45826 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045827 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045828#endif
45829
Daniel Veillarda82b1822004-11-08 16:24:57 +000045830 return(test_ret);
45831}
45832
45833
45834static int
45835test_xmlXPathNodeTrailingSorted(void) {
45836 int test_ret = 0;
45837
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045838#ifdef LIBXML_XPATH_ENABLED
45839 int mem_base;
45840 xmlNodeSetPtr ret_val;
45841 xmlNodeSetPtr nodes; /* a node-set, sorted by document order */
45842 int n_nodes;
45843 xmlNodePtr node; /* a node */
45844 int n_node;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045845
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045846 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
45847 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
45848 mem_base = xmlMemBlocks();
45849 nodes = gen_xmlNodeSetPtr(n_nodes, 0);
45850 node = gen_xmlNodePtr(n_node, 1);
45851
45852 ret_val = xmlXPathNodeTrailingSorted(nodes, node);
45853 desret_xmlNodeSetPtr(ret_val);
45854 call_tests++;
45855 des_xmlNodeSetPtr(n_nodes, nodes, 0);
45856 des_xmlNodePtr(n_node, node, 1);
45857 xmlResetLastError();
45858 if (mem_base != xmlMemBlocks()) {
45859 printf("Leak of %d blocks found in xmlXPathNodeTrailingSorted",
45860 xmlMemBlocks() - mem_base);
45861 test_ret++;
45862 printf(" %d", n_nodes);
45863 printf(" %d", n_node);
45864 printf("\n");
45865 }
45866 }
45867 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045868 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045869#endif
45870
Daniel Veillarda82b1822004-11-08 16:24:57 +000045871 return(test_ret);
45872}
45873
45874
45875static int
45876test_xmlXPathNormalizeFunction(void) {
45877 int test_ret = 0;
45878
45879#ifdef LIBXML_XPATH_ENABLED
45880 int mem_base;
45881 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45882 int n_ctxt;
45883 int nargs; /* the number of arguments */
45884 int n_nargs;
45885
45886 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45887 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
45888 mem_base = xmlMemBlocks();
45889 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45890 nargs = gen_int(n_nargs, 1);
45891
45892 xmlXPathNormalizeFunction(ctxt, nargs);
45893 call_tests++;
45894 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45895 des_int(n_nargs, nargs, 1);
45896 xmlResetLastError();
45897 if (mem_base != xmlMemBlocks()) {
45898 printf("Leak of %d blocks found in xmlXPathNormalizeFunction",
45899 xmlMemBlocks() - mem_base);
45900 test_ret++;
45901 printf(" %d", n_ctxt);
45902 printf(" %d", n_nargs);
45903 printf("\n");
45904 }
45905 }
45906 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045907 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045908#endif
45909
Daniel Veillarda82b1822004-11-08 16:24:57 +000045910 return(test_ret);
45911}
45912
45913
45914static int
45915test_xmlXPathNotEqualValues(void) {
45916 int test_ret = 0;
45917
45918#ifdef LIBXML_XPATH_ENABLED
45919 int mem_base;
45920 int ret_val;
45921 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45922 int n_ctxt;
45923
45924 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45925 mem_base = xmlMemBlocks();
45926 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45927
45928 ret_val = xmlXPathNotEqualValues(ctxt);
45929 desret_int(ret_val);
45930 call_tests++;
45931 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45932 xmlResetLastError();
45933 if (mem_base != xmlMemBlocks()) {
45934 printf("Leak of %d blocks found in xmlXPathNotEqualValues",
45935 xmlMemBlocks() - mem_base);
45936 test_ret++;
45937 printf(" %d", n_ctxt);
45938 printf("\n");
45939 }
45940 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045941 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045942#endif
45943
Daniel Veillarda82b1822004-11-08 16:24:57 +000045944 return(test_ret);
45945}
45946
45947
45948static int
45949test_xmlXPathNotFunction(void) {
45950 int test_ret = 0;
45951
45952#ifdef LIBXML_XPATH_ENABLED
45953 int mem_base;
45954 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45955 int n_ctxt;
45956 int nargs; /* the number of arguments */
45957 int n_nargs;
45958
45959 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45960 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
45961 mem_base = xmlMemBlocks();
45962 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45963 nargs = gen_int(n_nargs, 1);
45964
45965 xmlXPathNotFunction(ctxt, nargs);
45966 call_tests++;
45967 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45968 des_int(n_nargs, nargs, 1);
45969 xmlResetLastError();
45970 if (mem_base != xmlMemBlocks()) {
45971 printf("Leak of %d blocks found in xmlXPathNotFunction",
45972 xmlMemBlocks() - mem_base);
45973 test_ret++;
45974 printf(" %d", n_ctxt);
45975 printf(" %d", n_nargs);
45976 printf("\n");
45977 }
45978 }
45979 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045980 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045981#endif
45982
Daniel Veillarda82b1822004-11-08 16:24:57 +000045983 return(test_ret);
45984}
45985
45986
45987static int
45988test_xmlXPathNsLookup(void) {
45989 int test_ret = 0;
45990
45991#ifdef LIBXML_XPATH_ENABLED
45992 int mem_base;
45993 const xmlChar * ret_val;
45994 xmlXPathContextPtr ctxt; /* the XPath context */
45995 int n_ctxt;
45996 xmlChar * prefix; /* the namespace prefix value */
45997 int n_prefix;
45998
45999 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
46000 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
46001 mem_base = xmlMemBlocks();
46002 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
46003 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
46004
William M. Brackf13f77f2004-11-12 16:03:48 +000046005 ret_val = xmlXPathNsLookup(ctxt, (const xmlChar *)prefix);
Daniel Veillarda82b1822004-11-08 16:24:57 +000046006 desret_const_xmlChar_ptr(ret_val);
46007 call_tests++;
46008 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000046009 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
Daniel Veillarda82b1822004-11-08 16:24:57 +000046010 xmlResetLastError();
46011 if (mem_base != xmlMemBlocks()) {
46012 printf("Leak of %d blocks found in xmlXPathNsLookup",
46013 xmlMemBlocks() - mem_base);
46014 test_ret++;
46015 printf(" %d", n_ctxt);
46016 printf(" %d", n_prefix);
46017 printf("\n");
46018 }
46019 }
46020 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046021 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046022#endif
46023
Daniel Veillarda82b1822004-11-08 16:24:57 +000046024 return(test_ret);
46025}
46026
46027
46028static int
46029test_xmlXPathNumberFunction(void) {
46030 int test_ret = 0;
46031
46032#ifdef LIBXML_XPATH_ENABLED
46033 int mem_base;
46034 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46035 int n_ctxt;
46036 int nargs; /* the number of arguments */
46037 int n_nargs;
46038
46039 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46040 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
46041 mem_base = xmlMemBlocks();
46042 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46043 nargs = gen_int(n_nargs, 1);
46044
46045 xmlXPathNumberFunction(ctxt, nargs);
46046 call_tests++;
46047 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46048 des_int(n_nargs, nargs, 1);
46049 xmlResetLastError();
46050 if (mem_base != xmlMemBlocks()) {
46051 printf("Leak of %d blocks found in xmlXPathNumberFunction",
46052 xmlMemBlocks() - mem_base);
46053 test_ret++;
46054 printf(" %d", n_ctxt);
46055 printf(" %d", n_nargs);
46056 printf("\n");
46057 }
46058 }
46059 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046060 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046061#endif
46062
Daniel Veillarda82b1822004-11-08 16:24:57 +000046063 return(test_ret);
46064}
46065
46066
46067static int
46068test_xmlXPathParseNCName(void) {
46069 int test_ret = 0;
46070
46071#ifdef LIBXML_XPATH_ENABLED
46072 int mem_base;
46073 xmlChar * ret_val;
46074 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46075 int n_ctxt;
46076
46077 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46078 mem_base = xmlMemBlocks();
46079 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46080
46081 ret_val = xmlXPathParseNCName(ctxt);
46082 desret_xmlChar_ptr(ret_val);
46083 call_tests++;
46084 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46085 xmlResetLastError();
46086 if (mem_base != xmlMemBlocks()) {
46087 printf("Leak of %d blocks found in xmlXPathParseNCName",
46088 xmlMemBlocks() - mem_base);
46089 test_ret++;
46090 printf(" %d", n_ctxt);
46091 printf("\n");
46092 }
46093 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046094 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046095#endif
46096
Daniel Veillarda82b1822004-11-08 16:24:57 +000046097 return(test_ret);
46098}
46099
46100
46101static int
46102test_xmlXPathParseName(void) {
46103 int test_ret = 0;
46104
46105#ifdef LIBXML_XPATH_ENABLED
46106 int mem_base;
46107 xmlChar * ret_val;
46108 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46109 int n_ctxt;
46110
46111 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46112 mem_base = xmlMemBlocks();
46113 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46114
46115 ret_val = xmlXPathParseName(ctxt);
46116 desret_xmlChar_ptr(ret_val);
46117 call_tests++;
46118 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46119 xmlResetLastError();
46120 if (mem_base != xmlMemBlocks()) {
46121 printf("Leak of %d blocks found in xmlXPathParseName",
46122 xmlMemBlocks() - mem_base);
46123 test_ret++;
46124 printf(" %d", n_ctxt);
46125 printf("\n");
46126 }
46127 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046128 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046129#endif
46130
Daniel Veillarda82b1822004-11-08 16:24:57 +000046131 return(test_ret);
46132}
46133
46134
46135static int
46136test_xmlXPathPopBoolean(void) {
46137 int test_ret = 0;
46138
46139#ifdef LIBXML_XPATH_ENABLED
46140 int mem_base;
46141 int ret_val;
46142 xmlXPathParserContextPtr ctxt; /* an XPath parser context */
46143 int n_ctxt;
46144
46145 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46146 mem_base = xmlMemBlocks();
46147 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46148
46149 ret_val = xmlXPathPopBoolean(ctxt);
46150 desret_int(ret_val);
46151 call_tests++;
46152 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46153 xmlResetLastError();
46154 if (mem_base != xmlMemBlocks()) {
46155 printf("Leak of %d blocks found in xmlXPathPopBoolean",
46156 xmlMemBlocks() - mem_base);
46157 test_ret++;
46158 printf(" %d", n_ctxt);
46159 printf("\n");
46160 }
46161 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046162 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046163#endif
46164
Daniel Veillarda82b1822004-11-08 16:24:57 +000046165 return(test_ret);
46166}
46167
46168
46169static int
46170test_xmlXPathPopExternal(void) {
46171 int test_ret = 0;
46172
46173#ifdef LIBXML_XPATH_ENABLED
46174 int mem_base;
46175 void * ret_val;
46176 xmlXPathParserContextPtr ctxt; /* an XPath parser context */
46177 int n_ctxt;
46178
46179 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46180 mem_base = xmlMemBlocks();
46181 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46182
46183 ret_val = xmlXPathPopExternal(ctxt);
46184 desret_void_ptr(ret_val);
46185 call_tests++;
46186 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46187 xmlResetLastError();
46188 if (mem_base != xmlMemBlocks()) {
46189 printf("Leak of %d blocks found in xmlXPathPopExternal",
46190 xmlMemBlocks() - mem_base);
46191 test_ret++;
46192 printf(" %d", n_ctxt);
46193 printf("\n");
46194 }
46195 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046196 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046197#endif
46198
Daniel Veillarda82b1822004-11-08 16:24:57 +000046199 return(test_ret);
46200}
46201
46202
46203static int
46204test_xmlXPathPopNodeSet(void) {
46205 int test_ret = 0;
46206
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046207#ifdef LIBXML_XPATH_ENABLED
46208 int mem_base;
46209 xmlNodeSetPtr ret_val;
46210 xmlXPathParserContextPtr ctxt; /* an XPath parser context */
46211 int n_ctxt;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046212
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046213 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46214 mem_base = xmlMemBlocks();
46215 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46216
46217 ret_val = xmlXPathPopNodeSet(ctxt);
46218 desret_xmlNodeSetPtr(ret_val);
46219 call_tests++;
46220 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46221 xmlResetLastError();
46222 if (mem_base != xmlMemBlocks()) {
46223 printf("Leak of %d blocks found in xmlXPathPopNodeSet",
46224 xmlMemBlocks() - mem_base);
46225 test_ret++;
46226 printf(" %d", n_ctxt);
46227 printf("\n");
46228 }
46229 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046230 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046231#endif
46232
Daniel Veillarda82b1822004-11-08 16:24:57 +000046233 return(test_ret);
46234}
46235
46236
46237static int
46238test_xmlXPathPopNumber(void) {
46239 int test_ret = 0;
46240
46241#ifdef LIBXML_XPATH_ENABLED
46242 int mem_base;
46243 double ret_val;
46244 xmlXPathParserContextPtr ctxt; /* an XPath parser context */
46245 int n_ctxt;
46246
46247 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46248 mem_base = xmlMemBlocks();
46249 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46250
46251 ret_val = xmlXPathPopNumber(ctxt);
46252 desret_double(ret_val);
46253 call_tests++;
46254 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46255 xmlResetLastError();
46256 if (mem_base != xmlMemBlocks()) {
46257 printf("Leak of %d blocks found in xmlXPathPopNumber",
46258 xmlMemBlocks() - mem_base);
46259 test_ret++;
46260 printf(" %d", n_ctxt);
46261 printf("\n");
46262 }
46263 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046264 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046265#endif
46266
Daniel Veillarda82b1822004-11-08 16:24:57 +000046267 return(test_ret);
46268}
46269
46270
46271static int
46272test_xmlXPathPopString(void) {
46273 int test_ret = 0;
46274
46275#ifdef LIBXML_XPATH_ENABLED
46276 int mem_base;
46277 xmlChar * ret_val;
46278 xmlXPathParserContextPtr ctxt; /* an XPath parser context */
46279 int n_ctxt;
46280
46281 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46282 mem_base = xmlMemBlocks();
46283 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46284
46285 ret_val = xmlXPathPopString(ctxt);
46286 desret_xmlChar_ptr(ret_val);
46287 call_tests++;
46288 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46289 xmlResetLastError();
46290 if (mem_base != xmlMemBlocks()) {
46291 printf("Leak of %d blocks found in xmlXPathPopString",
46292 xmlMemBlocks() - mem_base);
46293 test_ret++;
46294 printf(" %d", n_ctxt);
46295 printf("\n");
46296 }
46297 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046298 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046299#endif
46300
Daniel Veillarda82b1822004-11-08 16:24:57 +000046301 return(test_ret);
46302}
46303
46304
46305static int
46306test_xmlXPathPositionFunction(void) {
46307 int test_ret = 0;
46308
46309#ifdef LIBXML_XPATH_ENABLED
46310 int mem_base;
46311 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46312 int n_ctxt;
46313 int nargs; /* the number of arguments */
46314 int n_nargs;
46315
46316 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46317 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
46318 mem_base = xmlMemBlocks();
46319 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46320 nargs = gen_int(n_nargs, 1);
46321
46322 xmlXPathPositionFunction(ctxt, nargs);
46323 call_tests++;
46324 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46325 des_int(n_nargs, nargs, 1);
46326 xmlResetLastError();
46327 if (mem_base != xmlMemBlocks()) {
46328 printf("Leak of %d blocks found in xmlXPathPositionFunction",
46329 xmlMemBlocks() - mem_base);
46330 test_ret++;
46331 printf(" %d", n_ctxt);
46332 printf(" %d", n_nargs);
46333 printf("\n");
46334 }
46335 }
46336 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046337 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046338#endif
46339
Daniel Veillarda82b1822004-11-08 16:24:57 +000046340 return(test_ret);
46341}
46342
46343
46344static int
46345test_xmlXPathRegisterAllFunctions(void) {
46346 int test_ret = 0;
46347
46348#ifdef LIBXML_XPATH_ENABLED
46349 int mem_base;
46350 xmlXPathContextPtr ctxt; /* the XPath context */
46351 int n_ctxt;
46352
46353 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
46354 mem_base = xmlMemBlocks();
46355 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
46356
46357 xmlXPathRegisterAllFunctions(ctxt);
46358 call_tests++;
46359 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
46360 xmlResetLastError();
46361 if (mem_base != xmlMemBlocks()) {
46362 printf("Leak of %d blocks found in xmlXPathRegisterAllFunctions",
46363 xmlMemBlocks() - mem_base);
46364 test_ret++;
46365 printf(" %d", n_ctxt);
46366 printf("\n");
46367 }
46368 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046369 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046370#endif
46371
Daniel Veillarda82b1822004-11-08 16:24:57 +000046372 return(test_ret);
46373}
46374
46375
46376static int
46377test_xmlXPathRegisterFunc(void) {
46378 int test_ret = 0;
46379
46380
46381 /* missing type support */
46382 return(test_ret);
46383}
46384
46385
46386static int
46387test_xmlXPathRegisterFuncLookup(void) {
46388 int test_ret = 0;
46389
46390
46391 /* missing type support */
46392 return(test_ret);
46393}
46394
46395
46396static int
46397test_xmlXPathRegisterFuncNS(void) {
46398 int test_ret = 0;
46399
46400
46401 /* missing type support */
46402 return(test_ret);
46403}
46404
46405
46406static int
46407test_xmlXPathRegisterNs(void) {
46408 int test_ret = 0;
46409
46410#ifdef LIBXML_XPATH_ENABLED
46411 int mem_base;
46412 int ret_val;
46413 xmlXPathContextPtr ctxt; /* the XPath context */
46414 int n_ctxt;
46415 xmlChar * prefix; /* the namespace prefix */
46416 int n_prefix;
46417 xmlChar * ns_uri; /* the namespace name */
46418 int n_ns_uri;
46419
46420 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
46421 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
46422 for (n_ns_uri = 0;n_ns_uri < gen_nb_const_xmlChar_ptr;n_ns_uri++) {
46423 mem_base = xmlMemBlocks();
46424 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
46425 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
46426 ns_uri = gen_const_xmlChar_ptr(n_ns_uri, 2);
46427
William M. Brackf13f77f2004-11-12 16:03:48 +000046428 ret_val = xmlXPathRegisterNs(ctxt, (const xmlChar *)prefix, (const xmlChar *)ns_uri);
Daniel Veillarda82b1822004-11-08 16:24:57 +000046429 desret_int(ret_val);
46430 call_tests++;
46431 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000046432 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
46433 des_const_xmlChar_ptr(n_ns_uri, (const xmlChar *)ns_uri, 2);
Daniel Veillarda82b1822004-11-08 16:24:57 +000046434 xmlResetLastError();
46435 if (mem_base != xmlMemBlocks()) {
46436 printf("Leak of %d blocks found in xmlXPathRegisterNs",
46437 xmlMemBlocks() - mem_base);
46438 test_ret++;
46439 printf(" %d", n_ctxt);
46440 printf(" %d", n_prefix);
46441 printf(" %d", n_ns_uri);
46442 printf("\n");
46443 }
46444 }
46445 }
46446 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046447 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046448#endif
46449
Daniel Veillarda82b1822004-11-08 16:24:57 +000046450 return(test_ret);
46451}
46452
46453
46454static int
46455test_xmlXPathRegisterVariable(void) {
46456 int test_ret = 0;
46457
46458#ifdef LIBXML_XPATH_ENABLED
46459 int mem_base;
46460 int ret_val;
46461 xmlXPathContextPtr ctxt; /* the XPath context */
46462 int n_ctxt;
46463 xmlChar * name; /* the variable name */
46464 int n_name;
46465 xmlXPathObjectPtr value; /* the variable value or NULL */
46466 int n_value;
46467
46468 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
46469 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
46470 for (n_value = 0;n_value < gen_nb_xmlXPathObjectPtr;n_value++) {
46471 mem_base = xmlMemBlocks();
46472 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
46473 name = gen_const_xmlChar_ptr(n_name, 1);
46474 value = gen_xmlXPathObjectPtr(n_value, 2);
46475
William M. Brackf13f77f2004-11-12 16:03:48 +000046476 ret_val = xmlXPathRegisterVariable(ctxt, (const xmlChar *)name, value);
Daniel Veillarda82b1822004-11-08 16:24:57 +000046477 desret_int(ret_val);
46478 call_tests++;
46479 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000046480 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarda82b1822004-11-08 16:24:57 +000046481 des_xmlXPathObjectPtr(n_value, value, 2);
46482 xmlResetLastError();
46483 if (mem_base != xmlMemBlocks()) {
46484 printf("Leak of %d blocks found in xmlXPathRegisterVariable",
46485 xmlMemBlocks() - mem_base);
46486 test_ret++;
46487 printf(" %d", n_ctxt);
46488 printf(" %d", n_name);
46489 printf(" %d", n_value);
46490 printf("\n");
46491 }
46492 }
46493 }
46494 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046495 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046496#endif
46497
Daniel Veillarda82b1822004-11-08 16:24:57 +000046498 return(test_ret);
46499}
46500
46501
46502static int
46503test_xmlXPathRegisterVariableLookup(void) {
46504 int test_ret = 0;
46505
46506
46507 /* missing type support */
46508 return(test_ret);
46509}
46510
46511
46512static int
46513test_xmlXPathRegisterVariableNS(void) {
46514 int test_ret = 0;
46515
46516#ifdef LIBXML_XPATH_ENABLED
46517 int mem_base;
46518 int ret_val;
46519 xmlXPathContextPtr ctxt; /* the XPath context */
46520 int n_ctxt;
46521 xmlChar * name; /* the variable name */
46522 int n_name;
46523 xmlChar * ns_uri; /* the variable namespace URI */
46524 int n_ns_uri;
46525 xmlXPathObjectPtr value; /* the variable value or NULL */
46526 int n_value;
46527
46528 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
46529 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
46530 for (n_ns_uri = 0;n_ns_uri < gen_nb_const_xmlChar_ptr;n_ns_uri++) {
46531 for (n_value = 0;n_value < gen_nb_xmlXPathObjectPtr;n_value++) {
46532 mem_base = xmlMemBlocks();
46533 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
46534 name = gen_const_xmlChar_ptr(n_name, 1);
46535 ns_uri = gen_const_xmlChar_ptr(n_ns_uri, 2);
46536 value = gen_xmlXPathObjectPtr(n_value, 3);
46537
William M. Brackf13f77f2004-11-12 16:03:48 +000046538 ret_val = xmlXPathRegisterVariableNS(ctxt, (const xmlChar *)name, (const xmlChar *)ns_uri, value);
Daniel Veillarda82b1822004-11-08 16:24:57 +000046539 desret_int(ret_val);
46540 call_tests++;
46541 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000046542 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
46543 des_const_xmlChar_ptr(n_ns_uri, (const xmlChar *)ns_uri, 2);
Daniel Veillarda82b1822004-11-08 16:24:57 +000046544 des_xmlXPathObjectPtr(n_value, value, 3);
46545 xmlResetLastError();
46546 if (mem_base != xmlMemBlocks()) {
46547 printf("Leak of %d blocks found in xmlXPathRegisterVariableNS",
46548 xmlMemBlocks() - mem_base);
46549 test_ret++;
46550 printf(" %d", n_ctxt);
46551 printf(" %d", n_name);
46552 printf(" %d", n_ns_uri);
46553 printf(" %d", n_value);
46554 printf("\n");
46555 }
46556 }
46557 }
46558 }
46559 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046560 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046561#endif
46562
Daniel Veillarda82b1822004-11-08 16:24:57 +000046563 return(test_ret);
46564}
46565
46566
46567static int
46568test_xmlXPathRegisteredFuncsCleanup(void) {
46569 int test_ret = 0;
46570
46571#ifdef LIBXML_XPATH_ENABLED
46572 int mem_base;
46573 xmlXPathContextPtr ctxt; /* the XPath context */
46574 int n_ctxt;
46575
46576 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
46577 mem_base = xmlMemBlocks();
46578 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
46579
46580 xmlXPathRegisteredFuncsCleanup(ctxt);
46581 call_tests++;
46582 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
46583 xmlResetLastError();
46584 if (mem_base != xmlMemBlocks()) {
46585 printf("Leak of %d blocks found in xmlXPathRegisteredFuncsCleanup",
46586 xmlMemBlocks() - mem_base);
46587 test_ret++;
46588 printf(" %d", n_ctxt);
46589 printf("\n");
46590 }
46591 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046592 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046593#endif
46594
Daniel Veillarda82b1822004-11-08 16:24:57 +000046595 return(test_ret);
46596}
46597
46598
46599static int
46600test_xmlXPathRegisteredNsCleanup(void) {
46601 int test_ret = 0;
46602
46603#ifdef LIBXML_XPATH_ENABLED
46604 int mem_base;
46605 xmlXPathContextPtr ctxt; /* the XPath context */
46606 int n_ctxt;
46607
46608 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
46609 mem_base = xmlMemBlocks();
46610 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
46611
46612 xmlXPathRegisteredNsCleanup(ctxt);
46613 call_tests++;
46614 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
46615 xmlResetLastError();
46616 if (mem_base != xmlMemBlocks()) {
46617 printf("Leak of %d blocks found in xmlXPathRegisteredNsCleanup",
46618 xmlMemBlocks() - mem_base);
46619 test_ret++;
46620 printf(" %d", n_ctxt);
46621 printf("\n");
46622 }
46623 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046624 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046625#endif
46626
Daniel Veillarda82b1822004-11-08 16:24:57 +000046627 return(test_ret);
46628}
46629
46630
46631static int
46632test_xmlXPathRegisteredVariablesCleanup(void) {
46633 int test_ret = 0;
46634
46635#ifdef LIBXML_XPATH_ENABLED
46636 int mem_base;
46637 xmlXPathContextPtr ctxt; /* the XPath context */
46638 int n_ctxt;
46639
46640 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
46641 mem_base = xmlMemBlocks();
46642 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
46643
46644 xmlXPathRegisteredVariablesCleanup(ctxt);
46645 call_tests++;
46646 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
46647 xmlResetLastError();
46648 if (mem_base != xmlMemBlocks()) {
46649 printf("Leak of %d blocks found in xmlXPathRegisteredVariablesCleanup",
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_xmlXPathRoot(void) {
46665 int test_ret = 0;
46666
46667#ifdef LIBXML_XPATH_ENABLED
46668 int mem_base;
46669 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46670 int n_ctxt;
46671
46672 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46673 mem_base = xmlMemBlocks();
46674 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46675
46676 xmlXPathRoot(ctxt);
46677 call_tests++;
46678 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46679 xmlResetLastError();
46680 if (mem_base != xmlMemBlocks()) {
46681 printf("Leak of %d blocks found in xmlXPathRoot",
46682 xmlMemBlocks() - mem_base);
46683 test_ret++;
46684 printf(" %d", n_ctxt);
46685 printf("\n");
46686 }
46687 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046688 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046689#endif
46690
Daniel Veillarda82b1822004-11-08 16:24:57 +000046691 return(test_ret);
46692}
46693
46694
46695static int
46696test_xmlXPathRoundFunction(void) {
46697 int test_ret = 0;
46698
46699#ifdef LIBXML_XPATH_ENABLED
46700 int mem_base;
46701 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46702 int n_ctxt;
46703 int nargs; /* the number of arguments */
46704 int n_nargs;
46705
46706 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46707 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
46708 mem_base = xmlMemBlocks();
46709 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46710 nargs = gen_int(n_nargs, 1);
46711
46712 xmlXPathRoundFunction(ctxt, nargs);
46713 call_tests++;
46714 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46715 des_int(n_nargs, nargs, 1);
46716 xmlResetLastError();
46717 if (mem_base != xmlMemBlocks()) {
46718 printf("Leak of %d blocks found in xmlXPathRoundFunction",
46719 xmlMemBlocks() - mem_base);
46720 test_ret++;
46721 printf(" %d", n_ctxt);
46722 printf(" %d", n_nargs);
46723 printf("\n");
46724 }
46725 }
46726 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046727 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046728#endif
46729
Daniel Veillarda82b1822004-11-08 16:24:57 +000046730 return(test_ret);
46731}
46732
46733
46734static int
46735test_xmlXPathStartsWithFunction(void) {
46736 int test_ret = 0;
46737
46738#ifdef LIBXML_XPATH_ENABLED
46739 int mem_base;
46740 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46741 int n_ctxt;
46742 int nargs; /* the number of arguments */
46743 int n_nargs;
46744
46745 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46746 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
46747 mem_base = xmlMemBlocks();
46748 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46749 nargs = gen_int(n_nargs, 1);
46750
46751 xmlXPathStartsWithFunction(ctxt, nargs);
46752 call_tests++;
46753 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46754 des_int(n_nargs, nargs, 1);
46755 xmlResetLastError();
46756 if (mem_base != xmlMemBlocks()) {
46757 printf("Leak of %d blocks found in xmlXPathStartsWithFunction",
46758 xmlMemBlocks() - mem_base);
46759 test_ret++;
46760 printf(" %d", n_ctxt);
46761 printf(" %d", n_nargs);
46762 printf("\n");
46763 }
46764 }
46765 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046766 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046767#endif
46768
Daniel Veillarda82b1822004-11-08 16:24:57 +000046769 return(test_ret);
46770}
46771
46772
46773static int
46774test_xmlXPathStringEvalNumber(void) {
46775 int test_ret = 0;
46776
46777#ifdef LIBXML_XPATH_ENABLED
46778 int mem_base;
46779 double ret_val;
46780 xmlChar * str; /* A string to scan */
46781 int n_str;
46782
46783 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
46784 mem_base = xmlMemBlocks();
46785 str = gen_const_xmlChar_ptr(n_str, 0);
46786
William M. Brackf13f77f2004-11-12 16:03:48 +000046787 ret_val = xmlXPathStringEvalNumber((const xmlChar *)str);
Daniel Veillarda82b1822004-11-08 16:24:57 +000046788 desret_double(ret_val);
46789 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000046790 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillarda82b1822004-11-08 16:24:57 +000046791 xmlResetLastError();
46792 if (mem_base != xmlMemBlocks()) {
46793 printf("Leak of %d blocks found in xmlXPathStringEvalNumber",
46794 xmlMemBlocks() - mem_base);
46795 test_ret++;
46796 printf(" %d", n_str);
46797 printf("\n");
46798 }
46799 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046800 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046801#endif
46802
Daniel Veillarda82b1822004-11-08 16:24:57 +000046803 return(test_ret);
46804}
46805
46806
46807static int
46808test_xmlXPathStringFunction(void) {
46809 int test_ret = 0;
46810
46811#ifdef LIBXML_XPATH_ENABLED
46812 int mem_base;
46813 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46814 int n_ctxt;
46815 int nargs; /* the number of arguments */
46816 int n_nargs;
46817
46818 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46819 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
46820 mem_base = xmlMemBlocks();
46821 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46822 nargs = gen_int(n_nargs, 1);
46823
46824 xmlXPathStringFunction(ctxt, nargs);
46825 call_tests++;
46826 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46827 des_int(n_nargs, nargs, 1);
46828 xmlResetLastError();
46829 if (mem_base != xmlMemBlocks()) {
46830 printf("Leak of %d blocks found in xmlXPathStringFunction",
46831 xmlMemBlocks() - mem_base);
46832 test_ret++;
46833 printf(" %d", n_ctxt);
46834 printf(" %d", n_nargs);
46835 printf("\n");
46836 }
46837 }
46838 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046839 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046840#endif
46841
Daniel Veillarda82b1822004-11-08 16:24:57 +000046842 return(test_ret);
46843}
46844
46845
46846static int
46847test_xmlXPathStringLengthFunction(void) {
46848 int test_ret = 0;
46849
46850#ifdef LIBXML_XPATH_ENABLED
46851 int mem_base;
46852 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46853 int n_ctxt;
46854 int nargs; /* the number of arguments */
46855 int n_nargs;
46856
46857 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46858 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
46859 mem_base = xmlMemBlocks();
46860 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46861 nargs = gen_int(n_nargs, 1);
46862
46863 xmlXPathStringLengthFunction(ctxt, nargs);
46864 call_tests++;
46865 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46866 des_int(n_nargs, nargs, 1);
46867 xmlResetLastError();
46868 if (mem_base != xmlMemBlocks()) {
46869 printf("Leak of %d blocks found in xmlXPathStringLengthFunction",
46870 xmlMemBlocks() - mem_base);
46871 test_ret++;
46872 printf(" %d", n_ctxt);
46873 printf(" %d", n_nargs);
46874 printf("\n");
46875 }
46876 }
46877 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046878 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046879#endif
46880
Daniel Veillarda82b1822004-11-08 16:24:57 +000046881 return(test_ret);
46882}
46883
46884
46885static int
46886test_xmlXPathSubValues(void) {
46887 int test_ret = 0;
46888
46889#ifdef LIBXML_XPATH_ENABLED
46890 int mem_base;
46891 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46892 int n_ctxt;
46893
46894 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46895 mem_base = xmlMemBlocks();
46896 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46897
46898 xmlXPathSubValues(ctxt);
46899 call_tests++;
46900 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46901 xmlResetLastError();
46902 if (mem_base != xmlMemBlocks()) {
46903 printf("Leak of %d blocks found in xmlXPathSubValues",
46904 xmlMemBlocks() - mem_base);
46905 test_ret++;
46906 printf(" %d", n_ctxt);
46907 printf("\n");
46908 }
46909 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046910 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046911#endif
46912
Daniel Veillarda82b1822004-11-08 16:24:57 +000046913 return(test_ret);
46914}
46915
46916
46917static int
46918test_xmlXPathSubstringAfterFunction(void) {
46919 int test_ret = 0;
46920
46921#ifdef LIBXML_XPATH_ENABLED
46922 int mem_base;
46923 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46924 int n_ctxt;
46925 int nargs; /* the number of arguments */
46926 int n_nargs;
46927
46928 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46929 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
46930 mem_base = xmlMemBlocks();
46931 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46932 nargs = gen_int(n_nargs, 1);
46933
46934 xmlXPathSubstringAfterFunction(ctxt, nargs);
46935 call_tests++;
46936 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46937 des_int(n_nargs, nargs, 1);
46938 xmlResetLastError();
46939 if (mem_base != xmlMemBlocks()) {
46940 printf("Leak of %d blocks found in xmlXPathSubstringAfterFunction",
46941 xmlMemBlocks() - mem_base);
46942 test_ret++;
46943 printf(" %d", n_ctxt);
46944 printf(" %d", n_nargs);
46945 printf("\n");
46946 }
46947 }
46948 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046949 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046950#endif
46951
Daniel Veillarda82b1822004-11-08 16:24:57 +000046952 return(test_ret);
46953}
46954
46955
46956static int
46957test_xmlXPathSubstringBeforeFunction(void) {
46958 int test_ret = 0;
46959
46960#ifdef LIBXML_XPATH_ENABLED
46961 int mem_base;
46962 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46963 int n_ctxt;
46964 int nargs; /* the number of arguments */
46965 int n_nargs;
46966
46967 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46968 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
46969 mem_base = xmlMemBlocks();
46970 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46971 nargs = gen_int(n_nargs, 1);
46972
46973 xmlXPathSubstringBeforeFunction(ctxt, nargs);
46974 call_tests++;
46975 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46976 des_int(n_nargs, nargs, 1);
46977 xmlResetLastError();
46978 if (mem_base != xmlMemBlocks()) {
46979 printf("Leak of %d blocks found in xmlXPathSubstringBeforeFunction",
46980 xmlMemBlocks() - mem_base);
46981 test_ret++;
46982 printf(" %d", n_ctxt);
46983 printf(" %d", n_nargs);
46984 printf("\n");
46985 }
46986 }
46987 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046988 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046989#endif
46990
Daniel Veillarda82b1822004-11-08 16:24:57 +000046991 return(test_ret);
46992}
46993
46994
46995static int
46996test_xmlXPathSubstringFunction(void) {
46997 int test_ret = 0;
46998
46999#ifdef LIBXML_XPATH_ENABLED
47000 int mem_base;
47001 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47002 int n_ctxt;
47003 int nargs; /* the number of arguments */
47004 int n_nargs;
47005
47006 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47007 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47008 mem_base = xmlMemBlocks();
47009 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47010 nargs = gen_int(n_nargs, 1);
47011
47012 xmlXPathSubstringFunction(ctxt, nargs);
47013 call_tests++;
47014 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47015 des_int(n_nargs, nargs, 1);
47016 xmlResetLastError();
47017 if (mem_base != xmlMemBlocks()) {
47018 printf("Leak of %d blocks found in xmlXPathSubstringFunction",
47019 xmlMemBlocks() - mem_base);
47020 test_ret++;
47021 printf(" %d", n_ctxt);
47022 printf(" %d", n_nargs);
47023 printf("\n");
47024 }
47025 }
47026 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047027 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047028#endif
47029
Daniel Veillarda82b1822004-11-08 16:24:57 +000047030 return(test_ret);
47031}
47032
47033
47034static int
47035test_xmlXPathSumFunction(void) {
47036 int test_ret = 0;
47037
47038#ifdef LIBXML_XPATH_ENABLED
47039 int mem_base;
47040 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47041 int n_ctxt;
47042 int nargs; /* the number of arguments */
47043 int n_nargs;
47044
47045 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47046 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47047 mem_base = xmlMemBlocks();
47048 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47049 nargs = gen_int(n_nargs, 1);
47050
47051 xmlXPathSumFunction(ctxt, nargs);
47052 call_tests++;
47053 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47054 des_int(n_nargs, nargs, 1);
47055 xmlResetLastError();
47056 if (mem_base != xmlMemBlocks()) {
47057 printf("Leak of %d blocks found in xmlXPathSumFunction",
47058 xmlMemBlocks() - mem_base);
47059 test_ret++;
47060 printf(" %d", n_ctxt);
47061 printf(" %d", n_nargs);
47062 printf("\n");
47063 }
47064 }
47065 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047066 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047067#endif
47068
Daniel Veillarda82b1822004-11-08 16:24:57 +000047069 return(test_ret);
47070}
47071
47072
47073static int
47074test_xmlXPathTrailing(void) {
47075 int test_ret = 0;
47076
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047077#ifdef LIBXML_XPATH_ENABLED
47078 int mem_base;
47079 xmlNodeSetPtr ret_val;
47080 xmlNodeSetPtr nodes1; /* a node-set */
47081 int n_nodes1;
47082 xmlNodeSetPtr nodes2; /* a node-set */
47083 int n_nodes2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047084
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047085 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
47086 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
47087 mem_base = xmlMemBlocks();
47088 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
47089 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
47090
47091 ret_val = xmlXPathTrailing(nodes1, nodes2);
47092 desret_xmlNodeSetPtr(ret_val);
47093 call_tests++;
47094 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
47095 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
47096 xmlResetLastError();
47097 if (mem_base != xmlMemBlocks()) {
47098 printf("Leak of %d blocks found in xmlXPathTrailing",
47099 xmlMemBlocks() - mem_base);
47100 test_ret++;
47101 printf(" %d", n_nodes1);
47102 printf(" %d", n_nodes2);
47103 printf("\n");
47104 }
47105 }
47106 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047107 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047108#endif
47109
Daniel Veillarda82b1822004-11-08 16:24:57 +000047110 return(test_ret);
47111}
47112
47113
47114static int
47115test_xmlXPathTrailingSorted(void) {
47116 int test_ret = 0;
47117
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047118#ifdef LIBXML_XPATH_ENABLED
47119 int mem_base;
47120 xmlNodeSetPtr ret_val;
47121 xmlNodeSetPtr nodes1; /* a node-set, sorted by document order */
47122 int n_nodes1;
47123 xmlNodeSetPtr nodes2; /* a node-set, sorted by document order */
47124 int n_nodes2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047125
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047126 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
47127 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
47128 mem_base = xmlMemBlocks();
47129 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
47130 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
47131
47132 ret_val = xmlXPathTrailingSorted(nodes1, nodes2);
47133 desret_xmlNodeSetPtr(ret_val);
47134 call_tests++;
47135 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
47136 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
47137 xmlResetLastError();
47138 if (mem_base != xmlMemBlocks()) {
47139 printf("Leak of %d blocks found in xmlXPathTrailingSorted",
47140 xmlMemBlocks() - mem_base);
47141 test_ret++;
47142 printf(" %d", n_nodes1);
47143 printf(" %d", n_nodes2);
47144 printf("\n");
47145 }
47146 }
47147 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047148 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047149#endif
47150
Daniel Veillarda82b1822004-11-08 16:24:57 +000047151 return(test_ret);
47152}
47153
47154
47155static int
47156test_xmlXPathTranslateFunction(void) {
47157 int test_ret = 0;
47158
47159#ifdef LIBXML_XPATH_ENABLED
47160 int mem_base;
47161 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47162 int n_ctxt;
47163 int nargs; /* the number of arguments */
47164 int n_nargs;
47165
47166 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47167 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47168 mem_base = xmlMemBlocks();
47169 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47170 nargs = gen_int(n_nargs, 1);
47171
47172 xmlXPathTranslateFunction(ctxt, nargs);
47173 call_tests++;
47174 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47175 des_int(n_nargs, nargs, 1);
47176 xmlResetLastError();
47177 if (mem_base != xmlMemBlocks()) {
47178 printf("Leak of %d blocks found in xmlXPathTranslateFunction",
47179 xmlMemBlocks() - mem_base);
47180 test_ret++;
47181 printf(" %d", n_ctxt);
47182 printf(" %d", n_nargs);
47183 printf("\n");
47184 }
47185 }
47186 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047187 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047188#endif
47189
Daniel Veillarda82b1822004-11-08 16:24:57 +000047190 return(test_ret);
47191}
47192
47193
47194static int
47195test_xmlXPathTrueFunction(void) {
47196 int test_ret = 0;
47197
47198#ifdef LIBXML_XPATH_ENABLED
47199 int mem_base;
47200 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47201 int n_ctxt;
47202 int nargs; /* the number of arguments */
47203 int n_nargs;
47204
47205 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47206 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47207 mem_base = xmlMemBlocks();
47208 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47209 nargs = gen_int(n_nargs, 1);
47210
47211 xmlXPathTrueFunction(ctxt, nargs);
47212 call_tests++;
47213 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47214 des_int(n_nargs, nargs, 1);
47215 xmlResetLastError();
47216 if (mem_base != xmlMemBlocks()) {
47217 printf("Leak of %d blocks found in xmlXPathTrueFunction",
47218 xmlMemBlocks() - mem_base);
47219 test_ret++;
47220 printf(" %d", n_ctxt);
47221 printf(" %d", n_nargs);
47222 printf("\n");
47223 }
47224 }
47225 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047226 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047227#endif
47228
Daniel Veillarda82b1822004-11-08 16:24:57 +000047229 return(test_ret);
47230}
47231
47232
47233static int
47234test_xmlXPathValueFlipSign(void) {
47235 int test_ret = 0;
47236
47237#ifdef LIBXML_XPATH_ENABLED
47238 int mem_base;
47239 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47240 int n_ctxt;
47241
47242 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47243 mem_base = xmlMemBlocks();
47244 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47245
47246 xmlXPathValueFlipSign(ctxt);
47247 call_tests++;
47248 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47249 xmlResetLastError();
47250 if (mem_base != xmlMemBlocks()) {
47251 printf("Leak of %d blocks found in xmlXPathValueFlipSign",
47252 xmlMemBlocks() - mem_base);
47253 test_ret++;
47254 printf(" %d", n_ctxt);
47255 printf("\n");
47256 }
47257 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047258 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047259#endif
47260
Daniel Veillarda82b1822004-11-08 16:24:57 +000047261 return(test_ret);
47262}
47263
47264
47265static int
47266test_xmlXPathVariableLookup(void) {
47267 int test_ret = 0;
47268
47269#ifdef LIBXML_XPATH_ENABLED
47270 int mem_base;
47271 xmlXPathObjectPtr ret_val;
47272 xmlXPathContextPtr ctxt; /* the XPath context */
47273 int n_ctxt;
47274 xmlChar * name; /* the variable name */
47275 int n_name;
47276
47277 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
47278 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
47279 mem_base = xmlMemBlocks();
47280 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
47281 name = gen_const_xmlChar_ptr(n_name, 1);
47282
William M. Brackf13f77f2004-11-12 16:03:48 +000047283 ret_val = xmlXPathVariableLookup(ctxt, (const xmlChar *)name);
Daniel Veillarda82b1822004-11-08 16:24:57 +000047284 desret_xmlXPathObjectPtr(ret_val);
47285 call_tests++;
47286 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000047287 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarda82b1822004-11-08 16:24:57 +000047288 xmlResetLastError();
47289 if (mem_base != xmlMemBlocks()) {
47290 printf("Leak of %d blocks found in xmlXPathVariableLookup",
47291 xmlMemBlocks() - mem_base);
47292 test_ret++;
47293 printf(" %d", n_ctxt);
47294 printf(" %d", n_name);
47295 printf("\n");
47296 }
47297 }
47298 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047299 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047300#endif
47301
Daniel Veillarda82b1822004-11-08 16:24:57 +000047302 return(test_ret);
47303}
47304
47305
47306static int
47307test_xmlXPathVariableLookupNS(void) {
47308 int test_ret = 0;
47309
47310#ifdef LIBXML_XPATH_ENABLED
47311 int mem_base;
47312 xmlXPathObjectPtr ret_val;
47313 xmlXPathContextPtr ctxt; /* the XPath context */
47314 int n_ctxt;
47315 xmlChar * name; /* the variable name */
47316 int n_name;
47317 xmlChar * ns_uri; /* the variable namespace URI */
47318 int n_ns_uri;
47319
47320 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
47321 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
47322 for (n_ns_uri = 0;n_ns_uri < gen_nb_const_xmlChar_ptr;n_ns_uri++) {
47323 mem_base = xmlMemBlocks();
47324 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
47325 name = gen_const_xmlChar_ptr(n_name, 1);
47326 ns_uri = gen_const_xmlChar_ptr(n_ns_uri, 2);
47327
William M. Brackf13f77f2004-11-12 16:03:48 +000047328 ret_val = xmlXPathVariableLookupNS(ctxt, (const xmlChar *)name, (const xmlChar *)ns_uri);
Daniel Veillarda82b1822004-11-08 16:24:57 +000047329 desret_xmlXPathObjectPtr(ret_val);
47330 call_tests++;
47331 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000047332 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
47333 des_const_xmlChar_ptr(n_ns_uri, (const xmlChar *)ns_uri, 2);
Daniel Veillarda82b1822004-11-08 16:24:57 +000047334 xmlResetLastError();
47335 if (mem_base != xmlMemBlocks()) {
47336 printf("Leak of %d blocks found in xmlXPathVariableLookupNS",
47337 xmlMemBlocks() - mem_base);
47338 test_ret++;
47339 printf(" %d", n_ctxt);
47340 printf(" %d", n_name);
47341 printf(" %d", n_ns_uri);
47342 printf("\n");
47343 }
47344 }
47345 }
47346 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047347 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047348#endif
47349
Daniel Veillarda82b1822004-11-08 16:24:57 +000047350 return(test_ret);
47351}
47352
47353
47354static int
47355test_xmlXPathWrapCString(void) {
47356 int test_ret = 0;
47357
47358#ifdef LIBXML_XPATH_ENABLED
47359 int mem_base;
47360 xmlXPathObjectPtr ret_val;
47361 char * val; /* the char * value */
47362 int n_val;
47363
47364 for (n_val = 0;n_val < gen_nb_char_ptr;n_val++) {
47365 mem_base = xmlMemBlocks();
47366 val = gen_char_ptr(n_val, 0);
47367
47368 ret_val = xmlXPathWrapCString(val);
47369 desret_xmlXPathObjectPtr(ret_val);
47370 call_tests++;
47371 des_char_ptr(n_val, val, 0);
47372 xmlResetLastError();
47373 if (mem_base != xmlMemBlocks()) {
47374 printf("Leak of %d blocks found in xmlXPathWrapCString",
47375 xmlMemBlocks() - mem_base);
47376 test_ret++;
47377 printf(" %d", n_val);
47378 printf("\n");
47379 }
47380 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047381 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047382#endif
47383
Daniel Veillarda82b1822004-11-08 16:24:57 +000047384 return(test_ret);
47385}
47386
47387
47388static int
47389test_xmlXPathWrapExternal(void) {
47390 int test_ret = 0;
47391
47392#ifdef LIBXML_XPATH_ENABLED
47393 int mem_base;
47394 xmlXPathObjectPtr ret_val;
47395 void * val; /* the user data */
47396 int n_val;
47397
47398 for (n_val = 0;n_val < gen_nb_void_ptr;n_val++) {
47399 mem_base = xmlMemBlocks();
47400 val = gen_void_ptr(n_val, 0);
47401
47402 ret_val = xmlXPathWrapExternal(val);
47403 desret_xmlXPathObjectPtr(ret_val);
47404 call_tests++;
47405 des_void_ptr(n_val, val, 0);
47406 xmlResetLastError();
47407 if (mem_base != xmlMemBlocks()) {
47408 printf("Leak of %d blocks found in xmlXPathWrapExternal",
47409 xmlMemBlocks() - mem_base);
47410 test_ret++;
47411 printf(" %d", n_val);
47412 printf("\n");
47413 }
47414 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047415 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047416#endif
47417
Daniel Veillarda82b1822004-11-08 16:24:57 +000047418 return(test_ret);
47419}
47420
47421
47422static int
47423test_xmlXPathWrapNodeSet(void) {
47424 int test_ret = 0;
47425
47426#ifdef LIBXML_XPATH_ENABLED
47427 int mem_base;
47428 xmlXPathObjectPtr ret_val;
47429 xmlNodeSetPtr val; /* the NodePtr value */
47430 int n_val;
47431
47432 for (n_val = 0;n_val < gen_nb_xmlNodeSetPtr;n_val++) {
47433 mem_base = xmlMemBlocks();
47434 val = gen_xmlNodeSetPtr(n_val, 0);
47435
47436 ret_val = xmlXPathWrapNodeSet(val);
47437 desret_xmlXPathObjectPtr(ret_val);
47438 call_tests++;
47439 des_xmlNodeSetPtr(n_val, val, 0);
47440 xmlResetLastError();
47441 if (mem_base != xmlMemBlocks()) {
47442 printf("Leak of %d blocks found in xmlXPathWrapNodeSet",
47443 xmlMemBlocks() - mem_base);
47444 test_ret++;
47445 printf(" %d", n_val);
47446 printf("\n");
47447 }
47448 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047449 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047450#endif
47451
Daniel Veillarda82b1822004-11-08 16:24:57 +000047452 return(test_ret);
47453}
47454
47455
47456static int
47457test_xmlXPatherror(void) {
47458 int test_ret = 0;
47459
47460#ifdef LIBXML_XPATH_ENABLED
47461 int mem_base;
47462 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47463 int n_ctxt;
47464 const char * file; /* the file name */
47465 int n_file;
47466 int line; /* the line number */
47467 int n_line;
47468 int no; /* the error number */
47469 int n_no;
47470
47471 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47472 for (n_file = 0;n_file < gen_nb_filepath;n_file++) {
47473 for (n_line = 0;n_line < gen_nb_int;n_line++) {
47474 for (n_no = 0;n_no < gen_nb_int;n_no++) {
47475 mem_base = xmlMemBlocks();
47476 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47477 file = gen_filepath(n_file, 1);
47478 line = gen_int(n_line, 2);
47479 no = gen_int(n_no, 3);
47480
47481 xmlXPatherror(ctxt, file, line, no);
47482 call_tests++;
47483 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47484 des_filepath(n_file, file, 1);
47485 des_int(n_line, line, 2);
47486 des_int(n_no, no, 3);
47487 xmlResetLastError();
47488 if (mem_base != xmlMemBlocks()) {
47489 printf("Leak of %d blocks found in xmlXPatherror",
47490 xmlMemBlocks() - mem_base);
47491 test_ret++;
47492 printf(" %d", n_ctxt);
47493 printf(" %d", n_file);
47494 printf(" %d", n_line);
47495 printf(" %d", n_no);
47496 printf("\n");
47497 }
47498 }
47499 }
47500 }
47501 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047502 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047503#endif
47504
Daniel Veillarda82b1822004-11-08 16:24:57 +000047505 return(test_ret);
47506}
47507
47508static int
47509test_xpathInternals(void) {
47510 int test_ret = 0;
47511
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047512 if (quiet == 0) printf("Testing xpathInternals : 106 of 117 functions ...\n");
Daniel Veillarda82b1822004-11-08 16:24:57 +000047513 test_ret += test_valuePop();
47514 test_ret += test_valuePush();
47515 test_ret += test_xmlXPathAddValues();
47516 test_ret += test_xmlXPathBooleanFunction();
47517 test_ret += test_xmlXPathCeilingFunction();
47518 test_ret += test_xmlXPathCompareValues();
47519 test_ret += test_xmlXPathConcatFunction();
47520 test_ret += test_xmlXPathContainsFunction();
47521 test_ret += test_xmlXPathCountFunction();
47522 test_ret += test_xmlXPathDebugDumpCompExpr();
47523 test_ret += test_xmlXPathDebugDumpObject();
47524 test_ret += test_xmlXPathDifference();
47525 test_ret += test_xmlXPathDistinct();
47526 test_ret += test_xmlXPathDistinctSorted();
47527 test_ret += test_xmlXPathDivValues();
47528 test_ret += test_xmlXPathEqualValues();
47529 test_ret += test_xmlXPathErr();
47530 test_ret += test_xmlXPathEvalExpr();
47531 test_ret += test_xmlXPathEvaluatePredicateResult();
47532 test_ret += test_xmlXPathFalseFunction();
47533 test_ret += test_xmlXPathFloorFunction();
47534 test_ret += test_xmlXPathFunctionLookup();
47535 test_ret += test_xmlXPathFunctionLookupNS();
47536 test_ret += test_xmlXPathHasSameNodes();
47537 test_ret += test_xmlXPathIdFunction();
47538 test_ret += test_xmlXPathIntersection();
47539 test_ret += test_xmlXPathIsNodeType();
47540 test_ret += test_xmlXPathLangFunction();
47541 test_ret += test_xmlXPathLastFunction();
47542 test_ret += test_xmlXPathLeading();
47543 test_ret += test_xmlXPathLeadingSorted();
47544 test_ret += test_xmlXPathLocalNameFunction();
47545 test_ret += test_xmlXPathModValues();
47546 test_ret += test_xmlXPathMultValues();
47547 test_ret += test_xmlXPathNamespaceURIFunction();
47548 test_ret += test_xmlXPathNewBoolean();
47549 test_ret += test_xmlXPathNewCString();
47550 test_ret += test_xmlXPathNewFloat();
47551 test_ret += test_xmlXPathNewNodeSet();
47552 test_ret += test_xmlXPathNewNodeSetList();
47553 test_ret += test_xmlXPathNewParserContext();
47554 test_ret += test_xmlXPathNewString();
47555 test_ret += test_xmlXPathNextAncestor();
47556 test_ret += test_xmlXPathNextAncestorOrSelf();
47557 test_ret += test_xmlXPathNextAttribute();
47558 test_ret += test_xmlXPathNextChild();
47559 test_ret += test_xmlXPathNextDescendant();
47560 test_ret += test_xmlXPathNextDescendantOrSelf();
47561 test_ret += test_xmlXPathNextFollowing();
47562 test_ret += test_xmlXPathNextFollowingSibling();
47563 test_ret += test_xmlXPathNextNamespace();
47564 test_ret += test_xmlXPathNextParent();
47565 test_ret += test_xmlXPathNextPreceding();
47566 test_ret += test_xmlXPathNextPrecedingSibling();
47567 test_ret += test_xmlXPathNextSelf();
47568 test_ret += test_xmlXPathNodeLeading();
47569 test_ret += test_xmlXPathNodeLeadingSorted();
47570 test_ret += test_xmlXPathNodeSetAdd();
47571 test_ret += test_xmlXPathNodeSetAddNs();
47572 test_ret += test_xmlXPathNodeSetAddUnique();
47573 test_ret += test_xmlXPathNodeSetContains();
47574 test_ret += test_xmlXPathNodeSetDel();
47575 test_ret += test_xmlXPathNodeSetMerge();
47576 test_ret += test_xmlXPathNodeSetRemove();
47577 test_ret += test_xmlXPathNodeSetSort();
47578 test_ret += test_xmlXPathNodeTrailing();
47579 test_ret += test_xmlXPathNodeTrailingSorted();
47580 test_ret += test_xmlXPathNormalizeFunction();
47581 test_ret += test_xmlXPathNotEqualValues();
47582 test_ret += test_xmlXPathNotFunction();
47583 test_ret += test_xmlXPathNsLookup();
47584 test_ret += test_xmlXPathNumberFunction();
47585 test_ret += test_xmlXPathParseNCName();
47586 test_ret += test_xmlXPathParseName();
47587 test_ret += test_xmlXPathPopBoolean();
47588 test_ret += test_xmlXPathPopExternal();
47589 test_ret += test_xmlXPathPopNodeSet();
47590 test_ret += test_xmlXPathPopNumber();
47591 test_ret += test_xmlXPathPopString();
47592 test_ret += test_xmlXPathPositionFunction();
47593 test_ret += test_xmlXPathRegisterAllFunctions();
47594 test_ret += test_xmlXPathRegisterFunc();
47595 test_ret += test_xmlXPathRegisterFuncLookup();
47596 test_ret += test_xmlXPathRegisterFuncNS();
47597 test_ret += test_xmlXPathRegisterNs();
47598 test_ret += test_xmlXPathRegisterVariable();
47599 test_ret += test_xmlXPathRegisterVariableLookup();
47600 test_ret += test_xmlXPathRegisterVariableNS();
47601 test_ret += test_xmlXPathRegisteredFuncsCleanup();
47602 test_ret += test_xmlXPathRegisteredNsCleanup();
47603 test_ret += test_xmlXPathRegisteredVariablesCleanup();
47604 test_ret += test_xmlXPathRoot();
47605 test_ret += test_xmlXPathRoundFunction();
47606 test_ret += test_xmlXPathStartsWithFunction();
47607 test_ret += test_xmlXPathStringEvalNumber();
47608 test_ret += test_xmlXPathStringFunction();
47609 test_ret += test_xmlXPathStringLengthFunction();
47610 test_ret += test_xmlXPathSubValues();
47611 test_ret += test_xmlXPathSubstringAfterFunction();
47612 test_ret += test_xmlXPathSubstringBeforeFunction();
47613 test_ret += test_xmlXPathSubstringFunction();
47614 test_ret += test_xmlXPathSumFunction();
47615 test_ret += test_xmlXPathTrailing();
47616 test_ret += test_xmlXPathTrailingSorted();
47617 test_ret += test_xmlXPathTranslateFunction();
47618 test_ret += test_xmlXPathTrueFunction();
47619 test_ret += test_xmlXPathValueFlipSign();
47620 test_ret += test_xmlXPathVariableLookup();
47621 test_ret += test_xmlXPathVariableLookupNS();
47622 test_ret += test_xmlXPathWrapCString();
47623 test_ret += test_xmlXPathWrapExternal();
47624 test_ret += test_xmlXPathWrapNodeSet();
47625 test_ret += test_xmlXPatherror();
47626
47627 if (test_ret != 0)
47628 printf("Module xpathInternals: %d errors\n", test_ret);
47629 return(test_ret);
47630}
47631
Daniel Veillardd93f6252004-11-02 15:53:51 +000047632static int
47633test_xmlXPtrBuildNodeList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000047634 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047635
Daniel Veillardd005b9e2004-11-03 17:07:05 +000047636#ifdef LIBXML_XPTR_ENABLED
47637 int mem_base;
47638 xmlNodePtr ret_val;
47639 xmlXPathObjectPtr obj; /* the XPointer result from the evaluation. */
47640 int n_obj;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047641
Daniel Veillardd005b9e2004-11-03 17:07:05 +000047642 for (n_obj = 0;n_obj < gen_nb_xmlXPathObjectPtr;n_obj++) {
47643 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000047644 obj = gen_xmlXPathObjectPtr(n_obj, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000047645
47646 ret_val = xmlXPtrBuildNodeList(obj);
47647 desret_xmlNodePtr(ret_val);
47648 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000047649 des_xmlXPathObjectPtr(n_obj, obj, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000047650 xmlResetLastError();
47651 if (mem_base != xmlMemBlocks()) {
47652 printf("Leak of %d blocks found in xmlXPtrBuildNodeList",
47653 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000047654 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000047655 printf(" %d", n_obj);
47656 printf("\n");
47657 }
47658 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047659 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000047660#endif
47661
Daniel Veillard42595322004-11-08 10:52:06 +000047662 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000047663}
47664
47665
47666static int
47667test_xmlXPtrEval(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000047668 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047669
Daniel Veillardce682bc2004-11-05 17:22:25 +000047670#ifdef LIBXML_XPTR_ENABLED
47671 int mem_base;
47672 xmlXPathObjectPtr ret_val;
47673 xmlChar * str; /* the XPointer expression */
47674 int n_str;
47675 xmlXPathContextPtr ctx; /* the XPointer context */
47676 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047677
Daniel Veillardce682bc2004-11-05 17:22:25 +000047678 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
47679 for (n_ctx = 0;n_ctx < gen_nb_xmlXPathContextPtr;n_ctx++) {
47680 mem_base = xmlMemBlocks();
47681 str = gen_const_xmlChar_ptr(n_str, 0);
47682 ctx = gen_xmlXPathContextPtr(n_ctx, 1);
47683
William M. Brackf13f77f2004-11-12 16:03:48 +000047684 ret_val = xmlXPtrEval((const xmlChar *)str, ctx);
Daniel Veillardce682bc2004-11-05 17:22:25 +000047685 desret_xmlXPathObjectPtr(ret_val);
47686 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000047687 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000047688 des_xmlXPathContextPtr(n_ctx, ctx, 1);
47689 xmlResetLastError();
47690 if (mem_base != xmlMemBlocks()) {
47691 printf("Leak of %d blocks found in xmlXPtrEval",
47692 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000047693 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000047694 printf(" %d", n_str);
47695 printf(" %d", n_ctx);
47696 printf("\n");
47697 }
47698 }
47699 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047700 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000047701#endif
47702
Daniel Veillard42595322004-11-08 10:52:06 +000047703 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000047704}
47705
47706
47707static int
47708test_xmlXPtrEvalRangePredicate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000047709 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047710
Daniel Veillardce682bc2004-11-05 17:22:25 +000047711#ifdef LIBXML_XPTR_ENABLED
47712 int mem_base;
47713 xmlXPathParserContextPtr ctxt; /* the XPointer Parser context */
47714 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047715
Daniel Veillardce682bc2004-11-05 17:22:25 +000047716 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47717 mem_base = xmlMemBlocks();
47718 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47719
47720 xmlXPtrEvalRangePredicate(ctxt);
47721 call_tests++;
47722 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47723 xmlResetLastError();
47724 if (mem_base != xmlMemBlocks()) {
47725 printf("Leak of %d blocks found in xmlXPtrEvalRangePredicate",
47726 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000047727 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000047728 printf(" %d", n_ctxt);
47729 printf("\n");
47730 }
47731 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047732 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000047733#endif
47734
Daniel Veillard42595322004-11-08 10:52:06 +000047735 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000047736}
47737
Daniel Veillarda521d282004-11-09 14:59:59 +000047738#ifdef LIBXML_XPTR_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000047739
Daniel Veillardce682bc2004-11-05 17:22:25 +000047740#define gen_nb_xmlLocationSetPtr 1
47741static xmlLocationSetPtr gen_xmlLocationSetPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
47742 return(NULL);
47743}
47744static void des_xmlLocationSetPtr(int no ATTRIBUTE_UNUSED, xmlLocationSetPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
47745}
Daniel Veillarda521d282004-11-09 14:59:59 +000047746#endif
47747
Daniel Veillardce682bc2004-11-05 17:22:25 +000047748
Daniel Veillardd93f6252004-11-02 15:53:51 +000047749static int
47750test_xmlXPtrLocationSetAdd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000047751 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047752
Daniel Veillardce682bc2004-11-05 17:22:25 +000047753#ifdef LIBXML_XPTR_ENABLED
47754 int mem_base;
47755 xmlLocationSetPtr cur; /* the initial range set */
47756 int n_cur;
47757 xmlXPathObjectPtr val; /* a new xmlXPathObjectPtr */
47758 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047759
Daniel Veillardce682bc2004-11-05 17:22:25 +000047760 for (n_cur = 0;n_cur < gen_nb_xmlLocationSetPtr;n_cur++) {
47761 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
47762 mem_base = xmlMemBlocks();
47763 cur = gen_xmlLocationSetPtr(n_cur, 0);
47764 val = gen_xmlXPathObjectPtr(n_val, 1);
47765
47766 xmlXPtrLocationSetAdd(cur, val);
47767 call_tests++;
47768 des_xmlLocationSetPtr(n_cur, cur, 0);
47769 des_xmlXPathObjectPtr(n_val, val, 1);
47770 xmlResetLastError();
47771 if (mem_base != xmlMemBlocks()) {
47772 printf("Leak of %d blocks found in xmlXPtrLocationSetAdd",
47773 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000047774 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000047775 printf(" %d", n_cur);
47776 printf(" %d", n_val);
47777 printf("\n");
47778 }
47779 }
47780 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047781 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000047782#endif
47783
Daniel Veillard42595322004-11-08 10:52:06 +000047784 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000047785}
47786
47787
47788static int
47789test_xmlXPtrLocationSetCreate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000047790 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047791
47792
47793 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000047794 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000047795}
47796
47797
47798static int
47799test_xmlXPtrLocationSetDel(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000047800 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047801
Daniel Veillardce682bc2004-11-05 17:22:25 +000047802#ifdef LIBXML_XPTR_ENABLED
47803 int mem_base;
47804 xmlLocationSetPtr cur; /* the initial range set */
47805 int n_cur;
47806 xmlXPathObjectPtr val; /* an xmlXPathObjectPtr */
47807 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047808
Daniel Veillardce682bc2004-11-05 17:22:25 +000047809 for (n_cur = 0;n_cur < gen_nb_xmlLocationSetPtr;n_cur++) {
47810 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
47811 mem_base = xmlMemBlocks();
47812 cur = gen_xmlLocationSetPtr(n_cur, 0);
47813 val = gen_xmlXPathObjectPtr(n_val, 1);
47814
47815 xmlXPtrLocationSetDel(cur, val);
47816 call_tests++;
47817 des_xmlLocationSetPtr(n_cur, cur, 0);
47818 des_xmlXPathObjectPtr(n_val, val, 1);
47819 xmlResetLastError();
47820 if (mem_base != xmlMemBlocks()) {
47821 printf("Leak of %d blocks found in xmlXPtrLocationSetDel",
47822 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000047823 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000047824 printf(" %d", n_cur);
47825 printf(" %d", n_val);
47826 printf("\n");
47827 }
47828 }
47829 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047830 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000047831#endif
47832
Daniel Veillard42595322004-11-08 10:52:06 +000047833 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000047834}
47835
47836
47837static int
47838test_xmlXPtrLocationSetMerge(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000047839 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047840
47841
47842 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000047843 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000047844}
47845
47846
47847static int
47848test_xmlXPtrLocationSetRemove(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000047849 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047850
Daniel Veillardce682bc2004-11-05 17:22:25 +000047851#ifdef LIBXML_XPTR_ENABLED
47852 int mem_base;
47853 xmlLocationSetPtr cur; /* the initial range set */
47854 int n_cur;
47855 int val; /* the index to remove */
47856 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047857
Daniel Veillardce682bc2004-11-05 17:22:25 +000047858 for (n_cur = 0;n_cur < gen_nb_xmlLocationSetPtr;n_cur++) {
47859 for (n_val = 0;n_val < gen_nb_int;n_val++) {
47860 mem_base = xmlMemBlocks();
47861 cur = gen_xmlLocationSetPtr(n_cur, 0);
47862 val = gen_int(n_val, 1);
47863
47864 xmlXPtrLocationSetRemove(cur, val);
47865 call_tests++;
47866 des_xmlLocationSetPtr(n_cur, cur, 0);
47867 des_int(n_val, val, 1);
47868 xmlResetLastError();
47869 if (mem_base != xmlMemBlocks()) {
47870 printf("Leak of %d blocks found in xmlXPtrLocationSetRemove",
47871 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000047872 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000047873 printf(" %d", n_cur);
47874 printf(" %d", n_val);
47875 printf("\n");
47876 }
47877 }
47878 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047879 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000047880#endif
47881
Daniel Veillard42595322004-11-08 10:52:06 +000047882 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000047883}
47884
47885
47886static int
47887test_xmlXPtrNewCollapsedRange(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000047888 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047889
Daniel Veillard3d97e662004-11-04 10:49:00 +000047890#ifdef LIBXML_XPTR_ENABLED
47891 int mem_base;
47892 xmlXPathObjectPtr ret_val;
47893 xmlNodePtr start; /* the starting and ending node */
47894 int n_start;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047895
Daniel Veillard3d97e662004-11-04 10:49:00 +000047896 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
47897 mem_base = xmlMemBlocks();
47898 start = gen_xmlNodePtr(n_start, 0);
47899
47900 ret_val = xmlXPtrNewCollapsedRange(start);
47901 desret_xmlXPathObjectPtr(ret_val);
47902 call_tests++;
47903 des_xmlNodePtr(n_start, start, 0);
47904 xmlResetLastError();
47905 if (mem_base != xmlMemBlocks()) {
47906 printf("Leak of %d blocks found in xmlXPtrNewCollapsedRange",
47907 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000047908 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000047909 printf(" %d", n_start);
47910 printf("\n");
47911 }
47912 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047913 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000047914#endif
47915
Daniel Veillard42595322004-11-08 10:52:06 +000047916 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000047917}
47918
47919
47920static int
47921test_xmlXPtrNewContext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000047922 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047923
47924
47925 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000047926 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000047927}
47928
47929
47930static int
47931test_xmlXPtrNewLocationSetNodeSet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000047932 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047933
Daniel Veillardce682bc2004-11-05 17:22:25 +000047934#ifdef LIBXML_XPTR_ENABLED
47935 int mem_base;
47936 xmlXPathObjectPtr ret_val;
47937 xmlNodeSetPtr set; /* a node set */
47938 int n_set;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047939
Daniel Veillardce682bc2004-11-05 17:22:25 +000047940 for (n_set = 0;n_set < gen_nb_xmlNodeSetPtr;n_set++) {
47941 mem_base = xmlMemBlocks();
47942 set = gen_xmlNodeSetPtr(n_set, 0);
47943
47944 ret_val = xmlXPtrNewLocationSetNodeSet(set);
47945 desret_xmlXPathObjectPtr(ret_val);
47946 call_tests++;
47947 des_xmlNodeSetPtr(n_set, set, 0);
47948 xmlResetLastError();
47949 if (mem_base != xmlMemBlocks()) {
47950 printf("Leak of %d blocks found in xmlXPtrNewLocationSetNodeSet",
47951 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000047952 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000047953 printf(" %d", n_set);
47954 printf("\n");
47955 }
47956 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047957 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000047958#endif
47959
Daniel Veillard42595322004-11-08 10:52:06 +000047960 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000047961}
47962
47963
47964static int
47965test_xmlXPtrNewLocationSetNodes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000047966 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047967
Daniel Veillard3d97e662004-11-04 10:49:00 +000047968#ifdef LIBXML_XPTR_ENABLED
47969 int mem_base;
47970 xmlXPathObjectPtr ret_val;
47971 xmlNodePtr start; /* the start NodePtr value */
47972 int n_start;
47973 xmlNodePtr end; /* the end NodePtr value or NULL */
47974 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047975
Daniel Veillard3d97e662004-11-04 10:49:00 +000047976 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
47977 for (n_end = 0;n_end < gen_nb_xmlNodePtr;n_end++) {
47978 mem_base = xmlMemBlocks();
47979 start = gen_xmlNodePtr(n_start, 0);
47980 end = gen_xmlNodePtr(n_end, 1);
47981
47982 ret_val = xmlXPtrNewLocationSetNodes(start, end);
47983 desret_xmlXPathObjectPtr(ret_val);
47984 call_tests++;
47985 des_xmlNodePtr(n_start, start, 0);
47986 des_xmlNodePtr(n_end, end, 1);
47987 xmlResetLastError();
47988 if (mem_base != xmlMemBlocks()) {
47989 printf("Leak of %d blocks found in xmlXPtrNewLocationSetNodes",
47990 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000047991 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000047992 printf(" %d", n_start);
47993 printf(" %d", n_end);
47994 printf("\n");
47995 }
47996 }
47997 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047998 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000047999#endif
48000
Daniel Veillard42595322004-11-08 10:52:06 +000048001 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048002}
48003
48004
48005static int
48006test_xmlXPtrNewRange(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048007 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048008
Daniel Veillard3d97e662004-11-04 10:49:00 +000048009#ifdef LIBXML_XPTR_ENABLED
48010 int mem_base;
48011 xmlXPathObjectPtr ret_val;
48012 xmlNodePtr start; /* the starting node */
48013 int n_start;
48014 int startindex; /* the start index */
48015 int n_startindex;
48016 xmlNodePtr end; /* the ending point */
48017 int n_end;
48018 int endindex; /* the ending index */
48019 int n_endindex;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048020
Daniel Veillard3d97e662004-11-04 10:49:00 +000048021 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
48022 for (n_startindex = 0;n_startindex < gen_nb_int;n_startindex++) {
48023 for (n_end = 0;n_end < gen_nb_xmlNodePtr;n_end++) {
48024 for (n_endindex = 0;n_endindex < gen_nb_int;n_endindex++) {
48025 mem_base = xmlMemBlocks();
48026 start = gen_xmlNodePtr(n_start, 0);
48027 startindex = gen_int(n_startindex, 1);
48028 end = gen_xmlNodePtr(n_end, 2);
48029 endindex = gen_int(n_endindex, 3);
48030
48031 ret_val = xmlXPtrNewRange(start, startindex, end, endindex);
48032 desret_xmlXPathObjectPtr(ret_val);
48033 call_tests++;
48034 des_xmlNodePtr(n_start, start, 0);
48035 des_int(n_startindex, startindex, 1);
48036 des_xmlNodePtr(n_end, end, 2);
48037 des_int(n_endindex, endindex, 3);
48038 xmlResetLastError();
48039 if (mem_base != xmlMemBlocks()) {
48040 printf("Leak of %d blocks found in xmlXPtrNewRange",
48041 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048042 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048043 printf(" %d", n_start);
48044 printf(" %d", n_startindex);
48045 printf(" %d", n_end);
48046 printf(" %d", n_endindex);
48047 printf("\n");
48048 }
48049 }
48050 }
48051 }
48052 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048053 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048054#endif
48055
Daniel Veillard42595322004-11-08 10:52:06 +000048056 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048057}
48058
48059
48060static int
48061test_xmlXPtrNewRangeNodeObject(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048062 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048063
Daniel Veillard3d97e662004-11-04 10:49:00 +000048064#ifdef LIBXML_XPTR_ENABLED
48065 int mem_base;
48066 xmlXPathObjectPtr ret_val;
48067 xmlNodePtr start; /* the starting node */
48068 int n_start;
48069 xmlXPathObjectPtr end; /* the ending object */
48070 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048071
Daniel Veillard3d97e662004-11-04 10:49:00 +000048072 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
48073 for (n_end = 0;n_end < gen_nb_xmlXPathObjectPtr;n_end++) {
48074 mem_base = xmlMemBlocks();
48075 start = gen_xmlNodePtr(n_start, 0);
48076 end = gen_xmlXPathObjectPtr(n_end, 1);
48077
48078 ret_val = xmlXPtrNewRangeNodeObject(start, end);
48079 desret_xmlXPathObjectPtr(ret_val);
48080 call_tests++;
48081 des_xmlNodePtr(n_start, start, 0);
48082 des_xmlXPathObjectPtr(n_end, end, 1);
48083 xmlResetLastError();
48084 if (mem_base != xmlMemBlocks()) {
48085 printf("Leak of %d blocks found in xmlXPtrNewRangeNodeObject",
48086 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048087 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048088 printf(" %d", n_start);
48089 printf(" %d", n_end);
48090 printf("\n");
48091 }
48092 }
48093 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048094 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048095#endif
48096
Daniel Veillard42595322004-11-08 10:52:06 +000048097 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048098}
48099
48100
48101static int
48102test_xmlXPtrNewRangeNodePoint(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048103 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048104
Daniel Veillard3d97e662004-11-04 10:49:00 +000048105#ifdef LIBXML_XPTR_ENABLED
48106 int mem_base;
48107 xmlXPathObjectPtr ret_val;
48108 xmlNodePtr start; /* the starting node */
48109 int n_start;
48110 xmlXPathObjectPtr end; /* the ending point */
48111 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048112
Daniel Veillard3d97e662004-11-04 10:49:00 +000048113 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
48114 for (n_end = 0;n_end < gen_nb_xmlXPathObjectPtr;n_end++) {
48115 mem_base = xmlMemBlocks();
48116 start = gen_xmlNodePtr(n_start, 0);
48117 end = gen_xmlXPathObjectPtr(n_end, 1);
48118
48119 ret_val = xmlXPtrNewRangeNodePoint(start, end);
48120 desret_xmlXPathObjectPtr(ret_val);
48121 call_tests++;
48122 des_xmlNodePtr(n_start, start, 0);
48123 des_xmlXPathObjectPtr(n_end, end, 1);
48124 xmlResetLastError();
48125 if (mem_base != xmlMemBlocks()) {
48126 printf("Leak of %d blocks found in xmlXPtrNewRangeNodePoint",
48127 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048128 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048129 printf(" %d", n_start);
48130 printf(" %d", n_end);
48131 printf("\n");
48132 }
48133 }
48134 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048135 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048136#endif
48137
Daniel Veillard42595322004-11-08 10:52:06 +000048138 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048139}
48140
48141
48142static int
48143test_xmlXPtrNewRangeNodes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048144 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048145
Daniel Veillard3d97e662004-11-04 10:49:00 +000048146#ifdef LIBXML_XPTR_ENABLED
48147 int mem_base;
48148 xmlXPathObjectPtr ret_val;
48149 xmlNodePtr start; /* the starting node */
48150 int n_start;
48151 xmlNodePtr end; /* the ending node */
48152 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048153
Daniel Veillard3d97e662004-11-04 10:49:00 +000048154 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
48155 for (n_end = 0;n_end < gen_nb_xmlNodePtr;n_end++) {
48156 mem_base = xmlMemBlocks();
48157 start = gen_xmlNodePtr(n_start, 0);
48158 end = gen_xmlNodePtr(n_end, 1);
48159
48160 ret_val = xmlXPtrNewRangeNodes(start, end);
48161 desret_xmlXPathObjectPtr(ret_val);
48162 call_tests++;
48163 des_xmlNodePtr(n_start, start, 0);
48164 des_xmlNodePtr(n_end, end, 1);
48165 xmlResetLastError();
48166 if (mem_base != xmlMemBlocks()) {
48167 printf("Leak of %d blocks found in xmlXPtrNewRangeNodes",
48168 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048169 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048170 printf(" %d", n_start);
48171 printf(" %d", n_end);
48172 printf("\n");
48173 }
48174 }
48175 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048176 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048177#endif
48178
Daniel Veillard42595322004-11-08 10:52:06 +000048179 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048180}
48181
48182
48183static int
48184test_xmlXPtrNewRangePointNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048185 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048186
Daniel Veillard3d97e662004-11-04 10:49:00 +000048187#ifdef LIBXML_XPTR_ENABLED
48188 int mem_base;
48189 xmlXPathObjectPtr ret_val;
48190 xmlXPathObjectPtr start; /* the starting point */
48191 int n_start;
48192 xmlNodePtr end; /* the ending node */
48193 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048194
Daniel Veillard3d97e662004-11-04 10:49:00 +000048195 for (n_start = 0;n_start < gen_nb_xmlXPathObjectPtr;n_start++) {
48196 for (n_end = 0;n_end < gen_nb_xmlNodePtr;n_end++) {
48197 mem_base = xmlMemBlocks();
48198 start = gen_xmlXPathObjectPtr(n_start, 0);
48199 end = gen_xmlNodePtr(n_end, 1);
48200
48201 ret_val = xmlXPtrNewRangePointNode(start, end);
48202 desret_xmlXPathObjectPtr(ret_val);
48203 call_tests++;
48204 des_xmlXPathObjectPtr(n_start, start, 0);
48205 des_xmlNodePtr(n_end, end, 1);
48206 xmlResetLastError();
48207 if (mem_base != xmlMemBlocks()) {
48208 printf("Leak of %d blocks found in xmlXPtrNewRangePointNode",
48209 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048210 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048211 printf(" %d", n_start);
48212 printf(" %d", n_end);
48213 printf("\n");
48214 }
48215 }
48216 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048217 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048218#endif
48219
Daniel Veillard42595322004-11-08 10:52:06 +000048220 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048221}
48222
48223
48224static int
48225test_xmlXPtrNewRangePoints(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048226 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048227
Daniel Veillard3d97e662004-11-04 10:49:00 +000048228#ifdef LIBXML_XPTR_ENABLED
48229 int mem_base;
48230 xmlXPathObjectPtr ret_val;
48231 xmlXPathObjectPtr start; /* the starting point */
48232 int n_start;
48233 xmlXPathObjectPtr end; /* the ending point */
48234 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048235
Daniel Veillard3d97e662004-11-04 10:49:00 +000048236 for (n_start = 0;n_start < gen_nb_xmlXPathObjectPtr;n_start++) {
48237 for (n_end = 0;n_end < gen_nb_xmlXPathObjectPtr;n_end++) {
48238 mem_base = xmlMemBlocks();
48239 start = gen_xmlXPathObjectPtr(n_start, 0);
48240 end = gen_xmlXPathObjectPtr(n_end, 1);
48241
48242 ret_val = xmlXPtrNewRangePoints(start, end);
48243 desret_xmlXPathObjectPtr(ret_val);
48244 call_tests++;
48245 des_xmlXPathObjectPtr(n_start, start, 0);
48246 des_xmlXPathObjectPtr(n_end, end, 1);
48247 xmlResetLastError();
48248 if (mem_base != xmlMemBlocks()) {
48249 printf("Leak of %d blocks found in xmlXPtrNewRangePoints",
48250 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048251 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048252 printf(" %d", n_start);
48253 printf(" %d", n_end);
48254 printf("\n");
48255 }
48256 }
48257 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048258 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048259#endif
48260
Daniel Veillard42595322004-11-08 10:52:06 +000048261 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048262}
48263
48264
48265static int
48266test_xmlXPtrRangeToFunction(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048267 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048268
Daniel Veillardce682bc2004-11-05 17:22:25 +000048269#ifdef LIBXML_XPTR_ENABLED
48270 int mem_base;
48271 xmlXPathParserContextPtr ctxt; /* the XPointer Parser context */
48272 int n_ctxt;
48273 int nargs; /* the number of args */
48274 int n_nargs;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048275
Daniel Veillardce682bc2004-11-05 17:22:25 +000048276 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
48277 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
48278 mem_base = xmlMemBlocks();
48279 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
48280 nargs = gen_int(n_nargs, 1);
48281
48282 xmlXPtrRangeToFunction(ctxt, nargs);
48283 call_tests++;
48284 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
48285 des_int(n_nargs, nargs, 1);
48286 xmlResetLastError();
48287 if (mem_base != xmlMemBlocks()) {
48288 printf("Leak of %d blocks found in xmlXPtrRangeToFunction",
48289 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048290 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048291 printf(" %d", n_ctxt);
48292 printf(" %d", n_nargs);
48293 printf("\n");
48294 }
48295 }
48296 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048297 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048298#endif
48299
Daniel Veillard42595322004-11-08 10:52:06 +000048300 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048301}
48302
48303
48304static int
48305test_xmlXPtrWrapLocationSet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048306 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048307
Daniel Veillardce682bc2004-11-05 17:22:25 +000048308#ifdef LIBXML_XPTR_ENABLED
48309 int mem_base;
48310 xmlXPathObjectPtr ret_val;
48311 xmlLocationSetPtr val; /* the LocationSet value */
48312 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048313
Daniel Veillardce682bc2004-11-05 17:22:25 +000048314 for (n_val = 0;n_val < gen_nb_xmlLocationSetPtr;n_val++) {
48315 mem_base = xmlMemBlocks();
48316 val = gen_xmlLocationSetPtr(n_val, 0);
48317
48318 ret_val = xmlXPtrWrapLocationSet(val);
48319 desret_xmlXPathObjectPtr(ret_val);
48320 call_tests++;
48321 des_xmlLocationSetPtr(n_val, val, 0);
48322 xmlResetLastError();
48323 if (mem_base != xmlMemBlocks()) {
48324 printf("Leak of %d blocks found in xmlXPtrWrapLocationSet",
48325 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048326 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048327 printf(" %d", n_val);
48328 printf("\n");
48329 }
48330 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048331 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048332#endif
48333
Daniel Veillard42595322004-11-08 10:52:06 +000048334 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048335}
48336
48337static int
48338test_xpointer(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048339 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048340
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048341 if (quiet == 0) printf("Testing xpointer : 17 of 21 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000048342 test_ret += test_xmlXPtrBuildNodeList();
48343 test_ret += test_xmlXPtrEval();
48344 test_ret += test_xmlXPtrEvalRangePredicate();
48345 test_ret += test_xmlXPtrLocationSetAdd();
48346 test_ret += test_xmlXPtrLocationSetCreate();
48347 test_ret += test_xmlXPtrLocationSetDel();
48348 test_ret += test_xmlXPtrLocationSetMerge();
48349 test_ret += test_xmlXPtrLocationSetRemove();
48350 test_ret += test_xmlXPtrNewCollapsedRange();
48351 test_ret += test_xmlXPtrNewContext();
48352 test_ret += test_xmlXPtrNewLocationSetNodeSet();
48353 test_ret += test_xmlXPtrNewLocationSetNodes();
48354 test_ret += test_xmlXPtrNewRange();
48355 test_ret += test_xmlXPtrNewRangeNodeObject();
48356 test_ret += test_xmlXPtrNewRangeNodePoint();
48357 test_ret += test_xmlXPtrNewRangeNodes();
48358 test_ret += test_xmlXPtrNewRangePointNode();
48359 test_ret += test_xmlXPtrNewRangePoints();
48360 test_ret += test_xmlXPtrRangeToFunction();
48361 test_ret += test_xmlXPtrWrapLocationSet();
Daniel Veillardd93f6252004-11-02 15:53:51 +000048362
Daniel Veillard42595322004-11-08 10:52:06 +000048363 if (test_ret != 0)
48364 printf("Module xpointer: %d errors\n", test_ret);
48365 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048366}
Daniel Veillardce244ad2004-11-05 10:03:46 +000048367static int
48368test_module(const char *module) {
48369 if (!strcmp(module, "HTMLparser")) return(test_HTMLparser());
48370 if (!strcmp(module, "HTMLtree")) return(test_HTMLtree());
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000048371 if (!strcmp(module, "SAX2")) return(test_SAX2());
Daniel Veillarda82b1822004-11-08 16:24:57 +000048372 if (!strcmp(module, "c14n")) return(test_c14n());
Daniel Veillardce244ad2004-11-05 10:03:46 +000048373 if (!strcmp(module, "catalog")) return(test_catalog());
48374 if (!strcmp(module, "chvalid")) return(test_chvalid());
Daniel Veillarda82b1822004-11-08 16:24:57 +000048375 if (!strcmp(module, "debugXML")) return(test_debugXML());
Daniel Veillardce244ad2004-11-05 10:03:46 +000048376 if (!strcmp(module, "dict")) return(test_dict());
48377 if (!strcmp(module, "encoding")) return(test_encoding());
48378 if (!strcmp(module, "entities")) return(test_entities());
48379 if (!strcmp(module, "hash")) return(test_hash());
48380 if (!strcmp(module, "list")) return(test_list());
48381 if (!strcmp(module, "nanoftp")) return(test_nanoftp());
48382 if (!strcmp(module, "nanohttp")) return(test_nanohttp());
48383 if (!strcmp(module, "parser")) return(test_parser());
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000048384 if (!strcmp(module, "parserInternals")) return(test_parserInternals());
Daniel Veillardce244ad2004-11-05 10:03:46 +000048385 if (!strcmp(module, "pattern")) return(test_pattern());
48386 if (!strcmp(module, "relaxng")) return(test_relaxng());
48387 if (!strcmp(module, "schemasInternals")) return(test_schemasInternals());
48388 if (!strcmp(module, "tree")) return(test_tree());
48389 if (!strcmp(module, "uri")) return(test_uri());
48390 if (!strcmp(module, "valid")) return(test_valid());
48391 if (!strcmp(module, "xinclude")) return(test_xinclude());
48392 if (!strcmp(module, "xmlIO")) return(test_xmlIO());
Daniel Veillarda82b1822004-11-08 16:24:57 +000048393 if (!strcmp(module, "xmlautomata")) return(test_xmlautomata());
Daniel Veillardce244ad2004-11-05 10:03:46 +000048394 if (!strcmp(module, "xmlerror")) return(test_xmlerror());
48395 if (!strcmp(module, "xmlreader")) return(test_xmlreader());
Daniel Veillarda82b1822004-11-08 16:24:57 +000048396 if (!strcmp(module, "xmlregexp")) return(test_xmlregexp());
Daniel Veillardce244ad2004-11-05 10:03:46 +000048397 if (!strcmp(module, "xmlsave")) return(test_xmlsave());
48398 if (!strcmp(module, "xmlschemas")) return(test_xmlschemas());
48399 if (!strcmp(module, "xmlschemastypes")) return(test_xmlschemastypes());
48400 if (!strcmp(module, "xmlstring")) return(test_xmlstring());
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000048401 if (!strcmp(module, "xmlunicode")) return(test_xmlunicode());
Daniel Veillardce244ad2004-11-05 10:03:46 +000048402 if (!strcmp(module, "xmlwriter")) return(test_xmlwriter());
48403 if (!strcmp(module, "xpath")) return(test_xpath());
Daniel Veillarda82b1822004-11-08 16:24:57 +000048404 if (!strcmp(module, "xpathInternals")) return(test_xpathInternals());
Daniel Veillardce244ad2004-11-05 10:03:46 +000048405 if (!strcmp(module, "xpointer")) return(test_xpointer());
48406 return(0);
48407}