blob: 610e8fc0519bc37efd7d4d572c58ae3c872ee8e1 [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
114int main(int argc, char **argv) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000115 int ret;
116 int blocks, mem;
117
Daniel Veillard5ea30d72004-11-08 11:54:28 +0000118 memset(chartab, 0, sizeof(chartab));
Daniel Veillardc8311492004-11-08 16:51:13 +0000119 strncpy((char *) chartab, " chartab\n", 20);
Daniel Veillard5ea30d72004-11-08 11:54:28 +0000120 memset(inttab, 0, sizeof(inttab));
121 memset(longtab, 0, sizeof(longtab));
122
Daniel Veillarda03e3652004-11-02 18:45:30 +0000123 xmlInitParser();
Daniel Veillard3d97e662004-11-04 10:49:00 +0000124#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillarddd6d3002004-11-03 14:20:29 +0000125 xmlRelaxNGInitTypes();
Daniel Veillard3d97e662004-11-04 10:49:00 +0000126#endif
Daniel Veillarda03e3652004-11-02 18:45:30 +0000127
Daniel Veillardd93f6252004-11-02 15:53:51 +0000128 LIBXML_TEST_VERSION
129
130 xmlSetStructuredErrorFunc(NULL, structured_errors);
131
Daniel Veillardce244ad2004-11-05 10:03:46 +0000132 if (argc == 2)
133 ret = test_module(argv[1]);
134 else
135 ret = testlibxml2();
Daniel Veillardd93f6252004-11-02 15:53:51 +0000136
137 xmlCleanupParser();
138 blocks = xmlMemBlocks();
139 mem = xmlMemUsed();
140 if ((blocks != 0) || (mem != 0)) {
141 printf("testapi leaked %d bytes in %d blocks\n", mem, blocks);
142 }
143 xmlMemoryDump();
144
145 return (ret != 0);
146}
147
148#include <libxml/HTMLparser.h>
149#include <libxml/HTMLtree.h>
Daniel Veillardd93f6252004-11-02 15:53:51 +0000150#include <libxml/catalog.h>
151#include <libxml/chvalid.h>
152#include <libxml/dict.h>
153#include <libxml/encoding.h>
154#include <libxml/entities.h>
155#include <libxml/hash.h>
156#include <libxml/list.h>
157#include <libxml/nanoftp.h>
158#include <libxml/nanohttp.h>
159#include <libxml/parser.h>
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +0000160#include <libxml/parserInternals.h>
Daniel Veillardd93f6252004-11-02 15:53:51 +0000161#include <libxml/pattern.h>
162#include <libxml/relaxng.h>
163#include <libxml/schemasInternals.h>
164#include <libxml/tree.h>
165#include <libxml/uri.h>
166#include <libxml/valid.h>
167#include <libxml/xinclude.h>
168#include <libxml/xmlIO.h>
Daniel Veillardd93f6252004-11-02 15:53:51 +0000169#include <libxml/xmlerror.h>
Daniel Veillardd93f6252004-11-02 15:53:51 +0000170#include <libxml/xmlreader.h>
Daniel Veillardd93f6252004-11-02 15:53:51 +0000171#include <libxml/xmlsave.h>
172#include <libxml/xmlschemas.h>
173#include <libxml/xmlschemastypes.h>
174#include <libxml/xmlstring.h>
175#include <libxml/xmlwriter.h>
176#include <libxml/xpath.h>
177#include <libxml/xpointer.h>
Daniel Veillarda521d282004-11-09 14:59:59 +0000178#include <libxml/debugXML.h>
Daniel Veillardd93f6252004-11-02 15:53:51 +0000179
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000180#define gen_nb_void_ptr 2
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +0000181
Daniel Veillard3d97e662004-11-04 10:49:00 +0000182static void *gen_void_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +0000183 return(NULL);
184}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000185static void des_void_ptr(int no ATTRIBUTE_UNUSED, void *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +0000186}
187
Daniel Veillardce244ad2004-11-05 10:03:46 +0000188#if 0
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000189#define gen_nb_const_void_ptr 2
190
191static const void *gen_const_void_ptr(int no, int nr ATTRIBUTE_UNUSED) {
192 if (no == 0) return((const void *) "immutable string");
193 return(NULL);
194}
195static void des_const_void_ptr(int no ATTRIBUTE_UNUSED, const void *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
196}
Daniel Veillardce244ad2004-11-05 10:03:46 +0000197#endif
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000198
Daniel Veillard8a32fe42004-11-02 22:10:16 +0000199#define gen_nb_userdata 3
200
Daniel Veillard3d97e662004-11-04 10:49:00 +0000201static void *gen_userdata(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillard8a32fe42004-11-02 22:10:16 +0000202 if (no == 0) return((void *) &call_tests);
203 if (no == 1) return((void *) -1);
204 return(NULL);
205}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000206static void des_userdata(int no ATTRIBUTE_UNUSED, void *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillard8a32fe42004-11-02 22:10:16 +0000207}
208
209
Daniel Veillardd93f6252004-11-02 15:53:51 +0000210#define gen_nb_int 4
211
Daniel Veillard3d97e662004-11-04 10:49:00 +0000212static int gen_int(int no, int nr ATTRIBUTE_UNUSED) {
213 if (no == 0) return(0);
214 if (no == 1) return(1);
Daniel Veillardc2c894f2004-11-07 12:17:35 +0000215 if (no == 2) return(-1);
216 if (no == 3) return(122);
Daniel Veillard3d97e662004-11-04 10:49:00 +0000217 return(-1);
218}
219
220static void des_int(int no ATTRIBUTE_UNUSED, int val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
221}
222
Daniel Veillard6128c012004-11-08 17:16:15 +0000223#define gen_nb_parseroptions 5
224
225static int gen_parseroptions(int no, int nr ATTRIBUTE_UNUSED) {
226 if (no == 0) return(XML_PARSE_NOBLANKS | XML_PARSE_RECOVER);
227 if (no == 1) return(XML_PARSE_NOENT | XML_PARSE_DTDLOAD | XML_PARSE_DTDATTR | XML_PARSE_DTDVALID | XML_PARSE_NOCDATA);
228 if (no == 2) return(XML_PARSE_XINCLUDE | XML_PARSE_NOXINCNODE | XML_PARSE_NSCLEAN);
229 if (no == 3) return(XML_PARSE_XINCLUDE | XML_PARSE_NODICT);
230 return(XML_PARSE_SAX1);
231}
232
233static void des_parseroptions(int no ATTRIBUTE_UNUSED, int val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
234}
235
Daniel Veillardce244ad2004-11-05 10:03:46 +0000236#if 0
Daniel Veillardf2a36f92004-11-08 17:55:01 +0000237#define gen_nb_long 5
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000238
239static long gen_long(int no, int nr ATTRIBUTE_UNUSED) {
240 if (no == 0) return(0);
241 if (no == 1) return(1);
Daniel Veillardc2c894f2004-11-07 12:17:35 +0000242 if (no == 2) return(-1);
243 if (no == 3) return(122);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000244 return(-1);
245}
246
247static void des_long(int no ATTRIBUTE_UNUSED, long val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
248}
Daniel Veillardce244ad2004-11-05 10:03:46 +0000249#endif
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000250
Daniel Veillardf2a36f92004-11-08 17:55:01 +0000251#define gen_nb_xmlChar 4
252
253static xmlChar gen_xmlChar(int no, int nr ATTRIBUTE_UNUSED) {
254 if (no == 0) return('a');
255 if (no == 1) return(' ');
256 if (no == 2) return('ø');
257 return(0);
258}
259
260static void des_xmlChar(int no ATTRIBUTE_UNUSED, xmlChar val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
261}
262
Daniel Veillard3d97e662004-11-04 10:49:00 +0000263#define gen_nb_unsigned_int 3
264
265static unsigned int gen_unsigned_int(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000266 if (no == 0) return(0);
267 if (no == 1) return(1);
268 if (no == 2) return(122);
269 return(-1);
270}
271
Daniel Veillard3d97e662004-11-04 10:49:00 +0000272static void des_unsigned_int(int no ATTRIBUTE_UNUSED, unsigned int val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000273}
274
Daniel Veillard3d95c732004-11-06 22:25:14 +0000275#define gen_nb_unsigned_long 4
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000276
277static unsigned long gen_unsigned_long(int no, int nr ATTRIBUTE_UNUSED) {
278 if (no == 0) return(0);
279 if (no == 1) return(1);
280 if (no == 2) return(122);
281 return(-1);
282}
283
284static void des_unsigned_long(int no ATTRIBUTE_UNUSED, unsigned long val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
285}
286
Daniel Veillard3d95c732004-11-06 22:25:14 +0000287#define gen_nb_double 4
288
289static double gen_double(int no, int nr ATTRIBUTE_UNUSED) {
290 if (no == 0) return(0);
291 if (no == 1) return(-1.1);
Daniel Veillardc8311492004-11-08 16:51:13 +0000292#if defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_XPATH_ENABLED)
Daniel Veillard3d95c732004-11-06 22:25:14 +0000293 if (no == 2) return(xmlXPathNAN);
Daniel Veillardc8311492004-11-08 16:51:13 +0000294#endif
Daniel Veillard3d95c732004-11-06 22:25:14 +0000295 return(-1);
296}
297
298static void des_double(int no ATTRIBUTE_UNUSED, double val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
299}
300
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000301#define gen_nb_unsigned_long_ptr 2
302
303static unsigned long *gen_unsigned_long_ptr(int no, int nr) {
304 if (no == 0) return(&longtab[nr]);
305 return(NULL);
306}
307
308static void des_unsigned_long_ptr(int no ATTRIBUTE_UNUSED, unsigned long *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
309}
310
311#define gen_nb_int_ptr 2
312
313static int *gen_int_ptr(int no, int nr) {
314 if (no == 0) return(&inttab[nr]);
315 return(NULL);
316}
317
318static void des_int_ptr(int no ATTRIBUTE_UNUSED, int *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
319}
320
Daniel Veillardd93f6252004-11-02 15:53:51 +0000321#define gen_nb_const_char_ptr 4
322
Daniel Veillardce682bc2004-11-05 17:22:25 +0000323static char *gen_const_char_ptr(int no, int nr ATTRIBUTE_UNUSED) {
324 if (no == 0) return((char *) "foo");
325 if (no == 1) return((char *) "<foo/>");
326 if (no == 2) return((char *) "test/ent2");
Daniel Veillardd93f6252004-11-02 15:53:51 +0000327 return(NULL);
328}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000329static 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 +0000330}
331
Daniel Veillard8a32fe42004-11-02 22:10:16 +0000332#define gen_nb_xmlChar_ptr 2
333
Daniel Veillard3d97e662004-11-04 10:49:00 +0000334static xmlChar *gen_xmlChar_ptr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000335 if (no == 0) return(&chartab[0]);
Daniel Veillard8a32fe42004-11-02 22:10:16 +0000336 return(NULL);
337}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000338static void des_xmlChar_ptr(int no ATTRIBUTE_UNUSED, xmlChar *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillard8a32fe42004-11-02 22:10:16 +0000339}
340
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000341#define gen_nb_FILE_ptr 2
342
343static FILE *gen_FILE_ptr(int no, int nr ATTRIBUTE_UNUSED) {
344 if (no == 0) return(fopen("test.out", "a+"));
345 return(NULL);
346}
347static void des_FILE_ptr(int no ATTRIBUTE_UNUSED, FILE *val, int nr ATTRIBUTE_UNUSED) {
348 if (val != NULL) fclose(val);
349}
350
Daniel Veillarda82b1822004-11-08 16:24:57 +0000351#define gen_nb_debug_FILE_ptr 2
352static FILE *gen_debug_FILE_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
353 return(fopen("test.out", "a+"));
354}
355static void des_debug_FILE_ptr(int no ATTRIBUTE_UNUSED, FILE *val, int nr ATTRIBUTE_UNUSED) {
356 if (val != NULL) fclose(val);
357}
358
Daniel Veillardd93f6252004-11-02 15:53:51 +0000359#define gen_nb_const_xmlChar_ptr 5
360
Daniel Veillardce682bc2004-11-05 17:22:25 +0000361static xmlChar *gen_const_xmlChar_ptr(int no, int nr ATTRIBUTE_UNUSED) {
362 if (no == 0) return((xmlChar *) "foo");
363 if (no == 1) return((xmlChar *) "<foo/>");
364 if (no == 2) return((xmlChar *) "nøne");
365 if (no == 3) return((xmlChar *) " 2ab ");
Daniel Veillardd93f6252004-11-02 15:53:51 +0000366 return(NULL);
367}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000368static 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 +0000369}
370
371#define gen_nb_filepath 8
372
Daniel Veillard3d97e662004-11-04 10:49:00 +0000373static const char *gen_filepath(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000374 if (no == 0) return("missing.xml");
375 if (no == 1) return("<foo/>");
376 if (no == 2) return("test/ent2");
377 if (no == 3) return("test/valid/REC-xml-19980210.xml");
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000378 if (no == 4) return("test/valid/dtds/xhtml1-strict.dtd");
Daniel Veillardd93f6252004-11-02 15:53:51 +0000379 if (no == 5) return("http://missing.example.org/");
380 if (no == 6) return("http://missing. example.org/");
381 return(NULL);
382}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000383static void des_filepath(int no ATTRIBUTE_UNUSED, const char *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000384}
385
Daniel Veillard27f20102004-11-05 11:50:11 +0000386#define gen_nb_eaten_name 2
387
388static xmlChar *gen_eaten_name(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +0000389 if (no == 0) return(xmlStrdup(BAD_CAST "eaten"));
Daniel Veillard27f20102004-11-05 11:50:11 +0000390 return(NULL);
391}
392static void des_eaten_name(int no ATTRIBUTE_UNUSED, xmlChar *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
393}
394
Daniel Veillardd93f6252004-11-02 15:53:51 +0000395#define gen_nb_fileoutput 6
396
Daniel Veillard3d97e662004-11-04 10:49:00 +0000397static const char *gen_fileoutput(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000398 if (no == 0) return("/missing.xml");
399 if (no == 1) return("<foo/>");
400 if (no == 2) return("ftp://missing.example.org/foo");
401 if (no == 3) return("http://missing.example.org/");
402 if (no == 4) return("http://missing. example.org/");
403 return(NULL);
404}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000405static void des_fileoutput(int no ATTRIBUTE_UNUSED, const char *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000406}
407
Daniel Veillarda521d282004-11-09 14:59:59 +0000408#define gen_nb_xmlParserCtxtPtr 3
Daniel Veillard3d97e662004-11-04 10:49:00 +0000409static xmlParserCtxtPtr gen_xmlParserCtxtPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000410 if (no == 0) return(xmlNewParserCtxt());
Daniel Veillarda521d282004-11-09 14:59:59 +0000411 if (no == 1) return(xmlCreateMemoryParserCtxt("<doc/>", 6));
Daniel Veillardd93f6252004-11-02 15:53:51 +0000412 return(NULL);
413}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000414static void des_xmlParserCtxtPtr(int no ATTRIBUTE_UNUSED, xmlParserCtxtPtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000415 if (val != NULL)
416 xmlFreeParserCtxt(val);
417}
418
Daniel Veillard34099b42004-11-04 17:34:35 +0000419#define gen_nb_xmlSAXHandlerPtr 2
420static xmlSAXHandlerPtr gen_xmlSAXHandlerPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillarda521d282004-11-09 14:59:59 +0000421#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +0000422 if (no == 0) return((xmlSAXHandlerPtr) &xmlDefaultSAXHandler);
Daniel Veillarda521d282004-11-09 14:59:59 +0000423#endif
Daniel Veillard34099b42004-11-04 17:34:35 +0000424 return(NULL);
425}
426static void des_xmlSAXHandlerPtr(int no ATTRIBUTE_UNUSED, xmlSAXHandlerPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
427}
428
Daniel Veillardc0be74b2004-11-03 19:16:55 +0000429#define gen_nb_xmlValidCtxtPtr 2
Daniel Veillard3d97e662004-11-04 10:49:00 +0000430static xmlValidCtxtPtr gen_xmlValidCtxtPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillarda521d282004-11-09 14:59:59 +0000431#ifdef LIBXML_VALID_ENABLED
Daniel Veillardc0be74b2004-11-03 19:16:55 +0000432 if (no == 0) return(xmlNewValidCtxt());
Daniel Veillarda521d282004-11-09 14:59:59 +0000433#endif
Daniel Veillardc0be74b2004-11-03 19:16:55 +0000434 return(NULL);
435}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000436static void des_xmlValidCtxtPtr(int no ATTRIBUTE_UNUSED, xmlValidCtxtPtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillarda521d282004-11-09 14:59:59 +0000437#ifdef LIBXML_VALID_ENABLED
Daniel Veillardc0be74b2004-11-03 19:16:55 +0000438 if (val != NULL)
439 xmlFreeValidCtxt(val);
Daniel Veillarda521d282004-11-09 14:59:59 +0000440#endif
Daniel Veillardc0be74b2004-11-03 19:16:55 +0000441}
442
Daniel Veillard34099b42004-11-04 17:34:35 +0000443#define gen_nb_xmlParserInputBufferPtr 8
444
445static xmlParserInputBufferPtr gen_xmlParserInputBufferPtr(int no, int nr ATTRIBUTE_UNUSED) {
446 if (no == 0) return(xmlParserInputBufferCreateFilename("missing.xml", XML_CHAR_ENCODING_NONE));
447 if (no == 1) return(xmlParserInputBufferCreateFilename("<foo/>", XML_CHAR_ENCODING_NONE));
448 if (no == 2) return(xmlParserInputBufferCreateFilename("test/ent2", XML_CHAR_ENCODING_NONE));
449 if (no == 3) return(xmlParserInputBufferCreateFilename("test/valid/REC-xml-19980210.xml", XML_CHAR_ENCODING_NONE));
450 if (no == 4) return(xmlParserInputBufferCreateFilename("test/valid/dtds/xhtml1-strict.dtd", XML_CHAR_ENCODING_NONE));
451 if (no == 5) return(xmlParserInputBufferCreateFilename("http://missing.example.org/", XML_CHAR_ENCODING_NONE));
452 if (no == 6) return(xmlParserInputBufferCreateFilename("http://missing. example.org/", XML_CHAR_ENCODING_NONE));
453 return(NULL);
454}
455static void des_xmlParserInputBufferPtr(int no ATTRIBUTE_UNUSED, xmlParserInputBufferPtr val, int nr ATTRIBUTE_UNUSED) {
456 xmlFreeParserInputBuffer(val);
457}
458
Daniel Veillardd93f6252004-11-02 15:53:51 +0000459#define gen_nb_xmlDocPtr 3
Daniel Veillard3d97e662004-11-04 10:49:00 +0000460static xmlDocPtr gen_xmlDocPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000461 if (no == 0) return(xmlNewDoc(BAD_CAST "1.0"));
462 if (no == 1) return(xmlReadMemory("<foo/>", 6, "test", NULL, 0));
463 return(NULL);
464}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000465static void des_xmlDocPtr(int no ATTRIBUTE_UNUSED, xmlDocPtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardce244ad2004-11-05 10:03:46 +0000466 if ((val != NULL) && (val != api_doc) && (val->doc != api_doc))
Daniel Veillardd93f6252004-11-02 15:53:51 +0000467 xmlFreeDoc(val);
468}
469
Daniel Veillardce244ad2004-11-05 10:03:46 +0000470#define gen_nb_xmlAttrPtr 2
471static xmlAttrPtr gen_xmlAttrPtr(int no, int nr ATTRIBUTE_UNUSED) {
472 if (no == 0) return(get_api_attr());
473 return(NULL);
474}
475static void des_xmlAttrPtr(int no, xmlAttrPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
476 if (no == 0) free_api_doc();
477}
478
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000479#define gen_nb_xmlDictPtr 2
480static xmlDictPtr gen_xmlDictPtr(int no, int nr ATTRIBUTE_UNUSED) {
481 if (no == 0) return(xmlDictCreate());
482 return(NULL);
483}
484static void des_xmlDictPtr(int no ATTRIBUTE_UNUSED, xmlDictPtr val, int nr ATTRIBUTE_UNUSED) {
485 if (val != NULL)
486 xmlDictFree(val);
487}
488
Daniel Veillardce244ad2004-11-05 10:03:46 +0000489#define gen_nb_xmlNodePtr 3
Daniel Veillard3d97e662004-11-04 10:49:00 +0000490static xmlNodePtr gen_xmlNodePtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000491 if (no == 0) return(xmlNewPI(BAD_CAST "test", NULL));
Daniel Veillardce244ad2004-11-05 10:03:46 +0000492 if (no == 1) return(get_api_root());
Daniel Veillardd93f6252004-11-02 15:53:51 +0000493 return(NULL);
Daniel Veillardce244ad2004-11-05 10:03:46 +0000494/* if (no == 2) return((xmlNodePtr) get_api_doc()); */
Daniel Veillardd93f6252004-11-02 15:53:51 +0000495}
Daniel Veillard27f20102004-11-05 11:50:11 +0000496static void des_xmlNodePtr(int no, xmlNodePtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardce244ad2004-11-05 10:03:46 +0000497 if (no == 1) free_api_doc();
498 else if (val != NULL) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000499 xmlUnlinkNode(val);
500 xmlFreeNode(val);
501 }
502}
503
Daniel Veillard27f20102004-11-05 11:50:11 +0000504#define gen_nb_xmlDtdPtr 3
505static xmlDtdPtr gen_xmlDtdPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +0000506 if (no == 0)
507 return(xmlNewDtd(NULL, BAD_CAST "dtd", BAD_CAST"foo", BAD_CAST"bar"));
Daniel Veillard27f20102004-11-05 11:50:11 +0000508 if (no == 1) return(get_api_dtd());
509 return(NULL);
510}
511static void des_xmlDtdPtr(int no, xmlDtdPtr val, int nr ATTRIBUTE_UNUSED) {
512 if (no == 1) free_api_doc();
513 else if (val != NULL) {
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +0000514 xmlUnlinkNode((xmlNodePtr) val);
515 xmlFreeNode((xmlNodePtr) val);
Daniel Veillard27f20102004-11-05 11:50:11 +0000516 }
517}
518
519#define gen_nb_xmlNsPtr 2
520static xmlNsPtr gen_xmlNsPtr(int no, int nr ATTRIBUTE_UNUSED) {
521 if (no == 0) return(get_api_ns());
522 return(NULL);
523}
524static void des_xmlNsPtr(int no, xmlNsPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
525 if (no == 0) free_api_doc();
526}
527
Daniel Veillardd93f6252004-11-02 15:53:51 +0000528#define gen_nb_xmlNodePtr_in 3
Daniel Veillard3d97e662004-11-04 10:49:00 +0000529static xmlNodePtr gen_xmlNodePtr_in(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000530 if (no == 0) return(xmlNewPI(BAD_CAST "test", NULL));
531 if (no == 0) return(xmlNewText(BAD_CAST "text"));
532 return(NULL);
533}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000534static void des_xmlNodePtr_in(int no ATTRIBUTE_UNUSED, xmlNodePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000535}
536
Daniel Veillardc8311492004-11-08 16:51:13 +0000537#ifdef LIBXML_WRITER_ENABLED
Daniel Veillarde43cc572004-11-03 11:50:29 +0000538#define gen_nb_xmlTextWriterPtr 2
Daniel Veillard3d97e662004-11-04 10:49:00 +0000539static xmlTextWriterPtr gen_xmlTextWriterPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillarde43cc572004-11-03 11:50:29 +0000540 if (no == 0) return(xmlNewTextWriterFilename("test.out", 0));
541 return(NULL);
542}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000543static void des_xmlTextWriterPtr(int no ATTRIBUTE_UNUSED, xmlTextWriterPtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillarde43cc572004-11-03 11:50:29 +0000544 if (val != NULL) xmlFreeTextWriter(val);
545}
Daniel Veillardc8311492004-11-08 16:51:13 +0000546#endif
Daniel Veillarde43cc572004-11-03 11:50:29 +0000547
Daniel Veillardc8311492004-11-08 16:51:13 +0000548#ifdef LIBXML_READER_ENABLED
Daniel Veillarddd6d3002004-11-03 14:20:29 +0000549#define gen_nb_xmlTextReaderPtr 4
Daniel Veillard3d97e662004-11-04 10:49:00 +0000550static xmlTextReaderPtr gen_xmlTextReaderPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillarddd6d3002004-11-03 14:20:29 +0000551 if (no == 0) return(xmlNewTextReaderFilename("test/ent2"));
552 if (no == 1) return(xmlNewTextReaderFilename("test/valid/REC-xml-19980210.xml"));
553 if (no == 2) return(xmlNewTextReaderFilename("test/valid/dtds/xhtml1-strict.dtd"));
554 return(NULL);
555}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000556static void des_xmlTextReaderPtr(int no ATTRIBUTE_UNUSED, xmlTextReaderPtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillarddd6d3002004-11-03 14:20:29 +0000557 if (val != NULL) xmlFreeTextReader(val);
558}
Daniel Veillardc8311492004-11-08 16:51:13 +0000559#endif
Daniel Veillarddd6d3002004-11-03 14:20:29 +0000560
Daniel Veillard34099b42004-11-04 17:34:35 +0000561#define gen_nb_xmlBufferPtr 3
Daniel Veillard3d97e662004-11-04 10:49:00 +0000562static xmlBufferPtr gen_xmlBufferPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000563 if (no == 0) return(xmlBufferCreate());
Daniel Veillardce244ad2004-11-05 10:03:46 +0000564 if (no == 1) return(xmlBufferCreateStatic((void *)"a static buffer", 13));
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000565 return(NULL);
566}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000567static void des_xmlBufferPtr(int no ATTRIBUTE_UNUSED, xmlBufferPtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000568 if (val != NULL) {
569 xmlBufferFree(val);
570 }
571}
572
573#define gen_nb_xmlListPtr 2
Daniel Veillard3d97e662004-11-04 10:49:00 +0000574static xmlListPtr gen_xmlListPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000575 if (no == 0) return(xmlListCreate(NULL, NULL));
576 return(NULL);
577}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000578static void des_xmlListPtr(int no ATTRIBUTE_UNUSED, xmlListPtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000579 if (val != NULL) {
580 xmlListDelete(val);
581 }
582}
583
584#define gen_nb_xmlHashTablePtr 2
Daniel Veillard3d97e662004-11-04 10:49:00 +0000585static xmlHashTablePtr gen_xmlHashTablePtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000586 if (no == 0) return(xmlHashCreate(10));
587 return(NULL);
588}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000589static void des_xmlHashTablePtr(int no ATTRIBUTE_UNUSED, xmlHashTablePtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000590 if (val != NULL) {
591 xmlHashFree(val, NULL);
592 }
593}
594
595#include <libxml/xpathInternals.h>
596
Daniel Veillardc8311492004-11-08 16:51:13 +0000597#ifdef LIBXML_XPATH_ENABLED
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000598#define gen_nb_xmlXPathObjectPtr 5
Daniel Veillard3d97e662004-11-04 10:49:00 +0000599static xmlXPathObjectPtr gen_xmlXPathObjectPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000600 if (no == 0) return(xmlXPathNewString(BAD_CAST "string object"));
601 if (no == 1) return(xmlXPathNewFloat(1.1));
602 if (no == 2) return(xmlXPathNewBoolean(1));
603 if (no == 3) return(xmlXPathNewNodeSet(NULL));
604 return(NULL);
605}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000606static void des_xmlXPathObjectPtr(int no ATTRIBUTE_UNUSED, xmlXPathObjectPtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000607 if (val != NULL) {
608 xmlXPathFreeObject(val);
609 }
610}
Daniel Veillardc8311492004-11-08 16:51:13 +0000611#endif
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000612
Daniel Veillardc8311492004-11-08 16:51:13 +0000613#ifdef LIBXML_OUTPUT_ENABLED
Daniel Veillard3d97e662004-11-04 10:49:00 +0000614#define gen_nb_xmlOutputBufferPtr 2
615static xmlOutputBufferPtr gen_xmlOutputBufferPtr(int no, int nr ATTRIBUTE_UNUSED) {
616 if (no == 0) return(xmlOutputBufferCreateFilename("test.out", NULL, 0));
617 return(NULL);
618}
619static void des_xmlOutputBufferPtr(int no ATTRIBUTE_UNUSED, xmlOutputBufferPtr val, int nr ATTRIBUTE_UNUSED) {
620 if (val != NULL) {
621 xmlOutputBufferClose(val);
622 }
623}
Daniel Veillardc8311492004-11-08 16:51:13 +0000624#endif
Daniel Veillard3d97e662004-11-04 10:49:00 +0000625
Daniel Veillardc8311492004-11-08 16:51:13 +0000626#ifdef LIBXML_FTP_ENABLED
Daniel Veillard27f20102004-11-05 11:50:11 +0000627#define gen_nb_xmlNanoFTPCtxtPtr 4
628static void *gen_xmlNanoFTPCtxtPtr(int no, int nr ATTRIBUTE_UNUSED) {
629 if (no == 0) return(xmlNanoFTPNewCtxt("ftp://example.com/"));
630 if (no == 1) return(xmlNanoFTPNewCtxt("http://example.com/"));
631 if (no == 2) return(xmlNanoFTPNewCtxt("foo"));
632 return(NULL);
633}
634static void des_xmlNanoFTPCtxtPtr(int no ATTRIBUTE_UNUSED, void *val, int nr ATTRIBUTE_UNUSED) {
635 if (val != NULL) {
636 xmlNanoFTPFreeCtxt(val);
637 }
638}
Daniel Veillardc8311492004-11-08 16:51:13 +0000639#endif
Daniel Veillard27f20102004-11-05 11:50:11 +0000640
Daniel Veillardc8311492004-11-08 16:51:13 +0000641#ifdef LIBXML_HTTP_ENABLED
Daniel Veillard27f20102004-11-05 11:50:11 +0000642#define gen_nb_xmlNanoHTTPCtxtPtr 1
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +0000643static void *gen_xmlNanoHTTPCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillard27f20102004-11-05 11:50:11 +0000644 return(NULL);
645}
646static void des_xmlNanoHTTPCtxtPtr(int no ATTRIBUTE_UNUSED, void *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
647}
Daniel Veillardc8311492004-11-08 16:51:13 +0000648#endif
Daniel Veillard27f20102004-11-05 11:50:11 +0000649
Daniel Veillard3d97e662004-11-04 10:49:00 +0000650#define gen_nb_xmlCharEncoding 4
651static xmlCharEncoding gen_xmlCharEncoding(int no, int nr ATTRIBUTE_UNUSED) {
652 if (no == 0) return(XML_CHAR_ENCODING_UTF8);
653 if (no == 1) return(XML_CHAR_ENCODING_NONE);
654 if (no == 0) return(XML_CHAR_ENCODING_8859_1);
655 return(XML_CHAR_ENCODING_ERROR);
656}
657static void des_xmlCharEncoding(int no ATTRIBUTE_UNUSED, xmlCharEncoding val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
658}
659
Daniel Veillard42595322004-11-08 10:52:06 +0000660#define gen_nb_xmlHashDeallocator 2
661static void
662test_xmlHashDeallocator(void *payload ATTRIBUTE_UNUSED, xmlChar *name ATTRIBUTE_UNUSED) {
663}
664
665static xmlHashDeallocator gen_xmlHashDeallocator(int no, int nr ATTRIBUTE_UNUSED) {
666 if (no == 0) return(test_xmlHashDeallocator);
667 return(NULL);
668}
669static void des_xmlHashDeallocator(int no ATTRIBUTE_UNUSED, xmlHashDeallocator val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
670}
671
Daniel Veillardd93f6252004-11-02 15:53:51 +0000672
673static void desret_int(int val ATTRIBUTE_UNUSED) {
674}
Daniel Veillardf2a36f92004-11-08 17:55:01 +0000675static void desret_xmlChar(xmlChar val ATTRIBUTE_UNUSED) {
676}
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000677static void desret_long(long val ATTRIBUTE_UNUSED) {
678}
679static void desret_double(double val ATTRIBUTE_UNUSED) {
680}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000681static void desret_xmlCharEncoding(xmlCharEncoding val ATTRIBUTE_UNUSED) {
682}
Daniel Veillardce244ad2004-11-05 10:03:46 +0000683#if 0
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000684static void desret_const_void_ptr(void *val ATTRIBUTE_UNUSED) {
685}
Daniel Veillardce244ad2004-11-05 10:03:46 +0000686#endif
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +0000687static void desret_void_ptr(void *val ATTRIBUTE_UNUSED) {
688}
Daniel Veillardd93f6252004-11-02 15:53:51 +0000689static void desret_const_char_ptr(const char *val ATTRIBUTE_UNUSED) {
690}
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000691static void desret_const_xmlChar_ptr(const xmlChar *val ATTRIBUTE_UNUSED) {
692}
Daniel Veillard8a32fe42004-11-02 22:10:16 +0000693static void desret_xmlChar_ptr(xmlChar *val) {
694 if (val != NULL)
695 xmlFree(val);
696}
Daniel Veillardd93f6252004-11-02 15:53:51 +0000697static void desret_xmlDocPtr(xmlDocPtr val) {
Daniel Veillardce244ad2004-11-05 10:03:46 +0000698 if (val != api_doc)
699 xmlFreeDoc(val);
Daniel Veillardd93f6252004-11-02 15:53:51 +0000700}
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000701static void desret_xmlDictPtr(xmlDictPtr val) {
702 xmlDictFree(val);
703}
Daniel Veillardc8311492004-11-08 16:51:13 +0000704#ifdef LIBXML_OUTPUT_ENABLED
Daniel Veillard3d95c732004-11-06 22:25:14 +0000705static void desret_xmlOutputBufferPtr(xmlOutputBufferPtr val) {
706 xmlOutputBufferClose(val);
707}
Daniel Veillardc8311492004-11-08 16:51:13 +0000708#endif
709#ifdef LIBXML_READER_ENABLED
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000710static void desret_xmlTextReaderPtr(xmlTextReaderPtr val) {
711 xmlFreeTextReader(val);
712}
Daniel Veillardc8311492004-11-08 16:51:13 +0000713#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +0000714static void desret_xmlNodePtr(xmlNodePtr val) {
Daniel Veillardce244ad2004-11-05 10:03:46 +0000715 if ((val != NULL) && (val != api_root) && (val != (xmlNodePtr) api_doc)) {
716 xmlUnlinkNode(val);
717 xmlFreeNode(val);
718 }
Daniel Veillardd93f6252004-11-02 15:53:51 +0000719}
Daniel Veillard57b25162004-11-06 14:50:18 +0000720static void desret_xmlAttrPtr(xmlAttrPtr val) {
721 if (val != NULL) {
722 xmlUnlinkNode((xmlNodePtr) val);
723 xmlFreeNode((xmlNodePtr) val);
724 }
725}
Daniel Veillardd5cc0f72004-11-06 19:24:28 +0000726static void desret_xmlEntityPtr(xmlEntityPtr val) {
727 if (val != NULL) {
728 xmlUnlinkNode((xmlNodePtr) val);
729 xmlFreeNode((xmlNodePtr) val);
730 }
731}
Daniel Veillard42595322004-11-08 10:52:06 +0000732static void desret_xmlElementPtr(xmlElementPtr val) {
733 if (val != NULL) {
734 xmlUnlinkNode((xmlNodePtr) val);
735 }
736}
737static void desret_xmlAttributePtr(xmlAttributePtr val) {
738 if (val != NULL) {
739 xmlUnlinkNode((xmlNodePtr) val);
740 }
741}
Daniel Veillardd5cc0f72004-11-06 19:24:28 +0000742static void desret_xmlNsPtr(xmlNsPtr val ATTRIBUTE_UNUSED) {
743}
Daniel Veillard34099b42004-11-04 17:34:35 +0000744static void desret_xmlDtdPtr(xmlDtdPtr val) {
745 desret_xmlNodePtr((xmlNodePtr)val);
746}
Daniel Veillardc8311492004-11-08 16:51:13 +0000747#ifdef LIBXML_XPATH_ENABLED
Daniel Veillard3d97e662004-11-04 10:49:00 +0000748static void desret_xmlXPathObjectPtr(xmlXPathObjectPtr val) {
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000749 xmlXPathFreeObject(val);
Daniel Veillard3d97e662004-11-04 10:49:00 +0000750}
Daniel Veillardf2a36f92004-11-08 17:55:01 +0000751static void desret_xmlNodeSetPtr(xmlNodeSetPtr val) {
752 xmlXPathFreeNodeSet(val);
753}
Daniel Veillardc8311492004-11-08 16:51:13 +0000754#endif
Daniel Veillard34099b42004-11-04 17:34:35 +0000755static void desret_xmlParserCtxtPtr(xmlParserCtxtPtr val) {
756 xmlFreeParserCtxt(val);
757}
758
Daniel Veillardd5cc0f72004-11-06 19:24:28 +0000759static void desret_xmlParserInputBufferPtr(xmlParserInputBufferPtr val) {
760 xmlFreeParserInputBuffer(val);
761}
Daniel Veillard42595322004-11-08 10:52:06 +0000762static void desret_xmlParserInputPtr(xmlParserInputPtr val) {
763 xmlFreeInputStream(val);
764}
Daniel Veillardc8311492004-11-08 16:51:13 +0000765#ifdef LIBXML_WRITER_ENABLED
Daniel Veillardd5cc0f72004-11-06 19:24:28 +0000766static void desret_xmlTextWriterPtr(xmlTextWriterPtr val) {
767 xmlFreeTextWriter(val);
768}
Daniel Veillardc8311492004-11-08 16:51:13 +0000769#endif
Daniel Veillard3d95c732004-11-06 22:25:14 +0000770static void desret_xmlBufferPtr(xmlBufferPtr val) {
771 xmlBufferFree(val);
772}
Daniel Veillardc8311492004-11-08 16:51:13 +0000773#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillard42595322004-11-08 10:52:06 +0000774static void desret_xmlSchemaParserCtxtPtr(xmlSchemaParserCtxtPtr val) {
775 xmlSchemaFreeParserCtxt(val);
776}
777static void desret_xmlSchemaTypePtr(xmlSchemaTypePtr val ATTRIBUTE_UNUSED) {
778}
779static void desret_xmlRelaxNGParserCtxtPtr(xmlRelaxNGParserCtxtPtr val) {
780 xmlRelaxNGFreeParserCtxt(val);
781}
Daniel Veillardc8311492004-11-08 16:51:13 +0000782#endif
783#ifdef LIBXML_HTML_ENABLED
Daniel Veillard42595322004-11-08 10:52:06 +0000784static void desret_const_htmlEntityDesc_ptr(const htmlEntityDescPtr val ATTRIBUTE_UNUSED) {
785}
Daniel Veillardc8311492004-11-08 16:51:13 +0000786#endif
Daniel Veillardd5cc0f72004-11-06 19:24:28 +0000787
Daniel Veillarda521d282004-11-09 14:59:59 +0000788/* cut and pasted from autogenerated to avoid troubles */
789#define gen_nb_const_xmlChar_ptr_ptr 1
790static xmlChar ** gen_const_xmlChar_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
791 return(NULL);
792}
793static void des_const_xmlChar_ptr_ptr(int no ATTRIBUTE_UNUSED, const xmlChar ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
794}
795
796#define gen_nb_unsigned_char_ptr 1
797static unsigned char * gen_unsigned_char_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
798 return(NULL);
799}
800static void des_unsigned_char_ptr(int no ATTRIBUTE_UNUSED, unsigned char * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
801}
802
803#define gen_nb_const_unsigned_char_ptr 1
804static unsigned char * gen_const_unsigned_char_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
805 return(NULL);
806}
807static void des_const_unsigned_char_ptr(int no ATTRIBUTE_UNUSED, const unsigned char * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
808}
809
810#ifdef LIBXML_HTML_ENABLED
811#define gen_nb_const_htmlNodePtr 1
812static htmlNodePtr gen_const_htmlNodePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
813 return(NULL);
814}
815static void des_const_htmlNodePtr(int no ATTRIBUTE_UNUSED, const htmlNodePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
816}
817#endif
818
819#ifdef LIBXML_HTML_ENABLED
820#define gen_nb_htmlDocPtr 3
821static htmlDocPtr gen_htmlDocPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
822 if (no == 0) return(htmlNewDoc(NULL, NULL));
823 if (no == 1) return(htmlReadMemory("<html/>", 7, "test", NULL, 0));
824 return(NULL);
825}
826static void des_htmlDocPtr(int no ATTRIBUTE_UNUSED, htmlDocPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
827 if ((val != NULL) && (val != api_doc) && (val->doc != api_doc))
828 xmlFreeDoc(val);
829}
830static void desret_htmlDocPtr(htmlDocPtr val) {
831 if ((val != NULL) && (val != api_doc) && (val->doc != api_doc))
832 xmlFreeDoc(val);
833}
834#define gen_nb_htmlParserCtxtPtr 3
835static htmlParserCtxtPtr gen_htmlParserCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
836 if (no == 0) return(xmlNewParserCtxt());
837 if (no == 1) return(htmlCreateMemoryParserCtxt("<html/>", 7));
838 return(NULL);
839}
840static void des_htmlParserCtxtPtr(int no ATTRIBUTE_UNUSED, htmlParserCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
841 if (val != NULL)
842 htmlFreeParserCtxt(val);
843}
844static void desret_htmlParserCtxtPtr(htmlParserCtxtPtr val) {
845 if (val != NULL)
846 htmlFreeParserCtxt(val);
847}
848#endif
849
850#ifdef LIBXML_XPATH_ENABLED
851#define gen_nb_xmlNodeSetPtr 1
852static xmlNodeSetPtr gen_xmlNodeSetPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
853 return(NULL);
854}
855static void des_xmlNodeSetPtr(int no ATTRIBUTE_UNUSED, xmlNodeSetPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
856}
857#endif
858
859#ifdef LIBXML_DEBUG_ENABLED
860#define gen_nb_xmlShellCtxtPtr 1
861static xmlShellCtxtPtr gen_xmlShellCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
862 return(NULL);
863}
864static void des_xmlShellCtxtPtr(int no ATTRIBUTE_UNUSED, xmlShellCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
865}
866#endif
867
868#ifdef LIBXML_PATTERN_ENABLED
869#define gen_nb_xmlPatternPtr 1
870static xmlPatternPtr gen_xmlPatternPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
871 return(NULL);
872}
873static void des_xmlPatternPtr(int no ATTRIBUTE_UNUSED, xmlPatternPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
874}
875#endif
876
Daniel Veillardd5cc0f72004-11-06 19:24:28 +0000877/************************************************************************
878 * *
879 * WARNING: end of the manually maintained part of the test code *
880 * do not remove or alter the CUT HERE line *
881 * *
882 ************************************************************************/
883
Daniel Veillard34099b42004-11-04 17:34:35 +0000884/* CUT HERE: everything below that line is generated */
Daniel Veillarda521d282004-11-09 14:59:59 +0000885#ifdef LIBXML_HTML_ENABLED
Daniel Veillard57b25162004-11-06 14:50:18 +0000886#define gen_nb_htmlParserOption 4
887static htmlParserOption gen_htmlParserOption(int no, int nr ATTRIBUTE_UNUSED) {
888 if (no == 1) return(HTML_PARSE_NOBLANKS);
889 if (no == 2) return(HTML_PARSE_NOERROR);
890 if (no == 3) return(HTML_PARSE_NONET);
891 if (no == 4) return(HTML_PARSE_NOWARNING);
892 return(0);
893}
894static void des_htmlParserOption(int no ATTRIBUTE_UNUSED, htmlParserOption val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
895}
896static void desret_htmlParserOption(htmlParserOption val ATTRIBUTE_UNUSED) {
897}
898
Daniel Veillarda521d282004-11-09 14:59:59 +0000899#endif
900
901#ifdef LIBXML_HTML_ENABLED
Daniel Veillard57b25162004-11-06 14:50:18 +0000902#define gen_nb_htmlStatus 4
903static htmlStatus gen_htmlStatus(int no, int nr ATTRIBUTE_UNUSED) {
904 if (no == 1) return(HTML_DEPRECATED);
905 if (no == 2) return(HTML_INVALID);
906 if (no == 3) return(HTML_NA);
907 if (no == 4) return(HTML_REQUIRED);
908 return(0);
909}
910static void des_htmlStatus(int no ATTRIBUTE_UNUSED, htmlStatus val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
911}
912static void desret_htmlStatus(htmlStatus val ATTRIBUTE_UNUSED) {
913}
914
Daniel Veillarda521d282004-11-09 14:59:59 +0000915#endif
916
Daniel Veillard57b25162004-11-06 14:50:18 +0000917#define gen_nb_xlinkActuate 3
918static xlinkActuate gen_xlinkActuate(int no, int nr ATTRIBUTE_UNUSED) {
919 if (no == 1) return(XLINK_ACTUATE_AUTO);
920 if (no == 2) return(XLINK_ACTUATE_NONE);
921 if (no == 3) return(XLINK_ACTUATE_ONREQUEST);
922 return(0);
923}
924static void des_xlinkActuate(int no ATTRIBUTE_UNUSED, xlinkActuate val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
925}
926static void desret_xlinkActuate(xlinkActuate val ATTRIBUTE_UNUSED) {
927}
928
929#define gen_nb_xlinkShow 4
930static xlinkShow gen_xlinkShow(int no, int nr ATTRIBUTE_UNUSED) {
931 if (no == 1) return(XLINK_SHOW_EMBED);
932 if (no == 2) return(XLINK_SHOW_NEW);
933 if (no == 3) return(XLINK_SHOW_NONE);
934 if (no == 4) return(XLINK_SHOW_REPLACE);
935 return(0);
936}
937static void des_xlinkShow(int no ATTRIBUTE_UNUSED, xlinkShow val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
938}
939static void desret_xlinkShow(xlinkShow val ATTRIBUTE_UNUSED) {
940}
941
942#define gen_nb_xlinkType 4
943static xlinkType gen_xlinkType(int no, int nr ATTRIBUTE_UNUSED) {
944 if (no == 1) return(XLINK_TYPE_EXTENDED);
945 if (no == 2) return(XLINK_TYPE_EXTENDED_SET);
946 if (no == 3) return(XLINK_TYPE_NONE);
947 if (no == 4) return(XLINK_TYPE_SIMPLE);
948 return(0);
949}
950static void des_xlinkType(int no ATTRIBUTE_UNUSED, xlinkType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
951}
952static void desret_xlinkType(xlinkType val ATTRIBUTE_UNUSED) {
953}
954
955#define gen_nb_xmlAttributeDefault 4
956static xmlAttributeDefault gen_xmlAttributeDefault(int no, int nr ATTRIBUTE_UNUSED) {
957 if (no == 1) return(XML_ATTRIBUTE_FIXED);
958 if (no == 2) return(XML_ATTRIBUTE_IMPLIED);
959 if (no == 3) return(XML_ATTRIBUTE_NONE);
960 if (no == 4) return(XML_ATTRIBUTE_REQUIRED);
961 return(0);
962}
963static void des_xmlAttributeDefault(int no ATTRIBUTE_UNUSED, xmlAttributeDefault val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
964}
965static void desret_xmlAttributeDefault(xmlAttributeDefault val ATTRIBUTE_UNUSED) {
966}
967
968#define gen_nb_xmlAttributeType 4
969static xmlAttributeType gen_xmlAttributeType(int no, int nr ATTRIBUTE_UNUSED) {
970 if (no == 1) return(XML_ATTRIBUTE_CDATA);
971 if (no == 2) return(XML_ATTRIBUTE_ENTITIES);
972 if (no == 3) return(XML_ATTRIBUTE_ENTITY);
973 if (no == 4) return(XML_ATTRIBUTE_ENUMERATION);
974 return(0);
975}
976static void des_xmlAttributeType(int no ATTRIBUTE_UNUSED, xmlAttributeType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
977}
978static void desret_xmlAttributeType(xmlAttributeType val ATTRIBUTE_UNUSED) {
979}
980
981#define gen_nb_xmlBufferAllocationScheme 3
982static xmlBufferAllocationScheme gen_xmlBufferAllocationScheme(int no, int nr ATTRIBUTE_UNUSED) {
983 if (no == 1) return(XML_BUFFER_ALLOC_DOUBLEIT);
984 if (no == 2) return(XML_BUFFER_ALLOC_EXACT);
985 if (no == 3) return(XML_BUFFER_ALLOC_IMMUTABLE);
986 return(0);
987}
988static void des_xmlBufferAllocationScheme(int no ATTRIBUTE_UNUSED, xmlBufferAllocationScheme val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
989}
990static void desret_xmlBufferAllocationScheme(xmlBufferAllocationScheme val ATTRIBUTE_UNUSED) {
991}
992
Daniel Veillarda521d282004-11-09 14:59:59 +0000993#ifdef LIBXML_CATALOG_ENABLED
Daniel Veillard57b25162004-11-06 14:50:18 +0000994#define gen_nb_xmlCatalogAllow 4
995static xmlCatalogAllow gen_xmlCatalogAllow(int no, int nr ATTRIBUTE_UNUSED) {
996 if (no == 1) return(XML_CATA_ALLOW_ALL);
997 if (no == 2) return(XML_CATA_ALLOW_DOCUMENT);
998 if (no == 3) return(XML_CATA_ALLOW_GLOBAL);
999 if (no == 4) return(XML_CATA_ALLOW_NONE);
1000 return(0);
1001}
1002static void des_xmlCatalogAllow(int no ATTRIBUTE_UNUSED, xmlCatalogAllow val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1003}
1004static void desret_xmlCatalogAllow(xmlCatalogAllow val ATTRIBUTE_UNUSED) {
1005}
1006
Daniel Veillarda521d282004-11-09 14:59:59 +00001007#endif
1008
1009#ifdef LIBXML_CATALOG_ENABLED
Daniel Veillard57b25162004-11-06 14:50:18 +00001010#define gen_nb_xmlCatalogPrefer 3
1011static xmlCatalogPrefer gen_xmlCatalogPrefer(int no, int nr ATTRIBUTE_UNUSED) {
1012 if (no == 1) return(XML_CATA_PREFER_NONE);
1013 if (no == 2) return(XML_CATA_PREFER_PUBLIC);
1014 if (no == 3) return(XML_CATA_PREFER_SYSTEM);
1015 return(0);
1016}
1017static void des_xmlCatalogPrefer(int no ATTRIBUTE_UNUSED, xmlCatalogPrefer val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1018}
1019static void desret_xmlCatalogPrefer(xmlCatalogPrefer val ATTRIBUTE_UNUSED) {
1020}
1021
Daniel Veillarda521d282004-11-09 14:59:59 +00001022#endif
1023
Daniel Veillard57b25162004-11-06 14:50:18 +00001024#define gen_nb_xmlElementContentOccur 4
1025static xmlElementContentOccur gen_xmlElementContentOccur(int no, int nr ATTRIBUTE_UNUSED) {
1026 if (no == 1) return(XML_ELEMENT_CONTENT_MULT);
1027 if (no == 2) return(XML_ELEMENT_CONTENT_ONCE);
1028 if (no == 3) return(XML_ELEMENT_CONTENT_OPT);
1029 if (no == 4) return(XML_ELEMENT_CONTENT_PLUS);
1030 return(0);
1031}
1032static void des_xmlElementContentOccur(int no ATTRIBUTE_UNUSED, xmlElementContentOccur val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1033}
1034static void desret_xmlElementContentOccur(xmlElementContentOccur val ATTRIBUTE_UNUSED) {
1035}
1036
1037#define gen_nb_xmlElementContentType 4
1038static xmlElementContentType gen_xmlElementContentType(int no, int nr ATTRIBUTE_UNUSED) {
1039 if (no == 1) return(XML_ELEMENT_CONTENT_ELEMENT);
1040 if (no == 2) return(XML_ELEMENT_CONTENT_OR);
1041 if (no == 3) return(XML_ELEMENT_CONTENT_PCDATA);
1042 if (no == 4) return(XML_ELEMENT_CONTENT_SEQ);
1043 return(0);
1044}
1045static void des_xmlElementContentType(int no ATTRIBUTE_UNUSED, xmlElementContentType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1046}
1047static void desret_xmlElementContentType(xmlElementContentType val ATTRIBUTE_UNUSED) {
1048}
1049
1050#define gen_nb_xmlElementType 4
1051static xmlElementType gen_xmlElementType(int no, int nr ATTRIBUTE_UNUSED) {
1052 if (no == 1) return(XML_ATTRIBUTE_DECL);
1053 if (no == 2) return(XML_ATTRIBUTE_NODE);
1054 if (no == 3) return(XML_CDATA_SECTION_NODE);
1055 if (no == 4) return(XML_COMMENT_NODE);
1056 return(0);
1057}
1058static void des_xmlElementType(int no ATTRIBUTE_UNUSED, xmlElementType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1059}
1060static void desret_xmlElementType(xmlElementType val ATTRIBUTE_UNUSED) {
1061}
1062
1063#define gen_nb_xmlElementTypeVal 4
1064static xmlElementTypeVal gen_xmlElementTypeVal(int no, int nr ATTRIBUTE_UNUSED) {
1065 if (no == 1) return(XML_ELEMENT_TYPE_ANY);
1066 if (no == 2) return(XML_ELEMENT_TYPE_ELEMENT);
1067 if (no == 3) return(XML_ELEMENT_TYPE_EMPTY);
1068 if (no == 4) return(XML_ELEMENT_TYPE_MIXED);
1069 return(0);
1070}
1071static void des_xmlElementTypeVal(int no ATTRIBUTE_UNUSED, xmlElementTypeVal val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1072}
1073static void desret_xmlElementTypeVal(xmlElementTypeVal val ATTRIBUTE_UNUSED) {
1074}
1075
1076#define gen_nb_xmlEntityType 4
1077static xmlEntityType gen_xmlEntityType(int no, int nr ATTRIBUTE_UNUSED) {
1078 if (no == 1) return(XML_EXTERNAL_GENERAL_PARSED_ENTITY);
1079 if (no == 2) return(XML_EXTERNAL_GENERAL_UNPARSED_ENTITY);
1080 if (no == 3) return(XML_EXTERNAL_PARAMETER_ENTITY);
1081 if (no == 4) return(XML_INTERNAL_GENERAL_ENTITY);
1082 return(0);
1083}
1084static void des_xmlEntityType(int no ATTRIBUTE_UNUSED, xmlEntityType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1085}
1086static void desret_xmlEntityType(xmlEntityType val ATTRIBUTE_UNUSED) {
1087}
1088
1089#define gen_nb_xmlErrorDomain 4
1090static xmlErrorDomain gen_xmlErrorDomain(int no, int nr ATTRIBUTE_UNUSED) {
1091 if (no == 1) return(XML_FROM_C14N);
1092 if (no == 2) return(XML_FROM_CATALOG);
1093 if (no == 3) return(XML_FROM_CHECK);
1094 if (no == 4) return(XML_FROM_DATATYPE);
1095 return(0);
1096}
1097static void des_xmlErrorDomain(int no ATTRIBUTE_UNUSED, xmlErrorDomain val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1098}
1099static void desret_xmlErrorDomain(xmlErrorDomain val ATTRIBUTE_UNUSED) {
1100}
1101
1102#define gen_nb_xmlErrorLevel 4
1103static xmlErrorLevel gen_xmlErrorLevel(int no, int nr ATTRIBUTE_UNUSED) {
1104 if (no == 1) return(XML_ERR_ERROR);
1105 if (no == 2) return(XML_ERR_FATAL);
1106 if (no == 3) return(XML_ERR_NONE);
1107 if (no == 4) return(XML_ERR_WARNING);
1108 return(0);
1109}
1110static void des_xmlErrorLevel(int no ATTRIBUTE_UNUSED, xmlErrorLevel val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1111}
1112static void desret_xmlErrorLevel(xmlErrorLevel val ATTRIBUTE_UNUSED) {
1113}
1114
1115#define gen_nb_xmlParserErrors 4
1116static xmlParserErrors gen_xmlParserErrors(int no, int nr ATTRIBUTE_UNUSED) {
1117 if (no == 1) return(XML_C14N_CREATE_CTXT);
1118 if (no == 2) return(XML_C14N_CREATE_STACK);
1119 if (no == 3) return(XML_C14N_INVALID_NODE);
1120 if (no == 4) return(XML_C14N_REQUIRES_UTF8);
1121 return(0);
1122}
1123static void des_xmlParserErrors(int no ATTRIBUTE_UNUSED, xmlParserErrors val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1124}
1125static void desret_xmlParserErrors(xmlParserErrors val ATTRIBUTE_UNUSED) {
1126}
1127
1128#define gen_nb_xmlParserInputState 4
1129static xmlParserInputState gen_xmlParserInputState(int no, int nr ATTRIBUTE_UNUSED) {
1130 if (no == 1) return(XML_PARSER_ATTRIBUTE_VALUE);
1131 if (no == 2) return(XML_PARSER_CDATA_SECTION);
1132 if (no == 3) return(XML_PARSER_COMMENT);
1133 if (no == 4) return(XML_PARSER_CONTENT);
1134 return(0);
1135}
1136static void des_xmlParserInputState(int no ATTRIBUTE_UNUSED, xmlParserInputState val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1137}
1138static void desret_xmlParserInputState(xmlParserInputState val ATTRIBUTE_UNUSED) {
1139}
1140
1141#define gen_nb_xmlParserMode 4
1142static xmlParserMode gen_xmlParserMode(int no, int nr ATTRIBUTE_UNUSED) {
1143 if (no == 1) return(XML_PARSE_DOM);
1144 if (no == 2) return(XML_PARSE_PUSH_DOM);
1145 if (no == 3) return(XML_PARSE_PUSH_SAX);
1146 if (no == 4) return(XML_PARSE_READER);
1147 return(0);
1148}
1149static void des_xmlParserMode(int no ATTRIBUTE_UNUSED, xmlParserMode val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1150}
1151static void desret_xmlParserMode(xmlParserMode val ATTRIBUTE_UNUSED) {
1152}
1153
1154#define gen_nb_xmlParserOption 4
1155static xmlParserOption gen_xmlParserOption(int no, int nr ATTRIBUTE_UNUSED) {
1156 if (no == 1) return(XML_PARSE_DTDATTR);
1157 if (no == 2) return(XML_PARSE_DTDLOAD);
1158 if (no == 3) return(XML_PARSE_DTDVALID);
1159 if (no == 4) return(XML_PARSE_NOBLANKS);
1160 return(0);
1161}
1162static void des_xmlParserOption(int no ATTRIBUTE_UNUSED, xmlParserOption val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1163}
1164static void desret_xmlParserOption(xmlParserOption val ATTRIBUTE_UNUSED) {
1165}
1166
Daniel Veillarda521d282004-11-09 14:59:59 +00001167#ifdef LIBXML_READER_ENABLED
Daniel Veillard57b25162004-11-06 14:50:18 +00001168#define gen_nb_xmlParserProperties 4
1169static xmlParserProperties gen_xmlParserProperties(int no, int nr ATTRIBUTE_UNUSED) {
1170 if (no == 1) return(XML_PARSER_DEFAULTATTRS);
1171 if (no == 2) return(XML_PARSER_LOADDTD);
1172 if (no == 3) return(XML_PARSER_SUBST_ENTITIES);
1173 if (no == 4) return(XML_PARSER_VALIDATE);
1174 return(0);
1175}
1176static void des_xmlParserProperties(int no ATTRIBUTE_UNUSED, xmlParserProperties val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1177}
1178static void desret_xmlParserProperties(xmlParserProperties val ATTRIBUTE_UNUSED) {
1179}
1180
Daniel Veillarda521d282004-11-09 14:59:59 +00001181#endif
1182
1183#ifdef LIBXML_READER_ENABLED
Daniel Veillard57b25162004-11-06 14:50:18 +00001184#define gen_nb_xmlParserSeverities 4
1185static xmlParserSeverities gen_xmlParserSeverities(int no, int nr ATTRIBUTE_UNUSED) {
1186 if (no == 1) return(XML_PARSER_SEVERITY_ERROR);
1187 if (no == 2) return(XML_PARSER_SEVERITY_VALIDITY_ERROR);
1188 if (no == 3) return(XML_PARSER_SEVERITY_VALIDITY_WARNING);
1189 if (no == 4) return(XML_PARSER_SEVERITY_WARNING);
1190 return(0);
1191}
1192static void des_xmlParserSeverities(int no ATTRIBUTE_UNUSED, xmlParserSeverities val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1193}
1194static void desret_xmlParserSeverities(xmlParserSeverities val ATTRIBUTE_UNUSED) {
1195}
1196
Daniel Veillarda521d282004-11-09 14:59:59 +00001197#endif
1198
1199#ifdef LIBXML_READER_ENABLED
Daniel Veillard57b25162004-11-06 14:50:18 +00001200#define gen_nb_xmlReaderTypes 4
1201static xmlReaderTypes gen_xmlReaderTypes(int no, int nr ATTRIBUTE_UNUSED) {
1202 if (no == 1) return(XML_READER_TYPE_ATTRIBUTE);
1203 if (no == 2) return(XML_READER_TYPE_CDATA);
1204 if (no == 3) return(XML_READER_TYPE_COMMENT);
1205 if (no == 4) return(XML_READER_TYPE_DOCUMENT);
1206 return(0);
1207}
1208static void des_xmlReaderTypes(int no ATTRIBUTE_UNUSED, xmlReaderTypes val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1209}
1210static void desret_xmlReaderTypes(xmlReaderTypes val ATTRIBUTE_UNUSED) {
1211}
1212
Daniel Veillarda521d282004-11-09 14:59:59 +00001213#endif
1214
1215#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillard57b25162004-11-06 14:50:18 +00001216#define gen_nb_xmlRelaxNGParserFlag 3
1217static xmlRelaxNGParserFlag gen_xmlRelaxNGParserFlag(int no, int nr ATTRIBUTE_UNUSED) {
1218 if (no == 1) return(XML_RELAXNGP_CRNG);
1219 if (no == 2) return(XML_RELAXNGP_FREE_DOC);
1220 if (no == 3) return(XML_RELAXNGP_NONE);
1221 return(0);
1222}
1223static void des_xmlRelaxNGParserFlag(int no ATTRIBUTE_UNUSED, xmlRelaxNGParserFlag val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1224}
1225static void desret_xmlRelaxNGParserFlag(xmlRelaxNGParserFlag val ATTRIBUTE_UNUSED) {
1226}
1227
Daniel Veillarda521d282004-11-09 14:59:59 +00001228#endif
1229
1230#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillard57b25162004-11-06 14:50:18 +00001231#define gen_nb_xmlRelaxNGValidErr 4
1232static xmlRelaxNGValidErr gen_xmlRelaxNGValidErr(int no, int nr ATTRIBUTE_UNUSED) {
1233 if (no == 1) return(XML_RELAXNG_ERR_ATTREXTRANS);
1234 if (no == 2) return(XML_RELAXNG_ERR_ATTRNAME);
1235 if (no == 3) return(XML_RELAXNG_ERR_ATTRNONS);
1236 if (no == 4) return(XML_RELAXNG_ERR_ATTRVALID);
1237 return(0);
1238}
1239static void des_xmlRelaxNGValidErr(int no ATTRIBUTE_UNUSED, xmlRelaxNGValidErr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1240}
1241static void desret_xmlRelaxNGValidErr(xmlRelaxNGValidErr val ATTRIBUTE_UNUSED) {
1242}
1243
Daniel Veillarda521d282004-11-09 14:59:59 +00001244#endif
1245
1246#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillard57b25162004-11-06 14:50:18 +00001247#define gen_nb_xmlSchemaContentType 4
1248static xmlSchemaContentType gen_xmlSchemaContentType(int no, int nr ATTRIBUTE_UNUSED) {
1249 if (no == 1) return(XML_SCHEMA_CONTENT_ANY);
1250 if (no == 2) return(XML_SCHEMA_CONTENT_BASIC);
1251 if (no == 3) return(XML_SCHEMA_CONTENT_ELEMENTS);
1252 if (no == 4) return(XML_SCHEMA_CONTENT_EMPTY);
1253 return(0);
1254}
1255static void des_xmlSchemaContentType(int no ATTRIBUTE_UNUSED, xmlSchemaContentType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1256}
1257static void desret_xmlSchemaContentType(xmlSchemaContentType val ATTRIBUTE_UNUSED) {
1258}
1259
Daniel Veillarda521d282004-11-09 14:59:59 +00001260#endif
1261
1262#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillard57b25162004-11-06 14:50:18 +00001263#define gen_nb_xmlSchemaTypeType 4
1264static xmlSchemaTypeType gen_xmlSchemaTypeType(int no, int nr ATTRIBUTE_UNUSED) {
1265 if (no == 1) return(XML_SCHEMA_FACET_ENUMERATION);
1266 if (no == 2) return(XML_SCHEMA_FACET_FRACTIONDIGITS);
1267 if (no == 3) return(XML_SCHEMA_FACET_LENGTH);
1268 if (no == 4) return(XML_SCHEMA_FACET_MAXEXCLUSIVE);
1269 return(0);
1270}
1271static void des_xmlSchemaTypeType(int no ATTRIBUTE_UNUSED, xmlSchemaTypeType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1272}
1273static void desret_xmlSchemaTypeType(xmlSchemaTypeType val ATTRIBUTE_UNUSED) {
1274}
1275
Daniel Veillarda521d282004-11-09 14:59:59 +00001276#endif
1277
1278#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillard57b25162004-11-06 14:50:18 +00001279#define gen_nb_xmlSchemaValType 4
1280static xmlSchemaValType gen_xmlSchemaValType(int no, int nr ATTRIBUTE_UNUSED) {
1281 if (no == 1) return(XML_SCHEMAS_ANYSIMPLETYPE);
1282 if (no == 2) return(XML_SCHEMAS_ANYTYPE);
1283 if (no == 3) return(XML_SCHEMAS_ANYURI);
1284 if (no == 4) return(XML_SCHEMAS_BASE64BINARY);
1285 return(0);
1286}
1287static void des_xmlSchemaValType(int no ATTRIBUTE_UNUSED, xmlSchemaValType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1288}
1289static void desret_xmlSchemaValType(xmlSchemaValType val ATTRIBUTE_UNUSED) {
1290}
1291
Daniel Veillarda521d282004-11-09 14:59:59 +00001292#endif
1293
1294#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillard57b25162004-11-06 14:50:18 +00001295#define gen_nb_xmlSchemaValidError 4
1296static xmlSchemaValidError gen_xmlSchemaValidError(int no, int nr ATTRIBUTE_UNUSED) {
1297 if (no == 1) return(XML_SCHEMAS_ERR_);
1298 if (no == 2) return(XML_SCHEMAS_ERR_ATTRINVALID);
1299 if (no == 3) return(XML_SCHEMAS_ERR_ATTRUNKNOWN);
1300 if (no == 4) return(XML_SCHEMAS_ERR_CONSTRUCT);
1301 return(0);
1302}
1303static void des_xmlSchemaValidError(int no ATTRIBUTE_UNUSED, xmlSchemaValidError val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1304}
1305static void desret_xmlSchemaValidError(xmlSchemaValidError val ATTRIBUTE_UNUSED) {
1306}
1307
Daniel Veillarda521d282004-11-09 14:59:59 +00001308#endif
1309
1310#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillard57b25162004-11-06 14:50:18 +00001311#define gen_nb_xmlSchemaValidOption 1
1312static xmlSchemaValidOption gen_xmlSchemaValidOption(int no, int nr ATTRIBUTE_UNUSED) {
1313 if (no == 1) return(XML_SCHEMA_VAL_VC_I_CREATE);
1314 return(0);
1315}
1316static void des_xmlSchemaValidOption(int no ATTRIBUTE_UNUSED, xmlSchemaValidOption val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1317}
1318static void desret_xmlSchemaValidOption(xmlSchemaValidOption val ATTRIBUTE_UNUSED) {
1319}
1320
Daniel Veillarda521d282004-11-09 14:59:59 +00001321#endif
1322
1323#ifdef LIBXML_READER_ENABLED
Daniel Veillard57b25162004-11-06 14:50:18 +00001324#define gen_nb_xmlTextReaderMode 4
1325static xmlTextReaderMode gen_xmlTextReaderMode(int no, int nr ATTRIBUTE_UNUSED) {
1326 if (no == 1) return(XML_TEXTREADER_MODE_CLOSED);
1327 if (no == 2) return(XML_TEXTREADER_MODE_EOF);
1328 if (no == 3) return(XML_TEXTREADER_MODE_ERROR);
1329 if (no == 4) return(XML_TEXTREADER_MODE_INITIAL);
1330 return(0);
1331}
1332static void des_xmlTextReaderMode(int no ATTRIBUTE_UNUSED, xmlTextReaderMode val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1333}
1334static void desret_xmlTextReaderMode(xmlTextReaderMode val ATTRIBUTE_UNUSED) {
1335}
1336
Daniel Veillarda521d282004-11-09 14:59:59 +00001337#endif
1338
1339#ifdef LIBXML_XPATH_ENABLED
Daniel Veillard57b25162004-11-06 14:50:18 +00001340#define gen_nb_xmlXPathError 4
1341static xmlXPathError gen_xmlXPathError(int no, int nr ATTRIBUTE_UNUSED) {
1342 if (no == 1) return(XPATH_ENCODING_ERROR);
1343 if (no == 2) return(XPATH_EXPRESSION_OK);
1344 if (no == 3) return(XPATH_EXPR_ERROR);
1345 if (no == 4) return(XPATH_INVALID_ARITY);
1346 return(0);
1347}
1348static void des_xmlXPathError(int no ATTRIBUTE_UNUSED, xmlXPathError val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1349}
1350static void desret_xmlXPathError(xmlXPathError val ATTRIBUTE_UNUSED) {
1351}
1352
Daniel Veillarda521d282004-11-09 14:59:59 +00001353#endif
1354
1355#ifdef LIBXML_XPATH_ENABLED
Daniel Veillard57b25162004-11-06 14:50:18 +00001356#define gen_nb_xmlXPathObjectType 4
1357static xmlXPathObjectType gen_xmlXPathObjectType(int no, int nr ATTRIBUTE_UNUSED) {
1358 if (no == 1) return(XPATH_BOOLEAN);
1359 if (no == 2) return(XPATH_LOCATIONSET);
1360 if (no == 3) return(XPATH_NODESET);
1361 if (no == 4) return(XPATH_NUMBER);
1362 return(0);
1363}
1364static void des_xmlXPathObjectType(int no ATTRIBUTE_UNUSED, xmlXPathObjectType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1365}
1366static void desret_xmlXPathObjectType(xmlXPathObjectType val ATTRIBUTE_UNUSED) {
1367}
1368
Daniel Veillarda521d282004-11-09 14:59:59 +00001369#endif
1370
Daniel Veillard34099b42004-11-04 17:34:35 +00001371#include <libxml/HTMLparser.h>
1372#include <libxml/HTMLtree.h>
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00001373#include <libxml/SAX2.h>
Daniel Veillarda82b1822004-11-08 16:24:57 +00001374#include <libxml/c14n.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001375#include <libxml/catalog.h>
1376#include <libxml/chvalid.h>
Daniel Veillarda82b1822004-11-08 16:24:57 +00001377#include <libxml/debugXML.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001378#include <libxml/dict.h>
1379#include <libxml/encoding.h>
1380#include <libxml/entities.h>
1381#include <libxml/hash.h>
1382#include <libxml/list.h>
1383#include <libxml/nanoftp.h>
1384#include <libxml/nanohttp.h>
1385#include <libxml/parser.h>
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00001386#include <libxml/parserInternals.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001387#include <libxml/pattern.h>
1388#include <libxml/relaxng.h>
1389#include <libxml/schemasInternals.h>
1390#include <libxml/tree.h>
1391#include <libxml/uri.h>
1392#include <libxml/valid.h>
1393#include <libxml/xinclude.h>
1394#include <libxml/xmlIO.h>
Daniel Veillarda82b1822004-11-08 16:24:57 +00001395#include <libxml/xmlautomata.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001396#include <libxml/xmlerror.h>
1397#include <libxml/xmlreader.h>
Daniel Veillarda82b1822004-11-08 16:24:57 +00001398#include <libxml/xmlregexp.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001399#include <libxml/xmlsave.h>
1400#include <libxml/xmlschemas.h>
1401#include <libxml/xmlschemastypes.h>
1402#include <libxml/xmlstring.h>
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +00001403#include <libxml/xmlunicode.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001404#include <libxml/xmlwriter.h>
1405#include <libxml/xpath.h>
Daniel Veillarda82b1822004-11-08 16:24:57 +00001406#include <libxml/xpathInternals.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001407#include <libxml/xpointer.h>
1408static int test_HTMLparser(void);
1409static int test_HTMLtree(void);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00001410static int test_SAX2(void);
Daniel Veillarda82b1822004-11-08 16:24:57 +00001411static int test_c14n(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001412static int test_catalog(void);
1413static int test_chvalid(void);
Daniel Veillarda82b1822004-11-08 16:24:57 +00001414static int test_debugXML(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001415static int test_dict(void);
1416static int test_encoding(void);
1417static int test_entities(void);
1418static int test_hash(void);
1419static int test_list(void);
1420static int test_nanoftp(void);
1421static int test_nanohttp(void);
1422static int test_parser(void);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00001423static int test_parserInternals(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001424static int test_pattern(void);
1425static int test_relaxng(void);
1426static int test_schemasInternals(void);
1427static int test_tree(void);
1428static int test_uri(void);
1429static int test_valid(void);
1430static int test_xinclude(void);
1431static int test_xmlIO(void);
Daniel Veillarda82b1822004-11-08 16:24:57 +00001432static int test_xmlautomata(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001433static int test_xmlerror(void);
1434static int test_xmlreader(void);
Daniel Veillarda82b1822004-11-08 16:24:57 +00001435static int test_xmlregexp(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001436static int test_xmlsave(void);
1437static int test_xmlschemas(void);
1438static int test_xmlschemastypes(void);
1439static int test_xmlstring(void);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +00001440static int test_xmlunicode(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001441static int test_xmlwriter(void);
1442static int test_xpath(void);
Daniel Veillarda82b1822004-11-08 16:24:57 +00001443static int test_xpathInternals(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001444static int test_xpointer(void);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001445
1446/**
1447 * testlibxml2:
1448 *
1449 * Main entry point of the tester for the full libxml2 module,
1450 * it calls all the tester entry point for each module.
1451 *
1452 * Returns the number of error found
1453 */
1454static int
1455testlibxml2(void)
1456{
Daniel Veillard42595322004-11-08 10:52:06 +00001457 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001458
Daniel Veillard42595322004-11-08 10:52:06 +00001459 test_ret += test_HTMLparser();
1460 test_ret += test_HTMLtree();
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00001461 test_ret += test_SAX2();
Daniel Veillarda82b1822004-11-08 16:24:57 +00001462 test_ret += test_c14n();
Daniel Veillard42595322004-11-08 10:52:06 +00001463 test_ret += test_catalog();
1464 test_ret += test_chvalid();
Daniel Veillarda82b1822004-11-08 16:24:57 +00001465 test_ret += test_debugXML();
Daniel Veillard42595322004-11-08 10:52:06 +00001466 test_ret += test_dict();
1467 test_ret += test_encoding();
1468 test_ret += test_entities();
1469 test_ret += test_hash();
1470 test_ret += test_list();
1471 test_ret += test_nanoftp();
1472 test_ret += test_nanohttp();
1473 test_ret += test_parser();
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00001474 test_ret += test_parserInternals();
Daniel Veillard42595322004-11-08 10:52:06 +00001475 test_ret += test_pattern();
1476 test_ret += test_relaxng();
1477 test_ret += test_schemasInternals();
1478 test_ret += test_tree();
1479 test_ret += test_uri();
1480 test_ret += test_valid();
1481 test_ret += test_xinclude();
1482 test_ret += test_xmlIO();
Daniel Veillarda82b1822004-11-08 16:24:57 +00001483 test_ret += test_xmlautomata();
Daniel Veillard42595322004-11-08 10:52:06 +00001484 test_ret += test_xmlerror();
1485 test_ret += test_xmlreader();
Daniel Veillarda82b1822004-11-08 16:24:57 +00001486 test_ret += test_xmlregexp();
Daniel Veillard42595322004-11-08 10:52:06 +00001487 test_ret += test_xmlsave();
1488 test_ret += test_xmlschemas();
1489 test_ret += test_xmlschemastypes();
1490 test_ret += test_xmlstring();
1491 test_ret += test_xmlunicode();
1492 test_ret += test_xmlwriter();
1493 test_ret += test_xpath();
Daniel Veillarda82b1822004-11-08 16:24:57 +00001494 test_ret += test_xpathInternals();
Daniel Veillard42595322004-11-08 10:52:06 +00001495 test_ret += test_xpointer();
Daniel Veillardd93f6252004-11-02 15:53:51 +00001496
Daniel Veillard3d97e662004-11-04 10:49:00 +00001497 printf("Total: %d functions, %d tests, %d errors\n",
Daniel Veillard42595322004-11-08 10:52:06 +00001498 function_tests, call_tests, test_ret);
1499 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001500}
1501
1502
1503static int
1504test_UTF8ToHtml(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001505 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001506
Daniel Veillardce682bc2004-11-05 17:22:25 +00001507#ifdef LIBXML_HTML_ENABLED
1508 int mem_base;
1509 int ret_val;
1510 unsigned char * out; /* a pointer to an array of bytes to store the result */
1511 int n_out;
1512 int * outlen; /* the length of @out */
1513 int n_outlen;
1514 unsigned char * in; /* a pointer to an array of UTF-8 chars */
1515 int n_in;
1516 int * inlen; /* the length of @in */
1517 int n_inlen;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001518
Daniel Veillardce682bc2004-11-05 17:22:25 +00001519 for (n_out = 0;n_out < gen_nb_unsigned_char_ptr;n_out++) {
1520 for (n_outlen = 0;n_outlen < gen_nb_int_ptr;n_outlen++) {
1521 for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) {
1522 for (n_inlen = 0;n_inlen < gen_nb_int_ptr;n_inlen++) {
1523 mem_base = xmlMemBlocks();
1524 out = gen_unsigned_char_ptr(n_out, 0);
1525 outlen = gen_int_ptr(n_outlen, 1);
1526 in = gen_const_unsigned_char_ptr(n_in, 2);
1527 inlen = gen_int_ptr(n_inlen, 3);
1528
1529 ret_val = UTF8ToHtml(out, outlen, in, inlen);
1530 desret_int(ret_val);
1531 call_tests++;
1532 des_unsigned_char_ptr(n_out, out, 0);
1533 des_int_ptr(n_outlen, outlen, 1);
1534 des_const_unsigned_char_ptr(n_in, in, 2);
1535 des_int_ptr(n_inlen, inlen, 3);
1536 xmlResetLastError();
1537 if (mem_base != xmlMemBlocks()) {
1538 printf("Leak of %d blocks found in UTF8ToHtml",
1539 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001540 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001541 printf(" %d", n_out);
1542 printf(" %d", n_outlen);
1543 printf(" %d", n_in);
1544 printf(" %d", n_inlen);
1545 printf("\n");
1546 }
1547 }
1548 }
1549 }
1550 }
1551#endif
1552
1553 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00001554 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001555}
1556
Daniel Veillarda521d282004-11-09 14:59:59 +00001557#ifdef LIBXML_HTML_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +00001558
Daniel Veillardce682bc2004-11-05 17:22:25 +00001559#define gen_nb_const_htmlElemDesc_ptr 1
1560static htmlElemDesc * gen_const_htmlElemDesc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1561 return(NULL);
1562}
1563static void des_const_htmlElemDesc_ptr(int no ATTRIBUTE_UNUSED, const htmlElemDesc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1564}
Daniel Veillarda521d282004-11-09 14:59:59 +00001565#endif
1566
Daniel Veillardce682bc2004-11-05 17:22:25 +00001567
Daniel Veillardd93f6252004-11-02 15:53:51 +00001568static int
1569test_htmlAttrAllowed(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001570 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001571
Daniel Veillard57b25162004-11-06 14:50:18 +00001572#ifdef LIBXML_HTML_ENABLED
1573 int mem_base;
1574 htmlStatus ret_val;
1575 htmlElemDesc * elt; /* HTML element */
1576 int n_elt;
1577 xmlChar * attr; /* HTML attribute */
1578 int n_attr;
1579 int legacy; /* whether to allow deprecated attributes */
1580 int n_legacy;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001581
Daniel Veillard57b25162004-11-06 14:50:18 +00001582 for (n_elt = 0;n_elt < gen_nb_const_htmlElemDesc_ptr;n_elt++) {
1583 for (n_attr = 0;n_attr < gen_nb_const_xmlChar_ptr;n_attr++) {
1584 for (n_legacy = 0;n_legacy < gen_nb_int;n_legacy++) {
1585 mem_base = xmlMemBlocks();
1586 elt = gen_const_htmlElemDesc_ptr(n_elt, 0);
1587 attr = gen_const_xmlChar_ptr(n_attr, 1);
1588 legacy = gen_int(n_legacy, 2);
1589
1590 ret_val = htmlAttrAllowed(elt, attr, legacy);
1591 desret_htmlStatus(ret_val);
1592 call_tests++;
1593 des_const_htmlElemDesc_ptr(n_elt, elt, 0);
1594 des_const_xmlChar_ptr(n_attr, attr, 1);
1595 des_int(n_legacy, legacy, 2);
1596 xmlResetLastError();
1597 if (mem_base != xmlMemBlocks()) {
1598 printf("Leak of %d blocks found in htmlAttrAllowed",
1599 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001600 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +00001601 printf(" %d", n_elt);
1602 printf(" %d", n_attr);
1603 printf(" %d", n_legacy);
1604 printf("\n");
1605 }
1606 }
1607 }
1608 }
1609#endif
1610
1611 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00001612 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001613}
1614
Daniel Veillarda521d282004-11-09 14:59:59 +00001615#ifdef LIBXML_HTML_ENABLED
1616
1617#define gen_nb_htmlNodePtr 1
1618static htmlNodePtr gen_htmlNodePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1619 return(NULL);
1620}
1621static void des_htmlNodePtr(int no ATTRIBUTE_UNUSED, htmlNodePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1622}
1623#endif
1624
Daniel Veillardd93f6252004-11-02 15:53:51 +00001625
1626static int
1627test_htmlAutoCloseTag(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001628 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001629
Daniel Veillarda03e3652004-11-02 18:45:30 +00001630#ifdef LIBXML_HTML_ENABLED
1631 int mem_base;
1632 int ret_val;
1633 htmlDocPtr doc; /* the HTML document */
1634 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001635 xmlChar * name; /* The tag name */
Daniel Veillarda03e3652004-11-02 18:45:30 +00001636 int n_name;
1637 htmlNodePtr elem; /* the HTML element */
1638 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001639
Daniel Veillarda521d282004-11-09 14:59:59 +00001640 for (n_doc = 0;n_doc < gen_nb_htmlDocPtr;n_doc++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00001641 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
Daniel Veillarda521d282004-11-09 14:59:59 +00001642 for (n_elem = 0;n_elem < gen_nb_htmlNodePtr;n_elem++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00001643 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00001644 doc = gen_htmlDocPtr(n_doc, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001645 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarda521d282004-11-09 14:59:59 +00001646 elem = gen_htmlNodePtr(n_elem, 2);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001647
1648 ret_val = htmlAutoCloseTag(doc, name, elem);
1649 desret_int(ret_val);
1650 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00001651 des_htmlDocPtr(n_doc, doc, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001652 des_const_xmlChar_ptr(n_name, name, 1);
Daniel Veillarda521d282004-11-09 14:59:59 +00001653 des_htmlNodePtr(n_elem, elem, 2);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001654 xmlResetLastError();
1655 if (mem_base != xmlMemBlocks()) {
1656 printf("Leak of %d blocks found in htmlAutoCloseTag",
1657 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001658 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001659 printf(" %d", n_doc);
1660 printf(" %d", n_name);
1661 printf(" %d", n_elem);
1662 printf("\n");
1663 }
1664 }
1665 }
1666 }
1667#endif
1668
Daniel Veillard3d97e662004-11-04 10:49:00 +00001669 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00001670 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001671}
1672
1673
1674static int
1675test_htmlCreateMemoryParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001676 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001677
Daniel Veillard34099b42004-11-04 17:34:35 +00001678#ifdef LIBXML_HTML_ENABLED
1679 int mem_base;
1680 htmlParserCtxtPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001681 char * buffer; /* a pointer to a char array */
Daniel Veillard34099b42004-11-04 17:34:35 +00001682 int n_buffer;
1683 int size; /* the size of the array */
1684 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001685
Daniel Veillard34099b42004-11-04 17:34:35 +00001686 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
1687 for (n_size = 0;n_size < gen_nb_int;n_size++) {
1688 mem_base = xmlMemBlocks();
1689 buffer = gen_const_char_ptr(n_buffer, 0);
1690 size = gen_int(n_size, 1);
1691
1692 ret_val = htmlCreateMemoryParserCtxt(buffer, size);
Daniel Veillarda521d282004-11-09 14:59:59 +00001693 desret_htmlParserCtxtPtr(ret_val);
Daniel Veillard34099b42004-11-04 17:34:35 +00001694 call_tests++;
1695 des_const_char_ptr(n_buffer, buffer, 0);
1696 des_int(n_size, size, 1);
1697 xmlResetLastError();
1698 if (mem_base != xmlMemBlocks()) {
1699 printf("Leak of %d blocks found in htmlCreateMemoryParserCtxt",
1700 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001701 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +00001702 printf(" %d", n_buffer);
1703 printf(" %d", n_size);
1704 printf("\n");
1705 }
1706 }
1707 }
1708#endif
1709
1710 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00001711 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001712}
1713
Daniel Veillarda521d282004-11-09 14:59:59 +00001714#ifdef LIBXML_HTML_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +00001715
Daniel Veillardce682bc2004-11-05 17:22:25 +00001716#define gen_nb_htmlSAXHandlerPtr 1
1717static htmlSAXHandlerPtr gen_htmlSAXHandlerPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1718 return(NULL);
1719}
1720static void des_htmlSAXHandlerPtr(int no ATTRIBUTE_UNUSED, htmlSAXHandlerPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1721}
Daniel Veillarda521d282004-11-09 14:59:59 +00001722#endif
1723
Daniel Veillardce682bc2004-11-05 17:22:25 +00001724
Daniel Veillardd93f6252004-11-02 15:53:51 +00001725static int
1726test_htmlCreatePushParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001727 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001728
Daniel Veillardce682bc2004-11-05 17:22:25 +00001729#ifdef LIBXML_HTML_ENABLED
1730#ifdef LIBXML_PUSH_ENABLED
1731 int mem_base;
1732 htmlParserCtxtPtr ret_val;
1733 htmlSAXHandlerPtr sax; /* a SAX handler */
1734 int n_sax;
1735 void * user_data; /* The user data returned on SAX callbacks */
1736 int n_user_data;
1737 char * chunk; /* a pointer to an array of chars */
1738 int n_chunk;
1739 int size; /* number of chars in the array */
1740 int n_size;
1741 const char * filename; /* an optional file name or URI */
1742 int n_filename;
1743 xmlCharEncoding enc; /* an optional encoding */
1744 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001745
Daniel Veillardce682bc2004-11-05 17:22:25 +00001746 for (n_sax = 0;n_sax < gen_nb_htmlSAXHandlerPtr;n_sax++) {
1747 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
1748 for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) {
1749 for (n_size = 0;n_size < gen_nb_int;n_size++) {
Daniel Veillard42595322004-11-08 10:52:06 +00001750 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
Daniel Veillardce682bc2004-11-05 17:22:25 +00001751 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
1752 mem_base = xmlMemBlocks();
1753 sax = gen_htmlSAXHandlerPtr(n_sax, 0);
1754 user_data = gen_userdata(n_user_data, 1);
1755 chunk = gen_const_char_ptr(n_chunk, 2);
1756 size = gen_int(n_size, 3);
Daniel Veillard42595322004-11-08 10:52:06 +00001757 filename = gen_fileoutput(n_filename, 4);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001758 enc = gen_xmlCharEncoding(n_enc, 5);
1759
1760 ret_val = htmlCreatePushParserCtxt(sax, user_data, chunk, size, filename, enc);
Daniel Veillarda521d282004-11-09 14:59:59 +00001761 desret_htmlParserCtxtPtr(ret_val);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001762 call_tests++;
1763 des_htmlSAXHandlerPtr(n_sax, sax, 0);
1764 des_userdata(n_user_data, user_data, 1);
1765 des_const_char_ptr(n_chunk, chunk, 2);
1766 des_int(n_size, size, 3);
Daniel Veillard42595322004-11-08 10:52:06 +00001767 des_fileoutput(n_filename, filename, 4);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001768 des_xmlCharEncoding(n_enc, enc, 5);
1769 xmlResetLastError();
1770 if (mem_base != xmlMemBlocks()) {
1771 printf("Leak of %d blocks found in htmlCreatePushParserCtxt",
1772 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001773 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001774 printf(" %d", n_sax);
1775 printf(" %d", n_user_data);
1776 printf(" %d", n_chunk);
1777 printf(" %d", n_size);
1778 printf(" %d", n_filename);
1779 printf(" %d", n_enc);
1780 printf("\n");
1781 }
1782 }
1783 }
1784 }
1785 }
1786 }
1787 }
1788#endif
1789#endif
1790
1791 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00001792 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001793}
1794
1795
1796static int
1797test_htmlCtxtReadDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001798 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001799
Daniel Veillarda03e3652004-11-02 18:45:30 +00001800#ifdef LIBXML_HTML_ENABLED
1801 int mem_base;
1802 htmlDocPtr ret_val;
1803 htmlParserCtxtPtr ctxt; /* an HTML parser context */
1804 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001805 xmlChar * cur; /* a pointer to a zero terminated string */
Daniel Veillarda03e3652004-11-02 18:45:30 +00001806 int n_cur;
1807 const char * URL; /* the base URL to use for the document */
1808 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001809 char * encoding; /* the document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00001810 int n_encoding;
1811 int options; /* a combination of htmlParserOption(s) */
1812 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001813
Daniel Veillarda521d282004-11-09 14:59:59 +00001814 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00001815 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
1816 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
1817 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
1818 for (n_options = 0;n_options < gen_nb_int;n_options++) {
1819 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00001820 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001821 cur = gen_const_xmlChar_ptr(n_cur, 1);
1822 URL = gen_filepath(n_URL, 2);
1823 encoding = gen_const_char_ptr(n_encoding, 3);
1824 options = gen_int(n_options, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001825
Daniel Veillarda03e3652004-11-02 18:45:30 +00001826 ret_val = htmlCtxtReadDoc(ctxt, cur, URL, encoding, options);
Daniel Veillarda521d282004-11-09 14:59:59 +00001827 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001828 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00001829 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001830 des_const_xmlChar_ptr(n_cur, cur, 1);
1831 des_filepath(n_URL, URL, 2);
1832 des_const_char_ptr(n_encoding, encoding, 3);
1833 des_int(n_options, options, 4);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001834 xmlResetLastError();
1835 if (mem_base != xmlMemBlocks()) {
1836 printf("Leak of %d blocks found in htmlCtxtReadDoc",
1837 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001838 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001839 printf(" %d", n_ctxt);
1840 printf(" %d", n_cur);
1841 printf(" %d", n_URL);
1842 printf(" %d", n_encoding);
1843 printf(" %d", n_options);
1844 printf("\n");
1845 }
1846 }
1847 }
1848 }
1849 }
1850 }
1851#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +00001852
Daniel Veillard3d97e662004-11-04 10:49:00 +00001853 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00001854 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001855}
1856
1857
1858static int
1859test_htmlCtxtReadFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001860 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001861
Daniel Veillarda03e3652004-11-02 18:45:30 +00001862#ifdef LIBXML_HTML_ENABLED
1863 int mem_base;
1864 htmlDocPtr ret_val;
1865 htmlParserCtxtPtr ctxt; /* an HTML parser context */
1866 int n_ctxt;
1867 const char * filename; /* a file or URL */
1868 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001869 char * encoding; /* the document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00001870 int n_encoding;
1871 int options; /* a combination of htmlParserOption(s) */
1872 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001873
Daniel Veillarda521d282004-11-09 14:59:59 +00001874 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00001875 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
1876 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
1877 for (n_options = 0;n_options < gen_nb_int;n_options++) {
1878 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00001879 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001880 filename = gen_filepath(n_filename, 1);
1881 encoding = gen_const_char_ptr(n_encoding, 2);
1882 options = gen_int(n_options, 3);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001883
1884 ret_val = htmlCtxtReadFile(ctxt, filename, encoding, options);
Daniel Veillarda521d282004-11-09 14:59:59 +00001885 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001886 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00001887 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001888 des_filepath(n_filename, filename, 1);
1889 des_const_char_ptr(n_encoding, encoding, 2);
1890 des_int(n_options, options, 3);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001891 xmlResetLastError();
1892 if (mem_base != xmlMemBlocks()) {
1893 printf("Leak of %d blocks found in htmlCtxtReadFile",
1894 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001895 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001896 printf(" %d", n_ctxt);
1897 printf(" %d", n_filename);
1898 printf(" %d", n_encoding);
1899 printf(" %d", n_options);
1900 printf("\n");
1901 }
1902 }
1903 }
1904 }
1905 }
1906#endif
1907
Daniel Veillard3d97e662004-11-04 10:49:00 +00001908 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00001909 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001910}
1911
1912
1913static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00001914test_htmlCtxtReadMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001915 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001916
Daniel Veillarda03e3652004-11-02 18:45:30 +00001917#ifdef LIBXML_HTML_ENABLED
1918 int mem_base;
1919 htmlDocPtr ret_val;
1920 htmlParserCtxtPtr ctxt; /* an HTML parser context */
1921 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001922 char * buffer; /* a pointer to a char array */
Daniel Veillarda03e3652004-11-02 18:45:30 +00001923 int n_buffer;
1924 int size; /* the size of the array */
1925 int n_size;
1926 const char * URL; /* the base URL to use for the document */
1927 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001928 char * encoding; /* the document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00001929 int n_encoding;
1930 int options; /* a combination of htmlParserOption(s) */
1931 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001932
Daniel Veillarda521d282004-11-09 14:59:59 +00001933 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00001934 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
1935 for (n_size = 0;n_size < gen_nb_int;n_size++) {
1936 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
1937 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
1938 for (n_options = 0;n_options < gen_nb_int;n_options++) {
1939 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00001940 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001941 buffer = gen_const_char_ptr(n_buffer, 1);
1942 size = gen_int(n_size, 2);
1943 URL = gen_filepath(n_URL, 3);
1944 encoding = gen_const_char_ptr(n_encoding, 4);
1945 options = gen_int(n_options, 5);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001946
1947 ret_val = htmlCtxtReadMemory(ctxt, buffer, size, URL, encoding, options);
Daniel Veillarda521d282004-11-09 14:59:59 +00001948 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001949 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00001950 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001951 des_const_char_ptr(n_buffer, buffer, 1);
1952 des_int(n_size, size, 2);
1953 des_filepath(n_URL, URL, 3);
1954 des_const_char_ptr(n_encoding, encoding, 4);
1955 des_int(n_options, options, 5);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001956 xmlResetLastError();
1957 if (mem_base != xmlMemBlocks()) {
1958 printf("Leak of %d blocks found in htmlCtxtReadMemory",
1959 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001960 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001961 printf(" %d", n_ctxt);
1962 printf(" %d", n_buffer);
1963 printf(" %d", n_size);
1964 printf(" %d", n_URL);
1965 printf(" %d", n_encoding);
1966 printf(" %d", n_options);
1967 printf("\n");
1968 }
1969 }
1970 }
1971 }
1972 }
1973 }
1974 }
1975#endif
1976
Daniel Veillard3d97e662004-11-04 10:49:00 +00001977 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00001978 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001979}
1980
1981
1982static int
1983test_htmlCtxtReset(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001984 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001985
Daniel Veillarda03e3652004-11-02 18:45:30 +00001986#ifdef LIBXML_HTML_ENABLED
1987 int mem_base;
1988 htmlParserCtxtPtr ctxt; /* an HTML parser context */
1989 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001990
Daniel Veillarda521d282004-11-09 14:59:59 +00001991 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00001992 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00001993 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001994
1995 htmlCtxtReset(ctxt);
1996 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00001997 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001998 xmlResetLastError();
1999 if (mem_base != xmlMemBlocks()) {
2000 printf("Leak of %d blocks found in htmlCtxtReset",
2001 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002002 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002003 printf(" %d", n_ctxt);
2004 printf("\n");
2005 }
2006 }
2007#endif
2008
Daniel Veillard3d97e662004-11-04 10:49:00 +00002009 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00002010 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002011}
2012
2013
2014static int
2015test_htmlCtxtUseOptions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002016 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002017
Daniel Veillarda03e3652004-11-02 18:45:30 +00002018#ifdef LIBXML_HTML_ENABLED
2019 int mem_base;
2020 int ret_val;
2021 htmlParserCtxtPtr ctxt; /* an HTML parser context */
2022 int n_ctxt;
2023 int options; /* a combination of htmlParserOption(s) */
2024 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002025
Daniel Veillarda521d282004-11-09 14:59:59 +00002026 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00002027 for (n_options = 0;n_options < gen_nb_int;n_options++) {
2028 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00002029 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002030 options = gen_int(n_options, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002031
2032 ret_val = htmlCtxtUseOptions(ctxt, options);
2033 desret_int(ret_val);
2034 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00002035 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002036 des_int(n_options, options, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002037 xmlResetLastError();
2038 if (mem_base != xmlMemBlocks()) {
2039 printf("Leak of %d blocks found in htmlCtxtUseOptions",
2040 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002041 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002042 printf(" %d", n_ctxt);
2043 printf(" %d", n_options);
2044 printf("\n");
2045 }
2046 }
2047 }
2048#endif
2049
Daniel Veillard3d97e662004-11-04 10:49:00 +00002050 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00002051 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002052}
2053
2054
2055static int
2056test_htmlElementAllowedHere(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002057 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002058
Daniel Veillardce682bc2004-11-05 17:22:25 +00002059#ifdef LIBXML_HTML_ENABLED
2060 int mem_base;
2061 int ret_val;
2062 htmlElemDesc * parent; /* HTML parent element */
2063 int n_parent;
2064 xmlChar * elt; /* HTML element */
2065 int n_elt;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002066
Daniel Veillardce682bc2004-11-05 17:22:25 +00002067 for (n_parent = 0;n_parent < gen_nb_const_htmlElemDesc_ptr;n_parent++) {
2068 for (n_elt = 0;n_elt < gen_nb_const_xmlChar_ptr;n_elt++) {
2069 mem_base = xmlMemBlocks();
2070 parent = gen_const_htmlElemDesc_ptr(n_parent, 0);
2071 elt = gen_const_xmlChar_ptr(n_elt, 1);
2072
2073 ret_val = htmlElementAllowedHere(parent, elt);
2074 desret_int(ret_val);
2075 call_tests++;
2076 des_const_htmlElemDesc_ptr(n_parent, parent, 0);
2077 des_const_xmlChar_ptr(n_elt, elt, 1);
2078 xmlResetLastError();
2079 if (mem_base != xmlMemBlocks()) {
2080 printf("Leak of %d blocks found in htmlElementAllowedHere",
2081 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002082 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002083 printf(" %d", n_parent);
2084 printf(" %d", n_elt);
2085 printf("\n");
2086 }
2087 }
2088 }
2089#endif
2090
2091 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00002092 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002093}
2094
2095
2096static int
2097test_htmlElementStatusHere(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002098 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002099
Daniel Veillard57b25162004-11-06 14:50:18 +00002100#ifdef LIBXML_HTML_ENABLED
2101 int mem_base;
2102 htmlStatus ret_val;
2103 htmlElemDesc * parent; /* HTML parent element */
2104 int n_parent;
2105 htmlElemDesc * elt; /* HTML element */
2106 int n_elt;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002107
Daniel Veillard57b25162004-11-06 14:50:18 +00002108 for (n_parent = 0;n_parent < gen_nb_const_htmlElemDesc_ptr;n_parent++) {
2109 for (n_elt = 0;n_elt < gen_nb_const_htmlElemDesc_ptr;n_elt++) {
2110 mem_base = xmlMemBlocks();
2111 parent = gen_const_htmlElemDesc_ptr(n_parent, 0);
2112 elt = gen_const_htmlElemDesc_ptr(n_elt, 1);
2113
2114 ret_val = htmlElementStatusHere(parent, elt);
2115 desret_htmlStatus(ret_val);
2116 call_tests++;
2117 des_const_htmlElemDesc_ptr(n_parent, parent, 0);
2118 des_const_htmlElemDesc_ptr(n_elt, elt, 1);
2119 xmlResetLastError();
2120 if (mem_base != xmlMemBlocks()) {
2121 printf("Leak of %d blocks found in htmlElementStatusHere",
2122 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002123 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +00002124 printf(" %d", n_parent);
2125 printf(" %d", n_elt);
2126 printf("\n");
2127 }
2128 }
2129 }
2130#endif
2131
2132 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00002133 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002134}
2135
2136
2137static int
2138test_htmlEncodeEntities(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002139 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002140
Daniel Veillardce682bc2004-11-05 17:22:25 +00002141#ifdef LIBXML_HTML_ENABLED
2142 int mem_base;
2143 int ret_val;
2144 unsigned char * out; /* a pointer to an array of bytes to store the result */
2145 int n_out;
2146 int * outlen; /* the length of @out */
2147 int n_outlen;
2148 unsigned char * in; /* a pointer to an array of UTF-8 chars */
2149 int n_in;
2150 int * inlen; /* the length of @in */
2151 int n_inlen;
2152 int quoteChar; /* the quote character to escape (' or ") or zero. */
2153 int n_quoteChar;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002154
Daniel Veillardce682bc2004-11-05 17:22:25 +00002155 for (n_out = 0;n_out < gen_nb_unsigned_char_ptr;n_out++) {
2156 for (n_outlen = 0;n_outlen < gen_nb_int_ptr;n_outlen++) {
2157 for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) {
2158 for (n_inlen = 0;n_inlen < gen_nb_int_ptr;n_inlen++) {
2159 for (n_quoteChar = 0;n_quoteChar < gen_nb_int;n_quoteChar++) {
2160 mem_base = xmlMemBlocks();
2161 out = gen_unsigned_char_ptr(n_out, 0);
2162 outlen = gen_int_ptr(n_outlen, 1);
2163 in = gen_const_unsigned_char_ptr(n_in, 2);
2164 inlen = gen_int_ptr(n_inlen, 3);
2165 quoteChar = gen_int(n_quoteChar, 4);
2166
2167 ret_val = htmlEncodeEntities(out, outlen, in, inlen, quoteChar);
2168 desret_int(ret_val);
2169 call_tests++;
2170 des_unsigned_char_ptr(n_out, out, 0);
2171 des_int_ptr(n_outlen, outlen, 1);
2172 des_const_unsigned_char_ptr(n_in, in, 2);
2173 des_int_ptr(n_inlen, inlen, 3);
2174 des_int(n_quoteChar, quoteChar, 4);
2175 xmlResetLastError();
2176 if (mem_base != xmlMemBlocks()) {
2177 printf("Leak of %d blocks found in htmlEncodeEntities",
2178 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002179 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002180 printf(" %d", n_out);
2181 printf(" %d", n_outlen);
2182 printf(" %d", n_in);
2183 printf(" %d", n_inlen);
2184 printf(" %d", n_quoteChar);
2185 printf("\n");
2186 }
2187 }
2188 }
2189 }
2190 }
2191 }
2192#endif
2193
2194 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00002195 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002196}
2197
2198
2199static int
2200test_htmlEntityLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002201 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002202
Daniel Veillard42595322004-11-08 10:52:06 +00002203#ifdef LIBXML_HTML_ENABLED
2204 int mem_base;
2205 const htmlEntityDesc * ret_val;
2206 xmlChar * name; /* the entity name */
2207 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002208
Daniel Veillard42595322004-11-08 10:52:06 +00002209 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
2210 mem_base = xmlMemBlocks();
2211 name = gen_const_xmlChar_ptr(n_name, 0);
2212
2213 ret_val = htmlEntityLookup(name);
2214 desret_const_htmlEntityDesc_ptr(ret_val);
2215 call_tests++;
2216 des_const_xmlChar_ptr(n_name, name, 0);
2217 xmlResetLastError();
2218 if (mem_base != xmlMemBlocks()) {
2219 printf("Leak of %d blocks found in htmlEntityLookup",
2220 xmlMemBlocks() - mem_base);
2221 test_ret++;
2222 printf(" %d", n_name);
2223 printf("\n");
2224 }
2225 }
2226#endif
2227
2228 function_tests++;
2229 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002230}
2231
2232
2233static int
2234test_htmlEntityValueLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002235 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002236
Daniel Veillard42595322004-11-08 10:52:06 +00002237#ifdef LIBXML_HTML_ENABLED
2238 int mem_base;
2239 const htmlEntityDesc * ret_val;
2240 unsigned int value; /* the entity's unicode value */
2241 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002242
Daniel Veillard42595322004-11-08 10:52:06 +00002243 for (n_value = 0;n_value < gen_nb_unsigned_int;n_value++) {
2244 mem_base = xmlMemBlocks();
2245 value = gen_unsigned_int(n_value, 0);
2246
2247 ret_val = htmlEntityValueLookup(value);
2248 desret_const_htmlEntityDesc_ptr(ret_val);
2249 call_tests++;
2250 des_unsigned_int(n_value, value, 0);
2251 xmlResetLastError();
2252 if (mem_base != xmlMemBlocks()) {
2253 printf("Leak of %d blocks found in htmlEntityValueLookup",
2254 xmlMemBlocks() - mem_base);
2255 test_ret++;
2256 printf(" %d", n_value);
2257 printf("\n");
2258 }
2259 }
2260#endif
2261
2262 function_tests++;
2263 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002264}
2265
2266
2267static int
2268test_htmlHandleOmittedElem(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002269 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002270
2271#ifdef LIBXML_HTML_ENABLED
2272 int mem_base;
2273 int ret_val;
2274 int val; /* int 0 or 1 */
2275 int n_val;
2276
2277 for (n_val = 0;n_val < gen_nb_int;n_val++) {
2278 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002279 val = gen_int(n_val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002280
2281 ret_val = htmlHandleOmittedElem(val);
2282 desret_int(ret_val);
2283 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002284 des_int(n_val, val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002285 xmlResetLastError();
2286 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00002287 printf("Leak of %d blocks found in htmlHandleOmittedElem",
Daniel Veillardd93f6252004-11-02 15:53:51 +00002288 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002289 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002290 printf(" %d", n_val);
2291 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00002292 }
2293 }
2294#endif
2295
Daniel Veillard3d97e662004-11-04 10:49:00 +00002296 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00002297 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002298}
2299
2300
2301static int
2302test_htmlIsAutoClosed(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002303 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002304
Daniel Veillarda03e3652004-11-02 18:45:30 +00002305#ifdef LIBXML_HTML_ENABLED
2306 int mem_base;
2307 int ret_val;
2308 htmlDocPtr doc; /* the HTML document */
2309 int n_doc;
2310 htmlNodePtr elem; /* the HTML element */
2311 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002312
Daniel Veillarda521d282004-11-09 14:59:59 +00002313 for (n_doc = 0;n_doc < gen_nb_htmlDocPtr;n_doc++) {
2314 for (n_elem = 0;n_elem < gen_nb_htmlNodePtr;n_elem++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00002315 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00002316 doc = gen_htmlDocPtr(n_doc, 0);
2317 elem = gen_htmlNodePtr(n_elem, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002318
2319 ret_val = htmlIsAutoClosed(doc, elem);
2320 desret_int(ret_val);
2321 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00002322 des_htmlDocPtr(n_doc, doc, 0);
2323 des_htmlNodePtr(n_elem, elem, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002324 xmlResetLastError();
2325 if (mem_base != xmlMemBlocks()) {
2326 printf("Leak of %d blocks found in htmlIsAutoClosed",
2327 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002328 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002329 printf(" %d", n_doc);
2330 printf(" %d", n_elem);
2331 printf("\n");
2332 }
2333 }
2334 }
2335#endif
2336
Daniel Veillard3d97e662004-11-04 10:49:00 +00002337 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00002338 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002339}
2340
2341
2342static int
2343test_htmlIsScriptAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002344 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002345
2346#ifdef LIBXML_HTML_ENABLED
2347 int mem_base;
2348 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002349 xmlChar * name; /* an attribute name */
Daniel Veillardd93f6252004-11-02 15:53:51 +00002350 int n_name;
2351
2352 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
2353 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002354 name = gen_const_xmlChar_ptr(n_name, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002355
2356 ret_val = htmlIsScriptAttribute(name);
2357 desret_int(ret_val);
2358 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002359 des_const_xmlChar_ptr(n_name, name, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002360 xmlResetLastError();
2361 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00002362 printf("Leak of %d blocks found in htmlIsScriptAttribute",
Daniel Veillardd93f6252004-11-02 15:53:51 +00002363 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002364 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002365 printf(" %d", n_name);
2366 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00002367 }
2368 }
2369#endif
2370
Daniel Veillard3d97e662004-11-04 10:49:00 +00002371 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00002372 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002373}
2374
2375
2376static int
2377test_htmlNodeStatus(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002378 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002379
Daniel Veillard57b25162004-11-06 14:50:18 +00002380#ifdef LIBXML_HTML_ENABLED
2381 int mem_base;
2382 htmlStatus ret_val;
2383 htmlNodePtr node; /* an htmlNodePtr in a tree */
2384 int n_node;
2385 int legacy; /* whether to allow deprecated elements (YES is faster here for Element nodes) */
2386 int n_legacy;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002387
Daniel Veillarda521d282004-11-09 14:59:59 +00002388 for (n_node = 0;n_node < gen_nb_const_htmlNodePtr;n_node++) {
Daniel Veillard57b25162004-11-06 14:50:18 +00002389 for (n_legacy = 0;n_legacy < gen_nb_int;n_legacy++) {
2390 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00002391 node = gen_const_htmlNodePtr(n_node, 0);
Daniel Veillard57b25162004-11-06 14:50:18 +00002392 legacy = gen_int(n_legacy, 1);
2393
2394 ret_val = htmlNodeStatus(node, legacy);
2395 desret_htmlStatus(ret_val);
2396 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00002397 des_const_htmlNodePtr(n_node, node, 0);
Daniel Veillard57b25162004-11-06 14:50:18 +00002398 des_int(n_legacy, legacy, 1);
2399 xmlResetLastError();
2400 if (mem_base != xmlMemBlocks()) {
2401 printf("Leak of %d blocks found in htmlNodeStatus",
2402 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002403 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +00002404 printf(" %d", n_node);
2405 printf(" %d", n_legacy);
2406 printf("\n");
2407 }
2408 }
2409 }
2410#endif
2411
2412 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00002413 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002414}
2415
2416
2417static int
2418test_htmlParseCharRef(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002419 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002420
Daniel Veillarda03e3652004-11-02 18:45:30 +00002421#ifdef LIBXML_HTML_ENABLED
2422 int mem_base;
2423 int ret_val;
2424 htmlParserCtxtPtr ctxt; /* an HTML parser context */
2425 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002426
Daniel Veillarda521d282004-11-09 14:59:59 +00002427 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00002428 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00002429 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002430
2431 ret_val = htmlParseCharRef(ctxt);
2432 desret_int(ret_val);
2433 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00002434 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002435 xmlResetLastError();
2436 if (mem_base != xmlMemBlocks()) {
2437 printf("Leak of %d blocks found in htmlParseCharRef",
2438 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002439 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002440 printf(" %d", n_ctxt);
2441 printf("\n");
2442 }
2443 }
2444#endif
2445
Daniel Veillard3d97e662004-11-04 10:49:00 +00002446 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00002447 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002448}
2449
2450
2451static int
2452test_htmlParseChunk(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002453 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002454
Daniel Veillarda03e3652004-11-02 18:45:30 +00002455#ifdef LIBXML_HTML_ENABLED
2456#ifdef LIBXML_PUSH_ENABLED
2457 int mem_base;
2458 int ret_val;
2459 htmlParserCtxtPtr ctxt; /* an HTML parser context */
2460 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002461 char * chunk; /* an char array */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002462 int n_chunk;
2463 int size; /* the size in byte of the chunk */
2464 int n_size;
2465 int terminate; /* last chunk indicator */
2466 int n_terminate;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002467
Daniel Veillarda521d282004-11-09 14:59:59 +00002468 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00002469 for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) {
2470 for (n_size = 0;n_size < gen_nb_int;n_size++) {
2471 for (n_terminate = 0;n_terminate < gen_nb_int;n_terminate++) {
2472 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00002473 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002474 chunk = gen_const_char_ptr(n_chunk, 1);
2475 size = gen_int(n_size, 2);
2476 terminate = gen_int(n_terminate, 3);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002477
2478 ret_val = htmlParseChunk(ctxt, chunk, size, terminate);
Daniel Veillarda521d282004-11-09 14:59:59 +00002479 if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;}
Daniel Veillarda03e3652004-11-02 18:45:30 +00002480 desret_int(ret_val);
2481 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00002482 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002483 des_const_char_ptr(n_chunk, chunk, 1);
2484 des_int(n_size, size, 2);
2485 des_int(n_terminate, terminate, 3);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002486 xmlResetLastError();
2487 if (mem_base != xmlMemBlocks()) {
2488 printf("Leak of %d blocks found in htmlParseChunk",
2489 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002490 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002491 printf(" %d", n_ctxt);
2492 printf(" %d", n_chunk);
2493 printf(" %d", n_size);
2494 printf(" %d", n_terminate);
2495 printf("\n");
2496 }
2497 }
2498 }
2499 }
2500 }
2501#endif
2502#endif
2503
Daniel Veillard3d97e662004-11-04 10:49:00 +00002504 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00002505 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002506}
2507
2508
2509static int
2510test_htmlParseDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002511 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002512
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002513#ifdef LIBXML_HTML_ENABLED
2514 int mem_base;
2515 htmlDocPtr ret_val;
2516 xmlChar * cur; /* a pointer to an array of xmlChar */
2517 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002518 char * encoding; /* a free form C string describing the HTML document encoding, or NULL */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002519 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002520
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002521 for (n_cur = 0;n_cur < gen_nb_xmlChar_ptr;n_cur++) {
2522 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2523 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002524 cur = gen_xmlChar_ptr(n_cur, 0);
2525 encoding = gen_const_char_ptr(n_encoding, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002526
2527 ret_val = htmlParseDoc(cur, encoding);
Daniel Veillarda521d282004-11-09 14:59:59 +00002528 desret_htmlDocPtr(ret_val);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002529 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002530 des_xmlChar_ptr(n_cur, cur, 0);
2531 des_const_char_ptr(n_encoding, encoding, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002532 xmlResetLastError();
2533 if (mem_base != xmlMemBlocks()) {
2534 printf("Leak of %d blocks found in htmlParseDoc",
2535 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002536 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002537 printf(" %d", n_cur);
2538 printf(" %d", n_encoding);
2539 printf("\n");
2540 }
2541 }
2542 }
2543#endif
2544
Daniel Veillard3d97e662004-11-04 10:49:00 +00002545 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00002546 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002547}
2548
2549
2550static int
2551test_htmlParseDocument(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002552 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002553
Daniel Veillarda03e3652004-11-02 18:45:30 +00002554#ifdef LIBXML_HTML_ENABLED
2555 int mem_base;
2556 int ret_val;
2557 htmlParserCtxtPtr ctxt; /* an HTML parser context */
2558 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002559
Daniel Veillarda521d282004-11-09 14:59:59 +00002560 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00002561 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00002562 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002563
2564 ret_val = htmlParseDocument(ctxt);
Daniel Veillarda521d282004-11-09 14:59:59 +00002565 if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;}
Daniel Veillarda03e3652004-11-02 18:45:30 +00002566 desret_int(ret_val);
2567 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00002568 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002569 xmlResetLastError();
2570 if (mem_base != xmlMemBlocks()) {
2571 printf("Leak of %d blocks found in htmlParseDocument",
2572 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002573 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002574 printf(" %d", n_ctxt);
2575 printf("\n");
2576 }
2577 }
2578#endif
2579
Daniel Veillard3d97e662004-11-04 10:49:00 +00002580 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00002581 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002582}
2583
2584
2585static int
2586test_htmlParseElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002587 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002588
Daniel Veillarda03e3652004-11-02 18:45:30 +00002589#ifdef LIBXML_HTML_ENABLED
2590 int mem_base;
2591 htmlParserCtxtPtr ctxt; /* an HTML parser context */
2592 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002593
Daniel Veillarda521d282004-11-09 14:59:59 +00002594 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00002595 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00002596 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002597
2598 htmlParseElement(ctxt);
2599 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00002600 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002601 xmlResetLastError();
2602 if (mem_base != xmlMemBlocks()) {
2603 printf("Leak of %d blocks found in htmlParseElement",
2604 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002605 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002606 printf(" %d", n_ctxt);
2607 printf("\n");
2608 }
2609 }
2610#endif
2611
Daniel Veillard3d97e662004-11-04 10:49:00 +00002612 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00002613 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002614}
2615
2616
2617static int
2618test_htmlParseEntityRef(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002619 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002620
Daniel Veillard42595322004-11-08 10:52:06 +00002621#ifdef LIBXML_HTML_ENABLED
2622 int mem_base;
2623 const htmlEntityDesc * ret_val;
2624 htmlParserCtxtPtr ctxt; /* an HTML parser context */
2625 int n_ctxt;
2626 xmlChar ** str; /* location to store the entity name */
2627 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002628
Daniel Veillarda521d282004-11-09 14:59:59 +00002629 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillard42595322004-11-08 10:52:06 +00002630 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr_ptr;n_str++) {
2631 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00002632 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillard42595322004-11-08 10:52:06 +00002633 str = gen_const_xmlChar_ptr_ptr(n_str, 1);
2634
2635 ret_val = htmlParseEntityRef(ctxt, str);
2636 desret_const_htmlEntityDesc_ptr(ret_val);
2637 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00002638 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillard42595322004-11-08 10:52:06 +00002639 des_const_xmlChar_ptr_ptr(n_str, str, 1);
2640 xmlResetLastError();
2641 if (mem_base != xmlMemBlocks()) {
2642 printf("Leak of %d blocks found in htmlParseEntityRef",
2643 xmlMemBlocks() - mem_base);
2644 test_ret++;
2645 printf(" %d", n_ctxt);
2646 printf(" %d", n_str);
2647 printf("\n");
2648 }
2649 }
2650 }
2651#endif
2652
2653 function_tests++;
2654 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002655}
2656
2657
2658static int
2659test_htmlParseFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002660 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002661
Daniel Veillarda03e3652004-11-02 18:45:30 +00002662#ifdef LIBXML_HTML_ENABLED
2663 htmlDocPtr ret_val;
2664 const char * filename; /* the filename */
2665 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002666 char * encoding; /* a free form C string describing the HTML document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002667 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002668
Daniel Veillarda03e3652004-11-02 18:45:30 +00002669 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
2670 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +00002671 filename = gen_filepath(n_filename, 0);
2672 encoding = gen_const_char_ptr(n_encoding, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002673
2674 ret_val = htmlParseFile(filename, encoding);
Daniel Veillarda521d282004-11-09 14:59:59 +00002675 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002676 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002677 des_filepath(n_filename, filename, 0);
2678 des_const_char_ptr(n_encoding, encoding, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002679 xmlResetLastError();
2680 }
2681 }
2682#endif
2683
Daniel Veillard3d97e662004-11-04 10:49:00 +00002684 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00002685 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002686}
2687
2688
2689static int
2690test_htmlReadDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002691 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002692
Daniel Veillarda03e3652004-11-02 18:45:30 +00002693#ifdef LIBXML_HTML_ENABLED
2694 int mem_base;
2695 htmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002696 xmlChar * cur; /* a pointer to a zero terminated string */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002697 int n_cur;
2698 const char * URL; /* the base URL to use for the document */
2699 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002700 char * encoding; /* the document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002701 int n_encoding;
2702 int options; /* a combination of htmlParserOption(s) */
2703 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002704
Daniel Veillarda03e3652004-11-02 18:45:30 +00002705 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
2706 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
2707 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2708 for (n_options = 0;n_options < gen_nb_int;n_options++) {
2709 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002710 cur = gen_const_xmlChar_ptr(n_cur, 0);
2711 URL = gen_filepath(n_URL, 1);
2712 encoding = gen_const_char_ptr(n_encoding, 2);
2713 options = gen_int(n_options, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002714
Daniel Veillarda03e3652004-11-02 18:45:30 +00002715 ret_val = htmlReadDoc(cur, URL, encoding, options);
Daniel Veillarda521d282004-11-09 14:59:59 +00002716 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002717 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002718 des_const_xmlChar_ptr(n_cur, cur, 0);
2719 des_filepath(n_URL, URL, 1);
2720 des_const_char_ptr(n_encoding, encoding, 2);
2721 des_int(n_options, options, 3);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002722 xmlResetLastError();
2723 if (mem_base != xmlMemBlocks()) {
2724 printf("Leak of %d blocks found in htmlReadDoc",
2725 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002726 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002727 printf(" %d", n_cur);
2728 printf(" %d", n_URL);
2729 printf(" %d", n_encoding);
2730 printf(" %d", n_options);
2731 printf("\n");
2732 }
2733 }
2734 }
2735 }
2736 }
2737#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +00002738
Daniel Veillard3d97e662004-11-04 10:49:00 +00002739 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00002740 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002741}
2742
2743
2744static int
2745test_htmlReadFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002746 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002747
Daniel Veillarda03e3652004-11-02 18:45:30 +00002748#ifdef LIBXML_HTML_ENABLED
2749 int mem_base;
2750 htmlDocPtr ret_val;
2751 const char * filename; /* a file or URL */
2752 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002753 char * encoding; /* the document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002754 int n_encoding;
2755 int options; /* a combination of htmlParserOption(s) */
2756 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002757
Daniel Veillarda03e3652004-11-02 18:45:30 +00002758 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
2759 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2760 for (n_options = 0;n_options < gen_nb_int;n_options++) {
2761 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002762 filename = gen_filepath(n_filename, 0);
2763 encoding = gen_const_char_ptr(n_encoding, 1);
2764 options = gen_int(n_options, 2);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002765
2766 ret_val = htmlReadFile(filename, encoding, options);
Daniel Veillarda521d282004-11-09 14:59:59 +00002767 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002768 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002769 des_filepath(n_filename, filename, 0);
2770 des_const_char_ptr(n_encoding, encoding, 1);
2771 des_int(n_options, options, 2);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002772 xmlResetLastError();
2773 if (mem_base != xmlMemBlocks()) {
2774 printf("Leak of %d blocks found in htmlReadFile",
2775 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002776 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002777 printf(" %d", n_filename);
2778 printf(" %d", n_encoding);
2779 printf(" %d", n_options);
2780 printf("\n");
2781 }
2782 }
2783 }
2784 }
2785#endif
2786
Daniel Veillard3d97e662004-11-04 10:49:00 +00002787 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00002788 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002789}
2790
2791
2792static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00002793test_htmlReadMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002794 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002795
Daniel Veillarda03e3652004-11-02 18:45:30 +00002796#ifdef LIBXML_HTML_ENABLED
2797 int mem_base;
2798 htmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002799 char * buffer; /* a pointer to a char array */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002800 int n_buffer;
2801 int size; /* the size of the array */
2802 int n_size;
2803 const char * URL; /* the base URL to use for the document */
2804 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002805 char * encoding; /* the document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002806 int n_encoding;
2807 int options; /* a combination of htmlParserOption(s) */
2808 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002809
Daniel Veillarda03e3652004-11-02 18:45:30 +00002810 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
2811 for (n_size = 0;n_size < gen_nb_int;n_size++) {
2812 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
2813 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2814 for (n_options = 0;n_options < gen_nb_int;n_options++) {
2815 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002816 buffer = gen_const_char_ptr(n_buffer, 0);
2817 size = gen_int(n_size, 1);
2818 URL = gen_filepath(n_URL, 2);
2819 encoding = gen_const_char_ptr(n_encoding, 3);
2820 options = gen_int(n_options, 4);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002821
2822 ret_val = htmlReadMemory(buffer, size, URL, encoding, options);
Daniel Veillarda521d282004-11-09 14:59:59 +00002823 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002824 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002825 des_const_char_ptr(n_buffer, buffer, 0);
2826 des_int(n_size, size, 1);
2827 des_filepath(n_URL, URL, 2);
2828 des_const_char_ptr(n_encoding, encoding, 3);
2829 des_int(n_options, options, 4);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002830 xmlResetLastError();
2831 if (mem_base != xmlMemBlocks()) {
2832 printf("Leak of %d blocks found in htmlReadMemory",
2833 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002834 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002835 printf(" %d", n_buffer);
2836 printf(" %d", n_size);
2837 printf(" %d", n_URL);
2838 printf(" %d", n_encoding);
2839 printf(" %d", n_options);
2840 printf("\n");
2841 }
2842 }
2843 }
2844 }
2845 }
2846 }
2847#endif
2848
Daniel Veillard3d97e662004-11-04 10:49:00 +00002849 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00002850 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002851}
2852
2853
2854static int
2855test_htmlSAXParseDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002856 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002857
Daniel Veillardce682bc2004-11-05 17:22:25 +00002858#ifdef LIBXML_HTML_ENABLED
2859 int mem_base;
2860 htmlDocPtr ret_val;
2861 xmlChar * cur; /* a pointer to an array of xmlChar */
2862 int n_cur;
2863 char * encoding; /* a free form C string describing the HTML document encoding, or NULL */
2864 int n_encoding;
2865 htmlSAXHandlerPtr sax; /* the SAX handler block */
2866 int n_sax;
2867 void * userData; /* if using SAX, this pointer will be provided on callbacks. */
2868 int n_userData;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002869
Daniel Veillardce682bc2004-11-05 17:22:25 +00002870 for (n_cur = 0;n_cur < gen_nb_xmlChar_ptr;n_cur++) {
2871 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2872 for (n_sax = 0;n_sax < gen_nb_htmlSAXHandlerPtr;n_sax++) {
2873 for (n_userData = 0;n_userData < gen_nb_userdata;n_userData++) {
2874 mem_base = xmlMemBlocks();
2875 cur = gen_xmlChar_ptr(n_cur, 0);
2876 encoding = gen_const_char_ptr(n_encoding, 1);
2877 sax = gen_htmlSAXHandlerPtr(n_sax, 2);
2878 userData = gen_userdata(n_userData, 3);
2879
2880 ret_val = htmlSAXParseDoc(cur, encoding, sax, userData);
Daniel Veillarda521d282004-11-09 14:59:59 +00002881 desret_htmlDocPtr(ret_val);
Daniel Veillardce682bc2004-11-05 17:22:25 +00002882 call_tests++;
2883 des_xmlChar_ptr(n_cur, cur, 0);
2884 des_const_char_ptr(n_encoding, encoding, 1);
2885 des_htmlSAXHandlerPtr(n_sax, sax, 2);
2886 des_userdata(n_userData, userData, 3);
2887 xmlResetLastError();
2888 if (mem_base != xmlMemBlocks()) {
2889 printf("Leak of %d blocks found in htmlSAXParseDoc",
2890 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002891 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002892 printf(" %d", n_cur);
2893 printf(" %d", n_encoding);
2894 printf(" %d", n_sax);
2895 printf(" %d", n_userData);
2896 printf("\n");
2897 }
2898 }
2899 }
2900 }
2901 }
2902#endif
2903
2904 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00002905 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002906}
2907
2908
2909static int
2910test_htmlSAXParseFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002911 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002912
Daniel Veillardce682bc2004-11-05 17:22:25 +00002913#ifdef LIBXML_HTML_ENABLED
2914 int mem_base;
2915 htmlDocPtr ret_val;
2916 const char * filename; /* the filename */
2917 int n_filename;
2918 char * encoding; /* a free form C string describing the HTML document encoding, or NULL */
2919 int n_encoding;
2920 htmlSAXHandlerPtr sax; /* the SAX handler block */
2921 int n_sax;
2922 void * userData; /* if using SAX, this pointer will be provided on callbacks. */
2923 int n_userData;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002924
Daniel Veillardce682bc2004-11-05 17:22:25 +00002925 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
2926 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2927 for (n_sax = 0;n_sax < gen_nb_htmlSAXHandlerPtr;n_sax++) {
2928 for (n_userData = 0;n_userData < gen_nb_userdata;n_userData++) {
2929 mem_base = xmlMemBlocks();
2930 filename = gen_filepath(n_filename, 0);
2931 encoding = gen_const_char_ptr(n_encoding, 1);
2932 sax = gen_htmlSAXHandlerPtr(n_sax, 2);
2933 userData = gen_userdata(n_userData, 3);
2934
2935 ret_val = htmlSAXParseFile(filename, encoding, sax, userData);
Daniel Veillarda521d282004-11-09 14:59:59 +00002936 desret_htmlDocPtr(ret_val);
Daniel Veillardce682bc2004-11-05 17:22:25 +00002937 call_tests++;
2938 des_filepath(n_filename, filename, 0);
2939 des_const_char_ptr(n_encoding, encoding, 1);
2940 des_htmlSAXHandlerPtr(n_sax, sax, 2);
2941 des_userdata(n_userData, userData, 3);
2942 xmlResetLastError();
2943 if (mem_base != xmlMemBlocks()) {
2944 printf("Leak of %d blocks found in htmlSAXParseFile",
2945 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002946 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002947 printf(" %d", n_filename);
2948 printf(" %d", n_encoding);
2949 printf(" %d", n_sax);
2950 printf(" %d", n_userData);
2951 printf("\n");
2952 }
2953 }
2954 }
2955 }
2956 }
2957#endif
2958
2959 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00002960 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002961}
2962
2963
2964static int
2965test_htmlTagLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002966 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002967
2968
2969 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00002970 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002971}
2972
2973static int
2974test_HTMLparser(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002975 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002976
Daniel Veillard42595322004-11-08 10:52:06 +00002977 printf("Testing HTMLparser : 31 of 37 functions ...\n");
2978 test_ret += test_UTF8ToHtml();
2979 test_ret += test_htmlAttrAllowed();
2980 test_ret += test_htmlAutoCloseTag();
2981 test_ret += test_htmlCreateMemoryParserCtxt();
2982 test_ret += test_htmlCreatePushParserCtxt();
2983 test_ret += test_htmlCtxtReadDoc();
2984 test_ret += test_htmlCtxtReadFile();
2985 test_ret += test_htmlCtxtReadMemory();
2986 test_ret += test_htmlCtxtReset();
2987 test_ret += test_htmlCtxtUseOptions();
2988 test_ret += test_htmlElementAllowedHere();
2989 test_ret += test_htmlElementStatusHere();
2990 test_ret += test_htmlEncodeEntities();
2991 test_ret += test_htmlEntityLookup();
2992 test_ret += test_htmlEntityValueLookup();
2993 test_ret += test_htmlHandleOmittedElem();
2994 test_ret += test_htmlIsAutoClosed();
2995 test_ret += test_htmlIsScriptAttribute();
2996 test_ret += test_htmlNodeStatus();
2997 test_ret += test_htmlParseCharRef();
2998 test_ret += test_htmlParseChunk();
2999 test_ret += test_htmlParseDoc();
3000 test_ret += test_htmlParseDocument();
3001 test_ret += test_htmlParseElement();
3002 test_ret += test_htmlParseEntityRef();
3003 test_ret += test_htmlParseFile();
3004 test_ret += test_htmlReadDoc();
3005 test_ret += test_htmlReadFile();
3006 test_ret += test_htmlReadMemory();
3007 test_ret += test_htmlSAXParseDoc();
3008 test_ret += test_htmlSAXParseFile();
3009 test_ret += test_htmlTagLookup();
Daniel Veillardd93f6252004-11-02 15:53:51 +00003010
Daniel Veillard42595322004-11-08 10:52:06 +00003011 if (test_ret != 0)
3012 printf("Module HTMLparser: %d errors\n", test_ret);
3013 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003014}
3015
3016static int
3017test_htmlDocContentDumpFormatOutput(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003018 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003019
Daniel Veillard3d97e662004-11-04 10:49:00 +00003020#ifdef LIBXML_HTML_ENABLED
3021#ifdef LIBXML_OUTPUT_ENABLED
3022 int mem_base;
3023 xmlOutputBufferPtr buf; /* the HTML buffer output */
3024 int n_buf;
3025 xmlDocPtr cur; /* the document */
3026 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003027 char * encoding; /* the encoding string */
Daniel Veillard3d97e662004-11-04 10:49:00 +00003028 int n_encoding;
3029 int format; /* should formatting spaces been added */
3030 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003031
Daniel Veillard3d97e662004-11-04 10:49:00 +00003032 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
3033 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
3034 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
3035 for (n_format = 0;n_format < gen_nb_int;n_format++) {
3036 mem_base = xmlMemBlocks();
3037 buf = gen_xmlOutputBufferPtr(n_buf, 0);
3038 cur = gen_xmlDocPtr(n_cur, 1);
3039 encoding = gen_const_char_ptr(n_encoding, 2);
3040 format = gen_int(n_format, 3);
3041
3042 htmlDocContentDumpFormatOutput(buf, cur, encoding, format);
3043 call_tests++;
3044 des_xmlOutputBufferPtr(n_buf, buf, 0);
3045 des_xmlDocPtr(n_cur, cur, 1);
3046 des_const_char_ptr(n_encoding, encoding, 2);
3047 des_int(n_format, format, 3);
3048 xmlResetLastError();
3049 if (mem_base != xmlMemBlocks()) {
3050 printf("Leak of %d blocks found in htmlDocContentDumpFormatOutput",
3051 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003052 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003053 printf(" %d", n_buf);
3054 printf(" %d", n_cur);
3055 printf(" %d", n_encoding);
3056 printf(" %d", n_format);
3057 printf("\n");
3058 }
3059 }
3060 }
3061 }
3062 }
3063#endif
3064#endif
3065
3066 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00003067 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003068}
3069
3070
3071static int
3072test_htmlDocContentDumpOutput(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003073 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003074
Daniel Veillard3d97e662004-11-04 10:49:00 +00003075#ifdef LIBXML_HTML_ENABLED
3076#ifdef LIBXML_OUTPUT_ENABLED
3077 int mem_base;
3078 xmlOutputBufferPtr buf; /* the HTML buffer output */
3079 int n_buf;
3080 xmlDocPtr cur; /* the document */
3081 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003082 char * encoding; /* the encoding string */
Daniel Veillard3d97e662004-11-04 10:49:00 +00003083 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003084
Daniel Veillard3d97e662004-11-04 10:49:00 +00003085 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
3086 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
3087 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
3088 mem_base = xmlMemBlocks();
3089 buf = gen_xmlOutputBufferPtr(n_buf, 0);
3090 cur = gen_xmlDocPtr(n_cur, 1);
3091 encoding = gen_const_char_ptr(n_encoding, 2);
3092
3093 htmlDocContentDumpOutput(buf, cur, encoding);
3094 call_tests++;
3095 des_xmlOutputBufferPtr(n_buf, buf, 0);
3096 des_xmlDocPtr(n_cur, cur, 1);
3097 des_const_char_ptr(n_encoding, encoding, 2);
3098 xmlResetLastError();
3099 if (mem_base != xmlMemBlocks()) {
3100 printf("Leak of %d blocks found in htmlDocContentDumpOutput",
3101 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003102 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003103 printf(" %d", n_buf);
3104 printf(" %d", n_cur);
3105 printf(" %d", n_encoding);
3106 printf("\n");
3107 }
3108 }
3109 }
3110 }
3111#endif
3112#endif
3113
3114 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00003115 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003116}
3117
3118
3119static int
3120test_htmlDocDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003121 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003122
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003123#ifdef LIBXML_HTML_ENABLED
3124#ifdef LIBXML_OUTPUT_ENABLED
3125 int mem_base;
3126 int ret_val;
3127 FILE * f; /* the FILE* */
3128 int n_f;
3129 xmlDocPtr cur; /* the document */
3130 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003131
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003132 for (n_f = 0;n_f < gen_nb_FILE_ptr;n_f++) {
3133 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
3134 mem_base = xmlMemBlocks();
3135 f = gen_FILE_ptr(n_f, 0);
3136 cur = gen_xmlDocPtr(n_cur, 1);
3137
3138 ret_val = htmlDocDump(f, cur);
3139 desret_int(ret_val);
3140 call_tests++;
3141 des_FILE_ptr(n_f, f, 0);
3142 des_xmlDocPtr(n_cur, cur, 1);
3143 xmlResetLastError();
3144 if (mem_base != xmlMemBlocks()) {
3145 printf("Leak of %d blocks found in htmlDocDump",
3146 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003147 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003148 printf(" %d", n_f);
3149 printf(" %d", n_cur);
3150 printf("\n");
3151 }
3152 }
3153 }
3154#endif
3155#endif
3156
3157 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00003158 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003159}
3160
3161
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00003162#define gen_nb_xmlChar_ptr_ptr 1
3163static xmlChar ** gen_xmlChar_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
3164 return(NULL);
3165}
3166static void des_xmlChar_ptr_ptr(int no ATTRIBUTE_UNUSED, xmlChar ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
3167}
3168
Daniel Veillardd93f6252004-11-02 15:53:51 +00003169static int
3170test_htmlDocDumpMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003171 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003172
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00003173#ifdef LIBXML_HTML_ENABLED
3174#ifdef LIBXML_OUTPUT_ENABLED
3175 int mem_base;
3176 xmlDocPtr cur; /* the document */
3177 int n_cur;
3178 xmlChar ** mem; /* OUT: the memory pointer */
3179 int n_mem;
3180 int * size; /* OUT: the memory length */
3181 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003182
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00003183 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
3184 for (n_mem = 0;n_mem < gen_nb_xmlChar_ptr_ptr;n_mem++) {
3185 for (n_size = 0;n_size < gen_nb_int_ptr;n_size++) {
3186 mem_base = xmlMemBlocks();
3187 cur = gen_xmlDocPtr(n_cur, 0);
3188 mem = gen_xmlChar_ptr_ptr(n_mem, 1);
3189 size = gen_int_ptr(n_size, 2);
3190
3191 htmlDocDumpMemory(cur, mem, size);
3192 call_tests++;
3193 des_xmlDocPtr(n_cur, cur, 0);
3194 des_xmlChar_ptr_ptr(n_mem, mem, 1);
3195 des_int_ptr(n_size, size, 2);
3196 xmlResetLastError();
3197 if (mem_base != xmlMemBlocks()) {
3198 printf("Leak of %d blocks found in htmlDocDumpMemory",
3199 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003200 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00003201 printf(" %d", n_cur);
3202 printf(" %d", n_mem);
3203 printf(" %d", n_size);
3204 printf("\n");
3205 }
3206 }
3207 }
3208 }
3209#endif
3210#endif
3211
3212 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00003213 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003214}
3215
3216
3217static int
3218test_htmlGetMetaEncoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003219 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003220
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003221#ifdef LIBXML_HTML_ENABLED
3222 int mem_base;
3223 const xmlChar * ret_val;
3224 htmlDocPtr doc; /* the document */
3225 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003226
Daniel Veillarda521d282004-11-09 14:59:59 +00003227 for (n_doc = 0;n_doc < gen_nb_htmlDocPtr;n_doc++) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003228 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00003229 doc = gen_htmlDocPtr(n_doc, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003230
3231 ret_val = htmlGetMetaEncoding(doc);
3232 desret_const_xmlChar_ptr(ret_val);
3233 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00003234 des_htmlDocPtr(n_doc, doc, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003235 xmlResetLastError();
3236 if (mem_base != xmlMemBlocks()) {
3237 printf("Leak of %d blocks found in htmlGetMetaEncoding",
3238 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003239 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003240 printf(" %d", n_doc);
3241 printf("\n");
3242 }
3243 }
3244#endif
3245
Daniel Veillard3d97e662004-11-04 10:49:00 +00003246 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00003247 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003248}
3249
3250
3251static int
3252test_htmlIsBooleanAttr(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003253 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003254
3255#ifdef LIBXML_HTML_ENABLED
3256 int mem_base;
3257 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003258 xmlChar * name; /* the name of the attribute to check */
Daniel Veillardd93f6252004-11-02 15:53:51 +00003259 int n_name;
3260
3261 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
3262 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00003263 name = gen_const_xmlChar_ptr(n_name, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003264
3265 ret_val = htmlIsBooleanAttr(name);
3266 desret_int(ret_val);
3267 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003268 des_const_xmlChar_ptr(n_name, name, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003269 xmlResetLastError();
3270 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00003271 printf("Leak of %d blocks found in htmlIsBooleanAttr",
Daniel Veillardd93f6252004-11-02 15:53:51 +00003272 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003273 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003274 printf(" %d", n_name);
3275 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00003276 }
3277 }
3278#endif
3279
Daniel Veillard3d97e662004-11-04 10:49:00 +00003280 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00003281 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003282}
3283
3284
3285static int
3286test_htmlNewDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003287 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003288
Daniel Veillarda03e3652004-11-02 18:45:30 +00003289#ifdef LIBXML_HTML_ENABLED
3290 int mem_base;
3291 htmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003292 xmlChar * URI; /* URI for the dtd, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00003293 int n_URI;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003294 xmlChar * ExternalID; /* the external ID of the DTD, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00003295 int n_ExternalID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003296
Daniel Veillarda03e3652004-11-02 18:45:30 +00003297 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
3298 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
3299 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00003300 URI = gen_const_xmlChar_ptr(n_URI, 0);
3301 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003302
3303 ret_val = htmlNewDoc(URI, ExternalID);
Daniel Veillarda521d282004-11-09 14:59:59 +00003304 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003305 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003306 des_const_xmlChar_ptr(n_URI, URI, 0);
3307 des_const_xmlChar_ptr(n_ExternalID, ExternalID, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003308 xmlResetLastError();
3309 if (mem_base != xmlMemBlocks()) {
3310 printf("Leak of %d blocks found in htmlNewDoc",
3311 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003312 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003313 printf(" %d", n_URI);
3314 printf(" %d", n_ExternalID);
3315 printf("\n");
3316 }
3317 }
3318 }
3319#endif
3320
Daniel Veillard3d97e662004-11-04 10:49:00 +00003321 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00003322 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003323}
3324
3325
3326static int
3327test_htmlNewDocNoDtD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003328 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003329
Daniel Veillarda03e3652004-11-02 18:45:30 +00003330#ifdef LIBXML_HTML_ENABLED
3331 int mem_base;
3332 htmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003333 xmlChar * URI; /* URI for the dtd, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00003334 int n_URI;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003335 xmlChar * ExternalID; /* the external ID of the DTD, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00003336 int n_ExternalID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003337
Daniel Veillarda03e3652004-11-02 18:45:30 +00003338 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
3339 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
3340 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00003341 URI = gen_const_xmlChar_ptr(n_URI, 0);
3342 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003343
3344 ret_val = htmlNewDocNoDtD(URI, ExternalID);
Daniel Veillarda521d282004-11-09 14:59:59 +00003345 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003346 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003347 des_const_xmlChar_ptr(n_URI, URI, 0);
3348 des_const_xmlChar_ptr(n_ExternalID, ExternalID, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003349 xmlResetLastError();
3350 if (mem_base != xmlMemBlocks()) {
3351 printf("Leak of %d blocks found in htmlNewDocNoDtD",
3352 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003353 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003354 printf(" %d", n_URI);
3355 printf(" %d", n_ExternalID);
3356 printf("\n");
3357 }
3358 }
3359 }
3360#endif
3361
Daniel Veillard3d97e662004-11-04 10:49:00 +00003362 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00003363 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003364}
3365
3366
3367static int
3368test_htmlNodeDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003369 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003370
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003371#ifdef LIBXML_HTML_ENABLED
3372#ifdef LIBXML_OUTPUT_ENABLED
3373 int mem_base;
3374 int ret_val;
3375 xmlBufferPtr buf; /* the HTML buffer output */
3376 int n_buf;
3377 xmlDocPtr doc; /* the document */
3378 int n_doc;
3379 xmlNodePtr cur; /* the current node */
3380 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003381
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003382 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
3383 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
3384 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
3385 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00003386 buf = gen_xmlBufferPtr(n_buf, 0);
3387 doc = gen_xmlDocPtr(n_doc, 1);
3388 cur = gen_xmlNodePtr(n_cur, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003389
3390 ret_val = htmlNodeDump(buf, doc, cur);
3391 desret_int(ret_val);
3392 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003393 des_xmlBufferPtr(n_buf, buf, 0);
3394 des_xmlDocPtr(n_doc, doc, 1);
3395 des_xmlNodePtr(n_cur, cur, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003396 xmlResetLastError();
3397 if (mem_base != xmlMemBlocks()) {
3398 printf("Leak of %d blocks found in htmlNodeDump",
3399 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003400 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003401 printf(" %d", n_buf);
3402 printf(" %d", n_doc);
3403 printf(" %d", n_cur);
3404 printf("\n");
3405 }
3406 }
3407 }
3408 }
3409#endif
3410#endif
3411
Daniel Veillard3d97e662004-11-04 10:49:00 +00003412 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00003413 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003414}
3415
3416
3417static int
3418test_htmlNodeDumpFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003419 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003420
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003421#ifdef LIBXML_HTML_ENABLED
3422#ifdef LIBXML_OUTPUT_ENABLED
3423 int mem_base;
3424 FILE * out; /* the FILE pointer */
3425 int n_out;
3426 xmlDocPtr doc; /* the document */
3427 int n_doc;
3428 xmlNodePtr cur; /* the current node */
3429 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003430
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003431 for (n_out = 0;n_out < gen_nb_FILE_ptr;n_out++) {
3432 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
3433 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
3434 mem_base = xmlMemBlocks();
3435 out = gen_FILE_ptr(n_out, 0);
3436 doc = gen_xmlDocPtr(n_doc, 1);
3437 cur = gen_xmlNodePtr(n_cur, 2);
3438
3439 htmlNodeDumpFile(out, doc, cur);
3440 call_tests++;
3441 des_FILE_ptr(n_out, out, 0);
3442 des_xmlDocPtr(n_doc, doc, 1);
3443 des_xmlNodePtr(n_cur, cur, 2);
3444 xmlResetLastError();
3445 if (mem_base != xmlMemBlocks()) {
3446 printf("Leak of %d blocks found in htmlNodeDumpFile",
3447 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003448 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003449 printf(" %d", n_out);
3450 printf(" %d", n_doc);
3451 printf(" %d", n_cur);
3452 printf("\n");
3453 }
3454 }
3455 }
3456 }
3457#endif
3458#endif
3459
3460 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00003461 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003462}
3463
3464
3465static int
3466test_htmlNodeDumpFileFormat(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003467 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003468
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003469#ifdef LIBXML_HTML_ENABLED
3470#ifdef LIBXML_OUTPUT_ENABLED
3471 int mem_base;
3472 int ret_val;
3473 FILE * out; /* the FILE pointer */
3474 int n_out;
3475 xmlDocPtr doc; /* the document */
3476 int n_doc;
3477 xmlNodePtr cur; /* the current node */
3478 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003479 char * encoding; /* the document encoding */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003480 int n_encoding;
3481 int format; /* should formatting spaces been added */
3482 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003483
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003484 for (n_out = 0;n_out < gen_nb_FILE_ptr;n_out++) {
3485 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
3486 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
3487 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
3488 for (n_format = 0;n_format < gen_nb_int;n_format++) {
3489 mem_base = xmlMemBlocks();
3490 out = gen_FILE_ptr(n_out, 0);
3491 doc = gen_xmlDocPtr(n_doc, 1);
3492 cur = gen_xmlNodePtr(n_cur, 2);
3493 encoding = gen_const_char_ptr(n_encoding, 3);
3494 format = gen_int(n_format, 4);
3495
3496 ret_val = htmlNodeDumpFileFormat(out, doc, cur, encoding, format);
3497 desret_int(ret_val);
3498 call_tests++;
3499 des_FILE_ptr(n_out, out, 0);
3500 des_xmlDocPtr(n_doc, doc, 1);
3501 des_xmlNodePtr(n_cur, cur, 2);
3502 des_const_char_ptr(n_encoding, encoding, 3);
3503 des_int(n_format, format, 4);
3504 xmlResetLastError();
3505 if (mem_base != xmlMemBlocks()) {
3506 printf("Leak of %d blocks found in htmlNodeDumpFileFormat",
3507 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003508 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003509 printf(" %d", n_out);
3510 printf(" %d", n_doc);
3511 printf(" %d", n_cur);
3512 printf(" %d", n_encoding);
3513 printf(" %d", n_format);
3514 printf("\n");
3515 }
3516 }
3517 }
3518 }
3519 }
3520 }
3521#endif
3522#endif
3523
3524 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00003525 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003526}
3527
3528
3529static int
3530test_htmlNodeDumpFormatOutput(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003531 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003532
Daniel Veillard3d97e662004-11-04 10:49:00 +00003533#ifdef LIBXML_HTML_ENABLED
3534#ifdef LIBXML_OUTPUT_ENABLED
3535 int mem_base;
3536 xmlOutputBufferPtr buf; /* the HTML buffer output */
3537 int n_buf;
3538 xmlDocPtr doc; /* the document */
3539 int n_doc;
3540 xmlNodePtr cur; /* the current node */
3541 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003542 char * encoding; /* the encoding string */
Daniel Veillard3d97e662004-11-04 10:49:00 +00003543 int n_encoding;
3544 int format; /* should formatting spaces been added */
3545 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003546
Daniel Veillard3d97e662004-11-04 10:49:00 +00003547 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
3548 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
3549 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
3550 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
3551 for (n_format = 0;n_format < gen_nb_int;n_format++) {
3552 mem_base = xmlMemBlocks();
3553 buf = gen_xmlOutputBufferPtr(n_buf, 0);
3554 doc = gen_xmlDocPtr(n_doc, 1);
3555 cur = gen_xmlNodePtr(n_cur, 2);
3556 encoding = gen_const_char_ptr(n_encoding, 3);
3557 format = gen_int(n_format, 4);
3558
3559 htmlNodeDumpFormatOutput(buf, doc, cur, encoding, format);
3560 call_tests++;
3561 des_xmlOutputBufferPtr(n_buf, buf, 0);
3562 des_xmlDocPtr(n_doc, doc, 1);
3563 des_xmlNodePtr(n_cur, cur, 2);
3564 des_const_char_ptr(n_encoding, encoding, 3);
3565 des_int(n_format, format, 4);
3566 xmlResetLastError();
3567 if (mem_base != xmlMemBlocks()) {
3568 printf("Leak of %d blocks found in htmlNodeDumpFormatOutput",
3569 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003570 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003571 printf(" %d", n_buf);
3572 printf(" %d", n_doc);
3573 printf(" %d", n_cur);
3574 printf(" %d", n_encoding);
3575 printf(" %d", n_format);
3576 printf("\n");
3577 }
3578 }
3579 }
3580 }
3581 }
3582 }
3583#endif
3584#endif
3585
3586 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00003587 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003588}
3589
3590
3591static int
3592test_htmlNodeDumpOutput(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003593 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003594
Daniel Veillard3d97e662004-11-04 10:49:00 +00003595#ifdef LIBXML_HTML_ENABLED
3596#ifdef LIBXML_OUTPUT_ENABLED
3597 int mem_base;
3598 xmlOutputBufferPtr buf; /* the HTML buffer output */
3599 int n_buf;
3600 xmlDocPtr doc; /* the document */
3601 int n_doc;
3602 xmlNodePtr cur; /* the current node */
3603 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003604 char * encoding; /* the encoding string */
Daniel Veillard3d97e662004-11-04 10:49:00 +00003605 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003606
Daniel Veillard3d97e662004-11-04 10:49:00 +00003607 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
3608 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
3609 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
3610 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
3611 mem_base = xmlMemBlocks();
3612 buf = gen_xmlOutputBufferPtr(n_buf, 0);
3613 doc = gen_xmlDocPtr(n_doc, 1);
3614 cur = gen_xmlNodePtr(n_cur, 2);
3615 encoding = gen_const_char_ptr(n_encoding, 3);
3616
3617 htmlNodeDumpOutput(buf, doc, cur, encoding);
3618 call_tests++;
3619 des_xmlOutputBufferPtr(n_buf, buf, 0);
3620 des_xmlDocPtr(n_doc, doc, 1);
3621 des_xmlNodePtr(n_cur, cur, 2);
3622 des_const_char_ptr(n_encoding, encoding, 3);
3623 xmlResetLastError();
3624 if (mem_base != xmlMemBlocks()) {
3625 printf("Leak of %d blocks found in htmlNodeDumpOutput",
3626 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003627 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003628 printf(" %d", n_buf);
3629 printf(" %d", n_doc);
3630 printf(" %d", n_cur);
3631 printf(" %d", n_encoding);
3632 printf("\n");
3633 }
3634 }
3635 }
3636 }
3637 }
3638#endif
3639#endif
3640
3641 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00003642 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003643}
3644
3645
3646static int
3647test_htmlSaveFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003648 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003649
3650#ifdef LIBXML_HTML_ENABLED
3651#ifdef LIBXML_OUTPUT_ENABLED
3652 int mem_base;
3653 int ret_val;
3654 const char * filename; /* the filename (or URL) */
3655 int n_filename;
3656 xmlDocPtr cur; /* the document */
3657 int n_cur;
3658
3659 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
3660 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
3661 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00003662 filename = gen_fileoutput(n_filename, 0);
3663 cur = gen_xmlDocPtr(n_cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003664
3665 ret_val = htmlSaveFile(filename, cur);
3666 desret_int(ret_val);
3667 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003668 des_fileoutput(n_filename, filename, 0);
3669 des_xmlDocPtr(n_cur, cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003670 xmlResetLastError();
3671 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00003672 printf("Leak of %d blocks found in htmlSaveFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +00003673 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003674 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003675 printf(" %d", n_filename);
3676 printf(" %d", n_cur);
3677 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00003678 }
3679 }
3680 }
3681#endif
3682#endif
3683
Daniel Veillard3d97e662004-11-04 10:49:00 +00003684 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00003685 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003686}
3687
3688
3689static int
3690test_htmlSaveFileEnc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003691 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003692
3693#ifdef LIBXML_HTML_ENABLED
3694#ifdef LIBXML_OUTPUT_ENABLED
3695 int mem_base;
3696 int ret_val;
3697 const char * filename; /* the filename */
3698 int n_filename;
3699 xmlDocPtr cur; /* the document */
3700 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003701 char * encoding; /* the document encoding */
Daniel Veillardd93f6252004-11-02 15:53:51 +00003702 int n_encoding;
3703
3704 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
3705 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
3706 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
3707 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00003708 filename = gen_fileoutput(n_filename, 0);
3709 cur = gen_xmlDocPtr(n_cur, 1);
3710 encoding = gen_const_char_ptr(n_encoding, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003711
3712 ret_val = htmlSaveFileEnc(filename, cur, encoding);
3713 desret_int(ret_val);
3714 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003715 des_fileoutput(n_filename, filename, 0);
3716 des_xmlDocPtr(n_cur, cur, 1);
3717 des_const_char_ptr(n_encoding, encoding, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003718 xmlResetLastError();
3719 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00003720 printf("Leak of %d blocks found in htmlSaveFileEnc",
Daniel Veillardd93f6252004-11-02 15:53:51 +00003721 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003722 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003723 printf(" %d", n_filename);
3724 printf(" %d", n_cur);
3725 printf(" %d", n_encoding);
3726 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00003727 }
3728 }
3729 }
3730 }
3731#endif
3732#endif
3733
Daniel Veillard3d97e662004-11-04 10:49:00 +00003734 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00003735 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003736}
3737
3738
3739static int
3740test_htmlSaveFileFormat(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003741 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003742
3743#ifdef LIBXML_HTML_ENABLED
3744#ifdef LIBXML_OUTPUT_ENABLED
3745 int mem_base;
3746 int ret_val;
3747 const char * filename; /* the filename */
3748 int n_filename;
3749 xmlDocPtr cur; /* the document */
3750 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003751 char * encoding; /* the document encoding */
Daniel Veillardd93f6252004-11-02 15:53:51 +00003752 int n_encoding;
3753 int format; /* should formatting spaces been added */
3754 int n_format;
3755
3756 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
3757 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
3758 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
3759 for (n_format = 0;n_format < gen_nb_int;n_format++) {
3760 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00003761 filename = gen_fileoutput(n_filename, 0);
3762 cur = gen_xmlDocPtr(n_cur, 1);
3763 encoding = gen_const_char_ptr(n_encoding, 2);
3764 format = gen_int(n_format, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003765
3766 ret_val = htmlSaveFileFormat(filename, cur, encoding, format);
3767 desret_int(ret_val);
3768 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003769 des_fileoutput(n_filename, filename, 0);
3770 des_xmlDocPtr(n_cur, cur, 1);
3771 des_const_char_ptr(n_encoding, encoding, 2);
3772 des_int(n_format, format, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003773 xmlResetLastError();
3774 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00003775 printf("Leak of %d blocks found in htmlSaveFileFormat",
Daniel Veillardd93f6252004-11-02 15:53:51 +00003776 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003777 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003778 printf(" %d", n_filename);
3779 printf(" %d", n_cur);
3780 printf(" %d", n_encoding);
3781 printf(" %d", n_format);
3782 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00003783 }
3784 }
3785 }
3786 }
3787 }
3788#endif
3789#endif
3790
Daniel Veillard3d97e662004-11-04 10:49:00 +00003791 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00003792 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003793}
3794
3795
3796static int
3797test_htmlSetMetaEncoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003798 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003799
Daniel Veillarda03e3652004-11-02 18:45:30 +00003800#ifdef LIBXML_HTML_ENABLED
3801 int mem_base;
3802 int ret_val;
3803 htmlDocPtr doc; /* the document */
3804 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003805 xmlChar * encoding; /* the encoding string */
Daniel Veillarda03e3652004-11-02 18:45:30 +00003806 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003807
Daniel Veillarda521d282004-11-09 14:59:59 +00003808 for (n_doc = 0;n_doc < gen_nb_htmlDocPtr;n_doc++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00003809 for (n_encoding = 0;n_encoding < gen_nb_const_xmlChar_ptr;n_encoding++) {
3810 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00003811 doc = gen_htmlDocPtr(n_doc, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00003812 encoding = gen_const_xmlChar_ptr(n_encoding, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003813
3814 ret_val = htmlSetMetaEncoding(doc, encoding);
3815 desret_int(ret_val);
3816 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00003817 des_htmlDocPtr(n_doc, doc, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00003818 des_const_xmlChar_ptr(n_encoding, encoding, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003819 xmlResetLastError();
3820 if (mem_base != xmlMemBlocks()) {
3821 printf("Leak of %d blocks found in htmlSetMetaEncoding",
3822 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003823 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003824 printf(" %d", n_doc);
3825 printf(" %d", n_encoding);
3826 printf("\n");
3827 }
3828 }
3829 }
3830#endif
3831
Daniel Veillard3d97e662004-11-04 10:49:00 +00003832 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00003833 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003834}
3835
3836static int
3837test_HTMLtree(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003838 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003839
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00003840 printf("Testing HTMLtree : 17 of 17 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00003841 test_ret += test_htmlDocContentDumpFormatOutput();
3842 test_ret += test_htmlDocContentDumpOutput();
3843 test_ret += test_htmlDocDump();
3844 test_ret += test_htmlDocDumpMemory();
3845 test_ret += test_htmlGetMetaEncoding();
3846 test_ret += test_htmlIsBooleanAttr();
3847 test_ret += test_htmlNewDoc();
3848 test_ret += test_htmlNewDocNoDtD();
3849 test_ret += test_htmlNodeDump();
3850 test_ret += test_htmlNodeDumpFile();
3851 test_ret += test_htmlNodeDumpFileFormat();
3852 test_ret += test_htmlNodeDumpFormatOutput();
3853 test_ret += test_htmlNodeDumpOutput();
3854 test_ret += test_htmlSaveFile();
3855 test_ret += test_htmlSaveFileEnc();
3856 test_ret += test_htmlSaveFileFormat();
3857 test_ret += test_htmlSetMetaEncoding();
Daniel Veillardd93f6252004-11-02 15:53:51 +00003858
Daniel Veillard42595322004-11-08 10:52:06 +00003859 if (test_ret != 0)
3860 printf("Module HTMLtree: %d errors\n", test_ret);
3861 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003862}
3863
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003864static int
3865test_docbDefaultSAXHandlerInit(void) {
3866 int test_ret = 0;
3867
Daniel Veillarda521d282004-11-09 14:59:59 +00003868#ifdef LIBXML_DOCB_ENABLED
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003869 int mem_base;
3870
3871 mem_base = xmlMemBlocks();
3872
3873 docbDefaultSAXHandlerInit();
3874 call_tests++;
3875 xmlResetLastError();
3876 if (mem_base != xmlMemBlocks()) {
3877 printf("Leak of %d blocks found in docbDefaultSAXHandlerInit",
3878 xmlMemBlocks() - mem_base);
3879 test_ret++;
3880 printf("\n");
3881 }
Daniel Veillarda521d282004-11-09 14:59:59 +00003882#endif
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003883
3884 function_tests++;
3885 return(test_ret);
3886}
3887
3888
3889static int
3890test_htmlDefaultSAXHandlerInit(void) {
3891 int test_ret = 0;
3892
Daniel Veillarda521d282004-11-09 14:59:59 +00003893#ifdef LIBXML_HTML_ENABLED
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003894 int mem_base;
3895
3896 mem_base = xmlMemBlocks();
3897
3898 htmlDefaultSAXHandlerInit();
3899 call_tests++;
3900 xmlResetLastError();
3901 if (mem_base != xmlMemBlocks()) {
3902 printf("Leak of %d blocks found in htmlDefaultSAXHandlerInit",
3903 xmlMemBlocks() - mem_base);
3904 test_ret++;
3905 printf("\n");
3906 }
Daniel Veillarda521d282004-11-09 14:59:59 +00003907#endif
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003908
3909 function_tests++;
3910 return(test_ret);
3911}
3912
3913
3914static int
3915test_xmlDefaultSAXHandlerInit(void) {
3916 int test_ret = 0;
3917
3918 int mem_base;
3919
3920 mem_base = xmlMemBlocks();
3921
3922 xmlDefaultSAXHandlerInit();
3923 call_tests++;
3924 xmlResetLastError();
3925 if (mem_base != xmlMemBlocks()) {
3926 printf("Leak of %d blocks found in xmlDefaultSAXHandlerInit",
3927 xmlMemBlocks() - mem_base);
3928 test_ret++;
3929 printf("\n");
3930 }
3931
3932 function_tests++;
3933 return(test_ret);
3934}
3935
3936
3937#define gen_nb_xmlEnumerationPtr 1
3938static xmlEnumerationPtr gen_xmlEnumerationPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
3939 return(NULL);
3940}
3941static void des_xmlEnumerationPtr(int no ATTRIBUTE_UNUSED, xmlEnumerationPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
3942}
3943
3944static int
3945test_xmlSAX2AttributeDecl(void) {
3946 int test_ret = 0;
3947
3948 int mem_base;
3949 void * ctx; /* the user data (XML parser context) */
3950 int n_ctx;
3951 xmlChar * elem; /* the name of the element */
3952 int n_elem;
3953 xmlChar * fullname; /* the attribute name */
3954 int n_fullname;
3955 int type; /* the attribute type */
3956 int n_type;
3957 int def; /* the type of default value */
3958 int n_def;
3959 xmlChar * defaultValue; /* the attribute default value */
3960 int n_defaultValue;
3961 xmlEnumerationPtr tree; /* the tree of enumerated value set */
3962 int n_tree;
3963
3964 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
3965 for (n_elem = 0;n_elem < gen_nb_const_xmlChar_ptr;n_elem++) {
3966 for (n_fullname = 0;n_fullname < gen_nb_const_xmlChar_ptr;n_fullname++) {
3967 for (n_type = 0;n_type < gen_nb_int;n_type++) {
3968 for (n_def = 0;n_def < gen_nb_int;n_def++) {
3969 for (n_defaultValue = 0;n_defaultValue < gen_nb_const_xmlChar_ptr;n_defaultValue++) {
3970 for (n_tree = 0;n_tree < gen_nb_xmlEnumerationPtr;n_tree++) {
3971 mem_base = xmlMemBlocks();
3972 ctx = gen_void_ptr(n_ctx, 0);
3973 elem = gen_const_xmlChar_ptr(n_elem, 1);
3974 fullname = gen_const_xmlChar_ptr(n_fullname, 2);
3975 type = gen_int(n_type, 3);
3976 def = gen_int(n_def, 4);
3977 defaultValue = gen_const_xmlChar_ptr(n_defaultValue, 5);
3978 tree = gen_xmlEnumerationPtr(n_tree, 6);
3979
3980 xmlSAX2AttributeDecl(ctx, elem, fullname, type, def, defaultValue, tree);
3981 call_tests++;
3982 des_void_ptr(n_ctx, ctx, 0);
3983 des_const_xmlChar_ptr(n_elem, elem, 1);
3984 des_const_xmlChar_ptr(n_fullname, fullname, 2);
3985 des_int(n_type, type, 3);
3986 des_int(n_def, def, 4);
3987 des_const_xmlChar_ptr(n_defaultValue, defaultValue, 5);
3988 des_xmlEnumerationPtr(n_tree, tree, 6);
3989 xmlResetLastError();
3990 if (mem_base != xmlMemBlocks()) {
3991 printf("Leak of %d blocks found in xmlSAX2AttributeDecl",
3992 xmlMemBlocks() - mem_base);
3993 test_ret++;
3994 printf(" %d", n_ctx);
3995 printf(" %d", n_elem);
3996 printf(" %d", n_fullname);
3997 printf(" %d", n_type);
3998 printf(" %d", n_def);
3999 printf(" %d", n_defaultValue);
4000 printf(" %d", n_tree);
4001 printf("\n");
4002 }
4003 }
4004 }
4005 }
4006 }
4007 }
4008 }
4009 }
4010
4011 function_tests++;
4012 return(test_ret);
4013}
4014
4015
4016static int
4017test_xmlSAX2CDataBlock(void) {
4018 int test_ret = 0;
4019
4020 int mem_base;
4021 void * ctx; /* the user data (XML parser context) */
4022 int n_ctx;
4023 xmlChar * value; /* The pcdata content */
4024 int n_value;
4025 int len; /* the block length */
4026 int n_len;
4027
4028 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4029 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
4030 for (n_len = 0;n_len < gen_nb_int;n_len++) {
4031 mem_base = xmlMemBlocks();
4032 ctx = gen_void_ptr(n_ctx, 0);
4033 value = gen_const_xmlChar_ptr(n_value, 1);
4034 len = gen_int(n_len, 2);
4035
4036 xmlSAX2CDataBlock(ctx, value, len);
4037 call_tests++;
4038 des_void_ptr(n_ctx, ctx, 0);
4039 des_const_xmlChar_ptr(n_value, value, 1);
4040 des_int(n_len, len, 2);
4041 xmlResetLastError();
4042 if (mem_base != xmlMemBlocks()) {
4043 printf("Leak of %d blocks found in xmlSAX2CDataBlock",
4044 xmlMemBlocks() - mem_base);
4045 test_ret++;
4046 printf(" %d", n_ctx);
4047 printf(" %d", n_value);
4048 printf(" %d", n_len);
4049 printf("\n");
4050 }
4051 }
4052 }
4053 }
4054
4055 function_tests++;
4056 return(test_ret);
4057}
4058
4059
4060static int
4061test_xmlSAX2Characters(void) {
4062 int test_ret = 0;
4063
4064 int mem_base;
4065 void * ctx; /* the user data (XML parser context) */
4066 int n_ctx;
4067 xmlChar * ch; /* a xmlChar string */
4068 int n_ch;
4069 int len; /* the number of xmlChar */
4070 int n_len;
4071
4072 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4073 for (n_ch = 0;n_ch < gen_nb_const_xmlChar_ptr;n_ch++) {
4074 for (n_len = 0;n_len < gen_nb_int;n_len++) {
4075 mem_base = xmlMemBlocks();
4076 ctx = gen_void_ptr(n_ctx, 0);
4077 ch = gen_const_xmlChar_ptr(n_ch, 1);
4078 len = gen_int(n_len, 2);
4079
4080 xmlSAX2Characters(ctx, ch, len);
4081 call_tests++;
4082 des_void_ptr(n_ctx, ctx, 0);
4083 des_const_xmlChar_ptr(n_ch, ch, 1);
4084 des_int(n_len, len, 2);
4085 xmlResetLastError();
4086 if (mem_base != xmlMemBlocks()) {
4087 printf("Leak of %d blocks found in xmlSAX2Characters",
4088 xmlMemBlocks() - mem_base);
4089 test_ret++;
4090 printf(" %d", n_ctx);
4091 printf(" %d", n_ch);
4092 printf(" %d", n_len);
4093 printf("\n");
4094 }
4095 }
4096 }
4097 }
4098
4099 function_tests++;
4100 return(test_ret);
4101}
4102
4103
4104static int
4105test_xmlSAX2Comment(void) {
4106 int test_ret = 0;
4107
4108 int mem_base;
4109 void * ctx; /* the user data (XML parser context) */
4110 int n_ctx;
4111 xmlChar * value; /* the xmlSAX2Comment content */
4112 int n_value;
4113
4114 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4115 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
4116 mem_base = xmlMemBlocks();
4117 ctx = gen_void_ptr(n_ctx, 0);
4118 value = gen_const_xmlChar_ptr(n_value, 1);
4119
4120 xmlSAX2Comment(ctx, value);
4121 call_tests++;
4122 des_void_ptr(n_ctx, ctx, 0);
4123 des_const_xmlChar_ptr(n_value, value, 1);
4124 xmlResetLastError();
4125 if (mem_base != xmlMemBlocks()) {
4126 printf("Leak of %d blocks found in xmlSAX2Comment",
4127 xmlMemBlocks() - mem_base);
4128 test_ret++;
4129 printf(" %d", n_ctx);
4130 printf(" %d", n_value);
4131 printf("\n");
4132 }
4133 }
4134 }
4135
4136 function_tests++;
4137 return(test_ret);
4138}
4139
4140
4141#define gen_nb_xmlElementContentPtr 1
4142static xmlElementContentPtr gen_xmlElementContentPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
4143 return(NULL);
4144}
4145static void des_xmlElementContentPtr(int no ATTRIBUTE_UNUSED, xmlElementContentPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
4146}
4147
4148static int
4149test_xmlSAX2ElementDecl(void) {
4150 int test_ret = 0;
4151
4152 int mem_base;
4153 void * ctx; /* the user data (XML parser context) */
4154 int n_ctx;
4155 xmlChar * name; /* the element name */
4156 int n_name;
4157 int type; /* the element type */
4158 int n_type;
4159 xmlElementContentPtr content; /* the element value tree */
4160 int n_content;
4161
4162 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4163 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4164 for (n_type = 0;n_type < gen_nb_int;n_type++) {
4165 for (n_content = 0;n_content < gen_nb_xmlElementContentPtr;n_content++) {
4166 mem_base = xmlMemBlocks();
4167 ctx = gen_void_ptr(n_ctx, 0);
4168 name = gen_const_xmlChar_ptr(n_name, 1);
4169 type = gen_int(n_type, 2);
4170 content = gen_xmlElementContentPtr(n_content, 3);
4171
4172 xmlSAX2ElementDecl(ctx, name, type, content);
4173 call_tests++;
4174 des_void_ptr(n_ctx, ctx, 0);
4175 des_const_xmlChar_ptr(n_name, name, 1);
4176 des_int(n_type, type, 2);
4177 des_xmlElementContentPtr(n_content, content, 3);
4178 xmlResetLastError();
4179 if (mem_base != xmlMemBlocks()) {
4180 printf("Leak of %d blocks found in xmlSAX2ElementDecl",
4181 xmlMemBlocks() - mem_base);
4182 test_ret++;
4183 printf(" %d", n_ctx);
4184 printf(" %d", n_name);
4185 printf(" %d", n_type);
4186 printf(" %d", n_content);
4187 printf("\n");
4188 }
4189 }
4190 }
4191 }
4192 }
4193
4194 function_tests++;
4195 return(test_ret);
4196}
4197
4198
4199static int
4200test_xmlSAX2EndDocument(void) {
4201 int test_ret = 0;
4202
4203 int mem_base;
4204 void * ctx; /* the user data (XML parser context) */
4205 int n_ctx;
4206
4207 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4208 mem_base = xmlMemBlocks();
4209 ctx = gen_void_ptr(n_ctx, 0);
4210
4211 xmlSAX2EndDocument(ctx);
4212 call_tests++;
4213 des_void_ptr(n_ctx, ctx, 0);
4214 xmlResetLastError();
4215 if (mem_base != xmlMemBlocks()) {
4216 printf("Leak of %d blocks found in xmlSAX2EndDocument",
4217 xmlMemBlocks() - mem_base);
4218 test_ret++;
4219 printf(" %d", n_ctx);
4220 printf("\n");
4221 }
4222 }
4223
4224 function_tests++;
4225 return(test_ret);
4226}
4227
4228
4229static int
4230test_xmlSAX2EndElement(void) {
4231 int test_ret = 0;
4232
Daniel Veillarda521d282004-11-09 14:59:59 +00004233#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004234 int mem_base;
4235 void * ctx; /* the user data (XML parser context) */
4236 int n_ctx;
4237 xmlChar * name; /* The element name */
4238 int n_name;
4239
4240 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4241 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4242 mem_base = xmlMemBlocks();
4243 ctx = gen_void_ptr(n_ctx, 0);
4244 name = gen_const_xmlChar_ptr(n_name, 1);
4245
4246 xmlSAX2EndElement(ctx, name);
4247 call_tests++;
4248 des_void_ptr(n_ctx, ctx, 0);
4249 des_const_xmlChar_ptr(n_name, name, 1);
4250 xmlResetLastError();
4251 if (mem_base != xmlMemBlocks()) {
4252 printf("Leak of %d blocks found in xmlSAX2EndElement",
4253 xmlMemBlocks() - mem_base);
4254 test_ret++;
4255 printf(" %d", n_ctx);
4256 printf(" %d", n_name);
4257 printf("\n");
4258 }
4259 }
4260 }
Daniel Veillarda521d282004-11-09 14:59:59 +00004261#endif
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004262
4263 function_tests++;
4264 return(test_ret);
4265}
4266
4267
4268static int
4269test_xmlSAX2EndElementNs(void) {
4270 int test_ret = 0;
4271
4272 int mem_base;
4273 void * ctx; /* the user data (XML parser context) */
4274 int n_ctx;
4275 xmlChar * localname; /* the local name of the element */
4276 int n_localname;
4277 xmlChar * prefix; /* the element namespace prefix if available */
4278 int n_prefix;
4279 xmlChar * URI; /* the element namespace name if available */
4280 int n_URI;
4281
4282 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4283 for (n_localname = 0;n_localname < gen_nb_const_xmlChar_ptr;n_localname++) {
4284 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
4285 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
4286 mem_base = xmlMemBlocks();
4287 ctx = gen_void_ptr(n_ctx, 0);
4288 localname = gen_const_xmlChar_ptr(n_localname, 1);
4289 prefix = gen_const_xmlChar_ptr(n_prefix, 2);
4290 URI = gen_const_xmlChar_ptr(n_URI, 3);
4291
4292 xmlSAX2EndElementNs(ctx, localname, prefix, URI);
4293 call_tests++;
4294 des_void_ptr(n_ctx, ctx, 0);
4295 des_const_xmlChar_ptr(n_localname, localname, 1);
4296 des_const_xmlChar_ptr(n_prefix, prefix, 2);
4297 des_const_xmlChar_ptr(n_URI, URI, 3);
4298 xmlResetLastError();
4299 if (mem_base != xmlMemBlocks()) {
4300 printf("Leak of %d blocks found in xmlSAX2EndElementNs",
4301 xmlMemBlocks() - mem_base);
4302 test_ret++;
4303 printf(" %d", n_ctx);
4304 printf(" %d", n_localname);
4305 printf(" %d", n_prefix);
4306 printf(" %d", n_URI);
4307 printf("\n");
4308 }
4309 }
4310 }
4311 }
4312 }
4313
4314 function_tests++;
4315 return(test_ret);
4316}
4317
4318
4319static int
4320test_xmlSAX2EntityDecl(void) {
4321 int test_ret = 0;
4322
4323 int mem_base;
4324 void * ctx; /* the user data (XML parser context) */
4325 int n_ctx;
4326 xmlChar * name; /* the entity name */
4327 int n_name;
4328 int type; /* the entity type */
4329 int n_type;
4330 xmlChar * publicId; /* The public ID of the entity */
4331 int n_publicId;
4332 xmlChar * systemId; /* The system ID of the entity */
4333 int n_systemId;
4334 xmlChar * content; /* the entity value (without processing). */
4335 int n_content;
4336
4337 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4338 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4339 for (n_type = 0;n_type < gen_nb_int;n_type++) {
4340 for (n_publicId = 0;n_publicId < gen_nb_const_xmlChar_ptr;n_publicId++) {
4341 for (n_systemId = 0;n_systemId < gen_nb_const_xmlChar_ptr;n_systemId++) {
4342 for (n_content = 0;n_content < gen_nb_xmlChar_ptr;n_content++) {
4343 mem_base = xmlMemBlocks();
4344 ctx = gen_void_ptr(n_ctx, 0);
4345 name = gen_const_xmlChar_ptr(n_name, 1);
4346 type = gen_int(n_type, 2);
4347 publicId = gen_const_xmlChar_ptr(n_publicId, 3);
4348 systemId = gen_const_xmlChar_ptr(n_systemId, 4);
4349 content = gen_xmlChar_ptr(n_content, 5);
4350
4351 xmlSAX2EntityDecl(ctx, name, type, publicId, systemId, content);
4352 call_tests++;
4353 des_void_ptr(n_ctx, ctx, 0);
4354 des_const_xmlChar_ptr(n_name, name, 1);
4355 des_int(n_type, type, 2);
4356 des_const_xmlChar_ptr(n_publicId, publicId, 3);
4357 des_const_xmlChar_ptr(n_systemId, systemId, 4);
4358 des_xmlChar_ptr(n_content, content, 5);
4359 xmlResetLastError();
4360 if (mem_base != xmlMemBlocks()) {
4361 printf("Leak of %d blocks found in xmlSAX2EntityDecl",
4362 xmlMemBlocks() - mem_base);
4363 test_ret++;
4364 printf(" %d", n_ctx);
4365 printf(" %d", n_name);
4366 printf(" %d", n_type);
4367 printf(" %d", n_publicId);
4368 printf(" %d", n_systemId);
4369 printf(" %d", n_content);
4370 printf("\n");
4371 }
4372 }
4373 }
4374 }
4375 }
4376 }
4377 }
4378
4379 function_tests++;
4380 return(test_ret);
4381}
4382
4383
4384static int
4385test_xmlSAX2ExternalSubset(void) {
4386 int test_ret = 0;
4387
4388 int mem_base;
4389 void * ctx; /* the user data (XML parser context) */
4390 int n_ctx;
4391 xmlChar * name; /* the root element name */
4392 int n_name;
4393 xmlChar * ExternalID; /* the external ID */
4394 int n_ExternalID;
4395 xmlChar * SystemID; /* the SYSTEM ID (e.g. filename or URL) */
4396 int n_SystemID;
4397
4398 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4399 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4400 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
4401 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
4402 mem_base = xmlMemBlocks();
4403 ctx = gen_void_ptr(n_ctx, 0);
4404 name = gen_const_xmlChar_ptr(n_name, 1);
4405 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 2);
4406 SystemID = gen_const_xmlChar_ptr(n_SystemID, 3);
4407
4408 xmlSAX2ExternalSubset(ctx, name, ExternalID, SystemID);
4409 call_tests++;
4410 des_void_ptr(n_ctx, ctx, 0);
4411 des_const_xmlChar_ptr(n_name, name, 1);
4412 des_const_xmlChar_ptr(n_ExternalID, ExternalID, 2);
4413 des_const_xmlChar_ptr(n_SystemID, SystemID, 3);
4414 xmlResetLastError();
4415 if (mem_base != xmlMemBlocks()) {
4416 printf("Leak of %d blocks found in xmlSAX2ExternalSubset",
4417 xmlMemBlocks() - mem_base);
4418 test_ret++;
4419 printf(" %d", n_ctx);
4420 printf(" %d", n_name);
4421 printf(" %d", n_ExternalID);
4422 printf(" %d", n_SystemID);
4423 printf("\n");
4424 }
4425 }
4426 }
4427 }
4428 }
4429
4430 function_tests++;
4431 return(test_ret);
4432}
4433
4434
4435static int
4436test_xmlSAX2GetColumnNumber(void) {
4437 int test_ret = 0;
4438
4439 int mem_base;
4440 int ret_val;
4441 void * ctx; /* the user data (XML parser context) */
4442 int n_ctx;
4443
4444 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4445 mem_base = xmlMemBlocks();
4446 ctx = gen_void_ptr(n_ctx, 0);
4447
4448 ret_val = xmlSAX2GetColumnNumber(ctx);
4449 desret_int(ret_val);
4450 call_tests++;
4451 des_void_ptr(n_ctx, ctx, 0);
4452 xmlResetLastError();
4453 if (mem_base != xmlMemBlocks()) {
4454 printf("Leak of %d blocks found in xmlSAX2GetColumnNumber",
4455 xmlMemBlocks() - mem_base);
4456 test_ret++;
4457 printf(" %d", n_ctx);
4458 printf("\n");
4459 }
4460 }
4461
4462 function_tests++;
4463 return(test_ret);
4464}
4465
4466
4467static int
4468test_xmlSAX2GetEntity(void) {
4469 int test_ret = 0;
4470
4471 int mem_base;
4472 xmlEntityPtr ret_val;
4473 void * ctx; /* the user data (XML parser context) */
4474 int n_ctx;
4475 xmlChar * name; /* The entity name */
4476 int n_name;
4477
4478 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4479 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4480 mem_base = xmlMemBlocks();
4481 ctx = gen_void_ptr(n_ctx, 0);
4482 name = gen_const_xmlChar_ptr(n_name, 1);
4483
4484 ret_val = xmlSAX2GetEntity(ctx, name);
4485 desret_xmlEntityPtr(ret_val);
4486 call_tests++;
4487 des_void_ptr(n_ctx, ctx, 0);
4488 des_const_xmlChar_ptr(n_name, name, 1);
4489 xmlResetLastError();
4490 if (mem_base != xmlMemBlocks()) {
4491 printf("Leak of %d blocks found in xmlSAX2GetEntity",
4492 xmlMemBlocks() - mem_base);
4493 test_ret++;
4494 printf(" %d", n_ctx);
4495 printf(" %d", n_name);
4496 printf("\n");
4497 }
4498 }
4499 }
4500
4501 function_tests++;
4502 return(test_ret);
4503}
4504
4505
4506static int
4507test_xmlSAX2GetLineNumber(void) {
4508 int test_ret = 0;
4509
4510 int mem_base;
4511 int ret_val;
4512 void * ctx; /* the user data (XML parser context) */
4513 int n_ctx;
4514
4515 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4516 mem_base = xmlMemBlocks();
4517 ctx = gen_void_ptr(n_ctx, 0);
4518
4519 ret_val = xmlSAX2GetLineNumber(ctx);
4520 desret_int(ret_val);
4521 call_tests++;
4522 des_void_ptr(n_ctx, ctx, 0);
4523 xmlResetLastError();
4524 if (mem_base != xmlMemBlocks()) {
4525 printf("Leak of %d blocks found in xmlSAX2GetLineNumber",
4526 xmlMemBlocks() - mem_base);
4527 test_ret++;
4528 printf(" %d", n_ctx);
4529 printf("\n");
4530 }
4531 }
4532
4533 function_tests++;
4534 return(test_ret);
4535}
4536
4537
4538static int
4539test_xmlSAX2GetParameterEntity(void) {
4540 int test_ret = 0;
4541
4542 int mem_base;
4543 xmlEntityPtr ret_val;
4544 void * ctx; /* the user data (XML parser context) */
4545 int n_ctx;
4546 xmlChar * name; /* The entity name */
4547 int n_name;
4548
4549 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4550 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4551 mem_base = xmlMemBlocks();
4552 ctx = gen_void_ptr(n_ctx, 0);
4553 name = gen_const_xmlChar_ptr(n_name, 1);
4554
4555 ret_val = xmlSAX2GetParameterEntity(ctx, name);
4556 desret_xmlEntityPtr(ret_val);
4557 call_tests++;
4558 des_void_ptr(n_ctx, ctx, 0);
4559 des_const_xmlChar_ptr(n_name, name, 1);
4560 xmlResetLastError();
4561 if (mem_base != xmlMemBlocks()) {
4562 printf("Leak of %d blocks found in xmlSAX2GetParameterEntity",
4563 xmlMemBlocks() - mem_base);
4564 test_ret++;
4565 printf(" %d", n_ctx);
4566 printf(" %d", n_name);
4567 printf("\n");
4568 }
4569 }
4570 }
4571
4572 function_tests++;
4573 return(test_ret);
4574}
4575
4576
4577static int
4578test_xmlSAX2GetPublicId(void) {
4579 int test_ret = 0;
4580
4581 int mem_base;
4582 const xmlChar * ret_val;
4583 void * ctx; /* the user data (XML parser context) */
4584 int n_ctx;
4585
4586 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4587 mem_base = xmlMemBlocks();
4588 ctx = gen_void_ptr(n_ctx, 0);
4589
4590 ret_val = xmlSAX2GetPublicId(ctx);
4591 desret_const_xmlChar_ptr(ret_val);
4592 call_tests++;
4593 des_void_ptr(n_ctx, ctx, 0);
4594 xmlResetLastError();
4595 if (mem_base != xmlMemBlocks()) {
4596 printf("Leak of %d blocks found in xmlSAX2GetPublicId",
4597 xmlMemBlocks() - mem_base);
4598 test_ret++;
4599 printf(" %d", n_ctx);
4600 printf("\n");
4601 }
4602 }
4603
4604 function_tests++;
4605 return(test_ret);
4606}
4607
4608
4609static int
4610test_xmlSAX2GetSystemId(void) {
4611 int test_ret = 0;
4612
4613 int mem_base;
4614 const xmlChar * ret_val;
4615 void * ctx; /* the user data (XML parser context) */
4616 int n_ctx;
4617
4618 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4619 mem_base = xmlMemBlocks();
4620 ctx = gen_void_ptr(n_ctx, 0);
4621
4622 ret_val = xmlSAX2GetSystemId(ctx);
4623 desret_const_xmlChar_ptr(ret_val);
4624 call_tests++;
4625 des_void_ptr(n_ctx, ctx, 0);
4626 xmlResetLastError();
4627 if (mem_base != xmlMemBlocks()) {
4628 printf("Leak of %d blocks found in xmlSAX2GetSystemId",
4629 xmlMemBlocks() - mem_base);
4630 test_ret++;
4631 printf(" %d", n_ctx);
4632 printf("\n");
4633 }
4634 }
4635
4636 function_tests++;
4637 return(test_ret);
4638}
4639
4640
4641static int
4642test_xmlSAX2HasExternalSubset(void) {
4643 int test_ret = 0;
4644
4645 int mem_base;
4646 int ret_val;
4647 void * ctx; /* the user data (XML parser context) */
4648 int n_ctx;
4649
4650 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4651 mem_base = xmlMemBlocks();
4652 ctx = gen_void_ptr(n_ctx, 0);
4653
4654 ret_val = xmlSAX2HasExternalSubset(ctx);
4655 desret_int(ret_val);
4656 call_tests++;
4657 des_void_ptr(n_ctx, ctx, 0);
4658 xmlResetLastError();
4659 if (mem_base != xmlMemBlocks()) {
4660 printf("Leak of %d blocks found in xmlSAX2HasExternalSubset",
4661 xmlMemBlocks() - mem_base);
4662 test_ret++;
4663 printf(" %d", n_ctx);
4664 printf("\n");
4665 }
4666 }
4667
4668 function_tests++;
4669 return(test_ret);
4670}
4671
4672
4673static int
4674test_xmlSAX2HasInternalSubset(void) {
4675 int test_ret = 0;
4676
4677 int mem_base;
4678 int ret_val;
4679 void * ctx; /* the user data (XML parser context) */
4680 int n_ctx;
4681
4682 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4683 mem_base = xmlMemBlocks();
4684 ctx = gen_void_ptr(n_ctx, 0);
4685
4686 ret_val = xmlSAX2HasInternalSubset(ctx);
4687 desret_int(ret_val);
4688 call_tests++;
4689 des_void_ptr(n_ctx, ctx, 0);
4690 xmlResetLastError();
4691 if (mem_base != xmlMemBlocks()) {
4692 printf("Leak of %d blocks found in xmlSAX2HasInternalSubset",
4693 xmlMemBlocks() - mem_base);
4694 test_ret++;
4695 printf(" %d", n_ctx);
4696 printf("\n");
4697 }
4698 }
4699
4700 function_tests++;
4701 return(test_ret);
4702}
4703
4704
4705static int
4706test_xmlSAX2IgnorableWhitespace(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 * ch; /* a xmlChar string */
4713 int n_ch;
4714 int len; /* the number of xmlChar */
4715 int n_len;
4716
4717 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4718 for (n_ch = 0;n_ch < gen_nb_const_xmlChar_ptr;n_ch++) {
4719 for (n_len = 0;n_len < gen_nb_int;n_len++) {
4720 mem_base = xmlMemBlocks();
4721 ctx = gen_void_ptr(n_ctx, 0);
4722 ch = gen_const_xmlChar_ptr(n_ch, 1);
4723 len = gen_int(n_len, 2);
4724
4725 xmlSAX2IgnorableWhitespace(ctx, ch, len);
4726 call_tests++;
4727 des_void_ptr(n_ctx, ctx, 0);
4728 des_const_xmlChar_ptr(n_ch, ch, 1);
4729 des_int(n_len, len, 2);
4730 xmlResetLastError();
4731 if (mem_base != xmlMemBlocks()) {
4732 printf("Leak of %d blocks found in xmlSAX2IgnorableWhitespace",
4733 xmlMemBlocks() - mem_base);
4734 test_ret++;
4735 printf(" %d", n_ctx);
4736 printf(" %d", n_ch);
4737 printf(" %d", n_len);
4738 printf("\n");
4739 }
4740 }
4741 }
4742 }
4743
4744 function_tests++;
4745 return(test_ret);
4746}
4747
4748
4749#define gen_nb_xmlSAXHandler_ptr 1
4750static xmlSAXHandler * gen_xmlSAXHandler_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
4751 return(NULL);
4752}
4753static void des_xmlSAXHandler_ptr(int no ATTRIBUTE_UNUSED, xmlSAXHandler * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
4754}
4755
4756static int
4757test_xmlSAX2InitDefaultSAXHandler(void) {
4758 int test_ret = 0;
4759
4760 int mem_base;
4761 xmlSAXHandler * hdlr; /* the SAX handler */
4762 int n_hdlr;
4763 int warning; /* flag if non-zero sets the handler warning procedure */
4764 int n_warning;
4765
4766 for (n_hdlr = 0;n_hdlr < gen_nb_xmlSAXHandler_ptr;n_hdlr++) {
4767 for (n_warning = 0;n_warning < gen_nb_int;n_warning++) {
4768 mem_base = xmlMemBlocks();
4769 hdlr = gen_xmlSAXHandler_ptr(n_hdlr, 0);
4770 warning = gen_int(n_warning, 1);
4771
4772 xmlSAX2InitDefaultSAXHandler(hdlr, warning);
4773 call_tests++;
4774 des_xmlSAXHandler_ptr(n_hdlr, hdlr, 0);
4775 des_int(n_warning, warning, 1);
4776 xmlResetLastError();
4777 if (mem_base != xmlMemBlocks()) {
4778 printf("Leak of %d blocks found in xmlSAX2InitDefaultSAXHandler",
4779 xmlMemBlocks() - mem_base);
4780 test_ret++;
4781 printf(" %d", n_hdlr);
4782 printf(" %d", n_warning);
4783 printf("\n");
4784 }
4785 }
4786 }
4787
4788 function_tests++;
4789 return(test_ret);
4790}
4791
4792
4793static int
4794test_xmlSAX2InitDocbDefaultSAXHandler(void) {
4795 int test_ret = 0;
4796
4797#ifdef LIBXML_DOCB_ENABLED
4798 int mem_base;
4799 xmlSAXHandler * hdlr; /* the SAX handler */
4800 int n_hdlr;
4801
4802 for (n_hdlr = 0;n_hdlr < gen_nb_xmlSAXHandler_ptr;n_hdlr++) {
4803 mem_base = xmlMemBlocks();
4804 hdlr = gen_xmlSAXHandler_ptr(n_hdlr, 0);
4805
4806 xmlSAX2InitDocbDefaultSAXHandler(hdlr);
4807 call_tests++;
4808 des_xmlSAXHandler_ptr(n_hdlr, hdlr, 0);
4809 xmlResetLastError();
4810 if (mem_base != xmlMemBlocks()) {
4811 printf("Leak of %d blocks found in xmlSAX2InitDocbDefaultSAXHandler",
4812 xmlMemBlocks() - mem_base);
4813 test_ret++;
4814 printf(" %d", n_hdlr);
4815 printf("\n");
4816 }
4817 }
4818#endif
4819
4820 function_tests++;
4821 return(test_ret);
4822}
4823
4824
4825static int
4826test_xmlSAX2InitHtmlDefaultSAXHandler(void) {
4827 int test_ret = 0;
4828
4829#ifdef LIBXML_HTML_ENABLED
4830 int mem_base;
4831 xmlSAXHandler * hdlr; /* the SAX handler */
4832 int n_hdlr;
4833
4834 for (n_hdlr = 0;n_hdlr < gen_nb_xmlSAXHandler_ptr;n_hdlr++) {
4835 mem_base = xmlMemBlocks();
4836 hdlr = gen_xmlSAXHandler_ptr(n_hdlr, 0);
4837
4838 xmlSAX2InitHtmlDefaultSAXHandler(hdlr);
4839 call_tests++;
4840 des_xmlSAXHandler_ptr(n_hdlr, hdlr, 0);
4841 xmlResetLastError();
4842 if (mem_base != xmlMemBlocks()) {
4843 printf("Leak of %d blocks found in xmlSAX2InitHtmlDefaultSAXHandler",
4844 xmlMemBlocks() - mem_base);
4845 test_ret++;
4846 printf(" %d", n_hdlr);
4847 printf("\n");
4848 }
4849 }
4850#endif
4851
4852 function_tests++;
4853 return(test_ret);
4854}
4855
4856
4857static int
4858test_xmlSAX2InternalSubset(void) {
4859 int test_ret = 0;
4860
4861 int mem_base;
4862 void * ctx; /* the user data (XML parser context) */
4863 int n_ctx;
4864 xmlChar * name; /* the root element name */
4865 int n_name;
4866 xmlChar * ExternalID; /* the external ID */
4867 int n_ExternalID;
4868 xmlChar * SystemID; /* the SYSTEM ID (e.g. filename or URL) */
4869 int n_SystemID;
4870
4871 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4872 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4873 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
4874 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
4875 mem_base = xmlMemBlocks();
4876 ctx = gen_void_ptr(n_ctx, 0);
4877 name = gen_const_xmlChar_ptr(n_name, 1);
4878 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 2);
4879 SystemID = gen_const_xmlChar_ptr(n_SystemID, 3);
4880
4881 xmlSAX2InternalSubset(ctx, name, ExternalID, SystemID);
4882 call_tests++;
4883 des_void_ptr(n_ctx, ctx, 0);
4884 des_const_xmlChar_ptr(n_name, name, 1);
4885 des_const_xmlChar_ptr(n_ExternalID, ExternalID, 2);
4886 des_const_xmlChar_ptr(n_SystemID, SystemID, 3);
4887 xmlResetLastError();
4888 if (mem_base != xmlMemBlocks()) {
4889 printf("Leak of %d blocks found in xmlSAX2InternalSubset",
4890 xmlMemBlocks() - mem_base);
4891 test_ret++;
4892 printf(" %d", n_ctx);
4893 printf(" %d", n_name);
4894 printf(" %d", n_ExternalID);
4895 printf(" %d", n_SystemID);
4896 printf("\n");
4897 }
4898 }
4899 }
4900 }
4901 }
4902
4903 function_tests++;
4904 return(test_ret);
4905}
4906
4907
4908static int
4909test_xmlSAX2IsStandalone(void) {
4910 int test_ret = 0;
4911
4912 int mem_base;
4913 int ret_val;
4914 void * ctx; /* the user data (XML parser context) */
4915 int n_ctx;
4916
4917 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4918 mem_base = xmlMemBlocks();
4919 ctx = gen_void_ptr(n_ctx, 0);
4920
4921 ret_val = xmlSAX2IsStandalone(ctx);
4922 desret_int(ret_val);
4923 call_tests++;
4924 des_void_ptr(n_ctx, ctx, 0);
4925 xmlResetLastError();
4926 if (mem_base != xmlMemBlocks()) {
4927 printf("Leak of %d blocks found in xmlSAX2IsStandalone",
4928 xmlMemBlocks() - mem_base);
4929 test_ret++;
4930 printf(" %d", n_ctx);
4931 printf("\n");
4932 }
4933 }
4934
4935 function_tests++;
4936 return(test_ret);
4937}
4938
4939
4940static int
4941test_xmlSAX2NotationDecl(void) {
4942 int test_ret = 0;
4943
4944 int mem_base;
4945 void * ctx; /* the user data (XML parser context) */
4946 int n_ctx;
4947 xmlChar * name; /* The name of the notation */
4948 int n_name;
4949 xmlChar * publicId; /* The public ID of the entity */
4950 int n_publicId;
4951 xmlChar * systemId; /* The system ID of the entity */
4952 int n_systemId;
4953
4954 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4955 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4956 for (n_publicId = 0;n_publicId < gen_nb_const_xmlChar_ptr;n_publicId++) {
4957 for (n_systemId = 0;n_systemId < gen_nb_const_xmlChar_ptr;n_systemId++) {
4958 mem_base = xmlMemBlocks();
4959 ctx = gen_void_ptr(n_ctx, 0);
4960 name = gen_const_xmlChar_ptr(n_name, 1);
4961 publicId = gen_const_xmlChar_ptr(n_publicId, 2);
4962 systemId = gen_const_xmlChar_ptr(n_systemId, 3);
4963
4964 xmlSAX2NotationDecl(ctx, name, publicId, systemId);
4965 call_tests++;
4966 des_void_ptr(n_ctx, ctx, 0);
4967 des_const_xmlChar_ptr(n_name, name, 1);
4968 des_const_xmlChar_ptr(n_publicId, publicId, 2);
4969 des_const_xmlChar_ptr(n_systemId, systemId, 3);
4970 xmlResetLastError();
4971 if (mem_base != xmlMemBlocks()) {
4972 printf("Leak of %d blocks found in xmlSAX2NotationDecl",
4973 xmlMemBlocks() - mem_base);
4974 test_ret++;
4975 printf(" %d", n_ctx);
4976 printf(" %d", n_name);
4977 printf(" %d", n_publicId);
4978 printf(" %d", n_systemId);
4979 printf("\n");
4980 }
4981 }
4982 }
4983 }
4984 }
4985
4986 function_tests++;
4987 return(test_ret);
4988}
4989
4990
4991static int
4992test_xmlSAX2ProcessingInstruction(void) {
4993 int test_ret = 0;
4994
4995 int mem_base;
4996 void * ctx; /* the user data (XML parser context) */
4997 int n_ctx;
4998 xmlChar * target; /* the target name */
4999 int n_target;
5000 xmlChar * data; /* the PI data's */
5001 int n_data;
5002
5003 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
5004 for (n_target = 0;n_target < gen_nb_const_xmlChar_ptr;n_target++) {
5005 for (n_data = 0;n_data < gen_nb_const_xmlChar_ptr;n_data++) {
5006 mem_base = xmlMemBlocks();
5007 ctx = gen_void_ptr(n_ctx, 0);
5008 target = gen_const_xmlChar_ptr(n_target, 1);
5009 data = gen_const_xmlChar_ptr(n_data, 2);
5010
5011 xmlSAX2ProcessingInstruction(ctx, target, data);
5012 call_tests++;
5013 des_void_ptr(n_ctx, ctx, 0);
5014 des_const_xmlChar_ptr(n_target, target, 1);
5015 des_const_xmlChar_ptr(n_data, data, 2);
5016 xmlResetLastError();
5017 if (mem_base != xmlMemBlocks()) {
5018 printf("Leak of %d blocks found in xmlSAX2ProcessingInstruction",
5019 xmlMemBlocks() - mem_base);
5020 test_ret++;
5021 printf(" %d", n_ctx);
5022 printf(" %d", n_target);
5023 printf(" %d", n_data);
5024 printf("\n");
5025 }
5026 }
5027 }
5028 }
5029
5030 function_tests++;
5031 return(test_ret);
5032}
5033
5034
5035static int
5036test_xmlSAX2Reference(void) {
5037 int test_ret = 0;
5038
5039 int mem_base;
5040 void * ctx; /* the user data (XML parser context) */
5041 int n_ctx;
5042 xmlChar * name; /* The entity name */
5043 int n_name;
5044
5045 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
5046 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
5047 mem_base = xmlMemBlocks();
5048 ctx = gen_void_ptr(n_ctx, 0);
5049 name = gen_const_xmlChar_ptr(n_name, 1);
5050
5051 xmlSAX2Reference(ctx, name);
5052 call_tests++;
5053 des_void_ptr(n_ctx, ctx, 0);
5054 des_const_xmlChar_ptr(n_name, name, 1);
5055 xmlResetLastError();
5056 if (mem_base != xmlMemBlocks()) {
5057 printf("Leak of %d blocks found in xmlSAX2Reference",
5058 xmlMemBlocks() - mem_base);
5059 test_ret++;
5060 printf(" %d", n_ctx);
5061 printf(" %d", n_name);
5062 printf("\n");
5063 }
5064 }
5065 }
5066
5067 function_tests++;
5068 return(test_ret);
5069}
5070
5071
5072static int
5073test_xmlSAX2ResolveEntity(void) {
5074 int test_ret = 0;
5075
5076 int mem_base;
5077 xmlParserInputPtr ret_val;
5078 void * ctx; /* the user data (XML parser context) */
5079 int n_ctx;
5080 xmlChar * publicId; /* The public ID of the entity */
5081 int n_publicId;
5082 xmlChar * systemId; /* The system ID of the entity */
5083 int n_systemId;
5084
5085 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
5086 for (n_publicId = 0;n_publicId < gen_nb_const_xmlChar_ptr;n_publicId++) {
5087 for (n_systemId = 0;n_systemId < gen_nb_const_xmlChar_ptr;n_systemId++) {
5088 mem_base = xmlMemBlocks();
5089 ctx = gen_void_ptr(n_ctx, 0);
5090 publicId = gen_const_xmlChar_ptr(n_publicId, 1);
5091 systemId = gen_const_xmlChar_ptr(n_systemId, 2);
5092
5093 ret_val = xmlSAX2ResolveEntity(ctx, publicId, systemId);
5094 desret_xmlParserInputPtr(ret_val);
5095 call_tests++;
5096 des_void_ptr(n_ctx, ctx, 0);
5097 des_const_xmlChar_ptr(n_publicId, publicId, 1);
5098 des_const_xmlChar_ptr(n_systemId, systemId, 2);
5099 xmlResetLastError();
5100 if (mem_base != xmlMemBlocks()) {
5101 printf("Leak of %d blocks found in xmlSAX2ResolveEntity",
5102 xmlMemBlocks() - mem_base);
5103 test_ret++;
5104 printf(" %d", n_ctx);
5105 printf(" %d", n_publicId);
5106 printf(" %d", n_systemId);
5107 printf("\n");
5108 }
5109 }
5110 }
5111 }
5112
5113 function_tests++;
5114 return(test_ret);
5115}
5116
5117
5118#define gen_nb_xmlSAXLocatorPtr 1
5119static xmlSAXLocatorPtr gen_xmlSAXLocatorPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
5120 return(NULL);
5121}
5122static void des_xmlSAXLocatorPtr(int no ATTRIBUTE_UNUSED, xmlSAXLocatorPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
5123}
5124
5125static int
5126test_xmlSAX2SetDocumentLocator(void) {
5127 int test_ret = 0;
5128
5129 int mem_base;
5130 void * ctx; /* the user data (XML parser context) */
5131 int n_ctx;
5132 xmlSAXLocatorPtr loc; /* A SAX Locator */
5133 int n_loc;
5134
5135 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
5136 for (n_loc = 0;n_loc < gen_nb_xmlSAXLocatorPtr;n_loc++) {
5137 mem_base = xmlMemBlocks();
5138 ctx = gen_void_ptr(n_ctx, 0);
5139 loc = gen_xmlSAXLocatorPtr(n_loc, 1);
5140
5141 xmlSAX2SetDocumentLocator(ctx, loc);
5142 call_tests++;
5143 des_void_ptr(n_ctx, ctx, 0);
5144 des_xmlSAXLocatorPtr(n_loc, loc, 1);
5145 xmlResetLastError();
5146 if (mem_base != xmlMemBlocks()) {
5147 printf("Leak of %d blocks found in xmlSAX2SetDocumentLocator",
5148 xmlMemBlocks() - mem_base);
5149 test_ret++;
5150 printf(" %d", n_ctx);
5151 printf(" %d", n_loc);
5152 printf("\n");
5153 }
5154 }
5155 }
5156
5157 function_tests++;
5158 return(test_ret);
5159}
5160
5161
5162static int
5163test_xmlSAX2StartDocument(void) {
5164 int test_ret = 0;
5165
5166 int mem_base;
5167 void * ctx; /* the user data (XML parser context) */
5168 int n_ctx;
5169
5170 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
5171 mem_base = xmlMemBlocks();
5172 ctx = gen_void_ptr(n_ctx, 0);
5173
5174 xmlSAX2StartDocument(ctx);
5175 call_tests++;
5176 des_void_ptr(n_ctx, ctx, 0);
5177 xmlResetLastError();
5178 if (mem_base != xmlMemBlocks()) {
5179 printf("Leak of %d blocks found in xmlSAX2StartDocument",
5180 xmlMemBlocks() - mem_base);
5181 test_ret++;
5182 printf(" %d", n_ctx);
5183 printf("\n");
5184 }
5185 }
5186
5187 function_tests++;
5188 return(test_ret);
5189}
5190
5191
5192static int
5193test_xmlSAX2StartElement(void) {
5194 int test_ret = 0;
5195
Daniel Veillarda521d282004-11-09 14:59:59 +00005196#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005197 int mem_base;
5198 void * ctx; /* the user data (XML parser context) */
5199 int n_ctx;
5200 xmlChar * fullname; /* The element name, including namespace prefix */
5201 int n_fullname;
5202 xmlChar ** atts; /* An array of name/value attributes pairs, NULL terminated */
5203 int n_atts;
5204
5205 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
5206 for (n_fullname = 0;n_fullname < gen_nb_const_xmlChar_ptr;n_fullname++) {
5207 for (n_atts = 0;n_atts < gen_nb_const_xmlChar_ptr_ptr;n_atts++) {
5208 mem_base = xmlMemBlocks();
5209 ctx = gen_void_ptr(n_ctx, 0);
5210 fullname = gen_const_xmlChar_ptr(n_fullname, 1);
5211 atts = gen_const_xmlChar_ptr_ptr(n_atts, 2);
5212
5213 xmlSAX2StartElement(ctx, fullname, atts);
5214 call_tests++;
5215 des_void_ptr(n_ctx, ctx, 0);
5216 des_const_xmlChar_ptr(n_fullname, fullname, 1);
5217 des_const_xmlChar_ptr_ptr(n_atts, atts, 2);
5218 xmlResetLastError();
5219 if (mem_base != xmlMemBlocks()) {
5220 printf("Leak of %d blocks found in xmlSAX2StartElement",
5221 xmlMemBlocks() - mem_base);
5222 test_ret++;
5223 printf(" %d", n_ctx);
5224 printf(" %d", n_fullname);
5225 printf(" %d", n_atts);
5226 printf("\n");
5227 }
5228 }
5229 }
5230 }
Daniel Veillarda521d282004-11-09 14:59:59 +00005231#endif
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005232
5233 function_tests++;
5234 return(test_ret);
5235}
5236
5237
5238static int
5239test_xmlSAX2StartElementNs(void) {
5240 int test_ret = 0;
5241
5242 int mem_base;
5243 void * ctx; /* the user data (XML parser context) */
5244 int n_ctx;
5245 xmlChar * localname; /* the local name of the element */
5246 int n_localname;
5247 xmlChar * prefix; /* the element namespace prefix if available */
5248 int n_prefix;
5249 xmlChar * URI; /* the element namespace name if available */
5250 int n_URI;
5251 int nb_namespaces; /* number of namespace definitions on that node */
5252 int n_nb_namespaces;
5253 xmlChar ** namespaces; /* pointer to the array of prefix/URI pairs namespace definitions */
5254 int n_namespaces;
5255 int nb_attributes; /* the number of attributes on that node */
5256 int n_nb_attributes;
5257 int nb_defaulted; /* the number of defaulted attributes. */
5258 int n_nb_defaulted;
5259 xmlChar ** attributes; /* pointer to the array of (localname/prefix/URI/value/end) attribute values. */
5260 int n_attributes;
5261
5262 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
5263 for (n_localname = 0;n_localname < gen_nb_const_xmlChar_ptr;n_localname++) {
5264 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
5265 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
5266 for (n_nb_namespaces = 0;n_nb_namespaces < gen_nb_int;n_nb_namespaces++) {
5267 for (n_namespaces = 0;n_namespaces < gen_nb_const_xmlChar_ptr_ptr;n_namespaces++) {
5268 for (n_nb_attributes = 0;n_nb_attributes < gen_nb_int;n_nb_attributes++) {
5269 for (n_nb_defaulted = 0;n_nb_defaulted < gen_nb_int;n_nb_defaulted++) {
5270 for (n_attributes = 0;n_attributes < gen_nb_const_xmlChar_ptr_ptr;n_attributes++) {
5271 mem_base = xmlMemBlocks();
5272 ctx = gen_void_ptr(n_ctx, 0);
5273 localname = gen_const_xmlChar_ptr(n_localname, 1);
5274 prefix = gen_const_xmlChar_ptr(n_prefix, 2);
5275 URI = gen_const_xmlChar_ptr(n_URI, 3);
5276 nb_namespaces = gen_int(n_nb_namespaces, 4);
5277 namespaces = gen_const_xmlChar_ptr_ptr(n_namespaces, 5);
5278 nb_attributes = gen_int(n_nb_attributes, 6);
5279 nb_defaulted = gen_int(n_nb_defaulted, 7);
5280 attributes = gen_const_xmlChar_ptr_ptr(n_attributes, 8);
5281
5282 xmlSAX2StartElementNs(ctx, localname, prefix, URI, nb_namespaces, namespaces, nb_attributes, nb_defaulted, attributes);
5283 call_tests++;
5284 des_void_ptr(n_ctx, ctx, 0);
5285 des_const_xmlChar_ptr(n_localname, localname, 1);
5286 des_const_xmlChar_ptr(n_prefix, prefix, 2);
5287 des_const_xmlChar_ptr(n_URI, URI, 3);
5288 des_int(n_nb_namespaces, nb_namespaces, 4);
5289 des_const_xmlChar_ptr_ptr(n_namespaces, namespaces, 5);
5290 des_int(n_nb_attributes, nb_attributes, 6);
5291 des_int(n_nb_defaulted, nb_defaulted, 7);
5292 des_const_xmlChar_ptr_ptr(n_attributes, attributes, 8);
5293 xmlResetLastError();
5294 if (mem_base != xmlMemBlocks()) {
5295 printf("Leak of %d blocks found in xmlSAX2StartElementNs",
5296 xmlMemBlocks() - mem_base);
5297 test_ret++;
5298 printf(" %d", n_ctx);
5299 printf(" %d", n_localname);
5300 printf(" %d", n_prefix);
5301 printf(" %d", n_URI);
5302 printf(" %d", n_nb_namespaces);
5303 printf(" %d", n_namespaces);
5304 printf(" %d", n_nb_attributes);
5305 printf(" %d", n_nb_defaulted);
5306 printf(" %d", n_attributes);
5307 printf("\n");
5308 }
5309 }
5310 }
5311 }
5312 }
5313 }
5314 }
5315 }
5316 }
5317 }
5318
5319 function_tests++;
5320 return(test_ret);
5321}
5322
5323
5324static int
5325test_xmlSAX2UnparsedEntityDecl(void) {
5326 int test_ret = 0;
5327
5328 int mem_base;
5329 void * ctx; /* the user data (XML parser context) */
5330 int n_ctx;
5331 xmlChar * name; /* The name of the entity */
5332 int n_name;
5333 xmlChar * publicId; /* The public ID of the entity */
5334 int n_publicId;
5335 xmlChar * systemId; /* The system ID of the entity */
5336 int n_systemId;
5337 xmlChar * notationName; /* the name of the notation */
5338 int n_notationName;
5339
5340 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
5341 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
5342 for (n_publicId = 0;n_publicId < gen_nb_const_xmlChar_ptr;n_publicId++) {
5343 for (n_systemId = 0;n_systemId < gen_nb_const_xmlChar_ptr;n_systemId++) {
5344 for (n_notationName = 0;n_notationName < gen_nb_const_xmlChar_ptr;n_notationName++) {
5345 mem_base = xmlMemBlocks();
5346 ctx = gen_void_ptr(n_ctx, 0);
5347 name = gen_const_xmlChar_ptr(n_name, 1);
5348 publicId = gen_const_xmlChar_ptr(n_publicId, 2);
5349 systemId = gen_const_xmlChar_ptr(n_systemId, 3);
5350 notationName = gen_const_xmlChar_ptr(n_notationName, 4);
5351
5352 xmlSAX2UnparsedEntityDecl(ctx, name, publicId, systemId, notationName);
5353 call_tests++;
5354 des_void_ptr(n_ctx, ctx, 0);
5355 des_const_xmlChar_ptr(n_name, name, 1);
5356 des_const_xmlChar_ptr(n_publicId, publicId, 2);
5357 des_const_xmlChar_ptr(n_systemId, systemId, 3);
5358 des_const_xmlChar_ptr(n_notationName, notationName, 4);
5359 xmlResetLastError();
5360 if (mem_base != xmlMemBlocks()) {
5361 printf("Leak of %d blocks found in xmlSAX2UnparsedEntityDecl",
5362 xmlMemBlocks() - mem_base);
5363 test_ret++;
5364 printf(" %d", n_ctx);
5365 printf(" %d", n_name);
5366 printf(" %d", n_publicId);
5367 printf(" %d", n_systemId);
5368 printf(" %d", n_notationName);
5369 printf("\n");
5370 }
5371 }
5372 }
5373 }
5374 }
5375 }
5376
5377 function_tests++;
5378 return(test_ret);
5379}
5380
5381
5382static int
5383test_xmlSAXDefaultVersion(void) {
5384 int test_ret = 0;
5385
Daniel Veillarda521d282004-11-09 14:59:59 +00005386#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005387 int mem_base;
5388 int ret_val;
5389 int version; /* the version, 1 or 2 */
5390 int n_version;
5391
5392 for (n_version = 0;n_version < gen_nb_int;n_version++) {
5393 mem_base = xmlMemBlocks();
5394 version = gen_int(n_version, 0);
5395
5396 ret_val = xmlSAXDefaultVersion(version);
5397 desret_int(ret_val);
5398 call_tests++;
5399 des_int(n_version, version, 0);
5400 xmlResetLastError();
5401 if (mem_base != xmlMemBlocks()) {
5402 printf("Leak of %d blocks found in xmlSAXDefaultVersion",
5403 xmlMemBlocks() - mem_base);
5404 test_ret++;
5405 printf(" %d", n_version);
5406 printf("\n");
5407 }
5408 }
Daniel Veillarda521d282004-11-09 14:59:59 +00005409#endif
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005410
5411 function_tests++;
5412 return(test_ret);
5413}
5414
5415
5416static int
5417test_xmlSAXVersion(void) {
5418 int test_ret = 0;
5419
5420 int mem_base;
5421 int ret_val;
5422 xmlSAXHandler * hdlr; /* the SAX handler */
5423 int n_hdlr;
5424 int version; /* the version, 1 or 2 */
5425 int n_version;
5426
5427 for (n_hdlr = 0;n_hdlr < gen_nb_xmlSAXHandler_ptr;n_hdlr++) {
5428 for (n_version = 0;n_version < gen_nb_int;n_version++) {
5429 mem_base = xmlMemBlocks();
5430 hdlr = gen_xmlSAXHandler_ptr(n_hdlr, 0);
5431 version = gen_int(n_version, 1);
5432
5433 ret_val = xmlSAXVersion(hdlr, version);
5434 desret_int(ret_val);
5435 call_tests++;
5436 des_xmlSAXHandler_ptr(n_hdlr, hdlr, 0);
5437 des_int(n_version, version, 1);
5438 xmlResetLastError();
5439 if (mem_base != xmlMemBlocks()) {
5440 printf("Leak of %d blocks found in xmlSAXVersion",
5441 xmlMemBlocks() - mem_base);
5442 test_ret++;
5443 printf(" %d", n_hdlr);
5444 printf(" %d", n_version);
5445 printf("\n");
5446 }
5447 }
5448 }
5449
5450 function_tests++;
5451 return(test_ret);
5452}
5453
5454static int
5455test_SAX2(void) {
5456 int test_ret = 0;
5457
5458 printf("Testing SAX2 : 38 of 38 functions ...\n");
5459 test_ret += test_docbDefaultSAXHandlerInit();
5460 test_ret += test_htmlDefaultSAXHandlerInit();
5461 test_ret += test_xmlDefaultSAXHandlerInit();
5462 test_ret += test_xmlSAX2AttributeDecl();
5463 test_ret += test_xmlSAX2CDataBlock();
5464 test_ret += test_xmlSAX2Characters();
5465 test_ret += test_xmlSAX2Comment();
5466 test_ret += test_xmlSAX2ElementDecl();
5467 test_ret += test_xmlSAX2EndDocument();
5468 test_ret += test_xmlSAX2EndElement();
5469 test_ret += test_xmlSAX2EndElementNs();
5470 test_ret += test_xmlSAX2EntityDecl();
5471 test_ret += test_xmlSAX2ExternalSubset();
5472 test_ret += test_xmlSAX2GetColumnNumber();
5473 test_ret += test_xmlSAX2GetEntity();
5474 test_ret += test_xmlSAX2GetLineNumber();
5475 test_ret += test_xmlSAX2GetParameterEntity();
5476 test_ret += test_xmlSAX2GetPublicId();
5477 test_ret += test_xmlSAX2GetSystemId();
5478 test_ret += test_xmlSAX2HasExternalSubset();
5479 test_ret += test_xmlSAX2HasInternalSubset();
5480 test_ret += test_xmlSAX2IgnorableWhitespace();
5481 test_ret += test_xmlSAX2InitDefaultSAXHandler();
5482 test_ret += test_xmlSAX2InitDocbDefaultSAXHandler();
5483 test_ret += test_xmlSAX2InitHtmlDefaultSAXHandler();
5484 test_ret += test_xmlSAX2InternalSubset();
5485 test_ret += test_xmlSAX2IsStandalone();
5486 test_ret += test_xmlSAX2NotationDecl();
5487 test_ret += test_xmlSAX2ProcessingInstruction();
5488 test_ret += test_xmlSAX2Reference();
5489 test_ret += test_xmlSAX2ResolveEntity();
5490 test_ret += test_xmlSAX2SetDocumentLocator();
5491 test_ret += test_xmlSAX2StartDocument();
5492 test_ret += test_xmlSAX2StartElement();
5493 test_ret += test_xmlSAX2StartElementNs();
5494 test_ret += test_xmlSAX2UnparsedEntityDecl();
5495 test_ret += test_xmlSAXDefaultVersion();
5496 test_ret += test_xmlSAXVersion();
5497
5498 if (test_ret != 0)
5499 printf("Module SAX2: %d errors\n", test_ret);
5500 return(test_ret);
5501}
5502
Daniel Veillarda82b1822004-11-08 16:24:57 +00005503static int
5504test_xmlC14NDocDumpMemory(void) {
5505 int test_ret = 0;
5506
5507#ifdef LIBXML_C14N_ENABLED
5508#ifdef LIBXML_OUTPUT_ENABLED
5509 int mem_base;
5510 int ret_val;
5511 xmlDocPtr doc; /* the XML document for canonization */
5512 int n_doc;
5513 xmlNodeSetPtr nodes; /* the nodes set to be included in the canonized image or NULL if all document nodes should be included */
5514 int n_nodes;
5515 int exclusive; /* the exclusive flag (0 - non-exclusive canonicalization; otherwise - exclusive canonicalization) */
5516 int n_exclusive;
5517 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) */
5518 int n_inclusive_ns_prefixes;
5519 int with_comments; /* include comments in the result (!=0) or not (==0) */
5520 int n_with_comments;
5521 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 */
5522 int n_doc_txt_ptr;
5523
5524 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
5525 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
5526 for (n_exclusive = 0;n_exclusive < gen_nb_int;n_exclusive++) {
5527 for (n_inclusive_ns_prefixes = 0;n_inclusive_ns_prefixes < gen_nb_xmlChar_ptr_ptr;n_inclusive_ns_prefixes++) {
5528 for (n_with_comments = 0;n_with_comments < gen_nb_int;n_with_comments++) {
5529 for (n_doc_txt_ptr = 0;n_doc_txt_ptr < gen_nb_xmlChar_ptr_ptr;n_doc_txt_ptr++) {
5530 mem_base = xmlMemBlocks();
5531 doc = gen_xmlDocPtr(n_doc, 0);
5532 nodes = gen_xmlNodeSetPtr(n_nodes, 1);
5533 exclusive = gen_int(n_exclusive, 2);
5534 inclusive_ns_prefixes = gen_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, 3);
5535 with_comments = gen_int(n_with_comments, 4);
5536 doc_txt_ptr = gen_xmlChar_ptr_ptr(n_doc_txt_ptr, 5);
5537
5538 ret_val = xmlC14NDocDumpMemory(doc, nodes, exclusive, inclusive_ns_prefixes, with_comments, doc_txt_ptr);
5539 desret_int(ret_val);
5540 call_tests++;
5541 des_xmlDocPtr(n_doc, doc, 0);
5542 des_xmlNodeSetPtr(n_nodes, nodes, 1);
5543 des_int(n_exclusive, exclusive, 2);
5544 des_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, inclusive_ns_prefixes, 3);
5545 des_int(n_with_comments, with_comments, 4);
5546 des_xmlChar_ptr_ptr(n_doc_txt_ptr, doc_txt_ptr, 5);
5547 xmlResetLastError();
5548 if (mem_base != xmlMemBlocks()) {
5549 printf("Leak of %d blocks found in xmlC14NDocDumpMemory",
5550 xmlMemBlocks() - mem_base);
5551 test_ret++;
5552 printf(" %d", n_doc);
5553 printf(" %d", n_nodes);
5554 printf(" %d", n_exclusive);
5555 printf(" %d", n_inclusive_ns_prefixes);
5556 printf(" %d", n_with_comments);
5557 printf(" %d", n_doc_txt_ptr);
5558 printf("\n");
5559 }
5560 }
5561 }
5562 }
5563 }
5564 }
5565 }
5566#endif
5567#endif
5568
5569 function_tests++;
5570 return(test_ret);
5571}
5572
5573
5574static int
5575test_xmlC14NDocSave(void) {
5576 int test_ret = 0;
5577
5578#ifdef LIBXML_C14N_ENABLED
5579#ifdef LIBXML_OUTPUT_ENABLED
5580 int mem_base;
5581 int ret_val;
5582 xmlDocPtr doc; /* the XML document for canonization */
5583 int n_doc;
5584 xmlNodeSetPtr nodes; /* the nodes set to be included in the canonized image or NULL if all document nodes should be included */
5585 int n_nodes;
5586 int exclusive; /* the exclusive flag (0 - non-exclusive canonicalization; otherwise - exclusive canonicalization) */
5587 int n_exclusive;
5588 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) */
5589 int n_inclusive_ns_prefixes;
5590 int with_comments; /* include comments in the result (!=0) or not (==0) */
5591 int n_with_comments;
5592 const char * filename; /* the filename to store canonical XML image */
5593 int n_filename;
5594 int compression; /* the compression level (zlib requred): -1 - libxml default, 0 - uncompressed, >0 - compression level */
5595 int n_compression;
5596
5597 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
5598 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
5599 for (n_exclusive = 0;n_exclusive < gen_nb_int;n_exclusive++) {
5600 for (n_inclusive_ns_prefixes = 0;n_inclusive_ns_prefixes < gen_nb_xmlChar_ptr_ptr;n_inclusive_ns_prefixes++) {
5601 for (n_with_comments = 0;n_with_comments < gen_nb_int;n_with_comments++) {
5602 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
5603 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
5604 mem_base = xmlMemBlocks();
5605 doc = gen_xmlDocPtr(n_doc, 0);
5606 nodes = gen_xmlNodeSetPtr(n_nodes, 1);
5607 exclusive = gen_int(n_exclusive, 2);
5608 inclusive_ns_prefixes = gen_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, 3);
5609 with_comments = gen_int(n_with_comments, 4);
5610 filename = gen_fileoutput(n_filename, 5);
5611 compression = gen_int(n_compression, 6);
5612
5613 ret_val = xmlC14NDocSave(doc, nodes, exclusive, inclusive_ns_prefixes, with_comments, filename, compression);
5614 desret_int(ret_val);
5615 call_tests++;
5616 des_xmlDocPtr(n_doc, doc, 0);
5617 des_xmlNodeSetPtr(n_nodes, nodes, 1);
5618 des_int(n_exclusive, exclusive, 2);
5619 des_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, inclusive_ns_prefixes, 3);
5620 des_int(n_with_comments, with_comments, 4);
5621 des_fileoutput(n_filename, filename, 5);
5622 des_int(n_compression, compression, 6);
5623 xmlResetLastError();
5624 if (mem_base != xmlMemBlocks()) {
5625 printf("Leak of %d blocks found in xmlC14NDocSave",
5626 xmlMemBlocks() - mem_base);
5627 test_ret++;
5628 printf(" %d", n_doc);
5629 printf(" %d", n_nodes);
5630 printf(" %d", n_exclusive);
5631 printf(" %d", n_inclusive_ns_prefixes);
5632 printf(" %d", n_with_comments);
5633 printf(" %d", n_filename);
5634 printf(" %d", n_compression);
5635 printf("\n");
5636 }
5637 }
5638 }
5639 }
5640 }
5641 }
5642 }
5643 }
5644#endif
5645#endif
5646
5647 function_tests++;
5648 return(test_ret);
5649}
5650
5651
5652static int
5653test_xmlC14NDocSaveTo(void) {
5654 int test_ret = 0;
5655
5656#ifdef LIBXML_C14N_ENABLED
5657#ifdef LIBXML_OUTPUT_ENABLED
5658 int mem_base;
5659 int ret_val;
5660 xmlDocPtr doc; /* the XML document for canonization */
5661 int n_doc;
5662 xmlNodeSetPtr nodes; /* the nodes set to be included in the canonized image or NULL if all document nodes should be included */
5663 int n_nodes;
5664 int exclusive; /* the exclusive flag (0 - non-exclusive canonicalization; otherwise - exclusive canonicalization) */
5665 int n_exclusive;
5666 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) */
5667 int n_inclusive_ns_prefixes;
5668 int with_comments; /* include comments in the result (!=0) or not (==0) */
5669 int n_with_comments;
5670 xmlOutputBufferPtr buf; /* the output buffer to store canonical XML; this buffer MUST have encoder==NULL because C14N requires UTF-8 output */
5671 int n_buf;
5672
5673 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
5674 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
5675 for (n_exclusive = 0;n_exclusive < gen_nb_int;n_exclusive++) {
5676 for (n_inclusive_ns_prefixes = 0;n_inclusive_ns_prefixes < gen_nb_xmlChar_ptr_ptr;n_inclusive_ns_prefixes++) {
5677 for (n_with_comments = 0;n_with_comments < gen_nb_int;n_with_comments++) {
5678 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
5679 mem_base = xmlMemBlocks();
5680 doc = gen_xmlDocPtr(n_doc, 0);
5681 nodes = gen_xmlNodeSetPtr(n_nodes, 1);
5682 exclusive = gen_int(n_exclusive, 2);
5683 inclusive_ns_prefixes = gen_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, 3);
5684 with_comments = gen_int(n_with_comments, 4);
5685 buf = gen_xmlOutputBufferPtr(n_buf, 5);
5686
5687 ret_val = xmlC14NDocSaveTo(doc, nodes, exclusive, inclusive_ns_prefixes, with_comments, buf);
5688 desret_int(ret_val);
5689 call_tests++;
5690 des_xmlDocPtr(n_doc, doc, 0);
5691 des_xmlNodeSetPtr(n_nodes, nodes, 1);
5692 des_int(n_exclusive, exclusive, 2);
5693 des_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, inclusive_ns_prefixes, 3);
5694 des_int(n_with_comments, with_comments, 4);
5695 des_xmlOutputBufferPtr(n_buf, buf, 5);
5696 xmlResetLastError();
5697 if (mem_base != xmlMemBlocks()) {
5698 printf("Leak of %d blocks found in xmlC14NDocSaveTo",
5699 xmlMemBlocks() - mem_base);
5700 test_ret++;
5701 printf(" %d", n_doc);
5702 printf(" %d", n_nodes);
5703 printf(" %d", n_exclusive);
5704 printf(" %d", n_inclusive_ns_prefixes);
5705 printf(" %d", n_with_comments);
5706 printf(" %d", n_buf);
5707 printf("\n");
5708 }
5709 }
5710 }
5711 }
5712 }
5713 }
5714 }
5715#endif
5716#endif
5717
5718 function_tests++;
5719 return(test_ret);
5720}
5721
5722
5723static int
5724test_xmlC14NExecute(void) {
5725 int test_ret = 0;
5726
5727
5728 /* missing type support */
5729 return(test_ret);
5730}
5731
5732static int
5733test_c14n(void) {
5734 int test_ret = 0;
5735
5736 printf("Testing c14n : 3 of 4 functions ...\n");
5737 test_ret += test_xmlC14NDocDumpMemory();
5738 test_ret += test_xmlC14NDocSave();
5739 test_ret += test_xmlC14NDocSaveTo();
5740 test_ret += test_xmlC14NExecute();
5741
5742 if (test_ret != 0)
5743 printf("Module c14n: %d errors\n", test_ret);
5744 return(test_ret);
5745}
Daniel Veillarda521d282004-11-09 14:59:59 +00005746#ifdef LIBXML_CATALOG_ENABLED
Daniel Veillarda82b1822004-11-08 16:24:57 +00005747
Daniel Veillardce682bc2004-11-05 17:22:25 +00005748#define gen_nb_xmlCatalogPtr 1
5749static xmlCatalogPtr gen_xmlCatalogPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
5750 return(NULL);
5751}
5752static void des_xmlCatalogPtr(int no ATTRIBUTE_UNUSED, xmlCatalogPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
5753}
Daniel Veillarda521d282004-11-09 14:59:59 +00005754#endif
5755
Daniel Veillardce682bc2004-11-05 17:22:25 +00005756
Daniel Veillardd93f6252004-11-02 15:53:51 +00005757static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00005758test_xmlACatalogAdd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005759 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005760
Daniel Veillardce682bc2004-11-05 17:22:25 +00005761#ifdef LIBXML_CATALOG_ENABLED
5762 int mem_base;
5763 int ret_val;
5764 xmlCatalogPtr catal; /* a Catalog */
5765 int n_catal;
5766 xmlChar * type; /* the type of record to add to the catalog */
5767 int n_type;
5768 xmlChar * orig; /* the system, public or prefix to match */
5769 int n_orig;
5770 xmlChar * replace; /* the replacement value for the match */
5771 int n_replace;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005772
Daniel Veillardce682bc2004-11-05 17:22:25 +00005773 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5774 for (n_type = 0;n_type < gen_nb_const_xmlChar_ptr;n_type++) {
5775 for (n_orig = 0;n_orig < gen_nb_const_xmlChar_ptr;n_orig++) {
5776 for (n_replace = 0;n_replace < gen_nb_const_xmlChar_ptr;n_replace++) {
5777 mem_base = xmlMemBlocks();
5778 catal = gen_xmlCatalogPtr(n_catal, 0);
5779 type = gen_const_xmlChar_ptr(n_type, 1);
5780 orig = gen_const_xmlChar_ptr(n_orig, 2);
5781 replace = gen_const_xmlChar_ptr(n_replace, 3);
5782
5783 ret_val = xmlACatalogAdd(catal, type, orig, replace);
5784 desret_int(ret_val);
5785 call_tests++;
5786 des_xmlCatalogPtr(n_catal, catal, 0);
5787 des_const_xmlChar_ptr(n_type, type, 1);
5788 des_const_xmlChar_ptr(n_orig, orig, 2);
5789 des_const_xmlChar_ptr(n_replace, replace, 3);
5790 xmlResetLastError();
5791 if (mem_base != xmlMemBlocks()) {
5792 printf("Leak of %d blocks found in xmlACatalogAdd",
5793 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005794 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005795 printf(" %d", n_catal);
5796 printf(" %d", n_type);
5797 printf(" %d", n_orig);
5798 printf(" %d", n_replace);
5799 printf("\n");
5800 }
5801 }
5802 }
5803 }
5804 }
5805#endif
5806
5807 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00005808 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005809}
5810
5811
5812static int
5813test_xmlACatalogDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005814 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005815
Daniel Veillardce682bc2004-11-05 17:22:25 +00005816#ifdef LIBXML_CATALOG_ENABLED
5817#ifdef LIBXML_OUTPUT_ENABLED
5818 int mem_base;
5819 xmlCatalogPtr catal; /* a Catalog */
5820 int n_catal;
5821 FILE * out; /* the file. */
5822 int n_out;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005823
Daniel Veillardce682bc2004-11-05 17:22:25 +00005824 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5825 for (n_out = 0;n_out < gen_nb_FILE_ptr;n_out++) {
5826 mem_base = xmlMemBlocks();
5827 catal = gen_xmlCatalogPtr(n_catal, 0);
5828 out = gen_FILE_ptr(n_out, 1);
5829
5830 xmlACatalogDump(catal, out);
5831 call_tests++;
5832 des_xmlCatalogPtr(n_catal, catal, 0);
5833 des_FILE_ptr(n_out, out, 1);
5834 xmlResetLastError();
5835 if (mem_base != xmlMemBlocks()) {
5836 printf("Leak of %d blocks found in xmlACatalogDump",
5837 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005838 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005839 printf(" %d", n_catal);
5840 printf(" %d", n_out);
5841 printf("\n");
5842 }
5843 }
5844 }
5845#endif
5846#endif
5847
5848 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00005849 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005850}
5851
5852
5853static int
5854test_xmlACatalogRemove(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005855 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005856
Daniel Veillardce682bc2004-11-05 17:22:25 +00005857#ifdef LIBXML_CATALOG_ENABLED
5858 int mem_base;
5859 int ret_val;
5860 xmlCatalogPtr catal; /* a Catalog */
5861 int n_catal;
5862 xmlChar * value; /* the value to remove */
5863 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005864
Daniel Veillardce682bc2004-11-05 17:22:25 +00005865 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5866 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
5867 mem_base = xmlMemBlocks();
5868 catal = gen_xmlCatalogPtr(n_catal, 0);
5869 value = gen_const_xmlChar_ptr(n_value, 1);
5870
5871 ret_val = xmlACatalogRemove(catal, value);
5872 desret_int(ret_val);
5873 call_tests++;
5874 des_xmlCatalogPtr(n_catal, catal, 0);
5875 des_const_xmlChar_ptr(n_value, value, 1);
5876 xmlResetLastError();
5877 if (mem_base != xmlMemBlocks()) {
5878 printf("Leak of %d blocks found in xmlACatalogRemove",
5879 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005880 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005881 printf(" %d", n_catal);
5882 printf(" %d", n_value);
5883 printf("\n");
5884 }
5885 }
5886 }
5887#endif
5888
5889 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00005890 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005891}
5892
5893
5894static int
5895test_xmlACatalogResolve(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005896 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005897
Daniel Veillardce682bc2004-11-05 17:22:25 +00005898#ifdef LIBXML_CATALOG_ENABLED
5899 int mem_base;
5900 xmlChar * ret_val;
5901 xmlCatalogPtr catal; /* a Catalog */
5902 int n_catal;
5903 xmlChar * pubID; /* the public ID string */
5904 int n_pubID;
5905 xmlChar * sysID; /* the system ID string */
5906 int n_sysID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005907
Daniel Veillardce682bc2004-11-05 17:22:25 +00005908 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5909 for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) {
5910 for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) {
5911 mem_base = xmlMemBlocks();
5912 catal = gen_xmlCatalogPtr(n_catal, 0);
5913 pubID = gen_const_xmlChar_ptr(n_pubID, 1);
5914 sysID = gen_const_xmlChar_ptr(n_sysID, 2);
5915
5916 ret_val = xmlACatalogResolve(catal, pubID, sysID);
5917 desret_xmlChar_ptr(ret_val);
5918 call_tests++;
5919 des_xmlCatalogPtr(n_catal, catal, 0);
5920 des_const_xmlChar_ptr(n_pubID, pubID, 1);
5921 des_const_xmlChar_ptr(n_sysID, sysID, 2);
5922 xmlResetLastError();
5923 if (mem_base != xmlMemBlocks()) {
5924 printf("Leak of %d blocks found in xmlACatalogResolve",
5925 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005926 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005927 printf(" %d", n_catal);
5928 printf(" %d", n_pubID);
5929 printf(" %d", n_sysID);
5930 printf("\n");
5931 }
5932 }
5933 }
5934 }
5935#endif
5936
5937 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00005938 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005939}
5940
5941
5942static int
5943test_xmlACatalogResolvePublic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005944 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005945
Daniel Veillardce682bc2004-11-05 17:22:25 +00005946#ifdef LIBXML_CATALOG_ENABLED
5947 int mem_base;
5948 xmlChar * ret_val;
5949 xmlCatalogPtr catal; /* a Catalog */
5950 int n_catal;
5951 xmlChar * pubID; /* the public ID string */
5952 int n_pubID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005953
Daniel Veillardce682bc2004-11-05 17:22:25 +00005954 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5955 for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) {
5956 mem_base = xmlMemBlocks();
5957 catal = gen_xmlCatalogPtr(n_catal, 0);
5958 pubID = gen_const_xmlChar_ptr(n_pubID, 1);
5959
5960 ret_val = xmlACatalogResolvePublic(catal, pubID);
5961 desret_xmlChar_ptr(ret_val);
5962 call_tests++;
5963 des_xmlCatalogPtr(n_catal, catal, 0);
5964 des_const_xmlChar_ptr(n_pubID, pubID, 1);
5965 xmlResetLastError();
5966 if (mem_base != xmlMemBlocks()) {
5967 printf("Leak of %d blocks found in xmlACatalogResolvePublic",
5968 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005969 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005970 printf(" %d", n_catal);
5971 printf(" %d", n_pubID);
5972 printf("\n");
5973 }
5974 }
5975 }
5976#endif
5977
5978 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00005979 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005980}
5981
5982
5983static int
5984test_xmlACatalogResolveSystem(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005985 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005986
Daniel Veillardce682bc2004-11-05 17:22:25 +00005987#ifdef LIBXML_CATALOG_ENABLED
5988 int mem_base;
5989 xmlChar * ret_val;
5990 xmlCatalogPtr catal; /* a Catalog */
5991 int n_catal;
5992 xmlChar * sysID; /* the system ID string */
5993 int n_sysID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005994
Daniel Veillardce682bc2004-11-05 17:22:25 +00005995 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5996 for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) {
5997 mem_base = xmlMemBlocks();
5998 catal = gen_xmlCatalogPtr(n_catal, 0);
5999 sysID = gen_const_xmlChar_ptr(n_sysID, 1);
6000
6001 ret_val = xmlACatalogResolveSystem(catal, sysID);
6002 desret_xmlChar_ptr(ret_val);
6003 call_tests++;
6004 des_xmlCatalogPtr(n_catal, catal, 0);
6005 des_const_xmlChar_ptr(n_sysID, sysID, 1);
6006 xmlResetLastError();
6007 if (mem_base != xmlMemBlocks()) {
6008 printf("Leak of %d blocks found in xmlACatalogResolveSystem",
6009 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006010 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006011 printf(" %d", n_catal);
6012 printf(" %d", n_sysID);
6013 printf("\n");
6014 }
6015 }
6016 }
6017#endif
6018
6019 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00006020 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006021}
6022
6023
6024static int
6025test_xmlACatalogResolveURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006026 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006027
Daniel Veillardce682bc2004-11-05 17:22:25 +00006028#ifdef LIBXML_CATALOG_ENABLED
6029 int mem_base;
6030 xmlChar * ret_val;
6031 xmlCatalogPtr catal; /* a Catalog */
6032 int n_catal;
6033 xmlChar * URI; /* the URI */
6034 int n_URI;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006035
Daniel Veillardce682bc2004-11-05 17:22:25 +00006036 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
6037 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
6038 mem_base = xmlMemBlocks();
6039 catal = gen_xmlCatalogPtr(n_catal, 0);
6040 URI = gen_const_xmlChar_ptr(n_URI, 1);
6041
6042 ret_val = xmlACatalogResolveURI(catal, URI);
6043 desret_xmlChar_ptr(ret_val);
6044 call_tests++;
6045 des_xmlCatalogPtr(n_catal, catal, 0);
6046 des_const_xmlChar_ptr(n_URI, URI, 1);
6047 xmlResetLastError();
6048 if (mem_base != xmlMemBlocks()) {
6049 printf("Leak of %d blocks found in xmlACatalogResolveURI",
6050 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006051 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006052 printf(" %d", n_catal);
6053 printf(" %d", n_URI);
6054 printf("\n");
6055 }
6056 }
6057 }
6058#endif
6059
6060 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00006061 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006062}
6063
6064
6065static int
6066test_xmlCatalogAdd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006067 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006068
6069#ifdef LIBXML_CATALOG_ENABLED
6070 int mem_base;
6071 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006072 xmlChar * type; /* the type of record to add to the catalog */
Daniel Veillardd93f6252004-11-02 15:53:51 +00006073 int n_type;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006074 xmlChar * orig; /* the system, public or prefix to match */
Daniel Veillardd93f6252004-11-02 15:53:51 +00006075 int n_orig;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006076 xmlChar * replace; /* the replacement value for the match */
Daniel Veillardd93f6252004-11-02 15:53:51 +00006077 int n_replace;
6078
6079 for (n_type = 0;n_type < gen_nb_const_xmlChar_ptr;n_type++) {
6080 for (n_orig = 0;n_orig < gen_nb_const_xmlChar_ptr;n_orig++) {
6081 for (n_replace = 0;n_replace < gen_nb_const_xmlChar_ptr;n_replace++) {
6082 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00006083 type = gen_const_xmlChar_ptr(n_type, 0);
6084 orig = gen_const_xmlChar_ptr(n_orig, 1);
6085 replace = gen_const_xmlChar_ptr(n_replace, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006086
6087 ret_val = xmlCatalogAdd(type, orig, replace);
6088 desret_int(ret_val);
6089 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006090 des_const_xmlChar_ptr(n_type, type, 0);
6091 des_const_xmlChar_ptr(n_orig, orig, 1);
6092 des_const_xmlChar_ptr(n_replace, replace, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006093 xmlResetLastError();
6094 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00006095 printf("Leak of %d blocks found in xmlCatalogAdd",
Daniel Veillardd93f6252004-11-02 15:53:51 +00006096 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006097 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00006098 printf(" %d", n_type);
6099 printf(" %d", n_orig);
6100 printf(" %d", n_replace);
6101 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00006102 }
6103 }
6104 }
6105 }
6106#endif
6107
Daniel Veillard3d97e662004-11-04 10:49:00 +00006108 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00006109 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006110}
6111
6112
6113static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00006114test_xmlCatalogCleanup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006115 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006116
6117#ifdef LIBXML_CATALOG_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +00006118
Daniel Veillardd93f6252004-11-02 15:53:51 +00006119
6120 xmlCatalogCleanup();
6121 call_tests++;
6122 xmlResetLastError();
Daniel Veillardd93f6252004-11-02 15:53:51 +00006123#endif
6124
Daniel Veillard3d97e662004-11-04 10:49:00 +00006125 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00006126 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006127}
6128
6129
6130static int
6131test_xmlCatalogConvert(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006132 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006133
6134#ifdef LIBXML_CATALOG_ENABLED
6135 int ret_val;
6136
6137
6138 ret_val = xmlCatalogConvert();
6139 desret_int(ret_val);
6140 call_tests++;
6141 xmlResetLastError();
6142#endif
6143
Daniel Veillard3d97e662004-11-04 10:49:00 +00006144 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00006145 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006146}
6147
6148
6149static int
6150test_xmlCatalogDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006151 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006152
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00006153#ifdef LIBXML_CATALOG_ENABLED
6154#ifdef LIBXML_OUTPUT_ENABLED
6155 int mem_base;
6156 FILE * out; /* the file. */
6157 int n_out;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006158
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00006159 for (n_out = 0;n_out < gen_nb_FILE_ptr;n_out++) {
6160 mem_base = xmlMemBlocks();
6161 out = gen_FILE_ptr(n_out, 0);
6162
6163 xmlCatalogDump(out);
6164 call_tests++;
6165 des_FILE_ptr(n_out, out, 0);
6166 xmlResetLastError();
6167 if (mem_base != xmlMemBlocks()) {
6168 printf("Leak of %d blocks found in xmlCatalogDump",
6169 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006170 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00006171 printf(" %d", n_out);
6172 printf("\n");
6173 }
6174 }
6175#endif
6176#endif
6177
6178 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00006179 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006180}
6181
6182
6183static int
6184test_xmlCatalogGetDefaults(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006185 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006186
Daniel Veillard57b25162004-11-06 14:50:18 +00006187#ifdef LIBXML_CATALOG_ENABLED
6188 int mem_base;
6189 xmlCatalogAllow ret_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006190
Daniel Veillard57b25162004-11-06 14:50:18 +00006191 mem_base = xmlMemBlocks();
6192
6193 ret_val = xmlCatalogGetDefaults();
6194 desret_xmlCatalogAllow(ret_val);
6195 call_tests++;
6196 xmlResetLastError();
6197 if (mem_base != xmlMemBlocks()) {
6198 printf("Leak of %d blocks found in xmlCatalogGetDefaults",
6199 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006200 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +00006201 printf("\n");
6202 }
6203#endif
6204
6205 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00006206 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006207}
6208
6209
6210static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00006211test_xmlCatalogIsEmpty(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006212 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006213
Daniel Veillardce682bc2004-11-05 17:22:25 +00006214#ifdef LIBXML_CATALOG_ENABLED
6215 int mem_base;
6216 int ret_val;
6217 xmlCatalogPtr catal; /* should this create an SGML catalog */
6218 int n_catal;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006219
Daniel Veillardce682bc2004-11-05 17:22:25 +00006220 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
6221 mem_base = xmlMemBlocks();
6222 catal = gen_xmlCatalogPtr(n_catal, 0);
6223
6224 ret_val = xmlCatalogIsEmpty(catal);
6225 desret_int(ret_val);
6226 call_tests++;
6227 des_xmlCatalogPtr(n_catal, catal, 0);
6228 xmlResetLastError();
6229 if (mem_base != xmlMemBlocks()) {
6230 printf("Leak of %d blocks found in xmlCatalogIsEmpty",
6231 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006232 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006233 printf(" %d", n_catal);
6234 printf("\n");
6235 }
6236 }
6237#endif
6238
6239 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00006240 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006241}
6242
6243
6244static int
6245test_xmlCatalogLocalResolve(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006246 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006247
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006248#ifdef LIBXML_CATALOG_ENABLED
6249 int mem_base;
6250 xmlChar * ret_val;
6251 void * catalogs; /* a document's list of catalogs */
6252 int n_catalogs;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006253 xmlChar * pubID; /* the public ID string */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006254 int n_pubID;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006255 xmlChar * sysID; /* the system ID string */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006256 int n_sysID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006257
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006258 for (n_catalogs = 0;n_catalogs < gen_nb_void_ptr;n_catalogs++) {
6259 for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) {
6260 for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) {
6261 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00006262 catalogs = gen_void_ptr(n_catalogs, 0);
6263 pubID = gen_const_xmlChar_ptr(n_pubID, 1);
6264 sysID = gen_const_xmlChar_ptr(n_sysID, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006265
6266 ret_val = xmlCatalogLocalResolve(catalogs, pubID, sysID);
6267 desret_xmlChar_ptr(ret_val);
6268 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006269 des_void_ptr(n_catalogs, catalogs, 0);
6270 des_const_xmlChar_ptr(n_pubID, pubID, 1);
6271 des_const_xmlChar_ptr(n_sysID, sysID, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006272 xmlResetLastError();
6273 if (mem_base != xmlMemBlocks()) {
6274 printf("Leak of %d blocks found in xmlCatalogLocalResolve",
6275 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006276 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006277 printf(" %d", n_catalogs);
6278 printf(" %d", n_pubID);
6279 printf(" %d", n_sysID);
6280 printf("\n");
6281 }
6282 }
6283 }
6284 }
6285#endif
6286
Daniel Veillard3d97e662004-11-04 10:49:00 +00006287 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00006288 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006289}
6290
6291
6292static int
6293test_xmlCatalogLocalResolveURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006294 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006295
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006296#ifdef LIBXML_CATALOG_ENABLED
6297 int mem_base;
6298 xmlChar * ret_val;
6299 void * catalogs; /* a document's list of catalogs */
6300 int n_catalogs;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006301 xmlChar * URI; /* the URI */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006302 int n_URI;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006303
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006304 for (n_catalogs = 0;n_catalogs < gen_nb_void_ptr;n_catalogs++) {
6305 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
6306 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00006307 catalogs = gen_void_ptr(n_catalogs, 0);
6308 URI = gen_const_xmlChar_ptr(n_URI, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006309
6310 ret_val = xmlCatalogLocalResolveURI(catalogs, URI);
6311 desret_xmlChar_ptr(ret_val);
6312 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006313 des_void_ptr(n_catalogs, catalogs, 0);
6314 des_const_xmlChar_ptr(n_URI, URI, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006315 xmlResetLastError();
6316 if (mem_base != xmlMemBlocks()) {
6317 printf("Leak of %d blocks found in xmlCatalogLocalResolveURI",
6318 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006319 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006320 printf(" %d", n_catalogs);
6321 printf(" %d", n_URI);
6322 printf("\n");
6323 }
6324 }
6325 }
6326#endif
6327
Daniel Veillard3d97e662004-11-04 10:49:00 +00006328 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00006329 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006330}
6331
6332
6333static int
6334test_xmlCatalogRemove(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006335 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006336
6337#ifdef LIBXML_CATALOG_ENABLED
6338 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006339 xmlChar * value; /* the value to remove */
Daniel Veillardd93f6252004-11-02 15:53:51 +00006340 int n_value;
6341
6342 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +00006343 value = gen_const_xmlChar_ptr(n_value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006344
6345 ret_val = xmlCatalogRemove(value);
6346 desret_int(ret_val);
6347 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006348 des_const_xmlChar_ptr(n_value, value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006349 xmlResetLastError();
6350 }
6351#endif
6352
Daniel Veillard3d97e662004-11-04 10:49:00 +00006353 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00006354 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006355}
6356
6357
6358static int
6359test_xmlCatalogResolve(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006360 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006361
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006362#ifdef LIBXML_CATALOG_ENABLED
6363 int mem_base;
6364 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006365 xmlChar * pubID; /* the public ID string */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006366 int n_pubID;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006367 xmlChar * sysID; /* the system ID string */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006368 int n_sysID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006369
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006370 for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) {
6371 for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) {
6372 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00006373 pubID = gen_const_xmlChar_ptr(n_pubID, 0);
6374 sysID = gen_const_xmlChar_ptr(n_sysID, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006375
6376 ret_val = xmlCatalogResolve(pubID, sysID);
6377 desret_xmlChar_ptr(ret_val);
6378 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006379 des_const_xmlChar_ptr(n_pubID, pubID, 0);
6380 des_const_xmlChar_ptr(n_sysID, sysID, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006381 xmlResetLastError();
6382 if (mem_base != xmlMemBlocks()) {
6383 printf("Leak of %d blocks found in xmlCatalogResolve",
6384 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006385 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006386 printf(" %d", n_pubID);
6387 printf(" %d", n_sysID);
6388 printf("\n");
6389 }
6390 }
6391 }
6392#endif
6393
Daniel Veillard3d97e662004-11-04 10:49:00 +00006394 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00006395 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006396}
6397
6398
6399static int
6400test_xmlCatalogResolvePublic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006401 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006402
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006403#ifdef LIBXML_CATALOG_ENABLED
6404 int mem_base;
6405 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006406 xmlChar * pubID; /* the public ID string */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006407 int n_pubID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006408
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006409 for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) {
6410 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00006411 pubID = gen_const_xmlChar_ptr(n_pubID, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006412
6413 ret_val = xmlCatalogResolvePublic(pubID);
6414 desret_xmlChar_ptr(ret_val);
6415 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006416 des_const_xmlChar_ptr(n_pubID, pubID, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006417 xmlResetLastError();
6418 if (mem_base != xmlMemBlocks()) {
6419 printf("Leak of %d blocks found in xmlCatalogResolvePublic",
6420 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006421 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006422 printf(" %d", n_pubID);
6423 printf("\n");
6424 }
6425 }
6426#endif
6427
Daniel Veillard3d97e662004-11-04 10:49:00 +00006428 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00006429 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006430}
6431
6432
6433static int
6434test_xmlCatalogResolveSystem(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006435 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006436
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006437#ifdef LIBXML_CATALOG_ENABLED
6438 int mem_base;
6439 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006440 xmlChar * sysID; /* the system ID string */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006441 int n_sysID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006442
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006443 for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) {
6444 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00006445 sysID = gen_const_xmlChar_ptr(n_sysID, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006446
6447 ret_val = xmlCatalogResolveSystem(sysID);
6448 desret_xmlChar_ptr(ret_val);
6449 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006450 des_const_xmlChar_ptr(n_sysID, sysID, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006451 xmlResetLastError();
6452 if (mem_base != xmlMemBlocks()) {
6453 printf("Leak of %d blocks found in xmlCatalogResolveSystem",
6454 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006455 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006456 printf(" %d", n_sysID);
6457 printf("\n");
6458 }
6459 }
6460#endif
6461
Daniel Veillard3d97e662004-11-04 10:49:00 +00006462 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00006463 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006464}
6465
6466
6467static int
6468test_xmlCatalogResolveURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006469 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006470
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006471#ifdef LIBXML_CATALOG_ENABLED
6472 int mem_base;
6473 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006474 xmlChar * URI; /* the URI */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006475 int n_URI;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006476
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006477 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
6478 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00006479 URI = gen_const_xmlChar_ptr(n_URI, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006480
6481 ret_val = xmlCatalogResolveURI(URI);
6482 desret_xmlChar_ptr(ret_val);
6483 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006484 des_const_xmlChar_ptr(n_URI, URI, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006485 xmlResetLastError();
6486 if (mem_base != xmlMemBlocks()) {
6487 printf("Leak of %d blocks found in xmlCatalogResolveURI",
6488 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006489 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006490 printf(" %d", n_URI);
6491 printf("\n");
6492 }
6493 }
6494#endif
6495
Daniel Veillard3d97e662004-11-04 10:49:00 +00006496 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00006497 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006498}
6499
6500
6501static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00006502test_xmlCatalogSetDefaultPrefer(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006503 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006504
Daniel Veillard57b25162004-11-06 14:50:18 +00006505#ifdef LIBXML_CATALOG_ENABLED
6506 int mem_base;
6507 xmlCatalogPrefer ret_val;
6508 xmlCatalogPrefer prefer; /* the default preference for delegation */
6509 int n_prefer;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006510
Daniel Veillard57b25162004-11-06 14:50:18 +00006511 for (n_prefer = 0;n_prefer < gen_nb_xmlCatalogPrefer;n_prefer++) {
6512 mem_base = xmlMemBlocks();
6513 prefer = gen_xmlCatalogPrefer(n_prefer, 0);
6514
6515 ret_val = xmlCatalogSetDefaultPrefer(prefer);
6516 desret_xmlCatalogPrefer(ret_val);
6517 call_tests++;
6518 des_xmlCatalogPrefer(n_prefer, prefer, 0);
6519 xmlResetLastError();
6520 if (mem_base != xmlMemBlocks()) {
6521 printf("Leak of %d blocks found in xmlCatalogSetDefaultPrefer",
6522 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006523 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +00006524 printf(" %d", n_prefer);
6525 printf("\n");
6526 }
6527 }
6528#endif
6529
6530 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00006531 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006532}
6533
6534
6535static int
6536test_xmlCatalogSetDefaults(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006537 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006538
Daniel Veillard57b25162004-11-06 14:50:18 +00006539#ifdef LIBXML_CATALOG_ENABLED
6540 int mem_base;
6541 xmlCatalogAllow allow; /* what catalogs should be accepted */
6542 int n_allow;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006543
Daniel Veillard57b25162004-11-06 14:50:18 +00006544 for (n_allow = 0;n_allow < gen_nb_xmlCatalogAllow;n_allow++) {
6545 mem_base = xmlMemBlocks();
6546 allow = gen_xmlCatalogAllow(n_allow, 0);
6547
6548 xmlCatalogSetDefaults(allow);
6549 call_tests++;
6550 des_xmlCatalogAllow(n_allow, allow, 0);
6551 xmlResetLastError();
6552 if (mem_base != xmlMemBlocks()) {
6553 printf("Leak of %d blocks found in xmlCatalogSetDefaults",
6554 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006555 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +00006556 printf(" %d", n_allow);
6557 printf("\n");
6558 }
6559 }
6560#endif
6561
6562 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00006563 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006564}
6565
6566
6567static int
6568test_xmlConvertSGMLCatalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006569 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006570
Daniel Veillardce682bc2004-11-05 17:22:25 +00006571#ifdef LIBXML_CATALOG_ENABLED
6572 int mem_base;
6573 int ret_val;
6574 xmlCatalogPtr catal; /* the catalog */
6575 int n_catal;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006576
Daniel Veillardce682bc2004-11-05 17:22:25 +00006577 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
6578 mem_base = xmlMemBlocks();
6579 catal = gen_xmlCatalogPtr(n_catal, 0);
6580
6581 ret_val = xmlConvertSGMLCatalog(catal);
6582 desret_int(ret_val);
6583 call_tests++;
6584 des_xmlCatalogPtr(n_catal, catal, 0);
6585 xmlResetLastError();
6586 if (mem_base != xmlMemBlocks()) {
6587 printf("Leak of %d blocks found in xmlConvertSGMLCatalog",
6588 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006589 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006590 printf(" %d", n_catal);
6591 printf("\n");
6592 }
6593 }
6594#endif
6595
6596 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00006597 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006598}
6599
6600
6601static int
6602test_xmlInitializeCatalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006603 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006604
6605#ifdef LIBXML_CATALOG_ENABLED
6606 int mem_base;
6607
6608 mem_base = xmlMemBlocks();
6609
6610 xmlInitializeCatalog();
6611 call_tests++;
6612 xmlResetLastError();
6613 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00006614 printf("Leak of %d blocks found in xmlInitializeCatalog",
Daniel Veillardd93f6252004-11-02 15:53:51 +00006615 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006616 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00006617 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00006618 }
6619#endif
6620
Daniel Veillard3d97e662004-11-04 10:49:00 +00006621 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00006622 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006623}
6624
6625
6626static int
6627test_xmlLoadACatalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006628 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006629
6630
6631 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00006632 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006633}
6634
6635
6636static int
6637test_xmlLoadCatalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006638 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006639
6640#ifdef LIBXML_CATALOG_ENABLED
6641 int ret_val;
6642 const char * filename; /* a file path */
6643 int n_filename;
6644
6645 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +00006646 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006647
6648 ret_val = xmlLoadCatalog(filename);
6649 desret_int(ret_val);
6650 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006651 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006652 xmlResetLastError();
6653 }
6654#endif
6655
Daniel Veillard3d97e662004-11-04 10:49:00 +00006656 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00006657 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006658}
6659
6660
6661static int
6662test_xmlLoadCatalogs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006663 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006664
6665#ifdef LIBXML_CATALOG_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +00006666 char * pathss; /* a list of directories separated by a colon or a space. */
Daniel Veillardd93f6252004-11-02 15:53:51 +00006667 int n_pathss;
6668
6669 for (n_pathss = 0;n_pathss < gen_nb_const_char_ptr;n_pathss++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +00006670 pathss = gen_const_char_ptr(n_pathss, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006671
6672 xmlLoadCatalogs(pathss);
6673 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006674 des_const_char_ptr(n_pathss, pathss, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006675 xmlResetLastError();
6676 }
6677#endif
6678
Daniel Veillard3d97e662004-11-04 10:49:00 +00006679 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00006680 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006681}
6682
6683
6684static int
6685test_xmlLoadSGMLSuperCatalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006686 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006687
6688
6689 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00006690 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006691}
6692
6693
6694static int
6695test_xmlNewCatalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006696 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006697
6698
6699 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00006700 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006701}
6702
6703
6704static int
6705test_xmlParseCatalogFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006706 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006707
6708#ifdef LIBXML_CATALOG_ENABLED
6709 int mem_base;
6710 xmlDocPtr ret_val;
6711 const char * filename; /* the filename */
6712 int n_filename;
6713
6714 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
6715 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00006716 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006717
6718 ret_val = xmlParseCatalogFile(filename);
6719 desret_xmlDocPtr(ret_val);
6720 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006721 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006722 xmlResetLastError();
6723 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00006724 printf("Leak of %d blocks found in xmlParseCatalogFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +00006725 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006726 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00006727 printf(" %d", n_filename);
6728 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00006729 }
6730 }
6731#endif
6732
Daniel Veillard3d97e662004-11-04 10:49:00 +00006733 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00006734 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006735}
6736
6737static int
6738test_catalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006739 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006740
Daniel Veillardc2c894f2004-11-07 12:17:35 +00006741 printf("Testing catalog : 27 of 36 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00006742 test_ret += test_xmlACatalogAdd();
6743 test_ret += test_xmlACatalogDump();
6744 test_ret += test_xmlACatalogRemove();
6745 test_ret += test_xmlACatalogResolve();
6746 test_ret += test_xmlACatalogResolvePublic();
6747 test_ret += test_xmlACatalogResolveSystem();
6748 test_ret += test_xmlACatalogResolveURI();
6749 test_ret += test_xmlCatalogAdd();
6750 test_ret += test_xmlCatalogCleanup();
6751 test_ret += test_xmlCatalogConvert();
6752 test_ret += test_xmlCatalogDump();
6753 test_ret += test_xmlCatalogGetDefaults();
6754 test_ret += test_xmlCatalogIsEmpty();
6755 test_ret += test_xmlCatalogLocalResolve();
6756 test_ret += test_xmlCatalogLocalResolveURI();
6757 test_ret += test_xmlCatalogRemove();
6758 test_ret += test_xmlCatalogResolve();
6759 test_ret += test_xmlCatalogResolvePublic();
6760 test_ret += test_xmlCatalogResolveSystem();
6761 test_ret += test_xmlCatalogResolveURI();
6762 test_ret += test_xmlCatalogSetDefaultPrefer();
6763 test_ret += test_xmlCatalogSetDefaults();
6764 test_ret += test_xmlConvertSGMLCatalog();
6765 test_ret += test_xmlInitializeCatalog();
6766 test_ret += test_xmlLoadACatalog();
6767 test_ret += test_xmlLoadCatalog();
6768 test_ret += test_xmlLoadCatalogs();
6769 test_ret += test_xmlLoadSGMLSuperCatalog();
6770 test_ret += test_xmlNewCatalog();
6771 test_ret += test_xmlParseCatalogFile();
Daniel Veillardd93f6252004-11-02 15:53:51 +00006772
Daniel Veillard42595322004-11-08 10:52:06 +00006773 if (test_ret != 0)
6774 printf("Module catalog: %d errors\n", test_ret);
6775 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006776}
6777
Daniel Veillardce682bc2004-11-05 17:22:25 +00006778#define gen_nb_const_xmlChRangeGroupPtr 1
6779static xmlChRangeGroupPtr gen_const_xmlChRangeGroupPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
6780 return(NULL);
6781}
6782static void des_const_xmlChRangeGroupPtr(int no ATTRIBUTE_UNUSED, const xmlChRangeGroupPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
6783}
6784
Daniel Veillardd93f6252004-11-02 15:53:51 +00006785static int
6786test_xmlCharInRange(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006787 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006788
Daniel Veillardce682bc2004-11-05 17:22:25 +00006789 int mem_base;
6790 int ret_val;
6791 unsigned int val; /* character to be validated */
6792 int n_val;
6793 xmlChRangeGroupPtr rptr; /* pointer to range to be used to validate */
6794 int n_rptr;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006795
Daniel Veillardce682bc2004-11-05 17:22:25 +00006796 for (n_val = 0;n_val < gen_nb_unsigned_int;n_val++) {
6797 for (n_rptr = 0;n_rptr < gen_nb_const_xmlChRangeGroupPtr;n_rptr++) {
6798 mem_base = xmlMemBlocks();
6799 val = gen_unsigned_int(n_val, 0);
6800 rptr = gen_const_xmlChRangeGroupPtr(n_rptr, 1);
6801
6802 ret_val = xmlCharInRange(val, rptr);
6803 desret_int(ret_val);
6804 call_tests++;
6805 des_unsigned_int(n_val, val, 0);
6806 des_const_xmlChRangeGroupPtr(n_rptr, rptr, 1);
6807 xmlResetLastError();
6808 if (mem_base != xmlMemBlocks()) {
6809 printf("Leak of %d blocks found in xmlCharInRange",
6810 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006811 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006812 printf(" %d", n_val);
6813 printf(" %d", n_rptr);
6814 printf("\n");
6815 }
6816 }
6817 }
6818
6819 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00006820 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006821}
6822
6823
6824static int
6825test_xmlIsBaseChar(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006826 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006827
Daniel Veillard3d97e662004-11-04 10:49:00 +00006828 int mem_base;
6829 int ret_val;
6830 unsigned int ch; /* character to validate */
6831 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006832
Daniel Veillard3d97e662004-11-04 10:49:00 +00006833 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6834 mem_base = xmlMemBlocks();
6835 ch = gen_unsigned_int(n_ch, 0);
6836
6837 ret_val = xmlIsBaseChar(ch);
6838 desret_int(ret_val);
6839 call_tests++;
6840 des_unsigned_int(n_ch, ch, 0);
6841 xmlResetLastError();
6842 if (mem_base != xmlMemBlocks()) {
6843 printf("Leak of %d blocks found in xmlIsBaseChar",
6844 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006845 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006846 printf(" %d", n_ch);
6847 printf("\n");
6848 }
6849 }
6850
6851 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00006852 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006853}
6854
6855
6856static int
6857test_xmlIsBlank(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006858 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006859
Daniel Veillard3d97e662004-11-04 10:49:00 +00006860 int mem_base;
6861 int ret_val;
6862 unsigned int ch; /* character to validate */
6863 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006864
Daniel Veillard3d97e662004-11-04 10:49:00 +00006865 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6866 mem_base = xmlMemBlocks();
6867 ch = gen_unsigned_int(n_ch, 0);
6868
6869 ret_val = xmlIsBlank(ch);
6870 desret_int(ret_val);
6871 call_tests++;
6872 des_unsigned_int(n_ch, ch, 0);
6873 xmlResetLastError();
6874 if (mem_base != xmlMemBlocks()) {
6875 printf("Leak of %d blocks found in xmlIsBlank",
6876 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006877 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006878 printf(" %d", n_ch);
6879 printf("\n");
6880 }
6881 }
6882
6883 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00006884 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006885}
6886
6887
6888static int
6889test_xmlIsChar(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006890 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006891
Daniel Veillard3d97e662004-11-04 10:49:00 +00006892 int mem_base;
6893 int ret_val;
6894 unsigned int ch; /* character to validate */
6895 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006896
Daniel Veillard3d97e662004-11-04 10:49:00 +00006897 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6898 mem_base = xmlMemBlocks();
6899 ch = gen_unsigned_int(n_ch, 0);
6900
6901 ret_val = xmlIsChar(ch);
6902 desret_int(ret_val);
6903 call_tests++;
6904 des_unsigned_int(n_ch, ch, 0);
6905 xmlResetLastError();
6906 if (mem_base != xmlMemBlocks()) {
6907 printf("Leak of %d blocks found in xmlIsChar",
6908 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006909 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006910 printf(" %d", n_ch);
6911 printf("\n");
6912 }
6913 }
6914
6915 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00006916 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006917}
6918
6919
6920static int
6921test_xmlIsCombining(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006922 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006923
Daniel Veillard3d97e662004-11-04 10:49:00 +00006924 int mem_base;
6925 int ret_val;
6926 unsigned int ch; /* character to validate */
6927 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006928
Daniel Veillard3d97e662004-11-04 10:49:00 +00006929 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6930 mem_base = xmlMemBlocks();
6931 ch = gen_unsigned_int(n_ch, 0);
6932
6933 ret_val = xmlIsCombining(ch);
6934 desret_int(ret_val);
6935 call_tests++;
6936 des_unsigned_int(n_ch, ch, 0);
6937 xmlResetLastError();
6938 if (mem_base != xmlMemBlocks()) {
6939 printf("Leak of %d blocks found in xmlIsCombining",
6940 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006941 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006942 printf(" %d", n_ch);
6943 printf("\n");
6944 }
6945 }
6946
6947 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00006948 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006949}
6950
6951
6952static int
6953test_xmlIsDigit(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006954 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006955
Daniel Veillard3d97e662004-11-04 10:49:00 +00006956 int mem_base;
6957 int ret_val;
6958 unsigned int ch; /* character to validate */
6959 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006960
Daniel Veillard3d97e662004-11-04 10:49:00 +00006961 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6962 mem_base = xmlMemBlocks();
6963 ch = gen_unsigned_int(n_ch, 0);
6964
6965 ret_val = xmlIsDigit(ch);
6966 desret_int(ret_val);
6967 call_tests++;
6968 des_unsigned_int(n_ch, ch, 0);
6969 xmlResetLastError();
6970 if (mem_base != xmlMemBlocks()) {
6971 printf("Leak of %d blocks found in xmlIsDigit",
6972 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006973 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006974 printf(" %d", n_ch);
6975 printf("\n");
6976 }
6977 }
6978
6979 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00006980 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006981}
6982
6983
6984static int
6985test_xmlIsExtender(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006986 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006987
Daniel Veillard3d97e662004-11-04 10:49:00 +00006988 int mem_base;
6989 int ret_val;
6990 unsigned int ch; /* character to validate */
6991 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006992
Daniel Veillard3d97e662004-11-04 10:49:00 +00006993 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6994 mem_base = xmlMemBlocks();
6995 ch = gen_unsigned_int(n_ch, 0);
6996
6997 ret_val = xmlIsExtender(ch);
6998 desret_int(ret_val);
6999 call_tests++;
7000 des_unsigned_int(n_ch, ch, 0);
7001 xmlResetLastError();
7002 if (mem_base != xmlMemBlocks()) {
7003 printf("Leak of %d blocks found in xmlIsExtender",
7004 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00007005 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00007006 printf(" %d", n_ch);
7007 printf("\n");
7008 }
7009 }
7010
7011 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00007012 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00007013}
7014
7015
7016static int
7017test_xmlIsIdeographic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00007018 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00007019
Daniel Veillard3d97e662004-11-04 10:49:00 +00007020 int mem_base;
7021 int ret_val;
7022 unsigned int ch; /* character to validate */
7023 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00007024
Daniel Veillard3d97e662004-11-04 10:49:00 +00007025 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
7026 mem_base = xmlMemBlocks();
7027 ch = gen_unsigned_int(n_ch, 0);
7028
7029 ret_val = xmlIsIdeographic(ch);
7030 desret_int(ret_val);
7031 call_tests++;
7032 des_unsigned_int(n_ch, ch, 0);
7033 xmlResetLastError();
7034 if (mem_base != xmlMemBlocks()) {
7035 printf("Leak of %d blocks found in xmlIsIdeographic",
7036 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00007037 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00007038 printf(" %d", n_ch);
7039 printf("\n");
7040 }
7041 }
7042
7043 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00007044 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00007045}
7046
7047
7048static int
7049test_xmlIsPubidChar(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00007050 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00007051
Daniel Veillard3d97e662004-11-04 10:49:00 +00007052 int mem_base;
7053 int ret_val;
7054 unsigned int ch; /* character to validate */
7055 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00007056
Daniel Veillard3d97e662004-11-04 10:49:00 +00007057 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
7058 mem_base = xmlMemBlocks();
7059 ch = gen_unsigned_int(n_ch, 0);
7060
7061 ret_val = xmlIsPubidChar(ch);
7062 desret_int(ret_val);
7063 call_tests++;
7064 des_unsigned_int(n_ch, ch, 0);
7065 xmlResetLastError();
7066 if (mem_base != xmlMemBlocks()) {
7067 printf("Leak of %d blocks found in xmlIsPubidChar",
7068 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00007069 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00007070 printf(" %d", n_ch);
7071 printf("\n");
7072 }
7073 }
7074
7075 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00007076 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00007077}
7078
7079static int
7080test_chvalid(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00007081 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00007082
Daniel Veillardce682bc2004-11-05 17:22:25 +00007083 printf("Testing chvalid : 9 of 9 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00007084 test_ret += test_xmlCharInRange();
7085 test_ret += test_xmlIsBaseChar();
7086 test_ret += test_xmlIsBlank();
7087 test_ret += test_xmlIsChar();
7088 test_ret += test_xmlIsCombining();
7089 test_ret += test_xmlIsDigit();
7090 test_ret += test_xmlIsExtender();
7091 test_ret += test_xmlIsIdeographic();
7092 test_ret += test_xmlIsPubidChar();
Daniel Veillardd93f6252004-11-02 15:53:51 +00007093
Daniel Veillard42595322004-11-08 10:52:06 +00007094 if (test_ret != 0)
7095 printf("Module chvalid: %d errors\n", test_ret);
7096 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00007097}
7098
7099static int
Daniel Veillarda82b1822004-11-08 16:24:57 +00007100test_xmlBoolToText(void) {
7101 int test_ret = 0;
7102
7103#ifdef LIBXML_DEBUG_ENABLED
7104 int mem_base;
7105 const char * ret_val;
7106 int boolval; /* a bool to turn into text */
7107 int n_boolval;
7108
7109 for (n_boolval = 0;n_boolval < gen_nb_int;n_boolval++) {
7110 mem_base = xmlMemBlocks();
7111 boolval = gen_int(n_boolval, 0);
7112
7113 ret_val = xmlBoolToText(boolval);
7114 desret_const_char_ptr(ret_val);
7115 call_tests++;
7116 des_int(n_boolval, boolval, 0);
7117 xmlResetLastError();
7118 if (mem_base != xmlMemBlocks()) {
7119 printf("Leak of %d blocks found in xmlBoolToText",
7120 xmlMemBlocks() - mem_base);
7121 test_ret++;
7122 printf(" %d", n_boolval);
7123 printf("\n");
7124 }
7125 }
7126#endif
7127
7128 function_tests++;
7129 return(test_ret);
7130}
7131
7132
7133static int
7134test_xmlDebugCheckDocument(void) {
7135 int test_ret = 0;
7136
7137#ifdef LIBXML_DEBUG_ENABLED
7138 int mem_base;
7139 int ret_val;
7140 FILE * output; /* the FILE * for the output */
7141 int n_output;
7142 xmlDocPtr doc; /* the document */
7143 int n_doc;
7144
7145 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7146 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
7147 mem_base = xmlMemBlocks();
7148 output = gen_debug_FILE_ptr(n_output, 0);
7149 doc = gen_xmlDocPtr(n_doc, 1);
7150
7151 ret_val = xmlDebugCheckDocument(output, doc);
7152 desret_int(ret_val);
7153 call_tests++;
7154 des_debug_FILE_ptr(n_output, output, 0);
7155 des_xmlDocPtr(n_doc, doc, 1);
7156 xmlResetLastError();
7157 if (mem_base != xmlMemBlocks()) {
7158 printf("Leak of %d blocks found in xmlDebugCheckDocument",
7159 xmlMemBlocks() - mem_base);
7160 test_ret++;
7161 printf(" %d", n_output);
7162 printf(" %d", n_doc);
7163 printf("\n");
7164 }
7165 }
7166 }
7167#endif
7168
7169 function_tests++;
7170 return(test_ret);
7171}
7172
7173
7174static int
7175test_xmlDebugDumpAttr(void) {
7176 int test_ret = 0;
7177
7178#ifdef LIBXML_DEBUG_ENABLED
7179 int mem_base;
7180 FILE * output; /* the FILE * for the output */
7181 int n_output;
7182 xmlAttrPtr attr; /* the attribute */
7183 int n_attr;
7184 int depth; /* the indentation level. */
7185 int n_depth;
7186
7187 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7188 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
7189 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
7190 mem_base = xmlMemBlocks();
7191 output = gen_debug_FILE_ptr(n_output, 0);
7192 attr = gen_xmlAttrPtr(n_attr, 1);
7193 depth = gen_int(n_depth, 2);
7194
7195 xmlDebugDumpAttr(output, attr, depth);
7196 call_tests++;
7197 des_debug_FILE_ptr(n_output, output, 0);
7198 des_xmlAttrPtr(n_attr, attr, 1);
7199 des_int(n_depth, depth, 2);
7200 xmlResetLastError();
7201 if (mem_base != xmlMemBlocks()) {
7202 printf("Leak of %d blocks found in xmlDebugDumpAttr",
7203 xmlMemBlocks() - mem_base);
7204 test_ret++;
7205 printf(" %d", n_output);
7206 printf(" %d", n_attr);
7207 printf(" %d", n_depth);
7208 printf("\n");
7209 }
7210 }
7211 }
7212 }
7213#endif
7214
7215 function_tests++;
7216 return(test_ret);
7217}
7218
7219
7220static int
7221test_xmlDebugDumpAttrList(void) {
7222 int test_ret = 0;
7223
7224#ifdef LIBXML_DEBUG_ENABLED
7225 int mem_base;
7226 FILE * output; /* the FILE * for the output */
7227 int n_output;
7228 xmlAttrPtr attr; /* the attribute list */
7229 int n_attr;
7230 int depth; /* the indentation level. */
7231 int n_depth;
7232
7233 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7234 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
7235 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
7236 mem_base = xmlMemBlocks();
7237 output = gen_debug_FILE_ptr(n_output, 0);
7238 attr = gen_xmlAttrPtr(n_attr, 1);
7239 depth = gen_int(n_depth, 2);
7240
7241 xmlDebugDumpAttrList(output, attr, depth);
7242 call_tests++;
7243 des_debug_FILE_ptr(n_output, output, 0);
7244 des_xmlAttrPtr(n_attr, attr, 1);
7245 des_int(n_depth, depth, 2);
7246 xmlResetLastError();
7247 if (mem_base != xmlMemBlocks()) {
7248 printf("Leak of %d blocks found in xmlDebugDumpAttrList",
7249 xmlMemBlocks() - mem_base);
7250 test_ret++;
7251 printf(" %d", n_output);
7252 printf(" %d", n_attr);
7253 printf(" %d", n_depth);
7254 printf("\n");
7255 }
7256 }
7257 }
7258 }
7259#endif
7260
7261 function_tests++;
7262 return(test_ret);
7263}
7264
7265
7266static int
7267test_xmlDebugDumpDTD(void) {
7268 int test_ret = 0;
7269
7270#ifdef LIBXML_DEBUG_ENABLED
7271 int mem_base;
7272 FILE * output; /* the FILE * for the output */
7273 int n_output;
7274 xmlDtdPtr dtd; /* the DTD */
7275 int n_dtd;
7276
7277 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7278 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
7279 mem_base = xmlMemBlocks();
7280 output = gen_debug_FILE_ptr(n_output, 0);
7281 dtd = gen_xmlDtdPtr(n_dtd, 1);
7282
7283 xmlDebugDumpDTD(output, dtd);
7284 call_tests++;
7285 des_debug_FILE_ptr(n_output, output, 0);
7286 des_xmlDtdPtr(n_dtd, dtd, 1);
7287 xmlResetLastError();
7288 if (mem_base != xmlMemBlocks()) {
7289 printf("Leak of %d blocks found in xmlDebugDumpDTD",
7290 xmlMemBlocks() - mem_base);
7291 test_ret++;
7292 printf(" %d", n_output);
7293 printf(" %d", n_dtd);
7294 printf("\n");
7295 }
7296 }
7297 }
7298#endif
7299
7300 function_tests++;
7301 return(test_ret);
7302}
7303
7304
7305static int
7306test_xmlDebugDumpDocument(void) {
7307 int test_ret = 0;
7308
7309#ifdef LIBXML_DEBUG_ENABLED
7310 int mem_base;
7311 FILE * output; /* the FILE * for the output */
7312 int n_output;
7313 xmlDocPtr doc; /* the document */
7314 int n_doc;
7315
7316 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7317 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
7318 mem_base = xmlMemBlocks();
7319 output = gen_debug_FILE_ptr(n_output, 0);
7320 doc = gen_xmlDocPtr(n_doc, 1);
7321
7322 xmlDebugDumpDocument(output, doc);
7323 call_tests++;
7324 des_debug_FILE_ptr(n_output, output, 0);
7325 des_xmlDocPtr(n_doc, doc, 1);
7326 xmlResetLastError();
7327 if (mem_base != xmlMemBlocks()) {
7328 printf("Leak of %d blocks found in xmlDebugDumpDocument",
7329 xmlMemBlocks() - mem_base);
7330 test_ret++;
7331 printf(" %d", n_output);
7332 printf(" %d", n_doc);
7333 printf("\n");
7334 }
7335 }
7336 }
7337#endif
7338
7339 function_tests++;
7340 return(test_ret);
7341}
7342
7343
7344static int
7345test_xmlDebugDumpDocumentHead(void) {
7346 int test_ret = 0;
7347
7348#ifdef LIBXML_DEBUG_ENABLED
7349 int mem_base;
7350 FILE * output; /* the FILE * for the output */
7351 int n_output;
7352 xmlDocPtr doc; /* the document */
7353 int n_doc;
7354
7355 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7356 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
7357 mem_base = xmlMemBlocks();
7358 output = gen_debug_FILE_ptr(n_output, 0);
7359 doc = gen_xmlDocPtr(n_doc, 1);
7360
7361 xmlDebugDumpDocumentHead(output, doc);
7362 call_tests++;
7363 des_debug_FILE_ptr(n_output, output, 0);
7364 des_xmlDocPtr(n_doc, doc, 1);
7365 xmlResetLastError();
7366 if (mem_base != xmlMemBlocks()) {
7367 printf("Leak of %d blocks found in xmlDebugDumpDocumentHead",
7368 xmlMemBlocks() - mem_base);
7369 test_ret++;
7370 printf(" %d", n_output);
7371 printf(" %d", n_doc);
7372 printf("\n");
7373 }
7374 }
7375 }
7376#endif
7377
7378 function_tests++;
7379 return(test_ret);
7380}
7381
7382
7383static int
7384test_xmlDebugDumpEntities(void) {
7385 int test_ret = 0;
7386
7387#ifdef LIBXML_DEBUG_ENABLED
7388 int mem_base;
7389 FILE * output; /* the FILE * for the output */
7390 int n_output;
7391 xmlDocPtr doc; /* the document */
7392 int n_doc;
7393
7394 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7395 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
7396 mem_base = xmlMemBlocks();
7397 output = gen_debug_FILE_ptr(n_output, 0);
7398 doc = gen_xmlDocPtr(n_doc, 1);
7399
7400 xmlDebugDumpEntities(output, doc);
7401 call_tests++;
7402 des_debug_FILE_ptr(n_output, output, 0);
7403 des_xmlDocPtr(n_doc, doc, 1);
7404 xmlResetLastError();
7405 if (mem_base != xmlMemBlocks()) {
7406 printf("Leak of %d blocks found in xmlDebugDumpEntities",
7407 xmlMemBlocks() - mem_base);
7408 test_ret++;
7409 printf(" %d", n_output);
7410 printf(" %d", n_doc);
7411 printf("\n");
7412 }
7413 }
7414 }
7415#endif
7416
7417 function_tests++;
7418 return(test_ret);
7419}
7420
7421
7422static int
7423test_xmlDebugDumpNode(void) {
7424 int test_ret = 0;
7425
7426#ifdef LIBXML_DEBUG_ENABLED
7427 int mem_base;
7428 FILE * output; /* the FILE * for the output */
7429 int n_output;
7430 xmlNodePtr node; /* the node */
7431 int n_node;
7432 int depth; /* the indentation level. */
7433 int n_depth;
7434
7435 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7436 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7437 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
7438 mem_base = xmlMemBlocks();
7439 output = gen_debug_FILE_ptr(n_output, 0);
7440 node = gen_xmlNodePtr(n_node, 1);
7441 depth = gen_int(n_depth, 2);
7442
7443 xmlDebugDumpNode(output, node, depth);
7444 call_tests++;
7445 des_debug_FILE_ptr(n_output, output, 0);
7446 des_xmlNodePtr(n_node, node, 1);
7447 des_int(n_depth, depth, 2);
7448 xmlResetLastError();
7449 if (mem_base != xmlMemBlocks()) {
7450 printf("Leak of %d blocks found in xmlDebugDumpNode",
7451 xmlMemBlocks() - mem_base);
7452 test_ret++;
7453 printf(" %d", n_output);
7454 printf(" %d", n_node);
7455 printf(" %d", n_depth);
7456 printf("\n");
7457 }
7458 }
7459 }
7460 }
7461#endif
7462
7463 function_tests++;
7464 return(test_ret);
7465}
7466
7467
7468static int
7469test_xmlDebugDumpNodeList(void) {
7470 int test_ret = 0;
7471
7472#ifdef LIBXML_DEBUG_ENABLED
7473 int mem_base;
7474 FILE * output; /* the FILE * for the output */
7475 int n_output;
7476 xmlNodePtr node; /* the node list */
7477 int n_node;
7478 int depth; /* the indentation level. */
7479 int n_depth;
7480
7481 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7482 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7483 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
7484 mem_base = xmlMemBlocks();
7485 output = gen_debug_FILE_ptr(n_output, 0);
7486 node = gen_xmlNodePtr(n_node, 1);
7487 depth = gen_int(n_depth, 2);
7488
7489 xmlDebugDumpNodeList(output, node, depth);
7490 call_tests++;
7491 des_debug_FILE_ptr(n_output, output, 0);
7492 des_xmlNodePtr(n_node, node, 1);
7493 des_int(n_depth, depth, 2);
7494 xmlResetLastError();
7495 if (mem_base != xmlMemBlocks()) {
7496 printf("Leak of %d blocks found in xmlDebugDumpNodeList",
7497 xmlMemBlocks() - mem_base);
7498 test_ret++;
7499 printf(" %d", n_output);
7500 printf(" %d", n_node);
7501 printf(" %d", n_depth);
7502 printf("\n");
7503 }
7504 }
7505 }
7506 }
7507#endif
7508
7509 function_tests++;
7510 return(test_ret);
7511}
7512
7513
7514static int
7515test_xmlDebugDumpOneNode(void) {
7516 int test_ret = 0;
7517
7518#ifdef LIBXML_DEBUG_ENABLED
7519 int mem_base;
7520 FILE * output; /* the FILE * for the output */
7521 int n_output;
7522 xmlNodePtr node; /* the node */
7523 int n_node;
7524 int depth; /* the indentation level. */
7525 int n_depth;
7526
7527 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7528 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7529 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
7530 mem_base = xmlMemBlocks();
7531 output = gen_debug_FILE_ptr(n_output, 0);
7532 node = gen_xmlNodePtr(n_node, 1);
7533 depth = gen_int(n_depth, 2);
7534
7535 xmlDebugDumpOneNode(output, node, depth);
7536 call_tests++;
7537 des_debug_FILE_ptr(n_output, output, 0);
7538 des_xmlNodePtr(n_node, node, 1);
7539 des_int(n_depth, depth, 2);
7540 xmlResetLastError();
7541 if (mem_base != xmlMemBlocks()) {
7542 printf("Leak of %d blocks found in xmlDebugDumpOneNode",
7543 xmlMemBlocks() - mem_base);
7544 test_ret++;
7545 printf(" %d", n_output);
7546 printf(" %d", n_node);
7547 printf(" %d", n_depth);
7548 printf("\n");
7549 }
7550 }
7551 }
7552 }
7553#endif
7554
7555 function_tests++;
7556 return(test_ret);
7557}
7558
7559
7560static int
7561test_xmlDebugDumpString(void) {
7562 int test_ret = 0;
7563
7564#ifdef LIBXML_DEBUG_ENABLED
7565 int mem_base;
7566 FILE * output; /* the FILE * for the output */
7567 int n_output;
7568 xmlChar * str; /* the string */
7569 int n_str;
7570
7571 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7572 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
7573 mem_base = xmlMemBlocks();
7574 output = gen_debug_FILE_ptr(n_output, 0);
7575 str = gen_const_xmlChar_ptr(n_str, 1);
7576
7577 xmlDebugDumpString(output, str);
7578 call_tests++;
7579 des_debug_FILE_ptr(n_output, output, 0);
7580 des_const_xmlChar_ptr(n_str, str, 1);
7581 xmlResetLastError();
7582 if (mem_base != xmlMemBlocks()) {
7583 printf("Leak of %d blocks found in xmlDebugDumpString",
7584 xmlMemBlocks() - mem_base);
7585 test_ret++;
7586 printf(" %d", n_output);
7587 printf(" %d", n_str);
7588 printf("\n");
7589 }
7590 }
7591 }
7592#endif
7593
7594 function_tests++;
7595 return(test_ret);
7596}
7597
7598
7599static int
7600test_xmlLsCountNode(void) {
7601 int test_ret = 0;
7602
7603#ifdef LIBXML_DEBUG_ENABLED
7604 int mem_base;
7605 int ret_val;
7606 xmlNodePtr node; /* the node to count */
7607 int n_node;
7608
7609 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7610 mem_base = xmlMemBlocks();
7611 node = gen_xmlNodePtr(n_node, 0);
7612
7613 ret_val = xmlLsCountNode(node);
7614 desret_int(ret_val);
7615 call_tests++;
7616 des_xmlNodePtr(n_node, node, 0);
7617 xmlResetLastError();
7618 if (mem_base != xmlMemBlocks()) {
7619 printf("Leak of %d blocks found in xmlLsCountNode",
7620 xmlMemBlocks() - mem_base);
7621 test_ret++;
7622 printf(" %d", n_node);
7623 printf("\n");
7624 }
7625 }
7626#endif
7627
7628 function_tests++;
7629 return(test_ret);
7630}
7631
7632
7633static int
7634test_xmlLsOneNode(void) {
7635 int test_ret = 0;
7636
7637#ifdef LIBXML_DEBUG_ENABLED
7638 int mem_base;
7639 FILE * output; /* the FILE * for the output */
7640 int n_output;
7641 xmlNodePtr node; /* the node to dump */
7642 int n_node;
7643
7644 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7645 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7646 mem_base = xmlMemBlocks();
7647 output = gen_debug_FILE_ptr(n_output, 0);
7648 node = gen_xmlNodePtr(n_node, 1);
7649
7650 xmlLsOneNode(output, node);
7651 call_tests++;
7652 des_debug_FILE_ptr(n_output, output, 0);
7653 des_xmlNodePtr(n_node, node, 1);
7654 xmlResetLastError();
7655 if (mem_base != xmlMemBlocks()) {
7656 printf("Leak of %d blocks found in xmlLsOneNode",
7657 xmlMemBlocks() - mem_base);
7658 test_ret++;
7659 printf(" %d", n_output);
7660 printf(" %d", n_node);
7661 printf("\n");
7662 }
7663 }
7664 }
7665#endif
7666
7667 function_tests++;
7668 return(test_ret);
7669}
7670
7671
7672#define gen_nb_char_ptr 1
7673static char * gen_char_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
7674 return(NULL);
7675}
7676static void des_char_ptr(int no ATTRIBUTE_UNUSED, char * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
7677}
7678
7679static int
7680test_xmlShell(void) {
7681 int test_ret = 0;
7682
7683
7684 /* missing type support */
7685 return(test_ret);
7686}
7687
7688
Daniel Veillarda82b1822004-11-08 16:24:57 +00007689static int
7690test_xmlShellBase(void) {
7691 int test_ret = 0;
7692
7693#ifdef LIBXML_DEBUG_ENABLED
7694 int mem_base;
7695 int ret_val;
7696 xmlShellCtxtPtr ctxt; /* the shell context */
7697 int n_ctxt;
7698 char * arg; /* unused */
7699 int n_arg;
7700 xmlNodePtr node; /* a node */
7701 int n_node;
7702 xmlNodePtr node2; /* unused */
7703 int n_node2;
7704
7705 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7706 for (n_arg = 0;n_arg < gen_nb_char_ptr;n_arg++) {
7707 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7708 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7709 mem_base = xmlMemBlocks();
7710 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7711 arg = gen_char_ptr(n_arg, 1);
7712 node = gen_xmlNodePtr(n_node, 2);
7713 node2 = gen_xmlNodePtr(n_node2, 3);
7714
7715 ret_val = xmlShellBase(ctxt, arg, node, node2);
7716 desret_int(ret_val);
7717 call_tests++;
7718 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7719 des_char_ptr(n_arg, arg, 1);
7720 des_xmlNodePtr(n_node, node, 2);
7721 des_xmlNodePtr(n_node2, node2, 3);
7722 xmlResetLastError();
7723 if (mem_base != xmlMemBlocks()) {
7724 printf("Leak of %d blocks found in xmlShellBase",
7725 xmlMemBlocks() - mem_base);
7726 test_ret++;
7727 printf(" %d", n_ctxt);
7728 printf(" %d", n_arg);
7729 printf(" %d", n_node);
7730 printf(" %d", n_node2);
7731 printf("\n");
7732 }
7733 }
7734 }
7735 }
7736 }
7737#endif
7738
7739 function_tests++;
7740 return(test_ret);
7741}
7742
7743
7744static int
7745test_xmlShellCat(void) {
7746 int test_ret = 0;
7747
7748#ifdef LIBXML_DEBUG_ENABLED
7749 int mem_base;
7750 int ret_val;
7751 xmlShellCtxtPtr ctxt; /* the shell context */
7752 int n_ctxt;
7753 char * arg; /* unused */
7754 int n_arg;
7755 xmlNodePtr node; /* a node */
7756 int n_node;
7757 xmlNodePtr node2; /* unused */
7758 int n_node2;
7759
7760 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7761 for (n_arg = 0;n_arg < gen_nb_char_ptr;n_arg++) {
7762 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7763 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7764 mem_base = xmlMemBlocks();
7765 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7766 arg = gen_char_ptr(n_arg, 1);
7767 node = gen_xmlNodePtr(n_node, 2);
7768 node2 = gen_xmlNodePtr(n_node2, 3);
7769
7770 ret_val = xmlShellCat(ctxt, arg, node, node2);
7771 desret_int(ret_val);
7772 call_tests++;
7773 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7774 des_char_ptr(n_arg, arg, 1);
7775 des_xmlNodePtr(n_node, node, 2);
7776 des_xmlNodePtr(n_node2, node2, 3);
7777 xmlResetLastError();
7778 if (mem_base != xmlMemBlocks()) {
7779 printf("Leak of %d blocks found in xmlShellCat",
7780 xmlMemBlocks() - mem_base);
7781 test_ret++;
7782 printf(" %d", n_ctxt);
7783 printf(" %d", n_arg);
7784 printf(" %d", n_node);
7785 printf(" %d", n_node2);
7786 printf("\n");
7787 }
7788 }
7789 }
7790 }
7791 }
7792#endif
7793
7794 function_tests++;
7795 return(test_ret);
7796}
7797
7798
7799static int
7800test_xmlShellDir(void) {
7801 int test_ret = 0;
7802
7803#ifdef LIBXML_DEBUG_ENABLED
7804 int mem_base;
7805 int ret_val;
7806 xmlShellCtxtPtr ctxt; /* the shell context */
7807 int n_ctxt;
7808 char * arg; /* unused */
7809 int n_arg;
7810 xmlNodePtr node; /* a node */
7811 int n_node;
7812 xmlNodePtr node2; /* unused */
7813 int n_node2;
7814
7815 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7816 for (n_arg = 0;n_arg < gen_nb_char_ptr;n_arg++) {
7817 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7818 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7819 mem_base = xmlMemBlocks();
7820 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7821 arg = gen_char_ptr(n_arg, 1);
7822 node = gen_xmlNodePtr(n_node, 2);
7823 node2 = gen_xmlNodePtr(n_node2, 3);
7824
7825 ret_val = xmlShellDir(ctxt, arg, node, node2);
7826 desret_int(ret_val);
7827 call_tests++;
7828 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7829 des_char_ptr(n_arg, arg, 1);
7830 des_xmlNodePtr(n_node, node, 2);
7831 des_xmlNodePtr(n_node2, node2, 3);
7832 xmlResetLastError();
7833 if (mem_base != xmlMemBlocks()) {
7834 printf("Leak of %d blocks found in xmlShellDir",
7835 xmlMemBlocks() - mem_base);
7836 test_ret++;
7837 printf(" %d", n_ctxt);
7838 printf(" %d", n_arg);
7839 printf(" %d", n_node);
7840 printf(" %d", n_node2);
7841 printf("\n");
7842 }
7843 }
7844 }
7845 }
7846 }
7847#endif
7848
7849 function_tests++;
7850 return(test_ret);
7851}
7852
7853
7854static int
7855test_xmlShellDu(void) {
7856 int test_ret = 0;
7857
7858#ifdef LIBXML_DEBUG_ENABLED
7859 int mem_base;
7860 int ret_val;
7861 xmlShellCtxtPtr ctxt; /* the shell context */
7862 int n_ctxt;
7863 char * arg; /* unused */
7864 int n_arg;
7865 xmlNodePtr tree; /* a node defining a subtree */
7866 int n_tree;
7867 xmlNodePtr node2; /* unused */
7868 int n_node2;
7869
7870 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7871 for (n_arg = 0;n_arg < gen_nb_char_ptr;n_arg++) {
7872 for (n_tree = 0;n_tree < gen_nb_xmlNodePtr;n_tree++) {
7873 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7874 mem_base = xmlMemBlocks();
7875 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7876 arg = gen_char_ptr(n_arg, 1);
7877 tree = gen_xmlNodePtr(n_tree, 2);
7878 node2 = gen_xmlNodePtr(n_node2, 3);
7879
7880 ret_val = xmlShellDu(ctxt, arg, tree, node2);
7881 desret_int(ret_val);
7882 call_tests++;
7883 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7884 des_char_ptr(n_arg, arg, 1);
7885 des_xmlNodePtr(n_tree, tree, 2);
7886 des_xmlNodePtr(n_node2, node2, 3);
7887 xmlResetLastError();
7888 if (mem_base != xmlMemBlocks()) {
7889 printf("Leak of %d blocks found in xmlShellDu",
7890 xmlMemBlocks() - mem_base);
7891 test_ret++;
7892 printf(" %d", n_ctxt);
7893 printf(" %d", n_arg);
7894 printf(" %d", n_tree);
7895 printf(" %d", n_node2);
7896 printf("\n");
7897 }
7898 }
7899 }
7900 }
7901 }
7902#endif
7903
7904 function_tests++;
7905 return(test_ret);
7906}
7907
7908
7909static int
7910test_xmlShellList(void) {
7911 int test_ret = 0;
7912
7913#ifdef LIBXML_DEBUG_ENABLED
7914 int mem_base;
7915 int ret_val;
7916 xmlShellCtxtPtr ctxt; /* the shell context */
7917 int n_ctxt;
7918 char * arg; /* unused */
7919 int n_arg;
7920 xmlNodePtr node; /* a node */
7921 int n_node;
7922 xmlNodePtr node2; /* unused */
7923 int n_node2;
7924
7925 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7926 for (n_arg = 0;n_arg < gen_nb_char_ptr;n_arg++) {
7927 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7928 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7929 mem_base = xmlMemBlocks();
7930 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7931 arg = gen_char_ptr(n_arg, 1);
7932 node = gen_xmlNodePtr(n_node, 2);
7933 node2 = gen_xmlNodePtr(n_node2, 3);
7934
7935 ret_val = xmlShellList(ctxt, arg, node, node2);
7936 desret_int(ret_val);
7937 call_tests++;
7938 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7939 des_char_ptr(n_arg, arg, 1);
7940 des_xmlNodePtr(n_node, node, 2);
7941 des_xmlNodePtr(n_node2, node2, 3);
7942 xmlResetLastError();
7943 if (mem_base != xmlMemBlocks()) {
7944 printf("Leak of %d blocks found in xmlShellList",
7945 xmlMemBlocks() - mem_base);
7946 test_ret++;
7947 printf(" %d", n_ctxt);
7948 printf(" %d", n_arg);
7949 printf(" %d", n_node);
7950 printf(" %d", n_node2);
7951 printf("\n");
7952 }
7953 }
7954 }
7955 }
7956 }
7957#endif
7958
7959 function_tests++;
7960 return(test_ret);
7961}
7962
7963
7964static int
7965test_xmlShellLoad(void) {
7966 int test_ret = 0;
7967
7968#ifdef LIBXML_DEBUG_ENABLED
7969 int mem_base;
7970 int ret_val;
7971 xmlShellCtxtPtr ctxt; /* the shell context */
7972 int n_ctxt;
7973 char * filename; /* the file name */
7974 int n_filename;
7975 xmlNodePtr node; /* unused */
7976 int n_node;
7977 xmlNodePtr node2; /* unused */
7978 int n_node2;
7979
7980 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7981 for (n_filename = 0;n_filename < gen_nb_char_ptr;n_filename++) {
7982 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7983 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7984 mem_base = xmlMemBlocks();
7985 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7986 filename = gen_char_ptr(n_filename, 1);
7987 node = gen_xmlNodePtr(n_node, 2);
7988 node2 = gen_xmlNodePtr(n_node2, 3);
7989
7990 ret_val = xmlShellLoad(ctxt, filename, node, node2);
7991 desret_int(ret_val);
7992 call_tests++;
7993 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7994 des_char_ptr(n_filename, filename, 1);
7995 des_xmlNodePtr(n_node, node, 2);
7996 des_xmlNodePtr(n_node2, node2, 3);
7997 xmlResetLastError();
7998 if (mem_base != xmlMemBlocks()) {
7999 printf("Leak of %d blocks found in xmlShellLoad",
8000 xmlMemBlocks() - mem_base);
8001 test_ret++;
8002 printf(" %d", n_ctxt);
8003 printf(" %d", n_filename);
8004 printf(" %d", n_node);
8005 printf(" %d", n_node2);
8006 printf("\n");
8007 }
8008 }
8009 }
8010 }
8011 }
8012#endif
8013
8014 function_tests++;
8015 return(test_ret);
8016}
8017
8018
8019static int
8020test_xmlShellPrintXPathResult(void) {
8021 int test_ret = 0;
8022
8023#ifdef LIBXML_DEBUG_ENABLED
8024 int mem_base;
8025 xmlXPathObjectPtr list; /* a valid result generated by an xpath evaluation */
8026 int n_list;
8027
8028 for (n_list = 0;n_list < gen_nb_xmlXPathObjectPtr;n_list++) {
8029 mem_base = xmlMemBlocks();
8030 list = gen_xmlXPathObjectPtr(n_list, 0);
8031
8032 xmlShellPrintXPathResult(list);
8033 call_tests++;
8034 des_xmlXPathObjectPtr(n_list, list, 0);
8035 xmlResetLastError();
8036 if (mem_base != xmlMemBlocks()) {
8037 printf("Leak of %d blocks found in xmlShellPrintXPathResult",
8038 xmlMemBlocks() - mem_base);
8039 test_ret++;
8040 printf(" %d", n_list);
8041 printf("\n");
8042 }
8043 }
8044#endif
8045
8046 function_tests++;
8047 return(test_ret);
8048}
8049
8050
8051static int
8052test_xmlShellPwd(void) {
8053 int test_ret = 0;
8054
8055#ifdef LIBXML_DEBUG_ENABLED
8056 int mem_base;
8057 int ret_val;
8058 xmlShellCtxtPtr ctxt; /* the shell context */
8059 int n_ctxt;
8060 char * buffer; /* the output buffer */
8061 int n_buffer;
8062 xmlNodePtr node; /* a node */
8063 int n_node;
8064 xmlNodePtr node2; /* unused */
8065 int n_node2;
8066
8067 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
8068 for (n_buffer = 0;n_buffer < gen_nb_char_ptr;n_buffer++) {
8069 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
8070 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
8071 mem_base = xmlMemBlocks();
8072 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
8073 buffer = gen_char_ptr(n_buffer, 1);
8074 node = gen_xmlNodePtr(n_node, 2);
8075 node2 = gen_xmlNodePtr(n_node2, 3);
8076
8077 ret_val = xmlShellPwd(ctxt, buffer, node, node2);
8078 desret_int(ret_val);
8079 call_tests++;
8080 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
8081 des_char_ptr(n_buffer, buffer, 1);
8082 des_xmlNodePtr(n_node, node, 2);
8083 des_xmlNodePtr(n_node2, node2, 3);
8084 xmlResetLastError();
8085 if (mem_base != xmlMemBlocks()) {
8086 printf("Leak of %d blocks found in xmlShellPwd",
8087 xmlMemBlocks() - mem_base);
8088 test_ret++;
8089 printf(" %d", n_ctxt);
8090 printf(" %d", n_buffer);
8091 printf(" %d", n_node);
8092 printf(" %d", n_node2);
8093 printf("\n");
8094 }
8095 }
8096 }
8097 }
8098 }
8099#endif
8100
8101 function_tests++;
8102 return(test_ret);
8103}
8104
8105
8106static int
8107test_xmlShellSave(void) {
8108 int test_ret = 0;
8109
8110#ifdef LIBXML_DEBUG_ENABLED
8111#ifdef LIBXML_OUTPUT_ENABLED
8112 int mem_base;
8113 int ret_val;
8114 xmlShellCtxtPtr ctxt; /* the shell context */
8115 int n_ctxt;
8116 char * filename; /* the file name (optional) */
8117 int n_filename;
8118 xmlNodePtr node; /* unused */
8119 int n_node;
8120 xmlNodePtr node2; /* unused */
8121 int n_node2;
8122
8123 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
8124 for (n_filename = 0;n_filename < gen_nb_char_ptr;n_filename++) {
8125 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
8126 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
8127 mem_base = xmlMemBlocks();
8128 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
8129 filename = gen_char_ptr(n_filename, 1);
8130 node = gen_xmlNodePtr(n_node, 2);
8131 node2 = gen_xmlNodePtr(n_node2, 3);
8132
8133 ret_val = xmlShellSave(ctxt, filename, node, node2);
8134 desret_int(ret_val);
8135 call_tests++;
8136 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
8137 des_char_ptr(n_filename, filename, 1);
8138 des_xmlNodePtr(n_node, node, 2);
8139 des_xmlNodePtr(n_node2, node2, 3);
8140 xmlResetLastError();
8141 if (mem_base != xmlMemBlocks()) {
8142 printf("Leak of %d blocks found in xmlShellSave",
8143 xmlMemBlocks() - mem_base);
8144 test_ret++;
8145 printf(" %d", n_ctxt);
8146 printf(" %d", n_filename);
8147 printf(" %d", n_node);
8148 printf(" %d", n_node2);
8149 printf("\n");
8150 }
8151 }
8152 }
8153 }
8154 }
8155#endif
8156#endif
8157
8158 function_tests++;
8159 return(test_ret);
8160}
8161
8162
8163static int
8164test_xmlShellValidate(void) {
8165 int test_ret = 0;
8166
8167#ifdef LIBXML_DEBUG_ENABLED
8168 int mem_base;
8169 int ret_val;
8170 xmlShellCtxtPtr ctxt; /* the shell context */
8171 int n_ctxt;
8172 char * dtd; /* the DTD URI (optional) */
8173 int n_dtd;
8174 xmlNodePtr node; /* unused */
8175 int n_node;
8176 xmlNodePtr node2; /* unused */
8177 int n_node2;
8178
8179 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
8180 for (n_dtd = 0;n_dtd < gen_nb_char_ptr;n_dtd++) {
8181 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
8182 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
8183 mem_base = xmlMemBlocks();
8184 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
8185 dtd = gen_char_ptr(n_dtd, 1);
8186 node = gen_xmlNodePtr(n_node, 2);
8187 node2 = gen_xmlNodePtr(n_node2, 3);
8188
8189 ret_val = xmlShellValidate(ctxt, dtd, node, node2);
8190 desret_int(ret_val);
8191 call_tests++;
8192 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
8193 des_char_ptr(n_dtd, dtd, 1);
8194 des_xmlNodePtr(n_node, node, 2);
8195 des_xmlNodePtr(n_node2, node2, 3);
8196 xmlResetLastError();
8197 if (mem_base != xmlMemBlocks()) {
8198 printf("Leak of %d blocks found in xmlShellValidate",
8199 xmlMemBlocks() - mem_base);
8200 test_ret++;
8201 printf(" %d", n_ctxt);
8202 printf(" %d", n_dtd);
8203 printf(" %d", n_node);
8204 printf(" %d", n_node2);
8205 printf("\n");
8206 }
8207 }
8208 }
8209 }
8210 }
8211#endif
8212
8213 function_tests++;
8214 return(test_ret);
8215}
8216
8217
8218static int
8219test_xmlShellWrite(void) {
8220 int test_ret = 0;
8221
8222#ifdef LIBXML_DEBUG_ENABLED
8223#ifdef LIBXML_OUTPUT_ENABLED
8224 int mem_base;
8225 int ret_val;
8226 xmlShellCtxtPtr ctxt; /* the shell context */
8227 int n_ctxt;
8228 char * filename; /* the file name */
8229 int n_filename;
8230 xmlNodePtr node; /* a node in the tree */
8231 int n_node;
8232 xmlNodePtr node2; /* unused */
8233 int n_node2;
8234
8235 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
8236 for (n_filename = 0;n_filename < gen_nb_char_ptr;n_filename++) {
8237 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
8238 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
8239 mem_base = xmlMemBlocks();
8240 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
8241 filename = gen_char_ptr(n_filename, 1);
8242 node = gen_xmlNodePtr(n_node, 2);
8243 node2 = gen_xmlNodePtr(n_node2, 3);
8244
8245 ret_val = xmlShellWrite(ctxt, filename, node, node2);
8246 desret_int(ret_val);
8247 call_tests++;
8248 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
8249 des_char_ptr(n_filename, filename, 1);
8250 des_xmlNodePtr(n_node, node, 2);
8251 des_xmlNodePtr(n_node2, node2, 3);
8252 xmlResetLastError();
8253 if (mem_base != xmlMemBlocks()) {
8254 printf("Leak of %d blocks found in xmlShellWrite",
8255 xmlMemBlocks() - mem_base);
8256 test_ret++;
8257 printf(" %d", n_ctxt);
8258 printf(" %d", n_filename);
8259 printf(" %d", n_node);
8260 printf(" %d", n_node2);
8261 printf("\n");
8262 }
8263 }
8264 }
8265 }
8266 }
8267#endif
8268#endif
8269
8270 function_tests++;
8271 return(test_ret);
8272}
8273
8274static int
8275test_debugXML(void) {
8276 int test_ret = 0;
8277
8278 printf("Testing debugXML : 25 of 28 functions ...\n");
8279 test_ret += test_xmlBoolToText();
8280 test_ret += test_xmlDebugCheckDocument();
8281 test_ret += test_xmlDebugDumpAttr();
8282 test_ret += test_xmlDebugDumpAttrList();
8283 test_ret += test_xmlDebugDumpDTD();
8284 test_ret += test_xmlDebugDumpDocument();
8285 test_ret += test_xmlDebugDumpDocumentHead();
8286 test_ret += test_xmlDebugDumpEntities();
8287 test_ret += test_xmlDebugDumpNode();
8288 test_ret += test_xmlDebugDumpNodeList();
8289 test_ret += test_xmlDebugDumpOneNode();
8290 test_ret += test_xmlDebugDumpString();
8291 test_ret += test_xmlLsCountNode();
8292 test_ret += test_xmlLsOneNode();
8293 test_ret += test_xmlShell();
8294 test_ret += test_xmlShellBase();
8295 test_ret += test_xmlShellCat();
8296 test_ret += test_xmlShellDir();
8297 test_ret += test_xmlShellDu();
8298 test_ret += test_xmlShellList();
8299 test_ret += test_xmlShellLoad();
8300 test_ret += test_xmlShellPrintXPathResult();
8301 test_ret += test_xmlShellPwd();
8302 test_ret += test_xmlShellSave();
8303 test_ret += test_xmlShellValidate();
8304 test_ret += test_xmlShellWrite();
8305
8306 if (test_ret != 0)
8307 printf("Module debugXML: %d errors\n", test_ret);
8308 return(test_ret);
8309}
8310
8311static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00008312test_xmlDictCreate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008313 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008314
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008315 int mem_base;
8316 xmlDictPtr ret_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008317
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008318 mem_base = xmlMemBlocks();
8319
8320 ret_val = xmlDictCreate();
8321 desret_xmlDictPtr(ret_val);
8322 call_tests++;
8323 xmlResetLastError();
8324 if (mem_base != xmlMemBlocks()) {
8325 printf("Leak of %d blocks found in xmlDictCreate",
8326 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008327 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008328 printf("\n");
8329 }
8330
8331 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00008332 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008333}
8334
8335
8336static int
8337test_xmlDictCreateSub(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008338 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008339
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008340 int mem_base;
8341 xmlDictPtr ret_val;
8342 xmlDictPtr sub; /* an existing dictionnary */
8343 int n_sub;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008344
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008345 for (n_sub = 0;n_sub < gen_nb_xmlDictPtr;n_sub++) {
8346 mem_base = xmlMemBlocks();
8347 sub = gen_xmlDictPtr(n_sub, 0);
8348
8349 ret_val = xmlDictCreateSub(sub);
8350 desret_xmlDictPtr(ret_val);
8351 call_tests++;
8352 des_xmlDictPtr(n_sub, sub, 0);
8353 xmlResetLastError();
8354 if (mem_base != xmlMemBlocks()) {
8355 printf("Leak of %d blocks found in xmlDictCreateSub",
8356 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008357 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008358 printf(" %d", n_sub);
8359 printf("\n");
8360 }
8361 }
8362
8363 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00008364 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008365}
8366
8367
8368static int
8369test_xmlDictLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008370 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008371
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008372 int mem_base;
8373 const xmlChar * ret_val;
8374 xmlDictPtr dict; /* the dictionnary */
8375 int n_dict;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008376 xmlChar * name; /* the name of the userdata */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008377 int n_name;
8378 int len; /* the length of the name, if -1 it is recomputed */
8379 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008380
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008381 for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
8382 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
8383 for (n_len = 0;n_len < gen_nb_int;n_len++) {
8384 mem_base = xmlMemBlocks();
8385 dict = gen_xmlDictPtr(n_dict, 0);
8386 name = gen_const_xmlChar_ptr(n_name, 1);
8387 len = gen_int(n_len, 2);
8388
8389 ret_val = xmlDictLookup(dict, name, len);
8390 desret_const_xmlChar_ptr(ret_val);
8391 call_tests++;
8392 des_xmlDictPtr(n_dict, dict, 0);
8393 des_const_xmlChar_ptr(n_name, name, 1);
8394 des_int(n_len, len, 2);
8395 xmlResetLastError();
8396 if (mem_base != xmlMemBlocks()) {
8397 printf("Leak of %d blocks found in xmlDictLookup",
8398 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008399 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008400 printf(" %d", n_dict);
8401 printf(" %d", n_name);
8402 printf(" %d", n_len);
8403 printf("\n");
8404 }
8405 }
8406 }
8407 }
8408
8409 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00008410 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008411}
8412
8413
8414static int
8415test_xmlDictOwns(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008416 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008417
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008418 int mem_base;
8419 int ret_val;
8420 xmlDictPtr dict; /* the dictionnary */
8421 int n_dict;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008422 xmlChar * str; /* the string */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008423 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008424
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008425 for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
8426 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
8427 mem_base = xmlMemBlocks();
8428 dict = gen_xmlDictPtr(n_dict, 0);
8429 str = gen_const_xmlChar_ptr(n_str, 1);
8430
8431 ret_val = xmlDictOwns(dict, str);
8432 desret_int(ret_val);
8433 call_tests++;
8434 des_xmlDictPtr(n_dict, dict, 0);
8435 des_const_xmlChar_ptr(n_str, str, 1);
8436 xmlResetLastError();
8437 if (mem_base != xmlMemBlocks()) {
8438 printf("Leak of %d blocks found in xmlDictOwns",
8439 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008440 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008441 printf(" %d", n_dict);
8442 printf(" %d", n_str);
8443 printf("\n");
8444 }
8445 }
8446 }
8447
8448 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00008449 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008450}
8451
8452
8453static int
8454test_xmlDictQLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008455 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008456
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008457 int mem_base;
8458 const xmlChar * ret_val;
8459 xmlDictPtr dict; /* the dictionnary */
8460 int n_dict;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008461 xmlChar * prefix; /* the prefix */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008462 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008463 xmlChar * name; /* the name */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008464 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008465
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008466 for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
8467 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
8468 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
8469 mem_base = xmlMemBlocks();
8470 dict = gen_xmlDictPtr(n_dict, 0);
8471 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
8472 name = gen_const_xmlChar_ptr(n_name, 2);
8473
8474 ret_val = xmlDictQLookup(dict, prefix, name);
8475 desret_const_xmlChar_ptr(ret_val);
8476 call_tests++;
8477 des_xmlDictPtr(n_dict, dict, 0);
8478 des_const_xmlChar_ptr(n_prefix, prefix, 1);
8479 des_const_xmlChar_ptr(n_name, name, 2);
8480 xmlResetLastError();
8481 if (mem_base != xmlMemBlocks()) {
8482 printf("Leak of %d blocks found in xmlDictQLookup",
8483 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008484 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008485 printf(" %d", n_dict);
8486 printf(" %d", n_prefix);
8487 printf(" %d", n_name);
8488 printf("\n");
8489 }
8490 }
8491 }
8492 }
8493
8494 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00008495 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008496}
8497
8498
8499static int
8500test_xmlDictReference(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008501 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008502
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008503 int mem_base;
8504 int ret_val;
8505 xmlDictPtr dict; /* the dictionnary */
8506 int n_dict;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008507
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008508 for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
8509 mem_base = xmlMemBlocks();
8510 dict = gen_xmlDictPtr(n_dict, 0);
8511
8512 ret_val = xmlDictReference(dict);
8513 xmlDictFree(dict);
8514 desret_int(ret_val);
8515 call_tests++;
8516 des_xmlDictPtr(n_dict, dict, 0);
8517 xmlResetLastError();
8518 if (mem_base != xmlMemBlocks()) {
8519 printf("Leak of %d blocks found in xmlDictReference",
8520 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008521 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008522 printf(" %d", n_dict);
8523 printf("\n");
8524 }
8525 }
8526
8527 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00008528 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008529}
8530
8531
8532static int
8533test_xmlDictSize(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008534 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008535
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008536 int mem_base;
8537 int ret_val;
8538 xmlDictPtr dict; /* the dictionnary */
8539 int n_dict;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008540
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008541 for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
8542 mem_base = xmlMemBlocks();
8543 dict = gen_xmlDictPtr(n_dict, 0);
8544
8545 ret_val = xmlDictSize(dict);
8546 desret_int(ret_val);
8547 call_tests++;
8548 des_xmlDictPtr(n_dict, dict, 0);
8549 xmlResetLastError();
8550 if (mem_base != xmlMemBlocks()) {
8551 printf("Leak of %d blocks found in xmlDictSize",
8552 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008553 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008554 printf(" %d", n_dict);
8555 printf("\n");
8556 }
8557 }
8558
8559 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00008560 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008561}
8562
8563static int
8564test_dict(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008565 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008566
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008567 printf("Testing dict : 7 of 8 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00008568 test_ret += test_xmlDictCreate();
8569 test_ret += test_xmlDictCreateSub();
8570 test_ret += test_xmlDictLookup();
8571 test_ret += test_xmlDictOwns();
8572 test_ret += test_xmlDictQLookup();
8573 test_ret += test_xmlDictReference();
8574 test_ret += test_xmlDictSize();
Daniel Veillardd93f6252004-11-02 15:53:51 +00008575
Daniel Veillard42595322004-11-08 10:52:06 +00008576 if (test_ret != 0)
8577 printf("Module dict: %d errors\n", test_ret);
8578 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008579}
8580
8581static int
8582test_UTF8Toisolat1(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008583 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008584
Daniel Veillarda521d282004-11-09 14:59:59 +00008585#ifdef LIBXML_OUTPUT_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +00008586 int mem_base;
8587 int ret_val;
8588 unsigned char * out; /* a pointer to an array of bytes to store the result */
8589 int n_out;
8590 int * outlen; /* the length of @out */
8591 int n_outlen;
8592 unsigned char * in; /* a pointer to an array of UTF-8 chars */
8593 int n_in;
8594 int * inlen; /* the length of @in */
8595 int n_inlen;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008596
Daniel Veillardce682bc2004-11-05 17:22:25 +00008597 for (n_out = 0;n_out < gen_nb_unsigned_char_ptr;n_out++) {
8598 for (n_outlen = 0;n_outlen < gen_nb_int_ptr;n_outlen++) {
8599 for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) {
8600 for (n_inlen = 0;n_inlen < gen_nb_int_ptr;n_inlen++) {
8601 mem_base = xmlMemBlocks();
8602 out = gen_unsigned_char_ptr(n_out, 0);
8603 outlen = gen_int_ptr(n_outlen, 1);
8604 in = gen_const_unsigned_char_ptr(n_in, 2);
8605 inlen = gen_int_ptr(n_inlen, 3);
8606
8607 ret_val = UTF8Toisolat1(out, outlen, in, inlen);
8608 desret_int(ret_val);
8609 call_tests++;
8610 des_unsigned_char_ptr(n_out, out, 0);
8611 des_int_ptr(n_outlen, outlen, 1);
8612 des_const_unsigned_char_ptr(n_in, in, 2);
8613 des_int_ptr(n_inlen, inlen, 3);
8614 xmlResetLastError();
8615 if (mem_base != xmlMemBlocks()) {
8616 printf("Leak of %d blocks found in UTF8Toisolat1",
8617 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008618 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008619 printf(" %d", n_out);
8620 printf(" %d", n_outlen);
8621 printf(" %d", n_in);
8622 printf(" %d", n_inlen);
8623 printf("\n");
8624 }
8625 }
8626 }
8627 }
8628 }
Daniel Veillarda521d282004-11-09 14:59:59 +00008629#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +00008630
8631 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00008632 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008633}
8634
8635
8636static int
8637test_isolat1ToUTF8(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008638 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008639
Daniel Veillardce682bc2004-11-05 17:22:25 +00008640 int mem_base;
8641 int ret_val;
8642 unsigned char * out; /* a pointer to an array of bytes to store the result */
8643 int n_out;
8644 int * outlen; /* the length of @out */
8645 int n_outlen;
8646 unsigned char * in; /* a pointer to an array of ISO Latin 1 chars */
8647 int n_in;
8648 int * inlen; /* the length of @in */
8649 int n_inlen;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008650
Daniel Veillardce682bc2004-11-05 17:22:25 +00008651 for (n_out = 0;n_out < gen_nb_unsigned_char_ptr;n_out++) {
8652 for (n_outlen = 0;n_outlen < gen_nb_int_ptr;n_outlen++) {
8653 for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) {
8654 for (n_inlen = 0;n_inlen < gen_nb_int_ptr;n_inlen++) {
8655 mem_base = xmlMemBlocks();
8656 out = gen_unsigned_char_ptr(n_out, 0);
8657 outlen = gen_int_ptr(n_outlen, 1);
8658 in = gen_const_unsigned_char_ptr(n_in, 2);
8659 inlen = gen_int_ptr(n_inlen, 3);
8660
8661 ret_val = isolat1ToUTF8(out, outlen, in, inlen);
8662 desret_int(ret_val);
8663 call_tests++;
8664 des_unsigned_char_ptr(n_out, out, 0);
8665 des_int_ptr(n_outlen, outlen, 1);
8666 des_const_unsigned_char_ptr(n_in, in, 2);
8667 des_int_ptr(n_inlen, inlen, 3);
8668 xmlResetLastError();
8669 if (mem_base != xmlMemBlocks()) {
8670 printf("Leak of %d blocks found in isolat1ToUTF8",
8671 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008672 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008673 printf(" %d", n_out);
8674 printf(" %d", n_outlen);
8675 printf(" %d", n_in);
8676 printf(" %d", n_inlen);
8677 printf("\n");
8678 }
8679 }
8680 }
8681 }
8682 }
8683
8684 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00008685 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008686}
8687
8688
8689static int
8690test_xmlAddEncodingAlias(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008691 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008692
8693 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008694 char * name; /* the encoding name as parsed, in UTF-8 format (ASCII actually) */
Daniel Veillardd93f6252004-11-02 15:53:51 +00008695 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008696 char * alias; /* the alias name as parsed, in UTF-8 format (ASCII actually) */
Daniel Veillardd93f6252004-11-02 15:53:51 +00008697 int n_alias;
8698
8699 for (n_name = 0;n_name < gen_nb_const_char_ptr;n_name++) {
8700 for (n_alias = 0;n_alias < gen_nb_const_char_ptr;n_alias++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +00008701 name = gen_const_char_ptr(n_name, 0);
8702 alias = gen_const_char_ptr(n_alias, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008703
8704 ret_val = xmlAddEncodingAlias(name, alias);
8705 desret_int(ret_val);
8706 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00008707 des_const_char_ptr(n_name, name, 0);
8708 des_const_char_ptr(n_alias, alias, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008709 xmlResetLastError();
8710 }
8711 }
8712
Daniel Veillard3d97e662004-11-04 10:49:00 +00008713 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00008714 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008715}
8716
8717
Daniel Veillardce682bc2004-11-05 17:22:25 +00008718#define gen_nb_xmlCharEncodingHandler_ptr 1
8719static xmlCharEncodingHandler * gen_xmlCharEncodingHandler_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
8720 return(NULL);
8721}
8722static void des_xmlCharEncodingHandler_ptr(int no ATTRIBUTE_UNUSED, xmlCharEncodingHandler * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
8723}
8724
Daniel Veillardd93f6252004-11-02 15:53:51 +00008725static int
8726test_xmlCharEncCloseFunc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008727 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008728
Daniel Veillardce682bc2004-11-05 17:22:25 +00008729 int mem_base;
8730 int ret_val;
8731 xmlCharEncodingHandler * handler; /* char enconding transformation data structure */
8732 int n_handler;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008733
Daniel Veillardce682bc2004-11-05 17:22:25 +00008734 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandler_ptr;n_handler++) {
8735 mem_base = xmlMemBlocks();
8736 handler = gen_xmlCharEncodingHandler_ptr(n_handler, 0);
8737
8738 ret_val = xmlCharEncCloseFunc(handler);
8739 desret_int(ret_val);
8740 call_tests++;
8741 des_xmlCharEncodingHandler_ptr(n_handler, handler, 0);
8742 xmlResetLastError();
8743 if (mem_base != xmlMemBlocks()) {
8744 printf("Leak of %d blocks found in xmlCharEncCloseFunc",
8745 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008746 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008747 printf(" %d", n_handler);
8748 printf("\n");
8749 }
8750 }
8751
8752 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00008753 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008754}
8755
8756
8757static int
8758test_xmlCharEncFirstLine(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008759 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008760
Daniel Veillardce682bc2004-11-05 17:22:25 +00008761 int mem_base;
8762 int ret_val;
8763 xmlCharEncodingHandler * handler; /* char enconding transformation data structure */
8764 int n_handler;
8765 xmlBufferPtr out; /* an xmlBuffer for the output. */
8766 int n_out;
8767 xmlBufferPtr in; /* an xmlBuffer for the input */
8768 int n_in;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008769
Daniel Veillardce682bc2004-11-05 17:22:25 +00008770 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandler_ptr;n_handler++) {
8771 for (n_out = 0;n_out < gen_nb_xmlBufferPtr;n_out++) {
8772 for (n_in = 0;n_in < gen_nb_xmlBufferPtr;n_in++) {
8773 mem_base = xmlMemBlocks();
8774 handler = gen_xmlCharEncodingHandler_ptr(n_handler, 0);
8775 out = gen_xmlBufferPtr(n_out, 1);
8776 in = gen_xmlBufferPtr(n_in, 2);
8777
8778 ret_val = xmlCharEncFirstLine(handler, out, in);
8779 desret_int(ret_val);
8780 call_tests++;
8781 des_xmlCharEncodingHandler_ptr(n_handler, handler, 0);
8782 des_xmlBufferPtr(n_out, out, 1);
8783 des_xmlBufferPtr(n_in, in, 2);
8784 xmlResetLastError();
8785 if (mem_base != xmlMemBlocks()) {
8786 printf("Leak of %d blocks found in xmlCharEncFirstLine",
8787 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008788 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008789 printf(" %d", n_handler);
8790 printf(" %d", n_out);
8791 printf(" %d", n_in);
8792 printf("\n");
8793 }
8794 }
8795 }
8796 }
8797
8798 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00008799 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008800}
8801
8802
8803static int
8804test_xmlCharEncInFunc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008805 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008806
Daniel Veillardce682bc2004-11-05 17:22:25 +00008807 int mem_base;
8808 int ret_val;
8809 xmlCharEncodingHandler * handler; /* char encoding transformation data structure */
8810 int n_handler;
8811 xmlBufferPtr out; /* an xmlBuffer for the output. */
8812 int n_out;
8813 xmlBufferPtr in; /* an xmlBuffer for the input */
8814 int n_in;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008815
Daniel Veillardce682bc2004-11-05 17:22:25 +00008816 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandler_ptr;n_handler++) {
8817 for (n_out = 0;n_out < gen_nb_xmlBufferPtr;n_out++) {
8818 for (n_in = 0;n_in < gen_nb_xmlBufferPtr;n_in++) {
8819 mem_base = xmlMemBlocks();
8820 handler = gen_xmlCharEncodingHandler_ptr(n_handler, 0);
8821 out = gen_xmlBufferPtr(n_out, 1);
8822 in = gen_xmlBufferPtr(n_in, 2);
8823
8824 ret_val = xmlCharEncInFunc(handler, out, in);
8825 desret_int(ret_val);
8826 call_tests++;
8827 des_xmlCharEncodingHandler_ptr(n_handler, handler, 0);
8828 des_xmlBufferPtr(n_out, out, 1);
8829 des_xmlBufferPtr(n_in, in, 2);
8830 xmlResetLastError();
8831 if (mem_base != xmlMemBlocks()) {
8832 printf("Leak of %d blocks found in xmlCharEncInFunc",
8833 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008834 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008835 printf(" %d", n_handler);
8836 printf(" %d", n_out);
8837 printf(" %d", n_in);
8838 printf("\n");
8839 }
8840 }
8841 }
8842 }
8843
8844 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00008845 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008846}
8847
8848
8849static int
8850test_xmlCharEncOutFunc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008851 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008852
Daniel Veillardce682bc2004-11-05 17:22:25 +00008853 int mem_base;
8854 int ret_val;
8855 xmlCharEncodingHandler * handler; /* char enconding transformation data structure */
8856 int n_handler;
8857 xmlBufferPtr out; /* an xmlBuffer for the output. */
8858 int n_out;
8859 xmlBufferPtr in; /* an xmlBuffer for the input */
8860 int n_in;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008861
Daniel Veillardce682bc2004-11-05 17:22:25 +00008862 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandler_ptr;n_handler++) {
8863 for (n_out = 0;n_out < gen_nb_xmlBufferPtr;n_out++) {
8864 for (n_in = 0;n_in < gen_nb_xmlBufferPtr;n_in++) {
8865 mem_base = xmlMemBlocks();
8866 handler = gen_xmlCharEncodingHandler_ptr(n_handler, 0);
8867 out = gen_xmlBufferPtr(n_out, 1);
8868 in = gen_xmlBufferPtr(n_in, 2);
8869
8870 ret_val = xmlCharEncOutFunc(handler, out, in);
8871 desret_int(ret_val);
8872 call_tests++;
8873 des_xmlCharEncodingHandler_ptr(n_handler, handler, 0);
8874 des_xmlBufferPtr(n_out, out, 1);
8875 des_xmlBufferPtr(n_in, in, 2);
8876 xmlResetLastError();
8877 if (mem_base != xmlMemBlocks()) {
8878 printf("Leak of %d blocks found in xmlCharEncOutFunc",
8879 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008880 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008881 printf(" %d", n_handler);
8882 printf(" %d", n_out);
8883 printf(" %d", n_in);
8884 printf("\n");
8885 }
8886 }
8887 }
8888 }
8889
8890 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00008891 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008892}
8893
8894
8895static int
8896test_xmlCleanupCharEncodingHandlers(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008897 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008898
8899
8900
8901 xmlCleanupCharEncodingHandlers();
8902 call_tests++;
8903 xmlResetLastError();
8904
Daniel Veillard3d97e662004-11-04 10:49:00 +00008905 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00008906 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008907}
8908
8909
8910static int
8911test_xmlCleanupEncodingAliases(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008912 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008913
8914 int mem_base;
8915
8916 mem_base = xmlMemBlocks();
8917
8918 xmlCleanupEncodingAliases();
8919 call_tests++;
8920 xmlResetLastError();
8921 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00008922 printf("Leak of %d blocks found in xmlCleanupEncodingAliases",
Daniel Veillardd93f6252004-11-02 15:53:51 +00008923 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008924 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00008925 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00008926 }
8927
Daniel Veillard3d97e662004-11-04 10:49:00 +00008928 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00008929 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008930}
8931
8932
8933static int
8934test_xmlDelEncodingAlias(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008935 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008936
8937 int mem_base;
8938 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008939 char * alias; /* the alias name as parsed, in UTF-8 format (ASCII actually) */
Daniel Veillardd93f6252004-11-02 15:53:51 +00008940 int n_alias;
8941
8942 for (n_alias = 0;n_alias < gen_nb_const_char_ptr;n_alias++) {
8943 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00008944 alias = gen_const_char_ptr(n_alias, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008945
8946 ret_val = xmlDelEncodingAlias(alias);
8947 desret_int(ret_val);
8948 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00008949 des_const_char_ptr(n_alias, alias, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008950 xmlResetLastError();
8951 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00008952 printf("Leak of %d blocks found in xmlDelEncodingAlias",
Daniel Veillardd93f6252004-11-02 15:53:51 +00008953 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008954 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00008955 printf(" %d", n_alias);
8956 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00008957 }
8958 }
8959
Daniel Veillard3d97e662004-11-04 10:49:00 +00008960 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00008961 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008962}
8963
8964
8965static int
8966test_xmlDetectCharEncoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008967 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008968
Daniel Veillardce682bc2004-11-05 17:22:25 +00008969 int mem_base;
8970 xmlCharEncoding ret_val;
8971 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). */
8972 int n_in;
8973 int len; /* pointer to the length of the buffer */
8974 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008975
Daniel Veillardce682bc2004-11-05 17:22:25 +00008976 for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) {
8977 for (n_len = 0;n_len < gen_nb_int;n_len++) {
8978 mem_base = xmlMemBlocks();
8979 in = gen_const_unsigned_char_ptr(n_in, 0);
8980 len = gen_int(n_len, 1);
8981
8982 ret_val = xmlDetectCharEncoding(in, len);
8983 desret_xmlCharEncoding(ret_val);
8984 call_tests++;
8985 des_const_unsigned_char_ptr(n_in, in, 0);
8986 des_int(n_len, len, 1);
8987 xmlResetLastError();
8988 if (mem_base != xmlMemBlocks()) {
8989 printf("Leak of %d blocks found in xmlDetectCharEncoding",
8990 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008991 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008992 printf(" %d", n_in);
8993 printf(" %d", n_len);
8994 printf("\n");
8995 }
8996 }
8997 }
8998
8999 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00009000 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009001}
9002
9003
9004static int
9005test_xmlFindCharEncodingHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009006 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009007
9008
9009 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00009010 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009011}
9012
9013
9014static int
9015test_xmlGetCharEncodingHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009016 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009017
9018
9019 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00009020 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009021}
9022
9023
9024static int
9025test_xmlGetCharEncodingName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009026 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009027
Daniel Veillard3d97e662004-11-04 10:49:00 +00009028 int mem_base;
9029 const char * ret_val;
9030 xmlCharEncoding enc; /* the encoding */
9031 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009032
Daniel Veillard3d97e662004-11-04 10:49:00 +00009033 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
9034 mem_base = xmlMemBlocks();
9035 enc = gen_xmlCharEncoding(n_enc, 0);
9036
9037 ret_val = xmlGetCharEncodingName(enc);
9038 desret_const_char_ptr(ret_val);
9039 call_tests++;
9040 des_xmlCharEncoding(n_enc, enc, 0);
9041 xmlResetLastError();
9042 if (mem_base != xmlMemBlocks()) {
9043 printf("Leak of %d blocks found in xmlGetCharEncodingName",
9044 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009045 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009046 printf(" %d", n_enc);
9047 printf("\n");
9048 }
9049 }
9050
9051 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00009052 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009053}
9054
9055
9056static int
9057test_xmlGetEncodingAlias(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009058 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009059
9060 int mem_base;
9061 const char * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009062 char * alias; /* the alias name as parsed, in UTF-8 format (ASCII actually) */
Daniel Veillardd93f6252004-11-02 15:53:51 +00009063 int n_alias;
9064
9065 for (n_alias = 0;n_alias < gen_nb_const_char_ptr;n_alias++) {
9066 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009067 alias = gen_const_char_ptr(n_alias, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009068
9069 ret_val = xmlGetEncodingAlias(alias);
9070 desret_const_char_ptr(ret_val);
9071 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009072 des_const_char_ptr(n_alias, alias, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009073 xmlResetLastError();
9074 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00009075 printf("Leak of %d blocks found in xmlGetEncodingAlias",
Daniel Veillardd93f6252004-11-02 15:53:51 +00009076 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009077 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00009078 printf(" %d", n_alias);
9079 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00009080 }
9081 }
9082
Daniel Veillard3d97e662004-11-04 10:49:00 +00009083 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00009084 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009085}
9086
9087
9088static int
9089test_xmlInitCharEncodingHandlers(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009090 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009091
9092
9093
9094 xmlInitCharEncodingHandlers();
9095 call_tests++;
9096 xmlResetLastError();
9097
Daniel Veillard3d97e662004-11-04 10:49:00 +00009098 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00009099 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009100}
9101
9102
9103static int
9104test_xmlNewCharEncodingHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009105 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009106
9107
9108 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00009109 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009110}
9111
9112
9113static int
9114test_xmlParseCharEncoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009115 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009116
Daniel Veillard3d97e662004-11-04 10:49:00 +00009117 int mem_base;
9118 xmlCharEncoding ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009119 char * name; /* the encoding name as parsed, in UTF-8 format (ASCII actually) */
Daniel Veillard3d97e662004-11-04 10:49:00 +00009120 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009121
Daniel Veillard3d97e662004-11-04 10:49:00 +00009122 for (n_name = 0;n_name < gen_nb_const_char_ptr;n_name++) {
9123 mem_base = xmlMemBlocks();
9124 name = gen_const_char_ptr(n_name, 0);
9125
9126 ret_val = xmlParseCharEncoding(name);
9127 desret_xmlCharEncoding(ret_val);
9128 call_tests++;
9129 des_const_char_ptr(n_name, name, 0);
9130 xmlResetLastError();
9131 if (mem_base != xmlMemBlocks()) {
9132 printf("Leak of %d blocks found in xmlParseCharEncoding",
9133 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009134 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009135 printf(" %d", n_name);
9136 printf("\n");
9137 }
9138 }
9139
9140 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00009141 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009142}
9143
9144
Daniel Veillardce682bc2004-11-05 17:22:25 +00009145#define gen_nb_xmlCharEncodingHandlerPtr 1
9146static xmlCharEncodingHandlerPtr gen_xmlCharEncodingHandlerPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
9147 return(NULL);
9148}
9149static void des_xmlCharEncodingHandlerPtr(int no ATTRIBUTE_UNUSED, xmlCharEncodingHandlerPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
9150}
9151
Daniel Veillardd93f6252004-11-02 15:53:51 +00009152static int
9153test_xmlRegisterCharEncodingHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009154 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009155
Daniel Veillardce682bc2004-11-05 17:22:25 +00009156 int mem_base;
9157 xmlCharEncodingHandlerPtr handler; /* the xmlCharEncodingHandlerPtr handler block */
9158 int n_handler;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009159
Daniel Veillardce682bc2004-11-05 17:22:25 +00009160 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandlerPtr;n_handler++) {
9161 mem_base = xmlMemBlocks();
9162 handler = gen_xmlCharEncodingHandlerPtr(n_handler, 0);
9163
9164 xmlRegisterCharEncodingHandler(handler);
9165 call_tests++;
9166 des_xmlCharEncodingHandlerPtr(n_handler, handler, 0);
9167 xmlResetLastError();
9168 if (mem_base != xmlMemBlocks()) {
9169 printf("Leak of %d blocks found in xmlRegisterCharEncodingHandler",
9170 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009171 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009172 printf(" %d", n_handler);
9173 printf("\n");
9174 }
9175 }
9176
9177 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00009178 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009179}
9180
9181static int
9182test_encoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009183 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009184
Daniel Veillardce682bc2004-11-05 17:22:25 +00009185 printf("Testing encoding : 16 of 19 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00009186 test_ret += test_UTF8Toisolat1();
9187 test_ret += test_isolat1ToUTF8();
9188 test_ret += test_xmlAddEncodingAlias();
9189 test_ret += test_xmlCharEncCloseFunc();
9190 test_ret += test_xmlCharEncFirstLine();
9191 test_ret += test_xmlCharEncInFunc();
9192 test_ret += test_xmlCharEncOutFunc();
9193 test_ret += test_xmlCleanupCharEncodingHandlers();
9194 test_ret += test_xmlCleanupEncodingAliases();
9195 test_ret += test_xmlDelEncodingAlias();
9196 test_ret += test_xmlDetectCharEncoding();
9197 test_ret += test_xmlFindCharEncodingHandler();
9198 test_ret += test_xmlGetCharEncodingHandler();
9199 test_ret += test_xmlGetCharEncodingName();
9200 test_ret += test_xmlGetEncodingAlias();
9201 test_ret += test_xmlInitCharEncodingHandlers();
9202 test_ret += test_xmlNewCharEncodingHandler();
9203 test_ret += test_xmlParseCharEncoding();
9204 test_ret += test_xmlRegisterCharEncodingHandler();
Daniel Veillardd93f6252004-11-02 15:53:51 +00009205
Daniel Veillard42595322004-11-08 10:52:06 +00009206 if (test_ret != 0)
9207 printf("Module encoding: %d errors\n", test_ret);
9208 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009209}
9210
9211static int
9212test_xmlAddDocEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009213 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009214
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009215 int mem_base;
9216 xmlEntityPtr ret_val;
9217 xmlDocPtr doc; /* the document */
9218 int n_doc;
9219 xmlChar * name; /* the entity name */
9220 int n_name;
9221 int type; /* the entity type XML_xxx_yyy_ENTITY */
9222 int n_type;
9223 xmlChar * ExternalID; /* the entity external ID if available */
9224 int n_ExternalID;
9225 xmlChar * SystemID; /* the entity system ID if available */
9226 int n_SystemID;
9227 xmlChar * content; /* the entity content */
9228 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009229
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009230 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
9231 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9232 for (n_type = 0;n_type < gen_nb_int;n_type++) {
9233 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
9234 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
9235 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
9236 mem_base = xmlMemBlocks();
9237 doc = gen_xmlDocPtr(n_doc, 0);
9238 name = gen_const_xmlChar_ptr(n_name, 1);
9239 type = gen_int(n_type, 2);
9240 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 3);
9241 SystemID = gen_const_xmlChar_ptr(n_SystemID, 4);
9242 content = gen_const_xmlChar_ptr(n_content, 5);
9243
9244 ret_val = xmlAddDocEntity(doc, name, type, ExternalID, SystemID, content);
9245 desret_xmlEntityPtr(ret_val);
9246 call_tests++;
9247 des_xmlDocPtr(n_doc, doc, 0);
9248 des_const_xmlChar_ptr(n_name, name, 1);
9249 des_int(n_type, type, 2);
9250 des_const_xmlChar_ptr(n_ExternalID, ExternalID, 3);
9251 des_const_xmlChar_ptr(n_SystemID, SystemID, 4);
9252 des_const_xmlChar_ptr(n_content, content, 5);
9253 xmlResetLastError();
9254 if (mem_base != xmlMemBlocks()) {
9255 printf("Leak of %d blocks found in xmlAddDocEntity",
9256 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009257 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009258 printf(" %d", n_doc);
9259 printf(" %d", n_name);
9260 printf(" %d", n_type);
9261 printf(" %d", n_ExternalID);
9262 printf(" %d", n_SystemID);
9263 printf(" %d", n_content);
9264 printf("\n");
9265 }
9266 }
9267 }
9268 }
9269 }
9270 }
9271 }
9272
9273 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00009274 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009275}
9276
9277
9278static int
9279test_xmlAddDtdEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009280 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009281
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009282 int mem_base;
9283 xmlEntityPtr ret_val;
9284 xmlDocPtr doc; /* the document */
9285 int n_doc;
9286 xmlChar * name; /* the entity name */
9287 int n_name;
9288 int type; /* the entity type XML_xxx_yyy_ENTITY */
9289 int n_type;
9290 xmlChar * ExternalID; /* the entity external ID if available */
9291 int n_ExternalID;
9292 xmlChar * SystemID; /* the entity system ID if available */
9293 int n_SystemID;
9294 xmlChar * content; /* the entity content */
9295 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009296
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009297 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
9298 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9299 for (n_type = 0;n_type < gen_nb_int;n_type++) {
9300 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
9301 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
9302 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
9303 mem_base = xmlMemBlocks();
9304 doc = gen_xmlDocPtr(n_doc, 0);
9305 name = gen_const_xmlChar_ptr(n_name, 1);
9306 type = gen_int(n_type, 2);
9307 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 3);
9308 SystemID = gen_const_xmlChar_ptr(n_SystemID, 4);
9309 content = gen_const_xmlChar_ptr(n_content, 5);
9310
9311 ret_val = xmlAddDtdEntity(doc, name, type, ExternalID, SystemID, content);
9312 desret_xmlEntityPtr(ret_val);
9313 call_tests++;
9314 des_xmlDocPtr(n_doc, doc, 0);
9315 des_const_xmlChar_ptr(n_name, name, 1);
9316 des_int(n_type, type, 2);
9317 des_const_xmlChar_ptr(n_ExternalID, ExternalID, 3);
9318 des_const_xmlChar_ptr(n_SystemID, SystemID, 4);
9319 des_const_xmlChar_ptr(n_content, content, 5);
9320 xmlResetLastError();
9321 if (mem_base != xmlMemBlocks()) {
9322 printf("Leak of %d blocks found in xmlAddDtdEntity",
9323 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009324 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009325 printf(" %d", n_doc);
9326 printf(" %d", n_name);
9327 printf(" %d", n_type);
9328 printf(" %d", n_ExternalID);
9329 printf(" %d", n_SystemID);
9330 printf(" %d", n_content);
9331 printf("\n");
9332 }
9333 }
9334 }
9335 }
9336 }
9337 }
9338 }
9339
9340 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00009341 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009342}
9343
9344
9345static int
9346test_xmlCleanupPredefinedEntities(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009347 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009348
Daniel Veillarda521d282004-11-09 14:59:59 +00009349#ifdef LIBXML_LEGACY_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +00009350 int mem_base;
9351
9352 mem_base = xmlMemBlocks();
9353
9354 xmlCleanupPredefinedEntities();
9355 call_tests++;
9356 xmlResetLastError();
9357 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00009358 printf("Leak of %d blocks found in xmlCleanupPredefinedEntities",
Daniel Veillardd93f6252004-11-02 15:53:51 +00009359 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009360 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00009361 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00009362 }
Daniel Veillarda521d282004-11-09 14:59:59 +00009363#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +00009364
Daniel Veillard3d97e662004-11-04 10:49:00 +00009365 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00009366 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009367}
9368
9369
Daniel Veillardce682bc2004-11-05 17:22:25 +00009370#define gen_nb_xmlEntitiesTablePtr 1
9371static xmlEntitiesTablePtr gen_xmlEntitiesTablePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
9372 return(NULL);
9373}
9374static void des_xmlEntitiesTablePtr(int no ATTRIBUTE_UNUSED, xmlEntitiesTablePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
9375}
9376
Daniel Veillardd93f6252004-11-02 15:53:51 +00009377static int
9378test_xmlCopyEntitiesTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009379 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009380
9381
9382 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00009383 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009384}
9385
9386
9387static int
9388test_xmlCreateEntitiesTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009389 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009390
9391
9392 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00009393 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009394}
9395
9396
9397static int
9398test_xmlDumpEntitiesTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009399 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009400
Daniel Veillardce682bc2004-11-05 17:22:25 +00009401#ifdef LIBXML_OUTPUT_ENABLED
9402 int mem_base;
9403 xmlBufferPtr buf; /* An XML buffer. */
9404 int n_buf;
9405 xmlEntitiesTablePtr table; /* An entity table */
9406 int n_table;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009407
Daniel Veillardce682bc2004-11-05 17:22:25 +00009408 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
9409 for (n_table = 0;n_table < gen_nb_xmlEntitiesTablePtr;n_table++) {
9410 mem_base = xmlMemBlocks();
9411 buf = gen_xmlBufferPtr(n_buf, 0);
9412 table = gen_xmlEntitiesTablePtr(n_table, 1);
9413
9414 xmlDumpEntitiesTable(buf, table);
9415 call_tests++;
9416 des_xmlBufferPtr(n_buf, buf, 0);
9417 des_xmlEntitiesTablePtr(n_table, table, 1);
9418 xmlResetLastError();
9419 if (mem_base != xmlMemBlocks()) {
9420 printf("Leak of %d blocks found in xmlDumpEntitiesTable",
9421 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009422 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009423 printf(" %d", n_buf);
9424 printf(" %d", n_table);
9425 printf("\n");
9426 }
9427 }
9428 }
9429#endif
9430
9431 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00009432 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009433}
9434
9435
Daniel Veillardce682bc2004-11-05 17:22:25 +00009436#define gen_nb_xmlEntityPtr 1
9437static xmlEntityPtr gen_xmlEntityPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
9438 return(NULL);
9439}
9440static void des_xmlEntityPtr(int no ATTRIBUTE_UNUSED, xmlEntityPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
9441}
9442
Daniel Veillardd93f6252004-11-02 15:53:51 +00009443static int
9444test_xmlDumpEntityDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009445 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009446
Daniel Veillardce682bc2004-11-05 17:22:25 +00009447#ifdef LIBXML_OUTPUT_ENABLED
9448 int mem_base;
9449 xmlBufferPtr buf; /* An XML buffer. */
9450 int n_buf;
9451 xmlEntityPtr ent; /* An entity table */
9452 int n_ent;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009453
Daniel Veillardce682bc2004-11-05 17:22:25 +00009454 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
9455 for (n_ent = 0;n_ent < gen_nb_xmlEntityPtr;n_ent++) {
9456 mem_base = xmlMemBlocks();
9457 buf = gen_xmlBufferPtr(n_buf, 0);
9458 ent = gen_xmlEntityPtr(n_ent, 1);
9459
9460 xmlDumpEntityDecl(buf, ent);
9461 call_tests++;
9462 des_xmlBufferPtr(n_buf, buf, 0);
9463 des_xmlEntityPtr(n_ent, ent, 1);
9464 xmlResetLastError();
9465 if (mem_base != xmlMemBlocks()) {
9466 printf("Leak of %d blocks found in xmlDumpEntityDecl",
9467 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009468 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009469 printf(" %d", n_buf);
9470 printf(" %d", n_ent);
9471 printf("\n");
9472 }
9473 }
9474 }
9475#endif
9476
9477 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00009478 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009479}
9480
9481
9482static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00009483test_xmlEncodeEntitiesReentrant(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009484 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009485
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009486 int mem_base;
9487 xmlChar * ret_val;
9488 xmlDocPtr doc; /* the document containing the string */
9489 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009490 xmlChar * input; /* A string to convert to XML. */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009491 int n_input;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009492
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009493 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
9494 for (n_input = 0;n_input < gen_nb_const_xmlChar_ptr;n_input++) {
9495 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009496 doc = gen_xmlDocPtr(n_doc, 0);
9497 input = gen_const_xmlChar_ptr(n_input, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009498
9499 ret_val = xmlEncodeEntitiesReentrant(doc, input);
9500 desret_xmlChar_ptr(ret_val);
9501 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009502 des_xmlDocPtr(n_doc, doc, 0);
9503 des_const_xmlChar_ptr(n_input, input, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009504 xmlResetLastError();
9505 if (mem_base != xmlMemBlocks()) {
9506 printf("Leak of %d blocks found in xmlEncodeEntitiesReentrant",
9507 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009508 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009509 printf(" %d", n_doc);
9510 printf(" %d", n_input);
9511 printf("\n");
9512 }
9513 }
9514 }
9515
Daniel Veillard3d97e662004-11-04 10:49:00 +00009516 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00009517 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009518}
9519
9520
9521static int
9522test_xmlEncodeSpecialChars(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009523 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009524
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009525 int mem_base;
9526 xmlChar * ret_val;
9527 xmlDocPtr doc; /* the document containing the string */
9528 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009529 xmlChar * input; /* A string to convert to XML. */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009530 int n_input;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009531
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009532 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
9533 for (n_input = 0;n_input < gen_nb_const_xmlChar_ptr;n_input++) {
9534 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009535 doc = gen_xmlDocPtr(n_doc, 0);
9536 input = gen_const_xmlChar_ptr(n_input, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009537
9538 ret_val = xmlEncodeSpecialChars(doc, input);
9539 desret_xmlChar_ptr(ret_val);
9540 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009541 des_xmlDocPtr(n_doc, doc, 0);
9542 des_const_xmlChar_ptr(n_input, input, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009543 xmlResetLastError();
9544 if (mem_base != xmlMemBlocks()) {
9545 printf("Leak of %d blocks found in xmlEncodeSpecialChars",
9546 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009547 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009548 printf(" %d", n_doc);
9549 printf(" %d", n_input);
9550 printf("\n");
9551 }
9552 }
9553 }
9554
Daniel Veillard3d97e662004-11-04 10:49:00 +00009555 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00009556 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009557}
9558
9559
9560static int
9561test_xmlGetDocEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009562 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009563
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009564 int mem_base;
9565 xmlEntityPtr ret_val;
9566 xmlDocPtr doc; /* the document referencing the entity */
9567 int n_doc;
9568 xmlChar * name; /* the entity name */
9569 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009570
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009571 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
9572 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9573 mem_base = xmlMemBlocks();
9574 doc = gen_xmlDocPtr(n_doc, 0);
9575 name = gen_const_xmlChar_ptr(n_name, 1);
9576
9577 ret_val = xmlGetDocEntity(doc, name);
9578 desret_xmlEntityPtr(ret_val);
9579 call_tests++;
9580 des_xmlDocPtr(n_doc, doc, 0);
9581 des_const_xmlChar_ptr(n_name, name, 1);
9582 xmlResetLastError();
9583 if (mem_base != xmlMemBlocks()) {
9584 printf("Leak of %d blocks found in xmlGetDocEntity",
9585 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009586 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009587 printf(" %d", n_doc);
9588 printf(" %d", n_name);
9589 printf("\n");
9590 }
9591 }
9592 }
9593
9594 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00009595 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009596}
9597
9598
9599static int
9600test_xmlGetDtdEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009601 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009602
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009603 int mem_base;
9604 xmlEntityPtr ret_val;
9605 xmlDocPtr doc; /* the document referencing the entity */
9606 int n_doc;
9607 xmlChar * name; /* the entity name */
9608 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009609
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009610 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
9611 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9612 mem_base = xmlMemBlocks();
9613 doc = gen_xmlDocPtr(n_doc, 0);
9614 name = gen_const_xmlChar_ptr(n_name, 1);
9615
9616 ret_val = xmlGetDtdEntity(doc, name);
9617 desret_xmlEntityPtr(ret_val);
9618 call_tests++;
9619 des_xmlDocPtr(n_doc, doc, 0);
9620 des_const_xmlChar_ptr(n_name, name, 1);
9621 xmlResetLastError();
9622 if (mem_base != xmlMemBlocks()) {
9623 printf("Leak of %d blocks found in xmlGetDtdEntity",
9624 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009625 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009626 printf(" %d", n_doc);
9627 printf(" %d", n_name);
9628 printf("\n");
9629 }
9630 }
9631 }
9632
9633 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00009634 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009635}
9636
9637
9638static int
9639test_xmlGetParameterEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009640 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009641
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009642 int mem_base;
9643 xmlEntityPtr ret_val;
9644 xmlDocPtr doc; /* the document referencing the entity */
9645 int n_doc;
9646 xmlChar * name; /* the entity name */
9647 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009648
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009649 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
9650 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9651 mem_base = xmlMemBlocks();
9652 doc = gen_xmlDocPtr(n_doc, 0);
9653 name = gen_const_xmlChar_ptr(n_name, 1);
9654
9655 ret_val = xmlGetParameterEntity(doc, name);
9656 desret_xmlEntityPtr(ret_val);
9657 call_tests++;
9658 des_xmlDocPtr(n_doc, doc, 0);
9659 des_const_xmlChar_ptr(n_name, name, 1);
9660 xmlResetLastError();
9661 if (mem_base != xmlMemBlocks()) {
9662 printf("Leak of %d blocks found in xmlGetParameterEntity",
9663 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009664 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009665 printf(" %d", n_doc);
9666 printf(" %d", n_name);
9667 printf("\n");
9668 }
9669 }
9670 }
9671
9672 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00009673 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009674}
9675
9676
9677static int
9678test_xmlGetPredefinedEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009679 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009680
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009681 int mem_base;
9682 xmlEntityPtr ret_val;
9683 xmlChar * name; /* the entity name */
9684 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009685
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009686 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9687 mem_base = xmlMemBlocks();
9688 name = gen_const_xmlChar_ptr(n_name, 0);
9689
9690 ret_val = xmlGetPredefinedEntity(name);
9691 desret_xmlEntityPtr(ret_val);
9692 call_tests++;
9693 des_const_xmlChar_ptr(n_name, name, 0);
9694 xmlResetLastError();
9695 if (mem_base != xmlMemBlocks()) {
9696 printf("Leak of %d blocks found in xmlGetPredefinedEntity",
9697 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009698 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009699 printf(" %d", n_name);
9700 printf("\n");
9701 }
9702 }
9703
9704 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00009705 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009706}
9707
9708
9709static int
9710test_xmlInitializePredefinedEntities(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009711 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009712
Daniel Veillarda521d282004-11-09 14:59:59 +00009713#ifdef LIBXML_LEGACY_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +00009714 int mem_base;
9715
9716 mem_base = xmlMemBlocks();
9717
9718 xmlInitializePredefinedEntities();
9719 call_tests++;
9720 xmlResetLastError();
9721 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00009722 printf("Leak of %d blocks found in xmlInitializePredefinedEntities",
Daniel Veillardd93f6252004-11-02 15:53:51 +00009723 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009724 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00009725 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00009726 }
Daniel Veillarda521d282004-11-09 14:59:59 +00009727#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +00009728
Daniel Veillard3d97e662004-11-04 10:49:00 +00009729 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00009730 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009731}
9732
9733static int
9734test_entities(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009735 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009736
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009737 printf("Testing entities : 12 of 16 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00009738 test_ret += test_xmlAddDocEntity();
9739 test_ret += test_xmlAddDtdEntity();
9740 test_ret += test_xmlCleanupPredefinedEntities();
9741 test_ret += test_xmlCopyEntitiesTable();
9742 test_ret += test_xmlCreateEntitiesTable();
9743 test_ret += test_xmlDumpEntitiesTable();
9744 test_ret += test_xmlDumpEntityDecl();
9745 test_ret += test_xmlEncodeEntitiesReentrant();
9746 test_ret += test_xmlEncodeSpecialChars();
9747 test_ret += test_xmlGetDocEntity();
9748 test_ret += test_xmlGetDtdEntity();
9749 test_ret += test_xmlGetParameterEntity();
9750 test_ret += test_xmlGetPredefinedEntity();
9751 test_ret += test_xmlInitializePredefinedEntities();
Daniel Veillardd93f6252004-11-02 15:53:51 +00009752
Daniel Veillard42595322004-11-08 10:52:06 +00009753 if (test_ret != 0)
9754 printf("Module entities: %d errors\n", test_ret);
9755 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009756}
9757
9758static int
9759test_xmlHashAddEntry(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009760 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009761
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009762 int mem_base;
9763 int ret_val;
9764 xmlHashTablePtr table; /* the hash table */
9765 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009766 xmlChar * name; /* the name of the userdata */
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009767 int n_name;
9768 void * userdata; /* a pointer to the userdata */
9769 int n_userdata;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009770
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009771 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9772 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9773 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
9774 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009775 table = gen_xmlHashTablePtr(n_table, 0);
9776 name = gen_const_xmlChar_ptr(n_name, 1);
9777 userdata = gen_userdata(n_userdata, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009778
9779 ret_val = xmlHashAddEntry(table, name, userdata);
9780 desret_int(ret_val);
9781 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009782 des_xmlHashTablePtr(n_table, table, 0);
9783 des_const_xmlChar_ptr(n_name, name, 1);
9784 des_userdata(n_userdata, userdata, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009785 xmlResetLastError();
9786 if (mem_base != xmlMemBlocks()) {
9787 printf("Leak of %d blocks found in xmlHashAddEntry",
9788 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009789 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009790 printf(" %d", n_table);
9791 printf(" %d", n_name);
9792 printf(" %d", n_userdata);
9793 printf("\n");
9794 }
9795 }
9796 }
9797 }
9798
Daniel Veillard3d97e662004-11-04 10:49:00 +00009799 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00009800 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009801}
9802
9803
9804static int
9805test_xmlHashAddEntry2(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009806 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009807
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009808 int mem_base;
9809 int ret_val;
9810 xmlHashTablePtr table; /* the hash table */
9811 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009812 xmlChar * name; /* the name of the userdata */
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009813 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009814 xmlChar * name2; /* a second name of the userdata */
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009815 int n_name2;
9816 void * userdata; /* a pointer to the userdata */
9817 int n_userdata;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009818
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009819 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9820 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9821 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
9822 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
9823 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009824 table = gen_xmlHashTablePtr(n_table, 0);
9825 name = gen_const_xmlChar_ptr(n_name, 1);
9826 name2 = gen_const_xmlChar_ptr(n_name2, 2);
9827 userdata = gen_userdata(n_userdata, 3);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009828
9829 ret_val = xmlHashAddEntry2(table, name, name2, userdata);
9830 desret_int(ret_val);
9831 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009832 des_xmlHashTablePtr(n_table, table, 0);
9833 des_const_xmlChar_ptr(n_name, name, 1);
9834 des_const_xmlChar_ptr(n_name2, name2, 2);
9835 des_userdata(n_userdata, userdata, 3);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009836 xmlResetLastError();
9837 if (mem_base != xmlMemBlocks()) {
9838 printf("Leak of %d blocks found in xmlHashAddEntry2",
9839 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009840 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009841 printf(" %d", n_table);
9842 printf(" %d", n_name);
9843 printf(" %d", n_name2);
9844 printf(" %d", n_userdata);
9845 printf("\n");
9846 }
9847 }
9848 }
9849 }
9850 }
9851
Daniel Veillard3d97e662004-11-04 10:49:00 +00009852 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00009853 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009854}
9855
9856
9857static int
9858test_xmlHashAddEntry3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009859 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009860
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009861 int mem_base;
9862 int ret_val;
9863 xmlHashTablePtr table; /* the hash table */
9864 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009865 xmlChar * name; /* the name of the userdata */
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009866 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009867 xmlChar * name2; /* a second name of the userdata */
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009868 int n_name2;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009869 xmlChar * name3; /* a third name of the userdata */
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009870 int n_name3;
9871 void * userdata; /* a pointer to the userdata */
9872 int n_userdata;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009873
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009874 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9875 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9876 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
9877 for (n_name3 = 0;n_name3 < gen_nb_const_xmlChar_ptr;n_name3++) {
9878 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
9879 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009880 table = gen_xmlHashTablePtr(n_table, 0);
9881 name = gen_const_xmlChar_ptr(n_name, 1);
9882 name2 = gen_const_xmlChar_ptr(n_name2, 2);
9883 name3 = gen_const_xmlChar_ptr(n_name3, 3);
9884 userdata = gen_userdata(n_userdata, 4);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009885
9886 ret_val = xmlHashAddEntry3(table, name, name2, name3, userdata);
9887 desret_int(ret_val);
9888 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009889 des_xmlHashTablePtr(n_table, table, 0);
9890 des_const_xmlChar_ptr(n_name, name, 1);
9891 des_const_xmlChar_ptr(n_name2, name2, 2);
9892 des_const_xmlChar_ptr(n_name3, name3, 3);
9893 des_userdata(n_userdata, userdata, 4);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009894 xmlResetLastError();
9895 if (mem_base != xmlMemBlocks()) {
9896 printf("Leak of %d blocks found in xmlHashAddEntry3",
9897 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009898 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009899 printf(" %d", n_table);
9900 printf(" %d", n_name);
9901 printf(" %d", n_name2);
9902 printf(" %d", n_name3);
9903 printf(" %d", n_userdata);
9904 printf("\n");
9905 }
9906 }
9907 }
9908 }
9909 }
9910 }
9911
Daniel Veillard3d97e662004-11-04 10:49:00 +00009912 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00009913 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009914}
9915
9916
9917static int
9918test_xmlHashCopy(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009919 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009920
9921
9922 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00009923 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009924}
9925
9926
9927static int
9928test_xmlHashCreate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009929 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009930
9931
9932 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00009933 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009934}
9935
9936
9937static int
9938test_xmlHashLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009939 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009940
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009941 int mem_base;
9942 void * ret_val;
9943 xmlHashTablePtr table; /* the hash table */
9944 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009945 xmlChar * name; /* the name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009946 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009947
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009948 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9949 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9950 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009951 table = gen_xmlHashTablePtr(n_table, 0);
9952 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009953
9954 ret_val = xmlHashLookup(table, name);
9955 desret_void_ptr(ret_val);
9956 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009957 des_xmlHashTablePtr(n_table, table, 0);
9958 des_const_xmlChar_ptr(n_name, name, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009959 xmlResetLastError();
9960 if (mem_base != xmlMemBlocks()) {
9961 printf("Leak of %d blocks found in xmlHashLookup",
9962 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009963 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009964 printf(" %d", n_table);
9965 printf(" %d", n_name);
9966 printf("\n");
9967 }
9968 }
9969 }
9970
Daniel Veillard3d97e662004-11-04 10:49:00 +00009971 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00009972 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009973}
9974
9975
9976static int
9977test_xmlHashLookup2(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009978 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009979
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009980 int mem_base;
9981 void * ret_val;
9982 xmlHashTablePtr table; /* the hash table */
9983 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009984 xmlChar * name; /* the name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009985 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009986 xmlChar * name2; /* a second name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009987 int n_name2;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009988
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009989 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9990 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9991 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
9992 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009993 table = gen_xmlHashTablePtr(n_table, 0);
9994 name = gen_const_xmlChar_ptr(n_name, 1);
9995 name2 = gen_const_xmlChar_ptr(n_name2, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009996
9997 ret_val = xmlHashLookup2(table, name, name2);
9998 desret_void_ptr(ret_val);
9999 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010000 des_xmlHashTablePtr(n_table, table, 0);
10001 des_const_xmlChar_ptr(n_name, name, 1);
10002 des_const_xmlChar_ptr(n_name2, name2, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010003 xmlResetLastError();
10004 if (mem_base != xmlMemBlocks()) {
10005 printf("Leak of %d blocks found in xmlHashLookup2",
10006 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010007 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010008 printf(" %d", n_table);
10009 printf(" %d", n_name);
10010 printf(" %d", n_name2);
10011 printf("\n");
10012 }
10013 }
10014 }
10015 }
10016
Daniel Veillard3d97e662004-11-04 10:49:00 +000010017 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000010018 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010019}
10020
10021
10022static int
10023test_xmlHashLookup3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010024 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010025
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010026 int mem_base;
10027 void * ret_val;
10028 xmlHashTablePtr table; /* the hash table */
10029 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +000010030 xmlChar * name; /* the name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010031 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000010032 xmlChar * name2; /* a second name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010033 int n_name2;
Daniel Veillardce682bc2004-11-05 17:22:25 +000010034 xmlChar * name3; /* a third name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010035 int n_name3;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010036
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010037 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10038 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
10039 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
10040 for (n_name3 = 0;n_name3 < gen_nb_const_xmlChar_ptr;n_name3++) {
10041 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010042 table = gen_xmlHashTablePtr(n_table, 0);
10043 name = gen_const_xmlChar_ptr(n_name, 1);
10044 name2 = gen_const_xmlChar_ptr(n_name2, 2);
10045 name3 = gen_const_xmlChar_ptr(n_name3, 3);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010046
10047 ret_val = xmlHashLookup3(table, name, name2, name3);
10048 desret_void_ptr(ret_val);
10049 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010050 des_xmlHashTablePtr(n_table, table, 0);
10051 des_const_xmlChar_ptr(n_name, name, 1);
10052 des_const_xmlChar_ptr(n_name2, name2, 2);
10053 des_const_xmlChar_ptr(n_name3, name3, 3);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010054 xmlResetLastError();
10055 if (mem_base != xmlMemBlocks()) {
10056 printf("Leak of %d blocks found in xmlHashLookup3",
10057 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010058 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010059 printf(" %d", n_table);
10060 printf(" %d", n_name);
10061 printf(" %d", n_name2);
10062 printf(" %d", n_name3);
10063 printf("\n");
10064 }
10065 }
10066 }
10067 }
10068 }
10069
Daniel Veillard3d97e662004-11-04 10:49:00 +000010070 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000010071 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010072}
10073
10074
10075static int
10076test_xmlHashQLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010077 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010078
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010079 int mem_base;
10080 void * ret_val;
10081 xmlHashTablePtr table; /* the hash table */
10082 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +000010083 xmlChar * prefix; /* the prefix of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010084 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +000010085 xmlChar * name; /* the name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010086 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010087
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010088 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10089 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
10090 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
10091 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010092 table = gen_xmlHashTablePtr(n_table, 0);
10093 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
10094 name = gen_const_xmlChar_ptr(n_name, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010095
10096 ret_val = xmlHashQLookup(table, prefix, name);
10097 desret_void_ptr(ret_val);
10098 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010099 des_xmlHashTablePtr(n_table, table, 0);
10100 des_const_xmlChar_ptr(n_prefix, prefix, 1);
10101 des_const_xmlChar_ptr(n_name, name, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010102 xmlResetLastError();
10103 if (mem_base != xmlMemBlocks()) {
10104 printf("Leak of %d blocks found in xmlHashQLookup",
10105 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010106 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010107 printf(" %d", n_table);
10108 printf(" %d", n_prefix);
10109 printf(" %d", n_name);
10110 printf("\n");
10111 }
10112 }
10113 }
10114 }
10115
Daniel Veillard3d97e662004-11-04 10:49:00 +000010116 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000010117 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010118}
10119
10120
10121static int
10122test_xmlHashQLookup2(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010123 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010124
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010125 int mem_base;
10126 void * ret_val;
10127 xmlHashTablePtr table; /* the hash table */
10128 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +000010129 xmlChar * prefix; /* the prefix of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010130 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +000010131 xmlChar * name; /* the name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010132 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000010133 xmlChar * prefix2; /* the second prefix of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010134 int n_prefix2;
Daniel Veillardce682bc2004-11-05 17:22:25 +000010135 xmlChar * name2; /* a second name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010136 int n_name2;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010137
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010138 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10139 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
10140 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
10141 for (n_prefix2 = 0;n_prefix2 < gen_nb_const_xmlChar_ptr;n_prefix2++) {
10142 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
10143 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010144 table = gen_xmlHashTablePtr(n_table, 0);
10145 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
10146 name = gen_const_xmlChar_ptr(n_name, 2);
10147 prefix2 = gen_const_xmlChar_ptr(n_prefix2, 3);
10148 name2 = gen_const_xmlChar_ptr(n_name2, 4);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010149
10150 ret_val = xmlHashQLookup2(table, prefix, name, prefix2, name2);
10151 desret_void_ptr(ret_val);
10152 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010153 des_xmlHashTablePtr(n_table, table, 0);
10154 des_const_xmlChar_ptr(n_prefix, prefix, 1);
10155 des_const_xmlChar_ptr(n_name, name, 2);
10156 des_const_xmlChar_ptr(n_prefix2, prefix2, 3);
10157 des_const_xmlChar_ptr(n_name2, name2, 4);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010158 xmlResetLastError();
10159 if (mem_base != xmlMemBlocks()) {
10160 printf("Leak of %d blocks found in xmlHashQLookup2",
10161 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010162 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010163 printf(" %d", n_table);
10164 printf(" %d", n_prefix);
10165 printf(" %d", n_name);
10166 printf(" %d", n_prefix2);
10167 printf(" %d", n_name2);
10168 printf("\n");
10169 }
10170 }
10171 }
10172 }
10173 }
10174 }
10175
Daniel Veillard3d97e662004-11-04 10:49:00 +000010176 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000010177 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010178}
10179
10180
10181static int
10182test_xmlHashQLookup3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010183 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010184
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010185 int mem_base;
10186 void * ret_val;
10187 xmlHashTablePtr table; /* the hash table */
10188 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +000010189 xmlChar * prefix; /* the prefix of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010190 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +000010191 xmlChar * name; /* the name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010192 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000010193 xmlChar * prefix2; /* the second prefix of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010194 int n_prefix2;
Daniel Veillardce682bc2004-11-05 17:22:25 +000010195 xmlChar * name2; /* a second name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010196 int n_name2;
Daniel Veillardce682bc2004-11-05 17:22:25 +000010197 xmlChar * prefix3; /* the third prefix of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010198 int n_prefix3;
Daniel Veillardce682bc2004-11-05 17:22:25 +000010199 xmlChar * name3; /* a third name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010200 int n_name3;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010201
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010202 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10203 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
10204 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
10205 for (n_prefix2 = 0;n_prefix2 < gen_nb_const_xmlChar_ptr;n_prefix2++) {
10206 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
10207 for (n_prefix3 = 0;n_prefix3 < gen_nb_const_xmlChar_ptr;n_prefix3++) {
10208 for (n_name3 = 0;n_name3 < gen_nb_const_xmlChar_ptr;n_name3++) {
10209 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010210 table = gen_xmlHashTablePtr(n_table, 0);
10211 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
10212 name = gen_const_xmlChar_ptr(n_name, 2);
10213 prefix2 = gen_const_xmlChar_ptr(n_prefix2, 3);
10214 name2 = gen_const_xmlChar_ptr(n_name2, 4);
10215 prefix3 = gen_const_xmlChar_ptr(n_prefix3, 5);
10216 name3 = gen_const_xmlChar_ptr(n_name3, 6);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010217
10218 ret_val = xmlHashQLookup3(table, prefix, name, prefix2, name2, prefix3, name3);
10219 desret_void_ptr(ret_val);
10220 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010221 des_xmlHashTablePtr(n_table, table, 0);
10222 des_const_xmlChar_ptr(n_prefix, prefix, 1);
10223 des_const_xmlChar_ptr(n_name, name, 2);
10224 des_const_xmlChar_ptr(n_prefix2, prefix2, 3);
10225 des_const_xmlChar_ptr(n_name2, name2, 4);
10226 des_const_xmlChar_ptr(n_prefix3, prefix3, 5);
10227 des_const_xmlChar_ptr(n_name3, name3, 6);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010228 xmlResetLastError();
10229 if (mem_base != xmlMemBlocks()) {
10230 printf("Leak of %d blocks found in xmlHashQLookup3",
10231 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010232 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010233 printf(" %d", n_table);
10234 printf(" %d", n_prefix);
10235 printf(" %d", n_name);
10236 printf(" %d", n_prefix2);
10237 printf(" %d", n_name2);
10238 printf(" %d", n_prefix3);
10239 printf(" %d", n_name3);
10240 printf("\n");
10241 }
10242 }
10243 }
10244 }
10245 }
10246 }
10247 }
10248 }
10249
Daniel Veillard3d97e662004-11-04 10:49:00 +000010250 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000010251 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010252}
10253
10254
10255static int
10256test_xmlHashRemoveEntry(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010257 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010258
Daniel Veillard42595322004-11-08 10:52:06 +000010259 int mem_base;
10260 int ret_val;
10261 xmlHashTablePtr table; /* the hash table */
10262 int n_table;
10263 xmlChar * name; /* the name of the userdata */
10264 int n_name;
10265 xmlHashDeallocator f; /* the deallocator function for removed item (if any) */
10266 int n_f;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010267
Daniel Veillard42595322004-11-08 10:52:06 +000010268 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10269 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
10270 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
10271 mem_base = xmlMemBlocks();
10272 table = gen_xmlHashTablePtr(n_table, 0);
10273 name = gen_const_xmlChar_ptr(n_name, 1);
10274 f = gen_xmlHashDeallocator(n_f, 2);
10275
10276 ret_val = xmlHashRemoveEntry(table, name, f);
10277 desret_int(ret_val);
10278 call_tests++;
10279 des_xmlHashTablePtr(n_table, table, 0);
10280 des_const_xmlChar_ptr(n_name, name, 1);
10281 des_xmlHashDeallocator(n_f, f, 2);
10282 xmlResetLastError();
10283 if (mem_base != xmlMemBlocks()) {
10284 printf("Leak of %d blocks found in xmlHashRemoveEntry",
10285 xmlMemBlocks() - mem_base);
10286 test_ret++;
10287 printf(" %d", n_table);
10288 printf(" %d", n_name);
10289 printf(" %d", n_f);
10290 printf("\n");
10291 }
10292 }
10293 }
10294 }
10295
10296 function_tests++;
10297 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010298}
10299
10300
10301static int
10302test_xmlHashRemoveEntry2(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010303 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010304
Daniel Veillard42595322004-11-08 10:52:06 +000010305 int mem_base;
10306 int ret_val;
10307 xmlHashTablePtr table; /* the hash table */
10308 int n_table;
10309 xmlChar * name; /* the name of the userdata */
10310 int n_name;
10311 xmlChar * name2; /* a second name of the userdata */
10312 int n_name2;
10313 xmlHashDeallocator f; /* the deallocator function for removed item (if any) */
10314 int n_f;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010315
Daniel Veillard42595322004-11-08 10:52:06 +000010316 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10317 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
10318 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
10319 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
10320 mem_base = xmlMemBlocks();
10321 table = gen_xmlHashTablePtr(n_table, 0);
10322 name = gen_const_xmlChar_ptr(n_name, 1);
10323 name2 = gen_const_xmlChar_ptr(n_name2, 2);
10324 f = gen_xmlHashDeallocator(n_f, 3);
10325
10326 ret_val = xmlHashRemoveEntry2(table, name, name2, f);
10327 desret_int(ret_val);
10328 call_tests++;
10329 des_xmlHashTablePtr(n_table, table, 0);
10330 des_const_xmlChar_ptr(n_name, name, 1);
10331 des_const_xmlChar_ptr(n_name2, name2, 2);
10332 des_xmlHashDeallocator(n_f, f, 3);
10333 xmlResetLastError();
10334 if (mem_base != xmlMemBlocks()) {
10335 printf("Leak of %d blocks found in xmlHashRemoveEntry2",
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_f);
10342 printf("\n");
10343 }
10344 }
10345 }
10346 }
10347 }
10348
10349 function_tests++;
10350 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010351}
10352
10353
10354static int
10355test_xmlHashRemoveEntry3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010356 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010357
Daniel Veillard42595322004-11-08 10:52:06 +000010358 int mem_base;
10359 int ret_val;
10360 xmlHashTablePtr table; /* the hash table */
10361 int n_table;
10362 xmlChar * name; /* the name of the userdata */
10363 int n_name;
10364 xmlChar * name2; /* a second name of the userdata */
10365 int n_name2;
10366 xmlChar * name3; /* a third name of the userdata */
10367 int n_name3;
10368 xmlHashDeallocator f; /* the deallocator function for removed item (if any) */
10369 int n_f;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010370
Daniel Veillard42595322004-11-08 10:52:06 +000010371 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10372 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
10373 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
10374 for (n_name3 = 0;n_name3 < gen_nb_const_xmlChar_ptr;n_name3++) {
10375 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
10376 mem_base = xmlMemBlocks();
10377 table = gen_xmlHashTablePtr(n_table, 0);
10378 name = gen_const_xmlChar_ptr(n_name, 1);
10379 name2 = gen_const_xmlChar_ptr(n_name2, 2);
10380 name3 = gen_const_xmlChar_ptr(n_name3, 3);
10381 f = gen_xmlHashDeallocator(n_f, 4);
10382
10383 ret_val = xmlHashRemoveEntry3(table, name, name2, name3, f);
10384 desret_int(ret_val);
10385 call_tests++;
10386 des_xmlHashTablePtr(n_table, table, 0);
10387 des_const_xmlChar_ptr(n_name, name, 1);
10388 des_const_xmlChar_ptr(n_name2, name2, 2);
10389 des_const_xmlChar_ptr(n_name3, name3, 3);
10390 des_xmlHashDeallocator(n_f, f, 4);
10391 xmlResetLastError();
10392 if (mem_base != xmlMemBlocks()) {
10393 printf("Leak of %d blocks found in xmlHashRemoveEntry3",
10394 xmlMemBlocks() - mem_base);
10395 test_ret++;
10396 printf(" %d", n_table);
10397 printf(" %d", n_name);
10398 printf(" %d", n_name2);
10399 printf(" %d", n_name3);
10400 printf(" %d", n_f);
10401 printf("\n");
10402 }
10403 }
10404 }
10405 }
10406 }
10407 }
10408
10409 function_tests++;
10410 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010411}
10412
10413
10414static int
10415test_xmlHashScan(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010416 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010417
10418
10419 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010420 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010421}
10422
10423
10424static int
10425test_xmlHashScan3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010426 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010427
10428
10429 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010430 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010431}
10432
10433
10434static int
10435test_xmlHashScanFull(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010436 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010437
10438
10439 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010440 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010441}
10442
10443
10444static int
10445test_xmlHashScanFull3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010446 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010447
10448
10449 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010450 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010451}
10452
10453
10454static int
10455test_xmlHashSize(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010456 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010457
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010458 int mem_base;
10459 int ret_val;
10460 xmlHashTablePtr table; /* the hash table */
10461 int n_table;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010462
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010463 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10464 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010465 table = gen_xmlHashTablePtr(n_table, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010466
10467 ret_val = xmlHashSize(table);
10468 desret_int(ret_val);
10469 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010470 des_xmlHashTablePtr(n_table, table, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010471 xmlResetLastError();
10472 if (mem_base != xmlMemBlocks()) {
10473 printf("Leak of %d blocks found in xmlHashSize",
10474 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010475 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010476 printf(" %d", n_table);
10477 printf("\n");
10478 }
10479 }
10480
Daniel Veillard3d97e662004-11-04 10:49:00 +000010481 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000010482 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010483}
10484
10485
10486static int
10487test_xmlHashUpdateEntry(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010488 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010489
Daniel Veillard42595322004-11-08 10:52:06 +000010490 int mem_base;
10491 int ret_val;
10492 xmlHashTablePtr table; /* the hash table */
10493 int n_table;
10494 xmlChar * name; /* the name of the userdata */
10495 int n_name;
10496 void * userdata; /* a pointer to the userdata */
10497 int n_userdata;
10498 xmlHashDeallocator f; /* the deallocator function for replaced item (if any) */
10499 int n_f;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010500
Daniel Veillard42595322004-11-08 10:52:06 +000010501 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10502 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
10503 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
10504 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
10505 mem_base = xmlMemBlocks();
10506 table = gen_xmlHashTablePtr(n_table, 0);
10507 name = gen_const_xmlChar_ptr(n_name, 1);
10508 userdata = gen_userdata(n_userdata, 2);
10509 f = gen_xmlHashDeallocator(n_f, 3);
10510
10511 ret_val = xmlHashUpdateEntry(table, name, userdata, f);
10512 desret_int(ret_val);
10513 call_tests++;
10514 des_xmlHashTablePtr(n_table, table, 0);
10515 des_const_xmlChar_ptr(n_name, name, 1);
10516 des_userdata(n_userdata, userdata, 2);
10517 des_xmlHashDeallocator(n_f, f, 3);
10518 xmlResetLastError();
10519 if (mem_base != xmlMemBlocks()) {
10520 printf("Leak of %d blocks found in xmlHashUpdateEntry",
10521 xmlMemBlocks() - mem_base);
10522 test_ret++;
10523 printf(" %d", n_table);
10524 printf(" %d", n_name);
10525 printf(" %d", n_userdata);
10526 printf(" %d", n_f);
10527 printf("\n");
10528 }
10529 }
10530 }
10531 }
10532 }
10533
10534 function_tests++;
10535 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010536}
10537
10538
10539static int
10540test_xmlHashUpdateEntry2(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010541 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010542
Daniel Veillard42595322004-11-08 10:52:06 +000010543 int mem_base;
10544 int ret_val;
10545 xmlHashTablePtr table; /* the hash table */
10546 int n_table;
10547 xmlChar * name; /* the name of the userdata */
10548 int n_name;
10549 xmlChar * name2; /* a second name of the userdata */
10550 int n_name2;
10551 void * userdata; /* a pointer to the userdata */
10552 int n_userdata;
10553 xmlHashDeallocator f; /* the deallocator function for replaced item (if any) */
10554 int n_f;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010555
Daniel Veillard42595322004-11-08 10:52:06 +000010556 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10557 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
10558 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
10559 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
10560 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
10561 mem_base = xmlMemBlocks();
10562 table = gen_xmlHashTablePtr(n_table, 0);
10563 name = gen_const_xmlChar_ptr(n_name, 1);
10564 name2 = gen_const_xmlChar_ptr(n_name2, 2);
10565 userdata = gen_userdata(n_userdata, 3);
10566 f = gen_xmlHashDeallocator(n_f, 4);
10567
10568 ret_val = xmlHashUpdateEntry2(table, name, name2, userdata, f);
10569 desret_int(ret_val);
10570 call_tests++;
10571 des_xmlHashTablePtr(n_table, table, 0);
10572 des_const_xmlChar_ptr(n_name, name, 1);
10573 des_const_xmlChar_ptr(n_name2, name2, 2);
10574 des_userdata(n_userdata, userdata, 3);
10575 des_xmlHashDeallocator(n_f, f, 4);
10576 xmlResetLastError();
10577 if (mem_base != xmlMemBlocks()) {
10578 printf("Leak of %d blocks found in xmlHashUpdateEntry2",
10579 xmlMemBlocks() - mem_base);
10580 test_ret++;
10581 printf(" %d", n_table);
10582 printf(" %d", n_name);
10583 printf(" %d", n_name2);
10584 printf(" %d", n_userdata);
10585 printf(" %d", n_f);
10586 printf("\n");
10587 }
10588 }
10589 }
10590 }
10591 }
10592 }
10593
10594 function_tests++;
10595 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010596}
10597
10598
10599static int
10600test_xmlHashUpdateEntry3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010601 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010602
Daniel Veillard42595322004-11-08 10:52:06 +000010603 int mem_base;
10604 int ret_val;
10605 xmlHashTablePtr table; /* the hash table */
10606 int n_table;
10607 xmlChar * name; /* the name of the userdata */
10608 int n_name;
10609 xmlChar * name2; /* a second name of the userdata */
10610 int n_name2;
10611 xmlChar * name3; /* a third name of the userdata */
10612 int n_name3;
10613 void * userdata; /* a pointer to the userdata */
10614 int n_userdata;
10615 xmlHashDeallocator f; /* the deallocator function for replaced item (if any) */
10616 int n_f;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010617
Daniel Veillard42595322004-11-08 10:52:06 +000010618 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10619 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
10620 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
10621 for (n_name3 = 0;n_name3 < gen_nb_const_xmlChar_ptr;n_name3++) {
10622 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
10623 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
10624 mem_base = xmlMemBlocks();
10625 table = gen_xmlHashTablePtr(n_table, 0);
10626 name = gen_const_xmlChar_ptr(n_name, 1);
10627 name2 = gen_const_xmlChar_ptr(n_name2, 2);
10628 name3 = gen_const_xmlChar_ptr(n_name3, 3);
10629 userdata = gen_userdata(n_userdata, 4);
10630 f = gen_xmlHashDeallocator(n_f, 5);
10631
10632 ret_val = xmlHashUpdateEntry3(table, name, name2, name3, userdata, f);
10633 desret_int(ret_val);
10634 call_tests++;
10635 des_xmlHashTablePtr(n_table, table, 0);
10636 des_const_xmlChar_ptr(n_name, name, 1);
10637 des_const_xmlChar_ptr(n_name2, name2, 2);
10638 des_const_xmlChar_ptr(n_name3, name3, 3);
10639 des_userdata(n_userdata, userdata, 4);
10640 des_xmlHashDeallocator(n_f, f, 5);
10641 xmlResetLastError();
10642 if (mem_base != xmlMemBlocks()) {
10643 printf("Leak of %d blocks found in xmlHashUpdateEntry3",
10644 xmlMemBlocks() - mem_base);
10645 test_ret++;
10646 printf(" %d", n_table);
10647 printf(" %d", n_name);
10648 printf(" %d", n_name2);
10649 printf(" %d", n_name3);
10650 printf(" %d", n_userdata);
10651 printf(" %d", n_f);
10652 printf("\n");
10653 }
10654 }
10655 }
10656 }
10657 }
10658 }
10659 }
10660
10661 function_tests++;
10662 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010663}
10664
10665static int
10666test_hash(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010667 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010668
Daniel Veillard42595322004-11-08 10:52:06 +000010669 printf("Testing hash : 16 of 23 functions ...\n");
10670 test_ret += test_xmlHashAddEntry();
10671 test_ret += test_xmlHashAddEntry2();
10672 test_ret += test_xmlHashAddEntry3();
10673 test_ret += test_xmlHashCopy();
10674 test_ret += test_xmlHashCreate();
10675 test_ret += test_xmlHashLookup();
10676 test_ret += test_xmlHashLookup2();
10677 test_ret += test_xmlHashLookup3();
10678 test_ret += test_xmlHashQLookup();
10679 test_ret += test_xmlHashQLookup2();
10680 test_ret += test_xmlHashQLookup3();
10681 test_ret += test_xmlHashRemoveEntry();
10682 test_ret += test_xmlHashRemoveEntry2();
10683 test_ret += test_xmlHashRemoveEntry3();
10684 test_ret += test_xmlHashScan();
10685 test_ret += test_xmlHashScan3();
10686 test_ret += test_xmlHashScanFull();
10687 test_ret += test_xmlHashScanFull3();
10688 test_ret += test_xmlHashSize();
10689 test_ret += test_xmlHashUpdateEntry();
10690 test_ret += test_xmlHashUpdateEntry2();
10691 test_ret += test_xmlHashUpdateEntry3();
Daniel Veillardd93f6252004-11-02 15:53:51 +000010692
Daniel Veillard42595322004-11-08 10:52:06 +000010693 if (test_ret != 0)
10694 printf("Module hash: %d errors\n", test_ret);
10695 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010696}
10697
Daniel Veillardce682bc2004-11-05 17:22:25 +000010698#define gen_nb_xmlLinkPtr 1
10699static xmlLinkPtr gen_xmlLinkPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
10700 return(NULL);
10701}
10702static void des_xmlLinkPtr(int no ATTRIBUTE_UNUSED, xmlLinkPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
10703}
10704
Daniel Veillardd93f6252004-11-02 15:53:51 +000010705static int
10706test_xmlLinkGetData(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010707 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010708
Daniel Veillardce682bc2004-11-05 17:22:25 +000010709 int mem_base;
10710 void * ret_val;
10711 xmlLinkPtr lk; /* a link */
10712 int n_lk;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010713
Daniel Veillardce682bc2004-11-05 17:22:25 +000010714 for (n_lk = 0;n_lk < gen_nb_xmlLinkPtr;n_lk++) {
10715 mem_base = xmlMemBlocks();
10716 lk = gen_xmlLinkPtr(n_lk, 0);
10717
10718 ret_val = xmlLinkGetData(lk);
10719 desret_void_ptr(ret_val);
10720 call_tests++;
10721 des_xmlLinkPtr(n_lk, lk, 0);
10722 xmlResetLastError();
10723 if (mem_base != xmlMemBlocks()) {
10724 printf("Leak of %d blocks found in xmlLinkGetData",
10725 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010726 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000010727 printf(" %d", n_lk);
10728 printf("\n");
10729 }
10730 }
10731
10732 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000010733 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010734}
10735
10736
10737static int
10738test_xmlListAppend(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010739 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010740
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010741 int mem_base;
10742 int ret_val;
10743 xmlListPtr l; /* a list */
10744 int n_l;
10745 void * data; /* the data */
10746 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010747
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010748 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10749 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
10750 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010751 l = gen_xmlListPtr(n_l, 0);
10752 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010753
10754 ret_val = xmlListAppend(l, data);
10755 desret_int(ret_val);
10756 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010757 des_xmlListPtr(n_l, l, 0);
10758 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010759 xmlResetLastError();
10760 if (mem_base != xmlMemBlocks()) {
10761 printf("Leak of %d blocks found in xmlListAppend",
10762 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010763 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010764 printf(" %d", n_l);
10765 printf(" %d", n_data);
10766 printf("\n");
10767 }
10768 }
10769 }
10770
Daniel Veillard3d97e662004-11-04 10:49:00 +000010771 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000010772 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010773}
10774
10775
10776static int
10777test_xmlListClear(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010778 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010779
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010780 int mem_base;
10781 xmlListPtr l; /* a list */
10782 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010783
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010784 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10785 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010786 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010787
10788 xmlListClear(l);
10789 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010790 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010791 xmlResetLastError();
10792 if (mem_base != xmlMemBlocks()) {
10793 printf("Leak of %d blocks found in xmlListClear",
10794 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010795 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010796 printf(" %d", n_l);
10797 printf("\n");
10798 }
10799 }
10800
Daniel Veillard3d97e662004-11-04 10:49:00 +000010801 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000010802 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010803}
10804
10805
Daniel Veillardce682bc2004-11-05 17:22:25 +000010806#define gen_nb_const_xmlListPtr 1
10807static xmlListPtr gen_const_xmlListPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
10808 return(NULL);
10809}
10810static void des_const_xmlListPtr(int no ATTRIBUTE_UNUSED, const xmlListPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
10811}
10812
Daniel Veillardd93f6252004-11-02 15:53:51 +000010813static int
10814test_xmlListCopy(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010815 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010816
Daniel Veillardce682bc2004-11-05 17:22:25 +000010817 int mem_base;
10818 int ret_val;
10819 xmlListPtr cur; /* the new list */
10820 int n_cur;
10821 xmlListPtr old; /* the old list */
10822 int n_old;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010823
Daniel Veillardce682bc2004-11-05 17:22:25 +000010824 for (n_cur = 0;n_cur < gen_nb_xmlListPtr;n_cur++) {
10825 for (n_old = 0;n_old < gen_nb_const_xmlListPtr;n_old++) {
10826 mem_base = xmlMemBlocks();
10827 cur = gen_xmlListPtr(n_cur, 0);
10828 old = gen_const_xmlListPtr(n_old, 1);
10829
10830 ret_val = xmlListCopy(cur, old);
10831 desret_int(ret_val);
10832 call_tests++;
10833 des_xmlListPtr(n_cur, cur, 0);
10834 des_const_xmlListPtr(n_old, old, 1);
10835 xmlResetLastError();
10836 if (mem_base != xmlMemBlocks()) {
10837 printf("Leak of %d blocks found in xmlListCopy",
10838 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010839 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000010840 printf(" %d", n_cur);
10841 printf(" %d", n_old);
10842 printf("\n");
10843 }
10844 }
10845 }
10846
10847 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000010848 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010849}
10850
10851
10852static int
10853test_xmlListCreate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010854 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010855
10856
10857 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010858 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010859}
10860
10861
10862static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000010863test_xmlListDup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010864 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010865
10866
10867 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010868 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010869}
10870
10871
10872static int
10873test_xmlListEmpty(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010874 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010875
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010876 int mem_base;
10877 int ret_val;
10878 xmlListPtr l; /* a list */
10879 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010880
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010881 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10882 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010883 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010884
10885 ret_val = xmlListEmpty(l);
10886 desret_int(ret_val);
10887 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010888 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010889 xmlResetLastError();
10890 if (mem_base != xmlMemBlocks()) {
10891 printf("Leak of %d blocks found in xmlListEmpty",
10892 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010893 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010894 printf(" %d", n_l);
10895 printf("\n");
10896 }
10897 }
10898
Daniel Veillard3d97e662004-11-04 10:49:00 +000010899 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000010900 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010901}
10902
10903
10904static int
10905test_xmlListEnd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010906 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010907
10908
10909 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010910 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010911}
10912
10913
10914static int
10915test_xmlListFront(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010916 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010917
10918
10919 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010920 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010921}
10922
10923
10924static int
10925test_xmlListInsert(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010926 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010927
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010928 int mem_base;
10929 int ret_val;
10930 xmlListPtr l; /* a list */
10931 int n_l;
10932 void * data; /* the data */
10933 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010934
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010935 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10936 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
10937 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010938 l = gen_xmlListPtr(n_l, 0);
10939 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010940
10941 ret_val = xmlListInsert(l, data);
10942 desret_int(ret_val);
10943 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010944 des_xmlListPtr(n_l, l, 0);
10945 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010946 xmlResetLastError();
10947 if (mem_base != xmlMemBlocks()) {
10948 printf("Leak of %d blocks found in xmlListInsert",
10949 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010950 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010951 printf(" %d", n_l);
10952 printf(" %d", n_data);
10953 printf("\n");
10954 }
10955 }
10956 }
10957
Daniel Veillard3d97e662004-11-04 10:49:00 +000010958 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000010959 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010960}
10961
10962
10963static int
10964test_xmlListMerge(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010965 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010966
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010967 int mem_base;
10968 xmlListPtr l1; /* the original list */
10969 int n_l1;
10970 xmlListPtr l2; /* the new list */
10971 int n_l2;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010972
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010973 for (n_l1 = 0;n_l1 < gen_nb_xmlListPtr;n_l1++) {
10974 for (n_l2 = 0;n_l2 < gen_nb_xmlListPtr;n_l2++) {
10975 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010976 l1 = gen_xmlListPtr(n_l1, 0);
10977 l2 = gen_xmlListPtr(n_l2, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010978
10979 xmlListMerge(l1, l2);
10980 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010981 des_xmlListPtr(n_l1, l1, 0);
10982 des_xmlListPtr(n_l2, l2, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010983 xmlResetLastError();
10984 if (mem_base != xmlMemBlocks()) {
10985 printf("Leak of %d blocks found in xmlListMerge",
10986 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010987 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010988 printf(" %d", n_l1);
10989 printf(" %d", n_l2);
10990 printf("\n");
10991 }
10992 }
10993 }
10994
Daniel Veillard3d97e662004-11-04 10:49:00 +000010995 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000010996 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010997}
10998
10999
11000static int
11001test_xmlListPopBack(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011002 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011003
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011004 int mem_base;
11005 xmlListPtr l; /* a list */
11006 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011007
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011008 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
11009 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011010 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011011
11012 xmlListPopBack(l);
11013 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011014 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011015 xmlResetLastError();
11016 if (mem_base != xmlMemBlocks()) {
11017 printf("Leak of %d blocks found in xmlListPopBack",
11018 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011019 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011020 printf(" %d", n_l);
11021 printf("\n");
11022 }
11023 }
11024
Daniel Veillard3d97e662004-11-04 10:49:00 +000011025 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000011026 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011027}
11028
11029
11030static int
11031test_xmlListPopFront(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011032 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011033
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011034 int mem_base;
11035 xmlListPtr l; /* a list */
11036 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011037
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011038 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
11039 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011040 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011041
11042 xmlListPopFront(l);
11043 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011044 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011045 xmlResetLastError();
11046 if (mem_base != xmlMemBlocks()) {
11047 printf("Leak of %d blocks found in xmlListPopFront",
11048 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011049 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011050 printf(" %d", n_l);
11051 printf("\n");
11052 }
11053 }
11054
Daniel Veillard3d97e662004-11-04 10:49:00 +000011055 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000011056 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011057}
11058
11059
11060static int
11061test_xmlListPushBack(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011062 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011063
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011064 int mem_base;
11065 int ret_val;
11066 xmlListPtr l; /* a list */
11067 int n_l;
11068 void * data; /* new data */
11069 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011070
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011071 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
11072 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
11073 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011074 l = gen_xmlListPtr(n_l, 0);
11075 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011076
11077 ret_val = xmlListPushBack(l, data);
11078 desret_int(ret_val);
11079 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011080 des_xmlListPtr(n_l, l, 0);
11081 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011082 xmlResetLastError();
11083 if (mem_base != xmlMemBlocks()) {
11084 printf("Leak of %d blocks found in xmlListPushBack",
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(" %d", n_data);
11089 printf("\n");
11090 }
11091 }
11092 }
11093
Daniel Veillard3d97e662004-11-04 10:49:00 +000011094 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000011095 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011096}
11097
11098
11099static int
11100test_xmlListPushFront(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011101 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011102
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011103 int mem_base;
11104 int ret_val;
11105 xmlListPtr l; /* a list */
11106 int n_l;
11107 void * data; /* new data */
11108 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011109
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011110 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
11111 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
11112 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011113 l = gen_xmlListPtr(n_l, 0);
11114 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011115
11116 ret_val = xmlListPushFront(l, data);
11117 desret_int(ret_val);
11118 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011119 des_xmlListPtr(n_l, l, 0);
11120 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011121 xmlResetLastError();
11122 if (mem_base != xmlMemBlocks()) {
11123 printf("Leak of %d blocks found in xmlListPushFront",
11124 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011125 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011126 printf(" %d", n_l);
11127 printf(" %d", n_data);
11128 printf("\n");
11129 }
11130 }
11131 }
11132
Daniel Veillard3d97e662004-11-04 10:49:00 +000011133 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000011134 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011135}
11136
11137
11138static int
11139test_xmlListRemoveAll(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011140 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011141
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011142 int mem_base;
11143 int ret_val;
11144 xmlListPtr l; /* a list */
11145 int n_l;
11146 void * data; /* list data */
11147 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011148
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011149 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
11150 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
11151 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011152 l = gen_xmlListPtr(n_l, 0);
11153 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011154
11155 ret_val = xmlListRemoveAll(l, data);
11156 desret_int(ret_val);
11157 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011158 des_xmlListPtr(n_l, l, 0);
11159 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011160 xmlResetLastError();
11161 if (mem_base != xmlMemBlocks()) {
11162 printf("Leak of %d blocks found in xmlListRemoveAll",
11163 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011164 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011165 printf(" %d", n_l);
11166 printf(" %d", n_data);
11167 printf("\n");
11168 }
11169 }
11170 }
11171
Daniel Veillard3d97e662004-11-04 10:49:00 +000011172 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000011173 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011174}
11175
11176
11177static int
11178test_xmlListRemoveFirst(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011179 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011180
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011181 int mem_base;
11182 int ret_val;
11183 xmlListPtr l; /* a list */
11184 int n_l;
11185 void * data; /* list data */
11186 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011187
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011188 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
11189 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
11190 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011191 l = gen_xmlListPtr(n_l, 0);
11192 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011193
11194 ret_val = xmlListRemoveFirst(l, data);
11195 desret_int(ret_val);
11196 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011197 des_xmlListPtr(n_l, l, 0);
11198 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011199 xmlResetLastError();
11200 if (mem_base != xmlMemBlocks()) {
11201 printf("Leak of %d blocks found in xmlListRemoveFirst",
11202 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011203 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011204 printf(" %d", n_l);
11205 printf(" %d", n_data);
11206 printf("\n");
11207 }
11208 }
11209 }
11210
Daniel Veillard3d97e662004-11-04 10:49:00 +000011211 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000011212 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011213}
11214
11215
11216static int
11217test_xmlListRemoveLast(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011218 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011219
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011220 int mem_base;
11221 int ret_val;
11222 xmlListPtr l; /* a list */
11223 int n_l;
11224 void * data; /* list data */
11225 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011226
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011227 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
11228 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
11229 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011230 l = gen_xmlListPtr(n_l, 0);
11231 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011232
11233 ret_val = xmlListRemoveLast(l, data);
11234 desret_int(ret_val);
11235 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011236 des_xmlListPtr(n_l, l, 0);
11237 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011238 xmlResetLastError();
11239 if (mem_base != xmlMemBlocks()) {
11240 printf("Leak of %d blocks found in xmlListRemoveLast",
11241 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011242 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011243 printf(" %d", n_l);
11244 printf(" %d", n_data);
11245 printf("\n");
11246 }
11247 }
11248 }
11249
Daniel Veillard3d97e662004-11-04 10:49:00 +000011250 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000011251 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011252}
11253
11254
11255static int
11256test_xmlListReverse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011257 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011258
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011259 int mem_base;
11260 xmlListPtr l; /* a list */
11261 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011262
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011263 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
11264 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011265 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011266
11267 xmlListReverse(l);
11268 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011269 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011270 xmlResetLastError();
11271 if (mem_base != xmlMemBlocks()) {
11272 printf("Leak of %d blocks found in xmlListReverse",
11273 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011274 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011275 printf(" %d", n_l);
11276 printf("\n");
11277 }
11278 }
11279
Daniel Veillard3d97e662004-11-04 10:49:00 +000011280 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000011281 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011282}
11283
11284
11285static int
11286test_xmlListReverseSearch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011287 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011288
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011289 int mem_base;
11290 void * ret_val;
11291 xmlListPtr l; /* a list */
11292 int n_l;
11293 void * data; /* a search value */
11294 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011295
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011296 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
11297 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
11298 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011299 l = gen_xmlListPtr(n_l, 0);
11300 data = gen_userdata(n_data, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011301
11302 ret_val = xmlListReverseSearch(l, data);
11303 desret_void_ptr(ret_val);
11304 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011305 des_xmlListPtr(n_l, l, 0);
11306 des_userdata(n_data, data, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011307 xmlResetLastError();
11308 if (mem_base != xmlMemBlocks()) {
11309 printf("Leak of %d blocks found in xmlListReverseSearch",
11310 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011311 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011312 printf(" %d", n_l);
11313 printf(" %d", n_data);
11314 printf("\n");
11315 }
11316 }
11317 }
11318
Daniel Veillard3d97e662004-11-04 10:49:00 +000011319 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000011320 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011321}
11322
11323
11324static int
11325test_xmlListReverseWalk(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011326 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011327
11328
11329 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000011330 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011331}
11332
11333
11334static int
11335test_xmlListSearch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011336 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011337
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011338 int mem_base;
11339 void * ret_val;
11340 xmlListPtr l; /* a list */
11341 int n_l;
11342 void * data; /* a search value */
11343 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011344
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011345 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
11346 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
11347 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011348 l = gen_xmlListPtr(n_l, 0);
11349 data = gen_userdata(n_data, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011350
11351 ret_val = xmlListSearch(l, data);
11352 desret_void_ptr(ret_val);
11353 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011354 des_xmlListPtr(n_l, l, 0);
11355 des_userdata(n_data, data, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011356 xmlResetLastError();
11357 if (mem_base != xmlMemBlocks()) {
11358 printf("Leak of %d blocks found in xmlListSearch",
11359 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011360 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011361 printf(" %d", n_l);
11362 printf(" %d", n_data);
11363 printf("\n");
11364 }
11365 }
11366 }
11367
Daniel Veillard3d97e662004-11-04 10:49:00 +000011368 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000011369 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011370}
11371
11372
11373static int
11374test_xmlListSize(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011375 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011376
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011377 int mem_base;
11378 int ret_val;
11379 xmlListPtr l; /* a list */
11380 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011381
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011382 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
11383 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011384 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011385
11386 ret_val = xmlListSize(l);
11387 desret_int(ret_val);
11388 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011389 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011390 xmlResetLastError();
11391 if (mem_base != xmlMemBlocks()) {
11392 printf("Leak of %d blocks found in xmlListSize",
11393 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011394 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011395 printf(" %d", n_l);
11396 printf("\n");
11397 }
11398 }
11399
Daniel Veillard3d97e662004-11-04 10:49:00 +000011400 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000011401 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011402}
11403
11404
11405static int
11406test_xmlListSort(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011407 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011408
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011409 int mem_base;
11410 xmlListPtr l; /* a list */
11411 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011412
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011413 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
11414 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011415 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011416
11417 xmlListSort(l);
11418 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011419 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011420 xmlResetLastError();
11421 if (mem_base != xmlMemBlocks()) {
11422 printf("Leak of %d blocks found in xmlListSort",
11423 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011424 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011425 printf(" %d", n_l);
11426 printf("\n");
11427 }
11428 }
11429
Daniel Veillard3d97e662004-11-04 10:49:00 +000011430 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000011431 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011432}
11433
11434
11435static int
11436test_xmlListWalk(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011437 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011438
11439
11440 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000011441 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011442}
11443
11444static int
11445test_list(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011446 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011447
Daniel Veillardce682bc2004-11-05 17:22:25 +000011448 printf("Testing list : 19 of 26 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000011449 test_ret += test_xmlLinkGetData();
11450 test_ret += test_xmlListAppend();
11451 test_ret += test_xmlListClear();
11452 test_ret += test_xmlListCopy();
11453 test_ret += test_xmlListCreate();
11454 test_ret += test_xmlListDup();
11455 test_ret += test_xmlListEmpty();
11456 test_ret += test_xmlListEnd();
11457 test_ret += test_xmlListFront();
11458 test_ret += test_xmlListInsert();
11459 test_ret += test_xmlListMerge();
11460 test_ret += test_xmlListPopBack();
11461 test_ret += test_xmlListPopFront();
11462 test_ret += test_xmlListPushBack();
11463 test_ret += test_xmlListPushFront();
11464 test_ret += test_xmlListRemoveAll();
11465 test_ret += test_xmlListRemoveFirst();
11466 test_ret += test_xmlListRemoveLast();
11467 test_ret += test_xmlListReverse();
11468 test_ret += test_xmlListReverseSearch();
11469 test_ret += test_xmlListReverseWalk();
11470 test_ret += test_xmlListSearch();
11471 test_ret += test_xmlListSize();
11472 test_ret += test_xmlListSort();
11473 test_ret += test_xmlListWalk();
Daniel Veillardd93f6252004-11-02 15:53:51 +000011474
Daniel Veillard42595322004-11-08 10:52:06 +000011475 if (test_ret != 0)
11476 printf("Module list: %d errors\n", test_ret);
11477 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011478}
11479
11480static int
11481test_xmlNanoFTPCheckResponse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011482 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011483
Daniel Veillard27f20102004-11-05 11:50:11 +000011484#ifdef LIBXML_FTP_ENABLED
11485 int mem_base;
11486 int ret_val;
11487 void * ctx; /* an FTP context */
11488 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011489
Daniel Veillard27f20102004-11-05 11:50:11 +000011490 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11491 mem_base = xmlMemBlocks();
11492 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11493
11494 ret_val = xmlNanoFTPCheckResponse(ctx);
11495 desret_int(ret_val);
11496 call_tests++;
11497 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11498 xmlResetLastError();
11499 if (mem_base != xmlMemBlocks()) {
11500 printf("Leak of %d blocks found in xmlNanoFTPCheckResponse",
11501 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011502 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011503 printf(" %d", n_ctx);
11504 printf("\n");
11505 }
11506 }
11507#endif
11508
11509 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000011510 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011511}
11512
11513
11514static int
11515test_xmlNanoFTPCleanup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011516 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011517
11518#ifdef LIBXML_FTP_ENABLED
11519 int mem_base;
11520
11521 mem_base = xmlMemBlocks();
11522
11523 xmlNanoFTPCleanup();
11524 call_tests++;
11525 xmlResetLastError();
11526 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000011527 printf("Leak of %d blocks found in xmlNanoFTPCleanup",
Daniel Veillardd93f6252004-11-02 15:53:51 +000011528 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011529 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000011530 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000011531 }
11532#endif
11533
Daniel Veillard3d97e662004-11-04 10:49:00 +000011534 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000011535 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011536}
11537
11538
11539static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000011540test_xmlNanoFTPCloseConnection(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011541 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011542
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011543#ifdef LIBXML_FTP_ENABLED
11544 int mem_base;
Daniel Veillard27f20102004-11-05 11:50:11 +000011545 int ret_val;
11546 void * ctx; /* an FTP context */
11547 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011548
Daniel Veillard27f20102004-11-05 11:50:11 +000011549 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011550 mem_base = xmlMemBlocks();
Daniel Veillard27f20102004-11-05 11:50:11 +000011551 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011552
Daniel Veillard27f20102004-11-05 11:50:11 +000011553 ret_val = xmlNanoFTPCloseConnection(ctx);
11554 desret_int(ret_val);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011555 call_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011556 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011557 xmlResetLastError();
11558 if (mem_base != xmlMemBlocks()) {
Daniel Veillard27f20102004-11-05 11:50:11 +000011559 printf("Leak of %d blocks found in xmlNanoFTPCloseConnection",
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011560 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011561 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011562 printf(" %d", n_ctx);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011563 printf("\n");
11564 }
11565 }
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011566#endif
11567
Daniel Veillard3d97e662004-11-04 10:49:00 +000011568 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000011569 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011570}
11571
11572
11573static int
11574test_xmlNanoFTPCwd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011575 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011576
Daniel Veillard27f20102004-11-05 11:50:11 +000011577#ifdef LIBXML_FTP_ENABLED
11578 int mem_base;
11579 int ret_val;
11580 void * ctx; /* an FTP context */
11581 int n_ctx;
Daniel Veillardce682bc2004-11-05 17:22:25 +000011582 char * directory; /* a directory on the server */
Daniel Veillard27f20102004-11-05 11:50:11 +000011583 int n_directory;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011584
Daniel Veillard27f20102004-11-05 11:50:11 +000011585 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11586 for (n_directory = 0;n_directory < gen_nb_const_char_ptr;n_directory++) {
11587 mem_base = xmlMemBlocks();
11588 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11589 directory = gen_const_char_ptr(n_directory, 1);
11590
11591 ret_val = xmlNanoFTPCwd(ctx, directory);
11592 desret_int(ret_val);
11593 call_tests++;
11594 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11595 des_const_char_ptr(n_directory, directory, 1);
11596 xmlResetLastError();
11597 if (mem_base != xmlMemBlocks()) {
11598 printf("Leak of %d blocks found in xmlNanoFTPCwd",
11599 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011600 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011601 printf(" %d", n_ctx);
11602 printf(" %d", n_directory);
11603 printf("\n");
11604 }
11605 }
11606 }
11607#endif
11608
11609 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000011610 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011611}
11612
11613
11614static int
11615test_xmlNanoFTPDele(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011616 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011617
Daniel Veillard27f20102004-11-05 11:50:11 +000011618#ifdef LIBXML_FTP_ENABLED
11619 int mem_base;
11620 int ret_val;
11621 void * ctx; /* an FTP context */
11622 int n_ctx;
11623 const char * file; /* a file or directory on the server */
11624 int n_file;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011625
Daniel Veillard27f20102004-11-05 11:50:11 +000011626 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11627 for (n_file = 0;n_file < gen_nb_filepath;n_file++) {
11628 mem_base = xmlMemBlocks();
11629 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11630 file = gen_filepath(n_file, 1);
11631
11632 ret_val = xmlNanoFTPDele(ctx, file);
11633 desret_int(ret_val);
11634 call_tests++;
11635 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11636 des_filepath(n_file, file, 1);
11637 xmlResetLastError();
11638 if (mem_base != xmlMemBlocks()) {
11639 printf("Leak of %d blocks found in xmlNanoFTPDele",
11640 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011641 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011642 printf(" %d", n_ctx);
11643 printf(" %d", n_file);
11644 printf("\n");
11645 }
11646 }
11647 }
11648#endif
11649
11650 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000011651 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011652}
11653
11654
11655static int
11656test_xmlNanoFTPGet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011657 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011658
11659
11660 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000011661 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011662}
11663
11664
11665static int
11666test_xmlNanoFTPGetConnection(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011667 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011668
Daniel Veillard27f20102004-11-05 11:50:11 +000011669#ifdef LIBXML_FTP_ENABLED
11670 int mem_base;
11671 int ret_val;
11672 void * ctx; /* an FTP context */
11673 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011674
Daniel Veillard27f20102004-11-05 11:50:11 +000011675 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11676 mem_base = xmlMemBlocks();
11677 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11678
11679 ret_val = xmlNanoFTPGetConnection(ctx);
11680 desret_int(ret_val);
11681 call_tests++;
11682 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11683 xmlResetLastError();
11684 if (mem_base != xmlMemBlocks()) {
11685 printf("Leak of %d blocks found in xmlNanoFTPGetConnection",
11686 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011687 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011688 printf(" %d", n_ctx);
11689 printf("\n");
11690 }
11691 }
11692#endif
11693
11694 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000011695 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011696}
11697
11698
11699static int
11700test_xmlNanoFTPGetResponse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011701 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011702
Daniel Veillard27f20102004-11-05 11:50:11 +000011703#ifdef LIBXML_FTP_ENABLED
11704 int mem_base;
11705 int ret_val;
11706 void * ctx; /* an FTP context */
11707 int n_ctx;
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 mem_base = xmlMemBlocks();
11711 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11712
11713 ret_val = xmlNanoFTPGetResponse(ctx);
11714 desret_int(ret_val);
11715 call_tests++;
11716 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11717 xmlResetLastError();
11718 if (mem_base != xmlMemBlocks()) {
11719 printf("Leak of %d blocks found in xmlNanoFTPGetResponse",
11720 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011721 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011722 printf(" %d", n_ctx);
11723 printf("\n");
11724 }
11725 }
11726#endif
11727
11728 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000011729 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011730}
11731
11732
11733static int
11734test_xmlNanoFTPGetSocket(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011735 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011736
Daniel Veillard27f20102004-11-05 11:50:11 +000011737#ifdef LIBXML_FTP_ENABLED
11738 int mem_base;
11739 int ret_val;
11740 void * ctx; /* an FTP context */
11741 int n_ctx;
11742 const char * filename; /* the file to retrieve (or NULL if path is in context). */
11743 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011744
Daniel Veillard27f20102004-11-05 11:50:11 +000011745 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11746 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
11747 mem_base = xmlMemBlocks();
11748 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11749 filename = gen_filepath(n_filename, 1);
11750
11751 ret_val = xmlNanoFTPGetSocket(ctx, filename);
11752 desret_int(ret_val);
11753 call_tests++;
11754 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11755 des_filepath(n_filename, filename, 1);
11756 xmlResetLastError();
11757 if (mem_base != xmlMemBlocks()) {
11758 printf("Leak of %d blocks found in xmlNanoFTPGetSocket",
11759 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011760 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011761 printf(" %d", n_ctx);
11762 printf(" %d", n_filename);
11763 printf("\n");
11764 }
11765 }
11766 }
11767#endif
11768
11769 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000011770 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011771}
11772
11773
11774static int
11775test_xmlNanoFTPInit(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011776 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011777
11778#ifdef LIBXML_FTP_ENABLED
11779 int mem_base;
11780
11781 mem_base = xmlMemBlocks();
11782
11783 xmlNanoFTPInit();
11784 call_tests++;
11785 xmlResetLastError();
11786 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000011787 printf("Leak of %d blocks found in xmlNanoFTPInit",
Daniel Veillardd93f6252004-11-02 15:53:51 +000011788 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011789 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000011790 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000011791 }
11792#endif
11793
Daniel Veillard3d97e662004-11-04 10:49:00 +000011794 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000011795 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011796}
11797
11798
11799static int
11800test_xmlNanoFTPList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011801 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011802
11803
11804 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000011805 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011806}
11807
11808
11809static int
11810test_xmlNanoFTPNewCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011811 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011812
11813
11814 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000011815 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011816}
11817
11818
11819static int
11820test_xmlNanoFTPOpen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011821 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011822
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011823#ifdef LIBXML_FTP_ENABLED
11824 int mem_base;
11825 void * ret_val;
11826 const char * URL; /* the URL to the resource */
11827 int n_URL;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011828
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011829 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
11830 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011831 URL = gen_filepath(n_URL, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011832
11833 ret_val = xmlNanoFTPOpen(URL);
11834 desret_void_ptr(ret_val);
11835 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011836 des_filepath(n_URL, URL, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011837 xmlResetLastError();
11838 if (mem_base != xmlMemBlocks()) {
11839 printf("Leak of %d blocks found in xmlNanoFTPOpen",
11840 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011841 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011842 printf(" %d", n_URL);
11843 printf("\n");
11844 }
11845 }
11846#endif
11847
Daniel Veillard3d97e662004-11-04 10:49:00 +000011848 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000011849 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011850}
11851
11852
11853static int
11854test_xmlNanoFTPProxy(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011855 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011856
11857#ifdef LIBXML_FTP_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000011858 char * host; /* the proxy host name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000011859 int n_host;
11860 int port; /* the proxy port */
11861 int n_port;
Daniel Veillardce682bc2004-11-05 17:22:25 +000011862 char * user; /* the proxy user name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000011863 int n_user;
Daniel Veillardce682bc2004-11-05 17:22:25 +000011864 char * passwd; /* the proxy password */
Daniel Veillardd93f6252004-11-02 15:53:51 +000011865 int n_passwd;
11866 int type; /* the type of proxy 1 for using SITE, 2 for USER a@b */
11867 int n_type;
11868
11869 for (n_host = 0;n_host < gen_nb_const_char_ptr;n_host++) {
11870 for (n_port = 0;n_port < gen_nb_int;n_port++) {
11871 for (n_user = 0;n_user < gen_nb_const_char_ptr;n_user++) {
11872 for (n_passwd = 0;n_passwd < gen_nb_const_char_ptr;n_passwd++) {
11873 for (n_type = 0;n_type < gen_nb_int;n_type++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +000011874 host = gen_const_char_ptr(n_host, 0);
11875 port = gen_int(n_port, 1);
11876 user = gen_const_char_ptr(n_user, 2);
11877 passwd = gen_const_char_ptr(n_passwd, 3);
11878 type = gen_int(n_type, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011879
11880 xmlNanoFTPProxy(host, port, user, passwd, type);
11881 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011882 des_const_char_ptr(n_host, host, 0);
11883 des_int(n_port, port, 1);
11884 des_const_char_ptr(n_user, user, 2);
11885 des_const_char_ptr(n_passwd, passwd, 3);
11886 des_int(n_type, type, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011887 xmlResetLastError();
11888 }
11889 }
11890 }
11891 }
11892 }
11893#endif
11894
Daniel Veillard3d97e662004-11-04 10:49:00 +000011895 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000011896 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011897}
11898
11899
11900static int
11901test_xmlNanoFTPQuit(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011902 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011903
Daniel Veillard27f20102004-11-05 11:50:11 +000011904#ifdef LIBXML_FTP_ENABLED
11905 int mem_base;
11906 int ret_val;
11907 void * ctx; /* an FTP context */
11908 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011909
Daniel Veillard27f20102004-11-05 11:50:11 +000011910 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11911 mem_base = xmlMemBlocks();
11912 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11913
11914 ret_val = xmlNanoFTPQuit(ctx);
11915 desret_int(ret_val);
11916 call_tests++;
11917 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11918 xmlResetLastError();
11919 if (mem_base != xmlMemBlocks()) {
11920 printf("Leak of %d blocks found in xmlNanoFTPQuit",
11921 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011922 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011923 printf(" %d", n_ctx);
11924 printf("\n");
11925 }
11926 }
11927#endif
11928
11929 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000011930 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011931}
11932
11933
11934static int
11935test_xmlNanoFTPRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011936 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011937
Daniel Veillard27f20102004-11-05 11:50:11 +000011938#ifdef LIBXML_FTP_ENABLED
11939 int mem_base;
11940 int ret_val;
11941 void * ctx; /* the FTP context */
11942 int n_ctx;
11943 void * dest; /* a buffer */
11944 int n_dest;
11945 int len; /* the buffer length */
11946 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011947
Daniel Veillard27f20102004-11-05 11:50:11 +000011948 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11949 for (n_dest = 0;n_dest < gen_nb_void_ptr;n_dest++) {
11950 for (n_len = 0;n_len < gen_nb_int;n_len++) {
11951 mem_base = xmlMemBlocks();
11952 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11953 dest = gen_void_ptr(n_dest, 1);
11954 len = gen_int(n_len, 2);
11955
11956 ret_val = xmlNanoFTPRead(ctx, dest, len);
11957 desret_int(ret_val);
11958 call_tests++;
11959 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11960 des_void_ptr(n_dest, dest, 1);
11961 des_int(n_len, len, 2);
11962 xmlResetLastError();
11963 if (mem_base != xmlMemBlocks()) {
11964 printf("Leak of %d blocks found in xmlNanoFTPRead",
11965 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011966 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011967 printf(" %d", n_ctx);
11968 printf(" %d", n_dest);
11969 printf(" %d", n_len);
11970 printf("\n");
11971 }
11972 }
11973 }
11974 }
11975#endif
11976
11977 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000011978 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011979}
11980
11981
11982static int
11983test_xmlNanoFTPScanProxy(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011984 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011985
11986#ifdef LIBXML_FTP_ENABLED
11987 const char * URL; /* The proxy URL used to initialize the proxy context */
11988 int n_URL;
11989
11990 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +000011991 URL = gen_filepath(n_URL, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011992
11993 xmlNanoFTPScanProxy(URL);
11994 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011995 des_filepath(n_URL, URL, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011996 xmlResetLastError();
11997 }
11998#endif
11999
Daniel Veillard3d97e662004-11-04 10:49:00 +000012000 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000012001 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012002}
12003
12004
12005static int
12006test_xmlNanoFTPUpdateURL(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012007 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012008
Daniel Veillard27f20102004-11-05 11:50:11 +000012009#ifdef LIBXML_FTP_ENABLED
12010 int mem_base;
12011 int ret_val;
12012 void * ctx; /* an FTP context */
12013 int n_ctx;
12014 const char * URL; /* The URL used to update the context */
12015 int n_URL;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012016
Daniel Veillard27f20102004-11-05 11:50:11 +000012017 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
12018 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
12019 mem_base = xmlMemBlocks();
12020 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
12021 URL = gen_filepath(n_URL, 1);
12022
12023 ret_val = xmlNanoFTPUpdateURL(ctx, URL);
12024 desret_int(ret_val);
12025 call_tests++;
12026 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
12027 des_filepath(n_URL, URL, 1);
12028 xmlResetLastError();
12029 if (mem_base != xmlMemBlocks()) {
12030 printf("Leak of %d blocks found in xmlNanoFTPUpdateURL",
12031 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012032 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012033 printf(" %d", n_ctx);
12034 printf(" %d", n_URL);
12035 printf("\n");
12036 }
12037 }
12038 }
12039#endif
12040
12041 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000012042 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012043}
12044
12045static int
12046test_nanoftp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012047 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012048
Daniel Veillard27f20102004-11-05 11:50:11 +000012049 printf("Testing nanoftp : 15 of 22 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000012050 test_ret += test_xmlNanoFTPCheckResponse();
12051 test_ret += test_xmlNanoFTPCleanup();
12052 test_ret += test_xmlNanoFTPCloseConnection();
12053 test_ret += test_xmlNanoFTPCwd();
12054 test_ret += test_xmlNanoFTPDele();
12055 test_ret += test_xmlNanoFTPGet();
12056 test_ret += test_xmlNanoFTPGetConnection();
12057 test_ret += test_xmlNanoFTPGetResponse();
12058 test_ret += test_xmlNanoFTPGetSocket();
12059 test_ret += test_xmlNanoFTPInit();
12060 test_ret += test_xmlNanoFTPList();
12061 test_ret += test_xmlNanoFTPNewCtxt();
12062 test_ret += test_xmlNanoFTPOpen();
12063 test_ret += test_xmlNanoFTPProxy();
12064 test_ret += test_xmlNanoFTPQuit();
12065 test_ret += test_xmlNanoFTPRead();
12066 test_ret += test_xmlNanoFTPScanProxy();
12067 test_ret += test_xmlNanoFTPUpdateURL();
Daniel Veillardd93f6252004-11-02 15:53:51 +000012068
Daniel Veillard42595322004-11-08 10:52:06 +000012069 if (test_ret != 0)
12070 printf("Module nanoftp: %d errors\n", test_ret);
12071 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012072}
12073
12074static int
12075test_xmlNanoHTTPAuthHeader(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012076 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012077
Daniel Veillard27f20102004-11-05 11:50:11 +000012078#ifdef LIBXML_HTTP_ENABLED
12079 int mem_base;
12080 const char * ret_val;
12081 void * ctx; /* the HTTP context */
12082 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012083
Daniel Veillard27f20102004-11-05 11:50:11 +000012084 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
12085 mem_base = xmlMemBlocks();
12086 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
12087
12088 ret_val = xmlNanoHTTPAuthHeader(ctx);
12089 desret_const_char_ptr(ret_val);
12090 call_tests++;
12091 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
12092 xmlResetLastError();
12093 if (mem_base != xmlMemBlocks()) {
12094 printf("Leak of %d blocks found in xmlNanoHTTPAuthHeader",
12095 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012096 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012097 printf(" %d", n_ctx);
12098 printf("\n");
12099 }
12100 }
12101#endif
12102
12103 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000012104 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012105}
12106
12107
12108static int
12109test_xmlNanoHTTPCleanup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012110 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012111
12112#ifdef LIBXML_HTTP_ENABLED
12113 int mem_base;
12114
12115 mem_base = xmlMemBlocks();
12116
12117 xmlNanoHTTPCleanup();
12118 call_tests++;
12119 xmlResetLastError();
12120 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012121 printf("Leak of %d blocks found in xmlNanoHTTPCleanup",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012122 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012123 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012124 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012125 }
12126#endif
12127
Daniel Veillard3d97e662004-11-04 10:49:00 +000012128 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000012129 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012130}
12131
12132
12133static int
12134test_xmlNanoHTTPClose(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012135 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012136
Daniel Veillard27f20102004-11-05 11:50:11 +000012137#ifdef LIBXML_HTTP_ENABLED
12138 int mem_base;
12139 void * ctx; /* the HTTP context */
12140 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012141
Daniel Veillard27f20102004-11-05 11:50:11 +000012142 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
12143 mem_base = xmlMemBlocks();
12144 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
12145
12146 xmlNanoHTTPClose(ctx);
12147 call_tests++;
12148 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
12149 xmlResetLastError();
12150 if (mem_base != xmlMemBlocks()) {
12151 printf("Leak of %d blocks found in xmlNanoHTTPClose",
12152 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012153 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012154 printf(" %d", n_ctx);
12155 printf("\n");
12156 }
12157 }
12158#endif
12159
12160 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000012161 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012162}
12163
12164
12165static int
12166test_xmlNanoHTTPContentLength(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012167 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012168
Daniel Veillard27f20102004-11-05 11:50:11 +000012169#ifdef LIBXML_HTTP_ENABLED
12170 int mem_base;
12171 int ret_val;
12172 void * ctx; /* the HTTP context */
12173 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012174
Daniel Veillard27f20102004-11-05 11:50:11 +000012175 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
12176 mem_base = xmlMemBlocks();
12177 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
12178
12179 ret_val = xmlNanoHTTPContentLength(ctx);
12180 desret_int(ret_val);
12181 call_tests++;
12182 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
12183 xmlResetLastError();
12184 if (mem_base != xmlMemBlocks()) {
12185 printf("Leak of %d blocks found in xmlNanoHTTPContentLength",
12186 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012187 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012188 printf(" %d", n_ctx);
12189 printf("\n");
12190 }
12191 }
12192#endif
12193
12194 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000012195 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012196}
12197
12198
12199static int
12200test_xmlNanoHTTPEncoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012201 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012202
Daniel Veillard27f20102004-11-05 11:50:11 +000012203#ifdef LIBXML_HTTP_ENABLED
12204 int mem_base;
12205 const char * ret_val;
12206 void * ctx; /* the HTTP context */
12207 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012208
Daniel Veillard27f20102004-11-05 11:50:11 +000012209 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
12210 mem_base = xmlMemBlocks();
12211 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
12212
12213 ret_val = xmlNanoHTTPEncoding(ctx);
12214 desret_const_char_ptr(ret_val);
12215 call_tests++;
12216 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
12217 xmlResetLastError();
12218 if (mem_base != xmlMemBlocks()) {
12219 printf("Leak of %d blocks found in xmlNanoHTTPEncoding",
12220 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012221 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012222 printf(" %d", n_ctx);
12223 printf("\n");
12224 }
12225 }
12226#endif
12227
12228 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000012229 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012230}
12231
12232
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012233#define gen_nb_char_ptr_ptr 1
12234static char ** gen_char_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
12235 return(NULL);
12236}
12237static void des_char_ptr_ptr(int no ATTRIBUTE_UNUSED, char ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
12238}
12239
Daniel Veillardd93f6252004-11-02 15:53:51 +000012240static int
12241test_xmlNanoHTTPFetch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012242 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012243
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012244#ifdef LIBXML_HTTP_ENABLED
12245 int mem_base;
12246 int ret_val;
12247 const char * URL; /* The URL to load */
12248 int n_URL;
12249 const char * filename; /* the filename where the content should be saved */
12250 int n_filename;
12251 char ** contentType; /* if available the Content-Type information will be returned at that location */
12252 int n_contentType;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012253
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012254 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
12255 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
12256 for (n_contentType = 0;n_contentType < gen_nb_char_ptr_ptr;n_contentType++) {
12257 mem_base = xmlMemBlocks();
12258 URL = gen_filepath(n_URL, 0);
12259 filename = gen_filepath(n_filename, 1);
12260 contentType = gen_char_ptr_ptr(n_contentType, 2);
12261
12262 ret_val = xmlNanoHTTPFetch(URL, filename, contentType);
12263 desret_int(ret_val);
12264 call_tests++;
12265 des_filepath(n_URL, URL, 0);
12266 des_filepath(n_filename, filename, 1);
12267 des_char_ptr_ptr(n_contentType, contentType, 2);
12268 xmlResetLastError();
12269 if (mem_base != xmlMemBlocks()) {
12270 printf("Leak of %d blocks found in xmlNanoHTTPFetch",
12271 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012272 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012273 printf(" %d", n_URL);
12274 printf(" %d", n_filename);
12275 printf(" %d", n_contentType);
12276 printf("\n");
12277 }
12278 }
12279 }
12280 }
12281#endif
12282
12283 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000012284 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012285}
12286
12287
12288static int
12289test_xmlNanoHTTPInit(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012290 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012291
12292#ifdef LIBXML_HTTP_ENABLED
12293 int mem_base;
12294
12295 mem_base = xmlMemBlocks();
12296
12297 xmlNanoHTTPInit();
12298 call_tests++;
12299 xmlResetLastError();
12300 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012301 printf("Leak of %d blocks found in xmlNanoHTTPInit",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012302 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012303 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012304 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012305 }
12306#endif
12307
Daniel Veillard3d97e662004-11-04 10:49:00 +000012308 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000012309 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012310}
12311
12312
12313static int
12314test_xmlNanoHTTPMethod(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012315 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012316
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012317#ifdef LIBXML_HTTP_ENABLED
12318 int mem_base;
12319 void * ret_val;
12320 const char * URL; /* The URL to load */
12321 int n_URL;
12322 char * method; /* the HTTP method to use */
12323 int n_method;
12324 char * input; /* the input string if any */
12325 int n_input;
12326 char ** contentType; /* the Content-Type information IN and OUT */
12327 int n_contentType;
12328 char * headers; /* the extra headers */
12329 int n_headers;
12330 int ilen; /* input length */
12331 int n_ilen;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012332
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012333 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
12334 for (n_method = 0;n_method < gen_nb_const_char_ptr;n_method++) {
12335 for (n_input = 0;n_input < gen_nb_const_char_ptr;n_input++) {
12336 for (n_contentType = 0;n_contentType < gen_nb_char_ptr_ptr;n_contentType++) {
12337 for (n_headers = 0;n_headers < gen_nb_const_char_ptr;n_headers++) {
12338 for (n_ilen = 0;n_ilen < gen_nb_int;n_ilen++) {
12339 mem_base = xmlMemBlocks();
12340 URL = gen_filepath(n_URL, 0);
12341 method = gen_const_char_ptr(n_method, 1);
12342 input = gen_const_char_ptr(n_input, 2);
12343 contentType = gen_char_ptr_ptr(n_contentType, 3);
12344 headers = gen_const_char_ptr(n_headers, 4);
12345 ilen = gen_int(n_ilen, 5);
12346
12347 ret_val = xmlNanoHTTPMethod(URL, method, input, contentType, headers, ilen);
12348 desret_void_ptr(ret_val);
12349 call_tests++;
12350 des_filepath(n_URL, URL, 0);
12351 des_const_char_ptr(n_method, method, 1);
12352 des_const_char_ptr(n_input, input, 2);
12353 des_char_ptr_ptr(n_contentType, contentType, 3);
12354 des_const_char_ptr(n_headers, headers, 4);
12355 des_int(n_ilen, ilen, 5);
12356 xmlResetLastError();
12357 if (mem_base != xmlMemBlocks()) {
12358 printf("Leak of %d blocks found in xmlNanoHTTPMethod",
12359 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012360 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012361 printf(" %d", n_URL);
12362 printf(" %d", n_method);
12363 printf(" %d", n_input);
12364 printf(" %d", n_contentType);
12365 printf(" %d", n_headers);
12366 printf(" %d", n_ilen);
12367 printf("\n");
12368 }
12369 }
12370 }
12371 }
12372 }
12373 }
12374 }
12375#endif
12376
12377 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000012378 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012379}
12380
12381
12382static int
12383test_xmlNanoHTTPMethodRedir(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012384 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012385
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012386#ifdef LIBXML_HTTP_ENABLED
12387 int mem_base;
12388 void * ret_val;
12389 const char * URL; /* The URL to load */
12390 int n_URL;
12391 char * method; /* the HTTP method to use */
12392 int n_method;
12393 char * input; /* the input string if any */
12394 int n_input;
12395 char ** contentType; /* the Content-Type information IN and OUT */
12396 int n_contentType;
12397 char ** redir; /* the redirected URL OUT */
12398 int n_redir;
12399 char * headers; /* the extra headers */
12400 int n_headers;
12401 int ilen; /* input length */
12402 int n_ilen;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012403
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012404 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
12405 for (n_method = 0;n_method < gen_nb_const_char_ptr;n_method++) {
12406 for (n_input = 0;n_input < gen_nb_const_char_ptr;n_input++) {
12407 for (n_contentType = 0;n_contentType < gen_nb_char_ptr_ptr;n_contentType++) {
12408 for (n_redir = 0;n_redir < gen_nb_char_ptr_ptr;n_redir++) {
12409 for (n_headers = 0;n_headers < gen_nb_const_char_ptr;n_headers++) {
12410 for (n_ilen = 0;n_ilen < gen_nb_int;n_ilen++) {
12411 mem_base = xmlMemBlocks();
12412 URL = gen_filepath(n_URL, 0);
12413 method = gen_const_char_ptr(n_method, 1);
12414 input = gen_const_char_ptr(n_input, 2);
12415 contentType = gen_char_ptr_ptr(n_contentType, 3);
12416 redir = gen_char_ptr_ptr(n_redir, 4);
12417 headers = gen_const_char_ptr(n_headers, 5);
12418 ilen = gen_int(n_ilen, 6);
12419
12420 ret_val = xmlNanoHTTPMethodRedir(URL, method, input, contentType, redir, headers, ilen);
12421 desret_void_ptr(ret_val);
12422 call_tests++;
12423 des_filepath(n_URL, URL, 0);
12424 des_const_char_ptr(n_method, method, 1);
12425 des_const_char_ptr(n_input, input, 2);
12426 des_char_ptr_ptr(n_contentType, contentType, 3);
12427 des_char_ptr_ptr(n_redir, redir, 4);
12428 des_const_char_ptr(n_headers, headers, 5);
12429 des_int(n_ilen, ilen, 6);
12430 xmlResetLastError();
12431 if (mem_base != xmlMemBlocks()) {
12432 printf("Leak of %d blocks found in xmlNanoHTTPMethodRedir",
12433 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012434 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012435 printf(" %d", n_URL);
12436 printf(" %d", n_method);
12437 printf(" %d", n_input);
12438 printf(" %d", n_contentType);
12439 printf(" %d", n_redir);
12440 printf(" %d", n_headers);
12441 printf(" %d", n_ilen);
12442 printf("\n");
12443 }
12444 }
12445 }
12446 }
12447 }
12448 }
12449 }
12450 }
12451#endif
12452
12453 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000012454 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012455}
12456
12457
12458static int
12459test_xmlNanoHTTPMimeType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012460 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012461
Daniel Veillard27f20102004-11-05 11:50:11 +000012462#ifdef LIBXML_HTTP_ENABLED
12463 int mem_base;
12464 const char * ret_val;
12465 void * ctx; /* the HTTP context */
12466 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012467
Daniel Veillard27f20102004-11-05 11:50:11 +000012468 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
12469 mem_base = xmlMemBlocks();
12470 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
12471
12472 ret_val = xmlNanoHTTPMimeType(ctx);
12473 desret_const_char_ptr(ret_val);
12474 call_tests++;
12475 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
12476 xmlResetLastError();
12477 if (mem_base != xmlMemBlocks()) {
12478 printf("Leak of %d blocks found in xmlNanoHTTPMimeType",
12479 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012480 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012481 printf(" %d", n_ctx);
12482 printf("\n");
12483 }
12484 }
12485#endif
12486
12487 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000012488 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012489}
12490
12491
12492static int
12493test_xmlNanoHTTPOpen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012494 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012495
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012496#ifdef LIBXML_HTTP_ENABLED
12497 int mem_base;
12498 void * ret_val;
12499 const char * URL; /* The URL to load */
12500 int n_URL;
12501 char ** contentType; /* if available the Content-Type information will be returned at that location */
12502 int n_contentType;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012503
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012504 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
12505 for (n_contentType = 0;n_contentType < gen_nb_char_ptr_ptr;n_contentType++) {
12506 mem_base = xmlMemBlocks();
12507 URL = gen_filepath(n_URL, 0);
12508 contentType = gen_char_ptr_ptr(n_contentType, 1);
12509
12510 ret_val = xmlNanoHTTPOpen(URL, contentType);
12511 desret_void_ptr(ret_val);
12512 call_tests++;
12513 des_filepath(n_URL, URL, 0);
12514 des_char_ptr_ptr(n_contentType, contentType, 1);
12515 xmlResetLastError();
12516 if (mem_base != xmlMemBlocks()) {
12517 printf("Leak of %d blocks found in xmlNanoHTTPOpen",
12518 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012519 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012520 printf(" %d", n_URL);
12521 printf(" %d", n_contentType);
12522 printf("\n");
12523 }
12524 }
12525 }
12526#endif
12527
12528 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000012529 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012530}
12531
12532
12533static int
12534test_xmlNanoHTTPOpenRedir(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012535 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012536
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012537#ifdef LIBXML_HTTP_ENABLED
12538 int mem_base;
12539 void * ret_val;
12540 const char * URL; /* The URL to load */
12541 int n_URL;
12542 char ** contentType; /* if available the Content-Type information will be returned at that location */
12543 int n_contentType;
12544 char ** redir; /* if available the redirected URL will be returned */
12545 int n_redir;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012546
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012547 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
12548 for (n_contentType = 0;n_contentType < gen_nb_char_ptr_ptr;n_contentType++) {
12549 for (n_redir = 0;n_redir < gen_nb_char_ptr_ptr;n_redir++) {
12550 mem_base = xmlMemBlocks();
12551 URL = gen_filepath(n_URL, 0);
12552 contentType = gen_char_ptr_ptr(n_contentType, 1);
12553 redir = gen_char_ptr_ptr(n_redir, 2);
12554
12555 ret_val = xmlNanoHTTPOpenRedir(URL, contentType, redir);
12556 desret_void_ptr(ret_val);
12557 call_tests++;
12558 des_filepath(n_URL, URL, 0);
12559 des_char_ptr_ptr(n_contentType, contentType, 1);
12560 des_char_ptr_ptr(n_redir, redir, 2);
12561 xmlResetLastError();
12562 if (mem_base != xmlMemBlocks()) {
12563 printf("Leak of %d blocks found in xmlNanoHTTPOpenRedir",
12564 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012565 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012566 printf(" %d", n_URL);
12567 printf(" %d", n_contentType);
12568 printf(" %d", n_redir);
12569 printf("\n");
12570 }
12571 }
12572 }
12573 }
12574#endif
12575
12576 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000012577 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012578}
12579
12580
12581static int
12582test_xmlNanoHTTPRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012583 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012584
Daniel Veillard27f20102004-11-05 11:50:11 +000012585#ifdef LIBXML_HTTP_ENABLED
12586 int mem_base;
12587 int ret_val;
12588 void * ctx; /* the HTTP context */
12589 int n_ctx;
12590 void * dest; /* a buffer */
12591 int n_dest;
12592 int len; /* the buffer length */
12593 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012594
Daniel Veillard27f20102004-11-05 11:50:11 +000012595 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
12596 for (n_dest = 0;n_dest < gen_nb_void_ptr;n_dest++) {
12597 for (n_len = 0;n_len < gen_nb_int;n_len++) {
12598 mem_base = xmlMemBlocks();
12599 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
12600 dest = gen_void_ptr(n_dest, 1);
12601 len = gen_int(n_len, 2);
12602
12603 ret_val = xmlNanoHTTPRead(ctx, dest, len);
12604 desret_int(ret_val);
12605 call_tests++;
12606 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
12607 des_void_ptr(n_dest, dest, 1);
12608 des_int(n_len, len, 2);
12609 xmlResetLastError();
12610 if (mem_base != xmlMemBlocks()) {
12611 printf("Leak of %d blocks found in xmlNanoHTTPRead",
12612 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012613 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012614 printf(" %d", n_ctx);
12615 printf(" %d", n_dest);
12616 printf(" %d", n_len);
12617 printf("\n");
12618 }
12619 }
12620 }
12621 }
12622#endif
12623
12624 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000012625 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012626}
12627
12628
12629static int
12630test_xmlNanoHTTPRedir(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012631 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012632
12633
12634 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000012635 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012636}
12637
12638
12639static int
12640test_xmlNanoHTTPReturnCode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012641 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012642
Daniel Veillard27f20102004-11-05 11:50:11 +000012643#ifdef LIBXML_HTTP_ENABLED
12644 int mem_base;
12645 int ret_val;
12646 void * ctx; /* the HTTP context */
12647 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012648
Daniel Veillard27f20102004-11-05 11:50:11 +000012649 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
12650 mem_base = xmlMemBlocks();
12651 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
12652
12653 ret_val = xmlNanoHTTPReturnCode(ctx);
12654 desret_int(ret_val);
12655 call_tests++;
12656 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
12657 xmlResetLastError();
12658 if (mem_base != xmlMemBlocks()) {
12659 printf("Leak of %d blocks found in xmlNanoHTTPReturnCode",
12660 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012661 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012662 printf(" %d", n_ctx);
12663 printf("\n");
12664 }
12665 }
12666#endif
12667
12668 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000012669 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012670}
12671
12672
12673static int
12674test_xmlNanoHTTPSave(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012675 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012676
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012677#ifdef LIBXML_HTTP_ENABLED
12678#ifdef LIBXML_OUTPUT_ENABLED
12679 int mem_base;
12680 int ret_val;
12681 void * ctxt; /* the HTTP context */
12682 int n_ctxt;
12683 const char * filename; /* the filename where the content should be saved */
12684 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012685
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012686 for (n_ctxt = 0;n_ctxt < gen_nb_void_ptr;n_ctxt++) {
12687 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
12688 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012689 ctxt = gen_void_ptr(n_ctxt, 0);
12690 filename = gen_fileoutput(n_filename, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012691
12692 ret_val = xmlNanoHTTPSave(ctxt, filename);
12693 desret_int(ret_val);
12694 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012695 des_void_ptr(n_ctxt, ctxt, 0);
12696 des_fileoutput(n_filename, filename, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012697 xmlResetLastError();
12698 if (mem_base != xmlMemBlocks()) {
12699 printf("Leak of %d blocks found in xmlNanoHTTPSave",
12700 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012701 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012702 printf(" %d", n_ctxt);
12703 printf(" %d", n_filename);
12704 printf("\n");
12705 }
12706 }
12707 }
12708#endif
12709#endif
12710
Daniel Veillard3d97e662004-11-04 10:49:00 +000012711 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000012712 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012713}
12714
12715
12716static int
12717test_xmlNanoHTTPScanProxy(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012718 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012719
12720#ifdef LIBXML_HTTP_ENABLED
12721 const char * URL; /* The proxy URL used to initialize the proxy context */
12722 int n_URL;
12723
12724 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +000012725 URL = gen_filepath(n_URL, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012726
12727 xmlNanoHTTPScanProxy(URL);
12728 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012729 des_filepath(n_URL, URL, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012730 xmlResetLastError();
12731 }
12732#endif
12733
Daniel Veillard3d97e662004-11-04 10:49:00 +000012734 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000012735 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012736}
12737
12738static int
12739test_nanohttp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012740 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012741
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012742 printf("Testing nanohttp : 16 of 17 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000012743 test_ret += test_xmlNanoHTTPAuthHeader();
12744 test_ret += test_xmlNanoHTTPCleanup();
12745 test_ret += test_xmlNanoHTTPClose();
12746 test_ret += test_xmlNanoHTTPContentLength();
12747 test_ret += test_xmlNanoHTTPEncoding();
12748 test_ret += test_xmlNanoHTTPFetch();
12749 test_ret += test_xmlNanoHTTPInit();
12750 test_ret += test_xmlNanoHTTPMethod();
12751 test_ret += test_xmlNanoHTTPMethodRedir();
12752 test_ret += test_xmlNanoHTTPMimeType();
12753 test_ret += test_xmlNanoHTTPOpen();
12754 test_ret += test_xmlNanoHTTPOpenRedir();
12755 test_ret += test_xmlNanoHTTPRead();
12756 test_ret += test_xmlNanoHTTPRedir();
12757 test_ret += test_xmlNanoHTTPReturnCode();
12758 test_ret += test_xmlNanoHTTPSave();
12759 test_ret += test_xmlNanoHTTPScanProxy();
Daniel Veillardd93f6252004-11-02 15:53:51 +000012760
Daniel Veillard42595322004-11-08 10:52:06 +000012761 if (test_ret != 0)
12762 printf("Module nanohttp: %d errors\n", test_ret);
12763 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012764}
12765
12766static int
12767test_xmlByteConsumed(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012768 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012769
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000012770 int mem_base;
12771 long ret_val;
12772 xmlParserCtxtPtr ctxt; /* an XML parser context */
12773 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012774
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000012775 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12776 mem_base = xmlMemBlocks();
12777 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
12778
12779 ret_val = xmlByteConsumed(ctxt);
12780 desret_long(ret_val);
12781 call_tests++;
12782 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
12783 xmlResetLastError();
12784 if (mem_base != xmlMemBlocks()) {
12785 printf("Leak of %d blocks found in xmlByteConsumed",
12786 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012787 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000012788 printf(" %d", n_ctxt);
12789 printf("\n");
12790 }
12791 }
12792
12793 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000012794 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012795}
12796
12797
Daniel Veillardce682bc2004-11-05 17:22:25 +000012798#define gen_nb_xmlParserNodeInfoSeqPtr 1
12799static xmlParserNodeInfoSeqPtr gen_xmlParserNodeInfoSeqPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
12800 return(NULL);
12801}
12802static void des_xmlParserNodeInfoSeqPtr(int no ATTRIBUTE_UNUSED, xmlParserNodeInfoSeqPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
12803}
12804
Daniel Veillardd93f6252004-11-02 15:53:51 +000012805static int
12806test_xmlClearNodeInfoSeq(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012807 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012808
Daniel Veillardce682bc2004-11-05 17:22:25 +000012809 int mem_base;
12810 xmlParserNodeInfoSeqPtr seq; /* a node info sequence pointer */
12811 int n_seq;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012812
Daniel Veillardce682bc2004-11-05 17:22:25 +000012813 for (n_seq = 0;n_seq < gen_nb_xmlParserNodeInfoSeqPtr;n_seq++) {
12814 mem_base = xmlMemBlocks();
12815 seq = gen_xmlParserNodeInfoSeqPtr(n_seq, 0);
12816
12817 xmlClearNodeInfoSeq(seq);
12818 call_tests++;
12819 des_xmlParserNodeInfoSeqPtr(n_seq, seq, 0);
12820 xmlResetLastError();
12821 if (mem_base != xmlMemBlocks()) {
12822 printf("Leak of %d blocks found in xmlClearNodeInfoSeq",
12823 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012824 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012825 printf(" %d", n_seq);
12826 printf("\n");
12827 }
12828 }
12829
12830 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000012831 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012832}
12833
12834
12835static int
12836test_xmlClearParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012837 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012838
12839 int mem_base;
12840 xmlParserCtxtPtr ctxt; /* an XML parser context */
12841 int n_ctxt;
12842
12843 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12844 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012845 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012846
12847 xmlClearParserCtxt(ctxt);
12848 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012849 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012850 xmlResetLastError();
12851 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012852 printf("Leak of %d blocks found in xmlClearParserCtxt",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012853 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012854 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012855 printf(" %d", n_ctxt);
12856 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012857 }
12858 }
12859
Daniel Veillard3d97e662004-11-04 10:49:00 +000012860 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000012861 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012862}
12863
12864
12865static int
12866test_xmlCreateDocParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012867 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012868
Daniel Veillard34099b42004-11-04 17:34:35 +000012869 int mem_base;
12870 xmlParserCtxtPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012871 xmlChar * cur; /* a pointer to an array of xmlChar */
Daniel Veillard34099b42004-11-04 17:34:35 +000012872 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012873
Daniel Veillard34099b42004-11-04 17:34:35 +000012874 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
12875 mem_base = xmlMemBlocks();
12876 cur = gen_const_xmlChar_ptr(n_cur, 0);
12877
12878 ret_val = xmlCreateDocParserCtxt(cur);
12879 desret_xmlParserCtxtPtr(ret_val);
12880 call_tests++;
12881 des_const_xmlChar_ptr(n_cur, cur, 0);
12882 xmlResetLastError();
12883 if (mem_base != xmlMemBlocks()) {
12884 printf("Leak of %d blocks found in xmlCreateDocParserCtxt",
12885 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012886 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000012887 printf(" %d", n_cur);
12888 printf("\n");
12889 }
12890 }
12891
12892 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000012893 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012894}
12895
12896
12897static int
12898test_xmlCreatePushParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012899 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012900
Daniel Veillard34099b42004-11-04 17:34:35 +000012901#ifdef LIBXML_PUSH_ENABLED
12902 int mem_base;
12903 xmlParserCtxtPtr ret_val;
12904 xmlSAXHandlerPtr sax; /* a SAX handler */
12905 int n_sax;
12906 void * user_data; /* The user data returned on SAX callbacks */
12907 int n_user_data;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012908 char * chunk; /* a pointer to an array of chars */
Daniel Veillard34099b42004-11-04 17:34:35 +000012909 int n_chunk;
12910 int size; /* number of chars in the array */
12911 int n_size;
12912 const char * filename; /* an optional file name or URI */
12913 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012914
Daniel Veillard34099b42004-11-04 17:34:35 +000012915 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
12916 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
12917 for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) {
12918 for (n_size = 0;n_size < gen_nb_int;n_size++) {
Daniel Veillard42595322004-11-08 10:52:06 +000012919 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
Daniel Veillard34099b42004-11-04 17:34:35 +000012920 mem_base = xmlMemBlocks();
12921 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
12922 user_data = gen_userdata(n_user_data, 1);
12923 chunk = gen_const_char_ptr(n_chunk, 2);
12924 size = gen_int(n_size, 3);
Daniel Veillard42595322004-11-08 10:52:06 +000012925 filename = gen_fileoutput(n_filename, 4);
Daniel Veillard34099b42004-11-04 17:34:35 +000012926
12927 ret_val = xmlCreatePushParserCtxt(sax, user_data, chunk, size, filename);
12928 desret_xmlParserCtxtPtr(ret_val);
12929 call_tests++;
12930 des_xmlSAXHandlerPtr(n_sax, sax, 0);
12931 des_userdata(n_user_data, user_data, 1);
12932 des_const_char_ptr(n_chunk, chunk, 2);
12933 des_int(n_size, size, 3);
Daniel Veillard42595322004-11-08 10:52:06 +000012934 des_fileoutput(n_filename, filename, 4);
Daniel Veillard34099b42004-11-04 17:34:35 +000012935 xmlResetLastError();
12936 if (mem_base != xmlMemBlocks()) {
12937 printf("Leak of %d blocks found in xmlCreatePushParserCtxt",
12938 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012939 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000012940 printf(" %d", n_sax);
12941 printf(" %d", n_user_data);
12942 printf(" %d", n_chunk);
12943 printf(" %d", n_size);
12944 printf(" %d", n_filename);
12945 printf("\n");
12946 }
12947 }
12948 }
12949 }
12950 }
12951 }
12952#endif
12953
12954 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000012955 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012956}
12957
12958
12959static int
12960test_xmlCtxtReadDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012961 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012962
12963 int mem_base;
12964 xmlDocPtr ret_val;
12965 xmlParserCtxtPtr ctxt; /* an XML parser context */
12966 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012967 xmlChar * cur; /* a pointer to a zero terminated string */
Daniel Veillardd93f6252004-11-02 15:53:51 +000012968 int n_cur;
12969 const char * URL; /* the base URL to use for the document */
12970 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012971 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000012972 int n_encoding;
12973 int options; /* a combination of xmlParserOption */
12974 int n_options;
12975
12976 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12977 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
12978 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
12979 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000012980 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000012981 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012982 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
12983 cur = gen_const_xmlChar_ptr(n_cur, 1);
12984 URL = gen_filepath(n_URL, 2);
12985 encoding = gen_const_char_ptr(n_encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000012986 options = gen_parseroptions(n_options, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012987
12988 ret_val = xmlCtxtReadDoc(ctxt, cur, URL, encoding, options);
12989 desret_xmlDocPtr(ret_val);
12990 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012991 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
12992 des_const_xmlChar_ptr(n_cur, cur, 1);
12993 des_filepath(n_URL, URL, 2);
12994 des_const_char_ptr(n_encoding, encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000012995 des_parseroptions(n_options, options, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012996 xmlResetLastError();
12997 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012998 printf("Leak of %d blocks found in xmlCtxtReadDoc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012999 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013000 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013001 printf(" %d", n_ctxt);
13002 printf(" %d", n_cur);
13003 printf(" %d", n_URL);
13004 printf(" %d", n_encoding);
13005 printf(" %d", n_options);
13006 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013007 }
13008 }
13009 }
13010 }
13011 }
13012 }
13013
Daniel Veillard3d97e662004-11-04 10:49:00 +000013014 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000013015 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013016}
13017
13018
13019static int
13020test_xmlCtxtReadFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013021 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013022
13023 int mem_base;
13024 xmlDocPtr ret_val;
13025 xmlParserCtxtPtr ctxt; /* an XML parser context */
13026 int n_ctxt;
13027 const char * filename; /* a file or URL */
13028 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013029 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000013030 int n_encoding;
13031 int options; /* a combination of xmlParserOption */
13032 int n_options;
13033
13034 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13035 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
13036 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000013037 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000013038 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013039 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
13040 filename = gen_filepath(n_filename, 1);
13041 encoding = gen_const_char_ptr(n_encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000013042 options = gen_parseroptions(n_options, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013043
13044 ret_val = xmlCtxtReadFile(ctxt, filename, encoding, options);
13045 desret_xmlDocPtr(ret_val);
13046 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013047 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
13048 des_filepath(n_filename, filename, 1);
13049 des_const_char_ptr(n_encoding, encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000013050 des_parseroptions(n_options, options, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013051 xmlResetLastError();
13052 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013053 printf("Leak of %d blocks found in xmlCtxtReadFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013054 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013055 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013056 printf(" %d", n_ctxt);
13057 printf(" %d", n_filename);
13058 printf(" %d", n_encoding);
13059 printf(" %d", n_options);
13060 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013061 }
13062 }
13063 }
13064 }
13065 }
13066
Daniel Veillard3d97e662004-11-04 10:49:00 +000013067 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000013068 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013069}
13070
13071
13072static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000013073test_xmlCtxtReadMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013074 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013075
13076 int mem_base;
13077 xmlDocPtr ret_val;
13078 xmlParserCtxtPtr ctxt; /* an XML parser context */
13079 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013080 char * buffer; /* a pointer to a char array */
Daniel Veillardd93f6252004-11-02 15:53:51 +000013081 int n_buffer;
13082 int size; /* the size of the array */
13083 int n_size;
13084 const char * URL; /* the base URL to use for the document */
13085 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013086 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000013087 int n_encoding;
13088 int options; /* a combination of xmlParserOption */
13089 int n_options;
13090
13091 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13092 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
13093 for (n_size = 0;n_size < gen_nb_int;n_size++) {
13094 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
13095 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000013096 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000013097 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013098 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
13099 buffer = gen_const_char_ptr(n_buffer, 1);
13100 size = gen_int(n_size, 2);
13101 URL = gen_filepath(n_URL, 3);
13102 encoding = gen_const_char_ptr(n_encoding, 4);
Daniel Veillard6128c012004-11-08 17:16:15 +000013103 options = gen_parseroptions(n_options, 5);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013104
13105 ret_val = xmlCtxtReadMemory(ctxt, buffer, size, URL, encoding, options);
13106 desret_xmlDocPtr(ret_val);
13107 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013108 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
13109 des_const_char_ptr(n_buffer, buffer, 1);
13110 des_int(n_size, size, 2);
13111 des_filepath(n_URL, URL, 3);
13112 des_const_char_ptr(n_encoding, encoding, 4);
Daniel Veillard6128c012004-11-08 17:16:15 +000013113 des_parseroptions(n_options, options, 5);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013114 xmlResetLastError();
13115 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013116 printf("Leak of %d blocks found in xmlCtxtReadMemory",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013117 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013118 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013119 printf(" %d", n_ctxt);
13120 printf(" %d", n_buffer);
13121 printf(" %d", n_size);
13122 printf(" %d", n_URL);
13123 printf(" %d", n_encoding);
13124 printf(" %d", n_options);
13125 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013126 }
13127 }
13128 }
13129 }
13130 }
13131 }
13132 }
13133
Daniel Veillard3d97e662004-11-04 10:49:00 +000013134 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000013135 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013136}
13137
13138
13139static int
13140test_xmlCtxtReset(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013141 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013142
13143 int mem_base;
13144 xmlParserCtxtPtr ctxt; /* an XML parser context */
13145 int n_ctxt;
13146
13147 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13148 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013149 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013150
13151 xmlCtxtReset(ctxt);
13152 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013153 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013154 xmlResetLastError();
13155 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013156 printf("Leak of %d blocks found in xmlCtxtReset",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013157 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013158 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013159 printf(" %d", n_ctxt);
13160 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013161 }
13162 }
13163
Daniel Veillard3d97e662004-11-04 10:49:00 +000013164 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000013165 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013166}
13167
13168
13169static int
13170test_xmlCtxtResetPush(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013171 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013172
13173 int mem_base;
13174 int ret_val;
13175 xmlParserCtxtPtr ctxt; /* an XML parser context */
13176 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013177 char * chunk; /* a pointer to an array of chars */
Daniel Veillardd93f6252004-11-02 15:53:51 +000013178 int n_chunk;
13179 int size; /* number of chars in the array */
13180 int n_size;
13181 const char * filename; /* an optional file name or URI */
13182 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013183 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000013184 int n_encoding;
13185
13186 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13187 for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) {
13188 for (n_size = 0;n_size < gen_nb_int;n_size++) {
13189 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
13190 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
13191 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013192 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
13193 chunk = gen_const_char_ptr(n_chunk, 1);
13194 size = gen_int(n_size, 2);
13195 filename = gen_filepath(n_filename, 3);
13196 encoding = gen_const_char_ptr(n_encoding, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013197
13198 ret_val = xmlCtxtResetPush(ctxt, chunk, size, filename, encoding);
13199 desret_int(ret_val);
13200 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013201 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
13202 des_const_char_ptr(n_chunk, chunk, 1);
13203 des_int(n_size, size, 2);
13204 des_filepath(n_filename, filename, 3);
13205 des_const_char_ptr(n_encoding, encoding, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013206 xmlResetLastError();
13207 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013208 printf("Leak of %d blocks found in xmlCtxtResetPush",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013209 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013210 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013211 printf(" %d", n_ctxt);
13212 printf(" %d", n_chunk);
13213 printf(" %d", n_size);
13214 printf(" %d", n_filename);
13215 printf(" %d", n_encoding);
13216 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013217 }
13218 }
13219 }
13220 }
13221 }
13222 }
13223
Daniel Veillard3d97e662004-11-04 10:49:00 +000013224 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000013225 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013226}
13227
13228
13229static int
13230test_xmlCtxtUseOptions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013231 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013232
13233 int mem_base;
13234 int ret_val;
13235 xmlParserCtxtPtr ctxt; /* an XML parser context */
13236 int n_ctxt;
13237 int options; /* a combination of xmlParserOption */
13238 int n_options;
13239
13240 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000013241 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000013242 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013243 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillard6128c012004-11-08 17:16:15 +000013244 options = gen_parseroptions(n_options, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013245
13246 ret_val = xmlCtxtUseOptions(ctxt, options);
13247 desret_int(ret_val);
13248 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013249 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillard6128c012004-11-08 17:16:15 +000013250 des_parseroptions(n_options, options, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013251 xmlResetLastError();
13252 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013253 printf("Leak of %d blocks found in xmlCtxtUseOptions",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013254 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013255 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013256 printf(" %d", n_ctxt);
13257 printf(" %d", n_options);
13258 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013259 }
13260 }
13261 }
13262
Daniel Veillard3d97e662004-11-04 10:49:00 +000013263 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000013264 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013265}
13266
13267
13268static int
13269test_xmlGetExternalEntityLoader(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013270 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013271
13272
13273 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000013274 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013275}
13276
13277
13278static int
13279test_xmlGetFeature(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013280 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013281
Daniel Veillarda521d282004-11-09 14:59:59 +000013282#ifdef LIBXML_LEGACY_ENABLED
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000013283 int mem_base;
13284 int ret_val;
13285 xmlParserCtxtPtr ctxt; /* an XML/HTML parser context */
13286 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013287 char * name; /* the feature name */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000013288 int n_name;
13289 void * result; /* location to store the result */
13290 int n_result;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013291
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000013292 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13293 for (n_name = 0;n_name < gen_nb_const_char_ptr;n_name++) {
13294 for (n_result = 0;n_result < gen_nb_void_ptr;n_result++) {
13295 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013296 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
13297 name = gen_const_char_ptr(n_name, 1);
13298 result = gen_void_ptr(n_result, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000013299
13300 ret_val = xmlGetFeature(ctxt, name, result);
13301 desret_int(ret_val);
13302 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013303 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
13304 des_const_char_ptr(n_name, name, 1);
13305 des_void_ptr(n_result, result, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000013306 xmlResetLastError();
13307 if (mem_base != xmlMemBlocks()) {
13308 printf("Leak of %d blocks found in xmlGetFeature",
13309 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013310 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000013311 printf(" %d", n_ctxt);
13312 printf(" %d", n_name);
13313 printf(" %d", n_result);
13314 printf("\n");
13315 }
13316 }
13317 }
13318 }
Daniel Veillarda521d282004-11-09 14:59:59 +000013319#endif
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000013320
Daniel Veillard3d97e662004-11-04 10:49:00 +000013321 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000013322 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013323}
13324
13325
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000013326#define gen_nb_const_char_ptr_ptr 1
13327static char ** gen_const_char_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
13328 return(NULL);
13329}
13330static void des_const_char_ptr_ptr(int no ATTRIBUTE_UNUSED, const char ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
13331}
13332
Daniel Veillardd93f6252004-11-02 15:53:51 +000013333static int
13334test_xmlGetFeaturesList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013335 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013336
Daniel Veillarda521d282004-11-09 14:59:59 +000013337#ifdef LIBXML_LEGACY_ENABLED
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000013338 int mem_base;
13339 int ret_val;
13340 int * len; /* the length of the features name array (input/output) */
13341 int n_len;
13342 char ** result; /* an array of string to be filled with the features name. */
13343 int n_result;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013344
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000013345 for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
13346 for (n_result = 0;n_result < gen_nb_const_char_ptr_ptr;n_result++) {
13347 mem_base = xmlMemBlocks();
13348 len = gen_int_ptr(n_len, 0);
13349 result = gen_const_char_ptr_ptr(n_result, 1);
13350
13351 ret_val = xmlGetFeaturesList(len, result);
13352 desret_int(ret_val);
13353 call_tests++;
13354 des_int_ptr(n_len, len, 0);
13355 des_const_char_ptr_ptr(n_result, result, 1);
13356 xmlResetLastError();
13357 if (mem_base != xmlMemBlocks()) {
13358 printf("Leak of %d blocks found in xmlGetFeaturesList",
13359 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013360 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000013361 printf(" %d", n_len);
13362 printf(" %d", n_result);
13363 printf("\n");
13364 }
13365 }
13366 }
Daniel Veillarda521d282004-11-09 14:59:59 +000013367#endif
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000013368
13369 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000013370 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013371}
13372
13373
13374static int
13375test_xmlIOParseDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013376 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013377
Daniel Veillarda521d282004-11-09 14:59:59 +000013378#ifdef LIBXML_VALID_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000013379 int mem_base;
13380 xmlDtdPtr ret_val;
13381 xmlSAXHandlerPtr sax; /* the SAX handler block or NULL */
13382 int n_sax;
13383 xmlParserInputBufferPtr input; /* an Input Buffer */
13384 int n_input;
13385 xmlCharEncoding enc; /* the charset encoding if known */
13386 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013387
Daniel Veillard34099b42004-11-04 17:34:35 +000013388 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
13389 for (n_input = 0;n_input < gen_nb_xmlParserInputBufferPtr;n_input++) {
13390 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
13391 mem_base = xmlMemBlocks();
13392 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
13393 input = gen_xmlParserInputBufferPtr(n_input, 1);
13394 enc = gen_xmlCharEncoding(n_enc, 2);
13395
13396 ret_val = xmlIOParseDTD(sax, input, enc);
13397 input = NULL;
13398 desret_xmlDtdPtr(ret_val);
13399 call_tests++;
13400 des_xmlSAXHandlerPtr(n_sax, sax, 0);
13401 des_xmlParserInputBufferPtr(n_input, input, 1);
13402 des_xmlCharEncoding(n_enc, enc, 2);
13403 xmlResetLastError();
13404 if (mem_base != xmlMemBlocks()) {
13405 printf("Leak of %d blocks found in xmlIOParseDTD",
13406 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013407 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000013408 printf(" %d", n_sax);
13409 printf(" %d", n_input);
13410 printf(" %d", n_enc);
13411 printf("\n");
13412 }
13413 }
13414 }
13415 }
Daniel Veillarda521d282004-11-09 14:59:59 +000013416#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000013417
13418 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000013419 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013420}
13421
13422
13423static int
13424test_xmlInitNodeInfoSeq(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013425 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013426
Daniel Veillardce682bc2004-11-05 17:22:25 +000013427 int mem_base;
13428 xmlParserNodeInfoSeqPtr seq; /* a node info sequence pointer */
13429 int n_seq;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013430
Daniel Veillardce682bc2004-11-05 17:22:25 +000013431 for (n_seq = 0;n_seq < gen_nb_xmlParserNodeInfoSeqPtr;n_seq++) {
13432 mem_base = xmlMemBlocks();
13433 seq = gen_xmlParserNodeInfoSeqPtr(n_seq, 0);
13434
13435 xmlInitNodeInfoSeq(seq);
13436 call_tests++;
13437 des_xmlParserNodeInfoSeqPtr(n_seq, seq, 0);
13438 xmlResetLastError();
13439 if (mem_base != xmlMemBlocks()) {
13440 printf("Leak of %d blocks found in xmlInitNodeInfoSeq",
13441 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013442 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013443 printf(" %d", n_seq);
13444 printf("\n");
13445 }
13446 }
13447
13448 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000013449 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013450}
13451
13452
13453static int
13454test_xmlInitParser(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013455 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013456
13457 int mem_base;
13458
13459 mem_base = xmlMemBlocks();
13460
13461 xmlInitParser();
13462 call_tests++;
13463 xmlResetLastError();
13464 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013465 printf("Leak of %d blocks found in xmlInitParser",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013466 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013467 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013468 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013469 }
13470
Daniel Veillard3d97e662004-11-04 10:49:00 +000013471 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000013472 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013473}
13474
13475
13476static int
13477test_xmlInitParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013478 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013479
13480 int mem_base;
13481 int ret_val;
13482 xmlParserCtxtPtr ctxt; /* an XML parser context */
13483 int n_ctxt;
13484
13485 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13486 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013487 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013488
13489 ret_val = xmlInitParserCtxt(ctxt);
13490 desret_int(ret_val);
13491 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013492 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013493 xmlResetLastError();
13494 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013495 printf("Leak of %d blocks found in xmlInitParserCtxt",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013496 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013497 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013498 printf(" %d", n_ctxt);
13499 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013500 }
13501 }
13502
Daniel Veillard3d97e662004-11-04 10:49:00 +000013503 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000013504 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013505}
13506
13507
13508static int
13509test_xmlKeepBlanksDefault(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013510 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013511
13512 int mem_base;
13513 int ret_val;
13514 int val; /* int 0 or 1 */
13515 int n_val;
13516
13517 for (n_val = 0;n_val < gen_nb_int;n_val++) {
13518 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013519 val = gen_int(n_val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013520
13521 ret_val = xmlKeepBlanksDefault(val);
13522 desret_int(ret_val);
13523 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013524 des_int(n_val, val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013525 xmlResetLastError();
13526 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013527 printf("Leak of %d blocks found in xmlKeepBlanksDefault",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013528 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013529 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013530 printf(" %d", n_val);
13531 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013532 }
13533 }
13534
Daniel Veillard3d97e662004-11-04 10:49:00 +000013535 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000013536 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013537}
13538
13539
13540static int
13541test_xmlLineNumbersDefault(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013542 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013543
13544 int mem_base;
13545 int ret_val;
13546 int val; /* int 0 or 1 */
13547 int n_val;
13548
13549 for (n_val = 0;n_val < gen_nb_int;n_val++) {
13550 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013551 val = gen_int(n_val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013552
13553 ret_val = xmlLineNumbersDefault(val);
13554 desret_int(ret_val);
13555 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013556 des_int(n_val, val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013557 xmlResetLastError();
13558 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013559 printf("Leak of %d blocks found in xmlLineNumbersDefault",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013560 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013561 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013562 printf(" %d", n_val);
13563 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013564 }
13565 }
13566
Daniel Veillard3d97e662004-11-04 10:49:00 +000013567 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000013568 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013569}
13570
13571
13572static int
13573test_xmlLoadExternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013574 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013575
Daniel Veillard42595322004-11-08 10:52:06 +000013576 int mem_base;
13577 xmlParserInputPtr ret_val;
13578 const char * URL; /* the URL for the entity to load */
13579 int n_URL;
13580 char * ID; /* the Public ID for the entity to load */
13581 int n_ID;
13582 xmlParserCtxtPtr ctxt; /* the context in which the entity is called or NULL */
13583 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013584
Daniel Veillard42595322004-11-08 10:52:06 +000013585 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
13586 for (n_ID = 0;n_ID < gen_nb_const_char_ptr;n_ID++) {
13587 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13588 mem_base = xmlMemBlocks();
13589 URL = gen_filepath(n_URL, 0);
13590 ID = gen_const_char_ptr(n_ID, 1);
13591 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 2);
13592
13593 ret_val = xmlLoadExternalEntity(URL, ID, ctxt);
13594 desret_xmlParserInputPtr(ret_val);
13595 call_tests++;
13596 des_filepath(n_URL, URL, 0);
13597 des_const_char_ptr(n_ID, ID, 1);
13598 des_xmlParserCtxtPtr(n_ctxt, ctxt, 2);
13599 xmlResetLastError();
13600 if (mem_base != xmlMemBlocks()) {
13601 printf("Leak of %d blocks found in xmlLoadExternalEntity",
13602 xmlMemBlocks() - mem_base);
13603 test_ret++;
13604 printf(" %d", n_URL);
13605 printf(" %d", n_ID);
13606 printf(" %d", n_ctxt);
13607 printf("\n");
13608 }
13609 }
13610 }
13611 }
13612
13613 function_tests++;
13614 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013615}
13616
13617
13618static int
13619test_xmlNewIOInputStream(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013620 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013621
Daniel Veillard42595322004-11-08 10:52:06 +000013622 int mem_base;
13623 xmlParserInputPtr ret_val;
13624 xmlParserCtxtPtr ctxt; /* an XML parser context */
13625 int n_ctxt;
13626 xmlParserInputBufferPtr input; /* an I/O Input */
13627 int n_input;
13628 xmlCharEncoding enc; /* the charset encoding if known */
13629 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013630
Daniel Veillard42595322004-11-08 10:52:06 +000013631 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13632 for (n_input = 0;n_input < gen_nb_xmlParserInputBufferPtr;n_input++) {
13633 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
13634 mem_base = xmlMemBlocks();
13635 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
13636 input = gen_xmlParserInputBufferPtr(n_input, 1);
13637 enc = gen_xmlCharEncoding(n_enc, 2);
13638
13639 ret_val = xmlNewIOInputStream(ctxt, input, enc);
13640 if (ret_val != NULL) input = NULL;
13641 desret_xmlParserInputPtr(ret_val);
13642 call_tests++;
13643 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
13644 des_xmlParserInputBufferPtr(n_input, input, 1);
13645 des_xmlCharEncoding(n_enc, enc, 2);
13646 xmlResetLastError();
13647 if (mem_base != xmlMemBlocks()) {
13648 printf("Leak of %d blocks found in xmlNewIOInputStream",
13649 xmlMemBlocks() - mem_base);
13650 test_ret++;
13651 printf(" %d", n_ctxt);
13652 printf(" %d", n_input);
13653 printf(" %d", n_enc);
13654 printf("\n");
13655 }
13656 }
13657 }
13658 }
13659
13660 function_tests++;
13661 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013662}
13663
13664
13665static int
13666test_xmlNewParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013667 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013668
Daniel Veillard34099b42004-11-04 17:34:35 +000013669 int mem_base;
13670 xmlParserCtxtPtr ret_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013671
Daniel Veillard34099b42004-11-04 17:34:35 +000013672 mem_base = xmlMemBlocks();
13673
13674 ret_val = xmlNewParserCtxt();
13675 desret_xmlParserCtxtPtr(ret_val);
13676 call_tests++;
13677 xmlResetLastError();
13678 if (mem_base != xmlMemBlocks()) {
13679 printf("Leak of %d blocks found in xmlNewParserCtxt",
13680 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013681 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000013682 printf("\n");
13683 }
13684
13685 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000013686 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013687}
13688
13689
Daniel Veillardce682bc2004-11-05 17:22:25 +000013690#define gen_nb_xmlNodePtr_ptr 1
13691static xmlNodePtr * gen_xmlNodePtr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
13692 return(NULL);
13693}
13694static void des_xmlNodePtr_ptr(int no ATTRIBUTE_UNUSED, xmlNodePtr * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
13695}
13696
Daniel Veillardd93f6252004-11-02 15:53:51 +000013697static int
13698test_xmlParseBalancedChunkMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013699 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013700
Daniel Veillarda521d282004-11-09 14:59:59 +000013701#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000013702 int mem_base;
13703 int ret_val;
13704 xmlDocPtr doc; /* the document the chunk pertains to */
13705 int n_doc;
13706 xmlSAXHandlerPtr sax; /* the SAX handler bloc (possibly NULL) */
13707 int n_sax;
13708 void * user_data; /* The user data returned on SAX callbacks (possibly NULL) */
13709 int n_user_data;
13710 int depth; /* Used for loop detection, use 0 */
13711 int n_depth;
13712 xmlChar * string; /* the input string in UTF8 or ISO-Latin (zero terminated) */
13713 int n_string;
13714 xmlNodePtr * lst; /* the return value for the set of parsed nodes */
13715 int n_lst;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013716
Daniel Veillardce682bc2004-11-05 17:22:25 +000013717 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
13718 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
13719 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
13720 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
13721 for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) {
13722 for (n_lst = 0;n_lst < gen_nb_xmlNodePtr_ptr;n_lst++) {
13723 mem_base = xmlMemBlocks();
13724 doc = gen_xmlDocPtr(n_doc, 0);
13725 sax = gen_xmlSAXHandlerPtr(n_sax, 1);
13726 user_data = gen_userdata(n_user_data, 2);
13727 depth = gen_int(n_depth, 3);
13728 string = gen_const_xmlChar_ptr(n_string, 4);
13729 lst = gen_xmlNodePtr_ptr(n_lst, 5);
Daniel Veillarda521d282004-11-09 14:59:59 +000013730
13731#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000013732 if (sax == (xmlSAXHandlerPtr)&xmlDefaultSAXHandler) user_data = NULL;
Daniel Veillarda521d282004-11-09 14:59:59 +000013733#endif
13734
Daniel Veillardce682bc2004-11-05 17:22:25 +000013735
13736 ret_val = xmlParseBalancedChunkMemory(doc, sax, user_data, depth, string, lst);
13737 desret_int(ret_val);
13738 call_tests++;
13739 des_xmlDocPtr(n_doc, doc, 0);
13740 des_xmlSAXHandlerPtr(n_sax, sax, 1);
13741 des_userdata(n_user_data, user_data, 2);
13742 des_int(n_depth, depth, 3);
13743 des_const_xmlChar_ptr(n_string, string, 4);
13744 des_xmlNodePtr_ptr(n_lst, lst, 5);
13745 xmlResetLastError();
13746 if (mem_base != xmlMemBlocks()) {
13747 printf("Leak of %d blocks found in xmlParseBalancedChunkMemory",
13748 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013749 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013750 printf(" %d", n_doc);
13751 printf(" %d", n_sax);
13752 printf(" %d", n_user_data);
13753 printf(" %d", n_depth);
13754 printf(" %d", n_string);
13755 printf(" %d", n_lst);
13756 printf("\n");
13757 }
13758 }
13759 }
13760 }
13761 }
13762 }
13763 }
Daniel Veillarda521d282004-11-09 14:59:59 +000013764#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +000013765
13766 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000013767 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013768}
13769
13770
13771static int
13772test_xmlParseBalancedChunkMemoryRecover(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013773 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013774
Daniel Veillarda521d282004-11-09 14:59:59 +000013775#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000013776 int mem_base;
13777 int ret_val;
13778 xmlDocPtr doc; /* the document the chunk pertains to */
13779 int n_doc;
13780 xmlSAXHandlerPtr sax; /* the SAX handler bloc (possibly NULL) */
13781 int n_sax;
13782 void * user_data; /* The user data returned on SAX callbacks (possibly NULL) */
13783 int n_user_data;
13784 int depth; /* Used for loop detection, use 0 */
13785 int n_depth;
13786 xmlChar * string; /* the input string in UTF8 or ISO-Latin (zero terminated) */
13787 int n_string;
13788 xmlNodePtr * lst; /* the return value for the set of parsed nodes */
13789 int n_lst;
13790 int recover; /* return nodes even if the data is broken (use 0) */
13791 int n_recover;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013792
Daniel Veillardce682bc2004-11-05 17:22:25 +000013793 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
13794 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
13795 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
13796 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
13797 for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) {
13798 for (n_lst = 0;n_lst < gen_nb_xmlNodePtr_ptr;n_lst++) {
13799 for (n_recover = 0;n_recover < gen_nb_int;n_recover++) {
13800 mem_base = xmlMemBlocks();
13801 doc = gen_xmlDocPtr(n_doc, 0);
13802 sax = gen_xmlSAXHandlerPtr(n_sax, 1);
13803 user_data = gen_userdata(n_user_data, 2);
13804 depth = gen_int(n_depth, 3);
13805 string = gen_const_xmlChar_ptr(n_string, 4);
13806 lst = gen_xmlNodePtr_ptr(n_lst, 5);
13807 recover = gen_int(n_recover, 6);
Daniel Veillarda521d282004-11-09 14:59:59 +000013808
13809#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000013810 if (sax == (xmlSAXHandlerPtr)&xmlDefaultSAXHandler) user_data = NULL;
Daniel Veillarda521d282004-11-09 14:59:59 +000013811#endif
13812
Daniel Veillardce682bc2004-11-05 17:22:25 +000013813
13814 ret_val = xmlParseBalancedChunkMemoryRecover(doc, sax, user_data, depth, string, lst, recover);
13815 desret_int(ret_val);
13816 call_tests++;
13817 des_xmlDocPtr(n_doc, doc, 0);
13818 des_xmlSAXHandlerPtr(n_sax, sax, 1);
13819 des_userdata(n_user_data, user_data, 2);
13820 des_int(n_depth, depth, 3);
13821 des_const_xmlChar_ptr(n_string, string, 4);
13822 des_xmlNodePtr_ptr(n_lst, lst, 5);
13823 des_int(n_recover, recover, 6);
13824 xmlResetLastError();
13825 if (mem_base != xmlMemBlocks()) {
13826 printf("Leak of %d blocks found in xmlParseBalancedChunkMemoryRecover",
13827 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013828 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013829 printf(" %d", n_doc);
13830 printf(" %d", n_sax);
13831 printf(" %d", n_user_data);
13832 printf(" %d", n_depth);
13833 printf(" %d", n_string);
13834 printf(" %d", n_lst);
13835 printf(" %d", n_recover);
13836 printf("\n");
13837 }
13838 }
13839 }
13840 }
13841 }
13842 }
13843 }
13844 }
Daniel Veillarda521d282004-11-09 14:59:59 +000013845#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +000013846
13847 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000013848 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013849}
13850
13851
13852static int
13853test_xmlParseChunk(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013854 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013855
13856#ifdef LIBXML_PUSH_ENABLED
13857 int mem_base;
13858 int ret_val;
13859 xmlParserCtxtPtr ctxt; /* an XML parser context */
13860 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013861 char * chunk; /* an char array */
Daniel Veillardd93f6252004-11-02 15:53:51 +000013862 int n_chunk;
13863 int size; /* the size in byte of the chunk */
13864 int n_size;
13865 int terminate; /* last chunk indicator */
13866 int n_terminate;
13867
13868 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13869 for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) {
13870 for (n_size = 0;n_size < gen_nb_int;n_size++) {
13871 for (n_terminate = 0;n_terminate < gen_nb_int;n_terminate++) {
13872 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013873 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
13874 chunk = gen_const_char_ptr(n_chunk, 1);
13875 size = gen_int(n_size, 2);
13876 terminate = gen_int(n_terminate, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013877
13878 ret_val = xmlParseChunk(ctxt, chunk, size, terminate);
Daniel Veillarda521d282004-11-09 14:59:59 +000013879 if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;}
Daniel Veillardd93f6252004-11-02 15:53:51 +000013880 desret_int(ret_val);
13881 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013882 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
13883 des_const_char_ptr(n_chunk, chunk, 1);
13884 des_int(n_size, size, 2);
13885 des_int(n_terminate, terminate, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013886 xmlResetLastError();
13887 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013888 printf("Leak of %d blocks found in xmlParseChunk",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013889 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013890 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013891 printf(" %d", n_ctxt);
13892 printf(" %d", n_chunk);
13893 printf(" %d", n_size);
13894 printf(" %d", n_terminate);
13895 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013896 }
13897 }
13898 }
13899 }
13900 }
13901#endif
13902
Daniel Veillard3d97e662004-11-04 10:49:00 +000013903 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000013904 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013905}
13906
13907
13908static int
13909test_xmlParseCtxtExternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013910 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013911
Daniel Veillardce682bc2004-11-05 17:22:25 +000013912 int mem_base;
13913 int ret_val;
13914 xmlParserCtxtPtr ctx; /* the existing parsing context */
13915 int n_ctx;
13916 xmlChar * URL; /* the URL for the entity to load */
13917 int n_URL;
13918 xmlChar * ID; /* the System ID for the entity to load */
13919 int n_ID;
13920 xmlNodePtr * lst; /* the return value for the set of parsed nodes */
13921 int n_lst;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013922
Daniel Veillardce682bc2004-11-05 17:22:25 +000013923 for (n_ctx = 0;n_ctx < gen_nb_xmlParserCtxtPtr;n_ctx++) {
13924 for (n_URL = 0;n_URL < gen_nb_const_xmlChar_ptr;n_URL++) {
13925 for (n_ID = 0;n_ID < gen_nb_const_xmlChar_ptr;n_ID++) {
13926 for (n_lst = 0;n_lst < gen_nb_xmlNodePtr_ptr;n_lst++) {
13927 mem_base = xmlMemBlocks();
13928 ctx = gen_xmlParserCtxtPtr(n_ctx, 0);
13929 URL = gen_const_xmlChar_ptr(n_URL, 1);
13930 ID = gen_const_xmlChar_ptr(n_ID, 2);
13931 lst = gen_xmlNodePtr_ptr(n_lst, 3);
13932
13933 ret_val = xmlParseCtxtExternalEntity(ctx, URL, ID, lst);
13934 desret_int(ret_val);
13935 call_tests++;
13936 des_xmlParserCtxtPtr(n_ctx, ctx, 0);
13937 des_const_xmlChar_ptr(n_URL, URL, 1);
13938 des_const_xmlChar_ptr(n_ID, ID, 2);
13939 des_xmlNodePtr_ptr(n_lst, lst, 3);
13940 xmlResetLastError();
13941 if (mem_base != xmlMemBlocks()) {
13942 printf("Leak of %d blocks found in xmlParseCtxtExternalEntity",
13943 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013944 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013945 printf(" %d", n_ctx);
13946 printf(" %d", n_URL);
13947 printf(" %d", n_ID);
13948 printf(" %d", n_lst);
13949 printf("\n");
13950 }
13951 }
13952 }
13953 }
13954 }
13955
13956 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000013957 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013958}
13959
13960
13961static int
13962test_xmlParseDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013963 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013964
Daniel Veillarda521d282004-11-09 14:59:59 +000013965#ifdef LIBXML_VALID_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000013966 int mem_base;
13967 xmlDtdPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013968 xmlChar * ExternalID; /* a NAME* containing the External ID of the DTD */
Daniel Veillard34099b42004-11-04 17:34:35 +000013969 int n_ExternalID;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013970 xmlChar * SystemID; /* a NAME* containing the URL to the DTD */
Daniel Veillard34099b42004-11-04 17:34:35 +000013971 int n_SystemID;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013972
Daniel Veillard34099b42004-11-04 17:34:35 +000013973 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
13974 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
13975 mem_base = xmlMemBlocks();
13976 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 0);
13977 SystemID = gen_const_xmlChar_ptr(n_SystemID, 1);
13978
13979 ret_val = xmlParseDTD(ExternalID, SystemID);
13980 desret_xmlDtdPtr(ret_val);
13981 call_tests++;
13982 des_const_xmlChar_ptr(n_ExternalID, ExternalID, 0);
13983 des_const_xmlChar_ptr(n_SystemID, SystemID, 1);
13984 xmlResetLastError();
13985 if (mem_base != xmlMemBlocks()) {
13986 printf("Leak of %d blocks found in xmlParseDTD",
13987 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013988 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000013989 printf(" %d", n_ExternalID);
13990 printf(" %d", n_SystemID);
13991 printf("\n");
13992 }
13993 }
13994 }
Daniel Veillarda521d282004-11-09 14:59:59 +000013995#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000013996
13997 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000013998 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013999}
14000
14001
14002static int
14003test_xmlParseDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014004 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014005
Daniel Veillarda521d282004-11-09 14:59:59 +000014006#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014007 int mem_base;
14008 xmlDocPtr ret_val;
14009 xmlChar * cur; /* a pointer to an array of xmlChar */
14010 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014011
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014012 for (n_cur = 0;n_cur < gen_nb_xmlChar_ptr;n_cur++) {
14013 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014014 cur = gen_xmlChar_ptr(n_cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014015
14016 ret_val = xmlParseDoc(cur);
14017 desret_xmlDocPtr(ret_val);
14018 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000014019 des_xmlChar_ptr(n_cur, cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014020 xmlResetLastError();
14021 if (mem_base != xmlMemBlocks()) {
14022 printf("Leak of %d blocks found in xmlParseDoc",
14023 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014024 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014025 printf(" %d", n_cur);
14026 printf("\n");
14027 }
14028 }
Daniel Veillarda521d282004-11-09 14:59:59 +000014029#endif
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014030
Daniel Veillard3d97e662004-11-04 10:49:00 +000014031 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000014032 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014033}
14034
14035
14036static int
14037test_xmlParseDocument(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014038 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014039
14040 int mem_base;
14041 int ret_val;
14042 xmlParserCtxtPtr ctxt; /* an XML parser context */
14043 int n_ctxt;
14044
14045 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
14046 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014047 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014048
14049 ret_val = xmlParseDocument(ctxt);
Daniel Veillarda521d282004-11-09 14:59:59 +000014050 if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;}
Daniel Veillardd93f6252004-11-02 15:53:51 +000014051 desret_int(ret_val);
14052 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000014053 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014054 xmlResetLastError();
14055 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014056 printf("Leak of %d blocks found in xmlParseDocument",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014057 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014058 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014059 printf(" %d", n_ctxt);
14060 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014061 }
14062 }
14063
Daniel Veillard3d97e662004-11-04 10:49:00 +000014064 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000014065 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014066}
14067
14068
14069static int
14070test_xmlParseEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014071 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014072
Daniel Veillarda521d282004-11-09 14:59:59 +000014073#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000014074 int mem_base;
14075 xmlDocPtr ret_val;
14076 const char * filename; /* the filename */
14077 int n_filename;
14078
14079 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
14080 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014081 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014082
14083 ret_val = xmlParseEntity(filename);
14084 desret_xmlDocPtr(ret_val);
14085 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000014086 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014087 xmlResetLastError();
14088 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014089 printf("Leak of %d blocks found in xmlParseEntity",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014090 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014091 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014092 printf(" %d", n_filename);
14093 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014094 }
14095 }
Daniel Veillarda521d282004-11-09 14:59:59 +000014096#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000014097
Daniel Veillard3d97e662004-11-04 10:49:00 +000014098 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000014099 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014100}
14101
14102
14103static int
14104test_xmlParseExtParsedEnt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014105 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014106
14107 int mem_base;
14108 int ret_val;
14109 xmlParserCtxtPtr ctxt; /* an XML parser context */
14110 int n_ctxt;
14111
14112 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
14113 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014114 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014115
14116 ret_val = xmlParseExtParsedEnt(ctxt);
Daniel Veillarda521d282004-11-09 14:59:59 +000014117 if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;}
Daniel Veillardd93f6252004-11-02 15:53:51 +000014118 desret_int(ret_val);
14119 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000014120 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014121 xmlResetLastError();
14122 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014123 printf("Leak of %d blocks found in xmlParseExtParsedEnt",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014124 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014125 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014126 printf(" %d", n_ctxt);
14127 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014128 }
14129 }
14130
Daniel Veillard3d97e662004-11-04 10:49:00 +000014131 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000014132 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014133}
14134
14135
14136static int
14137test_xmlParseExternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014138 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014139
Daniel Veillarda521d282004-11-09 14:59:59 +000014140#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000014141 int mem_base;
14142 int ret_val;
14143 xmlDocPtr doc; /* the document the chunk pertains to */
14144 int n_doc;
14145 xmlSAXHandlerPtr sax; /* the SAX handler bloc (possibly NULL) */
14146 int n_sax;
14147 void * user_data; /* The user data returned on SAX callbacks (possibly NULL) */
14148 int n_user_data;
14149 int depth; /* Used for loop detection, use 0 */
14150 int n_depth;
14151 xmlChar * URL; /* the URL for the entity to load */
14152 int n_URL;
14153 xmlChar * ID; /* the System ID for the entity to load */
14154 int n_ID;
14155 xmlNodePtr * lst; /* the return value for the set of parsed nodes */
14156 int n_lst;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014157
Daniel Veillardce682bc2004-11-05 17:22:25 +000014158 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
14159 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14160 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
14161 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
14162 for (n_URL = 0;n_URL < gen_nb_const_xmlChar_ptr;n_URL++) {
14163 for (n_ID = 0;n_ID < gen_nb_const_xmlChar_ptr;n_ID++) {
14164 for (n_lst = 0;n_lst < gen_nb_xmlNodePtr_ptr;n_lst++) {
14165 mem_base = xmlMemBlocks();
14166 doc = gen_xmlDocPtr(n_doc, 0);
14167 sax = gen_xmlSAXHandlerPtr(n_sax, 1);
14168 user_data = gen_userdata(n_user_data, 2);
14169 depth = gen_int(n_depth, 3);
14170 URL = gen_const_xmlChar_ptr(n_URL, 4);
14171 ID = gen_const_xmlChar_ptr(n_ID, 5);
14172 lst = gen_xmlNodePtr_ptr(n_lst, 6);
14173
14174 ret_val = xmlParseExternalEntity(doc, sax, user_data, depth, URL, ID, lst);
14175 desret_int(ret_val);
14176 call_tests++;
14177 des_xmlDocPtr(n_doc, doc, 0);
14178 des_xmlSAXHandlerPtr(n_sax, sax, 1);
14179 des_userdata(n_user_data, user_data, 2);
14180 des_int(n_depth, depth, 3);
14181 des_const_xmlChar_ptr(n_URL, URL, 4);
14182 des_const_xmlChar_ptr(n_ID, ID, 5);
14183 des_xmlNodePtr_ptr(n_lst, lst, 6);
14184 xmlResetLastError();
14185 if (mem_base != xmlMemBlocks()) {
14186 printf("Leak of %d blocks found in xmlParseExternalEntity",
14187 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014188 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014189 printf(" %d", n_doc);
14190 printf(" %d", n_sax);
14191 printf(" %d", n_user_data);
14192 printf(" %d", n_depth);
14193 printf(" %d", n_URL);
14194 printf(" %d", n_ID);
14195 printf(" %d", n_lst);
14196 printf("\n");
14197 }
14198 }
14199 }
14200 }
14201 }
14202 }
14203 }
14204 }
Daniel Veillarda521d282004-11-09 14:59:59 +000014205#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +000014206
14207 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000014208 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014209}
14210
14211
14212static int
14213test_xmlParseFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014214 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014215
Daniel Veillarda521d282004-11-09 14:59:59 +000014216#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000014217 int mem_base;
14218 xmlDocPtr ret_val;
14219 const char * filename; /* the filename */
14220 int n_filename;
14221
14222 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
14223 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014224 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014225
14226 ret_val = xmlParseFile(filename);
14227 desret_xmlDocPtr(ret_val);
14228 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000014229 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014230 xmlResetLastError();
14231 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014232 printf("Leak of %d blocks found in xmlParseFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014233 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014234 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014235 printf(" %d", n_filename);
14236 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014237 }
14238 }
Daniel Veillarda521d282004-11-09 14:59:59 +000014239#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000014240
Daniel Veillard3d97e662004-11-04 10:49:00 +000014241 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000014242 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014243}
14244
14245
14246static int
14247test_xmlParseInNodeContext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014248 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014249
Daniel Veillard57b25162004-11-06 14:50:18 +000014250 int mem_base;
14251 xmlParserErrors ret_val;
14252 xmlNodePtr node; /* the context node */
14253 int n_node;
14254 char * data; /* the input string */
14255 int n_data;
14256 int datalen; /* the input string length in bytes */
14257 int n_datalen;
14258 int options; /* a combination of xmlParserOption */
14259 int n_options;
14260 xmlNodePtr * lst; /* the return value for the set of parsed nodes */
14261 int n_lst;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014262
Daniel Veillard57b25162004-11-06 14:50:18 +000014263 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
14264 for (n_data = 0;n_data < gen_nb_const_char_ptr;n_data++) {
14265 for (n_datalen = 0;n_datalen < gen_nb_int;n_datalen++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000014266 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillard57b25162004-11-06 14:50:18 +000014267 for (n_lst = 0;n_lst < gen_nb_xmlNodePtr_ptr;n_lst++) {
14268 mem_base = xmlMemBlocks();
14269 node = gen_xmlNodePtr(n_node, 0);
14270 data = gen_const_char_ptr(n_data, 1);
14271 datalen = gen_int(n_datalen, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000014272 options = gen_parseroptions(n_options, 3);
Daniel Veillard57b25162004-11-06 14:50:18 +000014273 lst = gen_xmlNodePtr_ptr(n_lst, 4);
14274
14275 ret_val = xmlParseInNodeContext(node, data, datalen, options, lst);
14276 desret_xmlParserErrors(ret_val);
14277 call_tests++;
14278 des_xmlNodePtr(n_node, node, 0);
14279 des_const_char_ptr(n_data, data, 1);
14280 des_int(n_datalen, datalen, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000014281 des_parseroptions(n_options, options, 3);
Daniel Veillard57b25162004-11-06 14:50:18 +000014282 des_xmlNodePtr_ptr(n_lst, lst, 4);
14283 xmlResetLastError();
14284 if (mem_base != xmlMemBlocks()) {
14285 printf("Leak of %d blocks found in xmlParseInNodeContext",
14286 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014287 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000014288 printf(" %d", n_node);
14289 printf(" %d", n_data);
14290 printf(" %d", n_datalen);
14291 printf(" %d", n_options);
14292 printf(" %d", n_lst);
14293 printf("\n");
14294 }
14295 }
14296 }
14297 }
14298 }
14299 }
14300
14301 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000014302 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014303}
14304
14305
14306static int
14307test_xmlParseMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014308 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014309
Daniel Veillarda521d282004-11-09 14:59:59 +000014310#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000014311 int mem_base;
14312 xmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014313 char * buffer; /* an pointer to a char array */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014314 int n_buffer;
14315 int size; /* the size of the array */
14316 int n_size;
14317
14318 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
14319 for (n_size = 0;n_size < gen_nb_int;n_size++) {
14320 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014321 buffer = gen_const_char_ptr(n_buffer, 0);
14322 size = gen_int(n_size, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014323
14324 ret_val = xmlParseMemory(buffer, size);
14325 desret_xmlDocPtr(ret_val);
14326 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000014327 des_const_char_ptr(n_buffer, buffer, 0);
14328 des_int(n_size, size, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014329 xmlResetLastError();
14330 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014331 printf("Leak of %d blocks found in xmlParseMemory",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014332 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014333 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014334 printf(" %d", n_buffer);
14335 printf(" %d", n_size);
14336 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014337 }
14338 }
14339 }
Daniel Veillarda521d282004-11-09 14:59:59 +000014340#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000014341
Daniel Veillard3d97e662004-11-04 10:49:00 +000014342 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000014343 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014344}
14345
14346
Daniel Veillardce682bc2004-11-05 17:22:25 +000014347#define gen_nb_const_xmlParserNodeInfoPtr 1
14348static xmlParserNodeInfoPtr gen_const_xmlParserNodeInfoPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14349 return(NULL);
14350}
14351static void des_const_xmlParserNodeInfoPtr(int no ATTRIBUTE_UNUSED, const xmlParserNodeInfoPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14352}
14353
Daniel Veillardd93f6252004-11-02 15:53:51 +000014354static int
14355test_xmlParserAddNodeInfo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014356 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014357
Daniel Veillardce682bc2004-11-05 17:22:25 +000014358 int mem_base;
14359 xmlParserCtxtPtr ctxt; /* an XML parser context */
14360 int n_ctxt;
14361 xmlParserNodeInfoPtr info; /* a node info sequence pointer */
14362 int n_info;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014363
Daniel Veillardce682bc2004-11-05 17:22:25 +000014364 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
14365 for (n_info = 0;n_info < gen_nb_const_xmlParserNodeInfoPtr;n_info++) {
14366 mem_base = xmlMemBlocks();
14367 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
14368 info = gen_const_xmlParserNodeInfoPtr(n_info, 1);
14369
14370 xmlParserAddNodeInfo(ctxt, info);
14371 call_tests++;
14372 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
14373 des_const_xmlParserNodeInfoPtr(n_info, info, 1);
14374 xmlResetLastError();
14375 if (mem_base != xmlMemBlocks()) {
14376 printf("Leak of %d blocks found in xmlParserAddNodeInfo",
14377 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014378 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014379 printf(" %d", n_ctxt);
14380 printf(" %d", n_info);
14381 printf("\n");
14382 }
14383 }
14384 }
14385
14386 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000014387 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014388}
14389
14390
Daniel Veillardce682bc2004-11-05 17:22:25 +000014391#define gen_nb_const_xmlParserCtxtPtr 1
14392static xmlParserCtxtPtr gen_const_xmlParserCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14393 return(NULL);
14394}
14395static void des_const_xmlParserCtxtPtr(int no ATTRIBUTE_UNUSED, const xmlParserCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14396}
14397
Daniel Veillarda521d282004-11-09 14:59:59 +000014398#define gen_nb_const_xmlNodePtr 1
14399static xmlNodePtr gen_const_xmlNodePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14400 return(NULL);
14401}
14402static void des_const_xmlNodePtr(int no ATTRIBUTE_UNUSED, const xmlNodePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14403}
14404
Daniel Veillardd93f6252004-11-02 15:53:51 +000014405static int
14406test_xmlParserFindNodeInfo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014407 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014408
14409
14410 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000014411 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014412}
14413
14414
Daniel Veillardce682bc2004-11-05 17:22:25 +000014415#define gen_nb_const_xmlParserNodeInfoSeqPtr 1
14416static xmlParserNodeInfoSeqPtr gen_const_xmlParserNodeInfoSeqPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14417 return(NULL);
14418}
14419static void des_const_xmlParserNodeInfoSeqPtr(int no ATTRIBUTE_UNUSED, const xmlParserNodeInfoSeqPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14420}
14421
Daniel Veillardd93f6252004-11-02 15:53:51 +000014422static int
14423test_xmlParserFindNodeInfoIndex(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014424 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014425
14426
14427 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000014428 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014429}
14430
14431
Daniel Veillardce682bc2004-11-05 17:22:25 +000014432#define gen_nb_xmlParserInputPtr 1
14433static xmlParserInputPtr gen_xmlParserInputPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14434 return(NULL);
14435}
14436static void des_xmlParserInputPtr(int no ATTRIBUTE_UNUSED, xmlParserInputPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14437}
14438
Daniel Veillardd93f6252004-11-02 15:53:51 +000014439static int
14440test_xmlParserInputGrow(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014441 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014442
Daniel Veillardce682bc2004-11-05 17:22:25 +000014443 int mem_base;
14444 int ret_val;
14445 xmlParserInputPtr in; /* an XML parser input */
14446 int n_in;
14447 int len; /* an indicative size for the lookahead */
14448 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014449
Daniel Veillardce682bc2004-11-05 17:22:25 +000014450 for (n_in = 0;n_in < gen_nb_xmlParserInputPtr;n_in++) {
14451 for (n_len = 0;n_len < gen_nb_int;n_len++) {
14452 mem_base = xmlMemBlocks();
14453 in = gen_xmlParserInputPtr(n_in, 0);
14454 len = gen_int(n_len, 1);
14455
14456 ret_val = xmlParserInputGrow(in, len);
14457 desret_int(ret_val);
14458 call_tests++;
14459 des_xmlParserInputPtr(n_in, in, 0);
14460 des_int(n_len, len, 1);
14461 xmlResetLastError();
14462 if (mem_base != xmlMemBlocks()) {
14463 printf("Leak of %d blocks found in xmlParserInputGrow",
14464 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014465 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014466 printf(" %d", n_in);
14467 printf(" %d", n_len);
14468 printf("\n");
14469 }
14470 }
14471 }
14472
14473 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000014474 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014475}
14476
14477
14478static int
14479test_xmlParserInputRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014480 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014481
Daniel Veillardce682bc2004-11-05 17:22:25 +000014482 int mem_base;
14483 int ret_val;
14484 xmlParserInputPtr in; /* an XML parser input */
14485 int n_in;
14486 int len; /* an indicative size for the lookahead */
14487 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014488
Daniel Veillardce682bc2004-11-05 17:22:25 +000014489 for (n_in = 0;n_in < gen_nb_xmlParserInputPtr;n_in++) {
14490 for (n_len = 0;n_len < gen_nb_int;n_len++) {
14491 mem_base = xmlMemBlocks();
14492 in = gen_xmlParserInputPtr(n_in, 0);
14493 len = gen_int(n_len, 1);
14494
14495 ret_val = xmlParserInputRead(in, len);
14496 desret_int(ret_val);
14497 call_tests++;
14498 des_xmlParserInputPtr(n_in, in, 0);
14499 des_int(n_len, len, 1);
14500 xmlResetLastError();
14501 if (mem_base != xmlMemBlocks()) {
14502 printf("Leak of %d blocks found in xmlParserInputRead",
14503 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014504 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014505 printf(" %d", n_in);
14506 printf(" %d", n_len);
14507 printf("\n");
14508 }
14509 }
14510 }
14511
14512 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000014513 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014514}
14515
14516
14517static int
14518test_xmlPedanticParserDefault(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014519 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014520
14521 int mem_base;
14522 int ret_val;
14523 int val; /* int 0 or 1 */
14524 int n_val;
14525
14526 for (n_val = 0;n_val < gen_nb_int;n_val++) {
14527 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014528 val = gen_int(n_val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014529
14530 ret_val = xmlPedanticParserDefault(val);
14531 desret_int(ret_val);
14532 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000014533 des_int(n_val, val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014534 xmlResetLastError();
14535 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014536 printf("Leak of %d blocks found in xmlPedanticParserDefault",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014537 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014538 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014539 printf(" %d", n_val);
14540 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014541 }
14542 }
14543
Daniel Veillard3d97e662004-11-04 10:49:00 +000014544 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000014545 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014546}
14547
14548
14549static int
14550test_xmlReadDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014551 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014552
14553 int mem_base;
14554 xmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014555 xmlChar * cur; /* a pointer to a zero terminated string */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014556 int n_cur;
14557 const char * URL; /* the base URL to use for the document */
14558 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014559 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014560 int n_encoding;
14561 int options; /* a combination of xmlParserOption */
14562 int n_options;
14563
14564 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
14565 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
14566 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000014567 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000014568 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014569 cur = gen_const_xmlChar_ptr(n_cur, 0);
14570 URL = gen_filepath(n_URL, 1);
14571 encoding = gen_const_char_ptr(n_encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000014572 options = gen_parseroptions(n_options, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014573
14574 ret_val = xmlReadDoc(cur, URL, encoding, options);
14575 desret_xmlDocPtr(ret_val);
14576 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000014577 des_const_xmlChar_ptr(n_cur, cur, 0);
14578 des_filepath(n_URL, URL, 1);
14579 des_const_char_ptr(n_encoding, encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000014580 des_parseroptions(n_options, options, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014581 xmlResetLastError();
14582 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014583 printf("Leak of %d blocks found in xmlReadDoc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014584 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014585 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014586 printf(" %d", n_cur);
14587 printf(" %d", n_URL);
14588 printf(" %d", n_encoding);
14589 printf(" %d", n_options);
14590 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014591 }
14592 }
14593 }
14594 }
14595 }
14596
Daniel Veillard3d97e662004-11-04 10:49:00 +000014597 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000014598 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014599}
14600
14601
14602static int
14603test_xmlReadFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014604 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014605
14606 int mem_base;
14607 xmlDocPtr ret_val;
14608 const char * filename; /* a file or URL */
14609 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014610 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014611 int n_encoding;
14612 int options; /* a combination of xmlParserOption */
14613 int n_options;
14614
14615 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
14616 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000014617 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000014618 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014619 filename = gen_filepath(n_filename, 0);
14620 encoding = gen_const_char_ptr(n_encoding, 1);
Daniel Veillard6128c012004-11-08 17:16:15 +000014621 options = gen_parseroptions(n_options, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014622
14623 ret_val = xmlReadFile(filename, encoding, options);
14624 desret_xmlDocPtr(ret_val);
14625 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000014626 des_filepath(n_filename, filename, 0);
14627 des_const_char_ptr(n_encoding, encoding, 1);
Daniel Veillard6128c012004-11-08 17:16:15 +000014628 des_parseroptions(n_options, options, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014629 xmlResetLastError();
14630 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014631 printf("Leak of %d blocks found in xmlReadFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014632 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014633 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014634 printf(" %d", n_filename);
14635 printf(" %d", n_encoding);
14636 printf(" %d", n_options);
14637 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014638 }
14639 }
14640 }
14641 }
14642
Daniel Veillard3d97e662004-11-04 10:49:00 +000014643 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000014644 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014645}
14646
14647
14648static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000014649test_xmlReadMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014650 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014651
14652 int mem_base;
14653 xmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014654 char * buffer; /* a pointer to a char array */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014655 int n_buffer;
14656 int size; /* the size of the array */
14657 int n_size;
14658 const char * URL; /* the base URL to use for the document */
14659 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014660 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014661 int n_encoding;
14662 int options; /* a combination of xmlParserOption */
14663 int n_options;
14664
14665 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
14666 for (n_size = 0;n_size < gen_nb_int;n_size++) {
14667 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
14668 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000014669 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000014670 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014671 buffer = gen_const_char_ptr(n_buffer, 0);
14672 size = gen_int(n_size, 1);
14673 URL = gen_filepath(n_URL, 2);
14674 encoding = gen_const_char_ptr(n_encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000014675 options = gen_parseroptions(n_options, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014676
14677 ret_val = xmlReadMemory(buffer, size, URL, encoding, options);
14678 desret_xmlDocPtr(ret_val);
14679 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000014680 des_const_char_ptr(n_buffer, buffer, 0);
14681 des_int(n_size, size, 1);
14682 des_filepath(n_URL, URL, 2);
14683 des_const_char_ptr(n_encoding, encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000014684 des_parseroptions(n_options, options, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014685 xmlResetLastError();
14686 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014687 printf("Leak of %d blocks found in xmlReadMemory",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014688 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014689 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014690 printf(" %d", n_buffer);
14691 printf(" %d", n_size);
14692 printf(" %d", n_URL);
14693 printf(" %d", n_encoding);
14694 printf(" %d", n_options);
14695 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014696 }
14697 }
14698 }
14699 }
14700 }
14701 }
14702
Daniel Veillard3d97e662004-11-04 10:49:00 +000014703 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000014704 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014705}
14706
14707
14708static int
14709test_xmlRecoverDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014710 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014711
Daniel Veillarda521d282004-11-09 14:59:59 +000014712#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014713 int mem_base;
14714 xmlDocPtr ret_val;
14715 xmlChar * cur; /* a pointer to an array of xmlChar */
14716 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014717
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014718 for (n_cur = 0;n_cur < gen_nb_xmlChar_ptr;n_cur++) {
14719 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014720 cur = gen_xmlChar_ptr(n_cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014721
14722 ret_val = xmlRecoverDoc(cur);
14723 desret_xmlDocPtr(ret_val);
14724 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000014725 des_xmlChar_ptr(n_cur, cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014726 xmlResetLastError();
14727 if (mem_base != xmlMemBlocks()) {
14728 printf("Leak of %d blocks found in xmlRecoverDoc",
14729 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014730 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014731 printf(" %d", n_cur);
14732 printf("\n");
14733 }
14734 }
Daniel Veillarda521d282004-11-09 14:59:59 +000014735#endif
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014736
Daniel Veillard3d97e662004-11-04 10:49:00 +000014737 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000014738 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014739}
14740
14741
14742static int
14743test_xmlRecoverFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014744 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014745
Daniel Veillarda521d282004-11-09 14:59:59 +000014746#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000014747 int mem_base;
14748 xmlDocPtr ret_val;
14749 const char * filename; /* the filename */
14750 int n_filename;
14751
14752 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
14753 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014754 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014755
14756 ret_val = xmlRecoverFile(filename);
14757 desret_xmlDocPtr(ret_val);
14758 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000014759 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014760 xmlResetLastError();
14761 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014762 printf("Leak of %d blocks found in xmlRecoverFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014763 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014764 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014765 printf(" %d", n_filename);
14766 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014767 }
14768 }
Daniel Veillarda521d282004-11-09 14:59:59 +000014769#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000014770
Daniel Veillard3d97e662004-11-04 10:49:00 +000014771 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000014772 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014773}
14774
14775
14776static int
14777test_xmlRecoverMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014778 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014779
Daniel Veillarda521d282004-11-09 14:59:59 +000014780#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000014781 int mem_base;
14782 xmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014783 char * buffer; /* an pointer to a char array */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014784 int n_buffer;
14785 int size; /* the size of the array */
14786 int n_size;
14787
14788 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
14789 for (n_size = 0;n_size < gen_nb_int;n_size++) {
14790 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014791 buffer = gen_const_char_ptr(n_buffer, 0);
14792 size = gen_int(n_size, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014793
14794 ret_val = xmlRecoverMemory(buffer, size);
14795 desret_xmlDocPtr(ret_val);
14796 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000014797 des_const_char_ptr(n_buffer, buffer, 0);
14798 des_int(n_size, size, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014799 xmlResetLastError();
14800 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014801 printf("Leak of %d blocks found in xmlRecoverMemory",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014802 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014803 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014804 printf(" %d", n_buffer);
14805 printf(" %d", n_size);
14806 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014807 }
14808 }
14809 }
Daniel Veillarda521d282004-11-09 14:59:59 +000014810#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000014811
Daniel Veillard3d97e662004-11-04 10:49:00 +000014812 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000014813 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014814}
14815
14816
14817static int
14818test_xmlSAXParseDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014819 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014820
Daniel Veillarda521d282004-11-09 14:59:59 +000014821#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014822 int mem_base;
14823 xmlDtdPtr ret_val;
14824 xmlSAXHandlerPtr sax; /* the SAX handler block */
14825 int n_sax;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014826 xmlChar * ExternalID; /* a NAME* containing the External ID of the DTD */
Daniel Veillard34099b42004-11-04 17:34:35 +000014827 int n_ExternalID;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014828 xmlChar * SystemID; /* a NAME* containing the URL to the DTD */
Daniel Veillard34099b42004-11-04 17:34:35 +000014829 int n_SystemID;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014830
Daniel Veillard34099b42004-11-04 17:34:35 +000014831 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14832 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
14833 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
14834 mem_base = xmlMemBlocks();
14835 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14836 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 1);
14837 SystemID = gen_const_xmlChar_ptr(n_SystemID, 2);
14838
14839 ret_val = xmlSAXParseDTD(sax, ExternalID, SystemID);
14840 desret_xmlDtdPtr(ret_val);
14841 call_tests++;
14842 des_xmlSAXHandlerPtr(n_sax, sax, 0);
14843 des_const_xmlChar_ptr(n_ExternalID, ExternalID, 1);
14844 des_const_xmlChar_ptr(n_SystemID, SystemID, 2);
14845 xmlResetLastError();
14846 if (mem_base != xmlMemBlocks()) {
14847 printf("Leak of %d blocks found in xmlSAXParseDTD",
14848 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014849 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014850 printf(" %d", n_sax);
14851 printf(" %d", n_ExternalID);
14852 printf(" %d", n_SystemID);
14853 printf("\n");
14854 }
14855 }
14856 }
14857 }
Daniel Veillarda521d282004-11-09 14:59:59 +000014858#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014859
14860 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000014861 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014862}
14863
14864
14865static int
14866test_xmlSAXParseDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014867 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014868
Daniel Veillarda521d282004-11-09 14:59:59 +000014869#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014870 int mem_base;
14871 xmlDocPtr ret_val;
14872 xmlSAXHandlerPtr sax; /* the SAX handler block */
14873 int n_sax;
14874 xmlChar * cur; /* a pointer to an array of xmlChar */
14875 int n_cur;
14876 int recovery; /* work in recovery mode, i.e. tries to read no Well Formed documents */
14877 int n_recovery;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014878
Daniel Veillard34099b42004-11-04 17:34:35 +000014879 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14880 for (n_cur = 0;n_cur < gen_nb_xmlChar_ptr;n_cur++) {
14881 for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) {
14882 mem_base = xmlMemBlocks();
14883 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14884 cur = gen_xmlChar_ptr(n_cur, 1);
14885 recovery = gen_int(n_recovery, 2);
14886
14887 ret_val = xmlSAXParseDoc(sax, cur, recovery);
14888 desret_xmlDocPtr(ret_val);
14889 call_tests++;
14890 des_xmlSAXHandlerPtr(n_sax, sax, 0);
14891 des_xmlChar_ptr(n_cur, cur, 1);
14892 des_int(n_recovery, recovery, 2);
14893 xmlResetLastError();
14894 if (mem_base != xmlMemBlocks()) {
14895 printf("Leak of %d blocks found in xmlSAXParseDoc",
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_cur);
14900 printf(" %d", n_recovery);
14901 printf("\n");
14902 }
14903 }
14904 }
14905 }
Daniel Veillarda521d282004-11-09 14:59:59 +000014906#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014907
14908 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000014909 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014910}
14911
14912
14913static int
14914test_xmlSAXParseEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014915 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014916
Daniel Veillarda521d282004-11-09 14:59:59 +000014917#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014918 int mem_base;
14919 xmlDocPtr ret_val;
14920 xmlSAXHandlerPtr sax; /* the SAX handler block */
14921 int n_sax;
14922 const char * filename; /* the filename */
14923 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014924
Daniel Veillard34099b42004-11-04 17:34:35 +000014925 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14926 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
14927 mem_base = xmlMemBlocks();
14928 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14929 filename = gen_filepath(n_filename, 1);
14930
14931 ret_val = xmlSAXParseEntity(sax, filename);
14932 desret_xmlDocPtr(ret_val);
14933 call_tests++;
14934 des_xmlSAXHandlerPtr(n_sax, sax, 0);
14935 des_filepath(n_filename, filename, 1);
14936 xmlResetLastError();
14937 if (mem_base != xmlMemBlocks()) {
14938 printf("Leak of %d blocks found in xmlSAXParseEntity",
14939 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014940 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014941 printf(" %d", n_sax);
14942 printf(" %d", n_filename);
14943 printf("\n");
14944 }
14945 }
14946 }
Daniel Veillarda521d282004-11-09 14:59:59 +000014947#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014948
14949 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000014950 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014951}
14952
14953
14954static int
14955test_xmlSAXParseFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014956 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014957
Daniel Veillarda521d282004-11-09 14:59:59 +000014958#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014959 int mem_base;
14960 xmlDocPtr ret_val;
14961 xmlSAXHandlerPtr sax; /* the SAX handler block */
14962 int n_sax;
14963 const char * filename; /* the filename */
14964 int n_filename;
14965 int recovery; /* work in recovery mode, i.e. tries to read no Well Formed documents */
14966 int n_recovery;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014967
Daniel Veillard34099b42004-11-04 17:34:35 +000014968 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14969 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
14970 for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) {
14971 mem_base = xmlMemBlocks();
14972 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14973 filename = gen_filepath(n_filename, 1);
14974 recovery = gen_int(n_recovery, 2);
14975
14976 ret_val = xmlSAXParseFile(sax, filename, recovery);
14977 desret_xmlDocPtr(ret_val);
14978 call_tests++;
14979 des_xmlSAXHandlerPtr(n_sax, sax, 0);
14980 des_filepath(n_filename, filename, 1);
14981 des_int(n_recovery, recovery, 2);
14982 xmlResetLastError();
14983 if (mem_base != xmlMemBlocks()) {
14984 printf("Leak of %d blocks found in xmlSAXParseFile",
14985 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014986 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014987 printf(" %d", n_sax);
14988 printf(" %d", n_filename);
14989 printf(" %d", n_recovery);
14990 printf("\n");
14991 }
14992 }
14993 }
14994 }
Daniel Veillarda521d282004-11-09 14:59:59 +000014995#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014996
14997 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000014998 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014999}
15000
15001
15002static int
15003test_xmlSAXParseFileWithData(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015004 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015005
Daniel Veillarda521d282004-11-09 14:59:59 +000015006#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000015007 int mem_base;
15008 xmlDocPtr ret_val;
15009 xmlSAXHandlerPtr sax; /* the SAX handler block */
15010 int n_sax;
15011 const char * filename; /* the filename */
15012 int n_filename;
15013 int recovery; /* work in recovery mode, i.e. tries to read no Well Formed documents */
15014 int n_recovery;
15015 void * data; /* the userdata */
15016 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015017
Daniel Veillard34099b42004-11-04 17:34:35 +000015018 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
15019 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
15020 for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) {
15021 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
15022 mem_base = xmlMemBlocks();
15023 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
15024 filename = gen_filepath(n_filename, 1);
15025 recovery = gen_int(n_recovery, 2);
15026 data = gen_userdata(n_data, 3);
15027
15028 ret_val = xmlSAXParseFileWithData(sax, filename, recovery, data);
15029 desret_xmlDocPtr(ret_val);
15030 call_tests++;
15031 des_xmlSAXHandlerPtr(n_sax, sax, 0);
15032 des_filepath(n_filename, filename, 1);
15033 des_int(n_recovery, recovery, 2);
15034 des_userdata(n_data, data, 3);
15035 xmlResetLastError();
15036 if (mem_base != xmlMemBlocks()) {
15037 printf("Leak of %d blocks found in xmlSAXParseFileWithData",
15038 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015039 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000015040 printf(" %d", n_sax);
15041 printf(" %d", n_filename);
15042 printf(" %d", n_recovery);
15043 printf(" %d", n_data);
15044 printf("\n");
15045 }
15046 }
15047 }
15048 }
15049 }
Daniel Veillarda521d282004-11-09 14:59:59 +000015050#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000015051
15052 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000015053 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015054}
15055
15056
15057static int
15058test_xmlSAXParseMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015059 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015060
Daniel Veillarda521d282004-11-09 14:59:59 +000015061#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000015062 int mem_base;
15063 xmlDocPtr ret_val;
15064 xmlSAXHandlerPtr sax; /* the SAX handler block */
15065 int n_sax;
Daniel Veillardce682bc2004-11-05 17:22:25 +000015066 char * buffer; /* an pointer to a char array */
Daniel Veillard34099b42004-11-04 17:34:35 +000015067 int n_buffer;
15068 int size; /* the size of the array */
15069 int n_size;
15070 int recovery; /* work in recovery mode, i.e. tries to read not Well Formed documents */
15071 int n_recovery;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015072
Daniel Veillard34099b42004-11-04 17:34:35 +000015073 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
15074 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
15075 for (n_size = 0;n_size < gen_nb_int;n_size++) {
15076 for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) {
15077 mem_base = xmlMemBlocks();
15078 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
15079 buffer = gen_const_char_ptr(n_buffer, 1);
15080 size = gen_int(n_size, 2);
15081 recovery = gen_int(n_recovery, 3);
15082
15083 ret_val = xmlSAXParseMemory(sax, buffer, size, recovery);
15084 desret_xmlDocPtr(ret_val);
15085 call_tests++;
15086 des_xmlSAXHandlerPtr(n_sax, sax, 0);
15087 des_const_char_ptr(n_buffer, buffer, 1);
15088 des_int(n_size, size, 2);
15089 des_int(n_recovery, recovery, 3);
15090 xmlResetLastError();
15091 if (mem_base != xmlMemBlocks()) {
15092 printf("Leak of %d blocks found in xmlSAXParseMemory",
15093 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015094 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000015095 printf(" %d", n_sax);
15096 printf(" %d", n_buffer);
15097 printf(" %d", n_size);
15098 printf(" %d", n_recovery);
15099 printf("\n");
15100 }
15101 }
15102 }
15103 }
15104 }
Daniel Veillarda521d282004-11-09 14:59:59 +000015105#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000015106
15107 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000015108 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015109}
15110
15111
15112static int
15113test_xmlSAXParseMemoryWithData(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015114 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015115
Daniel Veillarda521d282004-11-09 14:59:59 +000015116#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000015117 int mem_base;
15118 xmlDocPtr ret_val;
15119 xmlSAXHandlerPtr sax; /* the SAX handler block */
15120 int n_sax;
Daniel Veillardce682bc2004-11-05 17:22:25 +000015121 char * buffer; /* an pointer to a char array */
Daniel Veillard34099b42004-11-04 17:34:35 +000015122 int n_buffer;
15123 int size; /* the size of the array */
15124 int n_size;
15125 int recovery; /* work in recovery mode, i.e. tries to read no Well Formed documents */
15126 int n_recovery;
15127 void * data; /* the userdata */
15128 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015129
Daniel Veillard34099b42004-11-04 17:34:35 +000015130 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
15131 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
15132 for (n_size = 0;n_size < gen_nb_int;n_size++) {
15133 for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) {
15134 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
15135 mem_base = xmlMemBlocks();
15136 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
15137 buffer = gen_const_char_ptr(n_buffer, 1);
15138 size = gen_int(n_size, 2);
15139 recovery = gen_int(n_recovery, 3);
15140 data = gen_userdata(n_data, 4);
15141
15142 ret_val = xmlSAXParseMemoryWithData(sax, buffer, size, recovery, data);
15143 desret_xmlDocPtr(ret_val);
15144 call_tests++;
15145 des_xmlSAXHandlerPtr(n_sax, sax, 0);
15146 des_const_char_ptr(n_buffer, buffer, 1);
15147 des_int(n_size, size, 2);
15148 des_int(n_recovery, recovery, 3);
15149 des_userdata(n_data, data, 4);
15150 xmlResetLastError();
15151 if (mem_base != xmlMemBlocks()) {
15152 printf("Leak of %d blocks found in xmlSAXParseMemoryWithData",
15153 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015154 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000015155 printf(" %d", n_sax);
15156 printf(" %d", n_buffer);
15157 printf(" %d", n_size);
15158 printf(" %d", n_recovery);
15159 printf(" %d", n_data);
15160 printf("\n");
15161 }
15162 }
15163 }
15164 }
15165 }
15166 }
Daniel Veillarda521d282004-11-09 14:59:59 +000015167#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000015168
15169 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000015170 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015171}
15172
15173
15174static int
15175test_xmlSAXUserParseFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015176 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015177
Daniel Veillarda521d282004-11-09 14:59:59 +000015178#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000015179 int mem_base;
15180 int ret_val;
15181 xmlSAXHandlerPtr sax; /* a SAX handler */
15182 int n_sax;
15183 void * user_data; /* The user data returned on SAX callbacks */
15184 int n_user_data;
15185 const char * filename; /* a file name */
15186 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015187
Daniel Veillard34099b42004-11-04 17:34:35 +000015188 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
15189 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
15190 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
15191 mem_base = xmlMemBlocks();
15192 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
15193 user_data = gen_userdata(n_user_data, 1);
15194 filename = gen_filepath(n_filename, 2);
Daniel Veillarda521d282004-11-09 14:59:59 +000015195
15196#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardce244ad2004-11-05 10:03:46 +000015197 if (sax == (xmlSAXHandlerPtr)&xmlDefaultSAXHandler) user_data = NULL;
Daniel Veillarda521d282004-11-09 14:59:59 +000015198#endif
15199
Daniel Veillard34099b42004-11-04 17:34:35 +000015200
15201 ret_val = xmlSAXUserParseFile(sax, user_data, filename);
15202 desret_int(ret_val);
15203 call_tests++;
15204 des_xmlSAXHandlerPtr(n_sax, sax, 0);
15205 des_userdata(n_user_data, user_data, 1);
15206 des_filepath(n_filename, filename, 2);
15207 xmlResetLastError();
15208 if (mem_base != xmlMemBlocks()) {
15209 printf("Leak of %d blocks found in xmlSAXUserParseFile",
15210 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015211 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000015212 printf(" %d", n_sax);
15213 printf(" %d", n_user_data);
15214 printf(" %d", n_filename);
15215 printf("\n");
15216 }
15217 }
15218 }
15219 }
Daniel Veillarda521d282004-11-09 14:59:59 +000015220#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000015221
15222 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000015223 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015224}
15225
15226
15227static int
15228test_xmlSAXUserParseMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015229 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015230
Daniel Veillarda521d282004-11-09 14:59:59 +000015231#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000015232 int mem_base;
15233 int ret_val;
15234 xmlSAXHandlerPtr sax; /* a SAX handler */
15235 int n_sax;
15236 void * user_data; /* The user data returned on SAX callbacks */
15237 int n_user_data;
Daniel Veillardce682bc2004-11-05 17:22:25 +000015238 char * buffer; /* an in-memory XML document input */
Daniel Veillard34099b42004-11-04 17:34:35 +000015239 int n_buffer;
15240 int size; /* the length of the XML document in bytes */
15241 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015242
Daniel Veillard34099b42004-11-04 17:34:35 +000015243 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
15244 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
15245 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
15246 for (n_size = 0;n_size < gen_nb_int;n_size++) {
15247 mem_base = xmlMemBlocks();
15248 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
15249 user_data = gen_userdata(n_user_data, 1);
15250 buffer = gen_const_char_ptr(n_buffer, 2);
15251 size = gen_int(n_size, 3);
Daniel Veillarda521d282004-11-09 14:59:59 +000015252
15253#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardce244ad2004-11-05 10:03:46 +000015254 if (sax == (xmlSAXHandlerPtr)&xmlDefaultSAXHandler) user_data = NULL;
Daniel Veillarda521d282004-11-09 14:59:59 +000015255#endif
15256
Daniel Veillard34099b42004-11-04 17:34:35 +000015257
15258 ret_val = xmlSAXUserParseMemory(sax, user_data, buffer, size);
15259 desret_int(ret_val);
15260 call_tests++;
15261 des_xmlSAXHandlerPtr(n_sax, sax, 0);
15262 des_userdata(n_user_data, user_data, 1);
15263 des_const_char_ptr(n_buffer, buffer, 2);
15264 des_int(n_size, size, 3);
15265 xmlResetLastError();
15266 if (mem_base != xmlMemBlocks()) {
15267 printf("Leak of %d blocks found in xmlSAXUserParseMemory",
15268 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015269 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000015270 printf(" %d", n_sax);
15271 printf(" %d", n_user_data);
15272 printf(" %d", n_buffer);
15273 printf(" %d", n_size);
15274 printf("\n");
15275 }
15276 }
15277 }
15278 }
15279 }
Daniel Veillarda521d282004-11-09 14:59:59 +000015280#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000015281
15282 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000015283 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015284}
15285
15286
15287static int
15288test_xmlSetExternalEntityLoader(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015289 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015290
15291
15292 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000015293 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015294}
15295
15296
15297static int
15298test_xmlSetFeature(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015299 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015300
Daniel Veillarda521d282004-11-09 14:59:59 +000015301#ifdef LIBXML_LEGACY_ENABLED
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015302 int mem_base;
15303 int ret_val;
15304 xmlParserCtxtPtr ctxt; /* an XML/HTML parser context */
15305 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000015306 char * name; /* the feature name */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015307 int n_name;
15308 void * value; /* pointer to the location of the new value */
15309 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015310
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015311 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15312 for (n_name = 0;n_name < gen_nb_const_char_ptr;n_name++) {
15313 for (n_value = 0;n_value < gen_nb_void_ptr;n_value++) {
15314 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000015315 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15316 name = gen_const_char_ptr(n_name, 1);
15317 value = gen_void_ptr(n_value, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015318
15319 ret_val = xmlSetFeature(ctxt, name, value);
15320 desret_int(ret_val);
15321 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000015322 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15323 des_const_char_ptr(n_name, name, 1);
15324 des_void_ptr(n_value, value, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015325 xmlResetLastError();
15326 if (mem_base != xmlMemBlocks()) {
15327 printf("Leak of %d blocks found in xmlSetFeature",
15328 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015329 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015330 printf(" %d", n_ctxt);
15331 printf(" %d", n_name);
15332 printf(" %d", n_value);
15333 printf("\n");
15334 }
15335 }
15336 }
15337 }
Daniel Veillarda521d282004-11-09 14:59:59 +000015338#endif
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015339
Daniel Veillard3d97e662004-11-04 10:49:00 +000015340 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000015341 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015342}
15343
15344
15345static int
15346test_xmlSetupParserForBuffer(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015347 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015348
Daniel Veillarda521d282004-11-09 14:59:59 +000015349#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000015350 int mem_base;
15351 xmlParserCtxtPtr ctxt; /* an XML parser context */
15352 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000015353 xmlChar * buffer; /* a xmlChar * buffer */
Daniel Veillardd93f6252004-11-02 15:53:51 +000015354 int n_buffer;
15355 const char * filename; /* a file name */
15356 int n_filename;
15357
15358 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15359 for (n_buffer = 0;n_buffer < gen_nb_const_xmlChar_ptr;n_buffer++) {
15360 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
15361 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000015362 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15363 buffer = gen_const_xmlChar_ptr(n_buffer, 1);
15364 filename = gen_filepath(n_filename, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015365
15366 xmlSetupParserForBuffer(ctxt, buffer, filename);
15367 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000015368 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15369 des_const_xmlChar_ptr(n_buffer, buffer, 1);
15370 des_filepath(n_filename, filename, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015371 xmlResetLastError();
15372 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000015373 printf("Leak of %d blocks found in xmlSetupParserForBuffer",
Daniel Veillardd93f6252004-11-02 15:53:51 +000015374 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015375 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000015376 printf(" %d", n_ctxt);
15377 printf(" %d", n_buffer);
15378 printf(" %d", n_filename);
15379 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000015380 }
15381 }
15382 }
15383 }
Daniel Veillarda521d282004-11-09 14:59:59 +000015384#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000015385
Daniel Veillard3d97e662004-11-04 10:49:00 +000015386 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000015387 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015388}
15389
15390
15391static int
15392test_xmlStopParser(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015393 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015394
Daniel Veillarda521d282004-11-09 14:59:59 +000015395#ifdef LIBXML_PUSH_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000015396 int mem_base;
15397 xmlParserCtxtPtr ctxt; /* an XML parser context */
15398 int n_ctxt;
15399
15400 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15401 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000015402 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015403
15404 xmlStopParser(ctxt);
15405 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000015406 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015407 xmlResetLastError();
15408 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000015409 printf("Leak of %d blocks found in xmlStopParser",
Daniel Veillardd93f6252004-11-02 15:53:51 +000015410 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015411 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000015412 printf(" %d", n_ctxt);
15413 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000015414 }
15415 }
Daniel Veillarda521d282004-11-09 14:59:59 +000015416#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000015417
Daniel Veillard3d97e662004-11-04 10:49:00 +000015418 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000015419 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015420}
15421
15422
15423static int
15424test_xmlSubstituteEntitiesDefault(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015425 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015426
15427 int mem_base;
15428 int ret_val;
15429 int val; /* int 0 or 1 */
15430 int n_val;
15431
15432 for (n_val = 0;n_val < gen_nb_int;n_val++) {
15433 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000015434 val = gen_int(n_val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015435
15436 ret_val = xmlSubstituteEntitiesDefault(val);
15437 desret_int(ret_val);
15438 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000015439 des_int(n_val, val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015440 xmlResetLastError();
15441 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000015442 printf("Leak of %d blocks found in xmlSubstituteEntitiesDefault",
Daniel Veillardd93f6252004-11-02 15:53:51 +000015443 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015444 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000015445 printf(" %d", n_val);
15446 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000015447 }
15448 }
15449
Daniel Veillard3d97e662004-11-04 10:49:00 +000015450 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000015451 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015452}
15453
15454static int
15455test_parser(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015456 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015457
Daniel Veillard42595322004-11-08 10:52:06 +000015458 printf("Testing parser : 58 of 69 functions ...\n");
15459 test_ret += test_xmlByteConsumed();
15460 test_ret += test_xmlClearNodeInfoSeq();
15461 test_ret += test_xmlClearParserCtxt();
15462 test_ret += test_xmlCreateDocParserCtxt();
15463 test_ret += test_xmlCreatePushParserCtxt();
15464 test_ret += test_xmlCtxtReadDoc();
15465 test_ret += test_xmlCtxtReadFile();
15466 test_ret += test_xmlCtxtReadMemory();
15467 test_ret += test_xmlCtxtReset();
15468 test_ret += test_xmlCtxtResetPush();
15469 test_ret += test_xmlCtxtUseOptions();
15470 test_ret += test_xmlGetExternalEntityLoader();
15471 test_ret += test_xmlGetFeature();
15472 test_ret += test_xmlGetFeaturesList();
15473 test_ret += test_xmlIOParseDTD();
15474 test_ret += test_xmlInitNodeInfoSeq();
15475 test_ret += test_xmlInitParser();
15476 test_ret += test_xmlInitParserCtxt();
15477 test_ret += test_xmlKeepBlanksDefault();
15478 test_ret += test_xmlLineNumbersDefault();
15479 test_ret += test_xmlLoadExternalEntity();
15480 test_ret += test_xmlNewIOInputStream();
15481 test_ret += test_xmlNewParserCtxt();
15482 test_ret += test_xmlParseBalancedChunkMemory();
15483 test_ret += test_xmlParseBalancedChunkMemoryRecover();
15484 test_ret += test_xmlParseChunk();
15485 test_ret += test_xmlParseCtxtExternalEntity();
15486 test_ret += test_xmlParseDTD();
15487 test_ret += test_xmlParseDoc();
15488 test_ret += test_xmlParseDocument();
15489 test_ret += test_xmlParseEntity();
15490 test_ret += test_xmlParseExtParsedEnt();
15491 test_ret += test_xmlParseExternalEntity();
15492 test_ret += test_xmlParseFile();
15493 test_ret += test_xmlParseInNodeContext();
15494 test_ret += test_xmlParseMemory();
15495 test_ret += test_xmlParserAddNodeInfo();
15496 test_ret += test_xmlParserFindNodeInfo();
15497 test_ret += test_xmlParserFindNodeInfoIndex();
15498 test_ret += test_xmlParserInputGrow();
15499 test_ret += test_xmlParserInputRead();
15500 test_ret += test_xmlPedanticParserDefault();
15501 test_ret += test_xmlReadDoc();
15502 test_ret += test_xmlReadFile();
15503 test_ret += test_xmlReadMemory();
15504 test_ret += test_xmlRecoverDoc();
15505 test_ret += test_xmlRecoverFile();
15506 test_ret += test_xmlRecoverMemory();
15507 test_ret += test_xmlSAXParseDTD();
15508 test_ret += test_xmlSAXParseDoc();
15509 test_ret += test_xmlSAXParseEntity();
15510 test_ret += test_xmlSAXParseFile();
15511 test_ret += test_xmlSAXParseFileWithData();
15512 test_ret += test_xmlSAXParseMemory();
15513 test_ret += test_xmlSAXParseMemoryWithData();
15514 test_ret += test_xmlSAXUserParseFile();
15515 test_ret += test_xmlSAXUserParseMemory();
15516 test_ret += test_xmlSetExternalEntityLoader();
15517 test_ret += test_xmlSetFeature();
15518 test_ret += test_xmlSetupParserForBuffer();
15519 test_ret += test_xmlStopParser();
15520 test_ret += test_xmlSubstituteEntitiesDefault();
Daniel Veillardd93f6252004-11-02 15:53:51 +000015521
Daniel Veillard42595322004-11-08 10:52:06 +000015522 if (test_ret != 0)
15523 printf("Module parser: %d errors\n", test_ret);
15524 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015525}
15526
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015527static int
15528test_htmlCreateFileParserCtxt(void) {
15529 int test_ret = 0;
15530
15531#ifdef LIBXML_HTML_ENABLED
15532 int mem_base;
15533 htmlParserCtxtPtr ret_val;
15534 const char * filename; /* the filename */
15535 int n_filename;
15536 char * encoding; /* a free form C string describing the HTML document encoding, or NULL */
15537 int n_encoding;
15538
15539 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
15540 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
15541 mem_base = xmlMemBlocks();
15542 filename = gen_fileoutput(n_filename, 0);
15543 encoding = gen_const_char_ptr(n_encoding, 1);
15544
15545 ret_val = htmlCreateFileParserCtxt(filename, encoding);
Daniel Veillarda521d282004-11-09 14:59:59 +000015546 desret_htmlParserCtxtPtr(ret_val);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015547 call_tests++;
15548 des_fileoutput(n_filename, filename, 0);
15549 des_const_char_ptr(n_encoding, encoding, 1);
15550 xmlResetLastError();
15551 if (mem_base != xmlMemBlocks()) {
15552 printf("Leak of %d blocks found in htmlCreateFileParserCtxt",
15553 xmlMemBlocks() - mem_base);
15554 test_ret++;
15555 printf(" %d", n_filename);
15556 printf(" %d", n_encoding);
15557 printf("\n");
15558 }
15559 }
15560 }
15561#endif
15562
15563 function_tests++;
15564 return(test_ret);
15565}
15566
15567
15568static int
15569test_htmlInitAutoClose(void) {
15570 int test_ret = 0;
15571
15572#ifdef LIBXML_HTML_ENABLED
15573 int mem_base;
15574
15575 mem_base = xmlMemBlocks();
15576
15577 htmlInitAutoClose();
15578 call_tests++;
15579 xmlResetLastError();
15580 if (mem_base != xmlMemBlocks()) {
15581 printf("Leak of %d blocks found in htmlInitAutoClose",
15582 xmlMemBlocks() - mem_base);
15583 test_ret++;
15584 printf("\n");
15585 }
15586#endif
15587
15588 function_tests++;
15589 return(test_ret);
15590}
15591
15592
15593static int
15594test_inputPop(void) {
15595 int test_ret = 0;
15596
15597 int mem_base;
15598 xmlParserInputPtr ret_val;
15599 xmlParserCtxtPtr ctxt; /* an XML parser context */
15600 int n_ctxt;
15601
15602 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15603 mem_base = xmlMemBlocks();
15604 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15605
15606 ret_val = inputPop(ctxt);
15607 desret_xmlParserInputPtr(ret_val);
15608 call_tests++;
15609 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15610 xmlResetLastError();
15611 if (mem_base != xmlMemBlocks()) {
15612 printf("Leak of %d blocks found in inputPop",
15613 xmlMemBlocks() - mem_base);
15614 test_ret++;
15615 printf(" %d", n_ctxt);
15616 printf("\n");
15617 }
15618 }
15619
15620 function_tests++;
15621 return(test_ret);
15622}
15623
15624
15625static int
15626test_inputPush(void) {
15627 int test_ret = 0;
15628
15629 int mem_base;
15630 int ret_val;
15631 xmlParserCtxtPtr ctxt; /* an XML parser context */
15632 int n_ctxt;
15633 xmlParserInputPtr value; /* the parser input */
15634 int n_value;
15635
15636 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15637 for (n_value = 0;n_value < gen_nb_xmlParserInputPtr;n_value++) {
15638 mem_base = xmlMemBlocks();
15639 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15640 value = gen_xmlParserInputPtr(n_value, 1);
15641
15642 ret_val = inputPush(ctxt, value);
15643 desret_int(ret_val);
15644 call_tests++;
15645 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15646 des_xmlParserInputPtr(n_value, value, 1);
15647 xmlResetLastError();
15648 if (mem_base != xmlMemBlocks()) {
15649 printf("Leak of %d blocks found in inputPush",
15650 xmlMemBlocks() - mem_base);
15651 test_ret++;
15652 printf(" %d", n_ctxt);
15653 printf(" %d", n_value);
15654 printf("\n");
15655 }
15656 }
15657 }
15658
15659 function_tests++;
15660 return(test_ret);
15661}
15662
15663
15664static int
15665test_namePop(void) {
15666 int test_ret = 0;
15667
15668 int mem_base;
15669 const xmlChar * ret_val;
15670 xmlParserCtxtPtr ctxt; /* an XML parser context */
15671 int n_ctxt;
15672
15673 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15674 mem_base = xmlMemBlocks();
15675 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15676
15677 ret_val = namePop(ctxt);
15678 desret_const_xmlChar_ptr(ret_val);
15679 call_tests++;
15680 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15681 xmlResetLastError();
15682 if (mem_base != xmlMemBlocks()) {
15683 printf("Leak of %d blocks found in namePop",
15684 xmlMemBlocks() - mem_base);
15685 test_ret++;
15686 printf(" %d", n_ctxt);
15687 printf("\n");
15688 }
15689 }
15690
15691 function_tests++;
15692 return(test_ret);
15693}
15694
15695
15696static int
15697test_namePush(void) {
15698 int test_ret = 0;
15699
15700 int mem_base;
15701 int ret_val;
15702 xmlParserCtxtPtr ctxt; /* an XML parser context */
15703 int n_ctxt;
15704 xmlChar * value; /* the element name */
15705 int n_value;
15706
15707 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15708 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
15709 mem_base = xmlMemBlocks();
15710 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15711 value = gen_const_xmlChar_ptr(n_value, 1);
15712
15713 ret_val = namePush(ctxt, value);
15714 desret_int(ret_val);
15715 call_tests++;
15716 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15717 des_const_xmlChar_ptr(n_value, value, 1);
15718 xmlResetLastError();
15719 if (mem_base != xmlMemBlocks()) {
15720 printf("Leak of %d blocks found in namePush",
15721 xmlMemBlocks() - mem_base);
15722 test_ret++;
15723 printf(" %d", n_ctxt);
15724 printf(" %d", n_value);
15725 printf("\n");
15726 }
15727 }
15728 }
15729
15730 function_tests++;
15731 return(test_ret);
15732}
15733
15734
15735static int
15736test_nodePop(void) {
15737 int test_ret = 0;
15738
15739 int mem_base;
15740 xmlNodePtr ret_val;
15741 xmlParserCtxtPtr ctxt; /* an XML parser context */
15742 int n_ctxt;
15743
15744 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15745 mem_base = xmlMemBlocks();
15746 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15747
15748 ret_val = nodePop(ctxt);
15749 desret_xmlNodePtr(ret_val);
15750 call_tests++;
15751 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15752 xmlResetLastError();
15753 if (mem_base != xmlMemBlocks()) {
15754 printf("Leak of %d blocks found in nodePop",
15755 xmlMemBlocks() - mem_base);
15756 test_ret++;
15757 printf(" %d", n_ctxt);
15758 printf("\n");
15759 }
15760 }
15761
15762 function_tests++;
15763 return(test_ret);
15764}
15765
15766
15767static int
15768test_nodePush(void) {
15769 int test_ret = 0;
15770
15771 int mem_base;
15772 int ret_val;
15773 xmlParserCtxtPtr ctxt; /* an XML parser context */
15774 int n_ctxt;
15775 xmlNodePtr value; /* the element node */
15776 int n_value;
15777
15778 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15779 for (n_value = 0;n_value < gen_nb_xmlNodePtr;n_value++) {
15780 mem_base = xmlMemBlocks();
15781 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15782 value = gen_xmlNodePtr(n_value, 1);
15783
15784 ret_val = nodePush(ctxt, value);
15785 desret_int(ret_val);
15786 call_tests++;
15787 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15788 des_xmlNodePtr(n_value, value, 1);
15789 xmlResetLastError();
15790 if (mem_base != xmlMemBlocks()) {
15791 printf("Leak of %d blocks found in nodePush",
15792 xmlMemBlocks() - mem_base);
15793 test_ret++;
15794 printf(" %d", n_ctxt);
15795 printf(" %d", n_value);
15796 printf("\n");
15797 }
15798 }
15799 }
15800
15801 function_tests++;
15802 return(test_ret);
15803}
15804
15805
15806static int
15807test_xmlCheckLanguageID(void) {
15808 int test_ret = 0;
15809
15810 int mem_base;
15811 int ret_val;
15812 xmlChar * lang; /* pointer to the string value */
15813 int n_lang;
15814
15815 for (n_lang = 0;n_lang < gen_nb_const_xmlChar_ptr;n_lang++) {
15816 mem_base = xmlMemBlocks();
15817 lang = gen_const_xmlChar_ptr(n_lang, 0);
15818
15819 ret_val = xmlCheckLanguageID(lang);
15820 desret_int(ret_val);
15821 call_tests++;
15822 des_const_xmlChar_ptr(n_lang, lang, 0);
15823 xmlResetLastError();
15824 if (mem_base != xmlMemBlocks()) {
15825 printf("Leak of %d blocks found in xmlCheckLanguageID",
15826 xmlMemBlocks() - mem_base);
15827 test_ret++;
15828 printf(" %d", n_lang);
15829 printf("\n");
15830 }
15831 }
15832
15833 function_tests++;
15834 return(test_ret);
15835}
15836
15837
15838static int
15839test_xmlCopyChar(void) {
15840 int test_ret = 0;
15841
15842 int mem_base;
15843 int ret_val;
15844 int len; /* Ignored, compatibility */
15845 int n_len;
15846 xmlChar * out; /* pointer to an array of xmlChar */
15847 int n_out;
15848 int val; /* the char value */
15849 int n_val;
15850
15851 for (n_len = 0;n_len < gen_nb_int;n_len++) {
15852 for (n_out = 0;n_out < gen_nb_xmlChar_ptr;n_out++) {
15853 for (n_val = 0;n_val < gen_nb_int;n_val++) {
15854 mem_base = xmlMemBlocks();
15855 len = gen_int(n_len, 0);
15856 out = gen_xmlChar_ptr(n_out, 1);
15857 val = gen_int(n_val, 2);
15858
15859 ret_val = xmlCopyChar(len, out, val);
15860 desret_int(ret_val);
15861 call_tests++;
15862 des_int(n_len, len, 0);
15863 des_xmlChar_ptr(n_out, out, 1);
15864 des_int(n_val, val, 2);
15865 xmlResetLastError();
15866 if (mem_base != xmlMemBlocks()) {
15867 printf("Leak of %d blocks found in xmlCopyChar",
15868 xmlMemBlocks() - mem_base);
15869 test_ret++;
15870 printf(" %d", n_len);
15871 printf(" %d", n_out);
15872 printf(" %d", n_val);
15873 printf("\n");
15874 }
15875 }
15876 }
15877 }
15878
15879 function_tests++;
15880 return(test_ret);
15881}
15882
15883
15884static int
15885test_xmlCopyCharMultiByte(void) {
15886 int test_ret = 0;
15887
15888 int mem_base;
15889 int ret_val;
15890 xmlChar * out; /* pointer to an array of xmlChar */
15891 int n_out;
15892 int val; /* the char value */
15893 int n_val;
15894
15895 for (n_out = 0;n_out < gen_nb_xmlChar_ptr;n_out++) {
15896 for (n_val = 0;n_val < gen_nb_int;n_val++) {
15897 mem_base = xmlMemBlocks();
15898 out = gen_xmlChar_ptr(n_out, 0);
15899 val = gen_int(n_val, 1);
15900
15901 ret_val = xmlCopyCharMultiByte(out, val);
15902 desret_int(ret_val);
15903 call_tests++;
15904 des_xmlChar_ptr(n_out, out, 0);
15905 des_int(n_val, val, 1);
15906 xmlResetLastError();
15907 if (mem_base != xmlMemBlocks()) {
15908 printf("Leak of %d blocks found in xmlCopyCharMultiByte",
15909 xmlMemBlocks() - mem_base);
15910 test_ret++;
15911 printf(" %d", n_out);
15912 printf(" %d", n_val);
15913 printf("\n");
15914 }
15915 }
15916 }
15917
15918 function_tests++;
15919 return(test_ret);
15920}
15921
15922
15923static int
15924test_xmlCreateEntityParserCtxt(void) {
15925 int test_ret = 0;
15926
15927 int mem_base;
15928 xmlParserCtxtPtr ret_val;
15929 xmlChar * URL; /* the entity URL */
15930 int n_URL;
15931 xmlChar * ID; /* the entity PUBLIC ID */
15932 int n_ID;
15933 xmlChar * base; /* a possible base for the target URI */
15934 int n_base;
15935
15936 for (n_URL = 0;n_URL < gen_nb_const_xmlChar_ptr;n_URL++) {
15937 for (n_ID = 0;n_ID < gen_nb_const_xmlChar_ptr;n_ID++) {
15938 for (n_base = 0;n_base < gen_nb_const_xmlChar_ptr;n_base++) {
15939 mem_base = xmlMemBlocks();
15940 URL = gen_const_xmlChar_ptr(n_URL, 0);
15941 ID = gen_const_xmlChar_ptr(n_ID, 1);
15942 base = gen_const_xmlChar_ptr(n_base, 2);
15943
15944 ret_val = xmlCreateEntityParserCtxt(URL, ID, base);
15945 desret_xmlParserCtxtPtr(ret_val);
15946 call_tests++;
15947 des_const_xmlChar_ptr(n_URL, URL, 0);
15948 des_const_xmlChar_ptr(n_ID, ID, 1);
15949 des_const_xmlChar_ptr(n_base, base, 2);
15950 xmlResetLastError();
15951 if (mem_base != xmlMemBlocks()) {
15952 printf("Leak of %d blocks found in xmlCreateEntityParserCtxt",
15953 xmlMemBlocks() - mem_base);
15954 test_ret++;
15955 printf(" %d", n_URL);
15956 printf(" %d", n_ID);
15957 printf(" %d", n_base);
15958 printf("\n");
15959 }
15960 }
15961 }
15962 }
15963
15964 function_tests++;
15965 return(test_ret);
15966}
15967
15968
15969static int
15970test_xmlCreateFileParserCtxt(void) {
15971 int test_ret = 0;
15972
15973 int mem_base;
15974 xmlParserCtxtPtr ret_val;
15975 const char * filename; /* the filename */
15976 int n_filename;
15977
15978 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
15979 mem_base = xmlMemBlocks();
15980 filename = gen_fileoutput(n_filename, 0);
15981
15982 ret_val = xmlCreateFileParserCtxt(filename);
15983 desret_xmlParserCtxtPtr(ret_val);
15984 call_tests++;
15985 des_fileoutput(n_filename, filename, 0);
15986 xmlResetLastError();
15987 if (mem_base != xmlMemBlocks()) {
15988 printf("Leak of %d blocks found in xmlCreateFileParserCtxt",
15989 xmlMemBlocks() - mem_base);
15990 test_ret++;
15991 printf(" %d", n_filename);
15992 printf("\n");
15993 }
15994 }
15995
15996 function_tests++;
15997 return(test_ret);
15998}
15999
16000
16001static int
16002test_xmlCreateMemoryParserCtxt(void) {
16003 int test_ret = 0;
16004
16005 int mem_base;
16006 xmlParserCtxtPtr ret_val;
16007 char * buffer; /* a pointer to a char array */
16008 int n_buffer;
16009 int size; /* the size of the array */
16010 int n_size;
16011
16012 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
16013 for (n_size = 0;n_size < gen_nb_int;n_size++) {
16014 mem_base = xmlMemBlocks();
16015 buffer = gen_const_char_ptr(n_buffer, 0);
16016 size = gen_int(n_size, 1);
16017
16018 ret_val = xmlCreateMemoryParserCtxt(buffer, size);
16019 desret_xmlParserCtxtPtr(ret_val);
16020 call_tests++;
16021 des_const_char_ptr(n_buffer, buffer, 0);
16022 des_int(n_size, size, 1);
16023 xmlResetLastError();
16024 if (mem_base != xmlMemBlocks()) {
16025 printf("Leak of %d blocks found in xmlCreateMemoryParserCtxt",
16026 xmlMemBlocks() - mem_base);
16027 test_ret++;
16028 printf(" %d", n_buffer);
16029 printf(" %d", n_size);
16030 printf("\n");
16031 }
16032 }
16033 }
16034
16035 function_tests++;
16036 return(test_ret);
16037}
16038
16039
16040static int
16041test_xmlCreateURLParserCtxt(void) {
16042 int test_ret = 0;
16043
16044 int mem_base;
16045 xmlParserCtxtPtr ret_val;
16046 const char * filename; /* the filename or URL */
16047 int n_filename;
16048 int options; /* a combination of xmlParserOption */
16049 int n_options;
16050
16051 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
16052 for (n_options = 0;n_options < gen_nb_int;n_options++) {
16053 mem_base = xmlMemBlocks();
16054 filename = gen_fileoutput(n_filename, 0);
16055 options = gen_int(n_options, 1);
16056
16057 ret_val = xmlCreateURLParserCtxt(filename, options);
16058 desret_xmlParserCtxtPtr(ret_val);
16059 call_tests++;
16060 des_fileoutput(n_filename, filename, 0);
16061 des_int(n_options, options, 1);
16062 xmlResetLastError();
16063 if (mem_base != xmlMemBlocks()) {
16064 printf("Leak of %d blocks found in xmlCreateURLParserCtxt",
16065 xmlMemBlocks() - mem_base);
16066 test_ret++;
16067 printf(" %d", n_filename);
16068 printf(" %d", n_options);
16069 printf("\n");
16070 }
16071 }
16072 }
16073
16074 function_tests++;
16075 return(test_ret);
16076}
16077
16078
16079static int
16080test_xmlCurrentChar(void) {
16081 int test_ret = 0;
16082
16083 int mem_base;
16084 int ret_val;
16085 xmlParserCtxtPtr ctxt; /* the XML parser context */
16086 int n_ctxt;
16087 int * len; /* pointer to the length of the char read */
16088 int n_len;
16089
16090 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16091 for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
16092 mem_base = xmlMemBlocks();
16093 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16094 len = gen_int_ptr(n_len, 1);
16095
16096 ret_val = xmlCurrentChar(ctxt, len);
16097 desret_int(ret_val);
16098 call_tests++;
16099 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16100 des_int_ptr(n_len, len, 1);
16101 xmlResetLastError();
16102 if (mem_base != xmlMemBlocks()) {
16103 printf("Leak of %d blocks found in xmlCurrentChar",
16104 xmlMemBlocks() - mem_base);
16105 test_ret++;
16106 printf(" %d", n_ctxt);
16107 printf(" %d", n_len);
16108 printf("\n");
16109 }
16110 }
16111 }
16112
16113 function_tests++;
16114 return(test_ret);
16115}
16116
16117
16118static int
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016119test_xmlErrMemory(void) {
16120 int test_ret = 0;
16121
16122 int mem_base;
16123 xmlParserCtxtPtr ctxt; /* an XML parser context */
16124 int n_ctxt;
16125 char * extra; /* extra informations */
16126 int n_extra;
16127
16128 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16129 for (n_extra = 0;n_extra < gen_nb_const_char_ptr;n_extra++) {
16130 mem_base = xmlMemBlocks();
16131 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16132 extra = gen_const_char_ptr(n_extra, 1);
16133
16134 xmlErrMemory(ctxt, extra);
16135 call_tests++;
16136 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16137 des_const_char_ptr(n_extra, extra, 1);
16138 xmlResetLastError();
16139 if (mem_base != xmlMemBlocks()) {
16140 printf("Leak of %d blocks found in xmlErrMemory",
16141 xmlMemBlocks() - mem_base);
16142 test_ret++;
16143 printf(" %d", n_ctxt);
16144 printf(" %d", n_extra);
16145 printf("\n");
16146 }
16147 }
16148 }
16149
16150 function_tests++;
16151 return(test_ret);
16152}
16153
16154
16155static int
16156test_xmlIsLetter(void) {
16157 int test_ret = 0;
16158
16159 int mem_base;
16160 int ret_val;
16161 int c; /* an unicode character (int) */
16162 int n_c;
16163
16164 for (n_c = 0;n_c < gen_nb_int;n_c++) {
16165 mem_base = xmlMemBlocks();
16166 c = gen_int(n_c, 0);
16167
16168 ret_val = xmlIsLetter(c);
16169 desret_int(ret_val);
16170 call_tests++;
16171 des_int(n_c, c, 0);
16172 xmlResetLastError();
16173 if (mem_base != xmlMemBlocks()) {
16174 printf("Leak of %d blocks found in xmlIsLetter",
16175 xmlMemBlocks() - mem_base);
16176 test_ret++;
16177 printf(" %d", n_c);
16178 printf("\n");
16179 }
16180 }
16181
16182 function_tests++;
16183 return(test_ret);
16184}
16185
16186
16187static int
16188test_xmlNewEntityInputStream(void) {
16189 int test_ret = 0;
16190
16191 int mem_base;
16192 xmlParserInputPtr ret_val;
16193 xmlParserCtxtPtr ctxt; /* an XML parser context */
16194 int n_ctxt;
16195 xmlEntityPtr entity; /* an Entity pointer */
16196 int n_entity;
16197
16198 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16199 for (n_entity = 0;n_entity < gen_nb_xmlEntityPtr;n_entity++) {
16200 mem_base = xmlMemBlocks();
16201 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16202 entity = gen_xmlEntityPtr(n_entity, 1);
16203
16204 ret_val = xmlNewEntityInputStream(ctxt, entity);
16205 desret_xmlParserInputPtr(ret_val);
16206 call_tests++;
16207 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16208 des_xmlEntityPtr(n_entity, entity, 1);
16209 xmlResetLastError();
16210 if (mem_base != xmlMemBlocks()) {
16211 printf("Leak of %d blocks found in xmlNewEntityInputStream",
16212 xmlMemBlocks() - mem_base);
16213 test_ret++;
16214 printf(" %d", n_ctxt);
16215 printf(" %d", n_entity);
16216 printf("\n");
16217 }
16218 }
16219 }
16220
16221 function_tests++;
16222 return(test_ret);
16223}
16224
16225
16226static int
16227test_xmlNewInputFromFile(void) {
16228 int test_ret = 0;
16229
16230 int mem_base;
16231 xmlParserInputPtr ret_val;
16232 xmlParserCtxtPtr ctxt; /* an XML parser context */
16233 int n_ctxt;
16234 const char * filename; /* the filename to use as entity */
16235 int n_filename;
16236
16237 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16238 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
16239 mem_base = xmlMemBlocks();
16240 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16241 filename = gen_filepath(n_filename, 1);
16242
16243 ret_val = xmlNewInputFromFile(ctxt, filename);
16244 desret_xmlParserInputPtr(ret_val);
16245 call_tests++;
16246 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16247 des_filepath(n_filename, filename, 1);
16248 xmlResetLastError();
16249 if (mem_base != xmlMemBlocks()) {
16250 printf("Leak of %d blocks found in xmlNewInputFromFile",
16251 xmlMemBlocks() - mem_base);
16252 test_ret++;
16253 printf(" %d", n_ctxt);
16254 printf(" %d", n_filename);
16255 printf("\n");
16256 }
16257 }
16258 }
16259
16260 function_tests++;
16261 return(test_ret);
16262}
16263
16264
16265static int
16266test_xmlNewInputStream(void) {
16267 int test_ret = 0;
16268
16269 int mem_base;
16270 xmlParserInputPtr ret_val;
16271 xmlParserCtxtPtr ctxt; /* an XML parser context */
16272 int n_ctxt;
16273
16274 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16275 mem_base = xmlMemBlocks();
16276 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16277
16278 ret_val = xmlNewInputStream(ctxt);
16279 desret_xmlParserInputPtr(ret_val);
16280 call_tests++;
16281 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16282 xmlResetLastError();
16283 if (mem_base != xmlMemBlocks()) {
16284 printf("Leak of %d blocks found in xmlNewInputStream",
16285 xmlMemBlocks() - mem_base);
16286 test_ret++;
16287 printf(" %d", n_ctxt);
16288 printf("\n");
16289 }
16290 }
16291
16292 function_tests++;
16293 return(test_ret);
16294}
16295
16296
16297static int
16298test_xmlNewStringInputStream(void) {
16299 int test_ret = 0;
16300
16301 int mem_base;
16302 xmlParserInputPtr ret_val;
16303 xmlParserCtxtPtr ctxt; /* an XML parser context */
16304 int n_ctxt;
16305 xmlChar * buffer; /* an memory buffer */
16306 int n_buffer;
16307
16308 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16309 for (n_buffer = 0;n_buffer < gen_nb_const_xmlChar_ptr;n_buffer++) {
16310 mem_base = xmlMemBlocks();
16311 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16312 buffer = gen_const_xmlChar_ptr(n_buffer, 1);
16313
16314 ret_val = xmlNewStringInputStream(ctxt, buffer);
16315 desret_xmlParserInputPtr(ret_val);
16316 call_tests++;
16317 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16318 des_const_xmlChar_ptr(n_buffer, buffer, 1);
16319 xmlResetLastError();
16320 if (mem_base != xmlMemBlocks()) {
16321 printf("Leak of %d blocks found in xmlNewStringInputStream",
16322 xmlMemBlocks() - mem_base);
16323 test_ret++;
16324 printf(" %d", n_ctxt);
16325 printf(" %d", n_buffer);
16326 printf("\n");
16327 }
16328 }
16329 }
16330
16331 function_tests++;
16332 return(test_ret);
16333}
16334
16335
16336static int
16337test_xmlNextChar(void) {
16338 int test_ret = 0;
16339
16340 int mem_base;
16341 xmlParserCtxtPtr ctxt; /* the XML parser context */
16342 int n_ctxt;
16343
16344 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16345 mem_base = xmlMemBlocks();
16346 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16347
16348 xmlNextChar(ctxt);
16349 call_tests++;
16350 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16351 xmlResetLastError();
16352 if (mem_base != xmlMemBlocks()) {
16353 printf("Leak of %d blocks found in xmlNextChar",
16354 xmlMemBlocks() - mem_base);
16355 test_ret++;
16356 printf(" %d", n_ctxt);
16357 printf("\n");
16358 }
16359 }
16360
16361 function_tests++;
16362 return(test_ret);
16363}
16364
16365
16366static int
16367test_xmlParserInputShrink(void) {
16368 int test_ret = 0;
16369
16370 int mem_base;
16371 xmlParserInputPtr in; /* an XML parser input */
16372 int n_in;
16373
16374 for (n_in = 0;n_in < gen_nb_xmlParserInputPtr;n_in++) {
16375 mem_base = xmlMemBlocks();
16376 in = gen_xmlParserInputPtr(n_in, 0);
16377
16378 xmlParserInputShrink(in);
16379 call_tests++;
16380 des_xmlParserInputPtr(n_in, in, 0);
16381 xmlResetLastError();
16382 if (mem_base != xmlMemBlocks()) {
16383 printf("Leak of %d blocks found in xmlParserInputShrink",
16384 xmlMemBlocks() - mem_base);
16385 test_ret++;
16386 printf(" %d", n_in);
16387 printf("\n");
16388 }
16389 }
16390
16391 function_tests++;
16392 return(test_ret);
16393}
16394
16395
16396static int
16397test_xmlPopInput(void) {
16398 int test_ret = 0;
16399
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016400 int mem_base;
16401 xmlChar ret_val;
16402 xmlParserCtxtPtr ctxt; /* an XML parser context */
16403 int n_ctxt;
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016404
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016405 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16406 mem_base = xmlMemBlocks();
16407 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16408
16409 ret_val = xmlPopInput(ctxt);
16410 desret_xmlChar(ret_val);
16411 call_tests++;
16412 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16413 xmlResetLastError();
16414 if (mem_base != xmlMemBlocks()) {
16415 printf("Leak of %d blocks found in xmlPopInput",
16416 xmlMemBlocks() - mem_base);
16417 test_ret++;
16418 printf(" %d", n_ctxt);
16419 printf("\n");
16420 }
16421 }
16422
16423 function_tests++;
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016424 return(test_ret);
16425}
16426
16427
16428static int
16429test_xmlPushInput(void) {
16430 int test_ret = 0;
16431
16432 int mem_base;
16433 xmlParserCtxtPtr ctxt; /* an XML parser context */
16434 int n_ctxt;
16435 xmlParserInputPtr input; /* an XML parser input fragment (entity, XML fragment ...). */
16436 int n_input;
16437
16438 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16439 for (n_input = 0;n_input < gen_nb_xmlParserInputPtr;n_input++) {
16440 mem_base = xmlMemBlocks();
16441 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16442 input = gen_xmlParserInputPtr(n_input, 1);
16443
16444 xmlPushInput(ctxt, input);
16445 call_tests++;
16446 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16447 des_xmlParserInputPtr(n_input, input, 1);
16448 xmlResetLastError();
16449 if (mem_base != xmlMemBlocks()) {
16450 printf("Leak of %d blocks found in xmlPushInput",
16451 xmlMemBlocks() - mem_base);
16452 test_ret++;
16453 printf(" %d", n_ctxt);
16454 printf(" %d", n_input);
16455 printf("\n");
16456 }
16457 }
16458 }
16459
16460 function_tests++;
16461 return(test_ret);
16462}
16463
16464
16465static int
16466test_xmlSetEntityReferenceFunc(void) {
16467 int test_ret = 0;
16468
16469
16470 /* missing type support */
16471 return(test_ret);
16472}
16473
16474
16475static int
16476test_xmlSplitQName(void) {
16477 int test_ret = 0;
16478
16479 int mem_base;
16480 xmlChar * ret_val;
16481 xmlParserCtxtPtr ctxt; /* an XML parser context */
16482 int n_ctxt;
16483 xmlChar * name; /* an XML parser context */
16484 int n_name;
16485 xmlChar ** prefix; /* a xmlChar ** */
16486 int n_prefix;
16487
16488 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16489 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
16490 for (n_prefix = 0;n_prefix < gen_nb_xmlChar_ptr_ptr;n_prefix++) {
16491 mem_base = xmlMemBlocks();
16492 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16493 name = gen_const_xmlChar_ptr(n_name, 1);
16494 prefix = gen_xmlChar_ptr_ptr(n_prefix, 2);
16495
16496 ret_val = xmlSplitQName(ctxt, name, prefix);
16497 desret_xmlChar_ptr(ret_val);
16498 call_tests++;
16499 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16500 des_const_xmlChar_ptr(n_name, name, 1);
16501 des_xmlChar_ptr_ptr(n_prefix, prefix, 2);
16502 xmlResetLastError();
16503 if (mem_base != xmlMemBlocks()) {
16504 printf("Leak of %d blocks found in xmlSplitQName",
16505 xmlMemBlocks() - mem_base);
16506 test_ret++;
16507 printf(" %d", n_ctxt);
16508 printf(" %d", n_name);
16509 printf(" %d", n_prefix);
16510 printf("\n");
16511 }
16512 }
16513 }
16514 }
16515
16516 function_tests++;
16517 return(test_ret);
16518}
16519
16520
16521static int
16522test_xmlStringCurrentChar(void) {
16523 int test_ret = 0;
16524
16525 int mem_base;
16526 int ret_val;
16527 xmlParserCtxtPtr ctxt; /* the XML parser context */
16528 int n_ctxt;
16529 xmlChar * cur; /* pointer to the beginning of the char */
16530 int n_cur;
16531 int * len; /* pointer to the length of the char read */
16532 int n_len;
16533
16534 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16535 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
16536 for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
16537 mem_base = xmlMemBlocks();
16538 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16539 cur = gen_const_xmlChar_ptr(n_cur, 1);
16540 len = gen_int_ptr(n_len, 2);
16541
16542 ret_val = xmlStringCurrentChar(ctxt, cur, len);
16543 desret_int(ret_val);
16544 call_tests++;
16545 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16546 des_const_xmlChar_ptr(n_cur, cur, 1);
16547 des_int_ptr(n_len, len, 2);
16548 xmlResetLastError();
16549 if (mem_base != xmlMemBlocks()) {
16550 printf("Leak of %d blocks found in xmlStringCurrentChar",
16551 xmlMemBlocks() - mem_base);
16552 test_ret++;
16553 printf(" %d", n_ctxt);
16554 printf(" %d", n_cur);
16555 printf(" %d", n_len);
16556 printf("\n");
16557 }
16558 }
16559 }
16560 }
16561
16562 function_tests++;
16563 return(test_ret);
16564}
16565
16566
16567static int
16568test_xmlStringDecodeEntities(void) {
16569 int test_ret = 0;
16570
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016571 int mem_base;
16572 xmlChar * ret_val;
16573 xmlParserCtxtPtr ctxt; /* the parser context */
16574 int n_ctxt;
16575 xmlChar * str; /* the input string */
16576 int n_str;
16577 int what; /* combination of XML_SUBSTITUTE_REF and XML_SUBSTITUTE_PEREF */
16578 int n_what;
16579 xmlChar end; /* an end marker xmlChar, 0 if none */
16580 int n_end;
16581 xmlChar end2; /* an end marker xmlChar, 0 if none */
16582 int n_end2;
16583 xmlChar end3; /* an end marker xmlChar, 0 if none */
16584 int n_end3;
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016585
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016586 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16587 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
16588 for (n_what = 0;n_what < gen_nb_int;n_what++) {
16589 for (n_end = 0;n_end < gen_nb_xmlChar;n_end++) {
16590 for (n_end2 = 0;n_end2 < gen_nb_xmlChar;n_end2++) {
16591 for (n_end3 = 0;n_end3 < gen_nb_xmlChar;n_end3++) {
16592 mem_base = xmlMemBlocks();
16593 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16594 str = gen_const_xmlChar_ptr(n_str, 1);
16595 what = gen_int(n_what, 2);
16596 end = gen_xmlChar(n_end, 3);
16597 end2 = gen_xmlChar(n_end2, 4);
16598 end3 = gen_xmlChar(n_end3, 5);
16599
16600 ret_val = xmlStringDecodeEntities(ctxt, str, what, end, end2, end3);
16601 desret_xmlChar_ptr(ret_val);
16602 call_tests++;
16603 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16604 des_const_xmlChar_ptr(n_str, str, 1);
16605 des_int(n_what, what, 2);
16606 des_xmlChar(n_end, end, 3);
16607 des_xmlChar(n_end2, end2, 4);
16608 des_xmlChar(n_end3, end3, 5);
16609 xmlResetLastError();
16610 if (mem_base != xmlMemBlocks()) {
16611 printf("Leak of %d blocks found in xmlStringDecodeEntities",
16612 xmlMemBlocks() - mem_base);
16613 test_ret++;
16614 printf(" %d", n_ctxt);
16615 printf(" %d", n_str);
16616 printf(" %d", n_what);
16617 printf(" %d", n_end);
16618 printf(" %d", n_end2);
16619 printf(" %d", n_end3);
16620 printf("\n");
16621 }
16622 }
16623 }
16624 }
16625 }
16626 }
16627 }
16628
16629 function_tests++;
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016630 return(test_ret);
16631}
16632
16633
16634static int
16635test_xmlStringLenDecodeEntities(void) {
16636 int test_ret = 0;
16637
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016638 int mem_base;
16639 xmlChar * ret_val;
16640 xmlParserCtxtPtr ctxt; /* the parser context */
16641 int n_ctxt;
16642 xmlChar * str; /* the input string */
16643 int n_str;
16644 int len; /* the string length */
16645 int n_len;
16646 int what; /* combination of XML_SUBSTITUTE_REF and XML_SUBSTITUTE_PEREF */
16647 int n_what;
16648 xmlChar end; /* an end marker xmlChar, 0 if none */
16649 int n_end;
16650 xmlChar end2; /* an end marker xmlChar, 0 if none */
16651 int n_end2;
16652 xmlChar end3; /* an end marker xmlChar, 0 if none */
16653 int n_end3;
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016654
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016655 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16656 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
16657 for (n_len = 0;n_len < gen_nb_int;n_len++) {
16658 for (n_what = 0;n_what < gen_nb_int;n_what++) {
16659 for (n_end = 0;n_end < gen_nb_xmlChar;n_end++) {
16660 for (n_end2 = 0;n_end2 < gen_nb_xmlChar;n_end2++) {
16661 for (n_end3 = 0;n_end3 < gen_nb_xmlChar;n_end3++) {
16662 mem_base = xmlMemBlocks();
16663 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16664 str = gen_const_xmlChar_ptr(n_str, 1);
16665 len = gen_int(n_len, 2);
16666 what = gen_int(n_what, 3);
16667 end = gen_xmlChar(n_end, 4);
16668 end2 = gen_xmlChar(n_end2, 5);
16669 end3 = gen_xmlChar(n_end3, 6);
16670
16671 ret_val = xmlStringLenDecodeEntities(ctxt, str, len, what, end, end2, end3);
16672 desret_xmlChar_ptr(ret_val);
16673 call_tests++;
16674 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16675 des_const_xmlChar_ptr(n_str, str, 1);
16676 des_int(n_len, len, 2);
16677 des_int(n_what, what, 3);
16678 des_xmlChar(n_end, end, 4);
16679 des_xmlChar(n_end2, end2, 5);
16680 des_xmlChar(n_end3, end3, 6);
16681 xmlResetLastError();
16682 if (mem_base != xmlMemBlocks()) {
16683 printf("Leak of %d blocks found in xmlStringLenDecodeEntities",
16684 xmlMemBlocks() - mem_base);
16685 test_ret++;
16686 printf(" %d", n_ctxt);
16687 printf(" %d", n_str);
16688 printf(" %d", n_len);
16689 printf(" %d", n_what);
16690 printf(" %d", n_end);
16691 printf(" %d", n_end2);
16692 printf(" %d", n_end3);
16693 printf("\n");
16694 }
16695 }
16696 }
16697 }
16698 }
16699 }
16700 }
16701 }
16702
16703 function_tests++;
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016704 return(test_ret);
16705}
16706
16707
16708static int
16709test_xmlSwitchEncoding(void) {
16710 int test_ret = 0;
16711
16712 int mem_base;
16713 int ret_val;
16714 xmlParserCtxtPtr ctxt; /* the parser context */
16715 int n_ctxt;
16716 xmlCharEncoding enc; /* the encoding value (number) */
16717 int n_enc;
16718
16719 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16720 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
16721 mem_base = xmlMemBlocks();
16722 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16723 enc = gen_xmlCharEncoding(n_enc, 1);
16724
16725 ret_val = xmlSwitchEncoding(ctxt, enc);
16726 desret_int(ret_val);
16727 call_tests++;
16728 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16729 des_xmlCharEncoding(n_enc, enc, 1);
16730 xmlResetLastError();
16731 if (mem_base != xmlMemBlocks()) {
16732 printf("Leak of %d blocks found in xmlSwitchEncoding",
16733 xmlMemBlocks() - mem_base);
16734 test_ret++;
16735 printf(" %d", n_ctxt);
16736 printf(" %d", n_enc);
16737 printf("\n");
16738 }
16739 }
16740 }
16741
16742 function_tests++;
16743 return(test_ret);
16744}
16745
16746
16747static int
16748test_xmlSwitchInputEncoding(void) {
16749 int test_ret = 0;
16750
16751 int mem_base;
16752 int ret_val;
16753 xmlParserCtxtPtr ctxt; /* the parser context */
16754 int n_ctxt;
16755 xmlParserInputPtr input; /* the input stream */
16756 int n_input;
16757 xmlCharEncodingHandlerPtr handler; /* the encoding handler */
16758 int n_handler;
16759
16760 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16761 for (n_input = 0;n_input < gen_nb_xmlParserInputPtr;n_input++) {
16762 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandlerPtr;n_handler++) {
16763 mem_base = xmlMemBlocks();
16764 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16765 input = gen_xmlParserInputPtr(n_input, 1);
16766 handler = gen_xmlCharEncodingHandlerPtr(n_handler, 2);
16767
16768 ret_val = xmlSwitchInputEncoding(ctxt, input, handler);
16769 desret_int(ret_val);
16770 call_tests++;
16771 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16772 des_xmlParserInputPtr(n_input, input, 1);
16773 des_xmlCharEncodingHandlerPtr(n_handler, handler, 2);
16774 xmlResetLastError();
16775 if (mem_base != xmlMemBlocks()) {
16776 printf("Leak of %d blocks found in xmlSwitchInputEncoding",
16777 xmlMemBlocks() - mem_base);
16778 test_ret++;
16779 printf(" %d", n_ctxt);
16780 printf(" %d", n_input);
16781 printf(" %d", n_handler);
16782 printf("\n");
16783 }
16784 }
16785 }
16786 }
16787
16788 function_tests++;
16789 return(test_ret);
16790}
16791
16792
16793static int
16794test_xmlSwitchToEncoding(void) {
16795 int test_ret = 0;
16796
16797 int mem_base;
16798 int ret_val;
16799 xmlParserCtxtPtr ctxt; /* the parser context */
16800 int n_ctxt;
16801 xmlCharEncodingHandlerPtr handler; /* the encoding handler */
16802 int n_handler;
16803
16804 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16805 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandlerPtr;n_handler++) {
16806 mem_base = xmlMemBlocks();
16807 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16808 handler = gen_xmlCharEncodingHandlerPtr(n_handler, 1);
16809
16810 ret_val = xmlSwitchToEncoding(ctxt, handler);
16811 desret_int(ret_val);
16812 call_tests++;
16813 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16814 des_xmlCharEncodingHandlerPtr(n_handler, handler, 1);
16815 xmlResetLastError();
16816 if (mem_base != xmlMemBlocks()) {
16817 printf("Leak of %d blocks found in xmlSwitchToEncoding",
16818 xmlMemBlocks() - mem_base);
16819 test_ret++;
16820 printf(" %d", n_ctxt);
16821 printf(" %d", n_handler);
16822 printf("\n");
16823 }
16824 }
16825 }
16826
16827 function_tests++;
16828 return(test_ret);
16829}
16830
16831static int
16832test_parserInternals(void) {
16833 int test_ret = 0;
16834
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016835 printf("Testing parserInternals : 33 of 90 functions ...\n");
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016836 test_ret += test_htmlCreateFileParserCtxt();
16837 test_ret += test_htmlInitAutoClose();
16838 test_ret += test_inputPop();
16839 test_ret += test_inputPush();
16840 test_ret += test_namePop();
16841 test_ret += test_namePush();
16842 test_ret += test_nodePop();
16843 test_ret += test_nodePush();
16844 test_ret += test_xmlCheckLanguageID();
16845 test_ret += test_xmlCopyChar();
16846 test_ret += test_xmlCopyCharMultiByte();
16847 test_ret += test_xmlCreateEntityParserCtxt();
16848 test_ret += test_xmlCreateFileParserCtxt();
16849 test_ret += test_xmlCreateMemoryParserCtxt();
16850 test_ret += test_xmlCreateURLParserCtxt();
16851 test_ret += test_xmlCurrentChar();
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016852 test_ret += test_xmlErrMemory();
16853 test_ret += test_xmlIsLetter();
16854 test_ret += test_xmlNewEntityInputStream();
16855 test_ret += test_xmlNewInputFromFile();
16856 test_ret += test_xmlNewInputStream();
16857 test_ret += test_xmlNewStringInputStream();
16858 test_ret += test_xmlNextChar();
16859 test_ret += test_xmlParserInputShrink();
16860 test_ret += test_xmlPopInput();
16861 test_ret += test_xmlPushInput();
16862 test_ret += test_xmlSetEntityReferenceFunc();
16863 test_ret += test_xmlSplitQName();
16864 test_ret += test_xmlStringCurrentChar();
16865 test_ret += test_xmlStringDecodeEntities();
16866 test_ret += test_xmlStringLenDecodeEntities();
16867 test_ret += test_xmlSwitchEncoding();
16868 test_ret += test_xmlSwitchInputEncoding();
16869 test_ret += test_xmlSwitchToEncoding();
16870
16871 if (test_ret != 0)
16872 printf("Module parserInternals: %d errors\n", test_ret);
16873 return(test_ret);
16874}
16875
Daniel Veillardd93f6252004-11-02 15:53:51 +000016876static int
16877test_xmlPatternMatch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016878 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016879
Daniel Veillardce682bc2004-11-05 17:22:25 +000016880#ifdef LIBXML_PATTERN_ENABLED
16881 int mem_base;
16882 int ret_val;
16883 xmlPatternPtr comp; /* the precompiled pattern */
16884 int n_comp;
16885 xmlNodePtr node; /* a node */
16886 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016887
Daniel Veillardce682bc2004-11-05 17:22:25 +000016888 for (n_comp = 0;n_comp < gen_nb_xmlPatternPtr;n_comp++) {
16889 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
16890 mem_base = xmlMemBlocks();
16891 comp = gen_xmlPatternPtr(n_comp, 0);
16892 node = gen_xmlNodePtr(n_node, 1);
16893
16894 ret_val = xmlPatternMatch(comp, node);
16895 desret_int(ret_val);
16896 call_tests++;
16897 des_xmlPatternPtr(n_comp, comp, 0);
16898 des_xmlNodePtr(n_node, node, 1);
16899 xmlResetLastError();
16900 if (mem_base != xmlMemBlocks()) {
16901 printf("Leak of %d blocks found in xmlPatternMatch",
16902 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000016903 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000016904 printf(" %d", n_comp);
16905 printf(" %d", n_node);
16906 printf("\n");
16907 }
16908 }
16909 }
16910#endif
16911
16912 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000016913 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016914}
16915
16916
16917static int
16918test_xmlPatterncompile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016919 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016920
16921
16922 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000016923 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016924}
16925
16926static int
16927test_pattern(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016928 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016929
Daniel Veillardce682bc2004-11-05 17:22:25 +000016930 printf("Testing pattern : 1 of 4 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000016931 test_ret += test_xmlPatternMatch();
16932 test_ret += test_xmlPatterncompile();
Daniel Veillardd93f6252004-11-02 15:53:51 +000016933
Daniel Veillard42595322004-11-08 10:52:06 +000016934 if (test_ret != 0)
16935 printf("Module pattern: %d errors\n", test_ret);
16936 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016937}
Daniel Veillarda521d282004-11-09 14:59:59 +000016938#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000016939
Daniel Veillardce682bc2004-11-05 17:22:25 +000016940#define gen_nb_xmlRelaxNGPtr 1
16941static xmlRelaxNGPtr gen_xmlRelaxNGPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16942 return(NULL);
16943}
16944static void des_xmlRelaxNGPtr(int no ATTRIBUTE_UNUSED, xmlRelaxNGPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16945}
Daniel Veillarda521d282004-11-09 14:59:59 +000016946#endif
16947
Daniel Veillardce682bc2004-11-05 17:22:25 +000016948
Daniel Veillardd93f6252004-11-02 15:53:51 +000016949static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000016950test_xmlRelaxNGDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016951 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016952
Daniel Veillardce682bc2004-11-05 17:22:25 +000016953#ifdef LIBXML_SCHEMAS_ENABLED
16954#ifdef LIBXML_OUTPUT_ENABLED
16955 int mem_base;
16956 FILE * output; /* the file output */
16957 int n_output;
16958 xmlRelaxNGPtr schema; /* a schema structure */
16959 int n_schema;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016960
Daniel Veillardce682bc2004-11-05 17:22:25 +000016961 for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
16962 for (n_schema = 0;n_schema < gen_nb_xmlRelaxNGPtr;n_schema++) {
16963 mem_base = xmlMemBlocks();
16964 output = gen_FILE_ptr(n_output, 0);
16965 schema = gen_xmlRelaxNGPtr(n_schema, 1);
16966
16967 xmlRelaxNGDump(output, schema);
16968 call_tests++;
16969 des_FILE_ptr(n_output, output, 0);
16970 des_xmlRelaxNGPtr(n_schema, schema, 1);
16971 xmlResetLastError();
16972 if (mem_base != xmlMemBlocks()) {
16973 printf("Leak of %d blocks found in xmlRelaxNGDump",
16974 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000016975 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000016976 printf(" %d", n_output);
16977 printf(" %d", n_schema);
16978 printf("\n");
16979 }
16980 }
16981 }
16982#endif
16983#endif
16984
16985 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000016986 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016987}
16988
16989
16990static int
16991test_xmlRelaxNGDumpTree(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016992 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016993
Daniel Veillardce682bc2004-11-05 17:22:25 +000016994#ifdef LIBXML_SCHEMAS_ENABLED
16995#ifdef LIBXML_OUTPUT_ENABLED
16996 int mem_base;
16997 FILE * output; /* the file output */
16998 int n_output;
16999 xmlRelaxNGPtr schema; /* a schema structure */
17000 int n_schema;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017001
Daniel Veillardce682bc2004-11-05 17:22:25 +000017002 for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
17003 for (n_schema = 0;n_schema < gen_nb_xmlRelaxNGPtr;n_schema++) {
17004 mem_base = xmlMemBlocks();
17005 output = gen_FILE_ptr(n_output, 0);
17006 schema = gen_xmlRelaxNGPtr(n_schema, 1);
17007
17008 xmlRelaxNGDumpTree(output, schema);
17009 call_tests++;
17010 des_FILE_ptr(n_output, output, 0);
17011 des_xmlRelaxNGPtr(n_schema, schema, 1);
17012 xmlResetLastError();
17013 if (mem_base != xmlMemBlocks()) {
17014 printf("Leak of %d blocks found in xmlRelaxNGDumpTree",
17015 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017016 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017017 printf(" %d", n_output);
17018 printf(" %d", n_schema);
17019 printf("\n");
17020 }
17021 }
17022 }
17023#endif
17024#endif
17025
17026 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017027 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017028}
17029
Daniel Veillarda521d282004-11-09 14:59:59 +000017030#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000017031
Daniel Veillardce682bc2004-11-05 17:22:25 +000017032#define gen_nb_xmlRelaxNGParserCtxtPtr 1
17033static xmlRelaxNGParserCtxtPtr gen_xmlRelaxNGParserCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
17034 return(NULL);
17035}
17036static void des_xmlRelaxNGParserCtxtPtr(int no ATTRIBUTE_UNUSED, xmlRelaxNGParserCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
17037}
Daniel Veillarda521d282004-11-09 14:59:59 +000017038#endif
17039
17040#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000017041
17042#define gen_nb_xmlRelaxNGValidityErrorFunc_ptr 1
17043static xmlRelaxNGValidityErrorFunc * gen_xmlRelaxNGValidityErrorFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
17044 return(NULL);
17045}
17046static void des_xmlRelaxNGValidityErrorFunc_ptr(int no ATTRIBUTE_UNUSED, xmlRelaxNGValidityErrorFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
17047}
Daniel Veillarda521d282004-11-09 14:59:59 +000017048#endif
17049
17050#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000017051
17052#define gen_nb_xmlRelaxNGValidityWarningFunc_ptr 1
17053static xmlRelaxNGValidityWarningFunc * gen_xmlRelaxNGValidityWarningFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
17054 return(NULL);
17055}
17056static void des_xmlRelaxNGValidityWarningFunc_ptr(int no ATTRIBUTE_UNUSED, xmlRelaxNGValidityWarningFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
17057}
Daniel Veillarda521d282004-11-09 14:59:59 +000017058#endif
17059
17060#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000017061
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000017062#define gen_nb_void_ptr_ptr 1
17063static void ** gen_void_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
17064 return(NULL);
17065}
17066static void des_void_ptr_ptr(int no ATTRIBUTE_UNUSED, void ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
17067}
Daniel Veillarda521d282004-11-09 14:59:59 +000017068#endif
17069
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000017070
Daniel Veillardd93f6252004-11-02 15:53:51 +000017071static int
17072test_xmlRelaxNGGetParserErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017073 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017074
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000017075#ifdef LIBXML_SCHEMAS_ENABLED
17076 int mem_base;
17077 int ret_val;
17078 xmlRelaxNGParserCtxtPtr ctxt; /* a Relax-NG validation context */
17079 int n_ctxt;
17080 xmlRelaxNGValidityErrorFunc * err; /* the error callback result */
17081 int n_err;
17082 xmlRelaxNGValidityWarningFunc * warn; /* the warning callback result */
17083 int n_warn;
17084 void ** ctx; /* contextual data for the callbacks result */
17085 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017086
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000017087 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGParserCtxtPtr;n_ctxt++) {
17088 for (n_err = 0;n_err < gen_nb_xmlRelaxNGValidityErrorFunc_ptr;n_err++) {
17089 for (n_warn = 0;n_warn < gen_nb_xmlRelaxNGValidityWarningFunc_ptr;n_warn++) {
17090 for (n_ctx = 0;n_ctx < gen_nb_void_ptr_ptr;n_ctx++) {
17091 mem_base = xmlMemBlocks();
17092 ctxt = gen_xmlRelaxNGParserCtxtPtr(n_ctxt, 0);
17093 err = gen_xmlRelaxNGValidityErrorFunc_ptr(n_err, 1);
17094 warn = gen_xmlRelaxNGValidityWarningFunc_ptr(n_warn, 2);
17095 ctx = gen_void_ptr_ptr(n_ctx, 3);
17096
17097 ret_val = xmlRelaxNGGetParserErrors(ctxt, err, warn, ctx);
17098 desret_int(ret_val);
17099 call_tests++;
17100 des_xmlRelaxNGParserCtxtPtr(n_ctxt, ctxt, 0);
17101 des_xmlRelaxNGValidityErrorFunc_ptr(n_err, err, 1);
17102 des_xmlRelaxNGValidityWarningFunc_ptr(n_warn, warn, 2);
17103 des_void_ptr_ptr(n_ctx, ctx, 3);
17104 xmlResetLastError();
17105 if (mem_base != xmlMemBlocks()) {
17106 printf("Leak of %d blocks found in xmlRelaxNGGetParserErrors",
17107 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017108 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000017109 printf(" %d", n_ctxt);
17110 printf(" %d", n_err);
17111 printf(" %d", n_warn);
17112 printf(" %d", n_ctx);
17113 printf("\n");
17114 }
17115 }
17116 }
17117 }
17118 }
17119#endif
17120
17121 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017122 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017123}
17124
Daniel Veillarda521d282004-11-09 14:59:59 +000017125#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000017126
Daniel Veillardce682bc2004-11-05 17:22:25 +000017127#define gen_nb_xmlRelaxNGValidCtxtPtr 1
17128static xmlRelaxNGValidCtxtPtr gen_xmlRelaxNGValidCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
17129 return(NULL);
17130}
17131static void des_xmlRelaxNGValidCtxtPtr(int no ATTRIBUTE_UNUSED, xmlRelaxNGValidCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
17132}
Daniel Veillarda521d282004-11-09 14:59:59 +000017133#endif
17134
Daniel Veillardce682bc2004-11-05 17:22:25 +000017135
Daniel Veillardd93f6252004-11-02 15:53:51 +000017136static int
17137test_xmlRelaxNGGetValidErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017138 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017139
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000017140#ifdef LIBXML_SCHEMAS_ENABLED
17141 int mem_base;
17142 int ret_val;
17143 xmlRelaxNGValidCtxtPtr ctxt; /* a Relax-NG validation context */
17144 int n_ctxt;
17145 xmlRelaxNGValidityErrorFunc * err; /* the error function result */
17146 int n_err;
17147 xmlRelaxNGValidityWarningFunc * warn; /* the warning function result */
17148 int n_warn;
17149 void ** ctx; /* the functions context result */
17150 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017151
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000017152 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
17153 for (n_err = 0;n_err < gen_nb_xmlRelaxNGValidityErrorFunc_ptr;n_err++) {
17154 for (n_warn = 0;n_warn < gen_nb_xmlRelaxNGValidityWarningFunc_ptr;n_warn++) {
17155 for (n_ctx = 0;n_ctx < gen_nb_void_ptr_ptr;n_ctx++) {
17156 mem_base = xmlMemBlocks();
17157 ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
17158 err = gen_xmlRelaxNGValidityErrorFunc_ptr(n_err, 1);
17159 warn = gen_xmlRelaxNGValidityWarningFunc_ptr(n_warn, 2);
17160 ctx = gen_void_ptr_ptr(n_ctx, 3);
17161
17162 ret_val = xmlRelaxNGGetValidErrors(ctxt, err, warn, ctx);
17163 desret_int(ret_val);
17164 call_tests++;
17165 des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
17166 des_xmlRelaxNGValidityErrorFunc_ptr(n_err, err, 1);
17167 des_xmlRelaxNGValidityWarningFunc_ptr(n_warn, warn, 2);
17168 des_void_ptr_ptr(n_ctx, ctx, 3);
17169 xmlResetLastError();
17170 if (mem_base != xmlMemBlocks()) {
17171 printf("Leak of %d blocks found in xmlRelaxNGGetValidErrors",
17172 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017173 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000017174 printf(" %d", n_ctxt);
17175 printf(" %d", n_err);
17176 printf(" %d", n_warn);
17177 printf(" %d", n_ctx);
17178 printf("\n");
17179 }
17180 }
17181 }
17182 }
17183 }
17184#endif
17185
17186 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017187 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017188}
17189
17190
17191static int
Daniel Veillard34099b42004-11-04 17:34:35 +000017192test_xmlRelaxNGInitTypes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017193 int test_ret = 0;
Daniel Veillard34099b42004-11-04 17:34:35 +000017194
17195#ifdef LIBXML_SCHEMAS_ENABLED
17196 int mem_base;
17197 int ret_val;
17198
17199 mem_base = xmlMemBlocks();
17200
17201 ret_val = xmlRelaxNGInitTypes();
17202 desret_int(ret_val);
17203 call_tests++;
17204 xmlResetLastError();
17205 if (mem_base != xmlMemBlocks()) {
17206 printf("Leak of %d blocks found in xmlRelaxNGInitTypes",
17207 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017208 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000017209 printf("\n");
17210 }
17211#endif
17212
17213 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017214 return(test_ret);
Daniel Veillard34099b42004-11-04 17:34:35 +000017215}
17216
17217
17218static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000017219test_xmlRelaxNGNewDocParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017220 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017221
Daniel Veillard42595322004-11-08 10:52:06 +000017222#ifdef LIBXML_SCHEMAS_ENABLED
17223 int mem_base;
17224 xmlRelaxNGParserCtxtPtr ret_val;
17225 xmlDocPtr doc; /* a preparsed document tree */
17226 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017227
Daniel Veillard42595322004-11-08 10:52:06 +000017228 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
17229 mem_base = xmlMemBlocks();
17230 doc = gen_xmlDocPtr(n_doc, 0);
17231
17232 ret_val = xmlRelaxNGNewDocParserCtxt(doc);
17233 desret_xmlRelaxNGParserCtxtPtr(ret_val);
17234 call_tests++;
17235 des_xmlDocPtr(n_doc, doc, 0);
17236 xmlResetLastError();
17237 if (mem_base != xmlMemBlocks()) {
17238 printf("Leak of %d blocks found in xmlRelaxNGNewDocParserCtxt",
17239 xmlMemBlocks() - mem_base);
17240 test_ret++;
17241 printf(" %d", n_doc);
17242 printf("\n");
17243 }
17244 }
17245#endif
17246
17247 function_tests++;
17248 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017249}
17250
17251
17252static int
17253test_xmlRelaxNGNewMemParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017254 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017255
Daniel Veillard42595322004-11-08 10:52:06 +000017256#ifdef LIBXML_SCHEMAS_ENABLED
17257 int mem_base;
17258 xmlRelaxNGParserCtxtPtr ret_val;
17259 char * buffer; /* a pointer to a char array containing the schemas */
17260 int n_buffer;
17261 int size; /* the size of the array */
17262 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017263
Daniel Veillard42595322004-11-08 10:52:06 +000017264 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
17265 for (n_size = 0;n_size < gen_nb_int;n_size++) {
17266 mem_base = xmlMemBlocks();
17267 buffer = gen_const_char_ptr(n_buffer, 0);
17268 size = gen_int(n_size, 1);
17269
17270 ret_val = xmlRelaxNGNewMemParserCtxt(buffer, size);
17271 desret_xmlRelaxNGParserCtxtPtr(ret_val);
17272 call_tests++;
17273 des_const_char_ptr(n_buffer, buffer, 0);
17274 des_int(n_size, size, 1);
17275 xmlResetLastError();
17276 if (mem_base != xmlMemBlocks()) {
17277 printf("Leak of %d blocks found in xmlRelaxNGNewMemParserCtxt",
17278 xmlMemBlocks() - mem_base);
17279 test_ret++;
17280 printf(" %d", n_buffer);
17281 printf(" %d", n_size);
17282 printf("\n");
17283 }
17284 }
17285 }
17286#endif
17287
17288 function_tests++;
17289 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017290}
17291
17292
17293static int
17294test_xmlRelaxNGNewParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017295 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017296
Daniel Veillard42595322004-11-08 10:52:06 +000017297#ifdef LIBXML_SCHEMAS_ENABLED
17298 int mem_base;
17299 xmlRelaxNGParserCtxtPtr ret_val;
17300 char * URL; /* the location of the schema */
17301 int n_URL;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017302
Daniel Veillard42595322004-11-08 10:52:06 +000017303 for (n_URL = 0;n_URL < gen_nb_const_char_ptr;n_URL++) {
17304 mem_base = xmlMemBlocks();
17305 URL = gen_const_char_ptr(n_URL, 0);
17306
17307 ret_val = xmlRelaxNGNewParserCtxt(URL);
17308 desret_xmlRelaxNGParserCtxtPtr(ret_val);
17309 call_tests++;
17310 des_const_char_ptr(n_URL, URL, 0);
17311 xmlResetLastError();
17312 if (mem_base != xmlMemBlocks()) {
17313 printf("Leak of %d blocks found in xmlRelaxNGNewParserCtxt",
17314 xmlMemBlocks() - mem_base);
17315 test_ret++;
17316 printf(" %d", n_URL);
17317 printf("\n");
17318 }
17319 }
17320#endif
17321
17322 function_tests++;
17323 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017324}
17325
17326
17327static int
17328test_xmlRelaxNGNewValidCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017329 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017330
17331
17332 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000017333 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017334}
17335
17336
17337static int
17338test_xmlRelaxNGParse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017339 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017340
17341
17342 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000017343 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017344}
17345
17346
17347static int
17348test_xmlRelaxNGSetParserErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017349 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017350
17351
17352 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000017353 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017354}
17355
17356
17357static int
17358test_xmlRelaxNGSetValidErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017359 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017360
17361
17362 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000017363 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017364}
17365
17366
17367static int
17368test_xmlRelaxNGValidateDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017369 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017370
Daniel Veillardce682bc2004-11-05 17:22:25 +000017371#ifdef LIBXML_SCHEMAS_ENABLED
17372 int mem_base;
17373 int ret_val;
17374 xmlRelaxNGValidCtxtPtr ctxt; /* a Relax-NG validation context */
17375 int n_ctxt;
17376 xmlDocPtr doc; /* a parsed document tree */
17377 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017378
Daniel Veillardce682bc2004-11-05 17:22:25 +000017379 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
17380 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
17381 mem_base = xmlMemBlocks();
17382 ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
17383 doc = gen_xmlDocPtr(n_doc, 1);
17384
17385 ret_val = xmlRelaxNGValidateDoc(ctxt, doc);
17386 desret_int(ret_val);
17387 call_tests++;
17388 des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
17389 des_xmlDocPtr(n_doc, doc, 1);
17390 xmlResetLastError();
17391 if (mem_base != xmlMemBlocks()) {
17392 printf("Leak of %d blocks found in xmlRelaxNGValidateDoc",
17393 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017394 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017395 printf(" %d", n_ctxt);
17396 printf(" %d", n_doc);
17397 printf("\n");
17398 }
17399 }
17400 }
17401#endif
17402
17403 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017404 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017405}
17406
17407
17408static int
17409test_xmlRelaxNGValidateFullElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017410 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017411
Daniel Veillardce682bc2004-11-05 17:22:25 +000017412#ifdef LIBXML_SCHEMAS_ENABLED
17413 int mem_base;
17414 int ret_val;
17415 xmlRelaxNGValidCtxtPtr ctxt; /* the validation context */
17416 int n_ctxt;
17417 xmlDocPtr doc; /* a document instance */
17418 int n_doc;
17419 xmlNodePtr elem; /* an element instance */
17420 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017421
Daniel Veillardce682bc2004-11-05 17:22:25 +000017422 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
17423 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
17424 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
17425 mem_base = xmlMemBlocks();
17426 ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
17427 doc = gen_xmlDocPtr(n_doc, 1);
17428 elem = gen_xmlNodePtr(n_elem, 2);
17429
17430 ret_val = xmlRelaxNGValidateFullElement(ctxt, doc, elem);
17431 desret_int(ret_val);
17432 call_tests++;
17433 des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
17434 des_xmlDocPtr(n_doc, doc, 1);
17435 des_xmlNodePtr(n_elem, elem, 2);
17436 xmlResetLastError();
17437 if (mem_base != xmlMemBlocks()) {
17438 printf("Leak of %d blocks found in xmlRelaxNGValidateFullElement",
17439 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017440 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017441 printf(" %d", n_ctxt);
17442 printf(" %d", n_doc);
17443 printf(" %d", n_elem);
17444 printf("\n");
17445 }
17446 }
17447 }
17448 }
17449#endif
17450
17451 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017452 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017453}
17454
17455
17456static int
17457test_xmlRelaxNGValidatePopElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017458 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017459
Daniel Veillardce682bc2004-11-05 17:22:25 +000017460#ifdef LIBXML_SCHEMAS_ENABLED
17461 int mem_base;
17462 int ret_val;
17463 xmlRelaxNGValidCtxtPtr ctxt; /* the RelaxNG validation context */
17464 int n_ctxt;
17465 xmlDocPtr doc; /* a document instance */
17466 int n_doc;
17467 xmlNodePtr elem; /* an element instance */
17468 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017469
Daniel Veillardce682bc2004-11-05 17:22:25 +000017470 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
17471 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
17472 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
17473 mem_base = xmlMemBlocks();
17474 ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
17475 doc = gen_xmlDocPtr(n_doc, 1);
17476 elem = gen_xmlNodePtr(n_elem, 2);
17477
17478 ret_val = xmlRelaxNGValidatePopElement(ctxt, doc, elem);
17479 desret_int(ret_val);
17480 call_tests++;
17481 des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
17482 des_xmlDocPtr(n_doc, doc, 1);
17483 des_xmlNodePtr(n_elem, elem, 2);
17484 xmlResetLastError();
17485 if (mem_base != xmlMemBlocks()) {
17486 printf("Leak of %d blocks found in xmlRelaxNGValidatePopElement",
17487 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017488 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017489 printf(" %d", n_ctxt);
17490 printf(" %d", n_doc);
17491 printf(" %d", n_elem);
17492 printf("\n");
17493 }
17494 }
17495 }
17496 }
17497#endif
17498
17499 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017500 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017501}
17502
17503
17504static int
17505test_xmlRelaxNGValidatePushCData(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017506 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017507
Daniel Veillardce682bc2004-11-05 17:22:25 +000017508#ifdef LIBXML_SCHEMAS_ENABLED
17509 int mem_base;
17510 int ret_val;
17511 xmlRelaxNGValidCtxtPtr ctxt; /* the RelaxNG validation context */
17512 int n_ctxt;
17513 xmlChar * data; /* some character data read */
17514 int n_data;
17515 int len; /* the lenght of the data */
17516 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017517
Daniel Veillardce682bc2004-11-05 17:22:25 +000017518 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
17519 for (n_data = 0;n_data < gen_nb_const_xmlChar_ptr;n_data++) {
17520 for (n_len = 0;n_len < gen_nb_int;n_len++) {
17521 mem_base = xmlMemBlocks();
17522 ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
17523 data = gen_const_xmlChar_ptr(n_data, 1);
17524 len = gen_int(n_len, 2);
17525
17526 ret_val = xmlRelaxNGValidatePushCData(ctxt, data, len);
17527 desret_int(ret_val);
17528 call_tests++;
17529 des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
17530 des_const_xmlChar_ptr(n_data, data, 1);
17531 des_int(n_len, len, 2);
17532 xmlResetLastError();
17533 if (mem_base != xmlMemBlocks()) {
17534 printf("Leak of %d blocks found in xmlRelaxNGValidatePushCData",
17535 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017536 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017537 printf(" %d", n_ctxt);
17538 printf(" %d", n_data);
17539 printf(" %d", n_len);
17540 printf("\n");
17541 }
17542 }
17543 }
17544 }
17545#endif
17546
17547 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017548 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017549}
17550
17551
17552static int
17553test_xmlRelaxNGValidatePushElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017554 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017555
Daniel Veillardce682bc2004-11-05 17:22:25 +000017556#ifdef LIBXML_SCHEMAS_ENABLED
17557 int mem_base;
17558 int ret_val;
17559 xmlRelaxNGValidCtxtPtr ctxt; /* the validation context */
17560 int n_ctxt;
17561 xmlDocPtr doc; /* a document instance */
17562 int n_doc;
17563 xmlNodePtr elem; /* an element instance */
17564 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017565
Daniel Veillardce682bc2004-11-05 17:22:25 +000017566 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
17567 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
17568 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
17569 mem_base = xmlMemBlocks();
17570 ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
17571 doc = gen_xmlDocPtr(n_doc, 1);
17572 elem = gen_xmlNodePtr(n_elem, 2);
17573
17574 ret_val = xmlRelaxNGValidatePushElement(ctxt, doc, elem);
17575 desret_int(ret_val);
17576 call_tests++;
17577 des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
17578 des_xmlDocPtr(n_doc, doc, 1);
17579 des_xmlNodePtr(n_elem, elem, 2);
17580 xmlResetLastError();
17581 if (mem_base != xmlMemBlocks()) {
17582 printf("Leak of %d blocks found in xmlRelaxNGValidatePushElement",
17583 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017584 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017585 printf(" %d", n_ctxt);
17586 printf(" %d", n_doc);
17587 printf(" %d", n_elem);
17588 printf("\n");
17589 }
17590 }
17591 }
17592 }
17593#endif
17594
17595 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017596 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017597}
17598
17599
17600static int
17601test_xmlRelaxParserSetFlag(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017602 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017603
Daniel Veillardce682bc2004-11-05 17:22:25 +000017604#ifdef LIBXML_SCHEMAS_ENABLED
17605 int mem_base;
17606 int ret_val;
17607 xmlRelaxNGParserCtxtPtr ctxt; /* a RelaxNG parser context */
17608 int n_ctxt;
17609 int flags; /* a set of flags values */
17610 int n_flags;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017611
Daniel Veillardce682bc2004-11-05 17:22:25 +000017612 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGParserCtxtPtr;n_ctxt++) {
17613 for (n_flags = 0;n_flags < gen_nb_int;n_flags++) {
17614 mem_base = xmlMemBlocks();
17615 ctxt = gen_xmlRelaxNGParserCtxtPtr(n_ctxt, 0);
17616 flags = gen_int(n_flags, 1);
17617
17618 ret_val = xmlRelaxParserSetFlag(ctxt, flags);
17619 desret_int(ret_val);
17620 call_tests++;
17621 des_xmlRelaxNGParserCtxtPtr(n_ctxt, ctxt, 0);
17622 des_int(n_flags, flags, 1);
17623 xmlResetLastError();
17624 if (mem_base != xmlMemBlocks()) {
17625 printf("Leak of %d blocks found in xmlRelaxParserSetFlag",
17626 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017627 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017628 printf(" %d", n_ctxt);
17629 printf(" %d", n_flags);
17630 printf("\n");
17631 }
17632 }
17633 }
17634#endif
17635
17636 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017637 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017638}
17639
17640static int
17641test_relaxng(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017642 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017643
Daniel Veillard42595322004-11-08 10:52:06 +000017644 printf("Testing relaxng : 14 of 22 functions ...\n");
17645 test_ret += test_xmlRelaxNGDump();
17646 test_ret += test_xmlRelaxNGDumpTree();
17647 test_ret += test_xmlRelaxNGGetParserErrors();
17648 test_ret += test_xmlRelaxNGGetValidErrors();
17649 test_ret += test_xmlRelaxNGInitTypes();
17650 test_ret += test_xmlRelaxNGNewDocParserCtxt();
17651 test_ret += test_xmlRelaxNGNewMemParserCtxt();
17652 test_ret += test_xmlRelaxNGNewParserCtxt();
17653 test_ret += test_xmlRelaxNGNewValidCtxt();
17654 test_ret += test_xmlRelaxNGParse();
17655 test_ret += test_xmlRelaxNGSetParserErrors();
17656 test_ret += test_xmlRelaxNGSetValidErrors();
17657 test_ret += test_xmlRelaxNGValidateDoc();
17658 test_ret += test_xmlRelaxNGValidateFullElement();
17659 test_ret += test_xmlRelaxNGValidatePopElement();
17660 test_ret += test_xmlRelaxNGValidatePushCData();
17661 test_ret += test_xmlRelaxNGValidatePushElement();
17662 test_ret += test_xmlRelaxParserSetFlag();
Daniel Veillardd93f6252004-11-02 15:53:51 +000017663
Daniel Veillard42595322004-11-08 10:52:06 +000017664 if (test_ret != 0)
17665 printf("Module relaxng: %d errors\n", test_ret);
17666 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017667}
17668static int
17669test_schemasInternals(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017670 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017671
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000017672 printf("Testing schemasInternals : 0 of 2 functions ...\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017673
Daniel Veillard42595322004-11-08 10:52:06 +000017674 if (test_ret != 0)
17675 printf("Module schemasInternals: %d errors\n", test_ret);
17676 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017677}
17678
17679static int
17680test_xmlAddChild(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017681 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017682
17683 int mem_base;
17684 xmlNodePtr ret_val;
17685 xmlNodePtr parent; /* the parent node */
17686 int n_parent;
17687 xmlNodePtr cur; /* the child node */
17688 int n_cur;
17689
Daniel Veillarda03e3652004-11-02 18:45:30 +000017690 for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000017691 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr_in;n_cur++) {
17692 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017693 parent = gen_xmlNodePtr(n_parent, 0);
17694 cur = gen_xmlNodePtr_in(n_cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017695
17696 ret_val = xmlAddChild(parent, cur);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000017697 if (ret_val == NULL) { xmlFreeNode(cur) ; cur = NULL ; }
Daniel Veillardd93f6252004-11-02 15:53:51 +000017698 desret_xmlNodePtr(ret_val);
17699 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017700 des_xmlNodePtr(n_parent, parent, 0);
17701 des_xmlNodePtr_in(n_cur, cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017702 xmlResetLastError();
17703 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017704 printf("Leak of %d blocks found in xmlAddChild",
Daniel Veillardd93f6252004-11-02 15:53:51 +000017705 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017706 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000017707 printf(" %d", n_parent);
17708 printf(" %d", n_cur);
17709 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017710 }
17711 }
17712 }
17713
Daniel Veillard3d97e662004-11-04 10:49:00 +000017714 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017715 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017716}
17717
17718
17719static int
17720test_xmlAddChildList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017721 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017722
17723 int mem_base;
17724 xmlNodePtr ret_val;
17725 xmlNodePtr parent; /* the parent node */
17726 int n_parent;
17727 xmlNodePtr cur; /* the first node in the list */
17728 int n_cur;
17729
Daniel Veillarda03e3652004-11-02 18:45:30 +000017730 for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000017731 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr_in;n_cur++) {
17732 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017733 parent = gen_xmlNodePtr(n_parent, 0);
17734 cur = gen_xmlNodePtr_in(n_cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017735
17736 ret_val = xmlAddChildList(parent, cur);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000017737 if (ret_val == NULL) { xmlFreeNodeList(cur) ; cur = NULL ; }
Daniel Veillardd93f6252004-11-02 15:53:51 +000017738 desret_xmlNodePtr(ret_val);
17739 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017740 des_xmlNodePtr(n_parent, parent, 0);
17741 des_xmlNodePtr_in(n_cur, cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017742 xmlResetLastError();
17743 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017744 printf("Leak of %d blocks found in xmlAddChildList",
Daniel Veillardd93f6252004-11-02 15:53:51 +000017745 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017746 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000017747 printf(" %d", n_parent);
17748 printf(" %d", n_cur);
17749 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017750 }
17751 }
17752 }
17753
Daniel Veillard3d97e662004-11-04 10:49:00 +000017754 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017755 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017756}
17757
17758
17759static int
17760test_xmlAddNextSibling(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017761 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017762
17763 int mem_base;
17764 xmlNodePtr ret_val;
17765 xmlNodePtr cur; /* the child node */
17766 int n_cur;
17767 xmlNodePtr elem; /* the new node */
17768 int n_elem;
17769
17770 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017771 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr_in;n_elem++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000017772 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017773 cur = gen_xmlNodePtr(n_cur, 0);
17774 elem = gen_xmlNodePtr_in(n_elem, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017775
17776 ret_val = xmlAddNextSibling(cur, elem);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000017777 if (ret_val == NULL) { xmlFreeNode(elem) ; elem = NULL ; }
Daniel Veillardd93f6252004-11-02 15:53:51 +000017778 desret_xmlNodePtr(ret_val);
17779 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017780 des_xmlNodePtr(n_cur, cur, 0);
17781 des_xmlNodePtr_in(n_elem, elem, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017782 xmlResetLastError();
17783 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017784 printf("Leak of %d blocks found in xmlAddNextSibling",
Daniel Veillardd93f6252004-11-02 15:53:51 +000017785 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017786 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000017787 printf(" %d", n_cur);
17788 printf(" %d", n_elem);
17789 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017790 }
17791 }
17792 }
17793
Daniel Veillard3d97e662004-11-04 10:49:00 +000017794 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017795 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017796}
17797
17798
17799static int
17800test_xmlAddPrevSibling(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017801 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017802
17803#ifdef LIBXML_TREE_ENABLED
17804 int mem_base;
17805 xmlNodePtr ret_val;
17806 xmlNodePtr cur; /* the child node */
17807 int n_cur;
17808 xmlNodePtr elem; /* the new node */
17809 int n_elem;
17810
17811 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017812 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr_in;n_elem++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000017813 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017814 cur = gen_xmlNodePtr(n_cur, 0);
17815 elem = gen_xmlNodePtr_in(n_elem, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017816
17817 ret_val = xmlAddPrevSibling(cur, elem);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000017818 if (ret_val == NULL) { xmlFreeNode(elem) ; elem = NULL ; }
Daniel Veillardd93f6252004-11-02 15:53:51 +000017819 desret_xmlNodePtr(ret_val);
17820 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017821 des_xmlNodePtr(n_cur, cur, 0);
17822 des_xmlNodePtr_in(n_elem, elem, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017823 xmlResetLastError();
17824 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017825 printf("Leak of %d blocks found in xmlAddPrevSibling",
Daniel Veillardd93f6252004-11-02 15:53:51 +000017826 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017827 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000017828 printf(" %d", n_cur);
17829 printf(" %d", n_elem);
17830 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017831 }
17832 }
17833 }
17834#endif
17835
Daniel Veillard3d97e662004-11-04 10:49:00 +000017836 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017837 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017838}
17839
17840
17841static int
17842test_xmlAddSibling(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017843 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017844
17845 int mem_base;
17846 xmlNodePtr ret_val;
17847 xmlNodePtr cur; /* the child node */
17848 int n_cur;
17849 xmlNodePtr elem; /* the new node */
17850 int n_elem;
17851
17852 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017853 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr_in;n_elem++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000017854 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017855 cur = gen_xmlNodePtr(n_cur, 0);
17856 elem = gen_xmlNodePtr_in(n_elem, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017857
17858 ret_val = xmlAddSibling(cur, elem);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000017859 if (ret_val == NULL) { xmlFreeNode(elem) ; elem = NULL ; }
Daniel Veillardd93f6252004-11-02 15:53:51 +000017860 desret_xmlNodePtr(ret_val);
17861 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017862 des_xmlNodePtr(n_cur, cur, 0);
17863 des_xmlNodePtr_in(n_elem, elem, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017864 xmlResetLastError();
17865 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017866 printf("Leak of %d blocks found in xmlAddSibling",
Daniel Veillardd93f6252004-11-02 15:53:51 +000017867 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017868 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000017869 printf(" %d", n_cur);
17870 printf(" %d", n_elem);
17871 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017872 }
17873 }
17874 }
17875
Daniel Veillard3d97e662004-11-04 10:49:00 +000017876 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017877 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017878}
17879
17880
17881static int
17882test_xmlAttrSerializeTxtContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017883 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017884
Daniel Veillarda521d282004-11-09 14:59:59 +000017885#ifdef LIBXML_OUTPUT_ENABLED
Daniel Veillardce244ad2004-11-05 10:03:46 +000017886 int mem_base;
17887 xmlBufferPtr buf; /* the XML buffer output */
17888 int n_buf;
17889 xmlDocPtr doc; /* the document */
17890 int n_doc;
17891 xmlAttrPtr attr; /* the attribute node */
17892 int n_attr;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017893 xmlChar * string; /* the text content */
Daniel Veillardce244ad2004-11-05 10:03:46 +000017894 int n_string;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017895
Daniel Veillardce244ad2004-11-05 10:03:46 +000017896 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
17897 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
17898 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
17899 for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) {
17900 mem_base = xmlMemBlocks();
17901 buf = gen_xmlBufferPtr(n_buf, 0);
17902 doc = gen_xmlDocPtr(n_doc, 1);
17903 attr = gen_xmlAttrPtr(n_attr, 2);
17904 string = gen_const_xmlChar_ptr(n_string, 3);
17905
17906 xmlAttrSerializeTxtContent(buf, doc, attr, string);
17907 call_tests++;
17908 des_xmlBufferPtr(n_buf, buf, 0);
17909 des_xmlDocPtr(n_doc, doc, 1);
17910 des_xmlAttrPtr(n_attr, attr, 2);
17911 des_const_xmlChar_ptr(n_string, string, 3);
17912 xmlResetLastError();
17913 if (mem_base != xmlMemBlocks()) {
17914 printf("Leak of %d blocks found in xmlAttrSerializeTxtContent",
17915 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017916 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000017917 printf(" %d", n_buf);
17918 printf(" %d", n_doc);
17919 printf(" %d", n_attr);
17920 printf(" %d", n_string);
17921 printf("\n");
17922 }
17923 }
17924 }
17925 }
17926 }
Daniel Veillarda521d282004-11-09 14:59:59 +000017927#endif
Daniel Veillardce244ad2004-11-05 10:03:46 +000017928
17929 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017930 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017931}
17932
17933
17934static int
17935test_xmlBufferAdd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017936 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017937
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017938 int mem_base;
17939 int ret_val;
17940 xmlBufferPtr buf; /* the buffer to dump */
17941 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017942 xmlChar * str; /* the #xmlChar string */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017943 int n_str;
17944 int len; /* the number of #xmlChar to add */
17945 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017946
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017947 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
17948 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
17949 for (n_len = 0;n_len < gen_nb_int;n_len++) {
17950 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017951 buf = gen_xmlBufferPtr(n_buf, 0);
17952 str = gen_const_xmlChar_ptr(n_str, 1);
17953 len = gen_int(n_len, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017954
17955 ret_val = xmlBufferAdd(buf, str, len);
17956 desret_int(ret_val);
17957 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017958 des_xmlBufferPtr(n_buf, buf, 0);
17959 des_const_xmlChar_ptr(n_str, str, 1);
17960 des_int(n_len, len, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017961 xmlResetLastError();
17962 if (mem_base != xmlMemBlocks()) {
17963 printf("Leak of %d blocks found in xmlBufferAdd",
17964 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017965 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017966 printf(" %d", n_buf);
17967 printf(" %d", n_str);
17968 printf(" %d", n_len);
17969 printf("\n");
17970 }
17971 }
17972 }
17973 }
17974
Daniel Veillard3d97e662004-11-04 10:49:00 +000017975 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017976 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017977}
17978
17979
17980static int
17981test_xmlBufferAddHead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017982 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017983
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017984 int mem_base;
17985 int ret_val;
17986 xmlBufferPtr buf; /* the buffer */
17987 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017988 xmlChar * str; /* the #xmlChar string */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017989 int n_str;
17990 int len; /* the number of #xmlChar to add */
17991 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017992
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017993 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
17994 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
17995 for (n_len = 0;n_len < gen_nb_int;n_len++) {
17996 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017997 buf = gen_xmlBufferPtr(n_buf, 0);
17998 str = gen_const_xmlChar_ptr(n_str, 1);
17999 len = gen_int(n_len, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018000
18001 ret_val = xmlBufferAddHead(buf, str, len);
18002 desret_int(ret_val);
18003 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018004 des_xmlBufferPtr(n_buf, buf, 0);
18005 des_const_xmlChar_ptr(n_str, str, 1);
18006 des_int(n_len, len, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018007 xmlResetLastError();
18008 if (mem_base != xmlMemBlocks()) {
18009 printf("Leak of %d blocks found in xmlBufferAddHead",
18010 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018011 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018012 printf(" %d", n_buf);
18013 printf(" %d", n_str);
18014 printf(" %d", n_len);
18015 printf("\n");
18016 }
18017 }
18018 }
18019 }
18020
Daniel Veillard3d97e662004-11-04 10:49:00 +000018021 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000018022 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018023}
18024
18025
18026static int
18027test_xmlBufferCCat(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018028 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018029
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018030 int mem_base;
18031 int ret_val;
18032 xmlBufferPtr buf; /* the buffer to dump */
18033 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018034 char * str; /* the C char string */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018035 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018036
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018037 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18038 for (n_str = 0;n_str < gen_nb_const_char_ptr;n_str++) {
18039 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018040 buf = gen_xmlBufferPtr(n_buf, 0);
18041 str = gen_const_char_ptr(n_str, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018042
18043 ret_val = xmlBufferCCat(buf, str);
18044 desret_int(ret_val);
18045 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018046 des_xmlBufferPtr(n_buf, buf, 0);
18047 des_const_char_ptr(n_str, str, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018048 xmlResetLastError();
18049 if (mem_base != xmlMemBlocks()) {
18050 printf("Leak of %d blocks found in xmlBufferCCat",
18051 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018052 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018053 printf(" %d", n_buf);
18054 printf(" %d", n_str);
18055 printf("\n");
18056 }
18057 }
18058 }
18059
Daniel Veillard3d97e662004-11-04 10:49:00 +000018060 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000018061 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018062}
18063
18064
18065static int
18066test_xmlBufferCat(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018067 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018068
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018069 int mem_base;
18070 int ret_val;
18071 xmlBufferPtr buf; /* the buffer to add to */
18072 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018073 xmlChar * str; /* the #xmlChar string */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018074 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018075
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018076 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18077 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
18078 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018079 buf = gen_xmlBufferPtr(n_buf, 0);
18080 str = gen_const_xmlChar_ptr(n_str, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018081
18082 ret_val = xmlBufferCat(buf, str);
18083 desret_int(ret_val);
18084 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018085 des_xmlBufferPtr(n_buf, buf, 0);
18086 des_const_xmlChar_ptr(n_str, str, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018087 xmlResetLastError();
18088 if (mem_base != xmlMemBlocks()) {
18089 printf("Leak of %d blocks found in xmlBufferCat",
18090 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018091 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018092 printf(" %d", n_buf);
18093 printf(" %d", n_str);
18094 printf("\n");
18095 }
18096 }
18097 }
18098
Daniel Veillard3d97e662004-11-04 10:49:00 +000018099 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000018100 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018101}
18102
18103
Daniel Veillardce682bc2004-11-05 17:22:25 +000018104#define gen_nb_const_xmlBufferPtr 1
18105static xmlBufferPtr gen_const_xmlBufferPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
18106 return(NULL);
18107}
18108static void des_const_xmlBufferPtr(int no ATTRIBUTE_UNUSED, const xmlBufferPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
18109}
18110
Daniel Veillardd93f6252004-11-02 15:53:51 +000018111static int
18112test_xmlBufferContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018113 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018114
Daniel Veillardce682bc2004-11-05 17:22:25 +000018115 int mem_base;
18116 const xmlChar * ret_val;
18117 xmlBufferPtr buf; /* the buffer */
18118 int n_buf;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018119
Daniel Veillardce682bc2004-11-05 17:22:25 +000018120 for (n_buf = 0;n_buf < gen_nb_const_xmlBufferPtr;n_buf++) {
18121 mem_base = xmlMemBlocks();
18122 buf = gen_const_xmlBufferPtr(n_buf, 0);
18123
18124 ret_val = xmlBufferContent(buf);
18125 desret_const_xmlChar_ptr(ret_val);
18126 call_tests++;
18127 des_const_xmlBufferPtr(n_buf, buf, 0);
18128 xmlResetLastError();
18129 if (mem_base != xmlMemBlocks()) {
18130 printf("Leak of %d blocks found in xmlBufferContent",
18131 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018132 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018133 printf(" %d", n_buf);
18134 printf("\n");
18135 }
18136 }
18137
18138 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000018139 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018140}
18141
18142
18143static int
18144test_xmlBufferCreate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018145 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018146
Daniel Veillard3d95c732004-11-06 22:25:14 +000018147 int mem_base;
18148 xmlBufferPtr ret_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018149
Daniel Veillard3d95c732004-11-06 22:25:14 +000018150 mem_base = xmlMemBlocks();
18151
18152 ret_val = xmlBufferCreate();
18153 desret_xmlBufferPtr(ret_val);
18154 call_tests++;
18155 xmlResetLastError();
18156 if (mem_base != xmlMemBlocks()) {
18157 printf("Leak of %d blocks found in xmlBufferCreate",
18158 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018159 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000018160 printf("\n");
18161 }
18162
18163 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000018164 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018165}
18166
18167
18168static int
18169test_xmlBufferCreateSize(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018170 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018171
18172
18173 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000018174 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018175}
18176
18177
18178static int
18179test_xmlBufferCreateStatic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018180 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018181
18182
18183 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000018184 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018185}
18186
18187
18188static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000018189test_xmlBufferEmpty(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018190 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018191
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018192 int mem_base;
18193 xmlBufferPtr buf; /* the buffer */
18194 int n_buf;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018195
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018196 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18197 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018198 buf = gen_xmlBufferPtr(n_buf, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018199
18200 xmlBufferEmpty(buf);
18201 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018202 des_xmlBufferPtr(n_buf, buf, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018203 xmlResetLastError();
18204 if (mem_base != xmlMemBlocks()) {
18205 printf("Leak of %d blocks found in xmlBufferEmpty",
18206 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018207 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018208 printf(" %d", n_buf);
18209 printf("\n");
18210 }
18211 }
18212
Daniel Veillard3d97e662004-11-04 10:49:00 +000018213 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000018214 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018215}
18216
18217
18218static int
18219test_xmlBufferGrow(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018220 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018221
Daniel Veillard3d97e662004-11-04 10:49:00 +000018222 int mem_base;
18223 int ret_val;
18224 xmlBufferPtr buf; /* the buffer */
18225 int n_buf;
18226 unsigned int len; /* the minimum free size to allocate */
18227 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018228
Daniel Veillard3d97e662004-11-04 10:49:00 +000018229 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18230 for (n_len = 0;n_len < gen_nb_unsigned_int;n_len++) {
18231 mem_base = xmlMemBlocks();
18232 buf = gen_xmlBufferPtr(n_buf, 0);
18233 len = gen_unsigned_int(n_len, 1);
18234
18235 ret_val = xmlBufferGrow(buf, len);
18236 desret_int(ret_val);
18237 call_tests++;
18238 des_xmlBufferPtr(n_buf, buf, 0);
18239 des_unsigned_int(n_len, len, 1);
18240 xmlResetLastError();
18241 if (mem_base != xmlMemBlocks()) {
18242 printf("Leak of %d blocks found in xmlBufferGrow",
18243 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018244 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018245 printf(" %d", n_buf);
18246 printf(" %d", n_len);
18247 printf("\n");
18248 }
18249 }
18250 }
18251
18252 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000018253 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018254}
18255
18256
18257static int
18258test_xmlBufferLength(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018259 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018260
Daniel Veillardce682bc2004-11-05 17:22:25 +000018261 int mem_base;
18262 int ret_val;
18263 xmlBufferPtr buf; /* the buffer */
18264 int n_buf;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018265
Daniel Veillardce682bc2004-11-05 17:22:25 +000018266 for (n_buf = 0;n_buf < gen_nb_const_xmlBufferPtr;n_buf++) {
18267 mem_base = xmlMemBlocks();
18268 buf = gen_const_xmlBufferPtr(n_buf, 0);
18269
18270 ret_val = xmlBufferLength(buf);
18271 desret_int(ret_val);
18272 call_tests++;
18273 des_const_xmlBufferPtr(n_buf, buf, 0);
18274 xmlResetLastError();
18275 if (mem_base != xmlMemBlocks()) {
18276 printf("Leak of %d blocks found in xmlBufferLength",
18277 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018278 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018279 printf(" %d", n_buf);
18280 printf("\n");
18281 }
18282 }
18283
18284 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000018285 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018286}
18287
18288
18289static int
18290test_xmlBufferResize(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018291 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018292
Daniel Veillard3d97e662004-11-04 10:49:00 +000018293 int mem_base;
18294 int ret_val;
18295 xmlBufferPtr buf; /* the buffer to resize */
18296 int n_buf;
18297 unsigned int size; /* the desired size */
18298 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018299
Daniel Veillard3d97e662004-11-04 10:49:00 +000018300 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18301 for (n_size = 0;n_size < gen_nb_unsigned_int;n_size++) {
18302 mem_base = xmlMemBlocks();
18303 buf = gen_xmlBufferPtr(n_buf, 0);
18304 size = gen_unsigned_int(n_size, 1);
18305
18306 ret_val = xmlBufferResize(buf, size);
18307 desret_int(ret_val);
18308 call_tests++;
18309 des_xmlBufferPtr(n_buf, buf, 0);
18310 des_unsigned_int(n_size, size, 1);
18311 xmlResetLastError();
18312 if (mem_base != xmlMemBlocks()) {
18313 printf("Leak of %d blocks found in xmlBufferResize",
18314 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018315 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018316 printf(" %d", n_buf);
18317 printf(" %d", n_size);
18318 printf("\n");
18319 }
18320 }
18321 }
18322
18323 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000018324 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018325}
18326
18327
18328static int
18329test_xmlBufferSetAllocationScheme(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018330 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018331
Daniel Veillard57b25162004-11-06 14:50:18 +000018332 int mem_base;
18333 xmlBufferPtr buf; /* the buffer to tune */
18334 int n_buf;
18335 xmlBufferAllocationScheme scheme; /* allocation scheme to use */
18336 int n_scheme;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018337
Daniel Veillard57b25162004-11-06 14:50:18 +000018338 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18339 for (n_scheme = 0;n_scheme < gen_nb_xmlBufferAllocationScheme;n_scheme++) {
18340 mem_base = xmlMemBlocks();
18341 buf = gen_xmlBufferPtr(n_buf, 0);
18342 scheme = gen_xmlBufferAllocationScheme(n_scheme, 1);
18343
18344 xmlBufferSetAllocationScheme(buf, scheme);
18345 call_tests++;
18346 des_xmlBufferPtr(n_buf, buf, 0);
18347 des_xmlBufferAllocationScheme(n_scheme, scheme, 1);
18348 xmlResetLastError();
18349 if (mem_base != xmlMemBlocks()) {
18350 printf("Leak of %d blocks found in xmlBufferSetAllocationScheme",
18351 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018352 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000018353 printf(" %d", n_buf);
18354 printf(" %d", n_scheme);
18355 printf("\n");
18356 }
18357 }
18358 }
18359
18360 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000018361 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018362}
18363
18364
18365static int
18366test_xmlBufferShrink(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018367 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018368
Daniel Veillard3d97e662004-11-04 10:49:00 +000018369 int mem_base;
18370 int ret_val;
18371 xmlBufferPtr buf; /* the buffer to dump */
18372 int n_buf;
18373 unsigned int len; /* the number of xmlChar to remove */
18374 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018375
Daniel Veillard3d97e662004-11-04 10:49:00 +000018376 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18377 for (n_len = 0;n_len < gen_nb_unsigned_int;n_len++) {
18378 mem_base = xmlMemBlocks();
18379 buf = gen_xmlBufferPtr(n_buf, 0);
18380 len = gen_unsigned_int(n_len, 1);
18381
18382 ret_val = xmlBufferShrink(buf, len);
18383 desret_int(ret_val);
18384 call_tests++;
18385 des_xmlBufferPtr(n_buf, buf, 0);
18386 des_unsigned_int(n_len, len, 1);
18387 xmlResetLastError();
18388 if (mem_base != xmlMemBlocks()) {
18389 printf("Leak of %d blocks found in xmlBufferShrink",
18390 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018391 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018392 printf(" %d", n_buf);
18393 printf(" %d", n_len);
18394 printf("\n");
18395 }
18396 }
18397 }
18398
18399 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000018400 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018401}
18402
18403
18404static int
18405test_xmlBufferWriteCHAR(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018406 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018407
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018408 int mem_base;
18409 xmlBufferPtr buf; /* the XML buffer */
18410 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018411 xmlChar * string; /* the string to add */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018412 int n_string;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018413
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018414 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18415 for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) {
18416 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018417 buf = gen_xmlBufferPtr(n_buf, 0);
18418 string = gen_const_xmlChar_ptr(n_string, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018419
18420 xmlBufferWriteCHAR(buf, string);
18421 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018422 des_xmlBufferPtr(n_buf, buf, 0);
18423 des_const_xmlChar_ptr(n_string, string, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018424 xmlResetLastError();
18425 if (mem_base != xmlMemBlocks()) {
18426 printf("Leak of %d blocks found in xmlBufferWriteCHAR",
18427 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018428 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018429 printf(" %d", n_buf);
18430 printf(" %d", n_string);
18431 printf("\n");
18432 }
18433 }
18434 }
18435
Daniel Veillard3d97e662004-11-04 10:49:00 +000018436 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000018437 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018438}
18439
18440
18441static int
18442test_xmlBufferWriteChar(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018443 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018444
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018445 int mem_base;
18446 xmlBufferPtr buf; /* the XML buffer output */
18447 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018448 char * string; /* the string to add */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018449 int n_string;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018450
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018451 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18452 for (n_string = 0;n_string < gen_nb_const_char_ptr;n_string++) {
18453 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018454 buf = gen_xmlBufferPtr(n_buf, 0);
18455 string = gen_const_char_ptr(n_string, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018456
18457 xmlBufferWriteChar(buf, string);
18458 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018459 des_xmlBufferPtr(n_buf, buf, 0);
18460 des_const_char_ptr(n_string, string, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018461 xmlResetLastError();
18462 if (mem_base != xmlMemBlocks()) {
18463 printf("Leak of %d blocks found in xmlBufferWriteChar",
18464 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018465 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018466 printf(" %d", n_buf);
18467 printf(" %d", n_string);
18468 printf("\n");
18469 }
18470 }
18471 }
18472
Daniel Veillard3d97e662004-11-04 10:49:00 +000018473 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000018474 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018475}
18476
18477
18478static int
18479test_xmlBufferWriteQuotedString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018480 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018481
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018482 int mem_base;
18483 xmlBufferPtr buf; /* the XML buffer output */
18484 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018485 xmlChar * string; /* the string to add */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018486 int n_string;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018487
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018488 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18489 for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) {
18490 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018491 buf = gen_xmlBufferPtr(n_buf, 0);
18492 string = gen_const_xmlChar_ptr(n_string, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018493
18494 xmlBufferWriteQuotedString(buf, string);
18495 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018496 des_xmlBufferPtr(n_buf, buf, 0);
18497 des_const_xmlChar_ptr(n_string, string, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018498 xmlResetLastError();
18499 if (mem_base != xmlMemBlocks()) {
18500 printf("Leak of %d blocks found in xmlBufferWriteQuotedString",
18501 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018502 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018503 printf(" %d", n_buf);
18504 printf(" %d", n_string);
18505 printf("\n");
18506 }
18507 }
18508 }
18509
Daniel Veillard3d97e662004-11-04 10:49:00 +000018510 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000018511 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018512}
18513
18514
18515static int
18516test_xmlBuildQName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018517 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018518
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018519 int mem_base;
18520 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018521 xmlChar * ncname; /* the Name */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018522 int n_ncname;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018523 xmlChar * prefix; /* the prefix */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018524 int n_prefix;
18525 xmlChar * memory; /* preallocated memory */
18526 int n_memory;
18527 int len; /* preallocated memory length */
18528 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018529
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018530 for (n_ncname = 0;n_ncname < gen_nb_const_xmlChar_ptr;n_ncname++) {
18531 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
18532 for (n_memory = 0;n_memory < gen_nb_xmlChar_ptr;n_memory++) {
18533 for (n_len = 0;n_len < gen_nb_int;n_len++) {
18534 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018535 ncname = gen_const_xmlChar_ptr(n_ncname, 0);
18536 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
18537 memory = gen_xmlChar_ptr(n_memory, 2);
18538 len = gen_int(n_len, 3);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018539
18540 ret_val = xmlBuildQName(ncname, prefix, memory, len);
18541 if ((ret_val != NULL) && (ret_val != ncname) &&
18542 (ret_val != prefix) && (ret_val != memory))
18543 xmlFree(ret_val);
18544 ret_val = NULL;
18545 desret_xmlChar_ptr(ret_val);
18546 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018547 des_const_xmlChar_ptr(n_ncname, ncname, 0);
18548 des_const_xmlChar_ptr(n_prefix, prefix, 1);
18549 des_xmlChar_ptr(n_memory, memory, 2);
18550 des_int(n_len, len, 3);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018551 xmlResetLastError();
18552 if (mem_base != xmlMemBlocks()) {
18553 printf("Leak of %d blocks found in xmlBuildQName",
18554 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018555 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018556 printf(" %d", n_ncname);
18557 printf(" %d", n_prefix);
18558 printf(" %d", n_memory);
18559 printf(" %d", n_len);
18560 printf("\n");
18561 }
18562 }
18563 }
18564 }
18565 }
18566
Daniel Veillard3d97e662004-11-04 10:49:00 +000018567 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000018568 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018569}
18570
18571
18572static int
18573test_xmlCopyDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018574 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018575
18576#ifdef LIBXML_TREE_ENABLED
18577 int mem_base;
18578 xmlDocPtr ret_val;
18579 xmlDocPtr doc; /* the document */
18580 int n_doc;
18581 int recursive; /* if not zero do a recursive copy. */
18582 int n_recursive;
18583
18584 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
18585 for (n_recursive = 0;n_recursive < gen_nb_int;n_recursive++) {
18586 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018587 doc = gen_xmlDocPtr(n_doc, 0);
18588 recursive = gen_int(n_recursive, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018589
18590 ret_val = xmlCopyDoc(doc, recursive);
18591 desret_xmlDocPtr(ret_val);
18592 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018593 des_xmlDocPtr(n_doc, doc, 0);
18594 des_int(n_recursive, recursive, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018595 xmlResetLastError();
18596 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000018597 printf("Leak of %d blocks found in xmlCopyDoc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000018598 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018599 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000018600 printf(" %d", n_doc);
18601 printf(" %d", n_recursive);
18602 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000018603 }
18604 }
18605 }
18606#endif
18607
Daniel Veillard3d97e662004-11-04 10:49:00 +000018608 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000018609 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018610}
18611
18612
18613static int
18614test_xmlCopyDtd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018615 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018616
Daniel Veillard27f20102004-11-05 11:50:11 +000018617#ifdef LIBXML_TREE_ENABLED
18618 int mem_base;
18619 xmlDtdPtr ret_val;
18620 xmlDtdPtr dtd; /* the dtd */
18621 int n_dtd;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018622
Daniel Veillard27f20102004-11-05 11:50:11 +000018623 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
18624 mem_base = xmlMemBlocks();
18625 dtd = gen_xmlDtdPtr(n_dtd, 0);
18626
18627 ret_val = xmlCopyDtd(dtd);
18628 desret_xmlDtdPtr(ret_val);
18629 call_tests++;
18630 des_xmlDtdPtr(n_dtd, dtd, 0);
18631 xmlResetLastError();
18632 if (mem_base != xmlMemBlocks()) {
18633 printf("Leak of %d blocks found in xmlCopyDtd",
18634 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018635 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000018636 printf(" %d", n_dtd);
18637 printf("\n");
18638 }
18639 }
18640#endif
18641
18642 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000018643 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018644}
18645
18646
18647static int
18648test_xmlCopyNamespace(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018649 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018650
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018651 int mem_base;
18652 xmlNsPtr ret_val;
18653 xmlNsPtr cur; /* the namespace */
18654 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018655
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018656 for (n_cur = 0;n_cur < gen_nb_xmlNsPtr;n_cur++) {
18657 mem_base = xmlMemBlocks();
18658 cur = gen_xmlNsPtr(n_cur, 0);
18659
18660 ret_val = xmlCopyNamespace(cur);
18661 if (ret_val != NULL) xmlFreeNs(ret_val);
18662 desret_xmlNsPtr(ret_val);
18663 call_tests++;
18664 des_xmlNsPtr(n_cur, cur, 0);
18665 xmlResetLastError();
18666 if (mem_base != xmlMemBlocks()) {
18667 printf("Leak of %d blocks found in xmlCopyNamespace",
18668 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018669 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018670 printf(" %d", n_cur);
18671 printf("\n");
18672 }
18673 }
18674
18675 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000018676 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018677}
18678
18679
18680static int
18681test_xmlCopyNamespaceList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018682 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018683
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018684 int mem_base;
18685 xmlNsPtr ret_val;
18686 xmlNsPtr cur; /* the first namespace */
18687 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018688
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018689 for (n_cur = 0;n_cur < gen_nb_xmlNsPtr;n_cur++) {
18690 mem_base = xmlMemBlocks();
18691 cur = gen_xmlNsPtr(n_cur, 0);
18692
18693 ret_val = xmlCopyNamespaceList(cur);
18694 if (ret_val != NULL) xmlFreeNsList(ret_val);
18695 desret_xmlNsPtr(ret_val);
18696 call_tests++;
18697 des_xmlNsPtr(n_cur, cur, 0);
18698 xmlResetLastError();
18699 if (mem_base != xmlMemBlocks()) {
18700 printf("Leak of %d blocks found in xmlCopyNamespaceList",
18701 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018702 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018703 printf(" %d", n_cur);
18704 printf("\n");
18705 }
18706 }
18707
18708 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000018709 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018710}
18711
18712
18713static int
18714test_xmlCopyNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018715 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018716
Daniel Veillardce682bc2004-11-05 17:22:25 +000018717 int mem_base;
18718 xmlNodePtr ret_val;
18719 xmlNodePtr node; /* the node */
18720 int n_node;
18721 int extended; /* if 1 do a recursive copy (properties, namespaces and children when applicable) if 2 copy properties and namespaces (when applicable) */
18722 int n_extended;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018723
Daniel Veillardce682bc2004-11-05 17:22:25 +000018724 for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) {
18725 for (n_extended = 0;n_extended < gen_nb_int;n_extended++) {
18726 mem_base = xmlMemBlocks();
18727 node = gen_const_xmlNodePtr(n_node, 0);
18728 extended = gen_int(n_extended, 1);
18729
18730 ret_val = xmlCopyNode(node, extended);
18731 desret_xmlNodePtr(ret_val);
18732 call_tests++;
18733 des_const_xmlNodePtr(n_node, node, 0);
18734 des_int(n_extended, extended, 1);
18735 xmlResetLastError();
18736 if (mem_base != xmlMemBlocks()) {
18737 printf("Leak of %d blocks found in xmlCopyNode",
18738 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018739 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018740 printf(" %d", n_node);
18741 printf(" %d", n_extended);
18742 printf("\n");
18743 }
18744 }
18745 }
18746
18747 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000018748 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018749}
18750
18751
18752static int
18753test_xmlCopyNodeList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018754 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018755
Daniel Veillardce682bc2004-11-05 17:22:25 +000018756 int mem_base;
18757 xmlNodePtr ret_val;
18758 xmlNodePtr node; /* the first node in the list. */
18759 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018760
Daniel Veillardce682bc2004-11-05 17:22:25 +000018761 for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) {
18762 mem_base = xmlMemBlocks();
18763 node = gen_const_xmlNodePtr(n_node, 0);
18764
18765 ret_val = xmlCopyNodeList(node);
18766 desret_xmlNodePtr(ret_val);
18767 call_tests++;
18768 des_const_xmlNodePtr(n_node, node, 0);
18769 xmlResetLastError();
18770 if (mem_base != xmlMemBlocks()) {
18771 printf("Leak of %d blocks found in xmlCopyNodeList",
18772 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018773 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018774 printf(" %d", n_node);
18775 printf("\n");
18776 }
18777 }
18778
18779 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000018780 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018781}
18782
18783
18784static int
18785test_xmlCopyProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018786 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018787
Daniel Veillard57b25162004-11-06 14:50:18 +000018788 int mem_base;
18789 xmlAttrPtr ret_val;
18790 xmlNodePtr target; /* the element where the attribute will be grafted */
18791 int n_target;
18792 xmlAttrPtr cur; /* the attribute */
18793 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018794
Daniel Veillard57b25162004-11-06 14:50:18 +000018795 for (n_target = 0;n_target < gen_nb_xmlNodePtr;n_target++) {
18796 for (n_cur = 0;n_cur < gen_nb_xmlAttrPtr;n_cur++) {
18797 mem_base = xmlMemBlocks();
18798 target = gen_xmlNodePtr(n_target, 0);
18799 cur = gen_xmlAttrPtr(n_cur, 1);
18800
18801 ret_val = xmlCopyProp(target, cur);
18802 desret_xmlAttrPtr(ret_val);
18803 call_tests++;
18804 des_xmlNodePtr(n_target, target, 0);
18805 des_xmlAttrPtr(n_cur, cur, 1);
18806 xmlResetLastError();
18807 if (mem_base != xmlMemBlocks()) {
18808 printf("Leak of %d blocks found in xmlCopyProp",
18809 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018810 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000018811 printf(" %d", n_target);
18812 printf(" %d", n_cur);
18813 printf("\n");
18814 }
18815 }
18816 }
18817
18818 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000018819 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018820}
18821
18822
18823static int
18824test_xmlCopyPropList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018825 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018826
Daniel Veillard57b25162004-11-06 14:50:18 +000018827 int mem_base;
18828 xmlAttrPtr ret_val;
18829 xmlNodePtr target; /* the element where the attributes will be grafted */
18830 int n_target;
18831 xmlAttrPtr cur; /* the first attribute */
18832 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018833
Daniel Veillard57b25162004-11-06 14:50:18 +000018834 for (n_target = 0;n_target < gen_nb_xmlNodePtr;n_target++) {
18835 for (n_cur = 0;n_cur < gen_nb_xmlAttrPtr;n_cur++) {
18836 mem_base = xmlMemBlocks();
18837 target = gen_xmlNodePtr(n_target, 0);
18838 cur = gen_xmlAttrPtr(n_cur, 1);
18839
18840 ret_val = xmlCopyPropList(target, cur);
18841 desret_xmlAttrPtr(ret_val);
18842 call_tests++;
18843 des_xmlNodePtr(n_target, target, 0);
18844 des_xmlAttrPtr(n_cur, cur, 1);
18845 xmlResetLastError();
18846 if (mem_base != xmlMemBlocks()) {
18847 printf("Leak of %d blocks found in xmlCopyPropList",
18848 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018849 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000018850 printf(" %d", n_target);
18851 printf(" %d", n_cur);
18852 printf("\n");
18853 }
18854 }
18855 }
18856
18857 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000018858 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018859}
18860
18861
18862static int
18863test_xmlCreateIntSubset(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018864 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018865
Daniel Veillard34099b42004-11-04 17:34:35 +000018866 int mem_base;
18867 xmlDtdPtr ret_val;
18868 xmlDocPtr doc; /* the document pointer */
18869 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018870 xmlChar * name; /* the DTD name */
Daniel Veillard34099b42004-11-04 17:34:35 +000018871 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018872 xmlChar * ExternalID; /* the external (PUBLIC) ID */
Daniel Veillard34099b42004-11-04 17:34:35 +000018873 int n_ExternalID;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018874 xmlChar * SystemID; /* the system ID */
Daniel Veillard34099b42004-11-04 17:34:35 +000018875 int n_SystemID;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018876
Daniel Veillard34099b42004-11-04 17:34:35 +000018877 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
18878 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
18879 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
18880 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
18881 mem_base = xmlMemBlocks();
18882 doc = gen_xmlDocPtr(n_doc, 0);
18883 name = gen_const_xmlChar_ptr(n_name, 1);
18884 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 2);
18885 SystemID = gen_const_xmlChar_ptr(n_SystemID, 3);
18886
18887 ret_val = xmlCreateIntSubset(doc, name, ExternalID, SystemID);
18888 desret_xmlDtdPtr(ret_val);
18889 call_tests++;
18890 des_xmlDocPtr(n_doc, doc, 0);
18891 des_const_xmlChar_ptr(n_name, name, 1);
18892 des_const_xmlChar_ptr(n_ExternalID, ExternalID, 2);
18893 des_const_xmlChar_ptr(n_SystemID, SystemID, 3);
18894 xmlResetLastError();
18895 if (mem_base != xmlMemBlocks()) {
18896 printf("Leak of %d blocks found in xmlCreateIntSubset",
18897 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018898 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000018899 printf(" %d", n_doc);
18900 printf(" %d", n_name);
18901 printf(" %d", n_ExternalID);
18902 printf(" %d", n_SystemID);
18903 printf("\n");
18904 }
18905 }
18906 }
18907 }
18908 }
18909
18910 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000018911 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018912}
18913
18914
18915static int
18916test_xmlDocCopyNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018917 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018918
Daniel Veillardce682bc2004-11-05 17:22:25 +000018919 int mem_base;
18920 xmlNodePtr ret_val;
18921 xmlNodePtr node; /* the node */
18922 int n_node;
18923 xmlDocPtr doc; /* the document */
18924 int n_doc;
18925 int extended; /* if 1 do a recursive copy (properties, namespaces and children when applicable) if 2 copy properties and namespaces (when applicable) */
18926 int n_extended;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018927
Daniel Veillardce682bc2004-11-05 17:22:25 +000018928 for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) {
18929 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
18930 for (n_extended = 0;n_extended < gen_nb_int;n_extended++) {
18931 mem_base = xmlMemBlocks();
18932 node = gen_const_xmlNodePtr(n_node, 0);
18933 doc = gen_xmlDocPtr(n_doc, 1);
18934 extended = gen_int(n_extended, 2);
18935
18936 ret_val = xmlDocCopyNode(node, doc, extended);
18937 desret_xmlNodePtr(ret_val);
18938 call_tests++;
18939 des_const_xmlNodePtr(n_node, node, 0);
18940 des_xmlDocPtr(n_doc, doc, 1);
18941 des_int(n_extended, extended, 2);
18942 xmlResetLastError();
18943 if (mem_base != xmlMemBlocks()) {
18944 printf("Leak of %d blocks found in xmlDocCopyNode",
18945 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018946 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018947 printf(" %d", n_node);
18948 printf(" %d", n_doc);
18949 printf(" %d", n_extended);
18950 printf("\n");
18951 }
18952 }
18953 }
18954 }
18955
18956 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000018957 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018958}
18959
18960
18961static int
18962test_xmlDocCopyNodeList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018963 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018964
Daniel Veillardce682bc2004-11-05 17:22:25 +000018965 int mem_base;
18966 xmlNodePtr ret_val;
18967 xmlDocPtr doc; /* the target document */
18968 int n_doc;
18969 xmlNodePtr node; /* the first node in the list. */
18970 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018971
Daniel Veillardce682bc2004-11-05 17:22:25 +000018972 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
18973 for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) {
18974 mem_base = xmlMemBlocks();
18975 doc = gen_xmlDocPtr(n_doc, 0);
18976 node = gen_const_xmlNodePtr(n_node, 1);
18977
18978 ret_val = xmlDocCopyNodeList(doc, node);
18979 desret_xmlNodePtr(ret_val);
18980 call_tests++;
18981 des_xmlDocPtr(n_doc, doc, 0);
18982 des_const_xmlNodePtr(n_node, node, 1);
18983 xmlResetLastError();
18984 if (mem_base != xmlMemBlocks()) {
18985 printf("Leak of %d blocks found in xmlDocCopyNodeList",
18986 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018987 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018988 printf(" %d", n_doc);
18989 printf(" %d", n_node);
18990 printf("\n");
18991 }
18992 }
18993 }
18994
18995 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000018996 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018997}
18998
18999
19000static int
19001test_xmlDocDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019002 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019003
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019004#ifdef LIBXML_OUTPUT_ENABLED
19005 int mem_base;
19006 int ret_val;
19007 FILE * f; /* the FILE* */
19008 int n_f;
19009 xmlDocPtr cur; /* the document */
19010 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019011
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019012 for (n_f = 0;n_f < gen_nb_FILE_ptr;n_f++) {
19013 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
19014 mem_base = xmlMemBlocks();
19015 f = gen_FILE_ptr(n_f, 0);
19016 cur = gen_xmlDocPtr(n_cur, 1);
19017
19018 ret_val = xmlDocDump(f, cur);
19019 desret_int(ret_val);
19020 call_tests++;
19021 des_FILE_ptr(n_f, f, 0);
19022 des_xmlDocPtr(n_cur, cur, 1);
19023 xmlResetLastError();
19024 if (mem_base != xmlMemBlocks()) {
19025 printf("Leak of %d blocks found in xmlDocDump",
19026 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019027 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019028 printf(" %d", n_f);
19029 printf(" %d", n_cur);
19030 printf("\n");
19031 }
19032 }
19033 }
19034#endif
19035
19036 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000019037 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019038}
19039
19040
19041static int
19042test_xmlDocDumpFormatMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019043 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019044
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019045#ifdef LIBXML_OUTPUT_ENABLED
19046 int mem_base;
19047 xmlDocPtr cur; /* the document */
19048 int n_cur;
19049 xmlChar ** mem; /* OUT: the memory pointer */
19050 int n_mem;
19051 int * size; /* OUT: the memory length */
19052 int n_size;
19053 int format; /* should formatting spaces been added */
19054 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019055
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019056 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
19057 for (n_mem = 0;n_mem < gen_nb_xmlChar_ptr_ptr;n_mem++) {
19058 for (n_size = 0;n_size < gen_nb_int_ptr;n_size++) {
19059 for (n_format = 0;n_format < gen_nb_int;n_format++) {
19060 mem_base = xmlMemBlocks();
19061 cur = gen_xmlDocPtr(n_cur, 0);
19062 mem = gen_xmlChar_ptr_ptr(n_mem, 1);
19063 size = gen_int_ptr(n_size, 2);
19064 format = gen_int(n_format, 3);
19065
19066 xmlDocDumpFormatMemory(cur, mem, size, format);
19067 call_tests++;
19068 des_xmlDocPtr(n_cur, cur, 0);
19069 des_xmlChar_ptr_ptr(n_mem, mem, 1);
19070 des_int_ptr(n_size, size, 2);
19071 des_int(n_format, format, 3);
19072 xmlResetLastError();
19073 if (mem_base != xmlMemBlocks()) {
19074 printf("Leak of %d blocks found in xmlDocDumpFormatMemory",
19075 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019076 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019077 printf(" %d", n_cur);
19078 printf(" %d", n_mem);
19079 printf(" %d", n_size);
19080 printf(" %d", n_format);
19081 printf("\n");
19082 }
19083 }
19084 }
19085 }
19086 }
19087#endif
19088
19089 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000019090 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019091}
19092
19093
19094static int
19095test_xmlDocDumpFormatMemoryEnc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019096 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019097
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019098#ifdef LIBXML_OUTPUT_ENABLED
19099 int mem_base;
19100 xmlDocPtr out_doc; /* Document to generate XML text from */
19101 int n_out_doc;
19102 xmlChar ** doc_txt_ptr; /* Memory pointer for allocated XML text */
19103 int n_doc_txt_ptr;
19104 int * doc_txt_len; /* Length of the generated XML text */
19105 int n_doc_txt_len;
19106 char * txt_encoding; /* Character encoding to use when generating XML text */
19107 int n_txt_encoding;
19108 int format; /* should formatting spaces been added */
19109 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019110
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019111 for (n_out_doc = 0;n_out_doc < gen_nb_xmlDocPtr;n_out_doc++) {
19112 for (n_doc_txt_ptr = 0;n_doc_txt_ptr < gen_nb_xmlChar_ptr_ptr;n_doc_txt_ptr++) {
19113 for (n_doc_txt_len = 0;n_doc_txt_len < gen_nb_int_ptr;n_doc_txt_len++) {
19114 for (n_txt_encoding = 0;n_txt_encoding < gen_nb_const_char_ptr;n_txt_encoding++) {
19115 for (n_format = 0;n_format < gen_nb_int;n_format++) {
19116 mem_base = xmlMemBlocks();
19117 out_doc = gen_xmlDocPtr(n_out_doc, 0);
19118 doc_txt_ptr = gen_xmlChar_ptr_ptr(n_doc_txt_ptr, 1);
19119 doc_txt_len = gen_int_ptr(n_doc_txt_len, 2);
19120 txt_encoding = gen_const_char_ptr(n_txt_encoding, 3);
19121 format = gen_int(n_format, 4);
19122
19123 xmlDocDumpFormatMemoryEnc(out_doc, doc_txt_ptr, doc_txt_len, txt_encoding, format);
19124 call_tests++;
19125 des_xmlDocPtr(n_out_doc, out_doc, 0);
19126 des_xmlChar_ptr_ptr(n_doc_txt_ptr, doc_txt_ptr, 1);
19127 des_int_ptr(n_doc_txt_len, doc_txt_len, 2);
19128 des_const_char_ptr(n_txt_encoding, txt_encoding, 3);
19129 des_int(n_format, format, 4);
19130 xmlResetLastError();
19131 if (mem_base != xmlMemBlocks()) {
19132 printf("Leak of %d blocks found in xmlDocDumpFormatMemoryEnc",
19133 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019134 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019135 printf(" %d", n_out_doc);
19136 printf(" %d", n_doc_txt_ptr);
19137 printf(" %d", n_doc_txt_len);
19138 printf(" %d", n_txt_encoding);
19139 printf(" %d", n_format);
19140 printf("\n");
19141 }
19142 }
19143 }
19144 }
19145 }
19146 }
19147#endif
19148
19149 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000019150 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019151}
19152
19153
19154static int
19155test_xmlDocDumpMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019156 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019157
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019158#ifdef LIBXML_OUTPUT_ENABLED
19159 int mem_base;
19160 xmlDocPtr cur; /* the document */
19161 int n_cur;
19162 xmlChar ** mem; /* OUT: the memory pointer */
19163 int n_mem;
19164 int * size; /* OUT: the memory length */
19165 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019166
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019167 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
19168 for (n_mem = 0;n_mem < gen_nb_xmlChar_ptr_ptr;n_mem++) {
19169 for (n_size = 0;n_size < gen_nb_int_ptr;n_size++) {
19170 mem_base = xmlMemBlocks();
19171 cur = gen_xmlDocPtr(n_cur, 0);
19172 mem = gen_xmlChar_ptr_ptr(n_mem, 1);
19173 size = gen_int_ptr(n_size, 2);
19174
19175 xmlDocDumpMemory(cur, mem, size);
19176 call_tests++;
19177 des_xmlDocPtr(n_cur, cur, 0);
19178 des_xmlChar_ptr_ptr(n_mem, mem, 1);
19179 des_int_ptr(n_size, size, 2);
19180 xmlResetLastError();
19181 if (mem_base != xmlMemBlocks()) {
19182 printf("Leak of %d blocks found in xmlDocDumpMemory",
19183 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019184 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019185 printf(" %d", n_cur);
19186 printf(" %d", n_mem);
19187 printf(" %d", n_size);
19188 printf("\n");
19189 }
19190 }
19191 }
19192 }
19193#endif
19194
19195 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000019196 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019197}
19198
19199
19200static int
19201test_xmlDocDumpMemoryEnc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019202 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019203
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019204#ifdef LIBXML_OUTPUT_ENABLED
19205 int mem_base;
19206 xmlDocPtr out_doc; /* Document to generate XML text from */
19207 int n_out_doc;
19208 xmlChar ** doc_txt_ptr; /* Memory pointer for allocated XML text */
19209 int n_doc_txt_ptr;
19210 int * doc_txt_len; /* Length of the generated XML text */
19211 int n_doc_txt_len;
19212 char * txt_encoding; /* Character encoding to use when generating XML text */
19213 int n_txt_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019214
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019215 for (n_out_doc = 0;n_out_doc < gen_nb_xmlDocPtr;n_out_doc++) {
19216 for (n_doc_txt_ptr = 0;n_doc_txt_ptr < gen_nb_xmlChar_ptr_ptr;n_doc_txt_ptr++) {
19217 for (n_doc_txt_len = 0;n_doc_txt_len < gen_nb_int_ptr;n_doc_txt_len++) {
19218 for (n_txt_encoding = 0;n_txt_encoding < gen_nb_const_char_ptr;n_txt_encoding++) {
19219 mem_base = xmlMemBlocks();
19220 out_doc = gen_xmlDocPtr(n_out_doc, 0);
19221 doc_txt_ptr = gen_xmlChar_ptr_ptr(n_doc_txt_ptr, 1);
19222 doc_txt_len = gen_int_ptr(n_doc_txt_len, 2);
19223 txt_encoding = gen_const_char_ptr(n_txt_encoding, 3);
19224
19225 xmlDocDumpMemoryEnc(out_doc, doc_txt_ptr, doc_txt_len, txt_encoding);
19226 call_tests++;
19227 des_xmlDocPtr(n_out_doc, out_doc, 0);
19228 des_xmlChar_ptr_ptr(n_doc_txt_ptr, doc_txt_ptr, 1);
19229 des_int_ptr(n_doc_txt_len, doc_txt_len, 2);
19230 des_const_char_ptr(n_txt_encoding, txt_encoding, 3);
19231 xmlResetLastError();
19232 if (mem_base != xmlMemBlocks()) {
19233 printf("Leak of %d blocks found in xmlDocDumpMemoryEnc",
19234 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019235 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019236 printf(" %d", n_out_doc);
19237 printf(" %d", n_doc_txt_ptr);
19238 printf(" %d", n_doc_txt_len);
19239 printf(" %d", n_txt_encoding);
19240 printf("\n");
19241 }
19242 }
19243 }
19244 }
19245 }
19246#endif
19247
19248 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000019249 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019250}
19251
19252
19253static int
19254test_xmlDocFormatDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019255 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019256
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019257#ifdef LIBXML_OUTPUT_ENABLED
19258 int mem_base;
19259 int ret_val;
19260 FILE * f; /* the FILE* */
19261 int n_f;
19262 xmlDocPtr cur; /* the document */
19263 int n_cur;
19264 int format; /* should formatting spaces been added */
19265 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019266
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019267 for (n_f = 0;n_f < gen_nb_FILE_ptr;n_f++) {
19268 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
19269 for (n_format = 0;n_format < gen_nb_int;n_format++) {
19270 mem_base = xmlMemBlocks();
19271 f = gen_FILE_ptr(n_f, 0);
19272 cur = gen_xmlDocPtr(n_cur, 1);
19273 format = gen_int(n_format, 2);
19274
19275 ret_val = xmlDocFormatDump(f, cur, format);
19276 desret_int(ret_val);
19277 call_tests++;
19278 des_FILE_ptr(n_f, f, 0);
19279 des_xmlDocPtr(n_cur, cur, 1);
19280 des_int(n_format, format, 2);
19281 xmlResetLastError();
19282 if (mem_base != xmlMemBlocks()) {
19283 printf("Leak of %d blocks found in xmlDocFormatDump",
19284 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019285 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019286 printf(" %d", n_f);
19287 printf(" %d", n_cur);
19288 printf(" %d", n_format);
19289 printf("\n");
19290 }
19291 }
19292 }
19293 }
19294#endif
19295
19296 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000019297 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019298}
19299
19300
19301static int
19302test_xmlDocGetRootElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019303 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019304
19305 int mem_base;
19306 xmlNodePtr ret_val;
19307 xmlDocPtr doc; /* the document */
19308 int n_doc;
19309
19310 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19311 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019312 doc = gen_xmlDocPtr(n_doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019313
19314 ret_val = xmlDocGetRootElement(doc);
19315 desret_xmlNodePtr(ret_val);
19316 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019317 des_xmlDocPtr(n_doc, doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019318 xmlResetLastError();
19319 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019320 printf("Leak of %d blocks found in xmlDocGetRootElement",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019321 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019322 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019323 printf(" %d", n_doc);
19324 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019325 }
19326 }
19327
Daniel Veillard3d97e662004-11-04 10:49:00 +000019328 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000019329 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019330}
19331
19332
19333static int
19334test_xmlDocSetRootElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019335 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019336
19337#ifdef LIBXML_TREE_ENABLED
19338 int mem_base;
19339 xmlNodePtr ret_val;
19340 xmlDocPtr doc; /* the document */
19341 int n_doc;
19342 xmlNodePtr root; /* the new document root element */
19343 int n_root;
19344
19345 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019346 for (n_root = 0;n_root < gen_nb_xmlNodePtr_in;n_root++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000019347 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019348 doc = gen_xmlDocPtr(n_doc, 0);
19349 root = gen_xmlNodePtr_in(n_root, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019350
19351 ret_val = xmlDocSetRootElement(doc, root);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019352 if (doc == NULL) { xmlFreeNode(root) ; root = NULL ; }
Daniel Veillardd93f6252004-11-02 15:53:51 +000019353 desret_xmlNodePtr(ret_val);
19354 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019355 des_xmlDocPtr(n_doc, doc, 0);
19356 des_xmlNodePtr_in(n_root, root, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019357 xmlResetLastError();
19358 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019359 printf("Leak of %d blocks found in xmlDocSetRootElement",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019360 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019361 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019362 printf(" %d", n_doc);
19363 printf(" %d", n_root);
19364 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019365 }
19366 }
19367 }
19368#endif
19369
Daniel Veillard3d97e662004-11-04 10:49:00 +000019370 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000019371 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019372}
19373
19374
19375static int
19376test_xmlElemDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019377 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019378
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019379#ifdef LIBXML_OUTPUT_ENABLED
19380 int mem_base;
19381 FILE * f; /* the FILE * for the output */
19382 int n_f;
19383 xmlDocPtr doc; /* the document */
19384 int n_doc;
19385 xmlNodePtr cur; /* the current node */
19386 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019387
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019388 for (n_f = 0;n_f < gen_nb_FILE_ptr;n_f++) {
19389 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19390 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
19391 mem_base = xmlMemBlocks();
19392 f = gen_FILE_ptr(n_f, 0);
19393 doc = gen_xmlDocPtr(n_doc, 1);
19394 cur = gen_xmlNodePtr(n_cur, 2);
19395
19396 xmlElemDump(f, doc, cur);
19397 call_tests++;
19398 des_FILE_ptr(n_f, f, 0);
19399 des_xmlDocPtr(n_doc, doc, 1);
19400 des_xmlNodePtr(n_cur, cur, 2);
19401 xmlResetLastError();
19402 if (mem_base != xmlMemBlocks()) {
19403 printf("Leak of %d blocks found in xmlElemDump",
19404 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019405 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019406 printf(" %d", n_f);
19407 printf(" %d", n_doc);
19408 printf(" %d", n_cur);
19409 printf("\n");
19410 }
19411 }
19412 }
19413 }
19414#endif
19415
19416 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000019417 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019418}
19419
19420
19421static int
19422test_xmlGetBufferAllocationScheme(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019423 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019424
Daniel Veillard57b25162004-11-06 14:50:18 +000019425 int mem_base;
19426 xmlBufferAllocationScheme ret_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019427
Daniel Veillard57b25162004-11-06 14:50:18 +000019428 mem_base = xmlMemBlocks();
19429
19430 ret_val = xmlGetBufferAllocationScheme();
19431 desret_xmlBufferAllocationScheme(ret_val);
19432 call_tests++;
19433 xmlResetLastError();
19434 if (mem_base != xmlMemBlocks()) {
19435 printf("Leak of %d blocks found in xmlGetBufferAllocationScheme",
19436 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019437 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000019438 printf("\n");
19439 }
19440
19441 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000019442 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019443}
19444
19445
19446static int
19447test_xmlGetCompressMode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019448 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019449
19450 int mem_base;
19451 int ret_val;
19452
19453 mem_base = xmlMemBlocks();
19454
19455 ret_val = xmlGetCompressMode();
19456 desret_int(ret_val);
19457 call_tests++;
19458 xmlResetLastError();
19459 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019460 printf("Leak of %d blocks found in xmlGetCompressMode",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019461 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019462 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019463 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019464 }
19465
Daniel Veillard3d97e662004-11-04 10:49:00 +000019466 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000019467 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019468}
19469
19470
19471static int
19472test_xmlGetDocCompressMode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019473 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019474
19475 int mem_base;
19476 int ret_val;
19477 xmlDocPtr doc; /* the document */
19478 int n_doc;
19479
19480 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19481 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019482 doc = gen_xmlDocPtr(n_doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019483
19484 ret_val = xmlGetDocCompressMode(doc);
19485 desret_int(ret_val);
19486 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019487 des_xmlDocPtr(n_doc, doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019488 xmlResetLastError();
19489 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019490 printf("Leak of %d blocks found in xmlGetDocCompressMode",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019491 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019492 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019493 printf(" %d", n_doc);
19494 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019495 }
19496 }
19497
Daniel Veillard3d97e662004-11-04 10:49:00 +000019498 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000019499 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019500}
19501
19502
19503static int
19504test_xmlGetIntSubset(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019505 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019506
Daniel Veillard34099b42004-11-04 17:34:35 +000019507 int mem_base;
19508 xmlDtdPtr ret_val;
19509 xmlDocPtr doc; /* the document pointer */
19510 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019511
Daniel Veillard34099b42004-11-04 17:34:35 +000019512 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19513 mem_base = xmlMemBlocks();
19514 doc = gen_xmlDocPtr(n_doc, 0);
19515
19516 ret_val = xmlGetIntSubset(doc);
19517 desret_xmlDtdPtr(ret_val);
19518 call_tests++;
19519 des_xmlDocPtr(n_doc, doc, 0);
19520 xmlResetLastError();
19521 if (mem_base != xmlMemBlocks()) {
19522 printf("Leak of %d blocks found in xmlGetIntSubset",
19523 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019524 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000019525 printf(" %d", n_doc);
19526 printf("\n");
19527 }
19528 }
19529
19530 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000019531 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019532}
19533
19534
19535static int
19536test_xmlGetLastChild(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019537 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019538
19539 int mem_base;
19540 xmlNodePtr ret_val;
19541 xmlNodePtr parent; /* the parent node */
19542 int n_parent;
19543
19544 for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) {
19545 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019546 parent = gen_xmlNodePtr(n_parent, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019547
19548 ret_val = xmlGetLastChild(parent);
19549 desret_xmlNodePtr(ret_val);
19550 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019551 des_xmlNodePtr(n_parent, parent, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019552 xmlResetLastError();
19553 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019554 printf("Leak of %d blocks found in xmlGetLastChild",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019555 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019556 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019557 printf(" %d", n_parent);
19558 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019559 }
19560 }
19561
Daniel Veillard3d97e662004-11-04 10:49:00 +000019562 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000019563 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019564}
19565
19566
19567static int
19568test_xmlGetLineNo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019569 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019570
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019571 int mem_base;
19572 long ret_val;
19573 xmlNodePtr node; /* valid node */
19574 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019575
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019576 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19577 mem_base = xmlMemBlocks();
19578 node = gen_xmlNodePtr(n_node, 0);
19579
19580 ret_val = xmlGetLineNo(node);
19581 desret_long(ret_val);
19582 call_tests++;
19583 des_xmlNodePtr(n_node, node, 0);
19584 xmlResetLastError();
19585 if (mem_base != xmlMemBlocks()) {
19586 printf("Leak of %d blocks found in xmlGetLineNo",
19587 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019588 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019589 printf(" %d", n_node);
19590 printf("\n");
19591 }
19592 }
19593
19594 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000019595 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019596}
19597
19598
19599static int
19600test_xmlGetNoNsProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019601 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019602
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019603 int mem_base;
19604 xmlChar * ret_val;
19605 xmlNodePtr node; /* the node */
19606 int n_node;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019607 xmlChar * name; /* the attribute name */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019608 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019609
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019610 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19611 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19612 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019613 node = gen_xmlNodePtr(n_node, 0);
19614 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019615
19616 ret_val = xmlGetNoNsProp(node, name);
19617 desret_xmlChar_ptr(ret_val);
19618 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019619 des_xmlNodePtr(n_node, node, 0);
19620 des_const_xmlChar_ptr(n_name, name, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019621 xmlResetLastError();
19622 if (mem_base != xmlMemBlocks()) {
19623 printf("Leak of %d blocks found in xmlGetNoNsProp",
19624 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019625 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019626 printf(" %d", n_node);
19627 printf(" %d", n_name);
19628 printf("\n");
19629 }
19630 }
19631 }
19632
Daniel Veillard3d97e662004-11-04 10:49:00 +000019633 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000019634 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019635}
19636
19637
19638static int
19639test_xmlGetNodePath(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019640 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019641
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019642#ifdef LIBXML_TREE_ENABLED
19643 int mem_base;
19644 xmlChar * ret_val;
19645 xmlNodePtr node; /* a node */
19646 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019647
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019648 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19649 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019650 node = gen_xmlNodePtr(n_node, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019651
19652 ret_val = xmlGetNodePath(node);
19653 desret_xmlChar_ptr(ret_val);
19654 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019655 des_xmlNodePtr(n_node, node, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019656 xmlResetLastError();
19657 if (mem_base != xmlMemBlocks()) {
19658 printf("Leak of %d blocks found in xmlGetNodePath",
19659 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019660 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019661 printf(" %d", n_node);
19662 printf("\n");
19663 }
19664 }
19665#endif
19666
Daniel Veillard3d97e662004-11-04 10:49:00 +000019667 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000019668 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019669}
19670
19671
19672static int
19673test_xmlGetNsList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019674 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019675
19676
19677 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000019678 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019679}
19680
19681
19682static int
19683test_xmlGetNsProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019684 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019685
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019686 int mem_base;
19687 xmlChar * ret_val;
19688 xmlNodePtr node; /* the node */
19689 int n_node;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019690 xmlChar * name; /* the attribute name */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019691 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019692 xmlChar * nameSpace; /* the URI of the namespace */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019693 int n_nameSpace;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019694
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019695 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19696 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19697 for (n_nameSpace = 0;n_nameSpace < gen_nb_const_xmlChar_ptr;n_nameSpace++) {
19698 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019699 node = gen_xmlNodePtr(n_node, 0);
19700 name = gen_const_xmlChar_ptr(n_name, 1);
19701 nameSpace = gen_const_xmlChar_ptr(n_nameSpace, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019702
19703 ret_val = xmlGetNsProp(node, name, nameSpace);
19704 desret_xmlChar_ptr(ret_val);
19705 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019706 des_xmlNodePtr(n_node, node, 0);
19707 des_const_xmlChar_ptr(n_name, name, 1);
19708 des_const_xmlChar_ptr(n_nameSpace, nameSpace, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019709 xmlResetLastError();
19710 if (mem_base != xmlMemBlocks()) {
19711 printf("Leak of %d blocks found in xmlGetNsProp",
19712 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019713 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019714 printf(" %d", n_node);
19715 printf(" %d", n_name);
19716 printf(" %d", n_nameSpace);
19717 printf("\n");
19718 }
19719 }
19720 }
19721 }
19722
Daniel Veillard3d97e662004-11-04 10:49:00 +000019723 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000019724 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019725}
19726
19727
19728static int
19729test_xmlGetProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019730 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019731
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019732 int mem_base;
19733 xmlChar * ret_val;
19734 xmlNodePtr node; /* the node */
19735 int n_node;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019736 xmlChar * name; /* the attribute name */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019737 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019738
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019739 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19740 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19741 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019742 node = gen_xmlNodePtr(n_node, 0);
19743 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019744
19745 ret_val = xmlGetProp(node, name);
19746 desret_xmlChar_ptr(ret_val);
19747 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019748 des_xmlNodePtr(n_node, node, 0);
19749 des_const_xmlChar_ptr(n_name, name, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019750 xmlResetLastError();
19751 if (mem_base != xmlMemBlocks()) {
19752 printf("Leak of %d blocks found in xmlGetProp",
19753 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019754 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019755 printf(" %d", n_node);
19756 printf(" %d", n_name);
19757 printf("\n");
19758 }
19759 }
19760 }
19761
Daniel Veillard3d97e662004-11-04 10:49:00 +000019762 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000019763 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019764}
19765
19766
19767static int
19768test_xmlHasNsProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019769 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019770
Daniel Veillard57b25162004-11-06 14:50:18 +000019771 int mem_base;
19772 xmlAttrPtr ret_val;
19773 xmlNodePtr node; /* the node */
19774 int n_node;
19775 xmlChar * name; /* the attribute name */
19776 int n_name;
19777 xmlChar * nameSpace; /* the URI of the namespace */
19778 int n_nameSpace;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019779
Daniel Veillard57b25162004-11-06 14:50:18 +000019780 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19781 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19782 for (n_nameSpace = 0;n_nameSpace < gen_nb_const_xmlChar_ptr;n_nameSpace++) {
19783 mem_base = xmlMemBlocks();
19784 node = gen_xmlNodePtr(n_node, 0);
19785 name = gen_const_xmlChar_ptr(n_name, 1);
19786 nameSpace = gen_const_xmlChar_ptr(n_nameSpace, 2);
19787
19788 ret_val = xmlHasNsProp(node, name, nameSpace);
19789 desret_xmlAttrPtr(ret_val);
19790 call_tests++;
19791 des_xmlNodePtr(n_node, node, 0);
19792 des_const_xmlChar_ptr(n_name, name, 1);
19793 des_const_xmlChar_ptr(n_nameSpace, nameSpace, 2);
19794 xmlResetLastError();
19795 if (mem_base != xmlMemBlocks()) {
19796 printf("Leak of %d blocks found in xmlHasNsProp",
19797 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019798 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000019799 printf(" %d", n_node);
19800 printf(" %d", n_name);
19801 printf(" %d", n_nameSpace);
19802 printf("\n");
19803 }
19804 }
19805 }
19806 }
19807
19808 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000019809 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019810}
19811
19812
19813static int
19814test_xmlHasProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019815 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019816
Daniel Veillard57b25162004-11-06 14:50:18 +000019817 int mem_base;
19818 xmlAttrPtr ret_val;
19819 xmlNodePtr node; /* the node */
19820 int n_node;
19821 xmlChar * name; /* the attribute name */
19822 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019823
Daniel Veillard57b25162004-11-06 14:50:18 +000019824 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19825 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19826 mem_base = xmlMemBlocks();
19827 node = gen_xmlNodePtr(n_node, 0);
19828 name = gen_const_xmlChar_ptr(n_name, 1);
19829
19830 ret_val = xmlHasProp(node, name);
19831 desret_xmlAttrPtr(ret_val);
19832 call_tests++;
19833 des_xmlNodePtr(n_node, node, 0);
19834 des_const_xmlChar_ptr(n_name, name, 1);
19835 xmlResetLastError();
19836 if (mem_base != xmlMemBlocks()) {
19837 printf("Leak of %d blocks found in xmlHasProp",
19838 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019839 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000019840 printf(" %d", n_node);
19841 printf(" %d", n_name);
19842 printf("\n");
19843 }
19844 }
19845 }
19846
19847 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000019848 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019849}
19850
19851
19852static int
19853test_xmlIsBlankNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019854 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019855
19856 int mem_base;
19857 int ret_val;
19858 xmlNodePtr node; /* the node */
19859 int n_node;
19860
19861 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19862 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019863 node = gen_xmlNodePtr(n_node, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019864
19865 ret_val = xmlIsBlankNode(node);
19866 desret_int(ret_val);
19867 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019868 des_xmlNodePtr(n_node, node, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019869 xmlResetLastError();
19870 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019871 printf("Leak of %d blocks found in xmlIsBlankNode",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019872 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019873 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019874 printf(" %d", n_node);
19875 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019876 }
19877 }
19878
Daniel Veillard3d97e662004-11-04 10:49:00 +000019879 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000019880 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019881}
19882
19883
19884static int
19885test_xmlIsXHTML(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019886 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019887
19888 int mem_base;
19889 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019890 xmlChar * systemID; /* the system identifier */
Daniel Veillardd93f6252004-11-02 15:53:51 +000019891 int n_systemID;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019892 xmlChar * publicID; /* the public identifier */
Daniel Veillardd93f6252004-11-02 15:53:51 +000019893 int n_publicID;
19894
19895 for (n_systemID = 0;n_systemID < gen_nb_const_xmlChar_ptr;n_systemID++) {
19896 for (n_publicID = 0;n_publicID < gen_nb_const_xmlChar_ptr;n_publicID++) {
19897 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019898 systemID = gen_const_xmlChar_ptr(n_systemID, 0);
19899 publicID = gen_const_xmlChar_ptr(n_publicID, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019900
19901 ret_val = xmlIsXHTML(systemID, publicID);
19902 desret_int(ret_val);
19903 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019904 des_const_xmlChar_ptr(n_systemID, systemID, 0);
19905 des_const_xmlChar_ptr(n_publicID, publicID, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019906 xmlResetLastError();
19907 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019908 printf("Leak of %d blocks found in xmlIsXHTML",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019909 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019910 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019911 printf(" %d", n_systemID);
19912 printf(" %d", n_publicID);
19913 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019914 }
19915 }
19916 }
19917
Daniel Veillard3d97e662004-11-04 10:49:00 +000019918 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000019919 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019920}
19921
19922
19923static int
19924test_xmlNewCDataBlock(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019925 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019926
19927 int mem_base;
19928 xmlNodePtr ret_val;
19929 xmlDocPtr doc; /* the document */
19930 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019931 xmlChar * content; /* the CDATA block content content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000019932 int n_content;
19933 int len; /* the length of the block */
19934 int n_len;
19935
19936 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19937 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
19938 for (n_len = 0;n_len < gen_nb_int;n_len++) {
19939 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019940 doc = gen_xmlDocPtr(n_doc, 0);
19941 content = gen_const_xmlChar_ptr(n_content, 1);
19942 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019943
19944 ret_val = xmlNewCDataBlock(doc, content, len);
19945 desret_xmlNodePtr(ret_val);
19946 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019947 des_xmlDocPtr(n_doc, doc, 0);
19948 des_const_xmlChar_ptr(n_content, content, 1);
19949 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019950 xmlResetLastError();
19951 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019952 printf("Leak of %d blocks found in xmlNewCDataBlock",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019953 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019954 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019955 printf(" %d", n_doc);
19956 printf(" %d", n_content);
19957 printf(" %d", n_len);
19958 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019959 }
19960 }
19961 }
19962 }
19963
Daniel Veillard3d97e662004-11-04 10:49:00 +000019964 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000019965 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019966}
19967
19968
19969static int
19970test_xmlNewCharRef(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019971 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019972
19973 int mem_base;
19974 xmlNodePtr ret_val;
19975 xmlDocPtr doc; /* the document */
19976 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019977 xmlChar * name; /* the char ref string, starting with # or "&# ... ;" */
Daniel Veillardd93f6252004-11-02 15:53:51 +000019978 int n_name;
19979
19980 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19981 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19982 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019983 doc = gen_xmlDocPtr(n_doc, 0);
19984 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019985
19986 ret_val = xmlNewCharRef(doc, name);
19987 desret_xmlNodePtr(ret_val);
19988 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019989 des_xmlDocPtr(n_doc, doc, 0);
19990 des_const_xmlChar_ptr(n_name, name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019991 xmlResetLastError();
19992 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019993 printf("Leak of %d blocks found in xmlNewCharRef",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019994 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019995 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019996 printf(" %d", n_doc);
19997 printf(" %d", n_name);
19998 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019999 }
20000 }
20001 }
20002
Daniel Veillard3d97e662004-11-04 10:49:00 +000020003 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000020004 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020005}
20006
20007
20008static int
20009test_xmlNewChild(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020010 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020011
Daniel Veillarda521d282004-11-09 14:59:59 +000020012#ifdef LIBXML_TREE_ENABLED
Daniel Veillard27f20102004-11-05 11:50:11 +000020013 int mem_base;
20014 xmlNodePtr ret_val;
20015 xmlNodePtr parent; /* the parent node */
20016 int n_parent;
20017 xmlNsPtr ns; /* a namespace if any */
20018 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020019 xmlChar * name; /* the name of the child */
Daniel Veillard27f20102004-11-05 11:50:11 +000020020 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020021 xmlChar * content; /* the XML content of the child if any. */
Daniel Veillard27f20102004-11-05 11:50:11 +000020022 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020023
Daniel Veillard27f20102004-11-05 11:50:11 +000020024 for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) {
20025 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20026 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20027 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20028 mem_base = xmlMemBlocks();
20029 parent = gen_xmlNodePtr(n_parent, 0);
20030 ns = gen_xmlNsPtr(n_ns, 1);
20031 name = gen_const_xmlChar_ptr(n_name, 2);
20032 content = gen_const_xmlChar_ptr(n_content, 3);
20033
20034 ret_val = xmlNewChild(parent, ns, name, content);
20035 desret_xmlNodePtr(ret_val);
20036 call_tests++;
20037 des_xmlNodePtr(n_parent, parent, 0);
20038 des_xmlNsPtr(n_ns, ns, 1);
20039 des_const_xmlChar_ptr(n_name, name, 2);
20040 des_const_xmlChar_ptr(n_content, content, 3);
20041 xmlResetLastError();
20042 if (mem_base != xmlMemBlocks()) {
20043 printf("Leak of %d blocks found in xmlNewChild",
20044 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020045 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000020046 printf(" %d", n_parent);
20047 printf(" %d", n_ns);
20048 printf(" %d", n_name);
20049 printf(" %d", n_content);
20050 printf("\n");
20051 }
20052 }
20053 }
20054 }
20055 }
Daniel Veillarda521d282004-11-09 14:59:59 +000020056#endif
Daniel Veillard27f20102004-11-05 11:50:11 +000020057
20058 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000020059 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020060}
20061
20062
20063static int
20064test_xmlNewComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020065 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020066
20067 int mem_base;
20068 xmlNodePtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020069 xmlChar * content; /* the comment content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020070 int n_content;
20071
20072 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20073 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020074 content = gen_const_xmlChar_ptr(n_content, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020075
20076 ret_val = xmlNewComment(content);
20077 desret_xmlNodePtr(ret_val);
20078 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020079 des_const_xmlChar_ptr(n_content, content, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020080 xmlResetLastError();
20081 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020082 printf("Leak of %d blocks found in xmlNewComment",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020083 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020084 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020085 printf(" %d", n_content);
20086 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020087 }
20088 }
20089
Daniel Veillard3d97e662004-11-04 10:49:00 +000020090 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000020091 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020092}
20093
20094
20095static int
20096test_xmlNewDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020097 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020098
20099 int mem_base;
20100 xmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020101 xmlChar * version; /* xmlChar string giving the version of XML "1.0" */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020102 int n_version;
20103
20104 for (n_version = 0;n_version < gen_nb_const_xmlChar_ptr;n_version++) {
20105 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020106 version = gen_const_xmlChar_ptr(n_version, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020107
20108 ret_val = xmlNewDoc(version);
20109 desret_xmlDocPtr(ret_val);
20110 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020111 des_const_xmlChar_ptr(n_version, version, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020112 xmlResetLastError();
20113 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020114 printf("Leak of %d blocks found in xmlNewDoc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020115 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020116 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020117 printf(" %d", n_version);
20118 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020119 }
20120 }
20121
Daniel Veillard3d97e662004-11-04 10:49:00 +000020122 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000020123 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020124}
20125
20126
20127static int
20128test_xmlNewDocComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020129 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020130
20131 int mem_base;
20132 xmlNodePtr ret_val;
20133 xmlDocPtr doc; /* the document */
20134 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020135 xmlChar * content; /* the comment content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020136 int n_content;
20137
20138 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20139 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20140 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020141 doc = gen_xmlDocPtr(n_doc, 0);
20142 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020143
20144 ret_val = xmlNewDocComment(doc, content);
20145 desret_xmlNodePtr(ret_val);
20146 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020147 des_xmlDocPtr(n_doc, doc, 0);
20148 des_const_xmlChar_ptr(n_content, content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020149 xmlResetLastError();
20150 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020151 printf("Leak of %d blocks found in xmlNewDocComment",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020152 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020153 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020154 printf(" %d", n_doc);
20155 printf(" %d", n_content);
20156 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020157 }
20158 }
20159 }
20160
Daniel Veillard3d97e662004-11-04 10:49:00 +000020161 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000020162 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020163}
20164
20165
20166static int
20167test_xmlNewDocFragment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020168 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020169
20170#ifdef LIBXML_TREE_ENABLED
20171 int mem_base;
20172 xmlNodePtr ret_val;
20173 xmlDocPtr doc; /* the document owning the fragment */
20174 int n_doc;
20175
20176 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20177 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020178 doc = gen_xmlDocPtr(n_doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020179
20180 ret_val = xmlNewDocFragment(doc);
20181 desret_xmlNodePtr(ret_val);
20182 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020183 des_xmlDocPtr(n_doc, doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020184 xmlResetLastError();
20185 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020186 printf("Leak of %d blocks found in xmlNewDocFragment",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020187 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020188 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020189 printf(" %d", n_doc);
20190 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020191 }
20192 }
20193#endif
20194
Daniel Veillard3d97e662004-11-04 10:49:00 +000020195 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000020196 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020197}
20198
20199
20200static int
20201test_xmlNewDocNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020202 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020203
Daniel Veillard27f20102004-11-05 11:50:11 +000020204 int mem_base;
20205 xmlNodePtr ret_val;
20206 xmlDocPtr doc; /* the document */
20207 int n_doc;
20208 xmlNsPtr ns; /* namespace if any */
20209 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020210 xmlChar * name; /* the node name */
Daniel Veillard27f20102004-11-05 11:50:11 +000020211 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020212 xmlChar * content; /* the XML text content if any */
Daniel Veillard27f20102004-11-05 11:50:11 +000020213 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020214
Daniel Veillard27f20102004-11-05 11:50:11 +000020215 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20216 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20217 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20218 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20219 mem_base = xmlMemBlocks();
20220 doc = gen_xmlDocPtr(n_doc, 0);
20221 ns = gen_xmlNsPtr(n_ns, 1);
20222 name = gen_const_xmlChar_ptr(n_name, 2);
20223 content = gen_const_xmlChar_ptr(n_content, 3);
20224
20225 ret_val = xmlNewDocNode(doc, ns, name, content);
20226 desret_xmlNodePtr(ret_val);
20227 call_tests++;
20228 des_xmlDocPtr(n_doc, doc, 0);
20229 des_xmlNsPtr(n_ns, ns, 1);
20230 des_const_xmlChar_ptr(n_name, name, 2);
20231 des_const_xmlChar_ptr(n_content, content, 3);
20232 xmlResetLastError();
20233 if (mem_base != xmlMemBlocks()) {
20234 printf("Leak of %d blocks found in xmlNewDocNode",
20235 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020236 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000020237 printf(" %d", n_doc);
20238 printf(" %d", n_ns);
20239 printf(" %d", n_name);
20240 printf(" %d", n_content);
20241 printf("\n");
20242 }
20243 }
20244 }
20245 }
20246 }
20247
20248 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000020249 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020250}
20251
20252
20253static int
20254test_xmlNewDocNodeEatName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020255 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020256
Daniel Veillard27f20102004-11-05 11:50:11 +000020257 int mem_base;
20258 xmlNodePtr ret_val;
20259 xmlDocPtr doc; /* the document */
20260 int n_doc;
20261 xmlNsPtr ns; /* namespace if any */
20262 int n_ns;
20263 xmlChar * name; /* the node name */
20264 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020265 xmlChar * content; /* the XML text content if any */
Daniel Veillard27f20102004-11-05 11:50:11 +000020266 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020267
Daniel Veillard27f20102004-11-05 11:50:11 +000020268 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20269 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20270 for (n_name = 0;n_name < gen_nb_eaten_name;n_name++) {
20271 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20272 mem_base = xmlMemBlocks();
20273 doc = gen_xmlDocPtr(n_doc, 0);
20274 ns = gen_xmlNsPtr(n_ns, 1);
20275 name = gen_eaten_name(n_name, 2);
20276 content = gen_const_xmlChar_ptr(n_content, 3);
20277
20278 ret_val = xmlNewDocNodeEatName(doc, ns, name, content);
20279 desret_xmlNodePtr(ret_val);
20280 call_tests++;
20281 des_xmlDocPtr(n_doc, doc, 0);
20282 des_xmlNsPtr(n_ns, ns, 1);
20283 des_eaten_name(n_name, name, 2);
20284 des_const_xmlChar_ptr(n_content, content, 3);
20285 xmlResetLastError();
20286 if (mem_base != xmlMemBlocks()) {
20287 printf("Leak of %d blocks found in xmlNewDocNodeEatName",
20288 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020289 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000020290 printf(" %d", n_doc);
20291 printf(" %d", n_ns);
20292 printf(" %d", n_name);
20293 printf(" %d", n_content);
20294 printf("\n");
20295 }
20296 }
20297 }
20298 }
20299 }
20300
20301 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000020302 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020303}
20304
20305
20306static int
20307test_xmlNewDocPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020308 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020309
20310 int mem_base;
20311 xmlNodePtr ret_val;
20312 xmlDocPtr doc; /* the target document */
20313 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020314 xmlChar * name; /* the processing instruction name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020315 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020316 xmlChar * content; /* the PI content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020317 int n_content;
20318
20319 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20320 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20321 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20322 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020323 doc = gen_xmlDocPtr(n_doc, 0);
20324 name = gen_const_xmlChar_ptr(n_name, 1);
20325 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020326
20327 ret_val = xmlNewDocPI(doc, name, content);
20328 desret_xmlNodePtr(ret_val);
20329 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020330 des_xmlDocPtr(n_doc, doc, 0);
20331 des_const_xmlChar_ptr(n_name, name, 1);
20332 des_const_xmlChar_ptr(n_content, content, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020333 xmlResetLastError();
20334 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020335 printf("Leak of %d blocks found in xmlNewDocPI",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020336 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020337 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020338 printf(" %d", n_doc);
20339 printf(" %d", n_name);
20340 printf(" %d", n_content);
20341 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020342 }
20343 }
20344 }
20345 }
20346
Daniel Veillard3d97e662004-11-04 10:49:00 +000020347 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000020348 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020349}
20350
20351
20352static int
20353test_xmlNewDocProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020354 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020355
Daniel Veillard57b25162004-11-06 14:50:18 +000020356 int mem_base;
20357 xmlAttrPtr ret_val;
20358 xmlDocPtr doc; /* the document */
20359 int n_doc;
20360 xmlChar * name; /* the name of the attribute */
20361 int n_name;
20362 xmlChar * value; /* the value of the attribute */
20363 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020364
Daniel Veillard57b25162004-11-06 14:50:18 +000020365 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20366 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20367 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
20368 mem_base = xmlMemBlocks();
20369 doc = gen_xmlDocPtr(n_doc, 0);
20370 name = gen_const_xmlChar_ptr(n_name, 1);
20371 value = gen_const_xmlChar_ptr(n_value, 2);
20372
20373 ret_val = xmlNewDocProp(doc, name, value);
20374 desret_xmlAttrPtr(ret_val);
20375 call_tests++;
20376 des_xmlDocPtr(n_doc, doc, 0);
20377 des_const_xmlChar_ptr(n_name, name, 1);
20378 des_const_xmlChar_ptr(n_value, value, 2);
20379 xmlResetLastError();
20380 if (mem_base != xmlMemBlocks()) {
20381 printf("Leak of %d blocks found in xmlNewDocProp",
20382 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020383 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000020384 printf(" %d", n_doc);
20385 printf(" %d", n_name);
20386 printf(" %d", n_value);
20387 printf("\n");
20388 }
20389 }
20390 }
20391 }
20392
20393 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000020394 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020395}
20396
20397
20398static int
20399test_xmlNewDocRawNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020400 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020401
Daniel Veillarda521d282004-11-09 14:59:59 +000020402#ifdef LIBXML_TREE_ENABLED
Daniel Veillard27f20102004-11-05 11:50:11 +000020403 int mem_base;
20404 xmlNodePtr ret_val;
20405 xmlDocPtr doc; /* the document */
20406 int n_doc;
20407 xmlNsPtr ns; /* namespace if any */
20408 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020409 xmlChar * name; /* the node name */
Daniel Veillard27f20102004-11-05 11:50:11 +000020410 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020411 xmlChar * content; /* the text content if any */
Daniel Veillard27f20102004-11-05 11:50:11 +000020412 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020413
Daniel Veillard27f20102004-11-05 11:50:11 +000020414 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20415 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20416 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20417 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20418 mem_base = xmlMemBlocks();
20419 doc = gen_xmlDocPtr(n_doc, 0);
20420 ns = gen_xmlNsPtr(n_ns, 1);
20421 name = gen_const_xmlChar_ptr(n_name, 2);
20422 content = gen_const_xmlChar_ptr(n_content, 3);
20423
20424 ret_val = xmlNewDocRawNode(doc, ns, name, content);
20425 desret_xmlNodePtr(ret_val);
20426 call_tests++;
20427 des_xmlDocPtr(n_doc, doc, 0);
20428 des_xmlNsPtr(n_ns, ns, 1);
20429 des_const_xmlChar_ptr(n_name, name, 2);
20430 des_const_xmlChar_ptr(n_content, content, 3);
20431 xmlResetLastError();
20432 if (mem_base != xmlMemBlocks()) {
20433 printf("Leak of %d blocks found in xmlNewDocRawNode",
20434 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020435 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000020436 printf(" %d", n_doc);
20437 printf(" %d", n_ns);
20438 printf(" %d", n_name);
20439 printf(" %d", n_content);
20440 printf("\n");
20441 }
20442 }
20443 }
20444 }
20445 }
Daniel Veillarda521d282004-11-09 14:59:59 +000020446#endif
Daniel Veillard27f20102004-11-05 11:50:11 +000020447
20448 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000020449 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020450}
20451
20452
20453static int
20454test_xmlNewDocText(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020455 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020456
20457 int mem_base;
20458 xmlNodePtr ret_val;
20459 xmlDocPtr doc; /* the document */
20460 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020461 xmlChar * content; /* the text content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020462 int n_content;
20463
20464 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20465 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20466 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020467 doc = gen_xmlDocPtr(n_doc, 0);
20468 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020469
20470 ret_val = xmlNewDocText(doc, content);
20471 desret_xmlNodePtr(ret_val);
20472 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020473 des_xmlDocPtr(n_doc, doc, 0);
20474 des_const_xmlChar_ptr(n_content, content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020475 xmlResetLastError();
20476 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020477 printf("Leak of %d blocks found in xmlNewDocText",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020478 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020479 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020480 printf(" %d", n_doc);
20481 printf(" %d", n_content);
20482 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020483 }
20484 }
20485 }
20486
Daniel Veillard3d97e662004-11-04 10:49:00 +000020487 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000020488 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020489}
20490
20491
20492static int
20493test_xmlNewDocTextLen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020494 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020495
20496 int mem_base;
20497 xmlNodePtr ret_val;
20498 xmlDocPtr doc; /* the document */
20499 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020500 xmlChar * content; /* the text content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020501 int n_content;
20502 int len; /* the text len. */
20503 int n_len;
20504
20505 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20506 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20507 for (n_len = 0;n_len < gen_nb_int;n_len++) {
20508 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020509 doc = gen_xmlDocPtr(n_doc, 0);
20510 content = gen_const_xmlChar_ptr(n_content, 1);
20511 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020512
20513 ret_val = xmlNewDocTextLen(doc, content, len);
20514 desret_xmlNodePtr(ret_val);
20515 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020516 des_xmlDocPtr(n_doc, doc, 0);
20517 des_const_xmlChar_ptr(n_content, content, 1);
20518 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020519 xmlResetLastError();
20520 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020521 printf("Leak of %d blocks found in xmlNewDocTextLen",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020522 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020523 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020524 printf(" %d", n_doc);
20525 printf(" %d", n_content);
20526 printf(" %d", n_len);
20527 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020528 }
20529 }
20530 }
20531 }
20532
Daniel Veillard3d97e662004-11-04 10:49:00 +000020533 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000020534 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020535}
20536
20537
20538static int
20539test_xmlNewDtd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020540 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020541
Daniel Veillard34099b42004-11-04 17:34:35 +000020542 int mem_base;
20543 xmlDtdPtr ret_val;
20544 xmlDocPtr doc; /* the document pointer */
20545 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020546 xmlChar * name; /* the DTD name */
Daniel Veillard34099b42004-11-04 17:34:35 +000020547 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020548 xmlChar * ExternalID; /* the external ID */
Daniel Veillard34099b42004-11-04 17:34:35 +000020549 int n_ExternalID;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020550 xmlChar * SystemID; /* the system ID */
Daniel Veillard34099b42004-11-04 17:34:35 +000020551 int n_SystemID;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020552
Daniel Veillard34099b42004-11-04 17:34:35 +000020553 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20554 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20555 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
20556 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
20557 mem_base = xmlMemBlocks();
20558 doc = gen_xmlDocPtr(n_doc, 0);
20559 name = gen_const_xmlChar_ptr(n_name, 1);
20560 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 2);
20561 SystemID = gen_const_xmlChar_ptr(n_SystemID, 3);
20562
20563 ret_val = xmlNewDtd(doc, name, ExternalID, SystemID);
20564 desret_xmlDtdPtr(ret_val);
20565 call_tests++;
20566 des_xmlDocPtr(n_doc, doc, 0);
20567 des_const_xmlChar_ptr(n_name, name, 1);
20568 des_const_xmlChar_ptr(n_ExternalID, ExternalID, 2);
20569 des_const_xmlChar_ptr(n_SystemID, SystemID, 3);
20570 xmlResetLastError();
20571 if (mem_base != xmlMemBlocks()) {
20572 printf("Leak of %d blocks found in xmlNewDtd",
20573 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020574 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000020575 printf(" %d", n_doc);
20576 printf(" %d", n_name);
20577 printf(" %d", n_ExternalID);
20578 printf(" %d", n_SystemID);
20579 printf("\n");
20580 }
20581 }
20582 }
20583 }
20584 }
20585
20586 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000020587 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020588}
20589
20590
20591static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000020592test_xmlNewNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020593 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020594
Daniel Veillard27f20102004-11-05 11:50:11 +000020595 int mem_base;
20596 xmlNodePtr ret_val;
20597 xmlNsPtr ns; /* namespace if any */
20598 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020599 xmlChar * name; /* the node name */
Daniel Veillard27f20102004-11-05 11:50:11 +000020600 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020601
Daniel Veillard27f20102004-11-05 11:50:11 +000020602 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20603 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20604 mem_base = xmlMemBlocks();
20605 ns = gen_xmlNsPtr(n_ns, 0);
20606 name = gen_const_xmlChar_ptr(n_name, 1);
20607
20608 ret_val = xmlNewNode(ns, name);
20609 desret_xmlNodePtr(ret_val);
20610 call_tests++;
20611 des_xmlNsPtr(n_ns, ns, 0);
20612 des_const_xmlChar_ptr(n_name, name, 1);
20613 xmlResetLastError();
20614 if (mem_base != xmlMemBlocks()) {
20615 printf("Leak of %d blocks found in xmlNewNode",
20616 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020617 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000020618 printf(" %d", n_ns);
20619 printf(" %d", n_name);
20620 printf("\n");
20621 }
20622 }
20623 }
20624
20625 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000020626 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020627}
20628
20629
20630static int
20631test_xmlNewNodeEatName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020632 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020633
Daniel Veillard27f20102004-11-05 11:50:11 +000020634 int mem_base;
20635 xmlNodePtr ret_val;
20636 xmlNsPtr ns; /* namespace if any */
20637 int n_ns;
20638 xmlChar * name; /* the node name */
20639 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020640
Daniel Veillard27f20102004-11-05 11:50:11 +000020641 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20642 for (n_name = 0;n_name < gen_nb_eaten_name;n_name++) {
20643 mem_base = xmlMemBlocks();
20644 ns = gen_xmlNsPtr(n_ns, 0);
20645 name = gen_eaten_name(n_name, 1);
20646
20647 ret_val = xmlNewNodeEatName(ns, name);
20648 desret_xmlNodePtr(ret_val);
20649 call_tests++;
20650 des_xmlNsPtr(n_ns, ns, 0);
20651 des_eaten_name(n_name, name, 1);
20652 xmlResetLastError();
20653 if (mem_base != xmlMemBlocks()) {
20654 printf("Leak of %d blocks found in xmlNewNodeEatName",
20655 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020656 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000020657 printf(" %d", n_ns);
20658 printf(" %d", n_name);
20659 printf("\n");
20660 }
20661 }
20662 }
20663
20664 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000020665 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020666}
20667
20668
20669static int
20670test_xmlNewNs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020671 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020672
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000020673 int mem_base;
20674 xmlNsPtr ret_val;
20675 xmlNodePtr node; /* the element carrying the namespace */
20676 int n_node;
20677 xmlChar * href; /* the URI associated */
20678 int n_href;
20679 xmlChar * prefix; /* the prefix for the namespace */
20680 int n_prefix;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020681
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000020682 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
20683 for (n_href = 0;n_href < gen_nb_const_xmlChar_ptr;n_href++) {
20684 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
20685 mem_base = xmlMemBlocks();
20686 node = gen_xmlNodePtr(n_node, 0);
20687 href = gen_const_xmlChar_ptr(n_href, 1);
20688 prefix = gen_const_xmlChar_ptr(n_prefix, 2);
20689
20690 ret_val = xmlNewNs(node, href, prefix);
20691 if ((node == NULL) && (ret_val != NULL)) xmlFreeNs(ret_val);
20692 desret_xmlNsPtr(ret_val);
20693 call_tests++;
20694 des_xmlNodePtr(n_node, node, 0);
20695 des_const_xmlChar_ptr(n_href, href, 1);
20696 des_const_xmlChar_ptr(n_prefix, prefix, 2);
20697 xmlResetLastError();
20698 if (mem_base != xmlMemBlocks()) {
20699 printf("Leak of %d blocks found in xmlNewNs",
20700 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020701 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000020702 printf(" %d", n_node);
20703 printf(" %d", n_href);
20704 printf(" %d", n_prefix);
20705 printf("\n");
20706 }
20707 }
20708 }
20709 }
20710
20711 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000020712 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020713}
20714
20715
20716static int
20717test_xmlNewNsProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020718 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020719
Daniel Veillard57b25162004-11-06 14:50:18 +000020720 int mem_base;
20721 xmlAttrPtr ret_val;
20722 xmlNodePtr node; /* the holding node */
20723 int n_node;
20724 xmlNsPtr ns; /* the namespace */
20725 int n_ns;
20726 xmlChar * name; /* the name of the attribute */
20727 int n_name;
20728 xmlChar * value; /* the value of the attribute */
20729 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020730
Daniel Veillard57b25162004-11-06 14:50:18 +000020731 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
20732 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20733 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20734 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
20735 mem_base = xmlMemBlocks();
20736 node = gen_xmlNodePtr(n_node, 0);
20737 ns = gen_xmlNsPtr(n_ns, 1);
20738 name = gen_const_xmlChar_ptr(n_name, 2);
20739 value = gen_const_xmlChar_ptr(n_value, 3);
20740
20741 ret_val = xmlNewNsProp(node, ns, name, value);
20742 desret_xmlAttrPtr(ret_val);
20743 call_tests++;
20744 des_xmlNodePtr(n_node, node, 0);
20745 des_xmlNsPtr(n_ns, ns, 1);
20746 des_const_xmlChar_ptr(n_name, name, 2);
20747 des_const_xmlChar_ptr(n_value, value, 3);
20748 xmlResetLastError();
20749 if (mem_base != xmlMemBlocks()) {
20750 printf("Leak of %d blocks found in xmlNewNsProp",
20751 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020752 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000020753 printf(" %d", n_node);
20754 printf(" %d", n_ns);
20755 printf(" %d", n_name);
20756 printf(" %d", n_value);
20757 printf("\n");
20758 }
20759 }
20760 }
20761 }
20762 }
20763
20764 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000020765 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020766}
20767
20768
20769static int
20770test_xmlNewNsPropEatName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020771 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020772
Daniel Veillard57b25162004-11-06 14:50:18 +000020773 int mem_base;
20774 xmlAttrPtr ret_val;
20775 xmlNodePtr node; /* the holding node */
20776 int n_node;
20777 xmlNsPtr ns; /* the namespace */
20778 int n_ns;
20779 xmlChar * name; /* the name of the attribute */
20780 int n_name;
20781 xmlChar * value; /* the value of the attribute */
20782 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020783
Daniel Veillard57b25162004-11-06 14:50:18 +000020784 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
20785 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20786 for (n_name = 0;n_name < gen_nb_eaten_name;n_name++) {
20787 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
20788 mem_base = xmlMemBlocks();
20789 node = gen_xmlNodePtr(n_node, 0);
20790 ns = gen_xmlNsPtr(n_ns, 1);
20791 name = gen_eaten_name(n_name, 2);
20792 value = gen_const_xmlChar_ptr(n_value, 3);
20793
20794 ret_val = xmlNewNsPropEatName(node, ns, name, value);
20795 desret_xmlAttrPtr(ret_val);
20796 call_tests++;
20797 des_xmlNodePtr(n_node, node, 0);
20798 des_xmlNsPtr(n_ns, ns, 1);
20799 des_eaten_name(n_name, name, 2);
20800 des_const_xmlChar_ptr(n_value, value, 3);
20801 xmlResetLastError();
20802 if (mem_base != xmlMemBlocks()) {
20803 printf("Leak of %d blocks found in xmlNewNsPropEatName",
20804 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020805 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000020806 printf(" %d", n_node);
20807 printf(" %d", n_ns);
20808 printf(" %d", n_name);
20809 printf(" %d", n_value);
20810 printf("\n");
20811 }
20812 }
20813 }
20814 }
20815 }
20816
20817 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000020818 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020819}
20820
20821
20822static int
20823test_xmlNewPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020824 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020825
20826 int mem_base;
20827 xmlNodePtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020828 xmlChar * name; /* the processing instruction name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020829 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020830 xmlChar * content; /* the PI content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020831 int n_content;
20832
20833 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20834 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20835 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020836 name = gen_const_xmlChar_ptr(n_name, 0);
20837 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020838
20839 ret_val = xmlNewPI(name, content);
20840 desret_xmlNodePtr(ret_val);
20841 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020842 des_const_xmlChar_ptr(n_name, name, 0);
20843 des_const_xmlChar_ptr(n_content, content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020844 xmlResetLastError();
20845 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020846 printf("Leak of %d blocks found in xmlNewPI",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020847 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020848 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020849 printf(" %d", n_name);
20850 printf(" %d", n_content);
20851 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020852 }
20853 }
20854 }
20855
Daniel Veillard3d97e662004-11-04 10:49:00 +000020856 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000020857 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020858}
20859
20860
20861static int
20862test_xmlNewProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020863 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020864
Daniel Veillarda521d282004-11-09 14:59:59 +000020865#ifdef LIBXML_TREE_ENABLED
Daniel Veillard57b25162004-11-06 14:50:18 +000020866 int mem_base;
20867 xmlAttrPtr ret_val;
20868 xmlNodePtr node; /* the holding node */
20869 int n_node;
20870 xmlChar * name; /* the name of the attribute */
20871 int n_name;
20872 xmlChar * value; /* the value of the attribute */
20873 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020874
Daniel Veillard57b25162004-11-06 14:50:18 +000020875 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
20876 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20877 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
20878 mem_base = xmlMemBlocks();
20879 node = gen_xmlNodePtr(n_node, 0);
20880 name = gen_const_xmlChar_ptr(n_name, 1);
20881 value = gen_const_xmlChar_ptr(n_value, 2);
20882
20883 ret_val = xmlNewProp(node, name, value);
20884 desret_xmlAttrPtr(ret_val);
20885 call_tests++;
20886 des_xmlNodePtr(n_node, node, 0);
20887 des_const_xmlChar_ptr(n_name, name, 1);
20888 des_const_xmlChar_ptr(n_value, value, 2);
20889 xmlResetLastError();
20890 if (mem_base != xmlMemBlocks()) {
20891 printf("Leak of %d blocks found in xmlNewProp",
20892 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020893 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000020894 printf(" %d", n_node);
20895 printf(" %d", n_name);
20896 printf(" %d", n_value);
20897 printf("\n");
20898 }
20899 }
20900 }
20901 }
Daniel Veillarda521d282004-11-09 14:59:59 +000020902#endif
Daniel Veillard57b25162004-11-06 14:50:18 +000020903
20904 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000020905 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020906}
20907
20908
20909static int
20910test_xmlNewReference(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020911 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020912
20913 int mem_base;
20914 xmlNodePtr ret_val;
20915 xmlDocPtr doc; /* the document */
20916 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020917 xmlChar * name; /* the reference name, or the reference string with & and ; */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020918 int n_name;
20919
20920 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20921 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20922 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020923 doc = gen_xmlDocPtr(n_doc, 0);
20924 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020925
20926 ret_val = xmlNewReference(doc, name);
20927 desret_xmlNodePtr(ret_val);
20928 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020929 des_xmlDocPtr(n_doc, doc, 0);
20930 des_const_xmlChar_ptr(n_name, name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020931 xmlResetLastError();
20932 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020933 printf("Leak of %d blocks found in xmlNewReference",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020934 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020935 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020936 printf(" %d", n_doc);
20937 printf(" %d", n_name);
20938 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020939 }
20940 }
20941 }
20942
Daniel Veillard3d97e662004-11-04 10:49:00 +000020943 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000020944 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020945}
20946
20947
20948static int
20949test_xmlNewText(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020950 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020951
20952 int mem_base;
20953 xmlNodePtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020954 xmlChar * content; /* the text content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020955 int n_content;
20956
20957 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20958 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020959 content = gen_const_xmlChar_ptr(n_content, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020960
20961 ret_val = xmlNewText(content);
20962 desret_xmlNodePtr(ret_val);
20963 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020964 des_const_xmlChar_ptr(n_content, content, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020965 xmlResetLastError();
20966 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020967 printf("Leak of %d blocks found in xmlNewText",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020968 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020969 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020970 printf(" %d", n_content);
20971 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020972 }
20973 }
20974
Daniel Veillard3d97e662004-11-04 10:49:00 +000020975 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000020976 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020977}
20978
20979
20980static int
20981test_xmlNewTextChild(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020982 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020983
Daniel Veillarda521d282004-11-09 14:59:59 +000020984#ifdef LIBXML_TREE_ENABLED
Daniel Veillard27f20102004-11-05 11:50:11 +000020985 int mem_base;
20986 xmlNodePtr ret_val;
20987 xmlNodePtr parent; /* the parent node */
20988 int n_parent;
20989 xmlNsPtr ns; /* a namespace if any */
20990 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020991 xmlChar * name; /* the name of the child */
Daniel Veillard27f20102004-11-05 11:50:11 +000020992 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020993 xmlChar * content; /* the text content of the child if any. */
Daniel Veillard27f20102004-11-05 11:50:11 +000020994 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020995
Daniel Veillard27f20102004-11-05 11:50:11 +000020996 for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) {
20997 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20998 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20999 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
21000 mem_base = xmlMemBlocks();
21001 parent = gen_xmlNodePtr(n_parent, 0);
21002 ns = gen_xmlNsPtr(n_ns, 1);
21003 name = gen_const_xmlChar_ptr(n_name, 2);
21004 content = gen_const_xmlChar_ptr(n_content, 3);
21005
21006 ret_val = xmlNewTextChild(parent, ns, name, content);
21007 desret_xmlNodePtr(ret_val);
21008 call_tests++;
21009 des_xmlNodePtr(n_parent, parent, 0);
21010 des_xmlNsPtr(n_ns, ns, 1);
21011 des_const_xmlChar_ptr(n_name, name, 2);
21012 des_const_xmlChar_ptr(n_content, content, 3);
21013 xmlResetLastError();
21014 if (mem_base != xmlMemBlocks()) {
21015 printf("Leak of %d blocks found in xmlNewTextChild",
21016 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021017 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000021018 printf(" %d", n_parent);
21019 printf(" %d", n_ns);
21020 printf(" %d", n_name);
21021 printf(" %d", n_content);
21022 printf("\n");
21023 }
21024 }
21025 }
21026 }
21027 }
Daniel Veillarda521d282004-11-09 14:59:59 +000021028#endif
Daniel Veillard27f20102004-11-05 11:50:11 +000021029
21030 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000021031 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021032}
21033
21034
21035static int
21036test_xmlNewTextLen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021037 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021038
21039 int mem_base;
21040 xmlNodePtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021041 xmlChar * content; /* the text content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021042 int n_content;
21043 int len; /* the text len. */
21044 int n_len;
21045
21046 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
21047 for (n_len = 0;n_len < gen_nb_int;n_len++) {
21048 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021049 content = gen_const_xmlChar_ptr(n_content, 0);
21050 len = gen_int(n_len, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021051
21052 ret_val = xmlNewTextLen(content, len);
21053 desret_xmlNodePtr(ret_val);
21054 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021055 des_const_xmlChar_ptr(n_content, content, 0);
21056 des_int(n_len, len, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021057 xmlResetLastError();
21058 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021059 printf("Leak of %d blocks found in xmlNewTextLen",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021060 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021061 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021062 printf(" %d", n_content);
21063 printf(" %d", n_len);
21064 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021065 }
21066 }
21067 }
21068
Daniel Veillard3d97e662004-11-04 10:49:00 +000021069 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000021070 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021071}
21072
21073
21074static int
21075test_xmlNodeAddContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021076 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021077
21078 int mem_base;
21079 xmlNodePtr cur; /* the node being modified */
21080 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021081 xmlChar * content; /* extra content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021082 int n_content;
21083
21084 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21085 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
21086 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021087 cur = gen_xmlNodePtr(n_cur, 0);
21088 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021089
21090 xmlNodeAddContent(cur, content);
21091 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021092 des_xmlNodePtr(n_cur, cur, 0);
21093 des_const_xmlChar_ptr(n_content, content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021094 xmlResetLastError();
21095 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021096 printf("Leak of %d blocks found in xmlNodeAddContent",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021097 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021098 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021099 printf(" %d", n_cur);
21100 printf(" %d", n_content);
21101 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021102 }
21103 }
21104 }
21105
Daniel Veillard3d97e662004-11-04 10:49:00 +000021106 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000021107 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021108}
21109
21110
21111static int
21112test_xmlNodeAddContentLen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021113 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021114
21115 int mem_base;
21116 xmlNodePtr cur; /* the node being modified */
21117 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021118 xmlChar * content; /* extra content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021119 int n_content;
21120 int len; /* the size of @content */
21121 int n_len;
21122
21123 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21124 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
21125 for (n_len = 0;n_len < gen_nb_int;n_len++) {
21126 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021127 cur = gen_xmlNodePtr(n_cur, 0);
21128 content = gen_const_xmlChar_ptr(n_content, 1);
21129 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021130
21131 xmlNodeAddContentLen(cur, content, len);
21132 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021133 des_xmlNodePtr(n_cur, cur, 0);
21134 des_const_xmlChar_ptr(n_content, content, 1);
21135 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021136 xmlResetLastError();
21137 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021138 printf("Leak of %d blocks found in xmlNodeAddContentLen",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021139 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021140 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021141 printf(" %d", n_cur);
21142 printf(" %d", n_content);
21143 printf(" %d", n_len);
21144 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021145 }
21146 }
21147 }
21148 }
21149
Daniel Veillard3d97e662004-11-04 10:49:00 +000021150 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000021151 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021152}
21153
21154
21155static int
21156test_xmlNodeBufGetContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021157 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021158
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021159 int mem_base;
21160 int ret_val;
21161 xmlBufferPtr buffer; /* a buffer */
21162 int n_buffer;
21163 xmlNodePtr cur; /* the node being read */
21164 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021165
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021166 for (n_buffer = 0;n_buffer < gen_nb_xmlBufferPtr;n_buffer++) {
21167 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21168 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021169 buffer = gen_xmlBufferPtr(n_buffer, 0);
21170 cur = gen_xmlNodePtr(n_cur, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021171
21172 ret_val = xmlNodeBufGetContent(buffer, cur);
21173 desret_int(ret_val);
21174 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021175 des_xmlBufferPtr(n_buffer, buffer, 0);
21176 des_xmlNodePtr(n_cur, cur, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021177 xmlResetLastError();
21178 if (mem_base != xmlMemBlocks()) {
21179 printf("Leak of %d blocks found in xmlNodeBufGetContent",
21180 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021181 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021182 printf(" %d", n_buffer);
21183 printf(" %d", n_cur);
21184 printf("\n");
21185 }
21186 }
21187 }
21188
Daniel Veillard3d97e662004-11-04 10:49:00 +000021189 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000021190 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021191}
21192
21193
21194static int
21195test_xmlNodeDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021196 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021197
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021198#ifdef LIBXML_OUTPUT_ENABLED
21199 int mem_base;
21200 int ret_val;
21201 xmlBufferPtr buf; /* the XML buffer output */
21202 int n_buf;
21203 xmlDocPtr doc; /* the document */
21204 int n_doc;
21205 xmlNodePtr cur; /* the current node */
21206 int n_cur;
21207 int level; /* the imbrication level for indenting */
21208 int n_level;
21209 int format; /* is formatting allowed */
21210 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021211
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021212 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
21213 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21214 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21215 for (n_level = 0;n_level < gen_nb_int;n_level++) {
21216 for (n_format = 0;n_format < gen_nb_int;n_format++) {
21217 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021218 buf = gen_xmlBufferPtr(n_buf, 0);
21219 doc = gen_xmlDocPtr(n_doc, 1);
21220 cur = gen_xmlNodePtr(n_cur, 2);
21221 level = gen_int(n_level, 3);
21222 format = gen_int(n_format, 4);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021223
21224 ret_val = xmlNodeDump(buf, doc, cur, level, format);
21225 desret_int(ret_val);
21226 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021227 des_xmlBufferPtr(n_buf, buf, 0);
21228 des_xmlDocPtr(n_doc, doc, 1);
21229 des_xmlNodePtr(n_cur, cur, 2);
21230 des_int(n_level, level, 3);
21231 des_int(n_format, format, 4);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021232 xmlResetLastError();
21233 if (mem_base != xmlMemBlocks()) {
21234 printf("Leak of %d blocks found in xmlNodeDump",
21235 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021236 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021237 printf(" %d", n_buf);
21238 printf(" %d", n_doc);
21239 printf(" %d", n_cur);
21240 printf(" %d", n_level);
21241 printf(" %d", n_format);
21242 printf("\n");
21243 }
21244 }
21245 }
21246 }
21247 }
21248 }
21249#endif
21250
Daniel Veillard3d97e662004-11-04 10:49:00 +000021251 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000021252 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021253}
21254
21255
21256static int
21257test_xmlNodeDumpOutput(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021258 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021259
Daniel Veillard3d97e662004-11-04 10:49:00 +000021260#ifdef LIBXML_OUTPUT_ENABLED
21261 int mem_base;
21262 xmlOutputBufferPtr buf; /* the XML buffer output */
21263 int n_buf;
21264 xmlDocPtr doc; /* the document */
21265 int n_doc;
21266 xmlNodePtr cur; /* the current node */
21267 int n_cur;
21268 int level; /* the imbrication level for indenting */
21269 int n_level;
21270 int format; /* is formatting allowed */
21271 int n_format;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021272 char * encoding; /* an optional encoding string */
Daniel Veillard3d97e662004-11-04 10:49:00 +000021273 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021274
Daniel Veillard3d97e662004-11-04 10:49:00 +000021275 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
21276 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21277 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21278 for (n_level = 0;n_level < gen_nb_int;n_level++) {
21279 for (n_format = 0;n_format < gen_nb_int;n_format++) {
21280 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
21281 mem_base = xmlMemBlocks();
21282 buf = gen_xmlOutputBufferPtr(n_buf, 0);
21283 doc = gen_xmlDocPtr(n_doc, 1);
21284 cur = gen_xmlNodePtr(n_cur, 2);
21285 level = gen_int(n_level, 3);
21286 format = gen_int(n_format, 4);
21287 encoding = gen_const_char_ptr(n_encoding, 5);
21288
21289 xmlNodeDumpOutput(buf, doc, cur, level, format, encoding);
21290 call_tests++;
21291 des_xmlOutputBufferPtr(n_buf, buf, 0);
21292 des_xmlDocPtr(n_doc, doc, 1);
21293 des_xmlNodePtr(n_cur, cur, 2);
21294 des_int(n_level, level, 3);
21295 des_int(n_format, format, 4);
21296 des_const_char_ptr(n_encoding, encoding, 5);
21297 xmlResetLastError();
21298 if (mem_base != xmlMemBlocks()) {
21299 printf("Leak of %d blocks found in xmlNodeDumpOutput",
21300 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021301 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021302 printf(" %d", n_buf);
21303 printf(" %d", n_doc);
21304 printf(" %d", n_cur);
21305 printf(" %d", n_level);
21306 printf(" %d", n_format);
21307 printf(" %d", n_encoding);
21308 printf("\n");
21309 }
21310 }
21311 }
21312 }
21313 }
21314 }
21315 }
21316#endif
21317
21318 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000021319 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021320}
21321
21322
21323static int
21324test_xmlNodeGetBase(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021325 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021326
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021327 int mem_base;
21328 xmlChar * ret_val;
21329 xmlDocPtr doc; /* the document the node pertains to */
21330 int n_doc;
21331 xmlNodePtr cur; /* the node being checked */
21332 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021333
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021334 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21335 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21336 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021337 doc = gen_xmlDocPtr(n_doc, 0);
21338 cur = gen_xmlNodePtr(n_cur, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021339
21340 ret_val = xmlNodeGetBase(doc, cur);
21341 desret_xmlChar_ptr(ret_val);
21342 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021343 des_xmlDocPtr(n_doc, doc, 0);
21344 des_xmlNodePtr(n_cur, cur, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021345 xmlResetLastError();
21346 if (mem_base != xmlMemBlocks()) {
21347 printf("Leak of %d blocks found in xmlNodeGetBase",
21348 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021349 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021350 printf(" %d", n_doc);
21351 printf(" %d", n_cur);
21352 printf("\n");
21353 }
21354 }
21355 }
21356
Daniel Veillard3d97e662004-11-04 10:49:00 +000021357 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000021358 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021359}
21360
21361
21362static int
21363test_xmlNodeGetContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021364 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021365
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021366 int mem_base;
21367 xmlChar * ret_val;
21368 xmlNodePtr cur; /* the node being read */
21369 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021370
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021371 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21372 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021373 cur = gen_xmlNodePtr(n_cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021374
21375 ret_val = xmlNodeGetContent(cur);
21376 desret_xmlChar_ptr(ret_val);
21377 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021378 des_xmlNodePtr(n_cur, cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021379 xmlResetLastError();
21380 if (mem_base != xmlMemBlocks()) {
21381 printf("Leak of %d blocks found in xmlNodeGetContent",
21382 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021383 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021384 printf(" %d", n_cur);
21385 printf("\n");
21386 }
21387 }
21388
Daniel Veillard3d97e662004-11-04 10:49:00 +000021389 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000021390 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021391}
21392
21393
21394static int
21395test_xmlNodeGetLang(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021396 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021397
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021398 int mem_base;
21399 xmlChar * ret_val;
21400 xmlNodePtr cur; /* the node being checked */
21401 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021402
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021403 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21404 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021405 cur = gen_xmlNodePtr(n_cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021406
21407 ret_val = xmlNodeGetLang(cur);
21408 desret_xmlChar_ptr(ret_val);
21409 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021410 des_xmlNodePtr(n_cur, cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021411 xmlResetLastError();
21412 if (mem_base != xmlMemBlocks()) {
21413 printf("Leak of %d blocks found in xmlNodeGetLang",
21414 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021415 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021416 printf(" %d", n_cur);
21417 printf("\n");
21418 }
21419 }
21420
Daniel Veillard3d97e662004-11-04 10:49:00 +000021421 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000021422 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021423}
21424
21425
21426static int
21427test_xmlNodeGetSpacePreserve(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021428 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021429
21430 int mem_base;
21431 int ret_val;
21432 xmlNodePtr cur; /* the node being checked */
21433 int n_cur;
21434
21435 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21436 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021437 cur = gen_xmlNodePtr(n_cur, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021438
21439 ret_val = xmlNodeGetSpacePreserve(cur);
21440 desret_int(ret_val);
21441 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021442 des_xmlNodePtr(n_cur, cur, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021443 xmlResetLastError();
21444 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021445 printf("Leak of %d blocks found in xmlNodeGetSpacePreserve",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021446 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021447 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021448 printf(" %d", n_cur);
21449 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021450 }
21451 }
21452
Daniel Veillard3d97e662004-11-04 10:49:00 +000021453 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000021454 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021455}
21456
21457
21458static int
21459test_xmlNodeIsText(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021460 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021461
21462 int mem_base;
21463 int ret_val;
21464 xmlNodePtr node; /* the node */
21465 int n_node;
21466
21467 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
21468 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021469 node = gen_xmlNodePtr(n_node, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021470
21471 ret_val = xmlNodeIsText(node);
21472 desret_int(ret_val);
21473 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021474 des_xmlNodePtr(n_node, node, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021475 xmlResetLastError();
21476 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021477 printf("Leak of %d blocks found in xmlNodeIsText",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021478 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021479 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021480 printf(" %d", n_node);
21481 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021482 }
21483 }
21484
Daniel Veillard3d97e662004-11-04 10:49:00 +000021485 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000021486 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021487}
21488
21489
21490static int
21491test_xmlNodeListGetRawString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021492 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021493
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021494#ifdef LIBXML_TREE_ENABLED
21495 int mem_base;
21496 xmlChar * ret_val;
21497 xmlDocPtr doc; /* the document */
21498 int n_doc;
21499 xmlNodePtr list; /* a Node list */
21500 int n_list;
21501 int inLine; /* should we replace entity contents or show their external form */
21502 int n_inLine;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021503
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021504 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21505 for (n_list = 0;n_list < gen_nb_xmlNodePtr;n_list++) {
21506 for (n_inLine = 0;n_inLine < gen_nb_int;n_inLine++) {
21507 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021508 doc = gen_xmlDocPtr(n_doc, 0);
21509 list = gen_xmlNodePtr(n_list, 1);
21510 inLine = gen_int(n_inLine, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021511
21512 ret_val = xmlNodeListGetRawString(doc, list, inLine);
21513 desret_xmlChar_ptr(ret_val);
21514 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021515 des_xmlDocPtr(n_doc, doc, 0);
21516 des_xmlNodePtr(n_list, list, 1);
21517 des_int(n_inLine, inLine, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021518 xmlResetLastError();
21519 if (mem_base != xmlMemBlocks()) {
21520 printf("Leak of %d blocks found in xmlNodeListGetRawString",
21521 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021522 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021523 printf(" %d", n_doc);
21524 printf(" %d", n_list);
21525 printf(" %d", n_inLine);
21526 printf("\n");
21527 }
21528 }
21529 }
21530 }
21531#endif
21532
Daniel Veillard3d97e662004-11-04 10:49:00 +000021533 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000021534 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021535}
21536
21537
21538static int
21539test_xmlNodeListGetString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021540 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021541
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021542 int mem_base;
21543 xmlChar * ret_val;
21544 xmlDocPtr doc; /* the document */
21545 int n_doc;
21546 xmlNodePtr list; /* a Node list */
21547 int n_list;
21548 int inLine; /* should we replace entity contents or show their external form */
21549 int n_inLine;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021550
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021551 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21552 for (n_list = 0;n_list < gen_nb_xmlNodePtr;n_list++) {
21553 for (n_inLine = 0;n_inLine < gen_nb_int;n_inLine++) {
21554 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021555 doc = gen_xmlDocPtr(n_doc, 0);
21556 list = gen_xmlNodePtr(n_list, 1);
21557 inLine = gen_int(n_inLine, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021558
21559 ret_val = xmlNodeListGetString(doc, list, inLine);
21560 desret_xmlChar_ptr(ret_val);
21561 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021562 des_xmlDocPtr(n_doc, doc, 0);
21563 des_xmlNodePtr(n_list, list, 1);
21564 des_int(n_inLine, inLine, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021565 xmlResetLastError();
21566 if (mem_base != xmlMemBlocks()) {
21567 printf("Leak of %d blocks found in xmlNodeListGetString",
21568 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021569 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021570 printf(" %d", n_doc);
21571 printf(" %d", n_list);
21572 printf(" %d", n_inLine);
21573 printf("\n");
21574 }
21575 }
21576 }
21577 }
21578
Daniel Veillard3d97e662004-11-04 10:49:00 +000021579 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000021580 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021581}
21582
21583
21584static int
21585test_xmlNodeSetBase(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021586 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021587
21588#ifdef LIBXML_TREE_ENABLED
21589 int mem_base;
21590 xmlNodePtr cur; /* the node being changed */
21591 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021592 xmlChar * uri; /* the new base URI */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021593 int n_uri;
21594
21595 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21596 for (n_uri = 0;n_uri < gen_nb_const_xmlChar_ptr;n_uri++) {
21597 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021598 cur = gen_xmlNodePtr(n_cur, 0);
21599 uri = gen_const_xmlChar_ptr(n_uri, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021600
21601 xmlNodeSetBase(cur, uri);
21602 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021603 des_xmlNodePtr(n_cur, cur, 0);
21604 des_const_xmlChar_ptr(n_uri, uri, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021605 xmlResetLastError();
21606 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021607 printf("Leak of %d blocks found in xmlNodeSetBase",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021608 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021609 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021610 printf(" %d", n_cur);
21611 printf(" %d", n_uri);
21612 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021613 }
21614 }
21615 }
21616#endif
21617
Daniel Veillard3d97e662004-11-04 10:49:00 +000021618 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000021619 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021620}
21621
21622
21623static int
21624test_xmlNodeSetContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021625 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021626
21627 int mem_base;
21628 xmlNodePtr cur; /* the node being modified */
21629 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021630 xmlChar * content; /* the new value of the content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021631 int n_content;
21632
21633 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21634 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
21635 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021636 cur = gen_xmlNodePtr(n_cur, 0);
21637 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021638
21639 xmlNodeSetContent(cur, content);
21640 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021641 des_xmlNodePtr(n_cur, cur, 0);
21642 des_const_xmlChar_ptr(n_content, content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021643 xmlResetLastError();
21644 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021645 printf("Leak of %d blocks found in xmlNodeSetContent",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021646 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021647 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021648 printf(" %d", n_cur);
21649 printf(" %d", n_content);
21650 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021651 }
21652 }
21653 }
21654
Daniel Veillard3d97e662004-11-04 10:49:00 +000021655 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000021656 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021657}
21658
21659
21660static int
21661test_xmlNodeSetContentLen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021662 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021663
21664#ifdef LIBXML_TREE_ENABLED
21665 int mem_base;
21666 xmlNodePtr cur; /* the node being modified */
21667 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021668 xmlChar * content; /* the new value of the content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021669 int n_content;
21670 int len; /* the size of @content */
21671 int n_len;
21672
21673 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21674 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
21675 for (n_len = 0;n_len < gen_nb_int;n_len++) {
21676 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021677 cur = gen_xmlNodePtr(n_cur, 0);
21678 content = gen_const_xmlChar_ptr(n_content, 1);
21679 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021680
21681 xmlNodeSetContentLen(cur, content, len);
21682 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021683 des_xmlNodePtr(n_cur, cur, 0);
21684 des_const_xmlChar_ptr(n_content, content, 1);
21685 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021686 xmlResetLastError();
21687 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021688 printf("Leak of %d blocks found in xmlNodeSetContentLen",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021689 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021690 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021691 printf(" %d", n_cur);
21692 printf(" %d", n_content);
21693 printf(" %d", n_len);
21694 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021695 }
21696 }
21697 }
21698 }
21699#endif
21700
Daniel Veillard3d97e662004-11-04 10:49:00 +000021701 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000021702 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021703}
21704
21705
21706static int
21707test_xmlNodeSetLang(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021708 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021709
21710#ifdef LIBXML_TREE_ENABLED
21711 int mem_base;
21712 xmlNodePtr cur; /* the node being changed */
21713 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021714 xmlChar * lang; /* the language description */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021715 int n_lang;
21716
21717 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21718 for (n_lang = 0;n_lang < gen_nb_const_xmlChar_ptr;n_lang++) {
21719 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021720 cur = gen_xmlNodePtr(n_cur, 0);
21721 lang = gen_const_xmlChar_ptr(n_lang, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021722
21723 xmlNodeSetLang(cur, lang);
21724 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021725 des_xmlNodePtr(n_cur, cur, 0);
21726 des_const_xmlChar_ptr(n_lang, lang, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021727 xmlResetLastError();
21728 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021729 printf("Leak of %d blocks found in xmlNodeSetLang",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021730 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021731 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021732 printf(" %d", n_cur);
21733 printf(" %d", n_lang);
21734 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021735 }
21736 }
21737 }
21738#endif
21739
Daniel Veillard3d97e662004-11-04 10:49:00 +000021740 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000021741 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021742}
21743
21744
21745static int
21746test_xmlNodeSetName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021747 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021748
21749#ifdef LIBXML_TREE_ENABLED
21750 int mem_base;
21751 xmlNodePtr cur; /* the node being changed */
21752 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021753 xmlChar * name; /* the new tag name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021754 int n_name;
21755
21756 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21757 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
21758 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021759 cur = gen_xmlNodePtr(n_cur, 0);
21760 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021761
21762 xmlNodeSetName(cur, name);
21763 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021764 des_xmlNodePtr(n_cur, cur, 0);
21765 des_const_xmlChar_ptr(n_name, name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021766 xmlResetLastError();
21767 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021768 printf("Leak of %d blocks found in xmlNodeSetName",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021769 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021770 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021771 printf(" %d", n_cur);
21772 printf(" %d", n_name);
21773 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021774 }
21775 }
21776 }
21777#endif
21778
Daniel Veillard3d97e662004-11-04 10:49:00 +000021779 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000021780 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021781}
21782
21783
21784static int
21785test_xmlNodeSetSpacePreserve(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021786 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021787
21788#ifdef LIBXML_TREE_ENABLED
21789 int mem_base;
21790 xmlNodePtr cur; /* the node being changed */
21791 int n_cur;
21792 int val; /* the xml:space value ("0": default, 1: "preserve") */
21793 int n_val;
21794
21795 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21796 for (n_val = 0;n_val < gen_nb_int;n_val++) {
21797 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021798 cur = gen_xmlNodePtr(n_cur, 0);
21799 val = gen_int(n_val, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021800
21801 xmlNodeSetSpacePreserve(cur, val);
21802 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021803 des_xmlNodePtr(n_cur, cur, 0);
21804 des_int(n_val, val, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021805 xmlResetLastError();
21806 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021807 printf("Leak of %d blocks found in xmlNodeSetSpacePreserve",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021808 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021809 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021810 printf(" %d", n_cur);
21811 printf(" %d", n_val);
21812 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021813 }
21814 }
21815 }
21816#endif
21817
Daniel Veillard3d97e662004-11-04 10:49:00 +000021818 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000021819 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021820}
21821
21822
21823static int
21824test_xmlReconciliateNs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021825 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021826
Daniel Veillarda521d282004-11-09 14:59:59 +000021827#ifdef LIBXML_TREE_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000021828 int mem_base;
21829 int ret_val;
21830 xmlDocPtr doc; /* the document */
21831 int n_doc;
21832 xmlNodePtr tree; /* a node defining the subtree to reconciliate */
21833 int n_tree;
21834
21835 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21836 for (n_tree = 0;n_tree < gen_nb_xmlNodePtr;n_tree++) {
21837 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021838 doc = gen_xmlDocPtr(n_doc, 0);
21839 tree = gen_xmlNodePtr(n_tree, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021840
21841 ret_val = xmlReconciliateNs(doc, tree);
21842 desret_int(ret_val);
21843 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021844 des_xmlDocPtr(n_doc, doc, 0);
21845 des_xmlNodePtr(n_tree, tree, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021846 xmlResetLastError();
21847 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021848 printf("Leak of %d blocks found in xmlReconciliateNs",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021849 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021850 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021851 printf(" %d", n_doc);
21852 printf(" %d", n_tree);
21853 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021854 }
21855 }
21856 }
Daniel Veillarda521d282004-11-09 14:59:59 +000021857#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000021858
Daniel Veillard3d97e662004-11-04 10:49:00 +000021859 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000021860 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021861}
21862
21863
21864static int
21865test_xmlRemoveProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021866 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021867
Daniel Veillardce244ad2004-11-05 10:03:46 +000021868#ifdef LIBXML_TREE_ENABLED
21869 int mem_base;
21870 int ret_val;
21871 xmlAttrPtr cur; /* an attribute */
21872 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021873
Daniel Veillardce244ad2004-11-05 10:03:46 +000021874 for (n_cur = 0;n_cur < gen_nb_xmlAttrPtr;n_cur++) {
21875 mem_base = xmlMemBlocks();
21876 cur = gen_xmlAttrPtr(n_cur, 0);
21877
21878 ret_val = xmlRemoveProp(cur);
21879 cur = NULL;
21880 desret_int(ret_val);
21881 call_tests++;
21882 des_xmlAttrPtr(n_cur, cur, 0);
21883 xmlResetLastError();
21884 if (mem_base != xmlMemBlocks()) {
21885 printf("Leak of %d blocks found in xmlRemoveProp",
21886 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021887 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000021888 printf(" %d", n_cur);
21889 printf("\n");
21890 }
21891 }
21892#endif
21893
21894 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000021895 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021896}
21897
21898
21899static int
21900test_xmlReplaceNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021901 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021902
21903#ifdef LIBXML_TREE_ENABLED
21904 int mem_base;
21905 xmlNodePtr ret_val;
21906 xmlNodePtr old; /* the old node */
21907 int n_old;
21908 xmlNodePtr cur; /* the node */
21909 int n_cur;
21910
21911 for (n_old = 0;n_old < gen_nb_xmlNodePtr;n_old++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021912 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr_in;n_cur++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000021913 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021914 old = gen_xmlNodePtr(n_old, 0);
21915 cur = gen_xmlNodePtr_in(n_cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021916
21917 ret_val = xmlReplaceNode(old, cur);
Daniel Veillardce244ad2004-11-05 10:03:46 +000021918 if (cur != NULL) {
21919 xmlUnlinkNode(cur);
Daniel Veillarda03e3652004-11-02 18:45:30 +000021920 xmlFreeNode(cur) ; cur = NULL ; }
Daniel Veillardce244ad2004-11-05 10:03:46 +000021921 if (old != NULL) {
21922 xmlUnlinkNode(old);
21923 xmlFreeNode(old) ; old = NULL ; }
21924 ret_val = NULL;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021925 desret_xmlNodePtr(ret_val);
21926 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021927 des_xmlNodePtr(n_old, old, 0);
21928 des_xmlNodePtr_in(n_cur, cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021929 xmlResetLastError();
21930 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021931 printf("Leak of %d blocks found in xmlReplaceNode",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021932 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021933 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021934 printf(" %d", n_old);
21935 printf(" %d", n_cur);
21936 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021937 }
21938 }
21939 }
21940#endif
21941
Daniel Veillard3d97e662004-11-04 10:49:00 +000021942 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000021943 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021944}
21945
21946
21947static int
21948test_xmlSaveFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021949 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021950
21951#ifdef LIBXML_OUTPUT_ENABLED
21952 int mem_base;
21953 int ret_val;
21954 const char * filename; /* the filename (or URL) */
21955 int n_filename;
21956 xmlDocPtr cur; /* the document */
21957 int n_cur;
21958
21959 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
21960 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
21961 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021962 filename = gen_fileoutput(n_filename, 0);
21963 cur = gen_xmlDocPtr(n_cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021964
21965 ret_val = xmlSaveFile(filename, cur);
21966 desret_int(ret_val);
21967 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021968 des_fileoutput(n_filename, filename, 0);
21969 des_xmlDocPtr(n_cur, cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021970 xmlResetLastError();
21971 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021972 printf("Leak of %d blocks found in xmlSaveFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021973 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021974 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021975 printf(" %d", n_filename);
21976 printf(" %d", n_cur);
21977 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021978 }
21979 }
21980 }
21981#endif
21982
Daniel Veillard3d97e662004-11-04 10:49:00 +000021983 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000021984 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021985}
21986
21987
21988static int
21989test_xmlSaveFileEnc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021990 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021991
21992#ifdef LIBXML_OUTPUT_ENABLED
21993 int mem_base;
21994 int ret_val;
21995 const char * filename; /* the filename (or URL) */
21996 int n_filename;
21997 xmlDocPtr cur; /* the document */
21998 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021999 char * encoding; /* the name of an encoding (or NULL) */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022000 int n_encoding;
22001
22002 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
22003 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
22004 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
22005 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022006 filename = gen_fileoutput(n_filename, 0);
22007 cur = gen_xmlDocPtr(n_cur, 1);
22008 encoding = gen_const_char_ptr(n_encoding, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022009
22010 ret_val = xmlSaveFileEnc(filename, cur, encoding);
22011 desret_int(ret_val);
22012 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022013 des_fileoutput(n_filename, filename, 0);
22014 des_xmlDocPtr(n_cur, cur, 1);
22015 des_const_char_ptr(n_encoding, encoding, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022016 xmlResetLastError();
22017 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022018 printf("Leak of %d blocks found in xmlSaveFileEnc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022019 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022020 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022021 printf(" %d", n_filename);
22022 printf(" %d", n_cur);
22023 printf(" %d", n_encoding);
22024 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022025 }
22026 }
22027 }
22028 }
22029#endif
22030
Daniel Veillard3d97e662004-11-04 10:49:00 +000022031 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000022032 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022033}
22034
22035
22036static int
22037test_xmlSaveFileTo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022038 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022039
Daniel Veillard3d97e662004-11-04 10:49:00 +000022040#ifdef LIBXML_OUTPUT_ENABLED
22041 int mem_base;
22042 int ret_val;
22043 xmlOutputBufferPtr buf; /* an output I/O buffer */
22044 int n_buf;
22045 xmlDocPtr cur; /* the document */
22046 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022047 char * encoding; /* the encoding if any assuming the I/O layer handles the trancoding */
Daniel Veillard3d97e662004-11-04 10:49:00 +000022048 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022049
Daniel Veillard3d97e662004-11-04 10:49:00 +000022050 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
22051 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
22052 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
22053 mem_base = xmlMemBlocks();
22054 buf = gen_xmlOutputBufferPtr(n_buf, 0);
22055 cur = gen_xmlDocPtr(n_cur, 1);
22056 encoding = gen_const_char_ptr(n_encoding, 2);
22057
22058 ret_val = xmlSaveFileTo(buf, cur, encoding);
22059 buf = NULL;
22060 desret_int(ret_val);
22061 call_tests++;
22062 des_xmlOutputBufferPtr(n_buf, buf, 0);
22063 des_xmlDocPtr(n_cur, cur, 1);
22064 des_const_char_ptr(n_encoding, encoding, 2);
22065 xmlResetLastError();
22066 if (mem_base != xmlMemBlocks()) {
22067 printf("Leak of %d blocks found in xmlSaveFileTo",
22068 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022069 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022070 printf(" %d", n_buf);
22071 printf(" %d", n_cur);
22072 printf(" %d", n_encoding);
22073 printf("\n");
22074 }
22075 }
22076 }
22077 }
22078#endif
22079
22080 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000022081 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022082}
22083
22084
22085static int
22086test_xmlSaveFormatFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022087 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022088
22089#ifdef LIBXML_OUTPUT_ENABLED
22090 int mem_base;
22091 int ret_val;
22092 const char * filename; /* the filename (or URL) */
22093 int n_filename;
22094 xmlDocPtr cur; /* the document */
22095 int n_cur;
22096 int format; /* should formatting spaces been added */
22097 int n_format;
22098
22099 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
22100 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
22101 for (n_format = 0;n_format < gen_nb_int;n_format++) {
22102 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022103 filename = gen_fileoutput(n_filename, 0);
22104 cur = gen_xmlDocPtr(n_cur, 1);
22105 format = gen_int(n_format, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022106
22107 ret_val = xmlSaveFormatFile(filename, cur, format);
22108 desret_int(ret_val);
22109 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022110 des_fileoutput(n_filename, filename, 0);
22111 des_xmlDocPtr(n_cur, cur, 1);
22112 des_int(n_format, format, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022113 xmlResetLastError();
22114 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022115 printf("Leak of %d blocks found in xmlSaveFormatFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022116 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022117 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022118 printf(" %d", n_filename);
22119 printf(" %d", n_cur);
22120 printf(" %d", n_format);
22121 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022122 }
22123 }
22124 }
22125 }
22126#endif
22127
Daniel Veillard3d97e662004-11-04 10:49:00 +000022128 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000022129 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022130}
22131
22132
22133static int
22134test_xmlSaveFormatFileEnc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022135 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022136
22137#ifdef LIBXML_OUTPUT_ENABLED
22138 int mem_base;
22139 int ret_val;
22140 const char * filename; /* the filename or URL to output */
22141 int n_filename;
22142 xmlDocPtr cur; /* the document being saved */
22143 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022144 char * encoding; /* the name of the encoding to use or NULL. */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022145 int n_encoding;
22146 int format; /* should formatting spaces be added. */
22147 int n_format;
22148
22149 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
22150 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
22151 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
22152 for (n_format = 0;n_format < gen_nb_int;n_format++) {
22153 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022154 filename = gen_fileoutput(n_filename, 0);
22155 cur = gen_xmlDocPtr(n_cur, 1);
22156 encoding = gen_const_char_ptr(n_encoding, 2);
22157 format = gen_int(n_format, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022158
22159 ret_val = xmlSaveFormatFileEnc(filename, cur, encoding, format);
22160 desret_int(ret_val);
22161 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022162 des_fileoutput(n_filename, filename, 0);
22163 des_xmlDocPtr(n_cur, cur, 1);
22164 des_const_char_ptr(n_encoding, encoding, 2);
22165 des_int(n_format, format, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022166 xmlResetLastError();
22167 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022168 printf("Leak of %d blocks found in xmlSaveFormatFileEnc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022169 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022170 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022171 printf(" %d", n_filename);
22172 printf(" %d", n_cur);
22173 printf(" %d", n_encoding);
22174 printf(" %d", n_format);
22175 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022176 }
22177 }
22178 }
22179 }
22180 }
22181#endif
22182
Daniel Veillard3d97e662004-11-04 10:49:00 +000022183 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000022184 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022185}
22186
22187
22188static int
22189test_xmlSaveFormatFileTo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022190 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022191
Daniel Veillard3d97e662004-11-04 10:49:00 +000022192#ifdef LIBXML_OUTPUT_ENABLED
22193 int mem_base;
22194 int ret_val;
22195 xmlOutputBufferPtr buf; /* an output I/O buffer */
22196 int n_buf;
22197 xmlDocPtr cur; /* the document */
22198 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022199 char * encoding; /* the encoding if any assuming the I/O layer handles the trancoding */
Daniel Veillard3d97e662004-11-04 10:49:00 +000022200 int n_encoding;
22201 int format; /* should formatting spaces been added */
22202 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022203
Daniel Veillard3d97e662004-11-04 10:49:00 +000022204 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
22205 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
22206 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
22207 for (n_format = 0;n_format < gen_nb_int;n_format++) {
22208 mem_base = xmlMemBlocks();
22209 buf = gen_xmlOutputBufferPtr(n_buf, 0);
22210 cur = gen_xmlDocPtr(n_cur, 1);
22211 encoding = gen_const_char_ptr(n_encoding, 2);
22212 format = gen_int(n_format, 3);
22213
22214 ret_val = xmlSaveFormatFileTo(buf, cur, encoding, format);
22215 buf = NULL;
22216 desret_int(ret_val);
22217 call_tests++;
22218 des_xmlOutputBufferPtr(n_buf, buf, 0);
22219 des_xmlDocPtr(n_cur, cur, 1);
22220 des_const_char_ptr(n_encoding, encoding, 2);
22221 des_int(n_format, format, 3);
22222 xmlResetLastError();
22223 if (mem_base != xmlMemBlocks()) {
22224 printf("Leak of %d blocks found in xmlSaveFormatFileTo",
22225 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022226 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022227 printf(" %d", n_buf);
22228 printf(" %d", n_cur);
22229 printf(" %d", n_encoding);
22230 printf(" %d", n_format);
22231 printf("\n");
22232 }
22233 }
22234 }
22235 }
22236 }
22237#endif
22238
22239 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000022240 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022241}
22242
22243
22244static int
22245test_xmlSearchNs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022246 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022247
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022248 int mem_base;
22249 xmlNsPtr ret_val;
22250 xmlDocPtr doc; /* the document */
22251 int n_doc;
22252 xmlNodePtr node; /* the current node */
22253 int n_node;
22254 xmlChar * nameSpace; /* the namespace prefix */
22255 int n_nameSpace;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022256
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022257 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
22258 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22259 for (n_nameSpace = 0;n_nameSpace < gen_nb_const_xmlChar_ptr;n_nameSpace++) {
22260 mem_base = xmlMemBlocks();
22261 doc = gen_xmlDocPtr(n_doc, 0);
22262 node = gen_xmlNodePtr(n_node, 1);
22263 nameSpace = gen_const_xmlChar_ptr(n_nameSpace, 2);
22264
22265 ret_val = xmlSearchNs(doc, node, nameSpace);
22266 desret_xmlNsPtr(ret_val);
22267 call_tests++;
22268 des_xmlDocPtr(n_doc, doc, 0);
22269 des_xmlNodePtr(n_node, node, 1);
22270 des_const_xmlChar_ptr(n_nameSpace, nameSpace, 2);
22271 xmlResetLastError();
22272 if (mem_base != xmlMemBlocks()) {
22273 printf("Leak of %d blocks found in xmlSearchNs",
22274 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022275 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022276 printf(" %d", n_doc);
22277 printf(" %d", n_node);
22278 printf(" %d", n_nameSpace);
22279 printf("\n");
22280 }
22281 }
22282 }
22283 }
22284
22285 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000022286 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022287}
22288
22289
22290static int
22291test_xmlSearchNsByHref(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022292 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022293
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022294 int mem_base;
22295 xmlNsPtr ret_val;
22296 xmlDocPtr doc; /* the document */
22297 int n_doc;
22298 xmlNodePtr node; /* the current node */
22299 int n_node;
22300 xmlChar * href; /* the namespace value */
22301 int n_href;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022302
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022303 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
22304 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22305 for (n_href = 0;n_href < gen_nb_const_xmlChar_ptr;n_href++) {
22306 mem_base = xmlMemBlocks();
22307 doc = gen_xmlDocPtr(n_doc, 0);
22308 node = gen_xmlNodePtr(n_node, 1);
22309 href = gen_const_xmlChar_ptr(n_href, 2);
22310
22311 ret_val = xmlSearchNsByHref(doc, node, href);
22312 desret_xmlNsPtr(ret_val);
22313 call_tests++;
22314 des_xmlDocPtr(n_doc, doc, 0);
22315 des_xmlNodePtr(n_node, node, 1);
22316 des_const_xmlChar_ptr(n_href, href, 2);
22317 xmlResetLastError();
22318 if (mem_base != xmlMemBlocks()) {
22319 printf("Leak of %d blocks found in xmlSearchNsByHref",
22320 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022321 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022322 printf(" %d", n_doc);
22323 printf(" %d", n_node);
22324 printf(" %d", n_href);
22325 printf("\n");
22326 }
22327 }
22328 }
22329 }
22330
22331 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000022332 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022333}
22334
22335
22336static int
22337test_xmlSetBufferAllocationScheme(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022338 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022339
Daniel Veillard57b25162004-11-06 14:50:18 +000022340 int mem_base;
22341 xmlBufferAllocationScheme scheme; /* allocation method to use */
22342 int n_scheme;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022343
Daniel Veillard57b25162004-11-06 14:50:18 +000022344 for (n_scheme = 0;n_scheme < gen_nb_xmlBufferAllocationScheme;n_scheme++) {
22345 mem_base = xmlMemBlocks();
22346 scheme = gen_xmlBufferAllocationScheme(n_scheme, 0);
22347
22348 xmlSetBufferAllocationScheme(scheme);
22349 call_tests++;
22350 des_xmlBufferAllocationScheme(n_scheme, scheme, 0);
22351 xmlResetLastError();
22352 if (mem_base != xmlMemBlocks()) {
22353 printf("Leak of %d blocks found in xmlSetBufferAllocationScheme",
22354 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022355 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000022356 printf(" %d", n_scheme);
22357 printf("\n");
22358 }
22359 }
22360
22361 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000022362 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022363}
22364
22365
22366static int
22367test_xmlSetCompressMode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022368 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022369
22370 int mem_base;
22371 int mode; /* the compression ratio */
22372 int n_mode;
22373
22374 for (n_mode = 0;n_mode < gen_nb_int;n_mode++) {
22375 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022376 mode = gen_int(n_mode, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022377
22378 xmlSetCompressMode(mode);
22379 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022380 des_int(n_mode, mode, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022381 xmlResetLastError();
22382 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022383 printf("Leak of %d blocks found in xmlSetCompressMode",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022384 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022385 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022386 printf(" %d", n_mode);
22387 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022388 }
22389 }
22390
Daniel Veillard3d97e662004-11-04 10:49:00 +000022391 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000022392 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022393}
22394
22395
22396static int
22397test_xmlSetDocCompressMode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022398 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022399
22400 int mem_base;
22401 xmlDocPtr doc; /* the document */
22402 int n_doc;
22403 int mode; /* the compression ratio */
22404 int n_mode;
22405
22406 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
22407 for (n_mode = 0;n_mode < gen_nb_int;n_mode++) {
22408 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022409 doc = gen_xmlDocPtr(n_doc, 0);
22410 mode = gen_int(n_mode, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022411
22412 xmlSetDocCompressMode(doc, mode);
22413 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022414 des_xmlDocPtr(n_doc, doc, 0);
22415 des_int(n_mode, mode, 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 xmlSetDocCompressMode",
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_mode);
22423 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022424 }
22425 }
22426 }
22427
Daniel Veillard3d97e662004-11-04 10:49:00 +000022428 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000022429 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022430}
22431
22432
22433static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000022434test_xmlSetNs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022435 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022436
Daniel Veillard27f20102004-11-05 11:50:11 +000022437 int mem_base;
22438 xmlNodePtr node; /* a node in the document */
22439 int n_node;
22440 xmlNsPtr ns; /* a namespace pointer */
22441 int n_ns;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022442
Daniel Veillard27f20102004-11-05 11:50:11 +000022443 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22444 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
22445 mem_base = xmlMemBlocks();
22446 node = gen_xmlNodePtr(n_node, 0);
22447 ns = gen_xmlNsPtr(n_ns, 1);
22448
22449 xmlSetNs(node, ns);
22450 call_tests++;
22451 des_xmlNodePtr(n_node, node, 0);
22452 des_xmlNsPtr(n_ns, ns, 1);
22453 xmlResetLastError();
22454 if (mem_base != xmlMemBlocks()) {
22455 printf("Leak of %d blocks found in xmlSetNs",
22456 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022457 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000022458 printf(" %d", n_node);
22459 printf(" %d", n_ns);
22460 printf("\n");
22461 }
22462 }
22463 }
22464
22465 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000022466 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022467}
22468
22469
22470static int
22471test_xmlSetNsProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022472 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022473
Daniel Veillard57b25162004-11-06 14:50:18 +000022474#ifdef LIBXML_TREE_ENABLED
22475 int mem_base;
22476 xmlAttrPtr ret_val;
22477 xmlNodePtr node; /* the node */
22478 int n_node;
22479 xmlNsPtr ns; /* the namespace definition */
22480 int n_ns;
22481 xmlChar * name; /* the attribute name */
22482 int n_name;
22483 xmlChar * value; /* the attribute value */
22484 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022485
Daniel Veillard57b25162004-11-06 14:50:18 +000022486 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22487 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
22488 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
22489 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22490 mem_base = xmlMemBlocks();
22491 node = gen_xmlNodePtr(n_node, 0);
22492 ns = gen_xmlNsPtr(n_ns, 1);
22493 name = gen_const_xmlChar_ptr(n_name, 2);
22494 value = gen_const_xmlChar_ptr(n_value, 3);
22495
22496 ret_val = xmlSetNsProp(node, ns, name, value);
22497 desret_xmlAttrPtr(ret_val);
22498 call_tests++;
22499 des_xmlNodePtr(n_node, node, 0);
22500 des_xmlNsPtr(n_ns, ns, 1);
22501 des_const_xmlChar_ptr(n_name, name, 2);
22502 des_const_xmlChar_ptr(n_value, value, 3);
22503 xmlResetLastError();
22504 if (mem_base != xmlMemBlocks()) {
22505 printf("Leak of %d blocks found in xmlSetNsProp",
22506 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022507 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000022508 printf(" %d", n_node);
22509 printf(" %d", n_ns);
22510 printf(" %d", n_name);
22511 printf(" %d", n_value);
22512 printf("\n");
22513 }
22514 }
22515 }
22516 }
22517 }
22518#endif
22519
22520 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000022521 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022522}
22523
22524
22525static int
22526test_xmlSetProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022527 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022528
Daniel Veillard57b25162004-11-06 14:50:18 +000022529#ifdef LIBXML_TREE_ENABLED
22530 int mem_base;
22531 xmlAttrPtr ret_val;
22532 xmlNodePtr node; /* the node */
22533 int n_node;
22534 xmlChar * name; /* the attribute name */
22535 int n_name;
22536 xmlChar * value; /* the attribute value */
22537 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022538
Daniel Veillard57b25162004-11-06 14:50:18 +000022539 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22540 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
22541 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22542 mem_base = xmlMemBlocks();
22543 node = gen_xmlNodePtr(n_node, 0);
22544 name = gen_const_xmlChar_ptr(n_name, 1);
22545 value = gen_const_xmlChar_ptr(n_value, 2);
22546
22547 ret_val = xmlSetProp(node, name, value);
22548 desret_xmlAttrPtr(ret_val);
22549 call_tests++;
22550 des_xmlNodePtr(n_node, node, 0);
22551 des_const_xmlChar_ptr(n_name, name, 1);
22552 des_const_xmlChar_ptr(n_value, value, 2);
22553 xmlResetLastError();
22554 if (mem_base != xmlMemBlocks()) {
22555 printf("Leak of %d blocks found in xmlSetProp",
22556 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022557 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000022558 printf(" %d", n_node);
22559 printf(" %d", n_name);
22560 printf(" %d", n_value);
22561 printf("\n");
22562 }
22563 }
22564 }
22565 }
22566#endif
22567
22568 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000022569 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022570}
22571
22572
22573static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000022574test_xmlSplitQName2(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022575 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022576
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022577 int mem_base;
22578 xmlChar * ret_val;
22579 xmlChar * name; /* the full QName */
22580 int n_name;
22581 xmlChar ** prefix; /* a xmlChar ** */
22582 int n_prefix;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022583
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022584 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
22585 for (n_prefix = 0;n_prefix < gen_nb_xmlChar_ptr_ptr;n_prefix++) {
22586 mem_base = xmlMemBlocks();
22587 name = gen_const_xmlChar_ptr(n_name, 0);
22588 prefix = gen_xmlChar_ptr_ptr(n_prefix, 1);
22589
22590 ret_val = xmlSplitQName2(name, prefix);
22591 desret_xmlChar_ptr(ret_val);
22592 call_tests++;
22593 des_const_xmlChar_ptr(n_name, name, 0);
22594 des_xmlChar_ptr_ptr(n_prefix, prefix, 1);
22595 xmlResetLastError();
22596 if (mem_base != xmlMemBlocks()) {
22597 printf("Leak of %d blocks found in xmlSplitQName2",
22598 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022599 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022600 printf(" %d", n_name);
22601 printf(" %d", n_prefix);
22602 printf("\n");
22603 }
22604 }
22605 }
22606
22607 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000022608 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022609}
22610
22611
22612static int
22613test_xmlSplitQName3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022614 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022615
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000022616 int mem_base;
22617 const xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022618 xmlChar * name; /* the full QName */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000022619 int n_name;
22620 int * len; /* an int * */
22621 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022622
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000022623 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
22624 for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
22625 mem_base = xmlMemBlocks();
22626 name = gen_const_xmlChar_ptr(n_name, 0);
22627 len = gen_int_ptr(n_len, 1);
22628
22629 ret_val = xmlSplitQName3(name, len);
22630 desret_const_xmlChar_ptr(ret_val);
22631 call_tests++;
22632 des_const_xmlChar_ptr(n_name, name, 0);
22633 des_int_ptr(n_len, len, 1);
22634 xmlResetLastError();
22635 if (mem_base != xmlMemBlocks()) {
22636 printf("Leak of %d blocks found in xmlSplitQName3",
22637 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022638 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000022639 printf(" %d", n_name);
22640 printf(" %d", n_len);
22641 printf("\n");
22642 }
22643 }
22644 }
22645
22646 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000022647 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022648}
22649
22650
22651static int
22652test_xmlStringGetNodeList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022653 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022654
22655 int mem_base;
22656 xmlNodePtr ret_val;
22657 xmlDocPtr doc; /* the document */
22658 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022659 xmlChar * value; /* the value of the attribute */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022660 int n_value;
22661
22662 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
22663 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22664 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022665 doc = gen_xmlDocPtr(n_doc, 0);
22666 value = gen_const_xmlChar_ptr(n_value, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022667
22668 ret_val = xmlStringGetNodeList(doc, value);
22669 desret_xmlNodePtr(ret_val);
22670 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022671 des_xmlDocPtr(n_doc, doc, 0);
22672 des_const_xmlChar_ptr(n_value, value, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022673 xmlResetLastError();
22674 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022675 printf("Leak of %d blocks found in xmlStringGetNodeList",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022676 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022677 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022678 printf(" %d", n_doc);
22679 printf(" %d", n_value);
22680 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022681 }
22682 }
22683 }
22684
Daniel Veillard3d97e662004-11-04 10:49:00 +000022685 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000022686 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022687}
22688
22689
22690static int
22691test_xmlStringLenGetNodeList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022692 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022693
22694 int mem_base;
22695 xmlNodePtr ret_val;
22696 xmlDocPtr doc; /* the document */
22697 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022698 xmlChar * value; /* the value of the text */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022699 int n_value;
22700 int len; /* the length of the string value */
22701 int n_len;
22702
22703 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
22704 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22705 for (n_len = 0;n_len < gen_nb_int;n_len++) {
22706 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022707 doc = gen_xmlDocPtr(n_doc, 0);
22708 value = gen_const_xmlChar_ptr(n_value, 1);
22709 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022710
22711 ret_val = xmlStringLenGetNodeList(doc, value, len);
22712 desret_xmlNodePtr(ret_val);
22713 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022714 des_xmlDocPtr(n_doc, doc, 0);
22715 des_const_xmlChar_ptr(n_value, value, 1);
22716 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022717 xmlResetLastError();
22718 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022719 printf("Leak of %d blocks found in xmlStringLenGetNodeList",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022720 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022721 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022722 printf(" %d", n_doc);
22723 printf(" %d", n_value);
22724 printf(" %d", n_len);
22725 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022726 }
22727 }
22728 }
22729 }
22730
Daniel Veillard3d97e662004-11-04 10:49:00 +000022731 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000022732 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022733}
22734
22735
22736static int
22737test_xmlTextConcat(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022738 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022739
22740 int mem_base;
22741 int ret_val;
22742 xmlNodePtr node; /* the node */
22743 int n_node;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022744 xmlChar * content; /* the content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022745 int n_content;
22746 int len; /* @content length */
22747 int n_len;
22748
22749 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22750 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
22751 for (n_len = 0;n_len < gen_nb_int;n_len++) {
22752 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022753 node = gen_xmlNodePtr(n_node, 0);
22754 content = gen_const_xmlChar_ptr(n_content, 1);
22755 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022756
22757 ret_val = xmlTextConcat(node, content, len);
22758 desret_int(ret_val);
22759 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022760 des_xmlNodePtr(n_node, node, 0);
22761 des_const_xmlChar_ptr(n_content, content, 1);
22762 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022763 xmlResetLastError();
22764 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022765 printf("Leak of %d blocks found in xmlTextConcat",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022766 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022767 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022768 printf(" %d", n_node);
22769 printf(" %d", n_content);
22770 printf(" %d", n_len);
22771 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022772 }
22773 }
22774 }
22775 }
22776
Daniel Veillard3d97e662004-11-04 10:49:00 +000022777 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000022778 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022779}
22780
22781
22782static int
22783test_xmlTextMerge(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022784 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022785
22786 int mem_base;
22787 xmlNodePtr ret_val;
22788 xmlNodePtr first; /* the first text node */
22789 int n_first;
22790 xmlNodePtr second; /* the second text node being merged */
22791 int n_second;
22792
Daniel Veillarda03e3652004-11-02 18:45:30 +000022793 for (n_first = 0;n_first < gen_nb_xmlNodePtr_in;n_first++) {
22794 for (n_second = 0;n_second < gen_nb_xmlNodePtr_in;n_second++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000022795 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022796 first = gen_xmlNodePtr_in(n_first, 0);
22797 second = gen_xmlNodePtr_in(n_second, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022798
22799 ret_val = xmlTextMerge(first, second);
Daniel Veillarda03e3652004-11-02 18:45:30 +000022800 if ((first != NULL) && (first->type != XML_TEXT_NODE)) {
Daniel Veillardce244ad2004-11-05 10:03:46 +000022801 xmlUnlinkNode(second);
Daniel Veillarda03e3652004-11-02 18:45:30 +000022802 xmlFreeNode(second) ; second = NULL ; }
Daniel Veillard8a32fe42004-11-02 22:10:16 +000022803 desret_xmlNodePtr(ret_val);
22804 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022805 des_xmlNodePtr_in(n_first, first, 0);
22806 des_xmlNodePtr_in(n_second, second, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022807 xmlResetLastError();
22808 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022809 printf("Leak of %d blocks found in xmlTextMerge",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022810 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022811 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022812 printf(" %d", n_first);
22813 printf(" %d", n_second);
22814 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022815 }
22816 }
22817 }
22818
Daniel Veillard3d97e662004-11-04 10:49:00 +000022819 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000022820 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022821}
22822
22823
22824static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000022825test_xmlUnsetNsProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022826 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022827
Daniel Veillard27f20102004-11-05 11:50:11 +000022828#ifdef LIBXML_TREE_ENABLED
22829 int mem_base;
22830 int ret_val;
22831 xmlNodePtr node; /* the node */
22832 int n_node;
22833 xmlNsPtr ns; /* the namespace definition */
22834 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022835 xmlChar * name; /* the attribute name */
Daniel Veillard27f20102004-11-05 11:50:11 +000022836 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022837
Daniel Veillard27f20102004-11-05 11:50:11 +000022838 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22839 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
22840 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
22841 mem_base = xmlMemBlocks();
22842 node = gen_xmlNodePtr(n_node, 0);
22843 ns = gen_xmlNsPtr(n_ns, 1);
22844 name = gen_const_xmlChar_ptr(n_name, 2);
22845
22846 ret_val = xmlUnsetNsProp(node, ns, name);
22847 desret_int(ret_val);
22848 call_tests++;
22849 des_xmlNodePtr(n_node, node, 0);
22850 des_xmlNsPtr(n_ns, ns, 1);
22851 des_const_xmlChar_ptr(n_name, name, 2);
22852 xmlResetLastError();
22853 if (mem_base != xmlMemBlocks()) {
22854 printf("Leak of %d blocks found in xmlUnsetNsProp",
22855 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022856 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000022857 printf(" %d", n_node);
22858 printf(" %d", n_ns);
22859 printf(" %d", n_name);
22860 printf("\n");
22861 }
22862 }
22863 }
22864 }
22865#endif
22866
22867 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000022868 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022869}
22870
22871
22872static int
22873test_xmlUnsetProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022874 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022875
22876#ifdef LIBXML_TREE_ENABLED
22877 int mem_base;
22878 int ret_val;
22879 xmlNodePtr node; /* the node */
22880 int n_node;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022881 xmlChar * name; /* the attribute name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022882 int n_name;
22883
22884 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22885 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
22886 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022887 node = gen_xmlNodePtr(n_node, 0);
22888 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022889
22890 ret_val = xmlUnsetProp(node, name);
22891 desret_int(ret_val);
22892 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022893 des_xmlNodePtr(n_node, node, 0);
22894 des_const_xmlChar_ptr(n_name, name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022895 xmlResetLastError();
22896 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022897 printf("Leak of %d blocks found in xmlUnsetProp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022898 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022899 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022900 printf(" %d", n_node);
22901 printf(" %d", n_name);
22902 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022903 }
22904 }
22905 }
22906#endif
22907
Daniel Veillard3d97e662004-11-04 10:49:00 +000022908 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000022909 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022910}
22911
22912
22913static int
22914test_xmlValidateNCName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022915 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022916
Daniel Veillarda521d282004-11-09 14:59:59 +000022917#ifdef LIBXML_TREE_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000022918 int mem_base;
22919 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022920 xmlChar * value; /* the value to check */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022921 int n_value;
22922 int space; /* allow spaces in front and end of the string */
22923 int n_space;
22924
22925 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22926 for (n_space = 0;n_space < gen_nb_int;n_space++) {
22927 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022928 value = gen_const_xmlChar_ptr(n_value, 0);
22929 space = gen_int(n_space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022930
22931 ret_val = xmlValidateNCName(value, space);
22932 desret_int(ret_val);
22933 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022934 des_const_xmlChar_ptr(n_value, value, 0);
22935 des_int(n_space, space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022936 xmlResetLastError();
22937 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022938 printf("Leak of %d blocks found in xmlValidateNCName",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022939 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022940 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022941 printf(" %d", n_value);
22942 printf(" %d", n_space);
22943 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022944 }
22945 }
22946 }
Daniel Veillarda521d282004-11-09 14:59:59 +000022947#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000022948
Daniel Veillard3d97e662004-11-04 10:49:00 +000022949 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000022950 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022951}
22952
22953
22954static int
22955test_xmlValidateNMToken(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022956 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022957
Daniel Veillarda521d282004-11-09 14:59:59 +000022958#ifdef LIBXML_TREE_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000022959 int mem_base;
22960 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022961 xmlChar * value; /* the value to check */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022962 int n_value;
22963 int space; /* allow spaces in front and end of the string */
22964 int n_space;
22965
22966 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22967 for (n_space = 0;n_space < gen_nb_int;n_space++) {
22968 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022969 value = gen_const_xmlChar_ptr(n_value, 0);
22970 space = gen_int(n_space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022971
22972 ret_val = xmlValidateNMToken(value, space);
22973 desret_int(ret_val);
22974 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022975 des_const_xmlChar_ptr(n_value, value, 0);
22976 des_int(n_space, space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022977 xmlResetLastError();
22978 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022979 printf("Leak of %d blocks found in xmlValidateNMToken",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022980 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022981 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022982 printf(" %d", n_value);
22983 printf(" %d", n_space);
22984 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022985 }
22986 }
22987 }
Daniel Veillarda521d282004-11-09 14:59:59 +000022988#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000022989
Daniel Veillard3d97e662004-11-04 10:49:00 +000022990 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000022991 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022992}
22993
22994
22995static int
22996test_xmlValidateName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022997 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022998
Daniel Veillarda521d282004-11-09 14:59:59 +000022999#ifdef LIBXML_TREE_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000023000 int mem_base;
23001 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023002 xmlChar * value; /* the value to check */
Daniel Veillardd93f6252004-11-02 15:53:51 +000023003 int n_value;
23004 int space; /* allow spaces in front and end of the string */
23005 int n_space;
23006
23007 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
23008 for (n_space = 0;n_space < gen_nb_int;n_space++) {
23009 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000023010 value = gen_const_xmlChar_ptr(n_value, 0);
23011 space = gen_int(n_space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023012
23013 ret_val = xmlValidateName(value, space);
23014 desret_int(ret_val);
23015 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000023016 des_const_xmlChar_ptr(n_value, value, 0);
23017 des_int(n_space, space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023018 xmlResetLastError();
23019 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000023020 printf("Leak of %d blocks found in xmlValidateName",
Daniel Veillardd93f6252004-11-02 15:53:51 +000023021 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023022 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000023023 printf(" %d", n_value);
23024 printf(" %d", n_space);
23025 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000023026 }
23027 }
23028 }
Daniel Veillarda521d282004-11-09 14:59:59 +000023029#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000023030
Daniel Veillard3d97e662004-11-04 10:49:00 +000023031 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000023032 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023033}
23034
23035
23036static int
23037test_xmlValidateQName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023038 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023039
Daniel Veillarda521d282004-11-09 14:59:59 +000023040#ifdef LIBXML_TREE_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000023041 int mem_base;
23042 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023043 xmlChar * value; /* the value to check */
Daniel Veillardd93f6252004-11-02 15:53:51 +000023044 int n_value;
23045 int space; /* allow spaces in front and end of the string */
23046 int n_space;
23047
23048 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
23049 for (n_space = 0;n_space < gen_nb_int;n_space++) {
23050 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000023051 value = gen_const_xmlChar_ptr(n_value, 0);
23052 space = gen_int(n_space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023053
23054 ret_val = xmlValidateQName(value, space);
23055 desret_int(ret_val);
23056 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000023057 des_const_xmlChar_ptr(n_value, value, 0);
23058 des_int(n_space, space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023059 xmlResetLastError();
23060 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000023061 printf("Leak of %d blocks found in xmlValidateQName",
Daniel Veillardd93f6252004-11-02 15:53:51 +000023062 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023063 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000023064 printf(" %d", n_value);
23065 printf(" %d", n_space);
23066 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000023067 }
23068 }
23069 }
Daniel Veillarda521d282004-11-09 14:59:59 +000023070#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000023071
Daniel Veillard3d97e662004-11-04 10:49:00 +000023072 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000023073 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023074}
23075
23076static int
23077test_tree(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023078 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023079
Daniel Veillard3d95c732004-11-06 22:25:14 +000023080 printf("Testing tree : 129 of 146 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000023081 test_ret += test_xmlAddChild();
23082 test_ret += test_xmlAddChildList();
23083 test_ret += test_xmlAddNextSibling();
23084 test_ret += test_xmlAddPrevSibling();
23085 test_ret += test_xmlAddSibling();
23086 test_ret += test_xmlAttrSerializeTxtContent();
23087 test_ret += test_xmlBufferAdd();
23088 test_ret += test_xmlBufferAddHead();
23089 test_ret += test_xmlBufferCCat();
23090 test_ret += test_xmlBufferCat();
23091 test_ret += test_xmlBufferContent();
23092 test_ret += test_xmlBufferCreate();
23093 test_ret += test_xmlBufferCreateSize();
23094 test_ret += test_xmlBufferCreateStatic();
23095 test_ret += test_xmlBufferEmpty();
23096 test_ret += test_xmlBufferGrow();
23097 test_ret += test_xmlBufferLength();
23098 test_ret += test_xmlBufferResize();
23099 test_ret += test_xmlBufferSetAllocationScheme();
23100 test_ret += test_xmlBufferShrink();
23101 test_ret += test_xmlBufferWriteCHAR();
23102 test_ret += test_xmlBufferWriteChar();
23103 test_ret += test_xmlBufferWriteQuotedString();
23104 test_ret += test_xmlBuildQName();
23105 test_ret += test_xmlCopyDoc();
23106 test_ret += test_xmlCopyDtd();
23107 test_ret += test_xmlCopyNamespace();
23108 test_ret += test_xmlCopyNamespaceList();
23109 test_ret += test_xmlCopyNode();
23110 test_ret += test_xmlCopyNodeList();
23111 test_ret += test_xmlCopyProp();
23112 test_ret += test_xmlCopyPropList();
23113 test_ret += test_xmlCreateIntSubset();
23114 test_ret += test_xmlDocCopyNode();
23115 test_ret += test_xmlDocCopyNodeList();
23116 test_ret += test_xmlDocDump();
23117 test_ret += test_xmlDocDumpFormatMemory();
23118 test_ret += test_xmlDocDumpFormatMemoryEnc();
23119 test_ret += test_xmlDocDumpMemory();
23120 test_ret += test_xmlDocDumpMemoryEnc();
23121 test_ret += test_xmlDocFormatDump();
23122 test_ret += test_xmlDocGetRootElement();
23123 test_ret += test_xmlDocSetRootElement();
23124 test_ret += test_xmlElemDump();
23125 test_ret += test_xmlGetBufferAllocationScheme();
23126 test_ret += test_xmlGetCompressMode();
23127 test_ret += test_xmlGetDocCompressMode();
23128 test_ret += test_xmlGetIntSubset();
23129 test_ret += test_xmlGetLastChild();
23130 test_ret += test_xmlGetLineNo();
23131 test_ret += test_xmlGetNoNsProp();
23132 test_ret += test_xmlGetNodePath();
23133 test_ret += test_xmlGetNsList();
23134 test_ret += test_xmlGetNsProp();
23135 test_ret += test_xmlGetProp();
23136 test_ret += test_xmlHasNsProp();
23137 test_ret += test_xmlHasProp();
23138 test_ret += test_xmlIsBlankNode();
23139 test_ret += test_xmlIsXHTML();
23140 test_ret += test_xmlNewCDataBlock();
23141 test_ret += test_xmlNewCharRef();
23142 test_ret += test_xmlNewChild();
23143 test_ret += test_xmlNewComment();
23144 test_ret += test_xmlNewDoc();
23145 test_ret += test_xmlNewDocComment();
23146 test_ret += test_xmlNewDocFragment();
23147 test_ret += test_xmlNewDocNode();
23148 test_ret += test_xmlNewDocNodeEatName();
23149 test_ret += test_xmlNewDocPI();
23150 test_ret += test_xmlNewDocProp();
23151 test_ret += test_xmlNewDocRawNode();
23152 test_ret += test_xmlNewDocText();
23153 test_ret += test_xmlNewDocTextLen();
23154 test_ret += test_xmlNewDtd();
23155 test_ret += test_xmlNewNode();
23156 test_ret += test_xmlNewNodeEatName();
23157 test_ret += test_xmlNewNs();
23158 test_ret += test_xmlNewNsProp();
23159 test_ret += test_xmlNewNsPropEatName();
23160 test_ret += test_xmlNewPI();
23161 test_ret += test_xmlNewProp();
23162 test_ret += test_xmlNewReference();
23163 test_ret += test_xmlNewText();
23164 test_ret += test_xmlNewTextChild();
23165 test_ret += test_xmlNewTextLen();
23166 test_ret += test_xmlNodeAddContent();
23167 test_ret += test_xmlNodeAddContentLen();
23168 test_ret += test_xmlNodeBufGetContent();
23169 test_ret += test_xmlNodeDump();
23170 test_ret += test_xmlNodeDumpOutput();
23171 test_ret += test_xmlNodeGetBase();
23172 test_ret += test_xmlNodeGetContent();
23173 test_ret += test_xmlNodeGetLang();
23174 test_ret += test_xmlNodeGetSpacePreserve();
23175 test_ret += test_xmlNodeIsText();
23176 test_ret += test_xmlNodeListGetRawString();
23177 test_ret += test_xmlNodeListGetString();
23178 test_ret += test_xmlNodeSetBase();
23179 test_ret += test_xmlNodeSetContent();
23180 test_ret += test_xmlNodeSetContentLen();
23181 test_ret += test_xmlNodeSetLang();
23182 test_ret += test_xmlNodeSetName();
23183 test_ret += test_xmlNodeSetSpacePreserve();
23184 test_ret += test_xmlReconciliateNs();
23185 test_ret += test_xmlRemoveProp();
23186 test_ret += test_xmlReplaceNode();
23187 test_ret += test_xmlSaveFile();
23188 test_ret += test_xmlSaveFileEnc();
23189 test_ret += test_xmlSaveFileTo();
23190 test_ret += test_xmlSaveFormatFile();
23191 test_ret += test_xmlSaveFormatFileEnc();
23192 test_ret += test_xmlSaveFormatFileTo();
23193 test_ret += test_xmlSearchNs();
23194 test_ret += test_xmlSearchNsByHref();
23195 test_ret += test_xmlSetBufferAllocationScheme();
23196 test_ret += test_xmlSetCompressMode();
23197 test_ret += test_xmlSetDocCompressMode();
23198 test_ret += test_xmlSetNs();
23199 test_ret += test_xmlSetNsProp();
23200 test_ret += test_xmlSetProp();
23201 test_ret += test_xmlSplitQName2();
23202 test_ret += test_xmlSplitQName3();
23203 test_ret += test_xmlStringGetNodeList();
23204 test_ret += test_xmlStringLenGetNodeList();
23205 test_ret += test_xmlTextConcat();
23206 test_ret += test_xmlTextMerge();
23207 test_ret += test_xmlUnsetNsProp();
23208 test_ret += test_xmlUnsetProp();
23209 test_ret += test_xmlValidateNCName();
23210 test_ret += test_xmlValidateNMToken();
23211 test_ret += test_xmlValidateName();
23212 test_ret += test_xmlValidateQName();
Daniel Veillardd93f6252004-11-02 15:53:51 +000023213
Daniel Veillard42595322004-11-08 10:52:06 +000023214 if (test_ret != 0)
23215 printf("Module tree: %d errors\n", test_ret);
23216 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023217}
23218
23219static int
23220test_xmlBuildRelativeURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023221 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023222
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023223 int mem_base;
23224 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023225 xmlChar * URI; /* the URI reference under consideration */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023226 int n_URI;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023227 xmlChar * base; /* the base value */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023228 int n_base;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023229
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023230 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
23231 for (n_base = 0;n_base < gen_nb_const_xmlChar_ptr;n_base++) {
23232 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000023233 URI = gen_const_xmlChar_ptr(n_URI, 0);
23234 base = gen_const_xmlChar_ptr(n_base, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023235
23236 ret_val = xmlBuildRelativeURI(URI, base);
23237 desret_xmlChar_ptr(ret_val);
23238 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000023239 des_const_xmlChar_ptr(n_URI, URI, 0);
23240 des_const_xmlChar_ptr(n_base, base, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023241 xmlResetLastError();
23242 if (mem_base != xmlMemBlocks()) {
23243 printf("Leak of %d blocks found in xmlBuildRelativeURI",
23244 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023245 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023246 printf(" %d", n_URI);
23247 printf(" %d", n_base);
23248 printf("\n");
23249 }
23250 }
23251 }
23252
Daniel Veillard3d97e662004-11-04 10:49:00 +000023253 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000023254 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023255}
23256
23257
23258static int
23259test_xmlBuildURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023260 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023261
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023262 int mem_base;
23263 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023264 xmlChar * URI; /* the URI instance found in the document */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023265 int n_URI;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023266 xmlChar * base; /* the base value */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023267 int n_base;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023268
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023269 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
23270 for (n_base = 0;n_base < gen_nb_const_xmlChar_ptr;n_base++) {
23271 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000023272 URI = gen_const_xmlChar_ptr(n_URI, 0);
23273 base = gen_const_xmlChar_ptr(n_base, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023274
23275 ret_val = xmlBuildURI(URI, base);
23276 desret_xmlChar_ptr(ret_val);
23277 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000023278 des_const_xmlChar_ptr(n_URI, URI, 0);
23279 des_const_xmlChar_ptr(n_base, base, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023280 xmlResetLastError();
23281 if (mem_base != xmlMemBlocks()) {
23282 printf("Leak of %d blocks found in xmlBuildURI",
23283 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023284 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023285 printf(" %d", n_URI);
23286 printf(" %d", n_base);
23287 printf("\n");
23288 }
23289 }
23290 }
23291
Daniel Veillard3d97e662004-11-04 10:49:00 +000023292 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000023293 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023294}
23295
23296
23297static int
23298test_xmlCanonicPath(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023299 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023300
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023301 int mem_base;
23302 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023303 xmlChar * path; /* the resource locator in a filesystem notation */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023304 int n_path;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023305
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023306 for (n_path = 0;n_path < gen_nb_const_xmlChar_ptr;n_path++) {
23307 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000023308 path = gen_const_xmlChar_ptr(n_path, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023309
23310 ret_val = xmlCanonicPath(path);
23311 desret_xmlChar_ptr(ret_val);
23312 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000023313 des_const_xmlChar_ptr(n_path, path, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023314 xmlResetLastError();
23315 if (mem_base != xmlMemBlocks()) {
23316 printf("Leak of %d blocks found in xmlCanonicPath",
23317 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023318 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023319 printf(" %d", n_path);
23320 printf("\n");
23321 }
23322 }
23323
Daniel Veillard3d97e662004-11-04 10:49:00 +000023324 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000023325 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023326}
23327
23328
23329static int
23330test_xmlCreateURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023331 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023332
23333
23334 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023335 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023336}
23337
23338
23339static int
23340test_xmlNormalizeURIPath(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023341 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023342
Daniel Veillardce682bc2004-11-05 17:22:25 +000023343 int mem_base;
23344 int ret_val;
23345 char * path; /* pointer to the path string */
23346 int n_path;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023347
Daniel Veillardce682bc2004-11-05 17:22:25 +000023348 for (n_path = 0;n_path < gen_nb_char_ptr;n_path++) {
23349 mem_base = xmlMemBlocks();
23350 path = gen_char_ptr(n_path, 0);
23351
23352 ret_val = xmlNormalizeURIPath(path);
23353 desret_int(ret_val);
23354 call_tests++;
23355 des_char_ptr(n_path, path, 0);
23356 xmlResetLastError();
23357 if (mem_base != xmlMemBlocks()) {
23358 printf("Leak of %d blocks found in xmlNormalizeURIPath",
23359 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023360 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023361 printf(" %d", n_path);
23362 printf("\n");
23363 }
23364 }
23365
23366 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000023367 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023368}
23369
23370
23371static int
23372test_xmlParseURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023373 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023374
23375
23376 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023377 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023378}
23379
23380
Daniel Veillardce682bc2004-11-05 17:22:25 +000023381#define gen_nb_xmlURIPtr 1
23382static xmlURIPtr gen_xmlURIPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23383 return(NULL);
23384}
23385static void des_xmlURIPtr(int no ATTRIBUTE_UNUSED, xmlURIPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23386}
23387
Daniel Veillardd93f6252004-11-02 15:53:51 +000023388static int
23389test_xmlParseURIReference(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023390 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023391
Daniel Veillardce682bc2004-11-05 17:22:25 +000023392 int mem_base;
23393 int ret_val;
23394 xmlURIPtr uri; /* pointer to an URI structure */
23395 int n_uri;
23396 char * str; /* the string to analyze */
23397 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023398
Daniel Veillardce682bc2004-11-05 17:22:25 +000023399 for (n_uri = 0;n_uri < gen_nb_xmlURIPtr;n_uri++) {
23400 for (n_str = 0;n_str < gen_nb_const_char_ptr;n_str++) {
23401 mem_base = xmlMemBlocks();
23402 uri = gen_xmlURIPtr(n_uri, 0);
23403 str = gen_const_char_ptr(n_str, 1);
23404
23405 ret_val = xmlParseURIReference(uri, str);
23406 desret_int(ret_val);
23407 call_tests++;
23408 des_xmlURIPtr(n_uri, uri, 0);
23409 des_const_char_ptr(n_str, str, 1);
23410 xmlResetLastError();
23411 if (mem_base != xmlMemBlocks()) {
23412 printf("Leak of %d blocks found in xmlParseURIReference",
23413 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023414 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023415 printf(" %d", n_uri);
23416 printf(" %d", n_str);
23417 printf("\n");
23418 }
23419 }
23420 }
23421
23422 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000023423 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023424}
23425
23426
23427static int
23428test_xmlPrintURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023429 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023430
Daniel Veillardce682bc2004-11-05 17:22:25 +000023431 int mem_base;
23432 FILE * stream; /* a FILE* for the output */
23433 int n_stream;
23434 xmlURIPtr uri; /* pointer to an xmlURI */
23435 int n_uri;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023436
Daniel Veillardce682bc2004-11-05 17:22:25 +000023437 for (n_stream = 0;n_stream < gen_nb_FILE_ptr;n_stream++) {
23438 for (n_uri = 0;n_uri < gen_nb_xmlURIPtr;n_uri++) {
23439 mem_base = xmlMemBlocks();
23440 stream = gen_FILE_ptr(n_stream, 0);
23441 uri = gen_xmlURIPtr(n_uri, 1);
23442
23443 xmlPrintURI(stream, uri);
23444 call_tests++;
23445 des_FILE_ptr(n_stream, stream, 0);
23446 des_xmlURIPtr(n_uri, uri, 1);
23447 xmlResetLastError();
23448 if (mem_base != xmlMemBlocks()) {
23449 printf("Leak of %d blocks found in xmlPrintURI",
23450 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023451 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023452 printf(" %d", n_stream);
23453 printf(" %d", n_uri);
23454 printf("\n");
23455 }
23456 }
23457 }
23458
23459 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000023460 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023461}
23462
23463
23464static int
23465test_xmlSaveUri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023466 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023467
Daniel Veillardce682bc2004-11-05 17:22:25 +000023468 int mem_base;
23469 xmlChar * ret_val;
23470 xmlURIPtr uri; /* pointer to an xmlURI */
23471 int n_uri;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023472
Daniel Veillardce682bc2004-11-05 17:22:25 +000023473 for (n_uri = 0;n_uri < gen_nb_xmlURIPtr;n_uri++) {
23474 mem_base = xmlMemBlocks();
23475 uri = gen_xmlURIPtr(n_uri, 0);
23476
23477 ret_val = xmlSaveUri(uri);
23478 desret_xmlChar_ptr(ret_val);
23479 call_tests++;
23480 des_xmlURIPtr(n_uri, uri, 0);
23481 xmlResetLastError();
23482 if (mem_base != xmlMemBlocks()) {
23483 printf("Leak of %d blocks found in xmlSaveUri",
23484 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023485 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023486 printf(" %d", n_uri);
23487 printf("\n");
23488 }
23489 }
23490
23491 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000023492 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023493}
23494
23495
23496static int
23497test_xmlURIEscape(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023498 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023499
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023500 int mem_base;
23501 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023502 xmlChar * str; /* the string of the URI to escape */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023503 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023504
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023505 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
23506 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000023507 str = gen_const_xmlChar_ptr(n_str, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023508
23509 ret_val = xmlURIEscape(str);
23510 desret_xmlChar_ptr(ret_val);
23511 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000023512 des_const_xmlChar_ptr(n_str, str, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023513 xmlResetLastError();
23514 if (mem_base != xmlMemBlocks()) {
23515 printf("Leak of %d blocks found in xmlURIEscape",
23516 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023517 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023518 printf(" %d", n_str);
23519 printf("\n");
23520 }
23521 }
23522
Daniel Veillard3d97e662004-11-04 10:49:00 +000023523 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000023524 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023525}
23526
23527
23528static int
23529test_xmlURIEscapeStr(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023530 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023531
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023532 int mem_base;
23533 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023534 xmlChar * str; /* string to escape */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023535 int n_str;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023536 xmlChar * list; /* exception list string of chars not to escape */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023537 int n_list;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023538
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023539 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
23540 for (n_list = 0;n_list < gen_nb_const_xmlChar_ptr;n_list++) {
23541 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000023542 str = gen_const_xmlChar_ptr(n_str, 0);
23543 list = gen_const_xmlChar_ptr(n_list, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023544
23545 ret_val = xmlURIEscapeStr(str, list);
23546 desret_xmlChar_ptr(ret_val);
23547 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000023548 des_const_xmlChar_ptr(n_str, str, 0);
23549 des_const_xmlChar_ptr(n_list, list, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023550 xmlResetLastError();
23551 if (mem_base != xmlMemBlocks()) {
23552 printf("Leak of %d blocks found in xmlURIEscapeStr",
23553 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023554 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023555 printf(" %d", n_str);
23556 printf(" %d", n_list);
23557 printf("\n");
23558 }
23559 }
23560 }
23561
Daniel Veillard3d97e662004-11-04 10:49:00 +000023562 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000023563 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023564}
23565
23566
23567static int
23568test_xmlURIUnescapeString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023569 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023570
23571
23572 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023573 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023574}
23575
23576static int
23577test_uri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023578 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023579
Daniel Veillardce682bc2004-11-05 17:22:25 +000023580 printf("Testing uri : 9 of 13 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000023581 test_ret += test_xmlBuildRelativeURI();
23582 test_ret += test_xmlBuildURI();
23583 test_ret += test_xmlCanonicPath();
23584 test_ret += test_xmlCreateURI();
23585 test_ret += test_xmlNormalizeURIPath();
23586 test_ret += test_xmlParseURI();
23587 test_ret += test_xmlParseURIReference();
23588 test_ret += test_xmlPrintURI();
23589 test_ret += test_xmlSaveUri();
23590 test_ret += test_xmlURIEscape();
23591 test_ret += test_xmlURIEscapeStr();
23592 test_ret += test_xmlURIUnescapeString();
Daniel Veillardd93f6252004-11-02 15:53:51 +000023593
Daniel Veillard42595322004-11-08 10:52:06 +000023594 if (test_ret != 0)
23595 printf("Module uri: %d errors\n", test_ret);
23596 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023597}
23598
23599static int
23600test_xmlAddAttributeDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023601 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023602
Daniel Veillard42595322004-11-08 10:52:06 +000023603 int mem_base;
23604 xmlAttributePtr ret_val;
23605 xmlValidCtxtPtr ctxt; /* the validation context */
23606 int n_ctxt;
23607 xmlDtdPtr dtd; /* pointer to the DTD */
23608 int n_dtd;
23609 xmlChar * elem; /* the element name */
23610 int n_elem;
23611 xmlChar * name; /* the attribute name */
23612 int n_name;
23613 xmlChar * ns; /* the attribute namespace prefix */
23614 int n_ns;
23615 xmlAttributeType type; /* the attribute type */
23616 int n_type;
23617 xmlAttributeDefault def; /* the attribute default type */
23618 int n_def;
23619 xmlChar * defaultValue; /* the attribute default value */
23620 int n_defaultValue;
23621 xmlEnumerationPtr tree; /* if it's an enumeration, the associated list */
23622 int n_tree;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023623
Daniel Veillard42595322004-11-08 10:52:06 +000023624 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
23625 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
23626 for (n_elem = 0;n_elem < gen_nb_const_xmlChar_ptr;n_elem++) {
23627 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
23628 for (n_ns = 0;n_ns < gen_nb_const_xmlChar_ptr;n_ns++) {
23629 for (n_type = 0;n_type < gen_nb_xmlAttributeType;n_type++) {
23630 for (n_def = 0;n_def < gen_nb_xmlAttributeDefault;n_def++) {
23631 for (n_defaultValue = 0;n_defaultValue < gen_nb_const_xmlChar_ptr;n_defaultValue++) {
23632 for (n_tree = 0;n_tree < gen_nb_xmlEnumerationPtr;n_tree++) {
23633 mem_base = xmlMemBlocks();
23634 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
23635 dtd = gen_xmlDtdPtr(n_dtd, 1);
23636 elem = gen_const_xmlChar_ptr(n_elem, 2);
23637 name = gen_const_xmlChar_ptr(n_name, 3);
23638 ns = gen_const_xmlChar_ptr(n_ns, 4);
23639 type = gen_xmlAttributeType(n_type, 5);
23640 def = gen_xmlAttributeDefault(n_def, 6);
23641 defaultValue = gen_const_xmlChar_ptr(n_defaultValue, 7);
23642 tree = gen_xmlEnumerationPtr(n_tree, 8);
23643
23644 ret_val = xmlAddAttributeDecl(ctxt, dtd, elem, name, ns, type, def, defaultValue, tree);
23645 desret_xmlAttributePtr(ret_val);
23646 call_tests++;
23647 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
23648 des_xmlDtdPtr(n_dtd, dtd, 1);
23649 des_const_xmlChar_ptr(n_elem, elem, 2);
23650 des_const_xmlChar_ptr(n_name, name, 3);
23651 des_const_xmlChar_ptr(n_ns, ns, 4);
23652 des_xmlAttributeType(n_type, type, 5);
23653 des_xmlAttributeDefault(n_def, def, 6);
23654 des_const_xmlChar_ptr(n_defaultValue, defaultValue, 7);
23655 des_xmlEnumerationPtr(n_tree, tree, 8);
23656 xmlResetLastError();
23657 if (mem_base != xmlMemBlocks()) {
23658 printf("Leak of %d blocks found in xmlAddAttributeDecl",
23659 xmlMemBlocks() - mem_base);
23660 test_ret++;
23661 printf(" %d", n_ctxt);
23662 printf(" %d", n_dtd);
23663 printf(" %d", n_elem);
23664 printf(" %d", n_name);
23665 printf(" %d", n_ns);
23666 printf(" %d", n_type);
23667 printf(" %d", n_def);
23668 printf(" %d", n_defaultValue);
23669 printf(" %d", n_tree);
23670 printf("\n");
23671 }
23672 }
23673 }
23674 }
23675 }
23676 }
23677 }
23678 }
23679 }
23680 }
23681
23682 function_tests++;
23683 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023684}
23685
23686
23687static int
23688test_xmlAddElementDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023689 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023690
Daniel Veillard42595322004-11-08 10:52:06 +000023691 int mem_base;
23692 xmlElementPtr ret_val;
23693 xmlValidCtxtPtr ctxt; /* the validation context */
23694 int n_ctxt;
23695 xmlDtdPtr dtd; /* pointer to the DTD */
23696 int n_dtd;
23697 xmlChar * name; /* the entity name */
23698 int n_name;
23699 xmlElementTypeVal type; /* the element type */
23700 int n_type;
23701 xmlElementContentPtr content; /* the element content tree or NULL */
23702 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023703
Daniel Veillard42595322004-11-08 10:52:06 +000023704 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
23705 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
23706 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
23707 for (n_type = 0;n_type < gen_nb_xmlElementTypeVal;n_type++) {
23708 for (n_content = 0;n_content < gen_nb_xmlElementContentPtr;n_content++) {
23709 mem_base = xmlMemBlocks();
23710 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
23711 dtd = gen_xmlDtdPtr(n_dtd, 1);
23712 name = gen_const_xmlChar_ptr(n_name, 2);
23713 type = gen_xmlElementTypeVal(n_type, 3);
23714 content = gen_xmlElementContentPtr(n_content, 4);
23715
23716 ret_val = xmlAddElementDecl(ctxt, dtd, name, type, content);
23717 desret_xmlElementPtr(ret_val);
23718 call_tests++;
23719 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
23720 des_xmlDtdPtr(n_dtd, dtd, 1);
23721 des_const_xmlChar_ptr(n_name, name, 2);
23722 des_xmlElementTypeVal(n_type, type, 3);
23723 des_xmlElementContentPtr(n_content, content, 4);
23724 xmlResetLastError();
23725 if (mem_base != xmlMemBlocks()) {
23726 printf("Leak of %d blocks found in xmlAddElementDecl",
23727 xmlMemBlocks() - mem_base);
23728 test_ret++;
23729 printf(" %d", n_ctxt);
23730 printf(" %d", n_dtd);
23731 printf(" %d", n_name);
23732 printf(" %d", n_type);
23733 printf(" %d", n_content);
23734 printf("\n");
23735 }
23736 }
23737 }
23738 }
23739 }
23740 }
23741
23742 function_tests++;
23743 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023744}
23745
23746
23747static int
23748test_xmlAddID(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023749 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023750
23751
23752 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023753 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023754}
23755
23756
23757static int
23758test_xmlAddNotationDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023759 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023760
23761
23762 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023763 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023764}
23765
23766
23767static int
23768test_xmlAddRef(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023769 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023770
23771
23772 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023773 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023774}
23775
23776
Daniel Veillardce682bc2004-11-05 17:22:25 +000023777#define gen_nb_xmlAttributeTablePtr 1
23778static xmlAttributeTablePtr gen_xmlAttributeTablePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23779 return(NULL);
23780}
23781static void des_xmlAttributeTablePtr(int no ATTRIBUTE_UNUSED, xmlAttributeTablePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23782}
23783
Daniel Veillardd93f6252004-11-02 15:53:51 +000023784static int
23785test_xmlCopyAttributeTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023786 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023787
23788
23789 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023790 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023791}
23792
23793
23794static int
23795test_xmlCopyElementContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023796 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023797
23798
23799 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023800 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023801}
23802
23803
Daniel Veillardce682bc2004-11-05 17:22:25 +000023804#define gen_nb_xmlElementTablePtr 1
23805static xmlElementTablePtr gen_xmlElementTablePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23806 return(NULL);
23807}
23808static void des_xmlElementTablePtr(int no ATTRIBUTE_UNUSED, xmlElementTablePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23809}
23810
Daniel Veillardd93f6252004-11-02 15:53:51 +000023811static int
23812test_xmlCopyElementTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023813 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023814
23815
23816 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023817 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023818}
23819
23820
23821static int
23822test_xmlCopyEnumeration(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023823 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023824
23825
23826 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023827 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023828}
23829
23830
Daniel Veillardce682bc2004-11-05 17:22:25 +000023831#define gen_nb_xmlNotationTablePtr 1
23832static xmlNotationTablePtr gen_xmlNotationTablePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23833 return(NULL);
23834}
23835static void des_xmlNotationTablePtr(int no ATTRIBUTE_UNUSED, xmlNotationTablePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23836}
23837
Daniel Veillardd93f6252004-11-02 15:53:51 +000023838static int
23839test_xmlCopyNotationTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023840 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023841
23842
23843 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023844 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023845}
23846
23847
23848static int
23849test_xmlCreateEnumeration(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023850 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023851
23852
23853 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023854 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023855}
23856
23857
Daniel Veillardce682bc2004-11-05 17:22:25 +000023858#define gen_nb_xmlAttributePtr 1
23859static xmlAttributePtr gen_xmlAttributePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23860 return(NULL);
23861}
23862static void des_xmlAttributePtr(int no ATTRIBUTE_UNUSED, xmlAttributePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23863}
23864
Daniel Veillardd93f6252004-11-02 15:53:51 +000023865static int
23866test_xmlDumpAttributeDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023867 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023868
Daniel Veillardce682bc2004-11-05 17:22:25 +000023869#ifdef LIBXML_OUTPUT_ENABLED
23870 int mem_base;
23871 xmlBufferPtr buf; /* the XML buffer output */
23872 int n_buf;
23873 xmlAttributePtr attr; /* An attribute declaration */
23874 int n_attr;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023875
Daniel Veillardce682bc2004-11-05 17:22:25 +000023876 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
23877 for (n_attr = 0;n_attr < gen_nb_xmlAttributePtr;n_attr++) {
23878 mem_base = xmlMemBlocks();
23879 buf = gen_xmlBufferPtr(n_buf, 0);
23880 attr = gen_xmlAttributePtr(n_attr, 1);
23881
23882 xmlDumpAttributeDecl(buf, attr);
23883 call_tests++;
23884 des_xmlBufferPtr(n_buf, buf, 0);
23885 des_xmlAttributePtr(n_attr, attr, 1);
23886 xmlResetLastError();
23887 if (mem_base != xmlMemBlocks()) {
23888 printf("Leak of %d blocks found in xmlDumpAttributeDecl",
23889 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023890 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023891 printf(" %d", n_buf);
23892 printf(" %d", n_attr);
23893 printf("\n");
23894 }
23895 }
23896 }
23897#endif
23898
23899 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000023900 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023901}
23902
23903
23904static int
23905test_xmlDumpAttributeTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023906 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023907
Daniel Veillardce682bc2004-11-05 17:22:25 +000023908#ifdef LIBXML_OUTPUT_ENABLED
23909 int mem_base;
23910 xmlBufferPtr buf; /* the XML buffer output */
23911 int n_buf;
23912 xmlAttributeTablePtr table; /* An attribute table */
23913 int n_table;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023914
Daniel Veillardce682bc2004-11-05 17:22:25 +000023915 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
23916 for (n_table = 0;n_table < gen_nb_xmlAttributeTablePtr;n_table++) {
23917 mem_base = xmlMemBlocks();
23918 buf = gen_xmlBufferPtr(n_buf, 0);
23919 table = gen_xmlAttributeTablePtr(n_table, 1);
23920
23921 xmlDumpAttributeTable(buf, table);
23922 call_tests++;
23923 des_xmlBufferPtr(n_buf, buf, 0);
23924 des_xmlAttributeTablePtr(n_table, table, 1);
23925 xmlResetLastError();
23926 if (mem_base != xmlMemBlocks()) {
23927 printf("Leak of %d blocks found in xmlDumpAttributeTable",
23928 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023929 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023930 printf(" %d", n_buf);
23931 printf(" %d", n_table);
23932 printf("\n");
23933 }
23934 }
23935 }
23936#endif
23937
23938 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000023939 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023940}
23941
23942
Daniel Veillardce682bc2004-11-05 17:22:25 +000023943#define gen_nb_xmlElementPtr 1
23944static xmlElementPtr gen_xmlElementPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23945 return(NULL);
23946}
23947static void des_xmlElementPtr(int no ATTRIBUTE_UNUSED, xmlElementPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23948}
23949
Daniel Veillardd93f6252004-11-02 15:53:51 +000023950static int
23951test_xmlDumpElementDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023952 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023953
Daniel Veillardce682bc2004-11-05 17:22:25 +000023954#ifdef LIBXML_OUTPUT_ENABLED
23955 int mem_base;
23956 xmlBufferPtr buf; /* the XML buffer output */
23957 int n_buf;
23958 xmlElementPtr elem; /* An element table */
23959 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023960
Daniel Veillardce682bc2004-11-05 17:22:25 +000023961 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
23962 for (n_elem = 0;n_elem < gen_nb_xmlElementPtr;n_elem++) {
23963 mem_base = xmlMemBlocks();
23964 buf = gen_xmlBufferPtr(n_buf, 0);
23965 elem = gen_xmlElementPtr(n_elem, 1);
23966
23967 xmlDumpElementDecl(buf, elem);
23968 call_tests++;
23969 des_xmlBufferPtr(n_buf, buf, 0);
23970 des_xmlElementPtr(n_elem, elem, 1);
23971 xmlResetLastError();
23972 if (mem_base != xmlMemBlocks()) {
23973 printf("Leak of %d blocks found in xmlDumpElementDecl",
23974 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023975 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023976 printf(" %d", n_buf);
23977 printf(" %d", n_elem);
23978 printf("\n");
23979 }
23980 }
23981 }
23982#endif
23983
23984 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000023985 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023986}
23987
23988
23989static int
23990test_xmlDumpElementTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023991 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023992
Daniel Veillardce682bc2004-11-05 17:22:25 +000023993#ifdef LIBXML_OUTPUT_ENABLED
23994 int mem_base;
23995 xmlBufferPtr buf; /* the XML buffer output */
23996 int n_buf;
23997 xmlElementTablePtr table; /* An element table */
23998 int n_table;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023999
Daniel Veillardce682bc2004-11-05 17:22:25 +000024000 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
24001 for (n_table = 0;n_table < gen_nb_xmlElementTablePtr;n_table++) {
24002 mem_base = xmlMemBlocks();
24003 buf = gen_xmlBufferPtr(n_buf, 0);
24004 table = gen_xmlElementTablePtr(n_table, 1);
24005
24006 xmlDumpElementTable(buf, table);
24007 call_tests++;
24008 des_xmlBufferPtr(n_buf, buf, 0);
24009 des_xmlElementTablePtr(n_table, table, 1);
24010 xmlResetLastError();
24011 if (mem_base != xmlMemBlocks()) {
24012 printf("Leak of %d blocks found in xmlDumpElementTable",
24013 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024014 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024015 printf(" %d", n_buf);
24016 printf(" %d", n_table);
24017 printf("\n");
24018 }
24019 }
24020 }
24021#endif
24022
24023 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000024024 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024025}
24026
24027
Daniel Veillardce682bc2004-11-05 17:22:25 +000024028#define gen_nb_xmlNotationPtr 1
24029static xmlNotationPtr gen_xmlNotationPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
24030 return(NULL);
24031}
24032static void des_xmlNotationPtr(int no ATTRIBUTE_UNUSED, xmlNotationPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
24033}
24034
Daniel Veillardd93f6252004-11-02 15:53:51 +000024035static int
24036test_xmlDumpNotationDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024037 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024038
Daniel Veillardce682bc2004-11-05 17:22:25 +000024039#ifdef LIBXML_OUTPUT_ENABLED
24040 int mem_base;
24041 xmlBufferPtr buf; /* the XML buffer output */
24042 int n_buf;
24043 xmlNotationPtr nota; /* A notation declaration */
24044 int n_nota;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024045
Daniel Veillardce682bc2004-11-05 17:22:25 +000024046 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
24047 for (n_nota = 0;n_nota < gen_nb_xmlNotationPtr;n_nota++) {
24048 mem_base = xmlMemBlocks();
24049 buf = gen_xmlBufferPtr(n_buf, 0);
24050 nota = gen_xmlNotationPtr(n_nota, 1);
24051
24052 xmlDumpNotationDecl(buf, nota);
24053 call_tests++;
24054 des_xmlBufferPtr(n_buf, buf, 0);
24055 des_xmlNotationPtr(n_nota, nota, 1);
24056 xmlResetLastError();
24057 if (mem_base != xmlMemBlocks()) {
24058 printf("Leak of %d blocks found in xmlDumpNotationDecl",
24059 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024060 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024061 printf(" %d", n_buf);
24062 printf(" %d", n_nota);
24063 printf("\n");
24064 }
24065 }
24066 }
24067#endif
24068
24069 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000024070 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024071}
24072
24073
24074static int
24075test_xmlDumpNotationTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024076 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024077
Daniel Veillardce682bc2004-11-05 17:22:25 +000024078#ifdef LIBXML_OUTPUT_ENABLED
24079 int mem_base;
24080 xmlBufferPtr buf; /* the XML buffer output */
24081 int n_buf;
24082 xmlNotationTablePtr table; /* A notation table */
24083 int n_table;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024084
Daniel Veillardce682bc2004-11-05 17:22:25 +000024085 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
24086 for (n_table = 0;n_table < gen_nb_xmlNotationTablePtr;n_table++) {
24087 mem_base = xmlMemBlocks();
24088 buf = gen_xmlBufferPtr(n_buf, 0);
24089 table = gen_xmlNotationTablePtr(n_table, 1);
24090
24091 xmlDumpNotationTable(buf, table);
24092 call_tests++;
24093 des_xmlBufferPtr(n_buf, buf, 0);
24094 des_xmlNotationTablePtr(n_table, table, 1);
24095 xmlResetLastError();
24096 if (mem_base != xmlMemBlocks()) {
24097 printf("Leak of %d blocks found in xmlDumpNotationTable",
24098 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024099 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024100 printf(" %d", n_buf);
24101 printf(" %d", n_table);
24102 printf("\n");
24103 }
24104 }
24105 }
24106#endif
24107
24108 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000024109 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024110}
24111
24112
24113static int
24114test_xmlGetDtdAttrDesc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024115 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024116
Daniel Veillard42595322004-11-08 10:52:06 +000024117 int mem_base;
24118 xmlAttributePtr ret_val;
24119 xmlDtdPtr dtd; /* a pointer to the DtD to search */
24120 int n_dtd;
24121 xmlChar * elem; /* the element name */
24122 int n_elem;
24123 xmlChar * name; /* the attribute name */
24124 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024125
Daniel Veillard42595322004-11-08 10:52:06 +000024126 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
24127 for (n_elem = 0;n_elem < gen_nb_const_xmlChar_ptr;n_elem++) {
24128 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24129 mem_base = xmlMemBlocks();
24130 dtd = gen_xmlDtdPtr(n_dtd, 0);
24131 elem = gen_const_xmlChar_ptr(n_elem, 1);
24132 name = gen_const_xmlChar_ptr(n_name, 2);
24133
24134 ret_val = xmlGetDtdAttrDesc(dtd, elem, name);
24135 desret_xmlAttributePtr(ret_val);
24136 call_tests++;
24137 des_xmlDtdPtr(n_dtd, dtd, 0);
24138 des_const_xmlChar_ptr(n_elem, elem, 1);
24139 des_const_xmlChar_ptr(n_name, name, 2);
24140 xmlResetLastError();
24141 if (mem_base != xmlMemBlocks()) {
24142 printf("Leak of %d blocks found in xmlGetDtdAttrDesc",
24143 xmlMemBlocks() - mem_base);
24144 test_ret++;
24145 printf(" %d", n_dtd);
24146 printf(" %d", n_elem);
24147 printf(" %d", n_name);
24148 printf("\n");
24149 }
24150 }
24151 }
24152 }
24153
24154 function_tests++;
24155 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024156}
24157
24158
24159static int
24160test_xmlGetDtdElementDesc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024161 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024162
Daniel Veillard42595322004-11-08 10:52:06 +000024163 int mem_base;
24164 xmlElementPtr ret_val;
24165 xmlDtdPtr dtd; /* a pointer to the DtD to search */
24166 int n_dtd;
24167 xmlChar * name; /* the element name */
24168 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024169
Daniel Veillard42595322004-11-08 10:52:06 +000024170 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
24171 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24172 mem_base = xmlMemBlocks();
24173 dtd = gen_xmlDtdPtr(n_dtd, 0);
24174 name = gen_const_xmlChar_ptr(n_name, 1);
24175
24176 ret_val = xmlGetDtdElementDesc(dtd, name);
24177 desret_xmlElementPtr(ret_val);
24178 call_tests++;
24179 des_xmlDtdPtr(n_dtd, dtd, 0);
24180 des_const_xmlChar_ptr(n_name, name, 1);
24181 xmlResetLastError();
24182 if (mem_base != xmlMemBlocks()) {
24183 printf("Leak of %d blocks found in xmlGetDtdElementDesc",
24184 xmlMemBlocks() - mem_base);
24185 test_ret++;
24186 printf(" %d", n_dtd);
24187 printf(" %d", n_name);
24188 printf("\n");
24189 }
24190 }
24191 }
24192
24193 function_tests++;
24194 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024195}
24196
24197
24198static int
24199test_xmlGetDtdNotationDesc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024200 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024201
24202
24203 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000024204 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024205}
24206
24207
24208static int
24209test_xmlGetDtdQAttrDesc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024210 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024211
Daniel Veillard42595322004-11-08 10:52:06 +000024212 int mem_base;
24213 xmlAttributePtr ret_val;
24214 xmlDtdPtr dtd; /* a pointer to the DtD to search */
24215 int n_dtd;
24216 xmlChar * elem; /* the element name */
24217 int n_elem;
24218 xmlChar * name; /* the attribute name */
24219 int n_name;
24220 xmlChar * prefix; /* the attribute namespace prefix */
24221 int n_prefix;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024222
Daniel Veillard42595322004-11-08 10:52:06 +000024223 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
24224 for (n_elem = 0;n_elem < gen_nb_const_xmlChar_ptr;n_elem++) {
24225 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24226 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
24227 mem_base = xmlMemBlocks();
24228 dtd = gen_xmlDtdPtr(n_dtd, 0);
24229 elem = gen_const_xmlChar_ptr(n_elem, 1);
24230 name = gen_const_xmlChar_ptr(n_name, 2);
24231 prefix = gen_const_xmlChar_ptr(n_prefix, 3);
24232
24233 ret_val = xmlGetDtdQAttrDesc(dtd, elem, name, prefix);
24234 desret_xmlAttributePtr(ret_val);
24235 call_tests++;
24236 des_xmlDtdPtr(n_dtd, dtd, 0);
24237 des_const_xmlChar_ptr(n_elem, elem, 1);
24238 des_const_xmlChar_ptr(n_name, name, 2);
24239 des_const_xmlChar_ptr(n_prefix, prefix, 3);
24240 xmlResetLastError();
24241 if (mem_base != xmlMemBlocks()) {
24242 printf("Leak of %d blocks found in xmlGetDtdQAttrDesc",
24243 xmlMemBlocks() - mem_base);
24244 test_ret++;
24245 printf(" %d", n_dtd);
24246 printf(" %d", n_elem);
24247 printf(" %d", n_name);
24248 printf(" %d", n_prefix);
24249 printf("\n");
24250 }
24251 }
24252 }
24253 }
24254 }
24255
24256 function_tests++;
24257 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024258}
24259
24260
24261static int
24262test_xmlGetDtdQElementDesc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024263 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024264
Daniel Veillard42595322004-11-08 10:52:06 +000024265 int mem_base;
24266 xmlElementPtr ret_val;
24267 xmlDtdPtr dtd; /* a pointer to the DtD to search */
24268 int n_dtd;
24269 xmlChar * name; /* the element name */
24270 int n_name;
24271 xmlChar * prefix; /* the element namespace prefix */
24272 int n_prefix;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024273
Daniel Veillard42595322004-11-08 10:52:06 +000024274 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
24275 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24276 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
24277 mem_base = xmlMemBlocks();
24278 dtd = gen_xmlDtdPtr(n_dtd, 0);
24279 name = gen_const_xmlChar_ptr(n_name, 1);
24280 prefix = gen_const_xmlChar_ptr(n_prefix, 2);
24281
24282 ret_val = xmlGetDtdQElementDesc(dtd, name, prefix);
24283 desret_xmlElementPtr(ret_val);
24284 call_tests++;
24285 des_xmlDtdPtr(n_dtd, dtd, 0);
24286 des_const_xmlChar_ptr(n_name, name, 1);
24287 des_const_xmlChar_ptr(n_prefix, prefix, 2);
24288 xmlResetLastError();
24289 if (mem_base != xmlMemBlocks()) {
24290 printf("Leak of %d blocks found in xmlGetDtdQElementDesc",
24291 xmlMemBlocks() - mem_base);
24292 test_ret++;
24293 printf(" %d", n_dtd);
24294 printf(" %d", n_name);
24295 printf(" %d", n_prefix);
24296 printf("\n");
24297 }
24298 }
24299 }
24300 }
24301
24302 function_tests++;
24303 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024304}
24305
24306
24307static int
24308test_xmlGetID(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024309 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024310
Daniel Veillard57b25162004-11-06 14:50:18 +000024311 int mem_base;
24312 xmlAttrPtr ret_val;
24313 xmlDocPtr doc; /* pointer to the document */
24314 int n_doc;
24315 xmlChar * ID; /* the ID value */
24316 int n_ID;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024317
Daniel Veillard57b25162004-11-06 14:50:18 +000024318 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24319 for (n_ID = 0;n_ID < gen_nb_const_xmlChar_ptr;n_ID++) {
24320 mem_base = xmlMemBlocks();
24321 doc = gen_xmlDocPtr(n_doc, 0);
24322 ID = gen_const_xmlChar_ptr(n_ID, 1);
24323
24324 ret_val = xmlGetID(doc, ID);
24325 desret_xmlAttrPtr(ret_val);
24326 call_tests++;
24327 des_xmlDocPtr(n_doc, doc, 0);
24328 des_const_xmlChar_ptr(n_ID, ID, 1);
24329 xmlResetLastError();
24330 if (mem_base != xmlMemBlocks()) {
24331 printf("Leak of %d blocks found in xmlGetID",
24332 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024333 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000024334 printf(" %d", n_doc);
24335 printf(" %d", n_ID);
24336 printf("\n");
24337 }
24338 }
24339 }
24340
24341 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000024342 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024343}
24344
24345
24346static int
24347test_xmlGetRefs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024348 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024349
24350
24351 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000024352 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024353}
24354
24355
24356static int
24357test_xmlIsID(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024358 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024359
Daniel Veillardce244ad2004-11-05 10:03:46 +000024360 int mem_base;
24361 int ret_val;
24362 xmlDocPtr doc; /* the document */
24363 int n_doc;
24364 xmlNodePtr elem; /* the element carrying the attribute */
24365 int n_elem;
24366 xmlAttrPtr attr; /* the attribute */
24367 int n_attr;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024368
Daniel Veillardce244ad2004-11-05 10:03:46 +000024369 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24370 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
24371 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
24372 mem_base = xmlMemBlocks();
24373 doc = gen_xmlDocPtr(n_doc, 0);
24374 elem = gen_xmlNodePtr(n_elem, 1);
24375 attr = gen_xmlAttrPtr(n_attr, 2);
24376
24377 ret_val = xmlIsID(doc, elem, attr);
24378 desret_int(ret_val);
24379 call_tests++;
24380 des_xmlDocPtr(n_doc, doc, 0);
24381 des_xmlNodePtr(n_elem, elem, 1);
24382 des_xmlAttrPtr(n_attr, attr, 2);
24383 xmlResetLastError();
24384 if (mem_base != xmlMemBlocks()) {
24385 printf("Leak of %d blocks found in xmlIsID",
24386 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024387 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000024388 printf(" %d", n_doc);
24389 printf(" %d", n_elem);
24390 printf(" %d", n_attr);
24391 printf("\n");
24392 }
24393 }
24394 }
24395 }
24396
24397 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000024398 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024399}
24400
24401
24402static int
24403test_xmlIsMixedElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024404 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024405
24406 int mem_base;
24407 int ret_val;
24408 xmlDocPtr doc; /* the document */
24409 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024410 xmlChar * name; /* the element name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000024411 int n_name;
24412
24413 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24414 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24415 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000024416 doc = gen_xmlDocPtr(n_doc, 0);
24417 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024418
24419 ret_val = xmlIsMixedElement(doc, name);
24420 desret_int(ret_val);
24421 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000024422 des_xmlDocPtr(n_doc, doc, 0);
24423 des_const_xmlChar_ptr(n_name, name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024424 xmlResetLastError();
24425 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000024426 printf("Leak of %d blocks found in xmlIsMixedElement",
Daniel Veillardd93f6252004-11-02 15:53:51 +000024427 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024428 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000024429 printf(" %d", n_doc);
24430 printf(" %d", n_name);
24431 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000024432 }
24433 }
24434 }
24435
Daniel Veillard3d97e662004-11-04 10:49:00 +000024436 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000024437 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024438}
24439
24440
24441static int
24442test_xmlIsRef(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024443 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024444
Daniel Veillardce244ad2004-11-05 10:03:46 +000024445 int mem_base;
24446 int ret_val;
24447 xmlDocPtr doc; /* the document */
24448 int n_doc;
24449 xmlNodePtr elem; /* the element carrying the attribute */
24450 int n_elem;
24451 xmlAttrPtr attr; /* the attribute */
24452 int n_attr;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024453
Daniel Veillardce244ad2004-11-05 10:03:46 +000024454 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24455 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
24456 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
24457 mem_base = xmlMemBlocks();
24458 doc = gen_xmlDocPtr(n_doc, 0);
24459 elem = gen_xmlNodePtr(n_elem, 1);
24460 attr = gen_xmlAttrPtr(n_attr, 2);
24461
24462 ret_val = xmlIsRef(doc, elem, attr);
24463 desret_int(ret_val);
24464 call_tests++;
24465 des_xmlDocPtr(n_doc, doc, 0);
24466 des_xmlNodePtr(n_elem, elem, 1);
24467 des_xmlAttrPtr(n_attr, attr, 2);
24468 xmlResetLastError();
24469 if (mem_base != xmlMemBlocks()) {
24470 printf("Leak of %d blocks found in xmlIsRef",
24471 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024472 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000024473 printf(" %d", n_doc);
24474 printf(" %d", n_elem);
24475 printf(" %d", n_attr);
24476 printf("\n");
24477 }
24478 }
24479 }
24480 }
24481
24482 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000024483 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024484}
24485
24486
24487static int
24488test_xmlNewElementContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024489 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024490
24491
24492 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000024493 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024494}
24495
24496
24497static int
24498test_xmlNewValidCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024499 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024500
24501
24502 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000024503 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024504}
24505
24506
24507static int
24508test_xmlRemoveID(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024509 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024510
Daniel Veillardce244ad2004-11-05 10:03:46 +000024511 int mem_base;
24512 int ret_val;
24513 xmlDocPtr doc; /* the document */
24514 int n_doc;
24515 xmlAttrPtr attr; /* the attribute */
24516 int n_attr;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024517
Daniel Veillardce244ad2004-11-05 10:03:46 +000024518 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24519 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
24520 mem_base = xmlMemBlocks();
24521 doc = gen_xmlDocPtr(n_doc, 0);
24522 attr = gen_xmlAttrPtr(n_attr, 1);
24523
24524 ret_val = xmlRemoveID(doc, attr);
24525 desret_int(ret_val);
24526 call_tests++;
24527 des_xmlDocPtr(n_doc, doc, 0);
24528 des_xmlAttrPtr(n_attr, attr, 1);
24529 xmlResetLastError();
24530 if (mem_base != xmlMemBlocks()) {
24531 printf("Leak of %d blocks found in xmlRemoveID",
24532 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024533 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000024534 printf(" %d", n_doc);
24535 printf(" %d", n_attr);
24536 printf("\n");
24537 }
24538 }
24539 }
24540
24541 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000024542 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024543}
24544
24545
24546static int
24547test_xmlRemoveRef(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024548 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024549
Daniel Veillardce244ad2004-11-05 10:03:46 +000024550 int mem_base;
24551 int ret_val;
24552 xmlDocPtr doc; /* the document */
24553 int n_doc;
24554 xmlAttrPtr attr; /* the attribute */
24555 int n_attr;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024556
Daniel Veillardce244ad2004-11-05 10:03:46 +000024557 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24558 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
24559 mem_base = xmlMemBlocks();
24560 doc = gen_xmlDocPtr(n_doc, 0);
24561 attr = gen_xmlAttrPtr(n_attr, 1);
24562
24563 ret_val = xmlRemoveRef(doc, attr);
24564 desret_int(ret_val);
24565 call_tests++;
24566 des_xmlDocPtr(n_doc, doc, 0);
24567 des_xmlAttrPtr(n_attr, attr, 1);
24568 xmlResetLastError();
24569 if (mem_base != xmlMemBlocks()) {
24570 printf("Leak of %d blocks found in xmlRemoveRef",
24571 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024572 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000024573 printf(" %d", n_doc);
24574 printf(" %d", n_attr);
24575 printf("\n");
24576 }
24577 }
24578 }
24579
24580 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000024581 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024582}
24583
24584
24585static int
24586test_xmlSnprintfElementContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024587 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024588
Daniel Veillardce682bc2004-11-05 17:22:25 +000024589 int mem_base;
24590 char * buf; /* an output buffer */
24591 int n_buf;
24592 int size; /* the buffer size */
24593 int n_size;
24594 xmlElementContentPtr content; /* An element table */
24595 int n_content;
24596 int glob; /* 1 if one must print the englobing parenthesis, 0 otherwise */
24597 int n_glob;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024598
Daniel Veillardce682bc2004-11-05 17:22:25 +000024599 for (n_buf = 0;n_buf < gen_nb_char_ptr;n_buf++) {
24600 for (n_size = 0;n_size < gen_nb_int;n_size++) {
24601 for (n_content = 0;n_content < gen_nb_xmlElementContentPtr;n_content++) {
24602 for (n_glob = 0;n_glob < gen_nb_int;n_glob++) {
24603 mem_base = xmlMemBlocks();
24604 buf = gen_char_ptr(n_buf, 0);
24605 size = gen_int(n_size, 1);
24606 content = gen_xmlElementContentPtr(n_content, 2);
24607 glob = gen_int(n_glob, 3);
24608
24609 xmlSnprintfElementContent(buf, size, content, glob);
24610 call_tests++;
24611 des_char_ptr(n_buf, buf, 0);
24612 des_int(n_size, size, 1);
24613 des_xmlElementContentPtr(n_content, content, 2);
24614 des_int(n_glob, glob, 3);
24615 xmlResetLastError();
24616 if (mem_base != xmlMemBlocks()) {
24617 printf("Leak of %d blocks found in xmlSnprintfElementContent",
24618 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024619 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024620 printf(" %d", n_buf);
24621 printf(" %d", n_size);
24622 printf(" %d", n_content);
24623 printf(" %d", n_glob);
24624 printf("\n");
24625 }
24626 }
24627 }
24628 }
24629 }
24630
24631 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000024632 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024633}
24634
24635
24636static int
24637test_xmlSprintfElementContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024638 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024639
Daniel Veillarda521d282004-11-09 14:59:59 +000024640#ifdef LIBXML_OUTPUT_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000024641 int mem_base;
24642 char * buf; /* an output buffer */
24643 int n_buf;
24644 xmlElementContentPtr content; /* An element table */
24645 int n_content;
24646 int glob; /* 1 if one must print the englobing parenthesis, 0 otherwise */
24647 int n_glob;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024648
Daniel Veillardce682bc2004-11-05 17:22:25 +000024649 for (n_buf = 0;n_buf < gen_nb_char_ptr;n_buf++) {
24650 for (n_content = 0;n_content < gen_nb_xmlElementContentPtr;n_content++) {
24651 for (n_glob = 0;n_glob < gen_nb_int;n_glob++) {
24652 mem_base = xmlMemBlocks();
24653 buf = gen_char_ptr(n_buf, 0);
24654 content = gen_xmlElementContentPtr(n_content, 1);
24655 glob = gen_int(n_glob, 2);
24656
24657 xmlSprintfElementContent(buf, content, glob);
24658 call_tests++;
24659 des_char_ptr(n_buf, buf, 0);
24660 des_xmlElementContentPtr(n_content, content, 1);
24661 des_int(n_glob, glob, 2);
24662 xmlResetLastError();
24663 if (mem_base != xmlMemBlocks()) {
24664 printf("Leak of %d blocks found in xmlSprintfElementContent",
24665 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024666 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024667 printf(" %d", n_buf);
24668 printf(" %d", n_content);
24669 printf(" %d", n_glob);
24670 printf("\n");
24671 }
24672 }
24673 }
24674 }
Daniel Veillarda521d282004-11-09 14:59:59 +000024675#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +000024676
24677 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000024678 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024679}
24680
24681
24682static int
24683test_xmlValidBuildContentModel(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024684 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024685
Daniel Veillardce682bc2004-11-05 17:22:25 +000024686#ifdef LIBXML_REGEXP_ENABLED
24687 int mem_base;
24688 int ret_val;
24689 xmlValidCtxtPtr ctxt; /* a validation context */
24690 int n_ctxt;
24691 xmlElementPtr elem; /* an element declaration node */
24692 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024693
Daniel Veillardce682bc2004-11-05 17:22:25 +000024694 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
24695 for (n_elem = 0;n_elem < gen_nb_xmlElementPtr;n_elem++) {
24696 mem_base = xmlMemBlocks();
24697 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
24698 elem = gen_xmlElementPtr(n_elem, 1);
24699
24700 ret_val = xmlValidBuildContentModel(ctxt, elem);
24701 desret_int(ret_val);
24702 call_tests++;
24703 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
24704 des_xmlElementPtr(n_elem, elem, 1);
24705 xmlResetLastError();
24706 if (mem_base != xmlMemBlocks()) {
24707 printf("Leak of %d blocks found in xmlValidBuildContentModel",
24708 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024709 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024710 printf(" %d", n_ctxt);
24711 printf(" %d", n_elem);
24712 printf("\n");
24713 }
24714 }
24715 }
24716#endif
24717
24718 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000024719 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024720}
24721
24722
24723static int
24724test_xmlValidCtxtNormalizeAttributeValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024725 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024726
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024727#ifdef LIBXML_VALID_ENABLED
24728 int mem_base;
24729 xmlChar * ret_val;
24730 xmlValidCtxtPtr ctxt; /* the validation context or NULL */
24731 int n_ctxt;
24732 xmlDocPtr doc; /* the document */
24733 int n_doc;
24734 xmlNodePtr elem; /* the parent */
24735 int n_elem;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024736 xmlChar * name; /* the attribute name */
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024737 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024738 xmlChar * value; /* the attribute value */
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024739 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024740
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024741 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
24742 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24743 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
24744 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24745 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
24746 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000024747 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
24748 doc = gen_xmlDocPtr(n_doc, 1);
24749 elem = gen_xmlNodePtr(n_elem, 2);
24750 name = gen_const_xmlChar_ptr(n_name, 3);
24751 value = gen_const_xmlChar_ptr(n_value, 4);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024752
24753 ret_val = xmlValidCtxtNormalizeAttributeValue(ctxt, doc, elem, name, value);
24754 desret_xmlChar_ptr(ret_val);
24755 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000024756 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
24757 des_xmlDocPtr(n_doc, doc, 1);
24758 des_xmlNodePtr(n_elem, elem, 2);
24759 des_const_xmlChar_ptr(n_name, name, 3);
24760 des_const_xmlChar_ptr(n_value, value, 4);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024761 xmlResetLastError();
24762 if (mem_base != xmlMemBlocks()) {
24763 printf("Leak of %d blocks found in xmlValidCtxtNormalizeAttributeValue",
24764 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024765 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024766 printf(" %d", n_ctxt);
24767 printf(" %d", n_doc);
24768 printf(" %d", n_elem);
24769 printf(" %d", n_name);
24770 printf(" %d", n_value);
24771 printf("\n");
24772 }
24773 }
24774 }
24775 }
24776 }
24777 }
24778#endif
24779
Daniel Veillard3d97e662004-11-04 10:49:00 +000024780 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000024781 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024782}
24783
24784
Daniel Veillardce682bc2004-11-05 17:22:25 +000024785#define gen_nb_xmlElementContent_ptr 1
24786static xmlElementContent * gen_xmlElementContent_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
24787 return(NULL);
24788}
24789static void des_xmlElementContent_ptr(int no ATTRIBUTE_UNUSED, xmlElementContent * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
24790}
24791
Daniel Veillardd93f6252004-11-02 15:53:51 +000024792static int
24793test_xmlValidGetPotentialChildren(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024794 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024795
Daniel Veillarda521d282004-11-09 14:59:59 +000024796#ifdef LIBXML_VALID_ENABLED
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024797 int mem_base;
24798 int ret_val;
24799 xmlElementContent * ctree; /* an element content tree */
24800 int n_ctree;
24801 xmlChar ** list; /* an array to store the list of child names */
24802 int n_list;
24803 int * len; /* a pointer to the number of element in the list */
24804 int n_len;
24805 int max; /* the size of the array */
24806 int n_max;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024807
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024808 for (n_ctree = 0;n_ctree < gen_nb_xmlElementContent_ptr;n_ctree++) {
24809 for (n_list = 0;n_list < gen_nb_const_xmlChar_ptr_ptr;n_list++) {
24810 for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
24811 for (n_max = 0;n_max < gen_nb_int;n_max++) {
24812 mem_base = xmlMemBlocks();
24813 ctree = gen_xmlElementContent_ptr(n_ctree, 0);
24814 list = gen_const_xmlChar_ptr_ptr(n_list, 1);
24815 len = gen_int_ptr(n_len, 2);
24816 max = gen_int(n_max, 3);
24817
24818 ret_val = xmlValidGetPotentialChildren(ctree, list, len, max);
24819 desret_int(ret_val);
24820 call_tests++;
24821 des_xmlElementContent_ptr(n_ctree, ctree, 0);
24822 des_const_xmlChar_ptr_ptr(n_list, list, 1);
24823 des_int_ptr(n_len, len, 2);
24824 des_int(n_max, max, 3);
24825 xmlResetLastError();
24826 if (mem_base != xmlMemBlocks()) {
24827 printf("Leak of %d blocks found in xmlValidGetPotentialChildren",
24828 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024829 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024830 printf(" %d", n_ctree);
24831 printf(" %d", n_list);
24832 printf(" %d", n_len);
24833 printf(" %d", n_max);
24834 printf("\n");
24835 }
24836 }
24837 }
24838 }
24839 }
Daniel Veillarda521d282004-11-09 14:59:59 +000024840#endif
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024841
24842 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000024843 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024844}
24845
24846
24847static int
24848test_xmlValidGetValidElements(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024849 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024850
Daniel Veillarda521d282004-11-09 14:59:59 +000024851#ifdef LIBXML_VALID_ENABLED
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024852 int mem_base;
24853 int ret_val;
24854 xmlNode * prev; /* an element to insert after */
24855 int n_prev;
24856 xmlNode * next; /* an element to insert next */
24857 int n_next;
24858 xmlChar ** names; /* an array to store the list of child names */
24859 int n_names;
24860 int max; /* the size of the array */
24861 int n_max;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024862
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024863 for (n_prev = 0;n_prev < gen_nb_xmlNodePtr;n_prev++) {
24864 for (n_next = 0;n_next < gen_nb_xmlNodePtr;n_next++) {
24865 for (n_names = 0;n_names < gen_nb_const_xmlChar_ptr_ptr;n_names++) {
24866 for (n_max = 0;n_max < gen_nb_int;n_max++) {
24867 mem_base = xmlMemBlocks();
24868 prev = gen_xmlNodePtr(n_prev, 0);
24869 next = gen_xmlNodePtr(n_next, 1);
24870 names = gen_const_xmlChar_ptr_ptr(n_names, 2);
24871 max = gen_int(n_max, 3);
24872
24873 ret_val = xmlValidGetValidElements(prev, next, names, max);
24874 desret_int(ret_val);
24875 call_tests++;
24876 des_xmlNodePtr(n_prev, prev, 0);
24877 des_xmlNodePtr(n_next, next, 1);
24878 des_const_xmlChar_ptr_ptr(n_names, names, 2);
24879 des_int(n_max, max, 3);
24880 xmlResetLastError();
24881 if (mem_base != xmlMemBlocks()) {
24882 printf("Leak of %d blocks found in xmlValidGetValidElements",
24883 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024884 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024885 printf(" %d", n_prev);
24886 printf(" %d", n_next);
24887 printf(" %d", n_names);
24888 printf(" %d", n_max);
24889 printf("\n");
24890 }
24891 }
24892 }
24893 }
24894 }
Daniel Veillarda521d282004-11-09 14:59:59 +000024895#endif
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024896
24897 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000024898 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024899}
24900
24901
24902static int
24903test_xmlValidNormalizeAttributeValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024904 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024905
Daniel Veillard8a32fe42004-11-02 22:10:16 +000024906#ifdef LIBXML_VALID_ENABLED
24907 int mem_base;
24908 xmlChar * ret_val;
24909 xmlDocPtr doc; /* the document */
24910 int n_doc;
24911 xmlNodePtr elem; /* the parent */
24912 int n_elem;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024913 xmlChar * name; /* the attribute name */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000024914 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024915 xmlChar * value; /* the attribute value */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000024916 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024917
Daniel Veillard8a32fe42004-11-02 22:10:16 +000024918 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24919 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
24920 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24921 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
24922 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000024923 doc = gen_xmlDocPtr(n_doc, 0);
24924 elem = gen_xmlNodePtr(n_elem, 1);
24925 name = gen_const_xmlChar_ptr(n_name, 2);
24926 value = gen_const_xmlChar_ptr(n_value, 3);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000024927
24928 ret_val = xmlValidNormalizeAttributeValue(doc, elem, name, value);
24929 desret_xmlChar_ptr(ret_val);
24930 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000024931 des_xmlDocPtr(n_doc, doc, 0);
24932 des_xmlNodePtr(n_elem, elem, 1);
24933 des_const_xmlChar_ptr(n_name, name, 2);
24934 des_const_xmlChar_ptr(n_value, value, 3);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000024935 xmlResetLastError();
24936 if (mem_base != xmlMemBlocks()) {
24937 printf("Leak of %d blocks found in xmlValidNormalizeAttributeValue",
24938 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024939 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000024940 printf(" %d", n_doc);
24941 printf(" %d", n_elem);
24942 printf(" %d", n_name);
24943 printf(" %d", n_value);
24944 printf("\n");
24945 }
24946 }
24947 }
24948 }
24949 }
24950#endif
24951
Daniel Veillard3d97e662004-11-04 10:49:00 +000024952 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000024953 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024954}
24955
24956
24957static int
24958test_xmlValidateAttributeDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024959 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024960
Daniel Veillardce682bc2004-11-05 17:22:25 +000024961#ifdef LIBXML_VALID_ENABLED
24962 int mem_base;
24963 int ret_val;
24964 xmlValidCtxtPtr ctxt; /* the validation context */
24965 int n_ctxt;
24966 xmlDocPtr doc; /* a document instance */
24967 int n_doc;
24968 xmlAttributePtr attr; /* an attribute definition */
24969 int n_attr;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024970
Daniel Veillardce682bc2004-11-05 17:22:25 +000024971 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
24972 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24973 for (n_attr = 0;n_attr < gen_nb_xmlAttributePtr;n_attr++) {
24974 mem_base = xmlMemBlocks();
24975 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
24976 doc = gen_xmlDocPtr(n_doc, 1);
24977 attr = gen_xmlAttributePtr(n_attr, 2);
24978
24979 ret_val = xmlValidateAttributeDecl(ctxt, doc, attr);
24980 desret_int(ret_val);
24981 call_tests++;
24982 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
24983 des_xmlDocPtr(n_doc, doc, 1);
24984 des_xmlAttributePtr(n_attr, attr, 2);
24985 xmlResetLastError();
24986 if (mem_base != xmlMemBlocks()) {
24987 printf("Leak of %d blocks found in xmlValidateAttributeDecl",
24988 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024989 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024990 printf(" %d", n_ctxt);
24991 printf(" %d", n_doc);
24992 printf(" %d", n_attr);
24993 printf("\n");
24994 }
24995 }
24996 }
24997 }
24998#endif
24999
25000 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000025001 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025002}
25003
25004
25005static int
25006test_xmlValidateAttributeValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025007 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025008
Daniel Veillard57b25162004-11-06 14:50:18 +000025009#ifdef LIBXML_VALID_ENABLED
25010 int mem_base;
25011 int ret_val;
25012 xmlAttributeType type; /* an attribute type */
25013 int n_type;
25014 xmlChar * value; /* an attribute value */
25015 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025016
Daniel Veillard57b25162004-11-06 14:50:18 +000025017 for (n_type = 0;n_type < gen_nb_xmlAttributeType;n_type++) {
25018 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25019 mem_base = xmlMemBlocks();
25020 type = gen_xmlAttributeType(n_type, 0);
25021 value = gen_const_xmlChar_ptr(n_value, 1);
25022
25023 ret_val = xmlValidateAttributeValue(type, value);
25024 desret_int(ret_val);
25025 call_tests++;
25026 des_xmlAttributeType(n_type, type, 0);
25027 des_const_xmlChar_ptr(n_value, value, 1);
25028 xmlResetLastError();
25029 if (mem_base != xmlMemBlocks()) {
25030 printf("Leak of %d blocks found in xmlValidateAttributeValue",
25031 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025032 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000025033 printf(" %d", n_type);
25034 printf(" %d", n_value);
25035 printf("\n");
25036 }
25037 }
25038 }
25039#endif
25040
25041 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000025042 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025043}
25044
25045
25046static int
25047test_xmlValidateDocument(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025048 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025049
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025050#ifdef LIBXML_VALID_ENABLED
25051 int mem_base;
25052 int ret_val;
25053 xmlValidCtxtPtr ctxt; /* the validation context */
25054 int n_ctxt;
25055 xmlDocPtr doc; /* a document instance */
25056 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025057
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025058 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25059 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25060 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025061 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25062 doc = gen_xmlDocPtr(n_doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025063
25064 ret_val = xmlValidateDocument(ctxt, doc);
25065 desret_int(ret_val);
25066 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025067 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25068 des_xmlDocPtr(n_doc, doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025069 xmlResetLastError();
25070 if (mem_base != xmlMemBlocks()) {
25071 printf("Leak of %d blocks found in xmlValidateDocument",
25072 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025073 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025074 printf(" %d", n_ctxt);
25075 printf(" %d", n_doc);
25076 printf("\n");
25077 }
25078 }
25079 }
25080#endif
25081
Daniel Veillard3d97e662004-11-04 10:49:00 +000025082 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000025083 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025084}
25085
25086
25087static int
25088test_xmlValidateDocumentFinal(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025089 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025090
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025091#ifdef LIBXML_VALID_ENABLED
25092 int mem_base;
25093 int ret_val;
25094 xmlValidCtxtPtr ctxt; /* the validation context */
25095 int n_ctxt;
25096 xmlDocPtr doc; /* a document instance */
25097 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025098
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025099 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25100 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25101 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025102 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25103 doc = gen_xmlDocPtr(n_doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025104
25105 ret_val = xmlValidateDocumentFinal(ctxt, doc);
25106 desret_int(ret_val);
25107 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025108 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25109 des_xmlDocPtr(n_doc, doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025110 xmlResetLastError();
25111 if (mem_base != xmlMemBlocks()) {
25112 printf("Leak of %d blocks found in xmlValidateDocumentFinal",
25113 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025114 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025115 printf(" %d", n_ctxt);
25116 printf(" %d", n_doc);
25117 printf("\n");
25118 }
25119 }
25120 }
25121#endif
25122
Daniel Veillard3d97e662004-11-04 10:49:00 +000025123 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000025124 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025125}
25126
25127
25128static int
25129test_xmlValidateDtd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025130 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025131
Daniel Veillard27f20102004-11-05 11:50:11 +000025132#ifdef LIBXML_VALID_ENABLED
25133 int mem_base;
25134 int ret_val;
25135 xmlValidCtxtPtr ctxt; /* the validation context */
25136 int n_ctxt;
25137 xmlDocPtr doc; /* a document instance */
25138 int n_doc;
25139 xmlDtdPtr dtd; /* a dtd instance */
25140 int n_dtd;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025141
Daniel Veillard27f20102004-11-05 11:50:11 +000025142 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25143 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25144 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
25145 mem_base = xmlMemBlocks();
25146 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25147 doc = gen_xmlDocPtr(n_doc, 1);
25148 dtd = gen_xmlDtdPtr(n_dtd, 2);
25149
25150 ret_val = xmlValidateDtd(ctxt, doc, dtd);
25151 desret_int(ret_val);
25152 call_tests++;
25153 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25154 des_xmlDocPtr(n_doc, doc, 1);
25155 des_xmlDtdPtr(n_dtd, dtd, 2);
25156 xmlResetLastError();
25157 if (mem_base != xmlMemBlocks()) {
25158 printf("Leak of %d blocks found in xmlValidateDtd",
25159 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025160 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000025161 printf(" %d", n_ctxt);
25162 printf(" %d", n_doc);
25163 printf(" %d", n_dtd);
25164 printf("\n");
25165 }
25166 }
25167 }
25168 }
25169#endif
25170
25171 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000025172 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025173}
25174
25175
25176static int
25177test_xmlValidateDtdFinal(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025178 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025179
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025180#ifdef LIBXML_VALID_ENABLED
25181 int mem_base;
25182 int ret_val;
25183 xmlValidCtxtPtr ctxt; /* the validation context */
25184 int n_ctxt;
25185 xmlDocPtr doc; /* a document instance */
25186 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025187
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025188 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25189 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25190 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025191 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25192 doc = gen_xmlDocPtr(n_doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025193
25194 ret_val = xmlValidateDtdFinal(ctxt, doc);
25195 desret_int(ret_val);
25196 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025197 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25198 des_xmlDocPtr(n_doc, doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025199 xmlResetLastError();
25200 if (mem_base != xmlMemBlocks()) {
25201 printf("Leak of %d blocks found in xmlValidateDtdFinal",
25202 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025203 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025204 printf(" %d", n_ctxt);
25205 printf(" %d", n_doc);
25206 printf("\n");
25207 }
25208 }
25209 }
25210#endif
25211
Daniel Veillard3d97e662004-11-04 10:49:00 +000025212 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000025213 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025214}
25215
25216
25217static int
25218test_xmlValidateElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025219 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025220
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025221#ifdef LIBXML_VALID_ENABLED
25222 int mem_base;
25223 int ret_val;
25224 xmlValidCtxtPtr ctxt; /* the validation context */
25225 int n_ctxt;
25226 xmlDocPtr doc; /* a document instance */
25227 int n_doc;
25228 xmlNodePtr elem; /* an element instance */
25229 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025230
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025231 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25232 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25233 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
25234 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025235 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25236 doc = gen_xmlDocPtr(n_doc, 1);
25237 elem = gen_xmlNodePtr(n_elem, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025238
25239 ret_val = xmlValidateElement(ctxt, doc, elem);
25240 desret_int(ret_val);
25241 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025242 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25243 des_xmlDocPtr(n_doc, doc, 1);
25244 des_xmlNodePtr(n_elem, elem, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025245 xmlResetLastError();
25246 if (mem_base != xmlMemBlocks()) {
25247 printf("Leak of %d blocks found in xmlValidateElement",
25248 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025249 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025250 printf(" %d", n_ctxt);
25251 printf(" %d", n_doc);
25252 printf(" %d", n_elem);
25253 printf("\n");
25254 }
25255 }
25256 }
25257 }
25258#endif
25259
Daniel Veillard3d97e662004-11-04 10:49:00 +000025260 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000025261 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025262}
25263
25264
25265static int
25266test_xmlValidateElementDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025267 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025268
Daniel Veillardce682bc2004-11-05 17:22:25 +000025269#ifdef LIBXML_VALID_ENABLED
25270 int mem_base;
25271 int ret_val;
25272 xmlValidCtxtPtr ctxt; /* the validation context */
25273 int n_ctxt;
25274 xmlDocPtr doc; /* a document instance */
25275 int n_doc;
25276 xmlElementPtr elem; /* an element definition */
25277 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025278
Daniel Veillardce682bc2004-11-05 17:22:25 +000025279 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25280 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25281 for (n_elem = 0;n_elem < gen_nb_xmlElementPtr;n_elem++) {
25282 mem_base = xmlMemBlocks();
25283 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25284 doc = gen_xmlDocPtr(n_doc, 1);
25285 elem = gen_xmlElementPtr(n_elem, 2);
25286
25287 ret_val = xmlValidateElementDecl(ctxt, doc, elem);
25288 desret_int(ret_val);
25289 call_tests++;
25290 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25291 des_xmlDocPtr(n_doc, doc, 1);
25292 des_xmlElementPtr(n_elem, elem, 2);
25293 xmlResetLastError();
25294 if (mem_base != xmlMemBlocks()) {
25295 printf("Leak of %d blocks found in xmlValidateElementDecl",
25296 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025297 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025298 printf(" %d", n_ctxt);
25299 printf(" %d", n_doc);
25300 printf(" %d", n_elem);
25301 printf("\n");
25302 }
25303 }
25304 }
25305 }
25306#endif
25307
25308 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000025309 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025310}
25311
25312
25313static int
25314test_xmlValidateNameValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025315 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025316
25317#ifdef LIBXML_VALID_ENABLED
25318 int mem_base;
25319 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025320 xmlChar * value; /* an Name value */
Daniel Veillardd93f6252004-11-02 15:53:51 +000025321 int n_value;
25322
25323 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25324 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025325 value = gen_const_xmlChar_ptr(n_value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025326
25327 ret_val = xmlValidateNameValue(value);
25328 desret_int(ret_val);
25329 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025330 des_const_xmlChar_ptr(n_value, value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025331 xmlResetLastError();
25332 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000025333 printf("Leak of %d blocks found in xmlValidateNameValue",
Daniel Veillardd93f6252004-11-02 15:53:51 +000025334 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025335 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000025336 printf(" %d", n_value);
25337 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000025338 }
25339 }
25340#endif
25341
Daniel Veillard3d97e662004-11-04 10:49:00 +000025342 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000025343 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025344}
25345
25346
25347static int
25348test_xmlValidateNamesValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025349 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025350
25351#ifdef LIBXML_VALID_ENABLED
25352 int mem_base;
25353 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025354 xmlChar * value; /* an Names value */
Daniel Veillardd93f6252004-11-02 15:53:51 +000025355 int n_value;
25356
25357 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25358 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025359 value = gen_const_xmlChar_ptr(n_value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025360
25361 ret_val = xmlValidateNamesValue(value);
25362 desret_int(ret_val);
25363 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025364 des_const_xmlChar_ptr(n_value, value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025365 xmlResetLastError();
25366 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000025367 printf("Leak of %d blocks found in xmlValidateNamesValue",
Daniel Veillardd93f6252004-11-02 15:53:51 +000025368 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025369 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000025370 printf(" %d", n_value);
25371 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000025372 }
25373 }
25374#endif
25375
Daniel Veillard3d97e662004-11-04 10:49:00 +000025376 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000025377 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025378}
25379
25380
25381static int
25382test_xmlValidateNmtokenValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025383 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025384
25385#ifdef LIBXML_VALID_ENABLED
25386 int mem_base;
25387 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025388 xmlChar * value; /* an Nmtoken value */
Daniel Veillardd93f6252004-11-02 15:53:51 +000025389 int n_value;
25390
25391 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25392 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025393 value = gen_const_xmlChar_ptr(n_value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025394
25395 ret_val = xmlValidateNmtokenValue(value);
25396 desret_int(ret_val);
25397 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025398 des_const_xmlChar_ptr(n_value, value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025399 xmlResetLastError();
25400 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000025401 printf("Leak of %d blocks found in xmlValidateNmtokenValue",
Daniel Veillardd93f6252004-11-02 15:53:51 +000025402 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025403 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000025404 printf(" %d", n_value);
25405 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000025406 }
25407 }
25408#endif
25409
Daniel Veillard3d97e662004-11-04 10:49:00 +000025410 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000025411 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025412}
25413
25414
25415static int
25416test_xmlValidateNmtokensValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025417 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025418
25419#ifdef LIBXML_VALID_ENABLED
25420 int mem_base;
25421 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025422 xmlChar * value; /* an Nmtokens value */
Daniel Veillardd93f6252004-11-02 15:53:51 +000025423 int n_value;
25424
25425 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25426 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025427 value = gen_const_xmlChar_ptr(n_value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025428
25429 ret_val = xmlValidateNmtokensValue(value);
25430 desret_int(ret_val);
25431 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025432 des_const_xmlChar_ptr(n_value, value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025433 xmlResetLastError();
25434 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000025435 printf("Leak of %d blocks found in xmlValidateNmtokensValue",
Daniel Veillardd93f6252004-11-02 15:53:51 +000025436 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025437 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000025438 printf(" %d", n_value);
25439 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000025440 }
25441 }
25442#endif
25443
Daniel Veillard3d97e662004-11-04 10:49:00 +000025444 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000025445 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025446}
25447
25448
25449static int
25450test_xmlValidateNotationDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025451 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025452
Daniel Veillardce682bc2004-11-05 17:22:25 +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 xmlNotationPtr nota; /* a notation definition */
25461 int n_nota;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025462
Daniel Veillardce682bc2004-11-05 17:22:25 +000025463 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25464 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25465 for (n_nota = 0;n_nota < gen_nb_xmlNotationPtr;n_nota++) {
25466 mem_base = xmlMemBlocks();
25467 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25468 doc = gen_xmlDocPtr(n_doc, 1);
25469 nota = gen_xmlNotationPtr(n_nota, 2);
25470
25471 ret_val = xmlValidateNotationDecl(ctxt, doc, nota);
25472 desret_int(ret_val);
25473 call_tests++;
25474 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25475 des_xmlDocPtr(n_doc, doc, 1);
25476 des_xmlNotationPtr(n_nota, nota, 2);
25477 xmlResetLastError();
25478 if (mem_base != xmlMemBlocks()) {
25479 printf("Leak of %d blocks found in xmlValidateNotationDecl",
25480 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025481 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025482 printf(" %d", n_ctxt);
25483 printf(" %d", n_doc);
25484 printf(" %d", n_nota);
25485 printf("\n");
25486 }
25487 }
25488 }
25489 }
25490#endif
25491
25492 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000025493 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025494}
25495
25496
25497static int
25498test_xmlValidateNotationUse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025499 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025500
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025501#ifdef LIBXML_VALID_ENABLED
25502 int mem_base;
25503 int ret_val;
25504 xmlValidCtxtPtr ctxt; /* the validation context */
25505 int n_ctxt;
25506 xmlDocPtr doc; /* the document */
25507 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025508 xmlChar * notationName; /* the notation name to check */
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025509 int n_notationName;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025510
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025511 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25512 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25513 for (n_notationName = 0;n_notationName < gen_nb_const_xmlChar_ptr;n_notationName++) {
25514 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025515 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25516 doc = gen_xmlDocPtr(n_doc, 1);
25517 notationName = gen_const_xmlChar_ptr(n_notationName, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025518
25519 ret_val = xmlValidateNotationUse(ctxt, doc, notationName);
25520 desret_int(ret_val);
25521 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025522 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25523 des_xmlDocPtr(n_doc, doc, 1);
25524 des_const_xmlChar_ptr(n_notationName, notationName, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025525 xmlResetLastError();
25526 if (mem_base != xmlMemBlocks()) {
25527 printf("Leak of %d blocks found in xmlValidateNotationUse",
25528 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025529 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025530 printf(" %d", n_ctxt);
25531 printf(" %d", n_doc);
25532 printf(" %d", n_notationName);
25533 printf("\n");
25534 }
25535 }
25536 }
25537 }
25538#endif
25539
Daniel Veillard3d97e662004-11-04 10:49:00 +000025540 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000025541 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025542}
25543
25544
25545static int
25546test_xmlValidateOneAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025547 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025548
Daniel Veillardce244ad2004-11-05 10:03:46 +000025549#ifdef LIBXML_VALID_ENABLED
25550 int mem_base;
25551 int ret_val;
25552 xmlValidCtxtPtr ctxt; /* the validation context */
25553 int n_ctxt;
25554 xmlDocPtr doc; /* a document instance */
25555 int n_doc;
25556 xmlNodePtr elem; /* an element instance */
25557 int n_elem;
25558 xmlAttrPtr attr; /* an attribute instance */
25559 int n_attr;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025560 xmlChar * value; /* the attribute value (without entities processing) */
Daniel Veillardce244ad2004-11-05 10:03:46 +000025561 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025562
Daniel Veillardce244ad2004-11-05 10:03:46 +000025563 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25564 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25565 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
25566 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
25567 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25568 mem_base = xmlMemBlocks();
25569 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25570 doc = gen_xmlDocPtr(n_doc, 1);
25571 elem = gen_xmlNodePtr(n_elem, 2);
25572 attr = gen_xmlAttrPtr(n_attr, 3);
25573 value = gen_const_xmlChar_ptr(n_value, 4);
25574
25575 ret_val = xmlValidateOneAttribute(ctxt, doc, elem, attr, value);
25576 desret_int(ret_val);
25577 call_tests++;
25578 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25579 des_xmlDocPtr(n_doc, doc, 1);
25580 des_xmlNodePtr(n_elem, elem, 2);
25581 des_xmlAttrPtr(n_attr, attr, 3);
25582 des_const_xmlChar_ptr(n_value, value, 4);
25583 xmlResetLastError();
25584 if (mem_base != xmlMemBlocks()) {
25585 printf("Leak of %d blocks found in xmlValidateOneAttribute",
25586 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025587 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000025588 printf(" %d", n_ctxt);
25589 printf(" %d", n_doc);
25590 printf(" %d", n_elem);
25591 printf(" %d", n_attr);
25592 printf(" %d", n_value);
25593 printf("\n");
25594 }
25595 }
25596 }
25597 }
25598 }
25599 }
25600#endif
25601
25602 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000025603 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025604}
25605
25606
25607static int
25608test_xmlValidateOneElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025609 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025610
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025611#ifdef LIBXML_VALID_ENABLED
25612 int mem_base;
25613 int ret_val;
25614 xmlValidCtxtPtr ctxt; /* the validation context */
25615 int n_ctxt;
25616 xmlDocPtr doc; /* a document instance */
25617 int n_doc;
25618 xmlNodePtr elem; /* an element instance */
25619 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025620
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025621 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25622 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25623 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
25624 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025625 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25626 doc = gen_xmlDocPtr(n_doc, 1);
25627 elem = gen_xmlNodePtr(n_elem, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025628
25629 ret_val = xmlValidateOneElement(ctxt, doc, elem);
25630 desret_int(ret_val);
25631 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025632 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25633 des_xmlDocPtr(n_doc, doc, 1);
25634 des_xmlNodePtr(n_elem, elem, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025635 xmlResetLastError();
25636 if (mem_base != xmlMemBlocks()) {
25637 printf("Leak of %d blocks found in xmlValidateOneElement",
25638 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025639 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025640 printf(" %d", n_ctxt);
25641 printf(" %d", n_doc);
25642 printf(" %d", n_elem);
25643 printf("\n");
25644 }
25645 }
25646 }
25647 }
25648#endif
25649
Daniel Veillard3d97e662004-11-04 10:49:00 +000025650 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000025651 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025652}
25653
25654
25655static int
25656test_xmlValidateOneNamespace(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025657 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025658
Daniel Veillard27f20102004-11-05 11:50:11 +000025659#ifdef LIBXML_VALID_ENABLED
25660 int mem_base;
25661 int ret_val;
25662 xmlValidCtxtPtr ctxt; /* the validation context */
25663 int n_ctxt;
25664 xmlDocPtr doc; /* a document instance */
25665 int n_doc;
25666 xmlNodePtr elem; /* an element instance */
25667 int n_elem;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025668 xmlChar * prefix; /* the namespace prefix */
Daniel Veillard27f20102004-11-05 11:50:11 +000025669 int n_prefix;
25670 xmlNsPtr ns; /* an namespace declaration instance */
25671 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025672 xmlChar * value; /* the attribute value (without entities processing) */
Daniel Veillard27f20102004-11-05 11:50:11 +000025673 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025674
Daniel Veillard27f20102004-11-05 11:50:11 +000025675 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25676 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25677 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
25678 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
25679 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
25680 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25681 mem_base = xmlMemBlocks();
25682 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25683 doc = gen_xmlDocPtr(n_doc, 1);
25684 elem = gen_xmlNodePtr(n_elem, 2);
25685 prefix = gen_const_xmlChar_ptr(n_prefix, 3);
25686 ns = gen_xmlNsPtr(n_ns, 4);
25687 value = gen_const_xmlChar_ptr(n_value, 5);
25688
25689 ret_val = xmlValidateOneNamespace(ctxt, doc, elem, prefix, ns, value);
25690 desret_int(ret_val);
25691 call_tests++;
25692 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25693 des_xmlDocPtr(n_doc, doc, 1);
25694 des_xmlNodePtr(n_elem, elem, 2);
25695 des_const_xmlChar_ptr(n_prefix, prefix, 3);
25696 des_xmlNsPtr(n_ns, ns, 4);
25697 des_const_xmlChar_ptr(n_value, value, 5);
25698 xmlResetLastError();
25699 if (mem_base != xmlMemBlocks()) {
25700 printf("Leak of %d blocks found in xmlValidateOneNamespace",
25701 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025702 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000025703 printf(" %d", n_ctxt);
25704 printf(" %d", n_doc);
25705 printf(" %d", n_elem);
25706 printf(" %d", n_prefix);
25707 printf(" %d", n_ns);
25708 printf(" %d", n_value);
25709 printf("\n");
25710 }
25711 }
25712 }
25713 }
25714 }
25715 }
25716 }
25717#endif
25718
25719 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000025720 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025721}
25722
25723
25724static int
25725test_xmlValidatePopElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025726 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025727
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025728#ifdef LIBXML_REGEXP_ENABLED
25729 int mem_base;
25730 int ret_val;
25731 xmlValidCtxtPtr ctxt; /* the validation context */
25732 int n_ctxt;
25733 xmlDocPtr doc; /* a document instance */
25734 int n_doc;
25735 xmlNodePtr elem; /* an element instance */
25736 int n_elem;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025737 xmlChar * qname; /* the qualified name as appearing in the serialization */
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025738 int n_qname;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025739
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025740 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25741 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25742 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
25743 for (n_qname = 0;n_qname < gen_nb_const_xmlChar_ptr;n_qname++) {
25744 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025745 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25746 doc = gen_xmlDocPtr(n_doc, 1);
25747 elem = gen_xmlNodePtr(n_elem, 2);
25748 qname = gen_const_xmlChar_ptr(n_qname, 3);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025749
25750 ret_val = xmlValidatePopElement(ctxt, doc, elem, qname);
25751 desret_int(ret_val);
25752 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025753 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25754 des_xmlDocPtr(n_doc, doc, 1);
25755 des_xmlNodePtr(n_elem, elem, 2);
25756 des_const_xmlChar_ptr(n_qname, qname, 3);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025757 xmlResetLastError();
25758 if (mem_base != xmlMemBlocks()) {
25759 printf("Leak of %d blocks found in xmlValidatePopElement",
25760 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025761 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025762 printf(" %d", n_ctxt);
25763 printf(" %d", n_doc);
25764 printf(" %d", n_elem);
25765 printf(" %d", n_qname);
25766 printf("\n");
25767 }
25768 }
25769 }
25770 }
25771 }
25772#endif
25773
Daniel Veillard3d97e662004-11-04 10:49:00 +000025774 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000025775 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025776}
25777
25778
25779static int
25780test_xmlValidatePushCData(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025781 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025782
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025783#ifdef LIBXML_REGEXP_ENABLED
25784 int mem_base;
25785 int ret_val;
25786 xmlValidCtxtPtr ctxt; /* the validation context */
25787 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025788 xmlChar * data; /* some character data read */
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025789 int n_data;
25790 int len; /* the lenght of the data */
25791 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025792
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025793 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25794 for (n_data = 0;n_data < gen_nb_const_xmlChar_ptr;n_data++) {
25795 for (n_len = 0;n_len < gen_nb_int;n_len++) {
25796 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025797 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25798 data = gen_const_xmlChar_ptr(n_data, 1);
25799 len = gen_int(n_len, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025800
25801 ret_val = xmlValidatePushCData(ctxt, data, len);
25802 desret_int(ret_val);
25803 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025804 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25805 des_const_xmlChar_ptr(n_data, data, 1);
25806 des_int(n_len, len, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025807 xmlResetLastError();
25808 if (mem_base != xmlMemBlocks()) {
25809 printf("Leak of %d blocks found in xmlValidatePushCData",
25810 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025811 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025812 printf(" %d", n_ctxt);
25813 printf(" %d", n_data);
25814 printf(" %d", n_len);
25815 printf("\n");
25816 }
25817 }
25818 }
25819 }
25820#endif
25821
Daniel Veillard3d97e662004-11-04 10:49:00 +000025822 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000025823 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025824}
25825
25826
25827static int
25828test_xmlValidatePushElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025829 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025830
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025831#ifdef LIBXML_REGEXP_ENABLED
25832 int mem_base;
25833 int ret_val;
25834 xmlValidCtxtPtr ctxt; /* the validation context */
25835 int n_ctxt;
25836 xmlDocPtr doc; /* a document instance */
25837 int n_doc;
25838 xmlNodePtr elem; /* an element instance */
25839 int n_elem;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025840 xmlChar * qname; /* the qualified name as appearing in the serialization */
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025841 int n_qname;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025842
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025843 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25844 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25845 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
25846 for (n_qname = 0;n_qname < gen_nb_const_xmlChar_ptr;n_qname++) {
25847 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025848 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25849 doc = gen_xmlDocPtr(n_doc, 1);
25850 elem = gen_xmlNodePtr(n_elem, 2);
25851 qname = gen_const_xmlChar_ptr(n_qname, 3);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025852
25853 ret_val = xmlValidatePushElement(ctxt, doc, elem, qname);
25854 desret_int(ret_val);
25855 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025856 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25857 des_xmlDocPtr(n_doc, doc, 1);
25858 des_xmlNodePtr(n_elem, elem, 2);
25859 des_const_xmlChar_ptr(n_qname, qname, 3);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025860 xmlResetLastError();
25861 if (mem_base != xmlMemBlocks()) {
25862 printf("Leak of %d blocks found in xmlValidatePushElement",
25863 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025864 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025865 printf(" %d", n_ctxt);
25866 printf(" %d", n_doc);
25867 printf(" %d", n_elem);
25868 printf(" %d", n_qname);
25869 printf("\n");
25870 }
25871 }
25872 }
25873 }
25874 }
25875#endif
25876
Daniel Veillard3d97e662004-11-04 10:49:00 +000025877 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000025878 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025879}
25880
25881
25882static int
25883test_xmlValidateRoot(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025884 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025885
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025886#ifdef LIBXML_VALID_ENABLED
25887 int mem_base;
25888 int ret_val;
25889 xmlValidCtxtPtr ctxt; /* the validation context */
25890 int n_ctxt;
25891 xmlDocPtr doc; /* a document instance */
25892 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025893
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025894 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25895 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25896 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025897 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25898 doc = gen_xmlDocPtr(n_doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025899
25900 ret_val = xmlValidateRoot(ctxt, doc);
25901 desret_int(ret_val);
25902 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025903 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25904 des_xmlDocPtr(n_doc, doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025905 xmlResetLastError();
25906 if (mem_base != xmlMemBlocks()) {
25907 printf("Leak of %d blocks found in xmlValidateRoot",
25908 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025909 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025910 printf(" %d", n_ctxt);
25911 printf(" %d", n_doc);
25912 printf("\n");
25913 }
25914 }
25915 }
25916#endif
25917
Daniel Veillard3d97e662004-11-04 10:49:00 +000025918 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000025919 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025920}
25921
25922static int
25923test_valid(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025924 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025925
Daniel Veillard42595322004-11-08 10:52:06 +000025926 printf("Testing valid : 46 of 67 functions ...\n");
25927 test_ret += test_xmlAddAttributeDecl();
25928 test_ret += test_xmlAddElementDecl();
25929 test_ret += test_xmlAddID();
25930 test_ret += test_xmlAddNotationDecl();
25931 test_ret += test_xmlAddRef();
25932 test_ret += test_xmlCopyAttributeTable();
25933 test_ret += test_xmlCopyElementContent();
25934 test_ret += test_xmlCopyElementTable();
25935 test_ret += test_xmlCopyEnumeration();
25936 test_ret += test_xmlCopyNotationTable();
25937 test_ret += test_xmlCreateEnumeration();
25938 test_ret += test_xmlDumpAttributeDecl();
25939 test_ret += test_xmlDumpAttributeTable();
25940 test_ret += test_xmlDumpElementDecl();
25941 test_ret += test_xmlDumpElementTable();
25942 test_ret += test_xmlDumpNotationDecl();
25943 test_ret += test_xmlDumpNotationTable();
25944 test_ret += test_xmlGetDtdAttrDesc();
25945 test_ret += test_xmlGetDtdElementDesc();
25946 test_ret += test_xmlGetDtdNotationDesc();
25947 test_ret += test_xmlGetDtdQAttrDesc();
25948 test_ret += test_xmlGetDtdQElementDesc();
25949 test_ret += test_xmlGetID();
25950 test_ret += test_xmlGetRefs();
25951 test_ret += test_xmlIsID();
25952 test_ret += test_xmlIsMixedElement();
25953 test_ret += test_xmlIsRef();
25954 test_ret += test_xmlNewElementContent();
25955 test_ret += test_xmlNewValidCtxt();
25956 test_ret += test_xmlRemoveID();
25957 test_ret += test_xmlRemoveRef();
25958 test_ret += test_xmlSnprintfElementContent();
25959 test_ret += test_xmlSprintfElementContent();
25960 test_ret += test_xmlValidBuildContentModel();
25961 test_ret += test_xmlValidCtxtNormalizeAttributeValue();
25962 test_ret += test_xmlValidGetPotentialChildren();
25963 test_ret += test_xmlValidGetValidElements();
25964 test_ret += test_xmlValidNormalizeAttributeValue();
25965 test_ret += test_xmlValidateAttributeDecl();
25966 test_ret += test_xmlValidateAttributeValue();
25967 test_ret += test_xmlValidateDocument();
25968 test_ret += test_xmlValidateDocumentFinal();
25969 test_ret += test_xmlValidateDtd();
25970 test_ret += test_xmlValidateDtdFinal();
25971 test_ret += test_xmlValidateElement();
25972 test_ret += test_xmlValidateElementDecl();
25973 test_ret += test_xmlValidateNameValue();
25974 test_ret += test_xmlValidateNamesValue();
25975 test_ret += test_xmlValidateNmtokenValue();
25976 test_ret += test_xmlValidateNmtokensValue();
25977 test_ret += test_xmlValidateNotationDecl();
25978 test_ret += test_xmlValidateNotationUse();
25979 test_ret += test_xmlValidateOneAttribute();
25980 test_ret += test_xmlValidateOneElement();
25981 test_ret += test_xmlValidateOneNamespace();
25982 test_ret += test_xmlValidatePopElement();
25983 test_ret += test_xmlValidatePushCData();
25984 test_ret += test_xmlValidatePushElement();
25985 test_ret += test_xmlValidateRoot();
Daniel Veillardd93f6252004-11-02 15:53:51 +000025986
Daniel Veillard42595322004-11-08 10:52:06 +000025987 if (test_ret != 0)
25988 printf("Module valid: %d errors\n", test_ret);
25989 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025990}
25991
25992static int
25993test_xmlXIncludeNewContext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025994 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025995
25996
25997 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000025998 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025999}
26000
26001
26002static int
26003test_xmlXIncludeProcess(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026004 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026005
26006#ifdef LIBXML_XINCLUDE_ENABLED
26007 int mem_base;
26008 int ret_val;
26009 xmlDocPtr doc; /* an XML document */
26010 int n_doc;
26011
26012 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
26013 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026014 doc = gen_xmlDocPtr(n_doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026015
26016 ret_val = xmlXIncludeProcess(doc);
26017 desret_int(ret_val);
26018 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026019 des_xmlDocPtr(n_doc, doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026020 xmlResetLastError();
26021 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026022 printf("Leak of %d blocks found in xmlXIncludeProcess",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026023 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026024 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026025 printf(" %d", n_doc);
26026 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026027 }
26028 }
26029#endif
26030
Daniel Veillard3d97e662004-11-04 10:49:00 +000026031 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000026032 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026033}
26034
26035
26036static int
26037test_xmlXIncludeProcessFlags(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026038 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026039
26040#ifdef LIBXML_XINCLUDE_ENABLED
26041 int mem_base;
26042 int ret_val;
26043 xmlDocPtr doc; /* an XML document */
26044 int n_doc;
26045 int flags; /* a set of xmlParserOption used for parsing XML includes */
26046 int n_flags;
26047
26048 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
26049 for (n_flags = 0;n_flags < gen_nb_int;n_flags++) {
26050 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026051 doc = gen_xmlDocPtr(n_doc, 0);
26052 flags = gen_int(n_flags, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026053
26054 ret_val = xmlXIncludeProcessFlags(doc, flags);
26055 desret_int(ret_val);
26056 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026057 des_xmlDocPtr(n_doc, doc, 0);
26058 des_int(n_flags, flags, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026059 xmlResetLastError();
26060 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026061 printf("Leak of %d blocks found in xmlXIncludeProcessFlags",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026062 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026063 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026064 printf(" %d", n_doc);
26065 printf(" %d", n_flags);
26066 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026067 }
26068 }
26069 }
26070#endif
26071
Daniel Veillard3d97e662004-11-04 10:49:00 +000026072 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000026073 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026074}
26075
Daniel Veillarda521d282004-11-09 14:59:59 +000026076#ifdef LIBXML_XINCLUDE_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000026077
Daniel Veillardce682bc2004-11-05 17:22:25 +000026078#define gen_nb_xmlXIncludeCtxtPtr 1
26079static xmlXIncludeCtxtPtr gen_xmlXIncludeCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
26080 return(NULL);
26081}
26082static void des_xmlXIncludeCtxtPtr(int no ATTRIBUTE_UNUSED, xmlXIncludeCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
26083}
Daniel Veillarda521d282004-11-09 14:59:59 +000026084#endif
26085
Daniel Veillardce682bc2004-11-05 17:22:25 +000026086
Daniel Veillardd93f6252004-11-02 15:53:51 +000026087static int
26088test_xmlXIncludeProcessNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026089 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026090
Daniel Veillardce682bc2004-11-05 17:22:25 +000026091#ifdef LIBXML_XINCLUDE_ENABLED
26092 int mem_base;
26093 int ret_val;
26094 xmlXIncludeCtxtPtr ctxt; /* an existing XInclude context */
26095 int n_ctxt;
26096 xmlNodePtr node; /* a node in an XML document */
26097 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026098
Daniel Veillardce682bc2004-11-05 17:22:25 +000026099 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXIncludeCtxtPtr;n_ctxt++) {
26100 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
26101 mem_base = xmlMemBlocks();
26102 ctxt = gen_xmlXIncludeCtxtPtr(n_ctxt, 0);
26103 node = gen_xmlNodePtr(n_node, 1);
26104
26105 ret_val = xmlXIncludeProcessNode(ctxt, node);
26106 desret_int(ret_val);
26107 call_tests++;
26108 des_xmlXIncludeCtxtPtr(n_ctxt, ctxt, 0);
26109 des_xmlNodePtr(n_node, node, 1);
26110 xmlResetLastError();
26111 if (mem_base != xmlMemBlocks()) {
26112 printf("Leak of %d blocks found in xmlXIncludeProcessNode",
26113 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026114 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026115 printf(" %d", n_ctxt);
26116 printf(" %d", n_node);
26117 printf("\n");
26118 }
26119 }
26120 }
26121#endif
26122
26123 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000026124 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026125}
26126
26127
26128static int
26129test_xmlXIncludeProcessTree(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026130 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026131
26132#ifdef LIBXML_XINCLUDE_ENABLED
26133 int mem_base;
26134 int ret_val;
26135 xmlNodePtr tree; /* a node in an XML document */
26136 int n_tree;
26137
26138 for (n_tree = 0;n_tree < gen_nb_xmlNodePtr;n_tree++) {
26139 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026140 tree = gen_xmlNodePtr(n_tree, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026141
26142 ret_val = xmlXIncludeProcessTree(tree);
26143 desret_int(ret_val);
26144 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026145 des_xmlNodePtr(n_tree, tree, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026146 xmlResetLastError();
26147 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026148 printf("Leak of %d blocks found in xmlXIncludeProcessTree",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026149 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026150 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026151 printf(" %d", n_tree);
26152 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026153 }
26154 }
26155#endif
26156
Daniel Veillard3d97e662004-11-04 10:49:00 +000026157 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000026158 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026159}
26160
26161
26162static int
26163test_xmlXIncludeProcessTreeFlags(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026164 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026165
26166#ifdef LIBXML_XINCLUDE_ENABLED
26167 int mem_base;
26168 int ret_val;
26169 xmlNodePtr tree; /* a node in an XML document */
26170 int n_tree;
26171 int flags; /* a set of xmlParserOption used for parsing XML includes */
26172 int n_flags;
26173
26174 for (n_tree = 0;n_tree < gen_nb_xmlNodePtr;n_tree++) {
26175 for (n_flags = 0;n_flags < gen_nb_int;n_flags++) {
26176 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026177 tree = gen_xmlNodePtr(n_tree, 0);
26178 flags = gen_int(n_flags, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026179
26180 ret_val = xmlXIncludeProcessTreeFlags(tree, flags);
26181 desret_int(ret_val);
26182 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026183 des_xmlNodePtr(n_tree, tree, 0);
26184 des_int(n_flags, flags, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026185 xmlResetLastError();
26186 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026187 printf("Leak of %d blocks found in xmlXIncludeProcessTreeFlags",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026188 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026189 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026190 printf(" %d", n_tree);
26191 printf(" %d", n_flags);
26192 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026193 }
26194 }
26195 }
26196#endif
26197
Daniel Veillard3d97e662004-11-04 10:49:00 +000026198 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000026199 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026200}
26201
26202
26203static int
26204test_xmlXIncludeSetFlags(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026205 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026206
Daniel Veillardce682bc2004-11-05 17:22:25 +000026207#ifdef LIBXML_XINCLUDE_ENABLED
26208 int mem_base;
26209 int ret_val;
26210 xmlXIncludeCtxtPtr ctxt; /* an XInclude processing context */
26211 int n_ctxt;
26212 int flags; /* a set of xmlParserOption used for parsing XML includes */
26213 int n_flags;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026214
Daniel Veillardce682bc2004-11-05 17:22:25 +000026215 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXIncludeCtxtPtr;n_ctxt++) {
26216 for (n_flags = 0;n_flags < gen_nb_int;n_flags++) {
26217 mem_base = xmlMemBlocks();
26218 ctxt = gen_xmlXIncludeCtxtPtr(n_ctxt, 0);
26219 flags = gen_int(n_flags, 1);
26220
26221 ret_val = xmlXIncludeSetFlags(ctxt, flags);
26222 desret_int(ret_val);
26223 call_tests++;
26224 des_xmlXIncludeCtxtPtr(n_ctxt, ctxt, 0);
26225 des_int(n_flags, flags, 1);
26226 xmlResetLastError();
26227 if (mem_base != xmlMemBlocks()) {
26228 printf("Leak of %d blocks found in xmlXIncludeSetFlags",
26229 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026230 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026231 printf(" %d", n_ctxt);
26232 printf(" %d", n_flags);
26233 printf("\n");
26234 }
26235 }
26236 }
26237#endif
26238
26239 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000026240 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026241}
26242
26243static int
26244test_xinclude(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026245 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026246
Daniel Veillardce682bc2004-11-05 17:22:25 +000026247 printf("Testing xinclude : 6 of 8 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000026248 test_ret += test_xmlXIncludeNewContext();
26249 test_ret += test_xmlXIncludeProcess();
26250 test_ret += test_xmlXIncludeProcessFlags();
26251 test_ret += test_xmlXIncludeProcessNode();
26252 test_ret += test_xmlXIncludeProcessTree();
26253 test_ret += test_xmlXIncludeProcessTreeFlags();
26254 test_ret += test_xmlXIncludeSetFlags();
Daniel Veillardd93f6252004-11-02 15:53:51 +000026255
Daniel Veillard42595322004-11-08 10:52:06 +000026256 if (test_ret != 0)
26257 printf("Module xinclude: %d errors\n", test_ret);
26258 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026259}
26260
26261static int
26262test_xmlAllocOutputBuffer(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026263 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026264
Daniel Veillard3d95c732004-11-06 22:25:14 +000026265#ifdef LIBXML_OUTPUT_ENABLED
26266 int mem_base;
26267 xmlOutputBufferPtr ret_val;
26268 xmlCharEncodingHandlerPtr encoder; /* the encoding converter or NULL */
26269 int n_encoder;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026270
Daniel Veillard3d95c732004-11-06 22:25:14 +000026271 for (n_encoder = 0;n_encoder < gen_nb_xmlCharEncodingHandlerPtr;n_encoder++) {
26272 mem_base = xmlMemBlocks();
26273 encoder = gen_xmlCharEncodingHandlerPtr(n_encoder, 0);
26274
26275 ret_val = xmlAllocOutputBuffer(encoder);
26276 desret_xmlOutputBufferPtr(ret_val);
26277 call_tests++;
26278 des_xmlCharEncodingHandlerPtr(n_encoder, encoder, 0);
26279 xmlResetLastError();
26280 if (mem_base != xmlMemBlocks()) {
26281 printf("Leak of %d blocks found in xmlAllocOutputBuffer",
26282 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026283 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000026284 printf(" %d", n_encoder);
26285 printf("\n");
26286 }
26287 }
26288#endif
26289
26290 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000026291 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026292}
26293
26294
26295static int
26296test_xmlAllocParserInputBuffer(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026297 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026298
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000026299 int mem_base;
26300 xmlParserInputBufferPtr ret_val;
26301 xmlCharEncoding enc; /* the charset encoding if known */
26302 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026303
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000026304 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
26305 mem_base = xmlMemBlocks();
26306 enc = gen_xmlCharEncoding(n_enc, 0);
26307
26308 ret_val = xmlAllocParserInputBuffer(enc);
26309 desret_xmlParserInputBufferPtr(ret_val);
26310 call_tests++;
26311 des_xmlCharEncoding(n_enc, enc, 0);
26312 xmlResetLastError();
26313 if (mem_base != xmlMemBlocks()) {
26314 printf("Leak of %d blocks found in xmlAllocParserInputBuffer",
26315 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026316 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000026317 printf(" %d", n_enc);
26318 printf("\n");
26319 }
26320 }
26321
26322 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000026323 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026324}
26325
26326
26327static int
26328test_xmlCheckFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026329 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026330
26331 int mem_base;
26332 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026333 char * path; /* the path to check */
Daniel Veillardd93f6252004-11-02 15:53:51 +000026334 int n_path;
26335
26336 for (n_path = 0;n_path < gen_nb_const_char_ptr;n_path++) {
26337 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026338 path = gen_const_char_ptr(n_path, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026339
26340 ret_val = xmlCheckFilename(path);
26341 desret_int(ret_val);
26342 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026343 des_const_char_ptr(n_path, path, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026344 xmlResetLastError();
26345 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026346 printf("Leak of %d blocks found in xmlCheckFilename",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026347 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026348 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026349 printf(" %d", n_path);
26350 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026351 }
26352 }
26353
Daniel Veillard3d97e662004-11-04 10:49:00 +000026354 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000026355 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026356}
26357
26358
26359static int
26360test_xmlCheckHTTPInput(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026361 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026362
Daniel Veillard42595322004-11-08 10:52:06 +000026363 int mem_base;
26364 xmlParserInputPtr ret_val;
26365 xmlParserCtxtPtr ctxt; /* an XML parser context */
26366 int n_ctxt;
26367 xmlParserInputPtr ret; /* an XML parser input */
26368 int n_ret;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026369
Daniel Veillard42595322004-11-08 10:52:06 +000026370 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
26371 for (n_ret = 0;n_ret < gen_nb_xmlParserInputPtr;n_ret++) {
26372 mem_base = xmlMemBlocks();
26373 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
26374 ret = gen_xmlParserInputPtr(n_ret, 1);
26375
26376 ret_val = xmlCheckHTTPInput(ctxt, ret);
26377 desret_xmlParserInputPtr(ret_val);
26378 call_tests++;
26379 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
26380 des_xmlParserInputPtr(n_ret, ret, 1);
26381 xmlResetLastError();
26382 if (mem_base != xmlMemBlocks()) {
26383 printf("Leak of %d blocks found in xmlCheckHTTPInput",
26384 xmlMemBlocks() - mem_base);
26385 test_ret++;
26386 printf(" %d", n_ctxt);
26387 printf(" %d", n_ret);
26388 printf("\n");
26389 }
26390 }
26391 }
26392
26393 function_tests++;
26394 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026395}
26396
26397
26398static int
26399test_xmlCleanupInputCallbacks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026400 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026401
26402 int mem_base;
26403
26404 mem_base = xmlMemBlocks();
26405
26406 xmlCleanupInputCallbacks();
26407 call_tests++;
26408 xmlResetLastError();
26409 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026410 printf("Leak of %d blocks found in xmlCleanupInputCallbacks",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026411 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026412 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026413 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026414 }
26415
Daniel Veillard3d97e662004-11-04 10:49:00 +000026416 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000026417 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026418}
26419
26420
26421static int
26422test_xmlCleanupOutputCallbacks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026423 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026424
26425#ifdef LIBXML_OUTPUT_ENABLED
26426 int mem_base;
26427
26428 mem_base = xmlMemBlocks();
26429
26430 xmlCleanupOutputCallbacks();
26431 call_tests++;
26432 xmlResetLastError();
26433 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026434 printf("Leak of %d blocks found in xmlCleanupOutputCallbacks",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026435 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026436 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026437 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026438 }
26439#endif
26440
Daniel Veillard3d97e662004-11-04 10:49:00 +000026441 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000026442 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026443}
26444
26445
26446static int
26447test_xmlFileClose(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026448 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026449
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026450 int mem_base;
26451 int ret_val;
26452 void * context; /* the I/O context */
26453 int n_context;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026454
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026455 for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
26456 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026457 context = gen_void_ptr(n_context, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026458
26459 ret_val = xmlFileClose(context);
26460 desret_int(ret_val);
26461 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026462 des_void_ptr(n_context, context, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026463 xmlResetLastError();
26464 if (mem_base != xmlMemBlocks()) {
26465 printf("Leak of %d blocks found in xmlFileClose",
26466 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026467 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026468 printf(" %d", n_context);
26469 printf("\n");
26470 }
26471 }
26472
Daniel Veillard3d97e662004-11-04 10:49:00 +000026473 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000026474 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026475}
26476
26477
26478static int
26479test_xmlFileMatch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026480 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026481
26482 int mem_base;
26483 int ret_val;
26484 const char * filename; /* the URI for matching */
26485 int n_filename;
26486
26487 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
26488 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026489 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026490
26491 ret_val = xmlFileMatch(filename);
26492 desret_int(ret_val);
26493 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026494 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026495 xmlResetLastError();
26496 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026497 printf("Leak of %d blocks found in xmlFileMatch",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026498 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026499 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026500 printf(" %d", n_filename);
26501 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026502 }
26503 }
26504
Daniel Veillard3d97e662004-11-04 10:49:00 +000026505 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000026506 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026507}
26508
26509
26510static int
26511test_xmlFileOpen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026512 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026513
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026514 int mem_base;
26515 void * ret_val;
26516 const char * filename; /* the URI for matching */
26517 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026518
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026519 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
26520 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026521 filename = gen_filepath(n_filename, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026522
26523 ret_val = xmlFileOpen(filename);
26524 desret_void_ptr(ret_val);
26525 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026526 des_filepath(n_filename, filename, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026527 xmlResetLastError();
26528 if (mem_base != xmlMemBlocks()) {
26529 printf("Leak of %d blocks found in xmlFileOpen",
26530 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026531 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026532 printf(" %d", n_filename);
26533 printf("\n");
26534 }
26535 }
26536
Daniel Veillard3d97e662004-11-04 10:49:00 +000026537 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000026538 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026539}
26540
26541
26542static int
26543test_xmlFileRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026544 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026545
Daniel Veillardce682bc2004-11-05 17:22:25 +000026546 int mem_base;
26547 int ret_val;
26548 void * context; /* the I/O context */
26549 int n_context;
26550 char * buffer; /* where to drop data */
26551 int n_buffer;
26552 int len; /* number of bytes to write */
26553 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026554
Daniel Veillardce682bc2004-11-05 17:22:25 +000026555 for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
26556 for (n_buffer = 0;n_buffer < gen_nb_char_ptr;n_buffer++) {
26557 for (n_len = 0;n_len < gen_nb_int;n_len++) {
26558 mem_base = xmlMemBlocks();
26559 context = gen_void_ptr(n_context, 0);
26560 buffer = gen_char_ptr(n_buffer, 1);
26561 len = gen_int(n_len, 2);
26562
26563 ret_val = xmlFileRead(context, buffer, len);
26564 desret_int(ret_val);
26565 call_tests++;
26566 des_void_ptr(n_context, context, 0);
26567 des_char_ptr(n_buffer, buffer, 1);
26568 des_int(n_len, len, 2);
26569 xmlResetLastError();
26570 if (mem_base != xmlMemBlocks()) {
26571 printf("Leak of %d blocks found in xmlFileRead",
26572 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026573 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026574 printf(" %d", n_context);
26575 printf(" %d", n_buffer);
26576 printf(" %d", n_len);
26577 printf("\n");
26578 }
26579 }
26580 }
26581 }
26582
26583 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000026584 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026585}
26586
26587
26588static int
26589test_xmlIOFTPClose(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026590 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026591
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026592#ifdef LIBXML_FTP_ENABLED
26593 int mem_base;
26594 int ret_val;
26595 void * context; /* the I/O context */
26596 int n_context;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026597
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026598 for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
26599 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026600 context = gen_void_ptr(n_context, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026601
26602 ret_val = xmlIOFTPClose(context);
26603 desret_int(ret_val);
26604 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026605 des_void_ptr(n_context, context, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026606 xmlResetLastError();
26607 if (mem_base != xmlMemBlocks()) {
26608 printf("Leak of %d blocks found in xmlIOFTPClose",
26609 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026610 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026611 printf(" %d", n_context);
26612 printf("\n");
26613 }
26614 }
26615#endif
26616
Daniel Veillard3d97e662004-11-04 10:49:00 +000026617 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000026618 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026619}
26620
26621
26622static int
26623test_xmlIOFTPMatch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026624 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026625
26626#ifdef LIBXML_FTP_ENABLED
26627 int mem_base;
26628 int ret_val;
26629 const char * filename; /* the URI for matching */
26630 int n_filename;
26631
26632 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
26633 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026634 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026635
26636 ret_val = xmlIOFTPMatch(filename);
26637 desret_int(ret_val);
26638 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026639 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026640 xmlResetLastError();
26641 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026642 printf("Leak of %d blocks found in xmlIOFTPMatch",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026643 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026644 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026645 printf(" %d", n_filename);
26646 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026647 }
26648 }
26649#endif
26650
Daniel Veillard3d97e662004-11-04 10:49:00 +000026651 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000026652 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026653}
26654
26655
26656static int
26657test_xmlIOFTPOpen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026658 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026659
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026660#ifdef LIBXML_FTP_ENABLED
26661 int mem_base;
26662 void * ret_val;
26663 const char * filename; /* the URI for matching */
26664 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026665
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026666 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
26667 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026668 filename = gen_filepath(n_filename, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026669
26670 ret_val = xmlIOFTPOpen(filename);
26671 desret_void_ptr(ret_val);
26672 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026673 des_filepath(n_filename, filename, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026674 xmlResetLastError();
26675 if (mem_base != xmlMemBlocks()) {
26676 printf("Leak of %d blocks found in xmlIOFTPOpen",
26677 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026678 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026679 printf(" %d", n_filename);
26680 printf("\n");
26681 }
26682 }
26683#endif
26684
Daniel Veillard3d97e662004-11-04 10:49:00 +000026685 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000026686 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026687}
26688
26689
26690static int
26691test_xmlIOFTPRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026692 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026693
Daniel Veillardce682bc2004-11-05 17:22:25 +000026694#ifdef LIBXML_FTP_ENABLED
26695 int mem_base;
26696 int ret_val;
26697 void * context; /* the I/O context */
26698 int n_context;
26699 char * buffer; /* where to drop data */
26700 int n_buffer;
26701 int len; /* number of bytes to write */
26702 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026703
Daniel Veillardce682bc2004-11-05 17:22:25 +000026704 for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
26705 for (n_buffer = 0;n_buffer < gen_nb_char_ptr;n_buffer++) {
26706 for (n_len = 0;n_len < gen_nb_int;n_len++) {
26707 mem_base = xmlMemBlocks();
26708 context = gen_void_ptr(n_context, 0);
26709 buffer = gen_char_ptr(n_buffer, 1);
26710 len = gen_int(n_len, 2);
26711
26712 ret_val = xmlIOFTPRead(context, buffer, len);
26713 desret_int(ret_val);
26714 call_tests++;
26715 des_void_ptr(n_context, context, 0);
26716 des_char_ptr(n_buffer, buffer, 1);
26717 des_int(n_len, len, 2);
26718 xmlResetLastError();
26719 if (mem_base != xmlMemBlocks()) {
26720 printf("Leak of %d blocks found in xmlIOFTPRead",
26721 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026722 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026723 printf(" %d", n_context);
26724 printf(" %d", n_buffer);
26725 printf(" %d", n_len);
26726 printf("\n");
26727 }
26728 }
26729 }
26730 }
26731#endif
26732
26733 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000026734 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026735}
26736
26737
26738static int
26739test_xmlIOHTTPClose(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026740 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026741
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026742#ifdef LIBXML_HTTP_ENABLED
26743 int mem_base;
26744 int ret_val;
26745 void * context; /* the I/O context */
26746 int n_context;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026747
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026748 for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
26749 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026750 context = gen_void_ptr(n_context, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026751
26752 ret_val = xmlIOHTTPClose(context);
26753 desret_int(ret_val);
26754 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026755 des_void_ptr(n_context, context, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026756 xmlResetLastError();
26757 if (mem_base != xmlMemBlocks()) {
26758 printf("Leak of %d blocks found in xmlIOHTTPClose",
26759 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026760 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026761 printf(" %d", n_context);
26762 printf("\n");
26763 }
26764 }
26765#endif
26766
Daniel Veillard3d97e662004-11-04 10:49:00 +000026767 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000026768 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026769}
26770
26771
26772static int
26773test_xmlIOHTTPMatch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026774 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026775
26776#ifdef LIBXML_HTTP_ENABLED
26777 int mem_base;
26778 int ret_val;
26779 const char * filename; /* the URI for matching */
26780 int n_filename;
26781
26782 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
26783 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026784 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026785
26786 ret_val = xmlIOHTTPMatch(filename);
26787 desret_int(ret_val);
26788 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026789 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026790 xmlResetLastError();
26791 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026792 printf("Leak of %d blocks found in xmlIOHTTPMatch",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026793 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026794 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026795 printf(" %d", n_filename);
26796 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026797 }
26798 }
26799#endif
26800
Daniel Veillard3d97e662004-11-04 10:49:00 +000026801 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000026802 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026803}
26804
26805
26806static int
26807test_xmlIOHTTPOpen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026808 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026809
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026810#ifdef LIBXML_HTTP_ENABLED
26811 int mem_base;
26812 void * ret_val;
26813 const char * filename; /* the URI for matching */
26814 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026815
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026816 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
26817 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026818 filename = gen_filepath(n_filename, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026819
26820 ret_val = xmlIOHTTPOpen(filename);
26821 desret_void_ptr(ret_val);
26822 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026823 des_filepath(n_filename, filename, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026824 xmlResetLastError();
26825 if (mem_base != xmlMemBlocks()) {
26826 printf("Leak of %d blocks found in xmlIOHTTPOpen",
26827 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026828 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026829 printf(" %d", n_filename);
26830 printf("\n");
26831 }
26832 }
26833#endif
26834
Daniel Veillard3d97e662004-11-04 10:49:00 +000026835 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000026836 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026837}
26838
26839
26840static int
26841test_xmlIOHTTPOpenW(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026842 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026843
26844
26845 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000026846 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026847}
26848
26849
26850static int
26851test_xmlIOHTTPRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026852 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026853
Daniel Veillardce682bc2004-11-05 17:22:25 +000026854#ifdef LIBXML_HTTP_ENABLED
26855 int mem_base;
26856 int ret_val;
26857 void * context; /* the I/O context */
26858 int n_context;
26859 char * buffer; /* where to drop data */
26860 int n_buffer;
26861 int len; /* number of bytes to write */
26862 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026863
Daniel Veillardce682bc2004-11-05 17:22:25 +000026864 for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
26865 for (n_buffer = 0;n_buffer < gen_nb_char_ptr;n_buffer++) {
26866 for (n_len = 0;n_len < gen_nb_int;n_len++) {
26867 mem_base = xmlMemBlocks();
26868 context = gen_void_ptr(n_context, 0);
26869 buffer = gen_char_ptr(n_buffer, 1);
26870 len = gen_int(n_len, 2);
26871
26872 ret_val = xmlIOHTTPRead(context, buffer, len);
26873 desret_int(ret_val);
26874 call_tests++;
26875 des_void_ptr(n_context, context, 0);
26876 des_char_ptr(n_buffer, buffer, 1);
26877 des_int(n_len, len, 2);
26878 xmlResetLastError();
26879 if (mem_base != xmlMemBlocks()) {
26880 printf("Leak of %d blocks found in xmlIOHTTPRead",
26881 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026882 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026883 printf(" %d", n_context);
26884 printf(" %d", n_buffer);
26885 printf(" %d", n_len);
26886 printf("\n");
26887 }
26888 }
26889 }
26890 }
26891#endif
26892
26893 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000026894 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026895}
26896
26897
26898static int
26899test_xmlNoNetExternalEntityLoader(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026900 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026901
Daniel Veillard42595322004-11-08 10:52:06 +000026902 int mem_base;
26903 xmlParserInputPtr ret_val;
26904 const char * URL; /* the URL for the entity to load */
26905 int n_URL;
26906 char * ID; /* the System ID for the entity to load */
26907 int n_ID;
26908 xmlParserCtxtPtr ctxt; /* the context in which the entity is called or NULL */
26909 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026910
Daniel Veillard42595322004-11-08 10:52:06 +000026911 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
26912 for (n_ID = 0;n_ID < gen_nb_const_char_ptr;n_ID++) {
26913 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
26914 mem_base = xmlMemBlocks();
26915 URL = gen_filepath(n_URL, 0);
26916 ID = gen_const_char_ptr(n_ID, 1);
26917 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 2);
26918
26919 ret_val = xmlNoNetExternalEntityLoader(URL, ID, ctxt);
26920 desret_xmlParserInputPtr(ret_val);
26921 call_tests++;
26922 des_filepath(n_URL, URL, 0);
26923 des_const_char_ptr(n_ID, ID, 1);
26924 des_xmlParserCtxtPtr(n_ctxt, ctxt, 2);
26925 xmlResetLastError();
26926 if (mem_base != xmlMemBlocks()) {
26927 printf("Leak of %d blocks found in xmlNoNetExternalEntityLoader",
26928 xmlMemBlocks() - mem_base);
26929 test_ret++;
26930 printf(" %d", n_URL);
26931 printf(" %d", n_ID);
26932 printf(" %d", n_ctxt);
26933 printf("\n");
26934 }
26935 }
26936 }
26937 }
26938
26939 function_tests++;
26940 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026941}
26942
26943
26944static int
26945test_xmlNormalizeWindowsPath(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026946 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026947
Daniel Veillard8a32fe42004-11-02 22:10:16 +000026948 int mem_base;
26949 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026950 xmlChar * path; /* the input file path */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000026951 int n_path;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026952
Daniel Veillard8a32fe42004-11-02 22:10:16 +000026953 for (n_path = 0;n_path < gen_nb_const_xmlChar_ptr;n_path++) {
26954 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026955 path = gen_const_xmlChar_ptr(n_path, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000026956
26957 ret_val = xmlNormalizeWindowsPath(path);
26958 desret_xmlChar_ptr(ret_val);
26959 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026960 des_const_xmlChar_ptr(n_path, path, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000026961 xmlResetLastError();
26962 if (mem_base != xmlMemBlocks()) {
26963 printf("Leak of %d blocks found in xmlNormalizeWindowsPath",
26964 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026965 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000026966 printf(" %d", n_path);
26967 printf("\n");
26968 }
26969 }
26970
Daniel Veillard3d97e662004-11-04 10:49:00 +000026971 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000026972 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026973}
26974
26975
26976static int
26977test_xmlOutputBufferCreateFd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026978 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026979
Daniel Veillard3d95c732004-11-06 22:25:14 +000026980#ifdef LIBXML_OUTPUT_ENABLED
26981 int mem_base;
26982 xmlOutputBufferPtr ret_val;
26983 int fd; /* a file descriptor number */
26984 int n_fd;
26985 xmlCharEncodingHandlerPtr encoder; /* the encoding converter or NULL */
26986 int n_encoder;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026987
Daniel Veillard3d95c732004-11-06 22:25:14 +000026988 for (n_fd = 0;n_fd < gen_nb_int;n_fd++) {
26989 for (n_encoder = 0;n_encoder < gen_nb_xmlCharEncodingHandlerPtr;n_encoder++) {
26990 mem_base = xmlMemBlocks();
26991 fd = gen_int(n_fd, 0);
26992 encoder = gen_xmlCharEncodingHandlerPtr(n_encoder, 1);
26993
26994 ret_val = xmlOutputBufferCreateFd(fd, encoder);
26995 desret_xmlOutputBufferPtr(ret_val);
26996 call_tests++;
26997 des_int(n_fd, fd, 0);
26998 des_xmlCharEncodingHandlerPtr(n_encoder, encoder, 1);
26999 xmlResetLastError();
27000 if (mem_base != xmlMemBlocks()) {
27001 printf("Leak of %d blocks found in xmlOutputBufferCreateFd",
27002 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027003 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000027004 printf(" %d", n_fd);
27005 printf(" %d", n_encoder);
27006 printf("\n");
27007 }
27008 }
27009 }
27010#endif
27011
27012 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000027013 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027014}
27015
27016
27017static int
27018test_xmlOutputBufferCreateFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027019 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027020
Daniel Veillard3d95c732004-11-06 22:25:14 +000027021#ifdef LIBXML_OUTPUT_ENABLED
27022 int mem_base;
27023 xmlOutputBufferPtr ret_val;
27024 FILE * file; /* a FILE* */
27025 int n_file;
27026 xmlCharEncodingHandlerPtr encoder; /* the encoding converter or NULL */
27027 int n_encoder;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027028
Daniel Veillard3d95c732004-11-06 22:25:14 +000027029 for (n_file = 0;n_file < gen_nb_FILE_ptr;n_file++) {
27030 for (n_encoder = 0;n_encoder < gen_nb_xmlCharEncodingHandlerPtr;n_encoder++) {
27031 mem_base = xmlMemBlocks();
27032 file = gen_FILE_ptr(n_file, 0);
27033 encoder = gen_xmlCharEncodingHandlerPtr(n_encoder, 1);
27034
27035 ret_val = xmlOutputBufferCreateFile(file, encoder);
27036 desret_xmlOutputBufferPtr(ret_val);
27037 call_tests++;
27038 des_FILE_ptr(n_file, file, 0);
27039 des_xmlCharEncodingHandlerPtr(n_encoder, encoder, 1);
27040 xmlResetLastError();
27041 if (mem_base != xmlMemBlocks()) {
27042 printf("Leak of %d blocks found in xmlOutputBufferCreateFile",
27043 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027044 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000027045 printf(" %d", n_file);
27046 printf(" %d", n_encoder);
27047 printf("\n");
27048 }
27049 }
27050 }
27051#endif
27052
27053 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000027054 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027055}
27056
27057
27058static int
27059test_xmlOutputBufferCreateFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027060 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027061
Daniel Veillard3d95c732004-11-06 22:25:14 +000027062#ifdef LIBXML_OUTPUT_ENABLED
27063 int mem_base;
27064 xmlOutputBufferPtr ret_val;
27065 const char * URI; /* a C string containing the URI or filename */
27066 int n_URI;
27067 xmlCharEncodingHandlerPtr encoder; /* the encoding converter or NULL */
27068 int n_encoder;
27069 int compression; /* the compression ration (0 none, 9 max). */
27070 int n_compression;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027071
Daniel Veillard42595322004-11-08 10:52:06 +000027072 for (n_URI = 0;n_URI < gen_nb_fileoutput;n_URI++) {
Daniel Veillard3d95c732004-11-06 22:25:14 +000027073 for (n_encoder = 0;n_encoder < gen_nb_xmlCharEncodingHandlerPtr;n_encoder++) {
27074 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
27075 mem_base = xmlMemBlocks();
Daniel Veillard42595322004-11-08 10:52:06 +000027076 URI = gen_fileoutput(n_URI, 0);
Daniel Veillard3d95c732004-11-06 22:25:14 +000027077 encoder = gen_xmlCharEncodingHandlerPtr(n_encoder, 1);
27078 compression = gen_int(n_compression, 2);
27079
27080 ret_val = xmlOutputBufferCreateFilename(URI, encoder, compression);
27081 desret_xmlOutputBufferPtr(ret_val);
27082 call_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000027083 des_fileoutput(n_URI, URI, 0);
Daniel Veillard3d95c732004-11-06 22:25:14 +000027084 des_xmlCharEncodingHandlerPtr(n_encoder, encoder, 1);
27085 des_int(n_compression, compression, 2);
27086 xmlResetLastError();
27087 if (mem_base != xmlMemBlocks()) {
27088 printf("Leak of %d blocks found in xmlOutputBufferCreateFilename",
27089 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027090 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000027091 printf(" %d", n_URI);
27092 printf(" %d", n_encoder);
27093 printf(" %d", n_compression);
27094 printf("\n");
27095 }
27096 }
27097 }
27098 }
27099#endif
27100
27101 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000027102 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027103}
27104
27105
27106static int
27107test_xmlOutputBufferFlush(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027108 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027109
Daniel Veillard3d97e662004-11-04 10:49:00 +000027110#ifdef LIBXML_OUTPUT_ENABLED
27111 int mem_base;
27112 int ret_val;
27113 xmlOutputBufferPtr out; /* a buffered output */
27114 int n_out;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027115
Daniel Veillard3d97e662004-11-04 10:49:00 +000027116 for (n_out = 0;n_out < gen_nb_xmlOutputBufferPtr;n_out++) {
27117 mem_base = xmlMemBlocks();
27118 out = gen_xmlOutputBufferPtr(n_out, 0);
27119
27120 ret_val = xmlOutputBufferFlush(out);
27121 desret_int(ret_val);
27122 call_tests++;
27123 des_xmlOutputBufferPtr(n_out, out, 0);
27124 xmlResetLastError();
27125 if (mem_base != xmlMemBlocks()) {
27126 printf("Leak of %d blocks found in xmlOutputBufferFlush",
27127 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027128 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000027129 printf(" %d", n_out);
27130 printf("\n");
27131 }
27132 }
27133#endif
27134
27135 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000027136 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027137}
27138
27139
27140static int
27141test_xmlOutputBufferWrite(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027142 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027143
Daniel Veillard3d97e662004-11-04 10:49:00 +000027144#ifdef LIBXML_OUTPUT_ENABLED
27145 int mem_base;
27146 int ret_val;
27147 xmlOutputBufferPtr out; /* a buffered parser output */
27148 int n_out;
27149 int len; /* the size in bytes of the array. */
27150 int n_len;
Daniel Veillardce682bc2004-11-05 17:22:25 +000027151 char * buf; /* an char array */
Daniel Veillard3d97e662004-11-04 10:49:00 +000027152 int n_buf;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027153
Daniel Veillard3d97e662004-11-04 10:49:00 +000027154 for (n_out = 0;n_out < gen_nb_xmlOutputBufferPtr;n_out++) {
27155 for (n_len = 0;n_len < gen_nb_int;n_len++) {
27156 for (n_buf = 0;n_buf < gen_nb_const_char_ptr;n_buf++) {
27157 mem_base = xmlMemBlocks();
27158 out = gen_xmlOutputBufferPtr(n_out, 0);
27159 len = gen_int(n_len, 1);
27160 buf = gen_const_char_ptr(n_buf, 2);
27161
27162 ret_val = xmlOutputBufferWrite(out, len, buf);
27163 desret_int(ret_val);
27164 call_tests++;
27165 des_xmlOutputBufferPtr(n_out, out, 0);
27166 des_int(n_len, len, 1);
27167 des_const_char_ptr(n_buf, buf, 2);
27168 xmlResetLastError();
27169 if (mem_base != xmlMemBlocks()) {
27170 printf("Leak of %d blocks found in xmlOutputBufferWrite",
27171 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027172 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000027173 printf(" %d", n_out);
27174 printf(" %d", n_len);
27175 printf(" %d", n_buf);
27176 printf("\n");
27177 }
27178 }
27179 }
27180 }
27181#endif
27182
27183 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000027184 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027185}
27186
27187
27188static int
27189test_xmlOutputBufferWriteEscape(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027190 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027191
27192
27193 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000027194 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027195}
27196
27197
27198static int
27199test_xmlOutputBufferWriteString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027200 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027201
Daniel Veillard3d97e662004-11-04 10:49:00 +000027202#ifdef LIBXML_OUTPUT_ENABLED
27203 int mem_base;
27204 int ret_val;
27205 xmlOutputBufferPtr out; /* a buffered parser output */
27206 int n_out;
Daniel Veillardce682bc2004-11-05 17:22:25 +000027207 char * str; /* a zero terminated C string */
Daniel Veillard3d97e662004-11-04 10:49:00 +000027208 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027209
Daniel Veillard3d97e662004-11-04 10:49:00 +000027210 for (n_out = 0;n_out < gen_nb_xmlOutputBufferPtr;n_out++) {
27211 for (n_str = 0;n_str < gen_nb_const_char_ptr;n_str++) {
27212 mem_base = xmlMemBlocks();
27213 out = gen_xmlOutputBufferPtr(n_out, 0);
27214 str = gen_const_char_ptr(n_str, 1);
27215
27216 ret_val = xmlOutputBufferWriteString(out, str);
27217 desret_int(ret_val);
27218 call_tests++;
27219 des_xmlOutputBufferPtr(n_out, out, 0);
27220 des_const_char_ptr(n_str, str, 1);
27221 xmlResetLastError();
27222 if (mem_base != xmlMemBlocks()) {
27223 printf("Leak of %d blocks found in xmlOutputBufferWriteString",
27224 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027225 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000027226 printf(" %d", n_out);
27227 printf(" %d", n_str);
27228 printf("\n");
27229 }
27230 }
27231 }
27232#endif
27233
27234 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000027235 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027236}
27237
27238
27239static int
27240test_xmlParserGetDirectory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027241 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027242
27243
27244 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000027245 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027246}
27247
27248
27249static int
27250test_xmlParserInputBufferCreateFd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027251 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027252
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027253 int mem_base;
27254 xmlParserInputBufferPtr ret_val;
27255 int fd; /* a file descriptor number */
27256 int n_fd;
27257 xmlCharEncoding enc; /* the charset encoding if known */
27258 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027259
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027260 for (n_fd = 0;n_fd < gen_nb_int;n_fd++) {
27261 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
27262 mem_base = xmlMemBlocks();
27263 fd = gen_int(n_fd, 0);
27264 enc = gen_xmlCharEncoding(n_enc, 1);
27265 if (fd >= 0) fd = -1;
27266
27267 ret_val = xmlParserInputBufferCreateFd(fd, enc);
27268 desret_xmlParserInputBufferPtr(ret_val);
27269 call_tests++;
27270 des_int(n_fd, fd, 0);
27271 des_xmlCharEncoding(n_enc, enc, 1);
27272 xmlResetLastError();
27273 if (mem_base != xmlMemBlocks()) {
27274 printf("Leak of %d blocks found in xmlParserInputBufferCreateFd",
27275 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027276 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027277 printf(" %d", n_fd);
27278 printf(" %d", n_enc);
27279 printf("\n");
27280 }
27281 }
27282 }
27283
27284 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000027285 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027286}
27287
27288
27289static int
27290test_xmlParserInputBufferCreateFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027291 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027292
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027293 int mem_base;
27294 xmlParserInputBufferPtr ret_val;
27295 FILE * file; /* a FILE* */
27296 int n_file;
27297 xmlCharEncoding enc; /* the charset encoding if known */
27298 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027299
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027300 for (n_file = 0;n_file < gen_nb_FILE_ptr;n_file++) {
27301 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
27302 mem_base = xmlMemBlocks();
27303 file = gen_FILE_ptr(n_file, 0);
27304 enc = gen_xmlCharEncoding(n_enc, 1);
27305
27306 ret_val = xmlParserInputBufferCreateFile(file, enc);
27307 desret_xmlParserInputBufferPtr(ret_val);
27308 call_tests++;
27309 des_FILE_ptr(n_file, file, 0);
27310 des_xmlCharEncoding(n_enc, enc, 1);
27311 xmlResetLastError();
27312 if (mem_base != xmlMemBlocks()) {
27313 printf("Leak of %d blocks found in xmlParserInputBufferCreateFile",
27314 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027315 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027316 printf(" %d", n_file);
27317 printf(" %d", n_enc);
27318 printf("\n");
27319 }
27320 }
27321 }
27322
27323 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000027324 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027325}
27326
27327
27328static int
27329test_xmlParserInputBufferCreateFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027330 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027331
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027332 int mem_base;
27333 xmlParserInputBufferPtr ret_val;
27334 const char * URI; /* a C string containing the URI or filename */
27335 int n_URI;
27336 xmlCharEncoding enc; /* the charset encoding if known */
27337 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027338
Daniel Veillard42595322004-11-08 10:52:06 +000027339 for (n_URI = 0;n_URI < gen_nb_fileoutput;n_URI++) {
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027340 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
27341 mem_base = xmlMemBlocks();
Daniel Veillard42595322004-11-08 10:52:06 +000027342 URI = gen_fileoutput(n_URI, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027343 enc = gen_xmlCharEncoding(n_enc, 1);
27344
27345 ret_val = xmlParserInputBufferCreateFilename(URI, enc);
27346 desret_xmlParserInputBufferPtr(ret_val);
27347 call_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000027348 des_fileoutput(n_URI, URI, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027349 des_xmlCharEncoding(n_enc, enc, 1);
27350 xmlResetLastError();
27351 if (mem_base != xmlMemBlocks()) {
27352 printf("Leak of %d blocks found in xmlParserInputBufferCreateFilename",
27353 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027354 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027355 printf(" %d", n_URI);
27356 printf(" %d", n_enc);
27357 printf("\n");
27358 }
27359 }
27360 }
27361
27362 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000027363 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027364}
27365
27366
27367static int
27368test_xmlParserInputBufferCreateMem(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027369 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027370
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027371 int mem_base;
27372 xmlParserInputBufferPtr ret_val;
27373 char * mem; /* the memory input */
27374 int n_mem;
27375 int size; /* the length of the memory block */
27376 int n_size;
27377 xmlCharEncoding enc; /* the charset encoding if known */
27378 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027379
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027380 for (n_mem = 0;n_mem < gen_nb_const_char_ptr;n_mem++) {
27381 for (n_size = 0;n_size < gen_nb_int;n_size++) {
27382 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
27383 mem_base = xmlMemBlocks();
27384 mem = gen_const_char_ptr(n_mem, 0);
27385 size = gen_int(n_size, 1);
27386 enc = gen_xmlCharEncoding(n_enc, 2);
27387
27388 ret_val = xmlParserInputBufferCreateMem(mem, size, enc);
27389 desret_xmlParserInputBufferPtr(ret_val);
27390 call_tests++;
27391 des_const_char_ptr(n_mem, mem, 0);
27392 des_int(n_size, size, 1);
27393 des_xmlCharEncoding(n_enc, enc, 2);
27394 xmlResetLastError();
27395 if (mem_base != xmlMemBlocks()) {
27396 printf("Leak of %d blocks found in xmlParserInputBufferCreateMem",
27397 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027398 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027399 printf(" %d", n_mem);
27400 printf(" %d", n_size);
27401 printf(" %d", n_enc);
27402 printf("\n");
27403 }
27404 }
27405 }
27406 }
27407
27408 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000027409 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027410}
27411
27412
27413static int
27414test_xmlParserInputBufferCreateStatic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027415 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027416
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027417 int mem_base;
27418 xmlParserInputBufferPtr ret_val;
27419 char * mem; /* the memory input */
27420 int n_mem;
27421 int size; /* the length of the memory block */
27422 int n_size;
27423 xmlCharEncoding enc; /* the charset encoding if known */
27424 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027425
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027426 for (n_mem = 0;n_mem < gen_nb_const_char_ptr;n_mem++) {
27427 for (n_size = 0;n_size < gen_nb_int;n_size++) {
27428 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
27429 mem_base = xmlMemBlocks();
27430 mem = gen_const_char_ptr(n_mem, 0);
27431 size = gen_int(n_size, 1);
27432 enc = gen_xmlCharEncoding(n_enc, 2);
27433
27434 ret_val = xmlParserInputBufferCreateStatic(mem, size, enc);
27435 desret_xmlParserInputBufferPtr(ret_val);
27436 call_tests++;
27437 des_const_char_ptr(n_mem, mem, 0);
27438 des_int(n_size, size, 1);
27439 des_xmlCharEncoding(n_enc, enc, 2);
27440 xmlResetLastError();
27441 if (mem_base != xmlMemBlocks()) {
27442 printf("Leak of %d blocks found in xmlParserInputBufferCreateStatic",
27443 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027444 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027445 printf(" %d", n_mem);
27446 printf(" %d", n_size);
27447 printf(" %d", n_enc);
27448 printf("\n");
27449 }
27450 }
27451 }
27452 }
27453
27454 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000027455 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027456}
27457
27458
27459static int
27460test_xmlParserInputBufferGrow(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027461 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027462
Daniel Veillard34099b42004-11-04 17:34:35 +000027463 int mem_base;
27464 int ret_val;
27465 xmlParserInputBufferPtr in; /* a buffered parser input */
27466 int n_in;
27467 int len; /* indicative value of the amount of chars to read */
27468 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027469
Daniel Veillard34099b42004-11-04 17:34:35 +000027470 for (n_in = 0;n_in < gen_nb_xmlParserInputBufferPtr;n_in++) {
27471 for (n_len = 0;n_len < gen_nb_int;n_len++) {
27472 mem_base = xmlMemBlocks();
27473 in = gen_xmlParserInputBufferPtr(n_in, 0);
27474 len = gen_int(n_len, 1);
27475
27476 ret_val = xmlParserInputBufferGrow(in, len);
27477 desret_int(ret_val);
27478 call_tests++;
27479 des_xmlParserInputBufferPtr(n_in, in, 0);
27480 des_int(n_len, len, 1);
27481 xmlResetLastError();
27482 if (mem_base != xmlMemBlocks()) {
27483 printf("Leak of %d blocks found in xmlParserInputBufferGrow",
27484 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027485 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000027486 printf(" %d", n_in);
27487 printf(" %d", n_len);
27488 printf("\n");
27489 }
27490 }
27491 }
27492
27493 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000027494 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027495}
27496
27497
27498static int
27499test_xmlParserInputBufferPush(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027500 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027501
Daniel Veillard34099b42004-11-04 17:34:35 +000027502 int mem_base;
27503 int ret_val;
27504 xmlParserInputBufferPtr in; /* a buffered parser input */
27505 int n_in;
27506 int len; /* the size in bytes of the array. */
27507 int n_len;
Daniel Veillardce682bc2004-11-05 17:22:25 +000027508 char * buf; /* an char array */
Daniel Veillard34099b42004-11-04 17:34:35 +000027509 int n_buf;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027510
Daniel Veillard34099b42004-11-04 17:34:35 +000027511 for (n_in = 0;n_in < gen_nb_xmlParserInputBufferPtr;n_in++) {
27512 for (n_len = 0;n_len < gen_nb_int;n_len++) {
27513 for (n_buf = 0;n_buf < gen_nb_const_char_ptr;n_buf++) {
27514 mem_base = xmlMemBlocks();
27515 in = gen_xmlParserInputBufferPtr(n_in, 0);
27516 len = gen_int(n_len, 1);
27517 buf = gen_const_char_ptr(n_buf, 2);
27518
27519 ret_val = xmlParserInputBufferPush(in, len, buf);
27520 desret_int(ret_val);
27521 call_tests++;
27522 des_xmlParserInputBufferPtr(n_in, in, 0);
27523 des_int(n_len, len, 1);
27524 des_const_char_ptr(n_buf, buf, 2);
27525 xmlResetLastError();
27526 if (mem_base != xmlMemBlocks()) {
27527 printf("Leak of %d blocks found in xmlParserInputBufferPush",
27528 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027529 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000027530 printf(" %d", n_in);
27531 printf(" %d", n_len);
27532 printf(" %d", n_buf);
27533 printf("\n");
27534 }
27535 }
27536 }
27537 }
27538
27539 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000027540 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027541}
27542
27543
27544static int
27545test_xmlParserInputBufferRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027546 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027547
Daniel Veillard34099b42004-11-04 17:34:35 +000027548 int mem_base;
27549 int ret_val;
27550 xmlParserInputBufferPtr in; /* a buffered parser input */
27551 int n_in;
27552 int len; /* indicative value of the amount of chars to read */
27553 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027554
Daniel Veillard34099b42004-11-04 17:34:35 +000027555 for (n_in = 0;n_in < gen_nb_xmlParserInputBufferPtr;n_in++) {
27556 for (n_len = 0;n_len < gen_nb_int;n_len++) {
27557 mem_base = xmlMemBlocks();
27558 in = gen_xmlParserInputBufferPtr(n_in, 0);
27559 len = gen_int(n_len, 1);
27560
27561 ret_val = xmlParserInputBufferRead(in, len);
27562 desret_int(ret_val);
27563 call_tests++;
27564 des_xmlParserInputBufferPtr(n_in, in, 0);
27565 des_int(n_len, len, 1);
27566 xmlResetLastError();
27567 if (mem_base != xmlMemBlocks()) {
27568 printf("Leak of %d blocks found in xmlParserInputBufferRead",
27569 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027570 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000027571 printf(" %d", n_in);
27572 printf(" %d", n_len);
27573 printf("\n");
27574 }
27575 }
27576 }
27577
27578 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000027579 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027580}
27581
27582
27583static int
27584test_xmlPopInputCallbacks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027585 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027586
27587 int mem_base;
27588 int ret_val;
27589
27590 mem_base = xmlMemBlocks();
27591
27592 ret_val = xmlPopInputCallbacks();
27593 desret_int(ret_val);
27594 call_tests++;
27595 xmlResetLastError();
27596 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000027597 printf("Leak of %d blocks found in xmlPopInputCallbacks",
Daniel Veillardd93f6252004-11-02 15:53:51 +000027598 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027599 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000027600 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000027601 }
27602
Daniel Veillard3d97e662004-11-04 10:49:00 +000027603 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000027604 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027605}
27606
27607
27608static int
27609test_xmlRegisterDefaultInputCallbacks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027610 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027611
27612 int mem_base;
27613
27614 mem_base = xmlMemBlocks();
27615
27616 xmlRegisterDefaultInputCallbacks();
27617 call_tests++;
27618 xmlResetLastError();
27619 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000027620 printf("Leak of %d blocks found in xmlRegisterDefaultInputCallbacks",
Daniel Veillardd93f6252004-11-02 15:53:51 +000027621 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027622 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000027623 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000027624 }
27625
Daniel Veillard3d97e662004-11-04 10:49:00 +000027626 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000027627 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027628}
27629
27630
27631static int
27632test_xmlRegisterDefaultOutputCallbacks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027633 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027634
27635#ifdef LIBXML_OUTPUT_ENABLED
27636 int mem_base;
27637
27638 mem_base = xmlMemBlocks();
27639
27640 xmlRegisterDefaultOutputCallbacks();
27641 call_tests++;
27642 xmlResetLastError();
27643 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000027644 printf("Leak of %d blocks found in xmlRegisterDefaultOutputCallbacks",
Daniel Veillardd93f6252004-11-02 15:53:51 +000027645 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027646 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000027647 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000027648 }
27649#endif
27650
Daniel Veillard3d97e662004-11-04 10:49:00 +000027651 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000027652 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027653}
27654
27655
27656static int
27657test_xmlRegisterHTTPPostCallbacks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027658 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027659
27660#ifdef LIBXML_HTTP_ENABLED
27661 int mem_base;
27662
27663 mem_base = xmlMemBlocks();
27664
27665 xmlRegisterHTTPPostCallbacks();
27666 call_tests++;
27667 xmlResetLastError();
27668 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000027669 printf("Leak of %d blocks found in xmlRegisterHTTPPostCallbacks",
Daniel Veillardd93f6252004-11-02 15:53:51 +000027670 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027671 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000027672 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000027673 }
27674#endif
27675
Daniel Veillard3d97e662004-11-04 10:49:00 +000027676 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000027677 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027678}
27679
27680static int
27681test_xmlIO(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027682 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027683
Daniel Veillard42595322004-11-08 10:52:06 +000027684 printf("Testing xmlIO : 38 of 47 functions ...\n");
27685 test_ret += test_xmlAllocOutputBuffer();
27686 test_ret += test_xmlAllocParserInputBuffer();
27687 test_ret += test_xmlCheckFilename();
27688 test_ret += test_xmlCheckHTTPInput();
27689 test_ret += test_xmlCleanupInputCallbacks();
27690 test_ret += test_xmlCleanupOutputCallbacks();
27691 test_ret += test_xmlFileClose();
27692 test_ret += test_xmlFileMatch();
27693 test_ret += test_xmlFileOpen();
27694 test_ret += test_xmlFileRead();
27695 test_ret += test_xmlIOFTPClose();
27696 test_ret += test_xmlIOFTPMatch();
27697 test_ret += test_xmlIOFTPOpen();
27698 test_ret += test_xmlIOFTPRead();
27699 test_ret += test_xmlIOHTTPClose();
27700 test_ret += test_xmlIOHTTPMatch();
27701 test_ret += test_xmlIOHTTPOpen();
27702 test_ret += test_xmlIOHTTPOpenW();
27703 test_ret += test_xmlIOHTTPRead();
27704 test_ret += test_xmlNoNetExternalEntityLoader();
27705 test_ret += test_xmlNormalizeWindowsPath();
27706 test_ret += test_xmlOutputBufferCreateFd();
27707 test_ret += test_xmlOutputBufferCreateFile();
27708 test_ret += test_xmlOutputBufferCreateFilename();
27709 test_ret += test_xmlOutputBufferFlush();
27710 test_ret += test_xmlOutputBufferWrite();
27711 test_ret += test_xmlOutputBufferWriteEscape();
27712 test_ret += test_xmlOutputBufferWriteString();
27713 test_ret += test_xmlParserGetDirectory();
27714 test_ret += test_xmlParserInputBufferCreateFd();
27715 test_ret += test_xmlParserInputBufferCreateFile();
27716 test_ret += test_xmlParserInputBufferCreateFilename();
27717 test_ret += test_xmlParserInputBufferCreateMem();
27718 test_ret += test_xmlParserInputBufferCreateStatic();
27719 test_ret += test_xmlParserInputBufferGrow();
27720 test_ret += test_xmlParserInputBufferPush();
27721 test_ret += test_xmlParserInputBufferRead();
27722 test_ret += test_xmlPopInputCallbacks();
27723 test_ret += test_xmlRegisterDefaultInputCallbacks();
27724 test_ret += test_xmlRegisterDefaultOutputCallbacks();
27725 test_ret += test_xmlRegisterHTTPPostCallbacks();
Daniel Veillardd93f6252004-11-02 15:53:51 +000027726
Daniel Veillard42595322004-11-08 10:52:06 +000027727 if (test_ret != 0)
27728 printf("Module xmlIO: %d errors\n", test_ret);
27729 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027730}
Daniel Veillarda521d282004-11-09 14:59:59 +000027731#ifdef LIBXML_AUTOMATA_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000027732
Daniel Veillarda82b1822004-11-08 16:24:57 +000027733#define gen_nb_xmlAutomataPtr 1
27734static xmlAutomataPtr gen_xmlAutomataPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
27735 return(NULL);
27736}
27737static void des_xmlAutomataPtr(int no ATTRIBUTE_UNUSED, xmlAutomataPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
27738}
Daniel Veillarda521d282004-11-09 14:59:59 +000027739#endif
27740
Daniel Veillarda82b1822004-11-08 16:24:57 +000027741
27742static int
27743test_xmlAutomataCompile(void) {
27744 int test_ret = 0;
27745
27746
27747 /* missing type support */
27748 return(test_ret);
27749}
27750
27751
27752static int
27753test_xmlAutomataGetInitState(void) {
27754 int test_ret = 0;
27755
27756
27757 /* missing type support */
27758 return(test_ret);
27759}
27760
27761
27762static int
27763test_xmlAutomataIsDeterminist(void) {
27764 int test_ret = 0;
27765
27766#ifdef LIBXML_AUTOMATA_ENABLED
27767 int mem_base;
27768 int ret_val;
27769 xmlAutomataPtr am; /* an automata */
27770 int n_am;
27771
27772 for (n_am = 0;n_am < gen_nb_xmlAutomataPtr;n_am++) {
27773 mem_base = xmlMemBlocks();
27774 am = gen_xmlAutomataPtr(n_am, 0);
27775
27776 ret_val = xmlAutomataIsDeterminist(am);
27777 desret_int(ret_val);
27778 call_tests++;
27779 des_xmlAutomataPtr(n_am, am, 0);
27780 xmlResetLastError();
27781 if (mem_base != xmlMemBlocks()) {
27782 printf("Leak of %d blocks found in xmlAutomataIsDeterminist",
27783 xmlMemBlocks() - mem_base);
27784 test_ret++;
27785 printf(" %d", n_am);
27786 printf("\n");
27787 }
27788 }
27789#endif
27790
27791 function_tests++;
27792 return(test_ret);
27793}
27794
Daniel Veillarda521d282004-11-09 14:59:59 +000027795#ifdef LIBXML_AUTOMATA_ENABLED
Daniel Veillarda82b1822004-11-08 16:24:57 +000027796
27797#define gen_nb_xmlAutomataStatePtr 1
27798static xmlAutomataStatePtr gen_xmlAutomataStatePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
27799 return(NULL);
27800}
27801static void des_xmlAutomataStatePtr(int no ATTRIBUTE_UNUSED, xmlAutomataStatePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
27802}
Daniel Veillarda521d282004-11-09 14:59:59 +000027803#endif
27804
Daniel Veillarda82b1822004-11-08 16:24:57 +000027805
27806static int
27807test_xmlAutomataNewAllTrans(void) {
27808 int test_ret = 0;
27809
27810
27811 /* missing type support */
27812 return(test_ret);
27813}
27814
27815
27816static int
27817test_xmlAutomataNewCountTrans(void) {
27818 int test_ret = 0;
27819
27820
27821 /* missing type support */
27822 return(test_ret);
27823}
27824
27825
27826static int
27827test_xmlAutomataNewCountTrans2(void) {
27828 int test_ret = 0;
27829
27830
27831 /* missing type support */
27832 return(test_ret);
27833}
27834
27835
27836static int
27837test_xmlAutomataNewCountedTrans(void) {
27838 int test_ret = 0;
27839
27840
27841 /* missing type support */
27842 return(test_ret);
27843}
27844
27845
27846static int
27847test_xmlAutomataNewCounter(void) {
27848 int test_ret = 0;
27849
27850#ifdef LIBXML_AUTOMATA_ENABLED
27851 int mem_base;
27852 int ret_val;
27853 xmlAutomataPtr am; /* an automata */
27854 int n_am;
27855 int min; /* the minimal value on the counter */
27856 int n_min;
27857 int max; /* the maximal value on the counter */
27858 int n_max;
27859
27860 for (n_am = 0;n_am < gen_nb_xmlAutomataPtr;n_am++) {
27861 for (n_min = 0;n_min < gen_nb_int;n_min++) {
27862 for (n_max = 0;n_max < gen_nb_int;n_max++) {
27863 mem_base = xmlMemBlocks();
27864 am = gen_xmlAutomataPtr(n_am, 0);
27865 min = gen_int(n_min, 1);
27866 max = gen_int(n_max, 2);
27867
27868 ret_val = xmlAutomataNewCounter(am, min, max);
27869 desret_int(ret_val);
27870 call_tests++;
27871 des_xmlAutomataPtr(n_am, am, 0);
27872 des_int(n_min, min, 1);
27873 des_int(n_max, max, 2);
27874 xmlResetLastError();
27875 if (mem_base != xmlMemBlocks()) {
27876 printf("Leak of %d blocks found in xmlAutomataNewCounter",
27877 xmlMemBlocks() - mem_base);
27878 test_ret++;
27879 printf(" %d", n_am);
27880 printf(" %d", n_min);
27881 printf(" %d", n_max);
27882 printf("\n");
27883 }
27884 }
27885 }
27886 }
27887#endif
27888
27889 function_tests++;
27890 return(test_ret);
27891}
27892
27893
27894static int
27895test_xmlAutomataNewCounterTrans(void) {
27896 int test_ret = 0;
27897
27898
27899 /* missing type support */
27900 return(test_ret);
27901}
27902
27903
27904static int
27905test_xmlAutomataNewEpsilon(void) {
27906 int test_ret = 0;
27907
27908
27909 /* missing type support */
27910 return(test_ret);
27911}
27912
27913
27914static int
27915test_xmlAutomataNewOnceTrans(void) {
27916 int test_ret = 0;
27917
27918
27919 /* missing type support */
27920 return(test_ret);
27921}
27922
27923
27924static int
27925test_xmlAutomataNewOnceTrans2(void) {
27926 int test_ret = 0;
27927
27928
27929 /* missing type support */
27930 return(test_ret);
27931}
27932
27933
27934static int
27935test_xmlAutomataNewState(void) {
27936 int test_ret = 0;
27937
27938
27939 /* missing type support */
27940 return(test_ret);
27941}
27942
27943
27944static int
27945test_xmlAutomataNewTransition(void) {
27946 int test_ret = 0;
27947
27948
27949 /* missing type support */
27950 return(test_ret);
27951}
27952
27953
27954static int
27955test_xmlAutomataNewTransition2(void) {
27956 int test_ret = 0;
27957
27958
27959 /* missing type support */
27960 return(test_ret);
27961}
27962
27963
27964static int
27965test_xmlAutomataSetFinalState(void) {
27966 int test_ret = 0;
27967
27968#ifdef LIBXML_AUTOMATA_ENABLED
27969 int mem_base;
27970 int ret_val;
27971 xmlAutomataPtr am; /* an automata */
27972 int n_am;
27973 xmlAutomataStatePtr state; /* a state in this automata */
27974 int n_state;
27975
27976 for (n_am = 0;n_am < gen_nb_xmlAutomataPtr;n_am++) {
27977 for (n_state = 0;n_state < gen_nb_xmlAutomataStatePtr;n_state++) {
27978 mem_base = xmlMemBlocks();
27979 am = gen_xmlAutomataPtr(n_am, 0);
27980 state = gen_xmlAutomataStatePtr(n_state, 1);
27981
27982 ret_val = xmlAutomataSetFinalState(am, state);
27983 desret_int(ret_val);
27984 call_tests++;
27985 des_xmlAutomataPtr(n_am, am, 0);
27986 des_xmlAutomataStatePtr(n_state, state, 1);
27987 xmlResetLastError();
27988 if (mem_base != xmlMemBlocks()) {
27989 printf("Leak of %d blocks found in xmlAutomataSetFinalState",
27990 xmlMemBlocks() - mem_base);
27991 test_ret++;
27992 printf(" %d", n_am);
27993 printf(" %d", n_state);
27994 printf("\n");
27995 }
27996 }
27997 }
27998#endif
27999
28000 function_tests++;
28001 return(test_ret);
28002}
28003
28004
28005static int
28006test_xmlNewAutomata(void) {
28007 int test_ret = 0;
28008
28009
28010 /* missing type support */
28011 return(test_ret);
28012}
28013
28014static int
28015test_xmlautomata(void) {
28016 int test_ret = 0;
28017
28018 printf("Testing xmlautomata : 3 of 18 functions ...\n");
28019 test_ret += test_xmlAutomataCompile();
28020 test_ret += test_xmlAutomataGetInitState();
28021 test_ret += test_xmlAutomataIsDeterminist();
28022 test_ret += test_xmlAutomataNewAllTrans();
28023 test_ret += test_xmlAutomataNewCountTrans();
28024 test_ret += test_xmlAutomataNewCountTrans2();
28025 test_ret += test_xmlAutomataNewCountedTrans();
28026 test_ret += test_xmlAutomataNewCounter();
28027 test_ret += test_xmlAutomataNewCounterTrans();
28028 test_ret += test_xmlAutomataNewEpsilon();
28029 test_ret += test_xmlAutomataNewOnceTrans();
28030 test_ret += test_xmlAutomataNewOnceTrans2();
28031 test_ret += test_xmlAutomataNewState();
28032 test_ret += test_xmlAutomataNewTransition();
28033 test_ret += test_xmlAutomataNewTransition2();
28034 test_ret += test_xmlAutomataSetFinalState();
28035 test_ret += test_xmlNewAutomata();
28036
28037 if (test_ret != 0)
28038 printf("Module xmlautomata: %d errors\n", test_ret);
28039 return(test_ret);
28040}
28041
Daniel Veillardce682bc2004-11-05 17:22:25 +000028042#define gen_nb_xmlGenericErrorFunc_ptr 1
28043static xmlGenericErrorFunc * gen_xmlGenericErrorFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
28044 return(NULL);
28045}
28046static void des_xmlGenericErrorFunc_ptr(int no ATTRIBUTE_UNUSED, xmlGenericErrorFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
28047}
28048
Daniel Veillardd93f6252004-11-02 15:53:51 +000028049static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000028050test_initGenericErrorDefaultFunc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028051 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028052
Daniel Veillardce682bc2004-11-05 17:22:25 +000028053 int mem_base;
28054 xmlGenericErrorFunc * handler; /* the handler */
28055 int n_handler;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028056
Daniel Veillardce682bc2004-11-05 17:22:25 +000028057 for (n_handler = 0;n_handler < gen_nb_xmlGenericErrorFunc_ptr;n_handler++) {
28058 mem_base = xmlMemBlocks();
28059 handler = gen_xmlGenericErrorFunc_ptr(n_handler, 0);
28060
28061 initGenericErrorDefaultFunc(handler);
28062 call_tests++;
28063 des_xmlGenericErrorFunc_ptr(n_handler, handler, 0);
28064 xmlResetLastError();
28065 if (mem_base != xmlMemBlocks()) {
28066 printf("Leak of %d blocks found in initGenericErrorDefaultFunc",
28067 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028068 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028069 printf(" %d", n_handler);
28070 printf("\n");
28071 }
28072 }
28073
28074 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000028075 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028076}
28077
28078
Daniel Veillardce682bc2004-11-05 17:22:25 +000028079#define gen_nb_xmlErrorPtr 1
28080static xmlErrorPtr gen_xmlErrorPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
28081 return(NULL);
28082}
28083static void des_xmlErrorPtr(int no ATTRIBUTE_UNUSED, xmlErrorPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
28084}
28085
Daniel Veillardd93f6252004-11-02 15:53:51 +000028086static int
28087test_xmlCopyError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028088 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028089
Daniel Veillardce682bc2004-11-05 17:22:25 +000028090 int mem_base;
28091 int ret_val;
28092 xmlErrorPtr from; /* a source error */
28093 int n_from;
28094 xmlErrorPtr to; /* a target error */
28095 int n_to;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028096
Daniel Veillardce682bc2004-11-05 17:22:25 +000028097 for (n_from = 0;n_from < gen_nb_xmlErrorPtr;n_from++) {
28098 for (n_to = 0;n_to < gen_nb_xmlErrorPtr;n_to++) {
28099 mem_base = xmlMemBlocks();
28100 from = gen_xmlErrorPtr(n_from, 0);
28101 to = gen_xmlErrorPtr(n_to, 1);
28102
28103 ret_val = xmlCopyError(from, to);
28104 desret_int(ret_val);
28105 call_tests++;
28106 des_xmlErrorPtr(n_from, from, 0);
28107 des_xmlErrorPtr(n_to, to, 1);
28108 xmlResetLastError();
28109 if (mem_base != xmlMemBlocks()) {
28110 printf("Leak of %d blocks found in xmlCopyError",
28111 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028112 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028113 printf(" %d", n_from);
28114 printf(" %d", n_to);
28115 printf("\n");
28116 }
28117 }
28118 }
28119
28120 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000028121 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028122}
28123
28124
28125static int
28126test_xmlCtxtGetLastError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028127 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028128
28129
28130 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028131 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028132}
28133
28134
28135static int
28136test_xmlCtxtResetLastError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028137 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028138
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000028139 int mem_base;
28140 void * ctx; /* an XML parser context */
28141 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028142
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000028143 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
28144 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028145 ctx = gen_void_ptr(n_ctx, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000028146
28147 xmlCtxtResetLastError(ctx);
28148 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028149 des_void_ptr(n_ctx, ctx, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000028150 xmlResetLastError();
28151 if (mem_base != xmlMemBlocks()) {
28152 printf("Leak of %d blocks found in xmlCtxtResetLastError",
28153 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028154 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000028155 printf(" %d", n_ctx);
28156 printf("\n");
28157 }
28158 }
28159
Daniel Veillard3d97e662004-11-04 10:49:00 +000028160 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000028161 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028162}
28163
28164
28165static int
28166test_xmlGetLastError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028167 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028168
28169
28170 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028171 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028172}
28173
28174
28175static int
28176test_xmlParserError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028177 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028178
28179
28180 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028181 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028182}
28183
28184
28185static int
28186test_xmlParserPrintFileContext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028187 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028188
Daniel Veillardce682bc2004-11-05 17:22:25 +000028189 int mem_base;
28190 xmlParserInputPtr input; /* an xmlParserInputPtr input */
28191 int n_input;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028192
Daniel Veillardce682bc2004-11-05 17:22:25 +000028193 for (n_input = 0;n_input < gen_nb_xmlParserInputPtr;n_input++) {
28194 mem_base = xmlMemBlocks();
28195 input = gen_xmlParserInputPtr(n_input, 0);
28196
28197 xmlParserPrintFileContext(input);
28198 call_tests++;
28199 des_xmlParserInputPtr(n_input, input, 0);
28200 xmlResetLastError();
28201 if (mem_base != xmlMemBlocks()) {
28202 printf("Leak of %d blocks found in xmlParserPrintFileContext",
28203 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028204 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028205 printf(" %d", n_input);
28206 printf("\n");
28207 }
28208 }
28209
28210 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000028211 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028212}
28213
28214
28215static int
28216test_xmlParserPrintFileInfo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028217 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028218
Daniel Veillardce682bc2004-11-05 17:22:25 +000028219 int mem_base;
28220 xmlParserInputPtr input; /* an xmlParserInputPtr input */
28221 int n_input;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028222
Daniel Veillardce682bc2004-11-05 17:22:25 +000028223 for (n_input = 0;n_input < gen_nb_xmlParserInputPtr;n_input++) {
28224 mem_base = xmlMemBlocks();
28225 input = gen_xmlParserInputPtr(n_input, 0);
28226
28227 xmlParserPrintFileInfo(input);
28228 call_tests++;
28229 des_xmlParserInputPtr(n_input, input, 0);
28230 xmlResetLastError();
28231 if (mem_base != xmlMemBlocks()) {
28232 printf("Leak of %d blocks found in xmlParserPrintFileInfo",
28233 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028234 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028235 printf(" %d", n_input);
28236 printf("\n");
28237 }
28238 }
28239
28240 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000028241 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028242}
28243
28244
28245static int
28246test_xmlParserValidityError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028247 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028248
28249
28250 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028251 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028252}
28253
28254
28255static int
28256test_xmlParserValidityWarning(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028257 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028258
28259
28260 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028261 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028262}
28263
28264
28265static int
28266test_xmlParserWarning(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028267 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028268
28269
28270 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028271 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028272}
28273
28274
28275static int
28276test_xmlResetError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028277 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028278
Daniel Veillardce682bc2004-11-05 17:22:25 +000028279 int mem_base;
28280 xmlErrorPtr err; /* pointer to the error. */
28281 int n_err;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028282
Daniel Veillardce682bc2004-11-05 17:22:25 +000028283 for (n_err = 0;n_err < gen_nb_xmlErrorPtr;n_err++) {
28284 mem_base = xmlMemBlocks();
28285 err = gen_xmlErrorPtr(n_err, 0);
28286
28287 xmlResetError(err);
28288 call_tests++;
28289 des_xmlErrorPtr(n_err, err, 0);
28290 xmlResetLastError();
28291 if (mem_base != xmlMemBlocks()) {
28292 printf("Leak of %d blocks found in xmlResetError",
28293 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028294 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028295 printf(" %d", n_err);
28296 printf("\n");
28297 }
28298 }
28299
28300 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000028301 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028302}
28303
28304
28305static int
28306test_xmlResetLastError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028307 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028308
28309
28310
28311 xmlResetLastError();
28312 call_tests++;
28313 xmlResetLastError();
28314
Daniel Veillard3d97e662004-11-04 10:49:00 +000028315 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000028316 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028317}
28318
28319
28320static int
28321test_xmlSetGenericErrorFunc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028322 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028323
28324
28325 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028326 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028327}
28328
28329
28330static int
28331test_xmlSetStructuredErrorFunc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028332 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028333
28334
28335 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028336 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028337}
28338
28339static int
28340test_xmlerror(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028341 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028342
Daniel Veillardce682bc2004-11-05 17:22:25 +000028343 printf("Testing xmlerror : 7 of 15 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000028344 test_ret += test_initGenericErrorDefaultFunc();
28345 test_ret += test_xmlCopyError();
28346 test_ret += test_xmlCtxtGetLastError();
28347 test_ret += test_xmlCtxtResetLastError();
28348 test_ret += test_xmlGetLastError();
28349 test_ret += test_xmlParserError();
28350 test_ret += test_xmlParserPrintFileContext();
28351 test_ret += test_xmlParserPrintFileInfo();
28352 test_ret += test_xmlParserValidityError();
28353 test_ret += test_xmlParserValidityWarning();
28354 test_ret += test_xmlParserWarning();
28355 test_ret += test_xmlResetError();
28356 test_ret += test_xmlResetLastError();
28357 test_ret += test_xmlSetGenericErrorFunc();
28358 test_ret += test_xmlSetStructuredErrorFunc();
Daniel Veillardd93f6252004-11-02 15:53:51 +000028359
Daniel Veillard42595322004-11-08 10:52:06 +000028360 if (test_ret != 0)
28361 printf("Module xmlerror: %d errors\n", test_ret);
28362 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028363}
Daniel Veillardd93f6252004-11-02 15:53:51 +000028364
28365static int
28366test_xmlNewTextReader(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028367 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028368
Daniel Veillard34099b42004-11-04 17:34:35 +000028369#ifdef LIBXML_READER_ENABLED
28370 int mem_base;
28371 xmlTextReaderPtr ret_val;
28372 xmlParserInputBufferPtr input; /* the xmlParserInputBufferPtr used to read data */
28373 int n_input;
28374 const char * URI; /* the URI information for the source if available */
28375 int n_URI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028376
Daniel Veillard34099b42004-11-04 17:34:35 +000028377 for (n_input = 0;n_input < gen_nb_xmlParserInputBufferPtr;n_input++) {
28378 for (n_URI = 0;n_URI < gen_nb_filepath;n_URI++) {
28379 mem_base = xmlMemBlocks();
28380 input = gen_xmlParserInputBufferPtr(n_input, 0);
28381 URI = gen_filepath(n_URI, 1);
28382
28383 ret_val = xmlNewTextReader(input, URI);
28384 desret_xmlTextReaderPtr(ret_val);
28385 call_tests++;
28386 des_xmlParserInputBufferPtr(n_input, input, 0);
28387 des_filepath(n_URI, URI, 1);
28388 xmlResetLastError();
28389 if (mem_base != xmlMemBlocks()) {
28390 printf("Leak of %d blocks found in xmlNewTextReader",
28391 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028392 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000028393 printf(" %d", n_input);
28394 printf(" %d", n_URI);
28395 printf("\n");
28396 }
28397 }
28398 }
28399#endif
28400
28401 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000028402 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028403}
28404
28405
28406static int
28407test_xmlNewTextReaderFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028408 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028409
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028410#ifdef LIBXML_READER_ENABLED
28411 int mem_base;
28412 xmlTextReaderPtr ret_val;
28413 const char * URI; /* the URI of the resource to process */
28414 int n_URI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028415
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028416 for (n_URI = 0;n_URI < gen_nb_filepath;n_URI++) {
28417 mem_base = xmlMemBlocks();
28418 URI = gen_filepath(n_URI, 0);
28419
28420 ret_val = xmlNewTextReaderFilename(URI);
28421 desret_xmlTextReaderPtr(ret_val);
28422 call_tests++;
28423 des_filepath(n_URI, URI, 0);
28424 xmlResetLastError();
28425 if (mem_base != xmlMemBlocks()) {
28426 printf("Leak of %d blocks found in xmlNewTextReaderFilename",
28427 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028428 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028429 printf(" %d", n_URI);
28430 printf("\n");
28431 }
28432 }
28433#endif
28434
28435 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000028436 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028437}
28438
28439
28440static int
28441test_xmlReaderForDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028442 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028443
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028444#ifdef LIBXML_READER_ENABLED
28445 int mem_base;
28446 xmlTextReaderPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028447 xmlChar * cur; /* a pointer to a zero terminated string */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028448 int n_cur;
28449 const char * URL; /* the base URL to use for the document */
28450 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028451 char * encoding; /* the document encoding, or NULL */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028452 int n_encoding;
28453 int options; /* a combination of xmlParserOption */
28454 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028455
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028456 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
28457 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
28458 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000028459 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028460 mem_base = xmlMemBlocks();
28461 cur = gen_const_xmlChar_ptr(n_cur, 0);
28462 URL = gen_filepath(n_URL, 1);
28463 encoding = gen_const_char_ptr(n_encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000028464 options = gen_parseroptions(n_options, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028465
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028466 ret_val = xmlReaderForDoc(cur, URL, encoding, options);
28467 desret_xmlTextReaderPtr(ret_val);
28468 call_tests++;
28469 des_const_xmlChar_ptr(n_cur, cur, 0);
28470 des_filepath(n_URL, URL, 1);
28471 des_const_char_ptr(n_encoding, encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000028472 des_parseroptions(n_options, options, 3);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028473 xmlResetLastError();
28474 if (mem_base != xmlMemBlocks()) {
28475 printf("Leak of %d blocks found in xmlReaderForDoc",
28476 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028477 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028478 printf(" %d", n_cur);
28479 printf(" %d", n_URL);
28480 printf(" %d", n_encoding);
28481 printf(" %d", n_options);
28482 printf("\n");
28483 }
28484 }
28485 }
28486 }
28487 }
28488#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000028489
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028490 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000028491 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028492}
28493
28494
28495static int
28496test_xmlReaderForFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028497 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028498
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028499#ifdef LIBXML_READER_ENABLED
28500 int mem_base;
28501 xmlTextReaderPtr ret_val;
28502 const char * filename; /* a file or URL */
28503 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028504 char * encoding; /* the document encoding, or NULL */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028505 int n_encoding;
28506 int options; /* a combination of xmlParserOption */
28507 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028508
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028509 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
28510 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000028511 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028512 mem_base = xmlMemBlocks();
28513 filename = gen_filepath(n_filename, 0);
28514 encoding = gen_const_char_ptr(n_encoding, 1);
Daniel Veillard6128c012004-11-08 17:16:15 +000028515 options = gen_parseroptions(n_options, 2);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028516
28517 ret_val = xmlReaderForFile(filename, encoding, options);
28518 desret_xmlTextReaderPtr(ret_val);
28519 call_tests++;
28520 des_filepath(n_filename, filename, 0);
28521 des_const_char_ptr(n_encoding, encoding, 1);
Daniel Veillard6128c012004-11-08 17:16:15 +000028522 des_parseroptions(n_options, options, 2);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028523 xmlResetLastError();
28524 if (mem_base != xmlMemBlocks()) {
28525 printf("Leak of %d blocks found in xmlReaderForFile",
28526 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028527 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028528 printf(" %d", n_filename);
28529 printf(" %d", n_encoding);
28530 printf(" %d", n_options);
28531 printf("\n");
28532 }
28533 }
28534 }
28535 }
28536#endif
28537
28538 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000028539 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028540}
28541
28542
28543static int
28544test_xmlReaderForMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028545 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028546
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028547#ifdef LIBXML_READER_ENABLED
28548 int mem_base;
28549 xmlTextReaderPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028550 char * buffer; /* a pointer to a char array */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028551 int n_buffer;
28552 int size; /* the size of the array */
28553 int n_size;
28554 const char * URL; /* the base URL to use for the document */
28555 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028556 char * encoding; /* the document encoding, or NULL */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028557 int n_encoding;
28558 int options; /* a combination of xmlParserOption */
28559 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028560
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028561 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
28562 for (n_size = 0;n_size < gen_nb_int;n_size++) {
28563 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
28564 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000028565 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028566 mem_base = xmlMemBlocks();
28567 buffer = gen_const_char_ptr(n_buffer, 0);
28568 size = gen_int(n_size, 1);
28569 URL = gen_filepath(n_URL, 2);
28570 encoding = gen_const_char_ptr(n_encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000028571 options = gen_parseroptions(n_options, 4);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028572
28573 ret_val = xmlReaderForMemory(buffer, size, URL, encoding, options);
28574 desret_xmlTextReaderPtr(ret_val);
28575 call_tests++;
28576 des_const_char_ptr(n_buffer, buffer, 0);
28577 des_int(n_size, size, 1);
28578 des_filepath(n_URL, URL, 2);
28579 des_const_char_ptr(n_encoding, encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000028580 des_parseroptions(n_options, options, 4);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028581 xmlResetLastError();
28582 if (mem_base != xmlMemBlocks()) {
28583 printf("Leak of %d blocks found in xmlReaderForMemory",
28584 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028585 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028586 printf(" %d", n_buffer);
28587 printf(" %d", n_size);
28588 printf(" %d", n_URL);
28589 printf(" %d", n_encoding);
28590 printf(" %d", n_options);
28591 printf("\n");
28592 }
28593 }
28594 }
28595 }
28596 }
28597 }
28598#endif
28599
28600 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000028601 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028602}
28603
28604
28605static int
28606test_xmlReaderNewDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028607 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028608
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028609#ifdef LIBXML_READER_ENABLED
28610 int mem_base;
28611 int ret_val;
28612 xmlTextReaderPtr reader; /* an XML reader */
28613 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028614 xmlChar * cur; /* a pointer to a zero terminated string */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028615 int n_cur;
28616 const char * URL; /* the base URL to use for the document */
28617 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028618 char * encoding; /* the document encoding, or NULL */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028619 int n_encoding;
28620 int options; /* a combination of xmlParserOption */
28621 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028622
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028623 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28624 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
28625 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
28626 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000028627 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028628 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028629 reader = gen_xmlTextReaderPtr(n_reader, 0);
28630 cur = gen_const_xmlChar_ptr(n_cur, 1);
28631 URL = gen_filepath(n_URL, 2);
28632 encoding = gen_const_char_ptr(n_encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000028633 options = gen_parseroptions(n_options, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028634
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028635 ret_val = xmlReaderNewDoc(reader, cur, URL, encoding, options);
28636 desret_int(ret_val);
28637 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028638 des_xmlTextReaderPtr(n_reader, reader, 0);
28639 des_const_xmlChar_ptr(n_cur, cur, 1);
28640 des_filepath(n_URL, URL, 2);
28641 des_const_char_ptr(n_encoding, encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000028642 des_parseroptions(n_options, options, 4);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028643 xmlResetLastError();
28644 if (mem_base != xmlMemBlocks()) {
28645 printf("Leak of %d blocks found in xmlReaderNewDoc",
28646 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028647 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028648 printf(" %d", n_reader);
28649 printf(" %d", n_cur);
28650 printf(" %d", n_URL);
28651 printf(" %d", n_encoding);
28652 printf(" %d", n_options);
28653 printf("\n");
28654 }
28655 }
28656 }
28657 }
28658 }
28659 }
28660#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000028661
Daniel Veillard3d97e662004-11-04 10:49:00 +000028662 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000028663 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028664}
28665
28666
28667static int
28668test_xmlReaderNewFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028669 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028670
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028671#ifdef LIBXML_READER_ENABLED
28672 int mem_base;
28673 int ret_val;
28674 xmlTextReaderPtr reader; /* an XML reader */
28675 int n_reader;
28676 const char * filename; /* a file or URL */
28677 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028678 char * encoding; /* the document encoding, or NULL */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028679 int n_encoding;
28680 int options; /* a combination of xmlParserOption */
28681 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028682
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028683 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28684 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
28685 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000028686 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028687 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028688 reader = gen_xmlTextReaderPtr(n_reader, 0);
28689 filename = gen_filepath(n_filename, 1);
28690 encoding = gen_const_char_ptr(n_encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000028691 options = gen_parseroptions(n_options, 3);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028692
28693 ret_val = xmlReaderNewFile(reader, filename, encoding, options);
28694 desret_int(ret_val);
28695 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028696 des_xmlTextReaderPtr(n_reader, reader, 0);
28697 des_filepath(n_filename, filename, 1);
28698 des_const_char_ptr(n_encoding, encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000028699 des_parseroptions(n_options, options, 3);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028700 xmlResetLastError();
28701 if (mem_base != xmlMemBlocks()) {
28702 printf("Leak of %d blocks found in xmlReaderNewFile",
28703 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028704 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028705 printf(" %d", n_reader);
28706 printf(" %d", n_filename);
28707 printf(" %d", n_encoding);
28708 printf(" %d", n_options);
28709 printf("\n");
28710 }
28711 }
28712 }
28713 }
28714 }
28715#endif
28716
Daniel Veillard3d97e662004-11-04 10:49:00 +000028717 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000028718 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028719}
28720
28721
28722static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000028723test_xmlReaderNewMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028724 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028725
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028726#ifdef LIBXML_READER_ENABLED
28727 int mem_base;
28728 int ret_val;
28729 xmlTextReaderPtr reader; /* an XML reader */
28730 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028731 char * buffer; /* a pointer to a char array */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028732 int n_buffer;
28733 int size; /* the size of the array */
28734 int n_size;
28735 const char * URL; /* the base URL to use for the document */
28736 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028737 char * encoding; /* the document encoding, or NULL */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028738 int n_encoding;
28739 int options; /* a combination of xmlParserOption */
28740 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028741
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028742 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28743 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
28744 for (n_size = 0;n_size < gen_nb_int;n_size++) {
28745 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
28746 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000028747 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028748 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028749 reader = gen_xmlTextReaderPtr(n_reader, 0);
28750 buffer = gen_const_char_ptr(n_buffer, 1);
28751 size = gen_int(n_size, 2);
28752 URL = gen_filepath(n_URL, 3);
28753 encoding = gen_const_char_ptr(n_encoding, 4);
Daniel Veillard6128c012004-11-08 17:16:15 +000028754 options = gen_parseroptions(n_options, 5);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028755
28756 ret_val = xmlReaderNewMemory(reader, buffer, size, URL, encoding, options);
28757 desret_int(ret_val);
28758 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028759 des_xmlTextReaderPtr(n_reader, reader, 0);
28760 des_const_char_ptr(n_buffer, buffer, 1);
28761 des_int(n_size, size, 2);
28762 des_filepath(n_URL, URL, 3);
28763 des_const_char_ptr(n_encoding, encoding, 4);
Daniel Veillard6128c012004-11-08 17:16:15 +000028764 des_parseroptions(n_options, options, 5);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028765 xmlResetLastError();
28766 if (mem_base != xmlMemBlocks()) {
28767 printf("Leak of %d blocks found in xmlReaderNewMemory",
28768 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028769 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028770 printf(" %d", n_reader);
28771 printf(" %d", n_buffer);
28772 printf(" %d", n_size);
28773 printf(" %d", n_URL);
28774 printf(" %d", n_encoding);
28775 printf(" %d", n_options);
28776 printf("\n");
28777 }
28778 }
28779 }
28780 }
28781 }
28782 }
28783 }
28784#endif
28785
Daniel Veillard3d97e662004-11-04 10:49:00 +000028786 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000028787 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028788}
28789
28790
28791static int
28792test_xmlReaderNewWalker(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028793 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028794
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028795#ifdef LIBXML_READER_ENABLED
28796 int mem_base;
28797 int ret_val;
28798 xmlTextReaderPtr reader; /* an XML reader */
28799 int n_reader;
28800 xmlDocPtr doc; /* a preparsed document */
28801 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028802
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028803 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28804 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
28805 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028806 reader = gen_xmlTextReaderPtr(n_reader, 0);
28807 doc = gen_xmlDocPtr(n_doc, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028808
28809 ret_val = xmlReaderNewWalker(reader, doc);
28810 desret_int(ret_val);
28811 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028812 des_xmlTextReaderPtr(n_reader, reader, 0);
28813 des_xmlDocPtr(n_doc, doc, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028814 xmlResetLastError();
28815 if (mem_base != xmlMemBlocks()) {
28816 printf("Leak of %d blocks found in xmlReaderNewWalker",
28817 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028818 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028819 printf(" %d", n_reader);
28820 printf(" %d", n_doc);
28821 printf("\n");
28822 }
28823 }
28824 }
28825#endif
28826
Daniel Veillard3d97e662004-11-04 10:49:00 +000028827 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000028828 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028829}
28830
28831
28832static int
28833test_xmlReaderWalker(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028834 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028835
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028836#ifdef LIBXML_READER_ENABLED
28837 int mem_base;
28838 xmlTextReaderPtr ret_val;
28839 xmlDocPtr doc; /* a preparsed document */
28840 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028841
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028842 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
28843 mem_base = xmlMemBlocks();
28844 doc = gen_xmlDocPtr(n_doc, 0);
28845
28846 ret_val = xmlReaderWalker(doc);
28847 desret_xmlTextReaderPtr(ret_val);
28848 call_tests++;
28849 des_xmlDocPtr(n_doc, doc, 0);
28850 xmlResetLastError();
28851 if (mem_base != xmlMemBlocks()) {
28852 printf("Leak of %d blocks found in xmlReaderWalker",
28853 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028854 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028855 printf(" %d", n_doc);
28856 printf("\n");
28857 }
28858 }
28859#endif
28860
28861 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000028862 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028863}
28864
28865
28866static int
28867test_xmlTextReaderAttributeCount(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028868 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028869
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028870#ifdef LIBXML_READER_ENABLED
28871 int mem_base;
28872 int ret_val;
28873 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
28874 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028875
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028876 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28877 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028878 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028879
28880 ret_val = xmlTextReaderAttributeCount(reader);
28881 desret_int(ret_val);
28882 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028883 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028884 xmlResetLastError();
28885 if (mem_base != xmlMemBlocks()) {
28886 printf("Leak of %d blocks found in xmlTextReaderAttributeCount",
28887 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028888 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028889 printf(" %d", n_reader);
28890 printf("\n");
28891 }
28892 }
28893#endif
28894
Daniel Veillard3d97e662004-11-04 10:49:00 +000028895 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000028896 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028897}
28898
28899
28900static int
28901test_xmlTextReaderBaseUri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028902 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028903
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028904#ifdef LIBXML_READER_ENABLED
28905 int mem_base;
28906 xmlChar * ret_val;
28907 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
28908 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028909
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028910 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28911 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028912 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028913
28914 ret_val = xmlTextReaderBaseUri(reader);
28915 desret_xmlChar_ptr(ret_val);
28916 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028917 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028918 xmlResetLastError();
28919 if (mem_base != xmlMemBlocks()) {
28920 printf("Leak of %d blocks found in xmlTextReaderBaseUri",
28921 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028922 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028923 printf(" %d", n_reader);
28924 printf("\n");
28925 }
28926 }
28927#endif
28928
Daniel Veillard3d97e662004-11-04 10:49:00 +000028929 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000028930 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028931}
28932
28933
28934static int
28935test_xmlTextReaderClose(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028936 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028937
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028938#ifdef LIBXML_READER_ENABLED
28939 int mem_base;
28940 int ret_val;
28941 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
28942 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028943
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028944 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28945 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028946 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028947
28948 ret_val = xmlTextReaderClose(reader);
28949 desret_int(ret_val);
28950 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028951 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028952 xmlResetLastError();
28953 if (mem_base != xmlMemBlocks()) {
28954 printf("Leak of %d blocks found in xmlTextReaderClose",
28955 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028956 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028957 printf(" %d", n_reader);
28958 printf("\n");
28959 }
28960 }
28961#endif
28962
Daniel Veillard3d97e662004-11-04 10:49:00 +000028963 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000028964 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028965}
28966
28967
28968static int
28969test_xmlTextReaderConstBaseUri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028970 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028971
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028972#ifdef LIBXML_READER_ENABLED
28973 int mem_base;
28974 const xmlChar * ret_val;
28975 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
28976 int n_reader;
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 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028980 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028981
28982 ret_val = xmlTextReaderConstBaseUri(reader);
28983 desret_const_xmlChar_ptr(ret_val);
28984 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028985 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028986 xmlResetLastError();
28987 if (mem_base != xmlMemBlocks()) {
28988 printf("Leak of %d blocks found in xmlTextReaderConstBaseUri",
28989 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028990 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028991 printf(" %d", n_reader);
28992 printf("\n");
28993 }
28994 }
28995#endif
28996
Daniel Veillard3d97e662004-11-04 10:49:00 +000028997 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000028998 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028999}
29000
29001
29002static int
29003test_xmlTextReaderConstEncoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029004 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029005
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029006#ifdef LIBXML_READER_ENABLED
29007 int mem_base;
29008 const xmlChar * ret_val;
29009 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29010 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029011
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029012 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29013 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029014 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029015
29016 ret_val = xmlTextReaderConstEncoding(reader);
29017 desret_const_xmlChar_ptr(ret_val);
29018 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029019 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029020 xmlResetLastError();
29021 if (mem_base != xmlMemBlocks()) {
29022 printf("Leak of %d blocks found in xmlTextReaderConstEncoding",
29023 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029024 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029025 printf(" %d", n_reader);
29026 printf("\n");
29027 }
29028 }
29029#endif
29030
Daniel Veillard3d97e662004-11-04 10:49:00 +000029031 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000029032 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029033}
29034
29035
29036static int
29037test_xmlTextReaderConstLocalName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029038 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029039
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029040#ifdef LIBXML_READER_ENABLED
29041 int mem_base;
29042 const xmlChar * ret_val;
29043 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29044 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029045
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029046 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29047 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029048 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029049
29050 ret_val = xmlTextReaderConstLocalName(reader);
29051 desret_const_xmlChar_ptr(ret_val);
29052 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029053 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029054 xmlResetLastError();
29055 if (mem_base != xmlMemBlocks()) {
29056 printf("Leak of %d blocks found in xmlTextReaderConstLocalName",
29057 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029058 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029059 printf(" %d", n_reader);
29060 printf("\n");
29061 }
29062 }
29063#endif
29064
Daniel Veillard3d97e662004-11-04 10:49:00 +000029065 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000029066 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029067}
29068
29069
29070static int
29071test_xmlTextReaderConstName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029072 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029073
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029074#ifdef LIBXML_READER_ENABLED
29075 int mem_base;
29076 const xmlChar * ret_val;
29077 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29078 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029079
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029080 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29081 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029082 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029083
29084 ret_val = xmlTextReaderConstName(reader);
29085 desret_const_xmlChar_ptr(ret_val);
29086 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029087 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029088 xmlResetLastError();
29089 if (mem_base != xmlMemBlocks()) {
29090 printf("Leak of %d blocks found in xmlTextReaderConstName",
29091 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029092 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029093 printf(" %d", n_reader);
29094 printf("\n");
29095 }
29096 }
29097#endif
29098
Daniel Veillard3d97e662004-11-04 10:49:00 +000029099 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000029100 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029101}
29102
29103
29104static int
29105test_xmlTextReaderConstNamespaceUri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029106 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029107
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029108#ifdef LIBXML_READER_ENABLED
29109 int mem_base;
29110 const xmlChar * ret_val;
29111 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29112 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029113
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029114 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29115 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029116 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029117
29118 ret_val = xmlTextReaderConstNamespaceUri(reader);
29119 desret_const_xmlChar_ptr(ret_val);
29120 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029121 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029122 xmlResetLastError();
29123 if (mem_base != xmlMemBlocks()) {
29124 printf("Leak of %d blocks found in xmlTextReaderConstNamespaceUri",
29125 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029126 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029127 printf(" %d", n_reader);
29128 printf("\n");
29129 }
29130 }
29131#endif
29132
Daniel Veillard3d97e662004-11-04 10:49:00 +000029133 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000029134 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029135}
29136
29137
29138static int
29139test_xmlTextReaderConstPrefix(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029140 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029141
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029142#ifdef LIBXML_READER_ENABLED
29143 int mem_base;
29144 const xmlChar * ret_val;
29145 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29146 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029147
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029148 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29149 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029150 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029151
29152 ret_val = xmlTextReaderConstPrefix(reader);
29153 desret_const_xmlChar_ptr(ret_val);
29154 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029155 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029156 xmlResetLastError();
29157 if (mem_base != xmlMemBlocks()) {
29158 printf("Leak of %d blocks found in xmlTextReaderConstPrefix",
29159 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029160 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029161 printf(" %d", n_reader);
29162 printf("\n");
29163 }
29164 }
29165#endif
29166
Daniel Veillard3d97e662004-11-04 10:49:00 +000029167 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000029168 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029169}
29170
29171
29172static int
29173test_xmlTextReaderConstString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029174 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029175
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029176#ifdef LIBXML_READER_ENABLED
29177 int mem_base;
29178 const xmlChar * ret_val;
29179 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29180 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000029181 xmlChar * str; /* the string to intern. */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029182 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029183
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029184 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29185 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
29186 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029187 reader = gen_xmlTextReaderPtr(n_reader, 0);
29188 str = gen_const_xmlChar_ptr(n_str, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029189
29190 ret_val = xmlTextReaderConstString(reader, str);
29191 desret_const_xmlChar_ptr(ret_val);
29192 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029193 des_xmlTextReaderPtr(n_reader, reader, 0);
29194 des_const_xmlChar_ptr(n_str, str, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029195 xmlResetLastError();
29196 if (mem_base != xmlMemBlocks()) {
29197 printf("Leak of %d blocks found in xmlTextReaderConstString",
29198 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029199 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029200 printf(" %d", n_reader);
29201 printf(" %d", n_str);
29202 printf("\n");
29203 }
29204 }
29205 }
29206#endif
29207
Daniel Veillard3d97e662004-11-04 10:49:00 +000029208 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000029209 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029210}
29211
29212
29213static int
29214test_xmlTextReaderConstValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029215 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029216
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029217#ifdef LIBXML_READER_ENABLED
29218 int mem_base;
29219 const xmlChar * ret_val;
29220 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29221 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029222
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029223 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29224 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029225 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029226
29227 ret_val = xmlTextReaderConstValue(reader);
29228 desret_const_xmlChar_ptr(ret_val);
29229 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029230 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029231 xmlResetLastError();
29232 if (mem_base != xmlMemBlocks()) {
29233 printf("Leak of %d blocks found in xmlTextReaderConstValue",
29234 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029235 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029236 printf(" %d", n_reader);
29237 printf("\n");
29238 }
29239 }
29240#endif
29241
Daniel Veillard3d97e662004-11-04 10:49:00 +000029242 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000029243 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029244}
29245
29246
29247static int
29248test_xmlTextReaderConstXmlLang(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029249 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029250
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029251#ifdef LIBXML_READER_ENABLED
29252 int mem_base;
29253 const xmlChar * ret_val;
29254 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29255 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029256
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029257 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29258 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029259 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029260
29261 ret_val = xmlTextReaderConstXmlLang(reader);
29262 desret_const_xmlChar_ptr(ret_val);
29263 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029264 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029265 xmlResetLastError();
29266 if (mem_base != xmlMemBlocks()) {
29267 printf("Leak of %d blocks found in xmlTextReaderConstXmlLang",
29268 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029269 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029270 printf(" %d", n_reader);
29271 printf("\n");
29272 }
29273 }
29274#endif
29275
Daniel Veillard3d97e662004-11-04 10:49:00 +000029276 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000029277 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029278}
29279
29280
29281static int
29282test_xmlTextReaderConstXmlVersion(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029283 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029284
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029285#ifdef LIBXML_READER_ENABLED
29286 int mem_base;
29287 const xmlChar * ret_val;
29288 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29289 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029290
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029291 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29292 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029293 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029294
29295 ret_val = xmlTextReaderConstXmlVersion(reader);
29296 desret_const_xmlChar_ptr(ret_val);
29297 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029298 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029299 xmlResetLastError();
29300 if (mem_base != xmlMemBlocks()) {
29301 printf("Leak of %d blocks found in xmlTextReaderConstXmlVersion",
29302 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029303 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029304 printf(" %d", n_reader);
29305 printf("\n");
29306 }
29307 }
29308#endif
29309
Daniel Veillard3d97e662004-11-04 10:49:00 +000029310 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000029311 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029312}
29313
29314
29315static int
29316test_xmlTextReaderCurrentDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029317 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029318
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029319#ifdef LIBXML_READER_ENABLED
29320 int mem_base;
29321 xmlDocPtr ret_val;
29322 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29323 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029324
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029325 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29326 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029327 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029328
29329 ret_val = xmlTextReaderCurrentDoc(reader);
29330 desret_xmlDocPtr(ret_val);
29331 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029332 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029333 xmlResetLastError();
29334 if (mem_base != xmlMemBlocks()) {
29335 printf("Leak of %d blocks found in xmlTextReaderCurrentDoc",
29336 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029337 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029338 printf(" %d", n_reader);
29339 printf("\n");
29340 }
29341 }
29342#endif
29343
Daniel Veillard3d97e662004-11-04 10:49:00 +000029344 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000029345 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029346}
29347
29348
29349static int
29350test_xmlTextReaderCurrentNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029351 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029352
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029353#ifdef LIBXML_READER_ENABLED
29354 int mem_base;
29355 xmlNodePtr ret_val;
29356 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29357 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029358
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029359 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29360 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029361 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029362
29363 ret_val = xmlTextReaderCurrentNode(reader);
29364 desret_xmlNodePtr(ret_val);
29365 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029366 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029367 xmlResetLastError();
29368 if (mem_base != xmlMemBlocks()) {
29369 printf("Leak of %d blocks found in xmlTextReaderCurrentNode",
29370 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029371 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029372 printf(" %d", n_reader);
29373 printf("\n");
29374 }
29375 }
29376#endif
29377
Daniel Veillard3d97e662004-11-04 10:49:00 +000029378 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000029379 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029380}
29381
29382
29383static int
29384test_xmlTextReaderDepth(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029385 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029386
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029387#ifdef LIBXML_READER_ENABLED
29388 int mem_base;
29389 int ret_val;
29390 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29391 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029392
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029393 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29394 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029395 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029396
29397 ret_val = xmlTextReaderDepth(reader);
29398 desret_int(ret_val);
29399 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029400 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029401 xmlResetLastError();
29402 if (mem_base != xmlMemBlocks()) {
29403 printf("Leak of %d blocks found in xmlTextReaderDepth",
29404 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029405 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029406 printf(" %d", n_reader);
29407 printf("\n");
29408 }
29409 }
29410#endif
29411
Daniel Veillard3d97e662004-11-04 10:49:00 +000029412 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000029413 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029414}
29415
29416
29417static int
29418test_xmlTextReaderExpand(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029419 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029420
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029421#ifdef LIBXML_READER_ENABLED
29422 int mem_base;
29423 xmlNodePtr ret_val;
29424 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29425 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029426
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029427 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29428 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029429 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029430
29431 ret_val = xmlTextReaderExpand(reader);
29432 desret_xmlNodePtr(ret_val);
29433 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029434 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029435 xmlResetLastError();
29436 if (mem_base != xmlMemBlocks()) {
29437 printf("Leak of %d blocks found in xmlTextReaderExpand",
29438 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029439 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029440 printf(" %d", n_reader);
29441 printf("\n");
29442 }
29443 }
29444#endif
29445
Daniel Veillard3d97e662004-11-04 10:49:00 +000029446 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000029447 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029448}
29449
29450
29451static int
29452test_xmlTextReaderGetAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029453 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029454
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029455#ifdef LIBXML_READER_ENABLED
29456 int mem_base;
29457 xmlChar * ret_val;
29458 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29459 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000029460 xmlChar * name; /* the qualified name of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029461 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029462
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029463 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29464 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
29465 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029466 reader = gen_xmlTextReaderPtr(n_reader, 0);
29467 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029468
29469 ret_val = xmlTextReaderGetAttribute(reader, name);
29470 desret_xmlChar_ptr(ret_val);
29471 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029472 des_xmlTextReaderPtr(n_reader, reader, 0);
29473 des_const_xmlChar_ptr(n_name, name, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029474 xmlResetLastError();
29475 if (mem_base != xmlMemBlocks()) {
29476 printf("Leak of %d blocks found in xmlTextReaderGetAttribute",
29477 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029478 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029479 printf(" %d", n_reader);
29480 printf(" %d", n_name);
29481 printf("\n");
29482 }
29483 }
29484 }
29485#endif
29486
Daniel Veillard3d97e662004-11-04 10:49:00 +000029487 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000029488 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029489}
29490
29491
29492static int
29493test_xmlTextReaderGetAttributeNo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029494 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029495
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029496#ifdef LIBXML_READER_ENABLED
29497 int mem_base;
29498 xmlChar * ret_val;
29499 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29500 int n_reader;
29501 int no; /* the zero-based index of the attribute relative to the containing element */
29502 int n_no;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029503
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029504 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29505 for (n_no = 0;n_no < gen_nb_int;n_no++) {
29506 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029507 reader = gen_xmlTextReaderPtr(n_reader, 0);
29508 no = gen_int(n_no, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029509
29510 ret_val = xmlTextReaderGetAttributeNo(reader, no);
29511 desret_xmlChar_ptr(ret_val);
29512 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029513 des_xmlTextReaderPtr(n_reader, reader, 0);
29514 des_int(n_no, no, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029515 xmlResetLastError();
29516 if (mem_base != xmlMemBlocks()) {
29517 printf("Leak of %d blocks found in xmlTextReaderGetAttributeNo",
29518 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029519 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029520 printf(" %d", n_reader);
29521 printf(" %d", n_no);
29522 printf("\n");
29523 }
29524 }
29525 }
29526#endif
29527
Daniel Veillard3d97e662004-11-04 10:49:00 +000029528 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000029529 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029530}
29531
29532
29533static int
29534test_xmlTextReaderGetAttributeNs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029535 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029536
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029537#ifdef LIBXML_READER_ENABLED
29538 int mem_base;
29539 xmlChar * ret_val;
29540 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29541 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000029542 xmlChar * localName; /* the local name of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029543 int n_localName;
Daniel Veillardce682bc2004-11-05 17:22:25 +000029544 xmlChar * namespaceURI; /* the namespace URI of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029545 int n_namespaceURI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029546
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029547 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29548 for (n_localName = 0;n_localName < gen_nb_const_xmlChar_ptr;n_localName++) {
29549 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
29550 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029551 reader = gen_xmlTextReaderPtr(n_reader, 0);
29552 localName = gen_const_xmlChar_ptr(n_localName, 1);
29553 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029554
29555 ret_val = xmlTextReaderGetAttributeNs(reader, localName, namespaceURI);
29556 desret_xmlChar_ptr(ret_val);
29557 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029558 des_xmlTextReaderPtr(n_reader, reader, 0);
29559 des_const_xmlChar_ptr(n_localName, localName, 1);
29560 des_const_xmlChar_ptr(n_namespaceURI, namespaceURI, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029561 xmlResetLastError();
29562 if (mem_base != xmlMemBlocks()) {
29563 printf("Leak of %d blocks found in xmlTextReaderGetAttributeNs",
29564 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029565 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029566 printf(" %d", n_reader);
29567 printf(" %d", n_localName);
29568 printf(" %d", n_namespaceURI);
29569 printf("\n");
29570 }
29571 }
29572 }
29573 }
29574#endif
29575
Daniel Veillard3d97e662004-11-04 10:49:00 +000029576 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000029577 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029578}
29579
Daniel Veillarda521d282004-11-09 14:59:59 +000029580#ifdef LIBXML_READER_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000029581
Daniel Veillardce682bc2004-11-05 17:22:25 +000029582#define gen_nb_xmlTextReaderErrorFunc_ptr 1
29583static xmlTextReaderErrorFunc * gen_xmlTextReaderErrorFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
29584 return(NULL);
29585}
29586static void des_xmlTextReaderErrorFunc_ptr(int no ATTRIBUTE_UNUSED, xmlTextReaderErrorFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
29587}
Daniel Veillarda521d282004-11-09 14:59:59 +000029588#endif
29589
Daniel Veillardce682bc2004-11-05 17:22:25 +000029590
Daniel Veillardd93f6252004-11-02 15:53:51 +000029591static int
29592test_xmlTextReaderGetErrorHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029593 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029594
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029595#ifdef LIBXML_READER_ENABLED
29596 int mem_base;
29597 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29598 int n_reader;
29599 xmlTextReaderErrorFunc * f; /* the callback function or NULL is no callback has been registered */
29600 int n_f;
29601 void ** arg; /* a user argument */
29602 int n_arg;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029603
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029604 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29605 for (n_f = 0;n_f < gen_nb_xmlTextReaderErrorFunc_ptr;n_f++) {
29606 for (n_arg = 0;n_arg < gen_nb_void_ptr_ptr;n_arg++) {
29607 mem_base = xmlMemBlocks();
29608 reader = gen_xmlTextReaderPtr(n_reader, 0);
29609 f = gen_xmlTextReaderErrorFunc_ptr(n_f, 1);
29610 arg = gen_void_ptr_ptr(n_arg, 2);
29611
29612 xmlTextReaderGetErrorHandler(reader, f, arg);
29613 call_tests++;
29614 des_xmlTextReaderPtr(n_reader, reader, 0);
29615 des_xmlTextReaderErrorFunc_ptr(n_f, f, 1);
29616 des_void_ptr_ptr(n_arg, arg, 2);
29617 xmlResetLastError();
29618 if (mem_base != xmlMemBlocks()) {
29619 printf("Leak of %d blocks found in xmlTextReaderGetErrorHandler",
29620 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029621 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029622 printf(" %d", n_reader);
29623 printf(" %d", n_f);
29624 printf(" %d", n_arg);
29625 printf("\n");
29626 }
29627 }
29628 }
29629 }
29630#endif
29631
29632 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000029633 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029634}
29635
29636
29637static int
29638test_xmlTextReaderGetParserProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029639 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029640
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029641#ifdef LIBXML_READER_ENABLED
29642 int mem_base;
29643 int ret_val;
29644 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29645 int n_reader;
29646 int prop; /* the xmlParserProperties to get */
29647 int n_prop;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029648
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029649 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29650 for (n_prop = 0;n_prop < gen_nb_int;n_prop++) {
29651 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029652 reader = gen_xmlTextReaderPtr(n_reader, 0);
29653 prop = gen_int(n_prop, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029654
29655 ret_val = xmlTextReaderGetParserProp(reader, prop);
29656 desret_int(ret_val);
29657 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029658 des_xmlTextReaderPtr(n_reader, reader, 0);
29659 des_int(n_prop, prop, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029660 xmlResetLastError();
29661 if (mem_base != xmlMemBlocks()) {
29662 printf("Leak of %d blocks found in xmlTextReaderGetParserProp",
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(" %d", n_prop);
29667 printf("\n");
29668 }
29669 }
29670 }
29671#endif
29672
Daniel Veillard3d97e662004-11-04 10:49:00 +000029673 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000029674 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029675}
29676
29677
29678static int
29679test_xmlTextReaderGetRemainder(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029680 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029681
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029682#ifdef LIBXML_READER_ENABLED
29683 int mem_base;
29684 xmlParserInputBufferPtr ret_val;
29685 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29686 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029687
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029688 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29689 mem_base = xmlMemBlocks();
29690 reader = gen_xmlTextReaderPtr(n_reader, 0);
29691
29692 ret_val = xmlTextReaderGetRemainder(reader);
29693 desret_xmlParserInputBufferPtr(ret_val);
29694 call_tests++;
29695 des_xmlTextReaderPtr(n_reader, reader, 0);
29696 xmlResetLastError();
29697 if (mem_base != xmlMemBlocks()) {
29698 printf("Leak of %d blocks found in xmlTextReaderGetRemainder",
29699 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029700 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029701 printf(" %d", n_reader);
29702 printf("\n");
29703 }
29704 }
29705#endif
29706
29707 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000029708 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029709}
29710
29711
29712static int
29713test_xmlTextReaderHasAttributes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029714 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029715
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029716#ifdef LIBXML_READER_ENABLED
29717 int mem_base;
29718 int ret_val;
29719 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29720 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029721
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029722 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29723 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029724 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029725
29726 ret_val = xmlTextReaderHasAttributes(reader);
29727 desret_int(ret_val);
29728 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029729 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029730 xmlResetLastError();
29731 if (mem_base != xmlMemBlocks()) {
29732 printf("Leak of %d blocks found in xmlTextReaderHasAttributes",
29733 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029734 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029735 printf(" %d", n_reader);
29736 printf("\n");
29737 }
29738 }
29739#endif
29740
Daniel Veillard3d97e662004-11-04 10:49:00 +000029741 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000029742 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029743}
29744
29745
29746static int
29747test_xmlTextReaderHasValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029748 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029749
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029750#ifdef LIBXML_READER_ENABLED
29751 int mem_base;
29752 int ret_val;
29753 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29754 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029755
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029756 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29757 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029758 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029759
29760 ret_val = xmlTextReaderHasValue(reader);
29761 desret_int(ret_val);
29762 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029763 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029764 xmlResetLastError();
29765 if (mem_base != xmlMemBlocks()) {
29766 printf("Leak of %d blocks found in xmlTextReaderHasValue",
29767 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029768 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029769 printf(" %d", n_reader);
29770 printf("\n");
29771 }
29772 }
29773#endif
29774
Daniel Veillard3d97e662004-11-04 10:49:00 +000029775 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000029776 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029777}
29778
29779
29780static int
29781test_xmlTextReaderIsDefault(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029782 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029783
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029784#ifdef LIBXML_READER_ENABLED
29785 int mem_base;
29786 int ret_val;
29787 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29788 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029789
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029790 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29791 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029792 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029793
29794 ret_val = xmlTextReaderIsDefault(reader);
29795 desret_int(ret_val);
29796 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029797 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029798 xmlResetLastError();
29799 if (mem_base != xmlMemBlocks()) {
29800 printf("Leak of %d blocks found in xmlTextReaderIsDefault",
29801 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029802 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029803 printf(" %d", n_reader);
29804 printf("\n");
29805 }
29806 }
29807#endif
29808
Daniel Veillard3d97e662004-11-04 10:49:00 +000029809 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000029810 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029811}
29812
29813
29814static int
29815test_xmlTextReaderIsEmptyElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029816 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029817
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029818#ifdef LIBXML_READER_ENABLED
29819 int mem_base;
29820 int ret_val;
29821 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29822 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029823
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029824 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29825 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029826 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029827
29828 ret_val = xmlTextReaderIsEmptyElement(reader);
29829 desret_int(ret_val);
29830 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029831 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029832 xmlResetLastError();
29833 if (mem_base != xmlMemBlocks()) {
29834 printf("Leak of %d blocks found in xmlTextReaderIsEmptyElement",
29835 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029836 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029837 printf(" %d", n_reader);
29838 printf("\n");
29839 }
29840 }
29841#endif
29842
Daniel Veillard3d97e662004-11-04 10:49:00 +000029843 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000029844 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029845}
29846
29847
29848static int
29849test_xmlTextReaderIsNamespaceDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029850 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029851
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029852#ifdef LIBXML_READER_ENABLED
29853 int mem_base;
29854 int ret_val;
29855 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29856 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029857
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029858 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29859 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029860 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029861
29862 ret_val = xmlTextReaderIsNamespaceDecl(reader);
29863 desret_int(ret_val);
29864 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029865 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029866 xmlResetLastError();
29867 if (mem_base != xmlMemBlocks()) {
29868 printf("Leak of %d blocks found in xmlTextReaderIsNamespaceDecl",
29869 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029870 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029871 printf(" %d", n_reader);
29872 printf("\n");
29873 }
29874 }
29875#endif
29876
Daniel Veillard3d97e662004-11-04 10:49:00 +000029877 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000029878 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029879}
29880
29881
29882static int
29883test_xmlTextReaderIsValid(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029884 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029885
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029886#ifdef LIBXML_READER_ENABLED
29887 int mem_base;
29888 int ret_val;
29889 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29890 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029891
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029892 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29893 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029894 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029895
29896 ret_val = xmlTextReaderIsValid(reader);
29897 desret_int(ret_val);
29898 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029899 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029900 xmlResetLastError();
29901 if (mem_base != xmlMemBlocks()) {
29902 printf("Leak of %d blocks found in xmlTextReaderIsValid",
29903 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029904 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029905 printf(" %d", n_reader);
29906 printf("\n");
29907 }
29908 }
29909#endif
29910
Daniel Veillard3d97e662004-11-04 10:49:00 +000029911 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000029912 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029913}
29914
29915
29916static int
29917test_xmlTextReaderLocalName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029918 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029919
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029920#ifdef LIBXML_READER_ENABLED
29921 int mem_base;
29922 xmlChar * ret_val;
29923 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29924 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029925
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029926 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29927 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029928 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029929
29930 ret_val = xmlTextReaderLocalName(reader);
29931 desret_xmlChar_ptr(ret_val);
29932 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029933 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029934 xmlResetLastError();
29935 if (mem_base != xmlMemBlocks()) {
29936 printf("Leak of %d blocks found in xmlTextReaderLocalName",
29937 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029938 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029939 printf(" %d", n_reader);
29940 printf("\n");
29941 }
29942 }
29943#endif
29944
Daniel Veillard3d97e662004-11-04 10:49:00 +000029945 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000029946 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029947}
29948
Daniel Veillarda521d282004-11-09 14:59:59 +000029949#ifdef LIBXML_READER_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000029950
Daniel Veillardce682bc2004-11-05 17:22:25 +000029951#define gen_nb_xmlTextReaderLocatorPtr 1
29952static xmlTextReaderLocatorPtr gen_xmlTextReaderLocatorPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
29953 return(NULL);
29954}
29955static void des_xmlTextReaderLocatorPtr(int no ATTRIBUTE_UNUSED, xmlTextReaderLocatorPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
29956}
Daniel Veillarda521d282004-11-09 14:59:59 +000029957#endif
29958
Daniel Veillardce682bc2004-11-05 17:22:25 +000029959
Daniel Veillardd93f6252004-11-02 15:53:51 +000029960static int
29961test_xmlTextReaderLocatorBaseURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029962 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029963
Daniel Veillardce682bc2004-11-05 17:22:25 +000029964#ifdef LIBXML_READER_ENABLED
29965 int mem_base;
29966 xmlChar * ret_val;
29967 xmlTextReaderLocatorPtr locator; /* the xmlTextReaderLocatorPtr used */
29968 int n_locator;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029969
Daniel Veillardce682bc2004-11-05 17:22:25 +000029970 for (n_locator = 0;n_locator < gen_nb_xmlTextReaderLocatorPtr;n_locator++) {
29971 mem_base = xmlMemBlocks();
29972 locator = gen_xmlTextReaderLocatorPtr(n_locator, 0);
29973
29974 ret_val = xmlTextReaderLocatorBaseURI(locator);
29975 desret_xmlChar_ptr(ret_val);
29976 call_tests++;
29977 des_xmlTextReaderLocatorPtr(n_locator, locator, 0);
29978 xmlResetLastError();
29979 if (mem_base != xmlMemBlocks()) {
29980 printf("Leak of %d blocks found in xmlTextReaderLocatorBaseURI",
29981 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029982 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000029983 printf(" %d", n_locator);
29984 printf("\n");
29985 }
29986 }
29987#endif
29988
29989 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000029990 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029991}
29992
29993
29994static int
29995test_xmlTextReaderLocatorLineNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029996 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029997
Daniel Veillardce682bc2004-11-05 17:22:25 +000029998#ifdef LIBXML_READER_ENABLED
29999 int mem_base;
30000 int ret_val;
30001 xmlTextReaderLocatorPtr locator; /* the xmlTextReaderLocatorPtr used */
30002 int n_locator;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030003
Daniel Veillardce682bc2004-11-05 17:22:25 +000030004 for (n_locator = 0;n_locator < gen_nb_xmlTextReaderLocatorPtr;n_locator++) {
30005 mem_base = xmlMemBlocks();
30006 locator = gen_xmlTextReaderLocatorPtr(n_locator, 0);
30007
30008 ret_val = xmlTextReaderLocatorLineNumber(locator);
30009 desret_int(ret_val);
30010 call_tests++;
30011 des_xmlTextReaderLocatorPtr(n_locator, locator, 0);
30012 xmlResetLastError();
30013 if (mem_base != xmlMemBlocks()) {
30014 printf("Leak of %d blocks found in xmlTextReaderLocatorLineNumber",
30015 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030016 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030017 printf(" %d", n_locator);
30018 printf("\n");
30019 }
30020 }
30021#endif
30022
30023 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000030024 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030025}
30026
30027
30028static int
30029test_xmlTextReaderLookupNamespace(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030030 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030031
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030032#ifdef LIBXML_READER_ENABLED
30033 int mem_base;
30034 xmlChar * ret_val;
30035 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30036 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030037 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 +000030038 int n_prefix;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030039
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030040 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30041 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
30042 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030043 reader = gen_xmlTextReaderPtr(n_reader, 0);
30044 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030045
30046 ret_val = xmlTextReaderLookupNamespace(reader, prefix);
30047 desret_xmlChar_ptr(ret_val);
30048 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030049 des_xmlTextReaderPtr(n_reader, reader, 0);
30050 des_const_xmlChar_ptr(n_prefix, prefix, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030051 xmlResetLastError();
30052 if (mem_base != xmlMemBlocks()) {
30053 printf("Leak of %d blocks found in xmlTextReaderLookupNamespace",
30054 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030055 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030056 printf(" %d", n_reader);
30057 printf(" %d", n_prefix);
30058 printf("\n");
30059 }
30060 }
30061 }
30062#endif
30063
Daniel Veillard3d97e662004-11-04 10:49:00 +000030064 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000030065 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030066}
30067
30068
30069static int
30070test_xmlTextReaderMoveToAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030071 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030072
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030073#ifdef LIBXML_READER_ENABLED
30074 int mem_base;
30075 int ret_val;
30076 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30077 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030078 xmlChar * name; /* the qualified name of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030079 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030080
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030081 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30082 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
30083 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030084 reader = gen_xmlTextReaderPtr(n_reader, 0);
30085 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030086
30087 ret_val = xmlTextReaderMoveToAttribute(reader, name);
30088 desret_int(ret_val);
30089 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030090 des_xmlTextReaderPtr(n_reader, reader, 0);
30091 des_const_xmlChar_ptr(n_name, name, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030092 xmlResetLastError();
30093 if (mem_base != xmlMemBlocks()) {
30094 printf("Leak of %d blocks found in xmlTextReaderMoveToAttribute",
30095 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030096 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030097 printf(" %d", n_reader);
30098 printf(" %d", n_name);
30099 printf("\n");
30100 }
30101 }
30102 }
30103#endif
30104
Daniel Veillard3d97e662004-11-04 10:49:00 +000030105 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000030106 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030107}
30108
30109
30110static int
30111test_xmlTextReaderMoveToAttributeNo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030112 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030113
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030114#ifdef LIBXML_READER_ENABLED
30115 int mem_base;
30116 int ret_val;
30117 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30118 int n_reader;
30119 int no; /* the zero-based index of the attribute relative to the containing element. */
30120 int n_no;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030121
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030122 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30123 for (n_no = 0;n_no < gen_nb_int;n_no++) {
30124 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030125 reader = gen_xmlTextReaderPtr(n_reader, 0);
30126 no = gen_int(n_no, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030127
30128 ret_val = xmlTextReaderMoveToAttributeNo(reader, no);
30129 desret_int(ret_val);
30130 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030131 des_xmlTextReaderPtr(n_reader, reader, 0);
30132 des_int(n_no, no, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030133 xmlResetLastError();
30134 if (mem_base != xmlMemBlocks()) {
30135 printf("Leak of %d blocks found in xmlTextReaderMoveToAttributeNo",
30136 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030137 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030138 printf(" %d", n_reader);
30139 printf(" %d", n_no);
30140 printf("\n");
30141 }
30142 }
30143 }
30144#endif
30145
Daniel Veillard3d97e662004-11-04 10:49:00 +000030146 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000030147 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030148}
30149
30150
30151static int
30152test_xmlTextReaderMoveToAttributeNs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030153 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030154
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030155#ifdef LIBXML_READER_ENABLED
30156 int mem_base;
30157 int ret_val;
30158 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30159 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030160 xmlChar * localName; /* the local name of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030161 int n_localName;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030162 xmlChar * namespaceURI; /* the namespace URI of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030163 int n_namespaceURI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030164
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030165 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30166 for (n_localName = 0;n_localName < gen_nb_const_xmlChar_ptr;n_localName++) {
30167 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
30168 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030169 reader = gen_xmlTextReaderPtr(n_reader, 0);
30170 localName = gen_const_xmlChar_ptr(n_localName, 1);
30171 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030172
30173 ret_val = xmlTextReaderMoveToAttributeNs(reader, localName, namespaceURI);
30174 desret_int(ret_val);
30175 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030176 des_xmlTextReaderPtr(n_reader, reader, 0);
30177 des_const_xmlChar_ptr(n_localName, localName, 1);
30178 des_const_xmlChar_ptr(n_namespaceURI, namespaceURI, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030179 xmlResetLastError();
30180 if (mem_base != xmlMemBlocks()) {
30181 printf("Leak of %d blocks found in xmlTextReaderMoveToAttributeNs",
30182 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030183 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030184 printf(" %d", n_reader);
30185 printf(" %d", n_localName);
30186 printf(" %d", n_namespaceURI);
30187 printf("\n");
30188 }
30189 }
30190 }
30191 }
30192#endif
30193
Daniel Veillard3d97e662004-11-04 10:49:00 +000030194 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000030195 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030196}
30197
30198
30199static int
30200test_xmlTextReaderMoveToElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030201 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030202
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030203#ifdef LIBXML_READER_ENABLED
30204 int mem_base;
30205 int ret_val;
30206 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30207 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030208
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030209 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30210 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030211 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030212
30213 ret_val = xmlTextReaderMoveToElement(reader);
30214 desret_int(ret_val);
30215 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030216 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030217 xmlResetLastError();
30218 if (mem_base != xmlMemBlocks()) {
30219 printf("Leak of %d blocks found in xmlTextReaderMoveToElement",
30220 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030221 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030222 printf(" %d", n_reader);
30223 printf("\n");
30224 }
30225 }
30226#endif
30227
Daniel Veillard3d97e662004-11-04 10:49:00 +000030228 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000030229 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030230}
30231
30232
30233static int
30234test_xmlTextReaderMoveToFirstAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030235 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030236
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030237#ifdef LIBXML_READER_ENABLED
30238 int mem_base;
30239 int ret_val;
30240 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30241 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030242
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030243 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30244 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030245 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030246
30247 ret_val = xmlTextReaderMoveToFirstAttribute(reader);
30248 desret_int(ret_val);
30249 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030250 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030251 xmlResetLastError();
30252 if (mem_base != xmlMemBlocks()) {
30253 printf("Leak of %d blocks found in xmlTextReaderMoveToFirstAttribute",
30254 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030255 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030256 printf(" %d", n_reader);
30257 printf("\n");
30258 }
30259 }
30260#endif
30261
Daniel Veillard3d97e662004-11-04 10:49:00 +000030262 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000030263 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030264}
30265
30266
30267static int
30268test_xmlTextReaderMoveToNextAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030269 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030270
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030271#ifdef LIBXML_READER_ENABLED
30272 int mem_base;
30273 int ret_val;
30274 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30275 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030276
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030277 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30278 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030279 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030280
30281 ret_val = xmlTextReaderMoveToNextAttribute(reader);
30282 desret_int(ret_val);
30283 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030284 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030285 xmlResetLastError();
30286 if (mem_base != xmlMemBlocks()) {
30287 printf("Leak of %d blocks found in xmlTextReaderMoveToNextAttribute",
30288 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030289 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030290 printf(" %d", n_reader);
30291 printf("\n");
30292 }
30293 }
30294#endif
30295
Daniel Veillard3d97e662004-11-04 10:49:00 +000030296 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000030297 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030298}
30299
30300
30301static int
30302test_xmlTextReaderName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030303 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030304
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030305#ifdef LIBXML_READER_ENABLED
30306 int mem_base;
30307 xmlChar * ret_val;
30308 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30309 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030310
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030311 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30312 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030313 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030314
30315 ret_val = xmlTextReaderName(reader);
30316 desret_xmlChar_ptr(ret_val);
30317 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030318 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030319 xmlResetLastError();
30320 if (mem_base != xmlMemBlocks()) {
30321 printf("Leak of %d blocks found in xmlTextReaderName",
30322 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030323 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030324 printf(" %d", n_reader);
30325 printf("\n");
30326 }
30327 }
30328#endif
30329
Daniel Veillard3d97e662004-11-04 10:49:00 +000030330 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000030331 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030332}
30333
30334
30335static int
30336test_xmlTextReaderNamespaceUri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030337 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030338
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030339#ifdef LIBXML_READER_ENABLED
30340 int mem_base;
30341 xmlChar * ret_val;
30342 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30343 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030344
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030345 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30346 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030347 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030348
30349 ret_val = xmlTextReaderNamespaceUri(reader);
30350 desret_xmlChar_ptr(ret_val);
30351 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030352 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030353 xmlResetLastError();
30354 if (mem_base != xmlMemBlocks()) {
30355 printf("Leak of %d blocks found in xmlTextReaderNamespaceUri",
30356 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030357 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030358 printf(" %d", n_reader);
30359 printf("\n");
30360 }
30361 }
30362#endif
30363
Daniel Veillard3d97e662004-11-04 10:49:00 +000030364 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000030365 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030366}
30367
30368
30369static int
30370test_xmlTextReaderNext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030371 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030372
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030373#ifdef LIBXML_READER_ENABLED
30374 int mem_base;
30375 int ret_val;
30376 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30377 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030378
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030379 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30380 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030381 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030382
30383 ret_val = xmlTextReaderNext(reader);
30384 desret_int(ret_val);
30385 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030386 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030387 xmlResetLastError();
30388 if (mem_base != xmlMemBlocks()) {
30389 printf("Leak of %d blocks found in xmlTextReaderNext",
30390 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030391 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030392 printf(" %d", n_reader);
30393 printf("\n");
30394 }
30395 }
30396#endif
30397
Daniel Veillard3d97e662004-11-04 10:49:00 +000030398 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000030399 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030400}
30401
30402
30403static int
30404test_xmlTextReaderNextSibling(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030405 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030406
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030407#ifdef LIBXML_READER_ENABLED
30408 int mem_base;
30409 int ret_val;
30410 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30411 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030412
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030413 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30414 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030415 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030416
30417 ret_val = xmlTextReaderNextSibling(reader);
30418 desret_int(ret_val);
30419 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030420 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030421 xmlResetLastError();
30422 if (mem_base != xmlMemBlocks()) {
30423 printf("Leak of %d blocks found in xmlTextReaderNextSibling",
30424 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030425 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030426 printf(" %d", n_reader);
30427 printf("\n");
30428 }
30429 }
30430#endif
30431
Daniel Veillard3d97e662004-11-04 10:49:00 +000030432 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000030433 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030434}
30435
30436
30437static int
30438test_xmlTextReaderNodeType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030439 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030440
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030441#ifdef LIBXML_READER_ENABLED
30442 int mem_base;
30443 int ret_val;
30444 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30445 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030446
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030447 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30448 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030449 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030450
30451 ret_val = xmlTextReaderNodeType(reader);
30452 desret_int(ret_val);
30453 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030454 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030455 xmlResetLastError();
30456 if (mem_base != xmlMemBlocks()) {
30457 printf("Leak of %d blocks found in xmlTextReaderNodeType",
30458 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030459 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030460 printf(" %d", n_reader);
30461 printf("\n");
30462 }
30463 }
30464#endif
30465
Daniel Veillard3d97e662004-11-04 10:49:00 +000030466 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000030467 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030468}
30469
30470
30471static int
30472test_xmlTextReaderNormalization(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030473 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030474
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030475#ifdef LIBXML_READER_ENABLED
30476 int mem_base;
30477 int ret_val;
30478 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30479 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030480
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030481 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30482 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030483 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030484
30485 ret_val = xmlTextReaderNormalization(reader);
30486 desret_int(ret_val);
30487 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030488 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030489 xmlResetLastError();
30490 if (mem_base != xmlMemBlocks()) {
30491 printf("Leak of %d blocks found in xmlTextReaderNormalization",
30492 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030493 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030494 printf(" %d", n_reader);
30495 printf("\n");
30496 }
30497 }
30498#endif
30499
Daniel Veillard3d97e662004-11-04 10:49:00 +000030500 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000030501 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030502}
30503
30504
30505static int
30506test_xmlTextReaderPrefix(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030507 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030508
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030509#ifdef LIBXML_READER_ENABLED
30510 int mem_base;
30511 xmlChar * ret_val;
30512 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30513 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030514
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030515 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30516 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030517 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030518
30519 ret_val = xmlTextReaderPrefix(reader);
30520 desret_xmlChar_ptr(ret_val);
30521 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030522 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030523 xmlResetLastError();
30524 if (mem_base != xmlMemBlocks()) {
30525 printf("Leak of %d blocks found in xmlTextReaderPrefix",
30526 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030527 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030528 printf(" %d", n_reader);
30529 printf("\n");
30530 }
30531 }
30532#endif
30533
Daniel Veillard3d97e662004-11-04 10:49:00 +000030534 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000030535 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030536}
30537
30538
30539static int
30540test_xmlTextReaderPreserve(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030541 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030542
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030543#ifdef LIBXML_READER_ENABLED
30544 int mem_base;
30545 xmlNodePtr ret_val;
30546 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30547 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030548
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030549 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30550 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030551 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030552
30553 ret_val = xmlTextReaderPreserve(reader);
30554 desret_xmlNodePtr(ret_val);
30555 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030556 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030557 xmlResetLastError();
30558 if (mem_base != xmlMemBlocks()) {
30559 printf("Leak of %d blocks found in xmlTextReaderPreserve",
30560 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030561 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030562 printf(" %d", n_reader);
30563 printf("\n");
30564 }
30565 }
30566#endif
30567
Daniel Veillard3d97e662004-11-04 10:49:00 +000030568 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000030569 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030570}
30571
30572
30573static int
30574test_xmlTextReaderPreservePattern(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030575 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030576
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030577#ifdef LIBXML_READER_ENABLED
30578 int mem_base;
30579 int ret_val;
30580 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30581 int n_reader;
30582 xmlChar * pattern; /* an XPath subset pattern */
30583 int n_pattern;
30584 xmlChar ** namespaces; /* the prefix definitions, array of [URI, prefix] or NULL */
30585 int n_namespaces;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030586
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030587 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30588 for (n_pattern = 0;n_pattern < gen_nb_const_xmlChar_ptr;n_pattern++) {
30589 for (n_namespaces = 0;n_namespaces < gen_nb_const_xmlChar_ptr_ptr;n_namespaces++) {
30590 mem_base = xmlMemBlocks();
30591 reader = gen_xmlTextReaderPtr(n_reader, 0);
30592 pattern = gen_const_xmlChar_ptr(n_pattern, 1);
30593 namespaces = gen_const_xmlChar_ptr_ptr(n_namespaces, 2);
30594
30595 ret_val = xmlTextReaderPreservePattern(reader, pattern, namespaces);
30596 desret_int(ret_val);
30597 call_tests++;
30598 des_xmlTextReaderPtr(n_reader, reader, 0);
30599 des_const_xmlChar_ptr(n_pattern, pattern, 1);
30600 des_const_xmlChar_ptr_ptr(n_namespaces, namespaces, 2);
30601 xmlResetLastError();
30602 if (mem_base != xmlMemBlocks()) {
30603 printf("Leak of %d blocks found in xmlTextReaderPreservePattern",
30604 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030605 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030606 printf(" %d", n_reader);
30607 printf(" %d", n_pattern);
30608 printf(" %d", n_namespaces);
30609 printf("\n");
30610 }
30611 }
30612 }
30613 }
30614#endif
30615
30616 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000030617 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030618}
30619
30620
30621static int
30622test_xmlTextReaderQuoteChar(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030623 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030624
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030625#ifdef LIBXML_READER_ENABLED
30626 int mem_base;
30627 int ret_val;
30628 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30629 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030630
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030631 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30632 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030633 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030634
30635 ret_val = xmlTextReaderQuoteChar(reader);
30636 desret_int(ret_val);
30637 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030638 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030639 xmlResetLastError();
30640 if (mem_base != xmlMemBlocks()) {
30641 printf("Leak of %d blocks found in xmlTextReaderQuoteChar",
30642 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030643 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030644 printf(" %d", n_reader);
30645 printf("\n");
30646 }
30647 }
30648#endif
30649
Daniel Veillard3d97e662004-11-04 10:49:00 +000030650 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000030651 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030652}
30653
30654
30655static int
30656test_xmlTextReaderRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030657 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030658
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030659#ifdef LIBXML_READER_ENABLED
30660 int mem_base;
30661 int ret_val;
30662 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30663 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030664
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030665 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30666 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030667 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030668
30669 ret_val = xmlTextReaderRead(reader);
30670 desret_int(ret_val);
30671 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030672 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030673 xmlResetLastError();
30674 if (mem_base != xmlMemBlocks()) {
30675 printf("Leak of %d blocks found in xmlTextReaderRead",
30676 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030677 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030678 printf(" %d", n_reader);
30679 printf("\n");
30680 }
30681 }
30682#endif
30683
Daniel Veillard3d97e662004-11-04 10:49:00 +000030684 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000030685 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030686}
30687
30688
30689static int
30690test_xmlTextReaderReadAttributeValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030691 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030692
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030693#ifdef LIBXML_READER_ENABLED
30694 int mem_base;
30695 int ret_val;
30696 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30697 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030698
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030699 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30700 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030701 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030702
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030703 ret_val = xmlTextReaderReadAttributeValue(reader);
30704 desret_int(ret_val);
30705 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030706 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030707 xmlResetLastError();
30708 if (mem_base != xmlMemBlocks()) {
30709 printf("Leak of %d blocks found in xmlTextReaderReadAttributeValue",
30710 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030711 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030712 printf(" %d", n_reader);
30713 printf("\n");
30714 }
30715 }
30716#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000030717
Daniel Veillard3d97e662004-11-04 10:49:00 +000030718 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000030719 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030720}
30721
30722
30723static int
30724test_xmlTextReaderReadState(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030725 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030726
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030727#ifdef LIBXML_READER_ENABLED
30728 int mem_base;
30729 int ret_val;
30730 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30731 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030732
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030733 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30734 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030735 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030736
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030737 ret_val = xmlTextReaderReadState(reader);
30738 desret_int(ret_val);
30739 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030740 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030741 xmlResetLastError();
30742 if (mem_base != xmlMemBlocks()) {
30743 printf("Leak of %d blocks found in xmlTextReaderReadState",
30744 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030745 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030746 printf(" %d", n_reader);
30747 printf("\n");
30748 }
30749 }
30750#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000030751
Daniel Veillard3d97e662004-11-04 10:49:00 +000030752 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000030753 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030754}
30755
30756
30757static int
30758test_xmlTextReaderRelaxNGSetSchema(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030759 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030760
Daniel Veillardce682bc2004-11-05 17:22:25 +000030761#ifdef LIBXML_READER_ENABLED
30762#ifdef LIBXML_SCHEMAS_ENABLED
30763 int mem_base;
30764 int ret_val;
30765 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30766 int n_reader;
30767 xmlRelaxNGPtr schema; /* a precompiled RelaxNG schema */
30768 int n_schema;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030769
Daniel Veillardce682bc2004-11-05 17:22:25 +000030770 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30771 for (n_schema = 0;n_schema < gen_nb_xmlRelaxNGPtr;n_schema++) {
30772 mem_base = xmlMemBlocks();
30773 reader = gen_xmlTextReaderPtr(n_reader, 0);
30774 schema = gen_xmlRelaxNGPtr(n_schema, 1);
30775
30776 ret_val = xmlTextReaderRelaxNGSetSchema(reader, schema);
30777 desret_int(ret_val);
30778 call_tests++;
30779 des_xmlTextReaderPtr(n_reader, reader, 0);
30780 des_xmlRelaxNGPtr(n_schema, schema, 1);
30781 xmlResetLastError();
30782 if (mem_base != xmlMemBlocks()) {
30783 printf("Leak of %d blocks found in xmlTextReaderRelaxNGSetSchema",
30784 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030785 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030786 printf(" %d", n_reader);
30787 printf(" %d", n_schema);
30788 printf("\n");
30789 }
30790 }
30791 }
30792#endif
30793#endif
30794
30795 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000030796 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030797}
30798
30799
30800static int
30801test_xmlTextReaderRelaxNGValidate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030802 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030803
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030804#ifdef LIBXML_READER_ENABLED
30805#ifdef LIBXML_SCHEMAS_ENABLED
30806 int mem_base;
30807 int ret_val;
30808 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30809 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030810 char * rng; /* the path to a RelaxNG schema or NULL */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030811 int n_rng;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030812
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030813 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30814 for (n_rng = 0;n_rng < gen_nb_const_char_ptr;n_rng++) {
30815 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030816 reader = gen_xmlTextReaderPtr(n_reader, 0);
30817 rng = gen_const_char_ptr(n_rng, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030818
30819 ret_val = xmlTextReaderRelaxNGValidate(reader, rng);
30820 desret_int(ret_val);
30821 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030822 des_xmlTextReaderPtr(n_reader, reader, 0);
30823 des_const_char_ptr(n_rng, rng, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030824 xmlResetLastError();
30825 if (mem_base != xmlMemBlocks()) {
30826 printf("Leak of %d blocks found in xmlTextReaderRelaxNGValidate",
30827 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030828 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030829 printf(" %d", n_reader);
30830 printf(" %d", n_rng);
30831 printf("\n");
30832 }
30833 }
30834 }
30835#endif
30836#endif
30837
Daniel Veillard3d97e662004-11-04 10:49:00 +000030838 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000030839 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030840}
30841
30842
30843static int
30844test_xmlTextReaderSetErrorHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030845 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030846
30847
30848 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000030849 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030850}
30851
30852
30853static int
30854test_xmlTextReaderSetParserProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030855 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030856
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030857#ifdef LIBXML_READER_ENABLED
30858 int mem_base;
30859 int ret_val;
30860 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30861 int n_reader;
30862 int prop; /* the xmlParserProperties to set */
30863 int n_prop;
30864 int value; /* usually 0 or 1 to (de)activate it */
30865 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030866
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030867 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30868 for (n_prop = 0;n_prop < gen_nb_int;n_prop++) {
30869 for (n_value = 0;n_value < gen_nb_int;n_value++) {
30870 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030871 reader = gen_xmlTextReaderPtr(n_reader, 0);
30872 prop = gen_int(n_prop, 1);
30873 value = gen_int(n_value, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030874
30875 ret_val = xmlTextReaderSetParserProp(reader, prop, value);
30876 desret_int(ret_val);
30877 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030878 des_xmlTextReaderPtr(n_reader, reader, 0);
30879 des_int(n_prop, prop, 1);
30880 des_int(n_value, value, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030881 xmlResetLastError();
30882 if (mem_base != xmlMemBlocks()) {
30883 printf("Leak of %d blocks found in xmlTextReaderSetParserProp",
30884 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030885 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030886 printf(" %d", n_reader);
30887 printf(" %d", n_prop);
30888 printf(" %d", n_value);
30889 printf("\n");
30890 }
30891 }
30892 }
30893 }
30894#endif
30895
Daniel Veillard3d97e662004-11-04 10:49:00 +000030896 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000030897 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030898}
30899
30900
30901static int
30902test_xmlTextReaderSetStructuredErrorHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030903 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030904
30905
30906 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000030907 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030908}
30909
30910
30911static int
30912test_xmlTextReaderStandalone(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030913 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030914
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030915#ifdef LIBXML_READER_ENABLED
30916 int mem_base;
30917 int ret_val;
30918 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30919 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030920
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030921 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30922 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030923 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030924
30925 ret_val = xmlTextReaderStandalone(reader);
30926 desret_int(ret_val);
30927 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030928 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030929 xmlResetLastError();
30930 if (mem_base != xmlMemBlocks()) {
30931 printf("Leak of %d blocks found in xmlTextReaderStandalone",
30932 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030933 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030934 printf(" %d", n_reader);
30935 printf("\n");
30936 }
30937 }
30938#endif
30939
Daniel Veillard3d97e662004-11-04 10:49:00 +000030940 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000030941 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030942}
30943
30944
30945static int
30946test_xmlTextReaderValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030947 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030948
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030949#ifdef LIBXML_READER_ENABLED
30950 int mem_base;
30951 xmlChar * ret_val;
30952 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30953 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030954
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030955 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30956 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030957 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030958
30959 ret_val = xmlTextReaderValue(reader);
30960 desret_xmlChar_ptr(ret_val);
30961 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030962 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030963 xmlResetLastError();
30964 if (mem_base != xmlMemBlocks()) {
30965 printf("Leak of %d blocks found in xmlTextReaderValue",
30966 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030967 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030968 printf(" %d", n_reader);
30969 printf("\n");
30970 }
30971 }
30972#endif
30973
Daniel Veillard3d97e662004-11-04 10:49:00 +000030974 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000030975 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030976}
30977
30978
30979static int
30980test_xmlTextReaderXmlLang(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030981 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030982
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030983#ifdef LIBXML_READER_ENABLED
30984 int mem_base;
30985 xmlChar * ret_val;
30986 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30987 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030988
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030989 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30990 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030991 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030992
30993 ret_val = xmlTextReaderXmlLang(reader);
30994 desret_xmlChar_ptr(ret_val);
30995 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030996 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030997 xmlResetLastError();
30998 if (mem_base != xmlMemBlocks()) {
30999 printf("Leak of %d blocks found in xmlTextReaderXmlLang",
31000 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031001 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031002 printf(" %d", n_reader);
31003 printf("\n");
31004 }
31005 }
31006#endif
31007
Daniel Veillard3d97e662004-11-04 10:49:00 +000031008 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000031009 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031010}
31011
31012static int
31013test_xmlreader(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031014 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031015
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000031016 printf("Testing xmlreader : 68 of 78 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000031017 test_ret += test_xmlNewTextReader();
31018 test_ret += test_xmlNewTextReaderFilename();
31019 test_ret += test_xmlReaderForDoc();
31020 test_ret += test_xmlReaderForFile();
31021 test_ret += test_xmlReaderForMemory();
31022 test_ret += test_xmlReaderNewDoc();
31023 test_ret += test_xmlReaderNewFile();
31024 test_ret += test_xmlReaderNewMemory();
31025 test_ret += test_xmlReaderNewWalker();
31026 test_ret += test_xmlReaderWalker();
31027 test_ret += test_xmlTextReaderAttributeCount();
31028 test_ret += test_xmlTextReaderBaseUri();
31029 test_ret += test_xmlTextReaderClose();
31030 test_ret += test_xmlTextReaderConstBaseUri();
31031 test_ret += test_xmlTextReaderConstEncoding();
31032 test_ret += test_xmlTextReaderConstLocalName();
31033 test_ret += test_xmlTextReaderConstName();
31034 test_ret += test_xmlTextReaderConstNamespaceUri();
31035 test_ret += test_xmlTextReaderConstPrefix();
31036 test_ret += test_xmlTextReaderConstString();
31037 test_ret += test_xmlTextReaderConstValue();
31038 test_ret += test_xmlTextReaderConstXmlLang();
31039 test_ret += test_xmlTextReaderConstXmlVersion();
31040 test_ret += test_xmlTextReaderCurrentDoc();
31041 test_ret += test_xmlTextReaderCurrentNode();
31042 test_ret += test_xmlTextReaderDepth();
31043 test_ret += test_xmlTextReaderExpand();
31044 test_ret += test_xmlTextReaderGetAttribute();
31045 test_ret += test_xmlTextReaderGetAttributeNo();
31046 test_ret += test_xmlTextReaderGetAttributeNs();
31047 test_ret += test_xmlTextReaderGetErrorHandler();
31048 test_ret += test_xmlTextReaderGetParserProp();
31049 test_ret += test_xmlTextReaderGetRemainder();
31050 test_ret += test_xmlTextReaderHasAttributes();
31051 test_ret += test_xmlTextReaderHasValue();
31052 test_ret += test_xmlTextReaderIsDefault();
31053 test_ret += test_xmlTextReaderIsEmptyElement();
31054 test_ret += test_xmlTextReaderIsNamespaceDecl();
31055 test_ret += test_xmlTextReaderIsValid();
31056 test_ret += test_xmlTextReaderLocalName();
31057 test_ret += test_xmlTextReaderLocatorBaseURI();
31058 test_ret += test_xmlTextReaderLocatorLineNumber();
31059 test_ret += test_xmlTextReaderLookupNamespace();
31060 test_ret += test_xmlTextReaderMoveToAttribute();
31061 test_ret += test_xmlTextReaderMoveToAttributeNo();
31062 test_ret += test_xmlTextReaderMoveToAttributeNs();
31063 test_ret += test_xmlTextReaderMoveToElement();
31064 test_ret += test_xmlTextReaderMoveToFirstAttribute();
31065 test_ret += test_xmlTextReaderMoveToNextAttribute();
31066 test_ret += test_xmlTextReaderName();
31067 test_ret += test_xmlTextReaderNamespaceUri();
31068 test_ret += test_xmlTextReaderNext();
31069 test_ret += test_xmlTextReaderNextSibling();
31070 test_ret += test_xmlTextReaderNodeType();
31071 test_ret += test_xmlTextReaderNormalization();
31072 test_ret += test_xmlTextReaderPrefix();
31073 test_ret += test_xmlTextReaderPreserve();
31074 test_ret += test_xmlTextReaderPreservePattern();
31075 test_ret += test_xmlTextReaderQuoteChar();
31076 test_ret += test_xmlTextReaderRead();
31077 test_ret += test_xmlTextReaderReadAttributeValue();
31078 test_ret += test_xmlTextReaderReadState();
31079 test_ret += test_xmlTextReaderRelaxNGSetSchema();
31080 test_ret += test_xmlTextReaderRelaxNGValidate();
31081 test_ret += test_xmlTextReaderSetErrorHandler();
31082 test_ret += test_xmlTextReaderSetParserProp();
31083 test_ret += test_xmlTextReaderSetStructuredErrorHandler();
31084 test_ret += test_xmlTextReaderStandalone();
31085 test_ret += test_xmlTextReaderValue();
31086 test_ret += test_xmlTextReaderXmlLang();
Daniel Veillardd93f6252004-11-02 15:53:51 +000031087
Daniel Veillard42595322004-11-08 10:52:06 +000031088 if (test_ret != 0)
31089 printf("Module xmlreader: %d errors\n", test_ret);
31090 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031091}
Daniel Veillarda521d282004-11-09 14:59:59 +000031092#ifdef LIBXML_REGEXP_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000031093
Daniel Veillarda82b1822004-11-08 16:24:57 +000031094#define gen_nb_xmlRegExecCtxtPtr 1
31095static xmlRegExecCtxtPtr gen_xmlRegExecCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31096 return(NULL);
31097}
31098static void des_xmlRegExecCtxtPtr(int no ATTRIBUTE_UNUSED, xmlRegExecCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31099}
Daniel Veillarda521d282004-11-09 14:59:59 +000031100#endif
31101
Daniel Veillarda82b1822004-11-08 16:24:57 +000031102
31103static int
31104test_xmlRegExecPushString(void) {
31105 int test_ret = 0;
31106
31107#ifdef LIBXML_REGEXP_ENABLED
31108 int mem_base;
31109 int ret_val;
31110 xmlRegExecCtxtPtr exec; /* a regexp execution context or NULL to indicate the end */
31111 int n_exec;
31112 xmlChar * value; /* a string token input */
31113 int n_value;
31114 void * data; /* data associated to the token to reuse in callbacks */
31115 int n_data;
31116
31117 for (n_exec = 0;n_exec < gen_nb_xmlRegExecCtxtPtr;n_exec++) {
31118 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
31119 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
31120 mem_base = xmlMemBlocks();
31121 exec = gen_xmlRegExecCtxtPtr(n_exec, 0);
31122 value = gen_const_xmlChar_ptr(n_value, 1);
31123 data = gen_userdata(n_data, 2);
31124
31125 ret_val = xmlRegExecPushString(exec, value, data);
31126 desret_int(ret_val);
31127 call_tests++;
31128 des_xmlRegExecCtxtPtr(n_exec, exec, 0);
31129 des_const_xmlChar_ptr(n_value, value, 1);
31130 des_userdata(n_data, data, 2);
31131 xmlResetLastError();
31132 if (mem_base != xmlMemBlocks()) {
31133 printf("Leak of %d blocks found in xmlRegExecPushString",
31134 xmlMemBlocks() - mem_base);
31135 test_ret++;
31136 printf(" %d", n_exec);
31137 printf(" %d", n_value);
31138 printf(" %d", n_data);
31139 printf("\n");
31140 }
31141 }
31142 }
31143 }
31144#endif
31145
31146 function_tests++;
31147 return(test_ret);
31148}
31149
31150
31151static int
31152test_xmlRegExecPushString2(void) {
31153 int test_ret = 0;
31154
31155#ifdef LIBXML_REGEXP_ENABLED
31156 int mem_base;
31157 int ret_val;
31158 xmlRegExecCtxtPtr exec; /* a regexp execution context or NULL to indicate the end */
31159 int n_exec;
31160 xmlChar * value; /* the first string token input */
31161 int n_value;
31162 xmlChar * value2; /* the second string token input */
31163 int n_value2;
31164 void * data; /* data associated to the token to reuse in callbacks */
31165 int n_data;
31166
31167 for (n_exec = 0;n_exec < gen_nb_xmlRegExecCtxtPtr;n_exec++) {
31168 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
31169 for (n_value2 = 0;n_value2 < gen_nb_const_xmlChar_ptr;n_value2++) {
31170 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
31171 mem_base = xmlMemBlocks();
31172 exec = gen_xmlRegExecCtxtPtr(n_exec, 0);
31173 value = gen_const_xmlChar_ptr(n_value, 1);
31174 value2 = gen_const_xmlChar_ptr(n_value2, 2);
31175 data = gen_userdata(n_data, 3);
31176
31177 ret_val = xmlRegExecPushString2(exec, value, value2, data);
31178 desret_int(ret_val);
31179 call_tests++;
31180 des_xmlRegExecCtxtPtr(n_exec, exec, 0);
31181 des_const_xmlChar_ptr(n_value, value, 1);
31182 des_const_xmlChar_ptr(n_value2, value2, 2);
31183 des_userdata(n_data, data, 3);
31184 xmlResetLastError();
31185 if (mem_base != xmlMemBlocks()) {
31186 printf("Leak of %d blocks found in xmlRegExecPushString2",
31187 xmlMemBlocks() - mem_base);
31188 test_ret++;
31189 printf(" %d", n_exec);
31190 printf(" %d", n_value);
31191 printf(" %d", n_value2);
31192 printf(" %d", n_data);
31193 printf("\n");
31194 }
31195 }
31196 }
31197 }
31198 }
31199#endif
31200
31201 function_tests++;
31202 return(test_ret);
31203}
31204
Daniel Veillarda521d282004-11-09 14:59:59 +000031205#ifdef LIBXML_REGEXP_ENABLED
Daniel Veillarda82b1822004-11-08 16:24:57 +000031206
31207#define gen_nb_xmlRegexpPtr 1
31208static xmlRegexpPtr gen_xmlRegexpPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31209 return(NULL);
31210}
31211static void des_xmlRegexpPtr(int no ATTRIBUTE_UNUSED, xmlRegexpPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31212}
Daniel Veillarda521d282004-11-09 14:59:59 +000031213#endif
31214
Daniel Veillarda82b1822004-11-08 16:24:57 +000031215
31216static int
31217test_xmlRegNewExecCtxt(void) {
31218 int test_ret = 0;
31219
31220
31221 /* missing type support */
31222 return(test_ret);
31223}
31224
31225
31226static int
31227test_xmlRegexpCompile(void) {
31228 int test_ret = 0;
31229
31230
31231 /* missing type support */
31232 return(test_ret);
31233}
31234
31235
31236static int
31237test_xmlRegexpExec(void) {
31238 int test_ret = 0;
31239
31240#ifdef LIBXML_REGEXP_ENABLED
31241 int mem_base;
31242 int ret_val;
31243 xmlRegexpPtr comp; /* the compiled regular expression */
31244 int n_comp;
31245 xmlChar * content; /* the value to check against the regular expression */
31246 int n_content;
31247
31248 for (n_comp = 0;n_comp < gen_nb_xmlRegexpPtr;n_comp++) {
31249 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
31250 mem_base = xmlMemBlocks();
31251 comp = gen_xmlRegexpPtr(n_comp, 0);
31252 content = gen_const_xmlChar_ptr(n_content, 1);
31253
31254 ret_val = xmlRegexpExec(comp, content);
31255 desret_int(ret_val);
31256 call_tests++;
31257 des_xmlRegexpPtr(n_comp, comp, 0);
31258 des_const_xmlChar_ptr(n_content, content, 1);
31259 xmlResetLastError();
31260 if (mem_base != xmlMemBlocks()) {
31261 printf("Leak of %d blocks found in xmlRegexpExec",
31262 xmlMemBlocks() - mem_base);
31263 test_ret++;
31264 printf(" %d", n_comp);
31265 printf(" %d", n_content);
31266 printf("\n");
31267 }
31268 }
31269 }
31270#endif
31271
31272 function_tests++;
31273 return(test_ret);
31274}
31275
31276
31277static int
31278test_xmlRegexpIsDeterminist(void) {
31279 int test_ret = 0;
31280
31281#ifdef LIBXML_REGEXP_ENABLED
31282 int mem_base;
31283 int ret_val;
31284 xmlRegexpPtr comp; /* the compiled regular expression */
31285 int n_comp;
31286
31287 for (n_comp = 0;n_comp < gen_nb_xmlRegexpPtr;n_comp++) {
31288 mem_base = xmlMemBlocks();
31289 comp = gen_xmlRegexpPtr(n_comp, 0);
31290
31291 ret_val = xmlRegexpIsDeterminist(comp);
31292 desret_int(ret_val);
31293 call_tests++;
31294 des_xmlRegexpPtr(n_comp, comp, 0);
31295 xmlResetLastError();
31296 if (mem_base != xmlMemBlocks()) {
31297 printf("Leak of %d blocks found in xmlRegexpIsDeterminist",
31298 xmlMemBlocks() - mem_base);
31299 test_ret++;
31300 printf(" %d", n_comp);
31301 printf("\n");
31302 }
31303 }
31304#endif
31305
31306 function_tests++;
31307 return(test_ret);
31308}
31309
31310
31311static int
31312test_xmlRegexpPrint(void) {
31313 int test_ret = 0;
31314
31315#ifdef LIBXML_REGEXP_ENABLED
31316 int mem_base;
31317 FILE * output; /* the file for the output debug */
31318 int n_output;
31319 xmlRegexpPtr regexp; /* the compiled regexp */
31320 int n_regexp;
31321
31322 for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
31323 for (n_regexp = 0;n_regexp < gen_nb_xmlRegexpPtr;n_regexp++) {
31324 mem_base = xmlMemBlocks();
31325 output = gen_FILE_ptr(n_output, 0);
31326 regexp = gen_xmlRegexpPtr(n_regexp, 1);
31327
31328 xmlRegexpPrint(output, regexp);
31329 call_tests++;
31330 des_FILE_ptr(n_output, output, 0);
31331 des_xmlRegexpPtr(n_regexp, regexp, 1);
31332 xmlResetLastError();
31333 if (mem_base != xmlMemBlocks()) {
31334 printf("Leak of %d blocks found in xmlRegexpPrint",
31335 xmlMemBlocks() - mem_base);
31336 test_ret++;
31337 printf(" %d", n_output);
31338 printf(" %d", n_regexp);
31339 printf("\n");
31340 }
31341 }
31342 }
31343#endif
31344
31345 function_tests++;
31346 return(test_ret);
31347}
31348
31349static int
31350test_xmlregexp(void) {
31351 int test_ret = 0;
31352
31353 printf("Testing xmlregexp : 5 of 9 functions ...\n");
31354 test_ret += test_xmlRegExecPushString();
31355 test_ret += test_xmlRegExecPushString2();
31356 test_ret += test_xmlRegNewExecCtxt();
31357 test_ret += test_xmlRegexpCompile();
31358 test_ret += test_xmlRegexpExec();
31359 test_ret += test_xmlRegexpIsDeterminist();
31360 test_ret += test_xmlRegexpPrint();
31361
31362 if (test_ret != 0)
31363 printf("Module xmlregexp: %d errors\n", test_ret);
31364 return(test_ret);
31365}
Daniel Veillarda521d282004-11-09 14:59:59 +000031366#ifdef LIBXML_OUTPUT_ENABLED
Daniel Veillarda82b1822004-11-08 16:24:57 +000031367
Daniel Veillardce682bc2004-11-05 17:22:25 +000031368#define gen_nb_xmlSaveCtxtPtr 1
31369static xmlSaveCtxtPtr gen_xmlSaveCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31370 return(NULL);
31371}
31372static void des_xmlSaveCtxtPtr(int no ATTRIBUTE_UNUSED, xmlSaveCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31373}
Daniel Veillarda521d282004-11-09 14:59:59 +000031374#endif
31375
Daniel Veillardce682bc2004-11-05 17:22:25 +000031376
Daniel Veillardd93f6252004-11-02 15:53:51 +000031377static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000031378test_xmlSaveClose(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031379 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031380
Daniel Veillardce682bc2004-11-05 17:22:25 +000031381#ifdef LIBXML_OUTPUT_ENABLED
31382 int mem_base;
31383 int ret_val;
31384 xmlSaveCtxtPtr ctxt; /* a document saving context */
31385 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031386
Daniel Veillardce682bc2004-11-05 17:22:25 +000031387 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSaveCtxtPtr;n_ctxt++) {
31388 mem_base = xmlMemBlocks();
31389 ctxt = gen_xmlSaveCtxtPtr(n_ctxt, 0);
31390
31391 ret_val = xmlSaveClose(ctxt);
31392 desret_int(ret_val);
31393 call_tests++;
31394 des_xmlSaveCtxtPtr(n_ctxt, ctxt, 0);
31395 xmlResetLastError();
31396 if (mem_base != xmlMemBlocks()) {
31397 printf("Leak of %d blocks found in xmlSaveClose",
31398 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031399 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031400 printf(" %d", n_ctxt);
31401 printf("\n");
31402 }
31403 }
31404#endif
31405
31406 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000031407 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031408}
31409
31410
31411static int
31412test_xmlSaveDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031413 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031414
Daniel Veillardce682bc2004-11-05 17:22:25 +000031415#ifdef LIBXML_OUTPUT_ENABLED
31416 int mem_base;
31417 long ret_val;
31418 xmlSaveCtxtPtr ctxt; /* a document saving context */
31419 int n_ctxt;
31420 xmlDocPtr doc; /* a document */
31421 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031422
Daniel Veillardce682bc2004-11-05 17:22:25 +000031423 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSaveCtxtPtr;n_ctxt++) {
31424 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
31425 mem_base = xmlMemBlocks();
31426 ctxt = gen_xmlSaveCtxtPtr(n_ctxt, 0);
31427 doc = gen_xmlDocPtr(n_doc, 1);
31428
31429 ret_val = xmlSaveDoc(ctxt, doc);
31430 desret_long(ret_val);
31431 call_tests++;
31432 des_xmlSaveCtxtPtr(n_ctxt, ctxt, 0);
31433 des_xmlDocPtr(n_doc, doc, 1);
31434 xmlResetLastError();
31435 if (mem_base != xmlMemBlocks()) {
31436 printf("Leak of %d blocks found in xmlSaveDoc",
31437 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031438 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031439 printf(" %d", n_ctxt);
31440 printf(" %d", n_doc);
31441 printf("\n");
31442 }
31443 }
31444 }
31445#endif
31446
31447 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000031448 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031449}
31450
31451
31452static int
31453test_xmlSaveFlush(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031454 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031455
Daniel Veillardce682bc2004-11-05 17:22:25 +000031456#ifdef LIBXML_OUTPUT_ENABLED
31457 int mem_base;
31458 int ret_val;
31459 xmlSaveCtxtPtr ctxt; /* a document saving context */
31460 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031461
Daniel Veillardce682bc2004-11-05 17:22:25 +000031462 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSaveCtxtPtr;n_ctxt++) {
31463 mem_base = xmlMemBlocks();
31464 ctxt = gen_xmlSaveCtxtPtr(n_ctxt, 0);
31465
31466 ret_val = xmlSaveFlush(ctxt);
31467 desret_int(ret_val);
31468 call_tests++;
31469 des_xmlSaveCtxtPtr(n_ctxt, ctxt, 0);
31470 xmlResetLastError();
31471 if (mem_base != xmlMemBlocks()) {
31472 printf("Leak of %d blocks found in xmlSaveFlush",
31473 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031474 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031475 printf(" %d", n_ctxt);
31476 printf("\n");
31477 }
31478 }
31479#endif
31480
31481 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000031482 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031483}
31484
31485
31486static int
31487test_xmlSaveSetAttrEscape(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031488 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031489
31490
31491 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031492 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031493}
31494
31495
31496static int
31497test_xmlSaveSetEscape(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031498 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031499
31500
31501 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031502 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031503}
31504
31505
31506static int
31507test_xmlSaveToFd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031508 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031509
31510
31511 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031512 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031513}
31514
31515
31516static int
31517test_xmlSaveToFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031518 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031519
31520
31521 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031522 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031523}
31524
31525
31526static int
31527test_xmlSaveTree(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031528 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031529
Daniel Veillardce682bc2004-11-05 17:22:25 +000031530#ifdef LIBXML_OUTPUT_ENABLED
31531 int mem_base;
31532 long ret_val;
31533 xmlSaveCtxtPtr ctxt; /* a document saving context */
31534 int n_ctxt;
31535 xmlNodePtr node; /* a document */
31536 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031537
Daniel Veillardce682bc2004-11-05 17:22:25 +000031538 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSaveCtxtPtr;n_ctxt++) {
31539 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
31540 mem_base = xmlMemBlocks();
31541 ctxt = gen_xmlSaveCtxtPtr(n_ctxt, 0);
31542 node = gen_xmlNodePtr(n_node, 1);
31543
31544 ret_val = xmlSaveTree(ctxt, node);
31545 desret_long(ret_val);
31546 call_tests++;
31547 des_xmlSaveCtxtPtr(n_ctxt, ctxt, 0);
31548 des_xmlNodePtr(n_node, node, 1);
31549 xmlResetLastError();
31550 if (mem_base != xmlMemBlocks()) {
31551 printf("Leak of %d blocks found in xmlSaveTree",
31552 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031553 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031554 printf(" %d", n_ctxt);
31555 printf(" %d", n_node);
31556 printf("\n");
31557 }
31558 }
31559 }
31560#endif
31561
31562 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000031563 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031564}
31565
31566static int
31567test_xmlsave(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031568 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031569
Daniel Veillardce682bc2004-11-05 17:22:25 +000031570 printf("Testing xmlsave : 4 of 9 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000031571 test_ret += test_xmlSaveClose();
31572 test_ret += test_xmlSaveDoc();
31573 test_ret += test_xmlSaveFlush();
31574 test_ret += test_xmlSaveSetAttrEscape();
31575 test_ret += test_xmlSaveSetEscape();
31576 test_ret += test_xmlSaveToFd();
31577 test_ret += test_xmlSaveToFilename();
31578 test_ret += test_xmlSaveTree();
Daniel Veillardd93f6252004-11-02 15:53:51 +000031579
Daniel Veillard42595322004-11-08 10:52:06 +000031580 if (test_ret != 0)
31581 printf("Module xmlsave: %d errors\n", test_ret);
31582 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031583}
Daniel Veillarda521d282004-11-09 14:59:59 +000031584#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000031585
Daniel Veillardce682bc2004-11-05 17:22:25 +000031586#define gen_nb_xmlSchemaPtr 1
31587static xmlSchemaPtr gen_xmlSchemaPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31588 return(NULL);
31589}
31590static void des_xmlSchemaPtr(int no ATTRIBUTE_UNUSED, xmlSchemaPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31591}
Daniel Veillarda521d282004-11-09 14:59:59 +000031592#endif
31593
Daniel Veillardce682bc2004-11-05 17:22:25 +000031594
Daniel Veillardd93f6252004-11-02 15:53:51 +000031595static int
31596test_xmlSchemaDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031597 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031598
Daniel Veillardce682bc2004-11-05 17:22:25 +000031599#ifdef LIBXML_SCHEMAS_ENABLED
31600#ifdef LIBXML_OUTPUT_ENABLED
31601 int mem_base;
31602 FILE * output; /* the file output */
31603 int n_output;
31604 xmlSchemaPtr schema; /* a schema structure */
31605 int n_schema;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031606
Daniel Veillardce682bc2004-11-05 17:22:25 +000031607 for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
31608 for (n_schema = 0;n_schema < gen_nb_xmlSchemaPtr;n_schema++) {
31609 mem_base = xmlMemBlocks();
31610 output = gen_FILE_ptr(n_output, 0);
31611 schema = gen_xmlSchemaPtr(n_schema, 1);
31612
31613 xmlSchemaDump(output, schema);
31614 call_tests++;
31615 des_FILE_ptr(n_output, output, 0);
31616 des_xmlSchemaPtr(n_schema, schema, 1);
31617 xmlResetLastError();
31618 if (mem_base != xmlMemBlocks()) {
31619 printf("Leak of %d blocks found in xmlSchemaDump",
31620 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031621 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031622 printf(" %d", n_output);
31623 printf(" %d", n_schema);
31624 printf("\n");
31625 }
31626 }
31627 }
31628#endif
31629#endif
31630
31631 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000031632 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031633}
31634
Daniel Veillarda521d282004-11-09 14:59:59 +000031635#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000031636
Daniel Veillardce682bc2004-11-05 17:22:25 +000031637#define gen_nb_xmlSchemaParserCtxtPtr 1
31638static xmlSchemaParserCtxtPtr gen_xmlSchemaParserCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31639 return(NULL);
31640}
31641static void des_xmlSchemaParserCtxtPtr(int no ATTRIBUTE_UNUSED, xmlSchemaParserCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31642}
Daniel Veillarda521d282004-11-09 14:59:59 +000031643#endif
31644
31645#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000031646
31647#define gen_nb_xmlSchemaValidityErrorFunc_ptr 1
31648static xmlSchemaValidityErrorFunc * gen_xmlSchemaValidityErrorFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31649 return(NULL);
31650}
31651static void des_xmlSchemaValidityErrorFunc_ptr(int no ATTRIBUTE_UNUSED, xmlSchemaValidityErrorFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31652}
Daniel Veillarda521d282004-11-09 14:59:59 +000031653#endif
31654
31655#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000031656
31657#define gen_nb_xmlSchemaValidityWarningFunc_ptr 1
31658static xmlSchemaValidityWarningFunc * gen_xmlSchemaValidityWarningFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31659 return(NULL);
31660}
31661static void des_xmlSchemaValidityWarningFunc_ptr(int no ATTRIBUTE_UNUSED, xmlSchemaValidityWarningFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31662}
Daniel Veillarda521d282004-11-09 14:59:59 +000031663#endif
31664
Daniel Veillardce682bc2004-11-05 17:22:25 +000031665
Daniel Veillardd93f6252004-11-02 15:53:51 +000031666static int
31667test_xmlSchemaGetParserErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031668 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031669
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000031670#ifdef LIBXML_SCHEMAS_ENABLED
31671 int mem_base;
31672 int ret_val;
31673 xmlSchemaParserCtxtPtr ctxt; /* a XMl-Schema parser context */
31674 int n_ctxt;
31675 xmlSchemaValidityErrorFunc * err; /* the error callback result */
31676 int n_err;
31677 xmlSchemaValidityWarningFunc * warn; /* the warning callback result */
31678 int n_warn;
31679 void ** ctx; /* contextual data for the callbacks result */
31680 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031681
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000031682 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaParserCtxtPtr;n_ctxt++) {
31683 for (n_err = 0;n_err < gen_nb_xmlSchemaValidityErrorFunc_ptr;n_err++) {
31684 for (n_warn = 0;n_warn < gen_nb_xmlSchemaValidityWarningFunc_ptr;n_warn++) {
31685 for (n_ctx = 0;n_ctx < gen_nb_void_ptr_ptr;n_ctx++) {
31686 mem_base = xmlMemBlocks();
31687 ctxt = gen_xmlSchemaParserCtxtPtr(n_ctxt, 0);
31688 err = gen_xmlSchemaValidityErrorFunc_ptr(n_err, 1);
31689 warn = gen_xmlSchemaValidityWarningFunc_ptr(n_warn, 2);
31690 ctx = gen_void_ptr_ptr(n_ctx, 3);
31691
31692 ret_val = xmlSchemaGetParserErrors(ctxt, err, warn, ctx);
31693 desret_int(ret_val);
31694 call_tests++;
31695 des_xmlSchemaParserCtxtPtr(n_ctxt, ctxt, 0);
31696 des_xmlSchemaValidityErrorFunc_ptr(n_err, err, 1);
31697 des_xmlSchemaValidityWarningFunc_ptr(n_warn, warn, 2);
31698 des_void_ptr_ptr(n_ctx, ctx, 3);
31699 xmlResetLastError();
31700 if (mem_base != xmlMemBlocks()) {
31701 printf("Leak of %d blocks found in xmlSchemaGetParserErrors",
31702 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031703 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000031704 printf(" %d", n_ctxt);
31705 printf(" %d", n_err);
31706 printf(" %d", n_warn);
31707 printf(" %d", n_ctx);
31708 printf("\n");
31709 }
31710 }
31711 }
31712 }
31713 }
31714#endif
31715
31716 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000031717 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031718}
31719
Daniel Veillarda521d282004-11-09 14:59:59 +000031720#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000031721
Daniel Veillardce682bc2004-11-05 17:22:25 +000031722#define gen_nb_xmlSchemaValidCtxtPtr 1
31723static xmlSchemaValidCtxtPtr gen_xmlSchemaValidCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31724 return(NULL);
31725}
31726static void des_xmlSchemaValidCtxtPtr(int no ATTRIBUTE_UNUSED, xmlSchemaValidCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31727}
Daniel Veillarda521d282004-11-09 14:59:59 +000031728#endif
31729
Daniel Veillardce682bc2004-11-05 17:22:25 +000031730
Daniel Veillardd93f6252004-11-02 15:53:51 +000031731static int
31732test_xmlSchemaGetValidErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031733 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031734
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000031735#ifdef LIBXML_SCHEMAS_ENABLED
31736 int mem_base;
31737 int ret_val;
31738 xmlSchemaValidCtxtPtr ctxt; /* a XML-Schema validation context */
31739 int n_ctxt;
31740 xmlSchemaValidityErrorFunc * err; /* the error function result */
31741 int n_err;
31742 xmlSchemaValidityWarningFunc * warn; /* the warning function result */
31743 int n_warn;
31744 void ** ctx; /* the functions context result */
31745 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031746
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000031747 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
31748 for (n_err = 0;n_err < gen_nb_xmlSchemaValidityErrorFunc_ptr;n_err++) {
31749 for (n_warn = 0;n_warn < gen_nb_xmlSchemaValidityWarningFunc_ptr;n_warn++) {
31750 for (n_ctx = 0;n_ctx < gen_nb_void_ptr_ptr;n_ctx++) {
31751 mem_base = xmlMemBlocks();
31752 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
31753 err = gen_xmlSchemaValidityErrorFunc_ptr(n_err, 1);
31754 warn = gen_xmlSchemaValidityWarningFunc_ptr(n_warn, 2);
31755 ctx = gen_void_ptr_ptr(n_ctx, 3);
31756
31757 ret_val = xmlSchemaGetValidErrors(ctxt, err, warn, ctx);
31758 desret_int(ret_val);
31759 call_tests++;
31760 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
31761 des_xmlSchemaValidityErrorFunc_ptr(n_err, err, 1);
31762 des_xmlSchemaValidityWarningFunc_ptr(n_warn, warn, 2);
31763 des_void_ptr_ptr(n_ctx, ctx, 3);
31764 xmlResetLastError();
31765 if (mem_base != xmlMemBlocks()) {
31766 printf("Leak of %d blocks found in xmlSchemaGetValidErrors",
31767 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031768 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000031769 printf(" %d", n_ctxt);
31770 printf(" %d", n_err);
31771 printf(" %d", n_warn);
31772 printf(" %d", n_ctx);
31773 printf("\n");
31774 }
31775 }
31776 }
31777 }
31778 }
31779#endif
31780
31781 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000031782 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031783}
31784
31785
31786static int
31787test_xmlSchemaNewDocParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031788 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031789
Daniel Veillard42595322004-11-08 10:52:06 +000031790#ifdef LIBXML_SCHEMAS_ENABLED
31791 int mem_base;
31792 xmlSchemaParserCtxtPtr ret_val;
31793 xmlDocPtr doc; /* a preparsed document tree */
31794 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031795
Daniel Veillard42595322004-11-08 10:52:06 +000031796 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
31797 mem_base = xmlMemBlocks();
31798 doc = gen_xmlDocPtr(n_doc, 0);
31799
31800 ret_val = xmlSchemaNewDocParserCtxt(doc);
31801 desret_xmlSchemaParserCtxtPtr(ret_val);
31802 call_tests++;
31803 des_xmlDocPtr(n_doc, doc, 0);
31804 xmlResetLastError();
31805 if (mem_base != xmlMemBlocks()) {
31806 printf("Leak of %d blocks found in xmlSchemaNewDocParserCtxt",
31807 xmlMemBlocks() - mem_base);
31808 test_ret++;
31809 printf(" %d", n_doc);
31810 printf("\n");
31811 }
31812 }
31813#endif
31814
31815 function_tests++;
31816 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031817}
31818
31819
31820static int
31821test_xmlSchemaNewMemParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031822 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031823
Daniel Veillard42595322004-11-08 10:52:06 +000031824#ifdef LIBXML_SCHEMAS_ENABLED
31825 int mem_base;
31826 xmlSchemaParserCtxtPtr ret_val;
31827 char * buffer; /* a pointer to a char array containing the schemas */
31828 int n_buffer;
31829 int size; /* the size of the array */
31830 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031831
Daniel Veillard42595322004-11-08 10:52:06 +000031832 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
31833 for (n_size = 0;n_size < gen_nb_int;n_size++) {
31834 mem_base = xmlMemBlocks();
31835 buffer = gen_const_char_ptr(n_buffer, 0);
31836 size = gen_int(n_size, 1);
31837
31838 ret_val = xmlSchemaNewMemParserCtxt(buffer, size);
31839 desret_xmlSchemaParserCtxtPtr(ret_val);
31840 call_tests++;
31841 des_const_char_ptr(n_buffer, buffer, 0);
31842 des_int(n_size, size, 1);
31843 xmlResetLastError();
31844 if (mem_base != xmlMemBlocks()) {
31845 printf("Leak of %d blocks found in xmlSchemaNewMemParserCtxt",
31846 xmlMemBlocks() - mem_base);
31847 test_ret++;
31848 printf(" %d", n_buffer);
31849 printf(" %d", n_size);
31850 printf("\n");
31851 }
31852 }
31853 }
31854#endif
31855
31856 function_tests++;
31857 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031858}
31859
31860
31861static int
31862test_xmlSchemaNewParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031863 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031864
Daniel Veillard42595322004-11-08 10:52:06 +000031865#ifdef LIBXML_SCHEMAS_ENABLED
31866 int mem_base;
31867 xmlSchemaParserCtxtPtr ret_val;
31868 char * URL; /* the location of the schema */
31869 int n_URL;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031870
Daniel Veillard42595322004-11-08 10:52:06 +000031871 for (n_URL = 0;n_URL < gen_nb_const_char_ptr;n_URL++) {
31872 mem_base = xmlMemBlocks();
31873 URL = gen_const_char_ptr(n_URL, 0);
31874
31875 ret_val = xmlSchemaNewParserCtxt(URL);
31876 desret_xmlSchemaParserCtxtPtr(ret_val);
31877 call_tests++;
31878 des_const_char_ptr(n_URL, URL, 0);
31879 xmlResetLastError();
31880 if (mem_base != xmlMemBlocks()) {
31881 printf("Leak of %d blocks found in xmlSchemaNewParserCtxt",
31882 xmlMemBlocks() - mem_base);
31883 test_ret++;
31884 printf(" %d", n_URL);
31885 printf("\n");
31886 }
31887 }
31888#endif
31889
31890 function_tests++;
31891 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031892}
31893
31894
31895static int
31896test_xmlSchemaNewValidCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031897 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031898
31899
31900 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031901 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031902}
31903
31904
31905static int
31906test_xmlSchemaParse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031907 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031908
31909
31910 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031911 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031912}
31913
31914
31915static int
31916test_xmlSchemaSetParserErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031917 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031918
31919
31920 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031921 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031922}
31923
31924
31925static int
31926test_xmlSchemaSetValidErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031927 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031928
31929
31930 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031931 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031932}
31933
31934
31935static int
31936test_xmlSchemaSetValidOptions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031937 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031938
Daniel Veillardce682bc2004-11-05 17:22:25 +000031939#ifdef LIBXML_SCHEMAS_ENABLED
31940 int mem_base;
31941 int ret_val;
31942 xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */
31943 int n_ctxt;
31944 int options; /* a combination of xmlSchemaValidOption */
31945 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031946
Daniel Veillardce682bc2004-11-05 17:22:25 +000031947 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
31948 for (n_options = 0;n_options < gen_nb_int;n_options++) {
31949 mem_base = xmlMemBlocks();
31950 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
31951 options = gen_int(n_options, 1);
31952
31953 ret_val = xmlSchemaSetValidOptions(ctxt, options);
31954 desret_int(ret_val);
31955 call_tests++;
31956 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
31957 des_int(n_options, options, 1);
31958 xmlResetLastError();
31959 if (mem_base != xmlMemBlocks()) {
31960 printf("Leak of %d blocks found in xmlSchemaSetValidOptions",
31961 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031962 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031963 printf(" %d", n_ctxt);
31964 printf(" %d", n_options);
31965 printf("\n");
31966 }
31967 }
31968 }
31969#endif
31970
31971 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000031972 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031973}
31974
31975
31976static int
31977test_xmlSchemaValidCtxtGetOptions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031978 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031979
Daniel Veillardce682bc2004-11-05 17:22:25 +000031980#ifdef LIBXML_SCHEMAS_ENABLED
31981 int mem_base;
31982 int ret_val;
31983 xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */
31984 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031985
Daniel Veillardce682bc2004-11-05 17:22:25 +000031986 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
31987 mem_base = xmlMemBlocks();
31988 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
31989
31990 ret_val = xmlSchemaValidCtxtGetOptions(ctxt);
31991 desret_int(ret_val);
31992 call_tests++;
31993 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
31994 xmlResetLastError();
31995 if (mem_base != xmlMemBlocks()) {
31996 printf("Leak of %d blocks found in xmlSchemaValidCtxtGetOptions",
31997 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031998 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031999 printf(" %d", n_ctxt);
32000 printf("\n");
32001 }
32002 }
32003#endif
32004
32005 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032006 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032007}
32008
32009
32010static int
32011test_xmlSchemaValidateDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032012 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032013
Daniel Veillardce682bc2004-11-05 17:22:25 +000032014#ifdef LIBXML_SCHEMAS_ENABLED
32015 int mem_base;
32016 int ret_val;
32017 xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */
32018 int n_ctxt;
32019 xmlDocPtr doc; /* a parsed document tree */
32020 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032021
Daniel Veillardce682bc2004-11-05 17:22:25 +000032022 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
32023 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
32024 mem_base = xmlMemBlocks();
32025 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
32026 doc = gen_xmlDocPtr(n_doc, 1);
32027
32028 ret_val = xmlSchemaValidateDoc(ctxt, doc);
32029 desret_int(ret_val);
32030 call_tests++;
32031 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
32032 des_xmlDocPtr(n_doc, doc, 1);
32033 xmlResetLastError();
32034 if (mem_base != xmlMemBlocks()) {
32035 printf("Leak of %d blocks found in xmlSchemaValidateDoc",
32036 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032037 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032038 printf(" %d", n_ctxt);
32039 printf(" %d", n_doc);
32040 printf("\n");
32041 }
32042 }
32043 }
32044#endif
32045
32046 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032047 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032048}
32049
32050
32051static int
32052test_xmlSchemaValidateOneElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032053 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032054
Daniel Veillardce682bc2004-11-05 17:22:25 +000032055#ifdef LIBXML_SCHEMAS_ENABLED
32056 int mem_base;
32057 int ret_val;
32058 xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */
32059 int n_ctxt;
32060 xmlNodePtr elem; /* an element node */
32061 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032062
Daniel Veillardce682bc2004-11-05 17:22:25 +000032063 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
32064 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
32065 mem_base = xmlMemBlocks();
32066 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
32067 elem = gen_xmlNodePtr(n_elem, 1);
32068
32069 ret_val = xmlSchemaValidateOneElement(ctxt, elem);
32070 desret_int(ret_val);
32071 call_tests++;
32072 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
32073 des_xmlNodePtr(n_elem, elem, 1);
32074 xmlResetLastError();
32075 if (mem_base != xmlMemBlocks()) {
32076 printf("Leak of %d blocks found in xmlSchemaValidateOneElement",
32077 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032078 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032079 printf(" %d", n_ctxt);
32080 printf(" %d", n_elem);
32081 printf("\n");
32082 }
32083 }
32084 }
32085#endif
32086
32087 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032088 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032089}
32090
32091
32092static int
32093test_xmlSchemaValidateStream(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032094 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032095
Daniel Veillardce682bc2004-11-05 17:22:25 +000032096#ifdef LIBXML_SCHEMAS_ENABLED
32097 int mem_base;
32098 int ret_val;
32099 xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */
32100 int n_ctxt;
32101 xmlParserInputBufferPtr input; /* the input to use for reading the data */
32102 int n_input;
32103 xmlCharEncoding enc; /* an optional encoding information */
32104 int n_enc;
32105 xmlSAXHandlerPtr sax; /* a SAX handler for the resulting events */
32106 int n_sax;
32107 void * user_data; /* the context to provide to the SAX handler. */
32108 int n_user_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032109
Daniel Veillardce682bc2004-11-05 17:22:25 +000032110 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
32111 for (n_input = 0;n_input < gen_nb_xmlParserInputBufferPtr;n_input++) {
32112 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
32113 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
32114 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
32115 mem_base = xmlMemBlocks();
32116 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
32117 input = gen_xmlParserInputBufferPtr(n_input, 1);
32118 enc = gen_xmlCharEncoding(n_enc, 2);
32119 sax = gen_xmlSAXHandlerPtr(n_sax, 3);
32120 user_data = gen_userdata(n_user_data, 4);
32121
32122 ret_val = xmlSchemaValidateStream(ctxt, input, enc, sax, user_data);
32123 desret_int(ret_val);
32124 call_tests++;
32125 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
32126 des_xmlParserInputBufferPtr(n_input, input, 1);
32127 des_xmlCharEncoding(n_enc, enc, 2);
32128 des_xmlSAXHandlerPtr(n_sax, sax, 3);
32129 des_userdata(n_user_data, user_data, 4);
32130 xmlResetLastError();
32131 if (mem_base != xmlMemBlocks()) {
32132 printf("Leak of %d blocks found in xmlSchemaValidateStream",
32133 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032134 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032135 printf(" %d", n_ctxt);
32136 printf(" %d", n_input);
32137 printf(" %d", n_enc);
32138 printf(" %d", n_sax);
32139 printf(" %d", n_user_data);
32140 printf("\n");
32141 }
32142 }
32143 }
32144 }
32145 }
32146 }
32147#endif
32148
32149 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032150 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032151}
32152
32153static int
32154test_xmlschemas(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032155 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032156
Daniel Veillard42595322004-11-08 10:52:06 +000032157 printf("Testing xmlschemas : 11 of 18 functions ...\n");
32158 test_ret += test_xmlSchemaDump();
32159 test_ret += test_xmlSchemaGetParserErrors();
32160 test_ret += test_xmlSchemaGetValidErrors();
32161 test_ret += test_xmlSchemaNewDocParserCtxt();
32162 test_ret += test_xmlSchemaNewMemParserCtxt();
32163 test_ret += test_xmlSchemaNewParserCtxt();
32164 test_ret += test_xmlSchemaNewValidCtxt();
32165 test_ret += test_xmlSchemaParse();
32166 test_ret += test_xmlSchemaSetParserErrors();
32167 test_ret += test_xmlSchemaSetValidErrors();
32168 test_ret += test_xmlSchemaSetValidOptions();
32169 test_ret += test_xmlSchemaValidCtxtGetOptions();
32170 test_ret += test_xmlSchemaValidateDoc();
32171 test_ret += test_xmlSchemaValidateOneElement();
32172 test_ret += test_xmlSchemaValidateStream();
Daniel Veillardd93f6252004-11-02 15:53:51 +000032173
Daniel Veillard42595322004-11-08 10:52:06 +000032174 if (test_ret != 0)
32175 printf("Module xmlschemas: %d errors\n", test_ret);
32176 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032177}
Daniel Veillarda521d282004-11-09 14:59:59 +000032178#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000032179
Daniel Veillardce682bc2004-11-05 17:22:25 +000032180#define gen_nb_xmlSchemaFacetPtr 1
32181static xmlSchemaFacetPtr gen_xmlSchemaFacetPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32182 return(NULL);
32183}
32184static void des_xmlSchemaFacetPtr(int no ATTRIBUTE_UNUSED, xmlSchemaFacetPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32185}
Daniel Veillarda521d282004-11-09 14:59:59 +000032186#endif
32187
32188#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000032189
32190#define gen_nb_xmlSchemaTypePtr 1
32191static xmlSchemaTypePtr gen_xmlSchemaTypePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32192 return(NULL);
32193}
32194static void des_xmlSchemaTypePtr(int no ATTRIBUTE_UNUSED, xmlSchemaTypePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32195}
Daniel Veillarda521d282004-11-09 14:59:59 +000032196#endif
32197
Daniel Veillardce682bc2004-11-05 17:22:25 +000032198
Daniel Veillardd93f6252004-11-02 15:53:51 +000032199static int
32200test_xmlSchemaCheckFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032201 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032202
Daniel Veillardce682bc2004-11-05 17:22:25 +000032203#ifdef LIBXML_SCHEMAS_ENABLED
32204 int mem_base;
32205 int ret_val;
32206 xmlSchemaFacetPtr facet; /* the facet */
32207 int n_facet;
32208 xmlSchemaTypePtr typeDecl; /* the schema type definition */
32209 int n_typeDecl;
32210 xmlSchemaParserCtxtPtr ctxt; /* the schema parser context or NULL */
32211 int n_ctxt;
32212 xmlChar * name; /* name of the type */
32213 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032214
Daniel Veillardce682bc2004-11-05 17:22:25 +000032215 for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) {
32216 for (n_typeDecl = 0;n_typeDecl < gen_nb_xmlSchemaTypePtr;n_typeDecl++) {
32217 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaParserCtxtPtr;n_ctxt++) {
32218 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
32219 mem_base = xmlMemBlocks();
32220 facet = gen_xmlSchemaFacetPtr(n_facet, 0);
32221 typeDecl = gen_xmlSchemaTypePtr(n_typeDecl, 1);
32222 ctxt = gen_xmlSchemaParserCtxtPtr(n_ctxt, 2);
32223 name = gen_const_xmlChar_ptr(n_name, 3);
32224
32225 ret_val = xmlSchemaCheckFacet(facet, typeDecl, ctxt, name);
32226 desret_int(ret_val);
32227 call_tests++;
32228 des_xmlSchemaFacetPtr(n_facet, facet, 0);
32229 des_xmlSchemaTypePtr(n_typeDecl, typeDecl, 1);
32230 des_xmlSchemaParserCtxtPtr(n_ctxt, ctxt, 2);
32231 des_const_xmlChar_ptr(n_name, name, 3);
32232 xmlResetLastError();
32233 if (mem_base != xmlMemBlocks()) {
32234 printf("Leak of %d blocks found in xmlSchemaCheckFacet",
32235 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032236 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032237 printf(" %d", n_facet);
32238 printf(" %d", n_typeDecl);
32239 printf(" %d", n_ctxt);
32240 printf(" %d", n_name);
32241 printf("\n");
32242 }
32243 }
32244 }
32245 }
32246 }
32247#endif
32248
32249 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032250 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032251}
32252
32253
32254static int
32255test_xmlSchemaCleanupTypes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032256 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032257
32258#ifdef LIBXML_SCHEMAS_ENABLED
32259 int mem_base;
32260
32261 mem_base = xmlMemBlocks();
32262
32263 xmlSchemaCleanupTypes();
32264 call_tests++;
32265 xmlResetLastError();
32266 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000032267 printf("Leak of %d blocks found in xmlSchemaCleanupTypes",
Daniel Veillardd93f6252004-11-02 15:53:51 +000032268 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032269 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000032270 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000032271 }
32272#endif
32273
Daniel Veillard3d97e662004-11-04 10:49:00 +000032274 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032275 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032276}
32277
32278
32279static int
32280test_xmlSchemaCollapseString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032281 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032282
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032283#ifdef LIBXML_SCHEMAS_ENABLED
32284 int mem_base;
32285 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032286 xmlChar * value; /* a value */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032287 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032288
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032289 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
32290 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000032291 value = gen_const_xmlChar_ptr(n_value, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032292
32293 ret_val = xmlSchemaCollapseString(value);
32294 desret_xmlChar_ptr(ret_val);
32295 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000032296 des_const_xmlChar_ptr(n_value, value, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032297 xmlResetLastError();
32298 if (mem_base != xmlMemBlocks()) {
32299 printf("Leak of %d blocks found in xmlSchemaCollapseString",
32300 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032301 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032302 printf(" %d", n_value);
32303 printf("\n");
32304 }
32305 }
32306#endif
32307
Daniel Veillard3d97e662004-11-04 10:49:00 +000032308 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032309 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032310}
32311
Daniel Veillarda521d282004-11-09 14:59:59 +000032312#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000032313
Daniel Veillardce682bc2004-11-05 17:22:25 +000032314#define gen_nb_xmlSchemaValPtr 1
32315static xmlSchemaValPtr gen_xmlSchemaValPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32316 return(NULL);
32317}
32318static void des_xmlSchemaValPtr(int no ATTRIBUTE_UNUSED, xmlSchemaValPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32319}
Daniel Veillarda521d282004-11-09 14:59:59 +000032320#endif
32321
Daniel Veillardce682bc2004-11-05 17:22:25 +000032322
Daniel Veillardd93f6252004-11-02 15:53:51 +000032323static int
32324test_xmlSchemaCompareValues(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032325 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032326
Daniel Veillardce682bc2004-11-05 17:22:25 +000032327#ifdef LIBXML_SCHEMAS_ENABLED
32328 int mem_base;
32329 int ret_val;
32330 xmlSchemaValPtr x; /* a first value */
32331 int n_x;
32332 xmlSchemaValPtr y; /* a second value */
32333 int n_y;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032334
Daniel Veillardce682bc2004-11-05 17:22:25 +000032335 for (n_x = 0;n_x < gen_nb_xmlSchemaValPtr;n_x++) {
32336 for (n_y = 0;n_y < gen_nb_xmlSchemaValPtr;n_y++) {
32337 mem_base = xmlMemBlocks();
32338 x = gen_xmlSchemaValPtr(n_x, 0);
32339 y = gen_xmlSchemaValPtr(n_y, 1);
32340
32341 ret_val = xmlSchemaCompareValues(x, y);
32342 desret_int(ret_val);
32343 call_tests++;
32344 des_xmlSchemaValPtr(n_x, x, 0);
32345 des_xmlSchemaValPtr(n_y, y, 1);
32346 xmlResetLastError();
32347 if (mem_base != xmlMemBlocks()) {
32348 printf("Leak of %d blocks found in xmlSchemaCompareValues",
32349 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032350 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032351 printf(" %d", n_x);
32352 printf(" %d", n_y);
32353 printf("\n");
32354 }
32355 }
32356 }
32357#endif
32358
32359 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032360 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032361}
32362
32363
32364static int
32365test_xmlSchemaGetBuiltInListSimpleTypeItemType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032366 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032367
Daniel Veillard42595322004-11-08 10:52:06 +000032368#ifdef LIBXML_SCHEMAS_ENABLED
32369 int mem_base;
32370 xmlSchemaTypePtr ret_val;
32371 xmlSchemaTypePtr type; /* the built-in simple type. */
32372 int n_type;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032373
Daniel Veillard42595322004-11-08 10:52:06 +000032374 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
32375 mem_base = xmlMemBlocks();
32376 type = gen_xmlSchemaTypePtr(n_type, 0);
32377
32378 ret_val = xmlSchemaGetBuiltInListSimpleTypeItemType(type);
32379 desret_xmlSchemaTypePtr(ret_val);
32380 call_tests++;
32381 des_xmlSchemaTypePtr(n_type, type, 0);
32382 xmlResetLastError();
32383 if (mem_base != xmlMemBlocks()) {
32384 printf("Leak of %d blocks found in xmlSchemaGetBuiltInListSimpleTypeItemType",
32385 xmlMemBlocks() - mem_base);
32386 test_ret++;
32387 printf(" %d", n_type);
32388 printf("\n");
32389 }
32390 }
32391#endif
32392
32393 function_tests++;
32394 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032395}
32396
32397
32398static int
32399test_xmlSchemaGetBuiltInType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032400 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032401
Daniel Veillard42595322004-11-08 10:52:06 +000032402#ifdef LIBXML_SCHEMAS_ENABLED
32403 xmlSchemaTypePtr ret_val;
32404 xmlSchemaValType type; /* the type of the built in type */
32405 int n_type;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032406
Daniel Veillard42595322004-11-08 10:52:06 +000032407 for (n_type = 0;n_type < gen_nb_xmlSchemaValType;n_type++) {
32408 type = gen_xmlSchemaValType(n_type, 0);
32409
32410 ret_val = xmlSchemaGetBuiltInType(type);
32411 desret_xmlSchemaTypePtr(ret_val);
32412 call_tests++;
32413 des_xmlSchemaValType(n_type, type, 0);
32414 xmlResetLastError();
32415 }
32416#endif
32417
32418 function_tests++;
32419 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032420}
32421
32422
32423static int
32424test_xmlSchemaGetFacetValueAsULong(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032425 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032426
32427
32428 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000032429 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032430}
32431
32432
32433static int
32434test_xmlSchemaGetPredefinedType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032435 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032436
Daniel Veillard42595322004-11-08 10:52:06 +000032437#ifdef LIBXML_SCHEMAS_ENABLED
32438 int mem_base;
32439 xmlSchemaTypePtr ret_val;
32440 xmlChar * name; /* the type name */
32441 int n_name;
32442 xmlChar * ns; /* the URI of the namespace usually "http://www.w3.org/2001/XMLSchema" */
32443 int n_ns;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032444
Daniel Veillard42595322004-11-08 10:52:06 +000032445 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
32446 for (n_ns = 0;n_ns < gen_nb_const_xmlChar_ptr;n_ns++) {
32447 mem_base = xmlMemBlocks();
32448 name = gen_const_xmlChar_ptr(n_name, 0);
32449 ns = gen_const_xmlChar_ptr(n_ns, 1);
32450
32451 ret_val = xmlSchemaGetPredefinedType(name, ns);
32452 desret_xmlSchemaTypePtr(ret_val);
32453 call_tests++;
32454 des_const_xmlChar_ptr(n_name, name, 0);
32455 des_const_xmlChar_ptr(n_ns, ns, 1);
32456 xmlResetLastError();
32457 if (mem_base != xmlMemBlocks()) {
32458 printf("Leak of %d blocks found in xmlSchemaGetPredefinedType",
32459 xmlMemBlocks() - mem_base);
32460 test_ret++;
32461 printf(" %d", n_name);
32462 printf(" %d", n_ns);
32463 printf("\n");
32464 }
32465 }
32466 }
32467#endif
32468
32469 function_tests++;
32470 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032471}
32472
32473
32474static int
32475test_xmlSchemaInitTypes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032476 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032477
32478#ifdef LIBXML_SCHEMAS_ENABLED
32479
32480
32481 xmlSchemaInitTypes();
32482 call_tests++;
32483 xmlResetLastError();
32484#endif
32485
Daniel Veillard3d97e662004-11-04 10:49:00 +000032486 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032487 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032488}
32489
32490
32491static int
32492test_xmlSchemaIsBuiltInTypeFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032493 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032494
Daniel Veillardce682bc2004-11-05 17:22:25 +000032495#ifdef LIBXML_SCHEMAS_ENABLED
32496 int mem_base;
32497 int ret_val;
32498 xmlSchemaTypePtr type; /* the built-in type */
32499 int n_type;
32500 int facetType; /* the facet type */
32501 int n_facetType;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032502
Daniel Veillardce682bc2004-11-05 17:22:25 +000032503 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
32504 for (n_facetType = 0;n_facetType < gen_nb_int;n_facetType++) {
32505 mem_base = xmlMemBlocks();
32506 type = gen_xmlSchemaTypePtr(n_type, 0);
32507 facetType = gen_int(n_facetType, 1);
32508
32509 ret_val = xmlSchemaIsBuiltInTypeFacet(type, facetType);
32510 desret_int(ret_val);
32511 call_tests++;
32512 des_xmlSchemaTypePtr(n_type, type, 0);
32513 des_int(n_facetType, facetType, 1);
32514 xmlResetLastError();
32515 if (mem_base != xmlMemBlocks()) {
32516 printf("Leak of %d blocks found in xmlSchemaIsBuiltInTypeFacet",
32517 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032518 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032519 printf(" %d", n_type);
32520 printf(" %d", n_facetType);
32521 printf("\n");
32522 }
32523 }
32524 }
32525#endif
32526
32527 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032528 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032529}
32530
32531
32532static int
32533test_xmlSchemaNewFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032534 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032535
32536
32537 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000032538 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032539}
32540
Daniel Veillarda521d282004-11-09 14:59:59 +000032541#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000032542
Daniel Veillardce682bc2004-11-05 17:22:25 +000032543#define gen_nb_xmlSchemaValPtr_ptr 1
32544static xmlSchemaValPtr * gen_xmlSchemaValPtr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32545 return(NULL);
32546}
32547static void des_xmlSchemaValPtr_ptr(int no ATTRIBUTE_UNUSED, xmlSchemaValPtr * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32548}
Daniel Veillarda521d282004-11-09 14:59:59 +000032549#endif
32550
Daniel Veillardce682bc2004-11-05 17:22:25 +000032551
Daniel Veillardd93f6252004-11-02 15:53:51 +000032552static int
32553test_xmlSchemaValPredefTypeNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032554 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032555
Daniel Veillardce682bc2004-11-05 17:22:25 +000032556#ifdef LIBXML_SCHEMAS_ENABLED
32557 int mem_base;
32558 int ret_val;
32559 xmlSchemaTypePtr type; /* the predefined type */
32560 int n_type;
32561 xmlChar * value; /* the value to check */
32562 int n_value;
32563 xmlSchemaValPtr * val; /* the return computed value */
32564 int n_val;
32565 xmlNodePtr node; /* the node containing the value */
32566 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032567
Daniel Veillardce682bc2004-11-05 17:22:25 +000032568 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
32569 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
32570 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr_ptr;n_val++) {
32571 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
32572 mem_base = xmlMemBlocks();
32573 type = gen_xmlSchemaTypePtr(n_type, 0);
32574 value = gen_const_xmlChar_ptr(n_value, 1);
32575 val = gen_xmlSchemaValPtr_ptr(n_val, 2);
32576 node = gen_xmlNodePtr(n_node, 3);
32577
32578 ret_val = xmlSchemaValPredefTypeNode(type, value, val, node);
32579 desret_int(ret_val);
32580 call_tests++;
32581 des_xmlSchemaTypePtr(n_type, type, 0);
32582 des_const_xmlChar_ptr(n_value, value, 1);
32583 des_xmlSchemaValPtr_ptr(n_val, val, 2);
32584 des_xmlNodePtr(n_node, node, 3);
32585 xmlResetLastError();
32586 if (mem_base != xmlMemBlocks()) {
32587 printf("Leak of %d blocks found in xmlSchemaValPredefTypeNode",
32588 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032589 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032590 printf(" %d", n_type);
32591 printf(" %d", n_value);
32592 printf(" %d", n_val);
32593 printf(" %d", n_node);
32594 printf("\n");
32595 }
32596 }
32597 }
32598 }
32599 }
32600#endif
32601
32602 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032603 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032604}
32605
32606
32607static int
32608test_xmlSchemaValPredefTypeNodeNoNorm(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032609 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032610
Daniel Veillardce682bc2004-11-05 17:22:25 +000032611#ifdef LIBXML_SCHEMAS_ENABLED
32612 int mem_base;
32613 int ret_val;
32614 xmlSchemaTypePtr type; /* the predefined type */
32615 int n_type;
32616 xmlChar * value; /* the value to check */
32617 int n_value;
32618 xmlSchemaValPtr * val; /* the return computed value */
32619 int n_val;
32620 xmlNodePtr node; /* the node containing the value */
32621 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032622
Daniel Veillardce682bc2004-11-05 17:22:25 +000032623 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
32624 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
32625 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr_ptr;n_val++) {
32626 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
32627 mem_base = xmlMemBlocks();
32628 type = gen_xmlSchemaTypePtr(n_type, 0);
32629 value = gen_const_xmlChar_ptr(n_value, 1);
32630 val = gen_xmlSchemaValPtr_ptr(n_val, 2);
32631 node = gen_xmlNodePtr(n_node, 3);
32632
32633 ret_val = xmlSchemaValPredefTypeNodeNoNorm(type, value, val, node);
32634 desret_int(ret_val);
32635 call_tests++;
32636 des_xmlSchemaTypePtr(n_type, type, 0);
32637 des_const_xmlChar_ptr(n_value, value, 1);
32638 des_xmlSchemaValPtr_ptr(n_val, val, 2);
32639 des_xmlNodePtr(n_node, node, 3);
32640 xmlResetLastError();
32641 if (mem_base != xmlMemBlocks()) {
32642 printf("Leak of %d blocks found in xmlSchemaValPredefTypeNodeNoNorm",
32643 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032644 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032645 printf(" %d", n_type);
32646 printf(" %d", n_value);
32647 printf(" %d", n_val);
32648 printf(" %d", n_node);
32649 printf("\n");
32650 }
32651 }
32652 }
32653 }
32654 }
32655#endif
32656
32657 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032658 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032659}
32660
32661
32662static int
32663test_xmlSchemaValidateFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032664 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032665
Daniel Veillardce682bc2004-11-05 17:22:25 +000032666#ifdef LIBXML_SCHEMAS_ENABLED
32667 int mem_base;
32668 int ret_val;
32669 xmlSchemaTypePtr base; /* the base type */
32670 int n_base;
32671 xmlSchemaFacetPtr facet; /* the facet to check */
32672 int n_facet;
32673 xmlChar * value; /* the lexical repr of the value to validate */
32674 int n_value;
32675 xmlSchemaValPtr val; /* the precomputed value */
32676 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032677
Daniel Veillardce682bc2004-11-05 17:22:25 +000032678 for (n_base = 0;n_base < gen_nb_xmlSchemaTypePtr;n_base++) {
32679 for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) {
32680 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
32681 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr;n_val++) {
32682 mem_base = xmlMemBlocks();
32683 base = gen_xmlSchemaTypePtr(n_base, 0);
32684 facet = gen_xmlSchemaFacetPtr(n_facet, 1);
32685 value = gen_const_xmlChar_ptr(n_value, 2);
32686 val = gen_xmlSchemaValPtr(n_val, 3);
32687
32688 ret_val = xmlSchemaValidateFacet(base, facet, value, val);
32689 desret_int(ret_val);
32690 call_tests++;
32691 des_xmlSchemaTypePtr(n_base, base, 0);
32692 des_xmlSchemaFacetPtr(n_facet, facet, 1);
32693 des_const_xmlChar_ptr(n_value, value, 2);
32694 des_xmlSchemaValPtr(n_val, val, 3);
32695 xmlResetLastError();
32696 if (mem_base != xmlMemBlocks()) {
32697 printf("Leak of %d blocks found in xmlSchemaValidateFacet",
32698 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032699 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032700 printf(" %d", n_base);
32701 printf(" %d", n_facet);
32702 printf(" %d", n_value);
32703 printf(" %d", n_val);
32704 printf("\n");
32705 }
32706 }
32707 }
32708 }
32709 }
32710#endif
32711
32712 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032713 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032714}
32715
32716
32717static int
32718test_xmlSchemaValidateLengthFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032719 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032720
Daniel Veillardce682bc2004-11-05 17:22:25 +000032721#ifdef LIBXML_SCHEMAS_ENABLED
32722 int mem_base;
32723 int ret_val;
32724 xmlSchemaTypePtr type; /* the built-in type */
32725 int n_type;
32726 xmlSchemaFacetPtr facet; /* the facet to check */
32727 int n_facet;
32728 xmlChar * value; /* the lexical repr. of the value to be validated */
32729 int n_value;
32730 xmlSchemaValPtr val; /* the precomputed value */
32731 int n_val;
32732 unsigned long * length; /* the actual length of the value */
32733 int n_length;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032734
Daniel Veillardce682bc2004-11-05 17:22:25 +000032735 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
32736 for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) {
32737 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
32738 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr;n_val++) {
32739 for (n_length = 0;n_length < gen_nb_unsigned_long_ptr;n_length++) {
32740 mem_base = xmlMemBlocks();
32741 type = gen_xmlSchemaTypePtr(n_type, 0);
32742 facet = gen_xmlSchemaFacetPtr(n_facet, 1);
32743 value = gen_const_xmlChar_ptr(n_value, 2);
32744 val = gen_xmlSchemaValPtr(n_val, 3);
32745 length = gen_unsigned_long_ptr(n_length, 4);
32746
32747 ret_val = xmlSchemaValidateLengthFacet(type, facet, value, val, length);
32748 desret_int(ret_val);
32749 call_tests++;
32750 des_xmlSchemaTypePtr(n_type, type, 0);
32751 des_xmlSchemaFacetPtr(n_facet, facet, 1);
32752 des_const_xmlChar_ptr(n_value, value, 2);
32753 des_xmlSchemaValPtr(n_val, val, 3);
32754 des_unsigned_long_ptr(n_length, length, 4);
32755 xmlResetLastError();
32756 if (mem_base != xmlMemBlocks()) {
32757 printf("Leak of %d blocks found in xmlSchemaValidateLengthFacet",
32758 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032759 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032760 printf(" %d", n_type);
32761 printf(" %d", n_facet);
32762 printf(" %d", n_value);
32763 printf(" %d", n_val);
32764 printf(" %d", n_length);
32765 printf("\n");
32766 }
32767 }
32768 }
32769 }
32770 }
32771 }
32772#endif
32773
32774 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032775 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032776}
32777
32778
32779static int
32780test_xmlSchemaValidateListSimpleTypeFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032781 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032782
Daniel Veillardce682bc2004-11-05 17:22:25 +000032783#ifdef LIBXML_SCHEMAS_ENABLED
32784 int mem_base;
32785 int ret_val;
32786 xmlSchemaFacetPtr facet; /* the facet to check */
32787 int n_facet;
32788 xmlChar * value; /* the lexical repr of the value to validate */
32789 int n_value;
32790 unsigned long actualLen; /* the number of list items */
32791 int n_actualLen;
32792 unsigned long * expectedLen; /* the resulting expected number of list items */
32793 int n_expectedLen;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032794
Daniel Veillardce682bc2004-11-05 17:22:25 +000032795 for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) {
32796 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
32797 for (n_actualLen = 0;n_actualLen < gen_nb_unsigned_long;n_actualLen++) {
32798 for (n_expectedLen = 0;n_expectedLen < gen_nb_unsigned_long_ptr;n_expectedLen++) {
32799 mem_base = xmlMemBlocks();
32800 facet = gen_xmlSchemaFacetPtr(n_facet, 0);
32801 value = gen_const_xmlChar_ptr(n_value, 1);
32802 actualLen = gen_unsigned_long(n_actualLen, 2);
32803 expectedLen = gen_unsigned_long_ptr(n_expectedLen, 3);
32804
32805 ret_val = xmlSchemaValidateListSimpleTypeFacet(facet, value, actualLen, expectedLen);
32806 desret_int(ret_val);
32807 call_tests++;
32808 des_xmlSchemaFacetPtr(n_facet, facet, 0);
32809 des_const_xmlChar_ptr(n_value, value, 1);
32810 des_unsigned_long(n_actualLen, actualLen, 2);
32811 des_unsigned_long_ptr(n_expectedLen, expectedLen, 3);
32812 xmlResetLastError();
32813 if (mem_base != xmlMemBlocks()) {
32814 printf("Leak of %d blocks found in xmlSchemaValidateListSimpleTypeFacet",
32815 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032816 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032817 printf(" %d", n_facet);
32818 printf(" %d", n_value);
32819 printf(" %d", n_actualLen);
32820 printf(" %d", n_expectedLen);
32821 printf("\n");
32822 }
32823 }
32824 }
32825 }
32826 }
32827#endif
32828
32829 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032830 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032831}
32832
32833
32834static int
32835test_xmlSchemaValidatePredefinedType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032836 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032837
Daniel Veillardce682bc2004-11-05 17:22:25 +000032838#ifdef LIBXML_SCHEMAS_ENABLED
32839 int mem_base;
32840 int ret_val;
32841 xmlSchemaTypePtr type; /* the predefined type */
32842 int n_type;
32843 xmlChar * value; /* the value to check */
32844 int n_value;
32845 xmlSchemaValPtr * val; /* the return computed value */
32846 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032847
Daniel Veillardce682bc2004-11-05 17:22:25 +000032848 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
32849 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
32850 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr_ptr;n_val++) {
32851 mem_base = xmlMemBlocks();
32852 type = gen_xmlSchemaTypePtr(n_type, 0);
32853 value = gen_const_xmlChar_ptr(n_value, 1);
32854 val = gen_xmlSchemaValPtr_ptr(n_val, 2);
32855
32856 ret_val = xmlSchemaValidatePredefinedType(type, value, val);
32857 desret_int(ret_val);
32858 call_tests++;
32859 des_xmlSchemaTypePtr(n_type, type, 0);
32860 des_const_xmlChar_ptr(n_value, value, 1);
32861 des_xmlSchemaValPtr_ptr(n_val, val, 2);
32862 xmlResetLastError();
32863 if (mem_base != xmlMemBlocks()) {
32864 printf("Leak of %d blocks found in xmlSchemaValidatePredefinedType",
32865 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032866 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032867 printf(" %d", n_type);
32868 printf(" %d", n_value);
32869 printf(" %d", n_val);
32870 printf("\n");
32871 }
32872 }
32873 }
32874 }
32875#endif
32876
32877 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032878 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032879}
32880
32881static int
32882test_xmlschemastypes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032883 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032884
Daniel Veillard42595322004-11-08 10:52:06 +000032885 printf("Testing xmlschemastypes : 15 of 19 functions ...\n");
32886 test_ret += test_xmlSchemaCheckFacet();
32887 test_ret += test_xmlSchemaCleanupTypes();
32888 test_ret += test_xmlSchemaCollapseString();
32889 test_ret += test_xmlSchemaCompareValues();
32890 test_ret += test_xmlSchemaGetBuiltInListSimpleTypeItemType();
32891 test_ret += test_xmlSchemaGetBuiltInType();
32892 test_ret += test_xmlSchemaGetFacetValueAsULong();
32893 test_ret += test_xmlSchemaGetPredefinedType();
32894 test_ret += test_xmlSchemaInitTypes();
32895 test_ret += test_xmlSchemaIsBuiltInTypeFacet();
32896 test_ret += test_xmlSchemaNewFacet();
32897 test_ret += test_xmlSchemaValPredefTypeNode();
32898 test_ret += test_xmlSchemaValPredefTypeNodeNoNorm();
32899 test_ret += test_xmlSchemaValidateFacet();
32900 test_ret += test_xmlSchemaValidateLengthFacet();
32901 test_ret += test_xmlSchemaValidateListSimpleTypeFacet();
32902 test_ret += test_xmlSchemaValidatePredefinedType();
Daniel Veillardd93f6252004-11-02 15:53:51 +000032903
Daniel Veillard42595322004-11-08 10:52:06 +000032904 if (test_ret != 0)
32905 printf("Module xmlschemastypes: %d errors\n", test_ret);
32906 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032907}
32908
32909static int
32910test_xmlCharStrdup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032911 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032912
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032913 int mem_base;
32914 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032915 char * cur; /* the input char * */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032916 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032917
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032918 for (n_cur = 0;n_cur < gen_nb_const_char_ptr;n_cur++) {
32919 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000032920 cur = gen_const_char_ptr(n_cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032921
32922 ret_val = xmlCharStrdup(cur);
32923 desret_xmlChar_ptr(ret_val);
32924 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000032925 des_const_char_ptr(n_cur, cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032926 xmlResetLastError();
32927 if (mem_base != xmlMemBlocks()) {
32928 printf("Leak of %d blocks found in xmlCharStrdup",
32929 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032930 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032931 printf(" %d", n_cur);
32932 printf("\n");
32933 }
32934 }
32935
Daniel Veillard3d97e662004-11-04 10:49:00 +000032936 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032937 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032938}
32939
32940
32941static int
32942test_xmlCharStrndup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032943 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032944
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032945 int mem_base;
32946 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032947 char * cur; /* the input char * */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032948 int n_cur;
32949 int len; /* the len of @cur */
32950 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032951
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032952 for (n_cur = 0;n_cur < gen_nb_const_char_ptr;n_cur++) {
32953 for (n_len = 0;n_len < gen_nb_int;n_len++) {
32954 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000032955 cur = gen_const_char_ptr(n_cur, 0);
32956 len = gen_int(n_len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032957
32958 ret_val = xmlCharStrndup(cur, len);
32959 desret_xmlChar_ptr(ret_val);
32960 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000032961 des_const_char_ptr(n_cur, cur, 0);
32962 des_int(n_len, len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032963 xmlResetLastError();
32964 if (mem_base != xmlMemBlocks()) {
32965 printf("Leak of %d blocks found in xmlCharStrndup",
32966 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032967 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032968 printf(" %d", n_cur);
32969 printf(" %d", n_len);
32970 printf("\n");
32971 }
32972 }
32973 }
32974
Daniel Veillard3d97e662004-11-04 10:49:00 +000032975 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032976 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032977}
32978
32979
32980static int
32981test_xmlCheckUTF8(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032982 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032983
Daniel Veillardce682bc2004-11-05 17:22:25 +000032984 int mem_base;
32985 int ret_val;
32986 unsigned char * utf; /* Pointer to putative UTF-8 encoded string. */
32987 int n_utf;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032988
Daniel Veillardce682bc2004-11-05 17:22:25 +000032989 for (n_utf = 0;n_utf < gen_nb_const_unsigned_char_ptr;n_utf++) {
32990 mem_base = xmlMemBlocks();
32991 utf = gen_const_unsigned_char_ptr(n_utf, 0);
32992
32993 ret_val = xmlCheckUTF8(utf);
32994 desret_int(ret_val);
32995 call_tests++;
32996 des_const_unsigned_char_ptr(n_utf, utf, 0);
32997 xmlResetLastError();
32998 if (mem_base != xmlMemBlocks()) {
32999 printf("Leak of %d blocks found in xmlCheckUTF8",
33000 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033001 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033002 printf(" %d", n_utf);
33003 printf("\n");
33004 }
33005 }
33006
33007 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000033008 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033009}
33010
33011
33012static int
33013test_xmlGetUTF8Char(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033014 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033015
Daniel Veillardce682bc2004-11-05 17:22:25 +000033016 int mem_base;
33017 int ret_val;
33018 unsigned char * utf; /* a sequence of UTF-8 encoded bytes */
33019 int n_utf;
33020 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. */
33021 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033022
Daniel Veillardce682bc2004-11-05 17:22:25 +000033023 for (n_utf = 0;n_utf < gen_nb_const_unsigned_char_ptr;n_utf++) {
33024 for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
33025 mem_base = xmlMemBlocks();
33026 utf = gen_const_unsigned_char_ptr(n_utf, 0);
33027 len = gen_int_ptr(n_len, 1);
33028
33029 ret_val = xmlGetUTF8Char(utf, len);
33030 desret_int(ret_val);
33031 call_tests++;
33032 des_const_unsigned_char_ptr(n_utf, utf, 0);
33033 des_int_ptr(n_len, len, 1);
33034 xmlResetLastError();
33035 if (mem_base != xmlMemBlocks()) {
33036 printf("Leak of %d blocks found in xmlGetUTF8Char",
33037 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033038 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033039 printf(" %d", n_utf);
33040 printf(" %d", n_len);
33041 printf("\n");
33042 }
33043 }
33044 }
33045
33046 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000033047 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033048}
33049
33050
33051static int
33052test_xmlStrEqual(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033053 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033054
33055 int mem_base;
33056 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033057 xmlChar * str1; /* the first xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033058 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033059 xmlChar * str2; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033060 int n_str2;
33061
33062 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
33063 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
33064 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033065 str1 = gen_const_xmlChar_ptr(n_str1, 0);
33066 str2 = gen_const_xmlChar_ptr(n_str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033067
33068 ret_val = xmlStrEqual(str1, str2);
33069 desret_int(ret_val);
33070 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000033071 des_const_xmlChar_ptr(n_str1, str1, 0);
33072 des_const_xmlChar_ptr(n_str2, str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033073 xmlResetLastError();
33074 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033075 printf("Leak of %d blocks found in xmlStrEqual",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033076 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033077 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033078 printf(" %d", n_str1);
33079 printf(" %d", n_str2);
33080 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033081 }
33082 }
33083 }
33084
Daniel Veillard3d97e662004-11-04 10:49:00 +000033085 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000033086 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033087}
33088
33089
33090static int
33091test_xmlStrPrintf(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033092 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033093
33094
33095 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000033096 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033097}
33098
33099
33100static int
33101test_xmlStrQEqual(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033102 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033103
33104 int mem_base;
33105 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033106 xmlChar * pref; /* the prefix of the QName */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033107 int n_pref;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033108 xmlChar * name; /* the localname of the QName */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033109 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033110 xmlChar * str; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033111 int n_str;
33112
33113 for (n_pref = 0;n_pref < gen_nb_const_xmlChar_ptr;n_pref++) {
33114 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
33115 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
33116 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033117 pref = gen_const_xmlChar_ptr(n_pref, 0);
33118 name = gen_const_xmlChar_ptr(n_name, 1);
33119 str = gen_const_xmlChar_ptr(n_str, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033120
33121 ret_val = xmlStrQEqual(pref, name, str);
33122 desret_int(ret_val);
33123 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000033124 des_const_xmlChar_ptr(n_pref, pref, 0);
33125 des_const_xmlChar_ptr(n_name, name, 1);
33126 des_const_xmlChar_ptr(n_str, str, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033127 xmlResetLastError();
33128 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033129 printf("Leak of %d blocks found in xmlStrQEqual",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033130 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033131 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033132 printf(" %d", n_pref);
33133 printf(" %d", n_name);
33134 printf(" %d", n_str);
33135 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033136 }
33137 }
33138 }
33139 }
33140
Daniel Veillard3d97e662004-11-04 10:49:00 +000033141 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000033142 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033143}
33144
33145
33146static int
33147test_xmlStrVPrintf(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033148 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033149
33150
33151 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000033152 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033153}
33154
33155
33156static int
33157test_xmlStrcasecmp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033158 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033159
33160 int mem_base;
33161 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033162 xmlChar * str1; /* the first xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033163 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033164 xmlChar * str2; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033165 int n_str2;
33166
33167 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
33168 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
33169 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033170 str1 = gen_const_xmlChar_ptr(n_str1, 0);
33171 str2 = gen_const_xmlChar_ptr(n_str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033172
33173 ret_val = xmlStrcasecmp(str1, str2);
33174 desret_int(ret_val);
33175 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000033176 des_const_xmlChar_ptr(n_str1, str1, 0);
33177 des_const_xmlChar_ptr(n_str2, str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033178 xmlResetLastError();
33179 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033180 printf("Leak of %d blocks found in xmlStrcasecmp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033181 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033182 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033183 printf(" %d", n_str1);
33184 printf(" %d", n_str2);
33185 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033186 }
33187 }
33188 }
33189
Daniel Veillard3d97e662004-11-04 10:49:00 +000033190 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000033191 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033192}
33193
33194
33195static int
33196test_xmlStrcasestr(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033197 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033198
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033199 int mem_base;
33200 const xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033201 xmlChar * str; /* the xmlChar * array (haystack) */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033202 int n_str;
33203 xmlChar * val; /* the xmlChar to search (needle) */
33204 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033205
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033206 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
33207 for (n_val = 0;n_val < gen_nb_xmlChar_ptr;n_val++) {
33208 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033209 str = gen_const_xmlChar_ptr(n_str, 0);
33210 val = gen_xmlChar_ptr(n_val, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033211
33212 ret_val = xmlStrcasestr(str, val);
33213 desret_const_xmlChar_ptr(ret_val);
33214 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000033215 des_const_xmlChar_ptr(n_str, str, 0);
33216 des_xmlChar_ptr(n_val, val, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033217 xmlResetLastError();
33218 if (mem_base != xmlMemBlocks()) {
33219 printf("Leak of %d blocks found in xmlStrcasestr",
33220 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033221 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033222 printf(" %d", n_str);
33223 printf(" %d", n_val);
33224 printf("\n");
33225 }
33226 }
33227 }
33228
Daniel Veillard3d97e662004-11-04 10:49:00 +000033229 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000033230 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033231}
33232
33233
33234static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000033235test_xmlStrchr(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033236 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033237
Daniel Veillardf2a36f92004-11-08 17:55:01 +000033238 int mem_base;
33239 const xmlChar * ret_val;
33240 xmlChar * str; /* the xmlChar * array */
33241 int n_str;
33242 xmlChar val; /* the xmlChar to search */
33243 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033244
Daniel Veillardf2a36f92004-11-08 17:55:01 +000033245 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
33246 for (n_val = 0;n_val < gen_nb_xmlChar;n_val++) {
33247 mem_base = xmlMemBlocks();
33248 str = gen_const_xmlChar_ptr(n_str, 0);
33249 val = gen_xmlChar(n_val, 1);
33250
33251 ret_val = xmlStrchr(str, val);
33252 desret_const_xmlChar_ptr(ret_val);
33253 call_tests++;
33254 des_const_xmlChar_ptr(n_str, str, 0);
33255 des_xmlChar(n_val, val, 1);
33256 xmlResetLastError();
33257 if (mem_base != xmlMemBlocks()) {
33258 printf("Leak of %d blocks found in xmlStrchr",
33259 xmlMemBlocks() - mem_base);
33260 test_ret++;
33261 printf(" %d", n_str);
33262 printf(" %d", n_val);
33263 printf("\n");
33264 }
33265 }
33266 }
33267
33268 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000033269 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033270}
33271
33272
33273static int
33274test_xmlStrcmp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033275 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033276
33277 int mem_base;
33278 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033279 xmlChar * str1; /* the first xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033280 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033281 xmlChar * str2; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033282 int n_str2;
33283
33284 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
33285 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
33286 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033287 str1 = gen_const_xmlChar_ptr(n_str1, 0);
33288 str2 = gen_const_xmlChar_ptr(n_str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033289
33290 ret_val = xmlStrcmp(str1, str2);
33291 desret_int(ret_val);
33292 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000033293 des_const_xmlChar_ptr(n_str1, str1, 0);
33294 des_const_xmlChar_ptr(n_str2, str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033295 xmlResetLastError();
33296 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033297 printf("Leak of %d blocks found in xmlStrcmp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033298 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033299 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033300 printf(" %d", n_str1);
33301 printf(" %d", n_str2);
33302 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033303 }
33304 }
33305 }
33306
Daniel Veillard3d97e662004-11-04 10:49:00 +000033307 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000033308 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033309}
33310
33311
33312static int
33313test_xmlStrdup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033314 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033315
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033316 int mem_base;
33317 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033318 xmlChar * cur; /* the input xmlChar * */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033319 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033320
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033321 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
33322 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033323 cur = gen_const_xmlChar_ptr(n_cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033324
33325 ret_val = xmlStrdup(cur);
33326 desret_xmlChar_ptr(ret_val);
33327 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000033328 des_const_xmlChar_ptr(n_cur, cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033329 xmlResetLastError();
33330 if (mem_base != xmlMemBlocks()) {
33331 printf("Leak of %d blocks found in xmlStrdup",
33332 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033333 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033334 printf(" %d", n_cur);
33335 printf("\n");
33336 }
33337 }
33338
Daniel Veillard3d97e662004-11-04 10:49:00 +000033339 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000033340 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033341}
33342
33343
33344static int
33345test_xmlStrlen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033346 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033347
33348 int mem_base;
33349 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033350 xmlChar * str; /* the xmlChar * array */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033351 int n_str;
33352
33353 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
33354 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033355 str = gen_const_xmlChar_ptr(n_str, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033356
33357 ret_val = xmlStrlen(str);
33358 desret_int(ret_val);
33359 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000033360 des_const_xmlChar_ptr(n_str, str, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033361 xmlResetLastError();
33362 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033363 printf("Leak of %d blocks found in xmlStrlen",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033364 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033365 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033366 printf(" %d", n_str);
33367 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033368 }
33369 }
33370
Daniel Veillard3d97e662004-11-04 10:49:00 +000033371 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000033372 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033373}
33374
33375
33376static int
33377test_xmlStrncasecmp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033378 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033379
33380 int mem_base;
33381 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033382 xmlChar * str1; /* the first xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033383 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033384 xmlChar * str2; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033385 int n_str2;
33386 int len; /* the max comparison length */
33387 int n_len;
33388
33389 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
33390 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
33391 for (n_len = 0;n_len < gen_nb_int;n_len++) {
33392 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033393 str1 = gen_const_xmlChar_ptr(n_str1, 0);
33394 str2 = gen_const_xmlChar_ptr(n_str2, 1);
33395 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033396
33397 ret_val = xmlStrncasecmp(str1, str2, len);
33398 desret_int(ret_val);
33399 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000033400 des_const_xmlChar_ptr(n_str1, str1, 0);
33401 des_const_xmlChar_ptr(n_str2, str2, 1);
33402 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033403 xmlResetLastError();
33404 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033405 printf("Leak of %d blocks found in xmlStrncasecmp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033406 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033407 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033408 printf(" %d", n_str1);
33409 printf(" %d", n_str2);
33410 printf(" %d", n_len);
33411 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033412 }
33413 }
33414 }
33415 }
33416
Daniel Veillard3d97e662004-11-04 10:49:00 +000033417 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000033418 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033419}
33420
33421
33422static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000033423test_xmlStrncatNew(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033424 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033425
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033426 int mem_base;
33427 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033428 xmlChar * str1; /* first xmlChar string */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033429 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033430 xmlChar * str2; /* second xmlChar string */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033431 int n_str2;
33432 int len; /* the len of @str2 */
33433 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033434
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033435 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
33436 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
33437 for (n_len = 0;n_len < gen_nb_int;n_len++) {
33438 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033439 str1 = gen_const_xmlChar_ptr(n_str1, 0);
33440 str2 = gen_const_xmlChar_ptr(n_str2, 1);
33441 len = gen_int(n_len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033442
33443 ret_val = xmlStrncatNew(str1, str2, len);
33444 desret_xmlChar_ptr(ret_val);
33445 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000033446 des_const_xmlChar_ptr(n_str1, str1, 0);
33447 des_const_xmlChar_ptr(n_str2, str2, 1);
33448 des_int(n_len, len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033449 xmlResetLastError();
33450 if (mem_base != xmlMemBlocks()) {
33451 printf("Leak of %d blocks found in xmlStrncatNew",
33452 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033453 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033454 printf(" %d", n_str1);
33455 printf(" %d", n_str2);
33456 printf(" %d", n_len);
33457 printf("\n");
33458 }
33459 }
33460 }
33461 }
33462
Daniel Veillard3d97e662004-11-04 10:49:00 +000033463 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000033464 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033465}
33466
33467
33468static int
33469test_xmlStrncmp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033470 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033471
33472 int mem_base;
33473 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033474 xmlChar * str1; /* the first xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033475 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033476 xmlChar * str2; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033477 int n_str2;
33478 int len; /* the max comparison length */
33479 int n_len;
33480
33481 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
33482 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
33483 for (n_len = 0;n_len < gen_nb_int;n_len++) {
33484 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033485 str1 = gen_const_xmlChar_ptr(n_str1, 0);
33486 str2 = gen_const_xmlChar_ptr(n_str2, 1);
33487 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033488
33489 ret_val = xmlStrncmp(str1, str2, len);
33490 desret_int(ret_val);
33491 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000033492 des_const_xmlChar_ptr(n_str1, str1, 0);
33493 des_const_xmlChar_ptr(n_str2, str2, 1);
33494 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033495 xmlResetLastError();
33496 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033497 printf("Leak of %d blocks found in xmlStrncmp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033498 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033499 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033500 printf(" %d", n_str1);
33501 printf(" %d", n_str2);
33502 printf(" %d", n_len);
33503 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033504 }
33505 }
33506 }
33507 }
33508
Daniel Veillard3d97e662004-11-04 10:49:00 +000033509 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000033510 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033511}
33512
33513
33514static int
33515test_xmlStrndup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033516 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033517
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033518 int mem_base;
33519 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033520 xmlChar * cur; /* the input xmlChar * */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033521 int n_cur;
33522 int len; /* the len of @cur */
33523 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033524
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033525 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
33526 for (n_len = 0;n_len < gen_nb_int;n_len++) {
33527 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033528 cur = gen_const_xmlChar_ptr(n_cur, 0);
33529 len = gen_int(n_len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033530
33531 ret_val = xmlStrndup(cur, len);
33532 desret_xmlChar_ptr(ret_val);
33533 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000033534 des_const_xmlChar_ptr(n_cur, cur, 0);
33535 des_int(n_len, len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033536 xmlResetLastError();
33537 if (mem_base != xmlMemBlocks()) {
33538 printf("Leak of %d blocks found in xmlStrndup",
33539 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033540 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033541 printf(" %d", n_cur);
33542 printf(" %d", n_len);
33543 printf("\n");
33544 }
33545 }
33546 }
33547
Daniel Veillard3d97e662004-11-04 10:49:00 +000033548 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000033549 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033550}
33551
33552
33553static int
33554test_xmlStrstr(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033555 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033556
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033557 int mem_base;
33558 const xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033559 xmlChar * str; /* the xmlChar * array (haystack) */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033560 int n_str;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033561 xmlChar * val; /* the xmlChar to search (needle) */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033562 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033563
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033564 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
33565 for (n_val = 0;n_val < gen_nb_const_xmlChar_ptr;n_val++) {
33566 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033567 str = gen_const_xmlChar_ptr(n_str, 0);
33568 val = gen_const_xmlChar_ptr(n_val, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033569
33570 ret_val = xmlStrstr(str, val);
33571 desret_const_xmlChar_ptr(ret_val);
33572 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000033573 des_const_xmlChar_ptr(n_str, str, 0);
33574 des_const_xmlChar_ptr(n_val, val, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033575 xmlResetLastError();
33576 if (mem_base != xmlMemBlocks()) {
33577 printf("Leak of %d blocks found in xmlStrstr",
33578 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033579 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033580 printf(" %d", n_str);
33581 printf(" %d", n_val);
33582 printf("\n");
33583 }
33584 }
33585 }
33586
Daniel Veillard3d97e662004-11-04 10:49:00 +000033587 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000033588 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033589}
33590
33591
33592static int
33593test_xmlStrsub(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033594 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033595
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033596 int mem_base;
33597 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033598 xmlChar * str; /* the xmlChar * array (haystack) */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033599 int n_str;
33600 int start; /* the index of the first char (zero based) */
33601 int n_start;
33602 int len; /* the length of the substring */
33603 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033604
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033605 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
33606 for (n_start = 0;n_start < gen_nb_int;n_start++) {
33607 for (n_len = 0;n_len < gen_nb_int;n_len++) {
33608 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033609 str = gen_const_xmlChar_ptr(n_str, 0);
33610 start = gen_int(n_start, 1);
33611 len = gen_int(n_len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033612
33613 ret_val = xmlStrsub(str, start, len);
33614 desret_xmlChar_ptr(ret_val);
33615 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000033616 des_const_xmlChar_ptr(n_str, str, 0);
33617 des_int(n_start, start, 1);
33618 des_int(n_len, len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033619 xmlResetLastError();
33620 if (mem_base != xmlMemBlocks()) {
33621 printf("Leak of %d blocks found in xmlStrsub",
33622 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033623 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033624 printf(" %d", n_str);
33625 printf(" %d", n_start);
33626 printf(" %d", n_len);
33627 printf("\n");
33628 }
33629 }
33630 }
33631 }
33632
Daniel Veillard3d97e662004-11-04 10:49:00 +000033633 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000033634 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033635}
33636
33637
33638static int
33639test_xmlUTF8Charcmp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033640 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033641
33642 int mem_base;
33643 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033644 xmlChar * utf1; /* pointer to first UTF8 char */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033645 int n_utf1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033646 xmlChar * utf2; /* pointer to second UTF8 char */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033647 int n_utf2;
33648
33649 for (n_utf1 = 0;n_utf1 < gen_nb_const_xmlChar_ptr;n_utf1++) {
33650 for (n_utf2 = 0;n_utf2 < gen_nb_const_xmlChar_ptr;n_utf2++) {
33651 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033652 utf1 = gen_const_xmlChar_ptr(n_utf1, 0);
33653 utf2 = gen_const_xmlChar_ptr(n_utf2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033654
33655 ret_val = xmlUTF8Charcmp(utf1, utf2);
33656 desret_int(ret_val);
33657 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000033658 des_const_xmlChar_ptr(n_utf1, utf1, 0);
33659 des_const_xmlChar_ptr(n_utf2, utf2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033660 xmlResetLastError();
33661 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033662 printf("Leak of %d blocks found in xmlUTF8Charcmp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033663 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033664 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033665 printf(" %d", n_utf1);
33666 printf(" %d", n_utf2);
33667 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033668 }
33669 }
33670 }
33671
Daniel Veillard3d97e662004-11-04 10:49:00 +000033672 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000033673 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033674}
33675
33676
33677static int
33678test_xmlUTF8Size(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033679 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033680
33681 int mem_base;
33682 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033683 xmlChar * utf; /* pointer to the UTF8 character */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033684 int n_utf;
33685
33686 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
33687 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033688 utf = gen_const_xmlChar_ptr(n_utf, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033689
33690 ret_val = xmlUTF8Size(utf);
33691 desret_int(ret_val);
33692 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000033693 des_const_xmlChar_ptr(n_utf, utf, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033694 xmlResetLastError();
33695 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033696 printf("Leak of %d blocks found in xmlUTF8Size",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033697 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033698 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033699 printf(" %d", n_utf);
33700 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033701 }
33702 }
33703
Daniel Veillard3d97e662004-11-04 10:49:00 +000033704 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000033705 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033706}
33707
33708
33709static int
33710test_xmlUTF8Strlen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033711 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033712
33713 int mem_base;
33714 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033715 xmlChar * utf; /* a sequence of UTF-8 encoded bytes */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033716 int n_utf;
33717
33718 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
33719 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033720 utf = gen_const_xmlChar_ptr(n_utf, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033721
33722 ret_val = xmlUTF8Strlen(utf);
33723 desret_int(ret_val);
33724 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000033725 des_const_xmlChar_ptr(n_utf, utf, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033726 xmlResetLastError();
33727 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033728 printf("Leak of %d blocks found in xmlUTF8Strlen",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033729 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033730 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033731 printf(" %d", n_utf);
33732 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033733 }
33734 }
33735
Daniel Veillard3d97e662004-11-04 10:49:00 +000033736 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000033737 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033738}
33739
33740
33741static int
33742test_xmlUTF8Strloc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033743 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033744
33745 int mem_base;
33746 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033747 xmlChar * utf; /* the input UTF8 * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033748 int n_utf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033749 xmlChar * utfchar; /* the UTF8 character to be found */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033750 int n_utfchar;
33751
33752 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
33753 for (n_utfchar = 0;n_utfchar < gen_nb_const_xmlChar_ptr;n_utfchar++) {
33754 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033755 utf = gen_const_xmlChar_ptr(n_utf, 0);
33756 utfchar = gen_const_xmlChar_ptr(n_utfchar, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033757
33758 ret_val = xmlUTF8Strloc(utf, utfchar);
33759 desret_int(ret_val);
33760 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000033761 des_const_xmlChar_ptr(n_utf, utf, 0);
33762 des_const_xmlChar_ptr(n_utfchar, utfchar, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033763 xmlResetLastError();
33764 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033765 printf("Leak of %d blocks found in xmlUTF8Strloc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033766 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033767 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033768 printf(" %d", n_utf);
33769 printf(" %d", n_utfchar);
33770 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033771 }
33772 }
33773 }
33774
Daniel Veillard3d97e662004-11-04 10:49:00 +000033775 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000033776 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033777}
33778
33779
33780static int
33781test_xmlUTF8Strndup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033782 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033783
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033784 int mem_base;
33785 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033786 xmlChar * utf; /* the input UTF8 * */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033787 int n_utf;
33788 int len; /* the len of @utf (in chars) */
33789 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033790
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033791 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
33792 for (n_len = 0;n_len < gen_nb_int;n_len++) {
33793 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033794 utf = gen_const_xmlChar_ptr(n_utf, 0);
33795 len = gen_int(n_len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033796
33797 ret_val = xmlUTF8Strndup(utf, len);
33798 desret_xmlChar_ptr(ret_val);
33799 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000033800 des_const_xmlChar_ptr(n_utf, utf, 0);
33801 des_int(n_len, len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033802 xmlResetLastError();
33803 if (mem_base != xmlMemBlocks()) {
33804 printf("Leak of %d blocks found in xmlUTF8Strndup",
33805 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033806 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033807 printf(" %d", n_utf);
33808 printf(" %d", n_len);
33809 printf("\n");
33810 }
33811 }
33812 }
33813
Daniel Veillard3d97e662004-11-04 10:49:00 +000033814 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000033815 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033816}
33817
33818
33819static int
33820test_xmlUTF8Strpos(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033821 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033822
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033823 int mem_base;
33824 const xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033825 xmlChar * utf; /* the input UTF8 * */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033826 int n_utf;
33827 int pos; /* the position of the desired UTF8 char (in chars) */
33828 int n_pos;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033829
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033830 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
33831 for (n_pos = 0;n_pos < gen_nb_int;n_pos++) {
33832 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033833 utf = gen_const_xmlChar_ptr(n_utf, 0);
33834 pos = gen_int(n_pos, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033835
33836 ret_val = xmlUTF8Strpos(utf, pos);
33837 desret_const_xmlChar_ptr(ret_val);
33838 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000033839 des_const_xmlChar_ptr(n_utf, utf, 0);
33840 des_int(n_pos, pos, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033841 xmlResetLastError();
33842 if (mem_base != xmlMemBlocks()) {
33843 printf("Leak of %d blocks found in xmlUTF8Strpos",
33844 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033845 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033846 printf(" %d", n_utf);
33847 printf(" %d", n_pos);
33848 printf("\n");
33849 }
33850 }
33851 }
33852
Daniel Veillard3d97e662004-11-04 10:49:00 +000033853 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000033854 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033855}
33856
33857
33858static int
33859test_xmlUTF8Strsize(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033860 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033861
33862 int mem_base;
33863 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033864 xmlChar * utf; /* a sequence of UTF-8 encoded bytes */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033865 int n_utf;
33866 int len; /* the number of characters in the array */
33867 int n_len;
33868
33869 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
33870 for (n_len = 0;n_len < gen_nb_int;n_len++) {
33871 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033872 utf = gen_const_xmlChar_ptr(n_utf, 0);
33873 len = gen_int(n_len, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033874
33875 ret_val = xmlUTF8Strsize(utf, len);
33876 desret_int(ret_val);
33877 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000033878 des_const_xmlChar_ptr(n_utf, utf, 0);
33879 des_int(n_len, len, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033880 xmlResetLastError();
33881 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033882 printf("Leak of %d blocks found in xmlUTF8Strsize",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033883 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033884 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033885 printf(" %d", n_utf);
33886 printf(" %d", n_len);
33887 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033888 }
33889 }
33890 }
33891
Daniel Veillard3d97e662004-11-04 10:49:00 +000033892 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000033893 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033894}
33895
33896
33897static int
33898test_xmlUTF8Strsub(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033899 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033900
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033901 int mem_base;
33902 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033903 xmlChar * utf; /* a sequence of UTF-8 encoded bytes */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033904 int n_utf;
33905 int start; /* relative pos of first char */
33906 int n_start;
33907 int len; /* total number to copy */
33908 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033909
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033910 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
33911 for (n_start = 0;n_start < gen_nb_int;n_start++) {
33912 for (n_len = 0;n_len < gen_nb_int;n_len++) {
33913 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033914 utf = gen_const_xmlChar_ptr(n_utf, 0);
33915 start = gen_int(n_start, 1);
33916 len = gen_int(n_len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033917
33918 ret_val = xmlUTF8Strsub(utf, start, len);
33919 desret_xmlChar_ptr(ret_val);
33920 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000033921 des_const_xmlChar_ptr(n_utf, utf, 0);
33922 des_int(n_start, start, 1);
33923 des_int(n_len, len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033924 xmlResetLastError();
33925 if (mem_base != xmlMemBlocks()) {
33926 printf("Leak of %d blocks found in xmlUTF8Strsub",
33927 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033928 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033929 printf(" %d", n_utf);
33930 printf(" %d", n_start);
33931 printf(" %d", n_len);
33932 printf("\n");
33933 }
33934 }
33935 }
33936 }
33937
Daniel Veillard3d97e662004-11-04 10:49:00 +000033938 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000033939 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033940}
33941
33942static int
33943test_xmlstring(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033944 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033945
Daniel Veillardf2a36f92004-11-08 17:55:01 +000033946 printf("Testing xmlstring : 26 of 30 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000033947 test_ret += test_xmlCharStrdup();
33948 test_ret += test_xmlCharStrndup();
33949 test_ret += test_xmlCheckUTF8();
33950 test_ret += test_xmlGetUTF8Char();
33951 test_ret += test_xmlStrEqual();
33952 test_ret += test_xmlStrPrintf();
33953 test_ret += test_xmlStrQEqual();
33954 test_ret += test_xmlStrVPrintf();
33955 test_ret += test_xmlStrcasecmp();
33956 test_ret += test_xmlStrcasestr();
33957 test_ret += test_xmlStrchr();
33958 test_ret += test_xmlStrcmp();
33959 test_ret += test_xmlStrdup();
33960 test_ret += test_xmlStrlen();
33961 test_ret += test_xmlStrncasecmp();
33962 test_ret += test_xmlStrncatNew();
33963 test_ret += test_xmlStrncmp();
33964 test_ret += test_xmlStrndup();
33965 test_ret += test_xmlStrstr();
33966 test_ret += test_xmlStrsub();
33967 test_ret += test_xmlUTF8Charcmp();
33968 test_ret += test_xmlUTF8Size();
33969 test_ret += test_xmlUTF8Strlen();
33970 test_ret += test_xmlUTF8Strloc();
33971 test_ret += test_xmlUTF8Strndup();
33972 test_ret += test_xmlUTF8Strpos();
33973 test_ret += test_xmlUTF8Strsize();
33974 test_ret += test_xmlUTF8Strsub();
Daniel Veillardd93f6252004-11-02 15:53:51 +000033975
Daniel Veillard42595322004-11-08 10:52:06 +000033976 if (test_ret != 0)
33977 printf("Module xmlstring: %d errors\n", test_ret);
33978 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033979}
33980
33981static int
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033982test_xmlUCSIsAegeanNumbers(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033983 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033984
33985#ifdef LIBXML_UNICODE_ENABLED
33986 int mem_base;
33987 int ret_val;
33988 int code; /* UCS code point */
33989 int n_code;
33990
33991 for (n_code = 0;n_code < gen_nb_int;n_code++) {
33992 mem_base = xmlMemBlocks();
33993 code = gen_int(n_code, 0);
33994
33995 ret_val = xmlUCSIsAegeanNumbers(code);
33996 desret_int(ret_val);
33997 call_tests++;
33998 des_int(n_code, code, 0);
33999 xmlResetLastError();
34000 if (mem_base != xmlMemBlocks()) {
34001 printf("Leak of %d blocks found in xmlUCSIsAegeanNumbers",
34002 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034003 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034004 printf(" %d", n_code);
34005 printf("\n");
34006 }
34007 }
34008#endif
34009
34010 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000034011 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034012}
34013
34014
34015static int
34016test_xmlUCSIsAlphabeticPresentationForms(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034017 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034018
34019#ifdef LIBXML_UNICODE_ENABLED
34020 int mem_base;
34021 int ret_val;
34022 int code; /* UCS code point */
34023 int n_code;
34024
34025 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34026 mem_base = xmlMemBlocks();
34027 code = gen_int(n_code, 0);
34028
34029 ret_val = xmlUCSIsAlphabeticPresentationForms(code);
34030 desret_int(ret_val);
34031 call_tests++;
34032 des_int(n_code, code, 0);
34033 xmlResetLastError();
34034 if (mem_base != xmlMemBlocks()) {
34035 printf("Leak of %d blocks found in xmlUCSIsAlphabeticPresentationForms",
34036 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034037 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034038 printf(" %d", n_code);
34039 printf("\n");
34040 }
34041 }
34042#endif
34043
34044 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000034045 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034046}
34047
34048
34049static int
34050test_xmlUCSIsArabic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034051 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034052
34053#ifdef LIBXML_UNICODE_ENABLED
34054 int mem_base;
34055 int ret_val;
34056 int code; /* UCS code point */
34057 int n_code;
34058
34059 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34060 mem_base = xmlMemBlocks();
34061 code = gen_int(n_code, 0);
34062
34063 ret_val = xmlUCSIsArabic(code);
34064 desret_int(ret_val);
34065 call_tests++;
34066 des_int(n_code, code, 0);
34067 xmlResetLastError();
34068 if (mem_base != xmlMemBlocks()) {
34069 printf("Leak of %d blocks found in xmlUCSIsArabic",
34070 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034071 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034072 printf(" %d", n_code);
34073 printf("\n");
34074 }
34075 }
34076#endif
34077
34078 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000034079 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034080}
34081
34082
34083static int
34084test_xmlUCSIsArabicPresentationFormsA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034085 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034086
34087#ifdef LIBXML_UNICODE_ENABLED
34088 int mem_base;
34089 int ret_val;
34090 int code; /* UCS code point */
34091 int n_code;
34092
34093 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34094 mem_base = xmlMemBlocks();
34095 code = gen_int(n_code, 0);
34096
34097 ret_val = xmlUCSIsArabicPresentationFormsA(code);
34098 desret_int(ret_val);
34099 call_tests++;
34100 des_int(n_code, code, 0);
34101 xmlResetLastError();
34102 if (mem_base != xmlMemBlocks()) {
34103 printf("Leak of %d blocks found in xmlUCSIsArabicPresentationFormsA",
34104 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034105 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034106 printf(" %d", n_code);
34107 printf("\n");
34108 }
34109 }
34110#endif
34111
34112 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000034113 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034114}
34115
34116
34117static int
34118test_xmlUCSIsArabicPresentationFormsB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034119 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034120
34121#ifdef LIBXML_UNICODE_ENABLED
34122 int mem_base;
34123 int ret_val;
34124 int code; /* UCS code point */
34125 int n_code;
34126
34127 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34128 mem_base = xmlMemBlocks();
34129 code = gen_int(n_code, 0);
34130
34131 ret_val = xmlUCSIsArabicPresentationFormsB(code);
34132 desret_int(ret_val);
34133 call_tests++;
34134 des_int(n_code, code, 0);
34135 xmlResetLastError();
34136 if (mem_base != xmlMemBlocks()) {
34137 printf("Leak of %d blocks found in xmlUCSIsArabicPresentationFormsB",
34138 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034139 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034140 printf(" %d", n_code);
34141 printf("\n");
34142 }
34143 }
34144#endif
34145
34146 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000034147 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034148}
34149
34150
34151static int
34152test_xmlUCSIsArmenian(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034153 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034154
34155#ifdef LIBXML_UNICODE_ENABLED
34156 int mem_base;
34157 int ret_val;
34158 int code; /* UCS code point */
34159 int n_code;
34160
34161 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34162 mem_base = xmlMemBlocks();
34163 code = gen_int(n_code, 0);
34164
34165 ret_val = xmlUCSIsArmenian(code);
34166 desret_int(ret_val);
34167 call_tests++;
34168 des_int(n_code, code, 0);
34169 xmlResetLastError();
34170 if (mem_base != xmlMemBlocks()) {
34171 printf("Leak of %d blocks found in xmlUCSIsArmenian",
34172 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034173 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034174 printf(" %d", n_code);
34175 printf("\n");
34176 }
34177 }
34178#endif
34179
34180 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000034181 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034182}
34183
34184
34185static int
34186test_xmlUCSIsArrows(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034187 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034188
34189#ifdef LIBXML_UNICODE_ENABLED
34190 int mem_base;
34191 int ret_val;
34192 int code; /* UCS code point */
34193 int n_code;
34194
34195 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34196 mem_base = xmlMemBlocks();
34197 code = gen_int(n_code, 0);
34198
34199 ret_val = xmlUCSIsArrows(code);
34200 desret_int(ret_val);
34201 call_tests++;
34202 des_int(n_code, code, 0);
34203 xmlResetLastError();
34204 if (mem_base != xmlMemBlocks()) {
34205 printf("Leak of %d blocks found in xmlUCSIsArrows",
34206 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034207 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034208 printf(" %d", n_code);
34209 printf("\n");
34210 }
34211 }
34212#endif
34213
34214 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000034215 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034216}
34217
34218
34219static int
34220test_xmlUCSIsBasicLatin(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034221 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034222
34223#ifdef LIBXML_UNICODE_ENABLED
34224 int mem_base;
34225 int ret_val;
34226 int code; /* UCS code point */
34227 int n_code;
34228
34229 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34230 mem_base = xmlMemBlocks();
34231 code = gen_int(n_code, 0);
34232
34233 ret_val = xmlUCSIsBasicLatin(code);
34234 desret_int(ret_val);
34235 call_tests++;
34236 des_int(n_code, code, 0);
34237 xmlResetLastError();
34238 if (mem_base != xmlMemBlocks()) {
34239 printf("Leak of %d blocks found in xmlUCSIsBasicLatin",
34240 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034241 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034242 printf(" %d", n_code);
34243 printf("\n");
34244 }
34245 }
34246#endif
34247
34248 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000034249 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034250}
34251
34252
34253static int
34254test_xmlUCSIsBengali(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034255 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034256
34257#ifdef LIBXML_UNICODE_ENABLED
34258 int mem_base;
34259 int ret_val;
34260 int code; /* UCS code point */
34261 int n_code;
34262
34263 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34264 mem_base = xmlMemBlocks();
34265 code = gen_int(n_code, 0);
34266
34267 ret_val = xmlUCSIsBengali(code);
34268 desret_int(ret_val);
34269 call_tests++;
34270 des_int(n_code, code, 0);
34271 xmlResetLastError();
34272 if (mem_base != xmlMemBlocks()) {
34273 printf("Leak of %d blocks found in xmlUCSIsBengali",
34274 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034275 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034276 printf(" %d", n_code);
34277 printf("\n");
34278 }
34279 }
34280#endif
34281
34282 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000034283 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034284}
34285
34286
34287static int
34288test_xmlUCSIsBlock(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034289 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034290
34291#ifdef LIBXML_UNICODE_ENABLED
34292 int mem_base;
34293 int ret_val;
34294 int code; /* UCS code point */
34295 int n_code;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034296 char * block; /* UCS block name */
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034297 int n_block;
34298
34299 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34300 for (n_block = 0;n_block < gen_nb_const_char_ptr;n_block++) {
34301 mem_base = xmlMemBlocks();
34302 code = gen_int(n_code, 0);
34303 block = gen_const_char_ptr(n_block, 1);
34304
34305 ret_val = xmlUCSIsBlock(code, block);
34306 desret_int(ret_val);
34307 call_tests++;
34308 des_int(n_code, code, 0);
34309 des_const_char_ptr(n_block, block, 1);
34310 xmlResetLastError();
34311 if (mem_base != xmlMemBlocks()) {
34312 printf("Leak of %d blocks found in xmlUCSIsBlock",
34313 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034314 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034315 printf(" %d", n_code);
34316 printf(" %d", n_block);
34317 printf("\n");
34318 }
34319 }
34320 }
34321#endif
34322
34323 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000034324 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034325}
34326
34327
34328static int
34329test_xmlUCSIsBlockElements(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034330 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034331
34332#ifdef LIBXML_UNICODE_ENABLED
34333 int mem_base;
34334 int ret_val;
34335 int code; /* UCS code point */
34336 int n_code;
34337
34338 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34339 mem_base = xmlMemBlocks();
34340 code = gen_int(n_code, 0);
34341
34342 ret_val = xmlUCSIsBlockElements(code);
34343 desret_int(ret_val);
34344 call_tests++;
34345 des_int(n_code, code, 0);
34346 xmlResetLastError();
34347 if (mem_base != xmlMemBlocks()) {
34348 printf("Leak of %d blocks found in xmlUCSIsBlockElements",
34349 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034350 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034351 printf(" %d", n_code);
34352 printf("\n");
34353 }
34354 }
34355#endif
34356
34357 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000034358 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034359}
34360
34361
34362static int
34363test_xmlUCSIsBopomofo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034364 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034365
34366#ifdef LIBXML_UNICODE_ENABLED
34367 int mem_base;
34368 int ret_val;
34369 int code; /* UCS code point */
34370 int n_code;
34371
34372 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34373 mem_base = xmlMemBlocks();
34374 code = gen_int(n_code, 0);
34375
34376 ret_val = xmlUCSIsBopomofo(code);
34377 desret_int(ret_val);
34378 call_tests++;
34379 des_int(n_code, code, 0);
34380 xmlResetLastError();
34381 if (mem_base != xmlMemBlocks()) {
34382 printf("Leak of %d blocks found in xmlUCSIsBopomofo",
34383 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034384 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034385 printf(" %d", n_code);
34386 printf("\n");
34387 }
34388 }
34389#endif
34390
34391 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000034392 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034393}
34394
34395
34396static int
34397test_xmlUCSIsBopomofoExtended(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034398 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034399
34400#ifdef LIBXML_UNICODE_ENABLED
34401 int mem_base;
34402 int ret_val;
34403 int code; /* UCS code point */
34404 int n_code;
34405
34406 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34407 mem_base = xmlMemBlocks();
34408 code = gen_int(n_code, 0);
34409
34410 ret_val = xmlUCSIsBopomofoExtended(code);
34411 desret_int(ret_val);
34412 call_tests++;
34413 des_int(n_code, code, 0);
34414 xmlResetLastError();
34415 if (mem_base != xmlMemBlocks()) {
34416 printf("Leak of %d blocks found in xmlUCSIsBopomofoExtended",
34417 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034418 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034419 printf(" %d", n_code);
34420 printf("\n");
34421 }
34422 }
34423#endif
34424
34425 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000034426 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034427}
34428
34429
34430static int
34431test_xmlUCSIsBoxDrawing(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034432 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034433
34434#ifdef LIBXML_UNICODE_ENABLED
34435 int mem_base;
34436 int ret_val;
34437 int code; /* UCS code point */
34438 int n_code;
34439
34440 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34441 mem_base = xmlMemBlocks();
34442 code = gen_int(n_code, 0);
34443
34444 ret_val = xmlUCSIsBoxDrawing(code);
34445 desret_int(ret_val);
34446 call_tests++;
34447 des_int(n_code, code, 0);
34448 xmlResetLastError();
34449 if (mem_base != xmlMemBlocks()) {
34450 printf("Leak of %d blocks found in xmlUCSIsBoxDrawing",
34451 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034452 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034453 printf(" %d", n_code);
34454 printf("\n");
34455 }
34456 }
34457#endif
34458
34459 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000034460 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034461}
34462
34463
34464static int
34465test_xmlUCSIsBraillePatterns(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034466 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034467
34468#ifdef LIBXML_UNICODE_ENABLED
34469 int mem_base;
34470 int ret_val;
34471 int code; /* UCS code point */
34472 int n_code;
34473
34474 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34475 mem_base = xmlMemBlocks();
34476 code = gen_int(n_code, 0);
34477
34478 ret_val = xmlUCSIsBraillePatterns(code);
34479 desret_int(ret_val);
34480 call_tests++;
34481 des_int(n_code, code, 0);
34482 xmlResetLastError();
34483 if (mem_base != xmlMemBlocks()) {
34484 printf("Leak of %d blocks found in xmlUCSIsBraillePatterns",
34485 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034486 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034487 printf(" %d", n_code);
34488 printf("\n");
34489 }
34490 }
34491#endif
34492
34493 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000034494 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034495}
34496
34497
34498static int
34499test_xmlUCSIsBuhid(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034500 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034501
34502#ifdef LIBXML_UNICODE_ENABLED
34503 int mem_base;
34504 int ret_val;
34505 int code; /* UCS code point */
34506 int n_code;
34507
34508 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34509 mem_base = xmlMemBlocks();
34510 code = gen_int(n_code, 0);
34511
34512 ret_val = xmlUCSIsBuhid(code);
34513 desret_int(ret_val);
34514 call_tests++;
34515 des_int(n_code, code, 0);
34516 xmlResetLastError();
34517 if (mem_base != xmlMemBlocks()) {
34518 printf("Leak of %d blocks found in xmlUCSIsBuhid",
34519 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034520 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034521 printf(" %d", n_code);
34522 printf("\n");
34523 }
34524 }
34525#endif
34526
34527 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000034528 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034529}
34530
34531
34532static int
34533test_xmlUCSIsByzantineMusicalSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034534 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034535
34536#ifdef LIBXML_UNICODE_ENABLED
34537 int mem_base;
34538 int ret_val;
34539 int code; /* UCS code point */
34540 int n_code;
34541
34542 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34543 mem_base = xmlMemBlocks();
34544 code = gen_int(n_code, 0);
34545
34546 ret_val = xmlUCSIsByzantineMusicalSymbols(code);
34547 desret_int(ret_val);
34548 call_tests++;
34549 des_int(n_code, code, 0);
34550 xmlResetLastError();
34551 if (mem_base != xmlMemBlocks()) {
34552 printf("Leak of %d blocks found in xmlUCSIsByzantineMusicalSymbols",
34553 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034554 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034555 printf(" %d", n_code);
34556 printf("\n");
34557 }
34558 }
34559#endif
34560
34561 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000034562 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034563}
34564
34565
34566static int
34567test_xmlUCSIsCJKCompatibility(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034568 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034569
34570#ifdef LIBXML_UNICODE_ENABLED
34571 int mem_base;
34572 int ret_val;
34573 int code; /* UCS code point */
34574 int n_code;
34575
34576 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34577 mem_base = xmlMemBlocks();
34578 code = gen_int(n_code, 0);
34579
34580 ret_val = xmlUCSIsCJKCompatibility(code);
34581 desret_int(ret_val);
34582 call_tests++;
34583 des_int(n_code, code, 0);
34584 xmlResetLastError();
34585 if (mem_base != xmlMemBlocks()) {
34586 printf("Leak of %d blocks found in xmlUCSIsCJKCompatibility",
34587 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034588 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034589 printf(" %d", n_code);
34590 printf("\n");
34591 }
34592 }
34593#endif
34594
34595 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000034596 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034597}
34598
34599
34600static int
34601test_xmlUCSIsCJKCompatibilityForms(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034602 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034603
34604#ifdef LIBXML_UNICODE_ENABLED
34605 int mem_base;
34606 int ret_val;
34607 int code; /* UCS code point */
34608 int n_code;
34609
34610 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34611 mem_base = xmlMemBlocks();
34612 code = gen_int(n_code, 0);
34613
34614 ret_val = xmlUCSIsCJKCompatibilityForms(code);
34615 desret_int(ret_val);
34616 call_tests++;
34617 des_int(n_code, code, 0);
34618 xmlResetLastError();
34619 if (mem_base != xmlMemBlocks()) {
34620 printf("Leak of %d blocks found in xmlUCSIsCJKCompatibilityForms",
34621 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034622 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034623 printf(" %d", n_code);
34624 printf("\n");
34625 }
34626 }
34627#endif
34628
34629 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000034630 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034631}
34632
34633
34634static int
34635test_xmlUCSIsCJKCompatibilityIdeographs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034636 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034637
34638#ifdef LIBXML_UNICODE_ENABLED
34639 int mem_base;
34640 int ret_val;
34641 int code; /* UCS code point */
34642 int n_code;
34643
34644 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34645 mem_base = xmlMemBlocks();
34646 code = gen_int(n_code, 0);
34647
34648 ret_val = xmlUCSIsCJKCompatibilityIdeographs(code);
34649 desret_int(ret_val);
34650 call_tests++;
34651 des_int(n_code, code, 0);
34652 xmlResetLastError();
34653 if (mem_base != xmlMemBlocks()) {
34654 printf("Leak of %d blocks found in xmlUCSIsCJKCompatibilityIdeographs",
34655 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034656 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034657 printf(" %d", n_code);
34658 printf("\n");
34659 }
34660 }
34661#endif
34662
34663 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000034664 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034665}
34666
34667
34668static int
34669test_xmlUCSIsCJKCompatibilityIdeographsSupplement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034670 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034671
34672#ifdef LIBXML_UNICODE_ENABLED
34673 int mem_base;
34674 int ret_val;
34675 int code; /* UCS code point */
34676 int n_code;
34677
34678 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34679 mem_base = xmlMemBlocks();
34680 code = gen_int(n_code, 0);
34681
34682 ret_val = xmlUCSIsCJKCompatibilityIdeographsSupplement(code);
34683 desret_int(ret_val);
34684 call_tests++;
34685 des_int(n_code, code, 0);
34686 xmlResetLastError();
34687 if (mem_base != xmlMemBlocks()) {
34688 printf("Leak of %d blocks found in xmlUCSIsCJKCompatibilityIdeographsSupplement",
34689 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034690 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034691 printf(" %d", n_code);
34692 printf("\n");
34693 }
34694 }
34695#endif
34696
34697 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000034698 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034699}
34700
34701
34702static int
34703test_xmlUCSIsCJKRadicalsSupplement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034704 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034705
34706#ifdef LIBXML_UNICODE_ENABLED
34707 int mem_base;
34708 int ret_val;
34709 int code; /* UCS code point */
34710 int n_code;
34711
34712 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34713 mem_base = xmlMemBlocks();
34714 code = gen_int(n_code, 0);
34715
34716 ret_val = xmlUCSIsCJKRadicalsSupplement(code);
34717 desret_int(ret_val);
34718 call_tests++;
34719 des_int(n_code, code, 0);
34720 xmlResetLastError();
34721 if (mem_base != xmlMemBlocks()) {
34722 printf("Leak of %d blocks found in xmlUCSIsCJKRadicalsSupplement",
34723 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034724 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034725 printf(" %d", n_code);
34726 printf("\n");
34727 }
34728 }
34729#endif
34730
34731 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000034732 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034733}
34734
34735
34736static int
34737test_xmlUCSIsCJKSymbolsandPunctuation(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034738 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034739
34740#ifdef LIBXML_UNICODE_ENABLED
34741 int mem_base;
34742 int ret_val;
34743 int code; /* UCS code point */
34744 int n_code;
34745
34746 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34747 mem_base = xmlMemBlocks();
34748 code = gen_int(n_code, 0);
34749
34750 ret_val = xmlUCSIsCJKSymbolsandPunctuation(code);
34751 desret_int(ret_val);
34752 call_tests++;
34753 des_int(n_code, code, 0);
34754 xmlResetLastError();
34755 if (mem_base != xmlMemBlocks()) {
34756 printf("Leak of %d blocks found in xmlUCSIsCJKSymbolsandPunctuation",
34757 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034758 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034759 printf(" %d", n_code);
34760 printf("\n");
34761 }
34762 }
34763#endif
34764
34765 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000034766 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034767}
34768
34769
34770static int
34771test_xmlUCSIsCJKUnifiedIdeographs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034772 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034773
34774#ifdef LIBXML_UNICODE_ENABLED
34775 int mem_base;
34776 int ret_val;
34777 int code; /* UCS code point */
34778 int n_code;
34779
34780 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34781 mem_base = xmlMemBlocks();
34782 code = gen_int(n_code, 0);
34783
34784 ret_val = xmlUCSIsCJKUnifiedIdeographs(code);
34785 desret_int(ret_val);
34786 call_tests++;
34787 des_int(n_code, code, 0);
34788 xmlResetLastError();
34789 if (mem_base != xmlMemBlocks()) {
34790 printf("Leak of %d blocks found in xmlUCSIsCJKUnifiedIdeographs",
34791 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034792 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034793 printf(" %d", n_code);
34794 printf("\n");
34795 }
34796 }
34797#endif
34798
34799 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000034800 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034801}
34802
34803
34804static int
34805test_xmlUCSIsCJKUnifiedIdeographsExtensionA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034806 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034807
34808#ifdef LIBXML_UNICODE_ENABLED
34809 int mem_base;
34810 int ret_val;
34811 int code; /* UCS code point */
34812 int n_code;
34813
34814 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34815 mem_base = xmlMemBlocks();
34816 code = gen_int(n_code, 0);
34817
34818 ret_val = xmlUCSIsCJKUnifiedIdeographsExtensionA(code);
34819 desret_int(ret_val);
34820 call_tests++;
34821 des_int(n_code, code, 0);
34822 xmlResetLastError();
34823 if (mem_base != xmlMemBlocks()) {
34824 printf("Leak of %d blocks found in xmlUCSIsCJKUnifiedIdeographsExtensionA",
34825 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034826 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034827 printf(" %d", n_code);
34828 printf("\n");
34829 }
34830 }
34831#endif
34832
34833 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000034834 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034835}
34836
34837
34838static int
34839test_xmlUCSIsCJKUnifiedIdeographsExtensionB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034840 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034841
34842#ifdef LIBXML_UNICODE_ENABLED
34843 int mem_base;
34844 int ret_val;
34845 int code; /* UCS code point */
34846 int n_code;
34847
34848 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34849 mem_base = xmlMemBlocks();
34850 code = gen_int(n_code, 0);
34851
34852 ret_val = xmlUCSIsCJKUnifiedIdeographsExtensionB(code);
34853 desret_int(ret_val);
34854 call_tests++;
34855 des_int(n_code, code, 0);
34856 xmlResetLastError();
34857 if (mem_base != xmlMemBlocks()) {
34858 printf("Leak of %d blocks found in xmlUCSIsCJKUnifiedIdeographsExtensionB",
34859 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034860 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034861 printf(" %d", n_code);
34862 printf("\n");
34863 }
34864 }
34865#endif
34866
34867 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000034868 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034869}
34870
34871
34872static int
34873test_xmlUCSIsCat(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034874 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034875
34876#ifdef LIBXML_UNICODE_ENABLED
34877 int mem_base;
34878 int ret_val;
34879 int code; /* UCS code point */
34880 int n_code;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034881 char * cat; /* UCS Category name */
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034882 int n_cat;
34883
34884 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34885 for (n_cat = 0;n_cat < gen_nb_const_char_ptr;n_cat++) {
34886 mem_base = xmlMemBlocks();
34887 code = gen_int(n_code, 0);
34888 cat = gen_const_char_ptr(n_cat, 1);
34889
34890 ret_val = xmlUCSIsCat(code, cat);
34891 desret_int(ret_val);
34892 call_tests++;
34893 des_int(n_code, code, 0);
34894 des_const_char_ptr(n_cat, cat, 1);
34895 xmlResetLastError();
34896 if (mem_base != xmlMemBlocks()) {
34897 printf("Leak of %d blocks found in xmlUCSIsCat",
34898 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034899 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034900 printf(" %d", n_code);
34901 printf(" %d", n_cat);
34902 printf("\n");
34903 }
34904 }
34905 }
34906#endif
34907
34908 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000034909 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034910}
34911
34912
34913static int
34914test_xmlUCSIsCatC(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034915 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034916
34917#ifdef LIBXML_UNICODE_ENABLED
34918 int mem_base;
34919 int ret_val;
34920 int code; /* UCS code point */
34921 int n_code;
34922
34923 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34924 mem_base = xmlMemBlocks();
34925 code = gen_int(n_code, 0);
34926
34927 ret_val = xmlUCSIsCatC(code);
34928 desret_int(ret_val);
34929 call_tests++;
34930 des_int(n_code, code, 0);
34931 xmlResetLastError();
34932 if (mem_base != xmlMemBlocks()) {
34933 printf("Leak of %d blocks found in xmlUCSIsCatC",
34934 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034935 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034936 printf(" %d", n_code);
34937 printf("\n");
34938 }
34939 }
34940#endif
34941
34942 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000034943 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034944}
34945
34946
34947static int
34948test_xmlUCSIsCatCc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034949 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034950
34951#ifdef LIBXML_UNICODE_ENABLED
34952 int mem_base;
34953 int ret_val;
34954 int code; /* UCS code point */
34955 int n_code;
34956
34957 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34958 mem_base = xmlMemBlocks();
34959 code = gen_int(n_code, 0);
34960
34961 ret_val = xmlUCSIsCatCc(code);
34962 desret_int(ret_val);
34963 call_tests++;
34964 des_int(n_code, code, 0);
34965 xmlResetLastError();
34966 if (mem_base != xmlMemBlocks()) {
34967 printf("Leak of %d blocks found in xmlUCSIsCatCc",
34968 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034969 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034970 printf(" %d", n_code);
34971 printf("\n");
34972 }
34973 }
34974#endif
34975
34976 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000034977 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034978}
34979
34980
34981static int
34982test_xmlUCSIsCatCf(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034983 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034984
34985#ifdef LIBXML_UNICODE_ENABLED
34986 int mem_base;
34987 int ret_val;
34988 int code; /* UCS code point */
34989 int n_code;
34990
34991 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34992 mem_base = xmlMemBlocks();
34993 code = gen_int(n_code, 0);
34994
34995 ret_val = xmlUCSIsCatCf(code);
34996 desret_int(ret_val);
34997 call_tests++;
34998 des_int(n_code, code, 0);
34999 xmlResetLastError();
35000 if (mem_base != xmlMemBlocks()) {
35001 printf("Leak of %d blocks found in xmlUCSIsCatCf",
35002 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035003 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035004 printf(" %d", n_code);
35005 printf("\n");
35006 }
35007 }
35008#endif
35009
35010 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000035011 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035012}
35013
35014
35015static int
35016test_xmlUCSIsCatCo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035017 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035018
35019#ifdef LIBXML_UNICODE_ENABLED
35020 int mem_base;
35021 int ret_val;
35022 int code; /* UCS code point */
35023 int n_code;
35024
35025 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35026 mem_base = xmlMemBlocks();
35027 code = gen_int(n_code, 0);
35028
35029 ret_val = xmlUCSIsCatCo(code);
35030 desret_int(ret_val);
35031 call_tests++;
35032 des_int(n_code, code, 0);
35033 xmlResetLastError();
35034 if (mem_base != xmlMemBlocks()) {
35035 printf("Leak of %d blocks found in xmlUCSIsCatCo",
35036 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035037 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035038 printf(" %d", n_code);
35039 printf("\n");
35040 }
35041 }
35042#endif
35043
35044 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000035045 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035046}
35047
35048
35049static int
35050test_xmlUCSIsCatCs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035051 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035052
35053#ifdef LIBXML_UNICODE_ENABLED
35054 int mem_base;
35055 int ret_val;
35056 int code; /* UCS code point */
35057 int n_code;
35058
35059 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35060 mem_base = xmlMemBlocks();
35061 code = gen_int(n_code, 0);
35062
35063 ret_val = xmlUCSIsCatCs(code);
35064 desret_int(ret_val);
35065 call_tests++;
35066 des_int(n_code, code, 0);
35067 xmlResetLastError();
35068 if (mem_base != xmlMemBlocks()) {
35069 printf("Leak of %d blocks found in xmlUCSIsCatCs",
35070 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035071 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035072 printf(" %d", n_code);
35073 printf("\n");
35074 }
35075 }
35076#endif
35077
35078 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000035079 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035080}
35081
35082
35083static int
35084test_xmlUCSIsCatL(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035085 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035086
35087#ifdef LIBXML_UNICODE_ENABLED
35088 int mem_base;
35089 int ret_val;
35090 int code; /* UCS code point */
35091 int n_code;
35092
35093 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35094 mem_base = xmlMemBlocks();
35095 code = gen_int(n_code, 0);
35096
35097 ret_val = xmlUCSIsCatL(code);
35098 desret_int(ret_val);
35099 call_tests++;
35100 des_int(n_code, code, 0);
35101 xmlResetLastError();
35102 if (mem_base != xmlMemBlocks()) {
35103 printf("Leak of %d blocks found in xmlUCSIsCatL",
35104 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035105 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035106 printf(" %d", n_code);
35107 printf("\n");
35108 }
35109 }
35110#endif
35111
35112 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000035113 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035114}
35115
35116
35117static int
35118test_xmlUCSIsCatLl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035119 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035120
35121#ifdef LIBXML_UNICODE_ENABLED
35122 int mem_base;
35123 int ret_val;
35124 int code; /* UCS code point */
35125 int n_code;
35126
35127 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35128 mem_base = xmlMemBlocks();
35129 code = gen_int(n_code, 0);
35130
35131 ret_val = xmlUCSIsCatLl(code);
35132 desret_int(ret_val);
35133 call_tests++;
35134 des_int(n_code, code, 0);
35135 xmlResetLastError();
35136 if (mem_base != xmlMemBlocks()) {
35137 printf("Leak of %d blocks found in xmlUCSIsCatLl",
35138 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035139 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035140 printf(" %d", n_code);
35141 printf("\n");
35142 }
35143 }
35144#endif
35145
35146 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000035147 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035148}
35149
35150
35151static int
35152test_xmlUCSIsCatLm(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035153 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035154
35155#ifdef LIBXML_UNICODE_ENABLED
35156 int mem_base;
35157 int ret_val;
35158 int code; /* UCS code point */
35159 int n_code;
35160
35161 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35162 mem_base = xmlMemBlocks();
35163 code = gen_int(n_code, 0);
35164
35165 ret_val = xmlUCSIsCatLm(code);
35166 desret_int(ret_val);
35167 call_tests++;
35168 des_int(n_code, code, 0);
35169 xmlResetLastError();
35170 if (mem_base != xmlMemBlocks()) {
35171 printf("Leak of %d blocks found in xmlUCSIsCatLm",
35172 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035173 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035174 printf(" %d", n_code);
35175 printf("\n");
35176 }
35177 }
35178#endif
35179
35180 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000035181 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035182}
35183
35184
35185static int
35186test_xmlUCSIsCatLo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035187 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035188
35189#ifdef LIBXML_UNICODE_ENABLED
35190 int mem_base;
35191 int ret_val;
35192 int code; /* UCS code point */
35193 int n_code;
35194
35195 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35196 mem_base = xmlMemBlocks();
35197 code = gen_int(n_code, 0);
35198
35199 ret_val = xmlUCSIsCatLo(code);
35200 desret_int(ret_val);
35201 call_tests++;
35202 des_int(n_code, code, 0);
35203 xmlResetLastError();
35204 if (mem_base != xmlMemBlocks()) {
35205 printf("Leak of %d blocks found in xmlUCSIsCatLo",
35206 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035207 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035208 printf(" %d", n_code);
35209 printf("\n");
35210 }
35211 }
35212#endif
35213
35214 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000035215 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035216}
35217
35218
35219static int
35220test_xmlUCSIsCatLt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035221 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035222
35223#ifdef LIBXML_UNICODE_ENABLED
35224 int mem_base;
35225 int ret_val;
35226 int code; /* UCS code point */
35227 int n_code;
35228
35229 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35230 mem_base = xmlMemBlocks();
35231 code = gen_int(n_code, 0);
35232
35233 ret_val = xmlUCSIsCatLt(code);
35234 desret_int(ret_val);
35235 call_tests++;
35236 des_int(n_code, code, 0);
35237 xmlResetLastError();
35238 if (mem_base != xmlMemBlocks()) {
35239 printf("Leak of %d blocks found in xmlUCSIsCatLt",
35240 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035241 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035242 printf(" %d", n_code);
35243 printf("\n");
35244 }
35245 }
35246#endif
35247
35248 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000035249 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035250}
35251
35252
35253static int
35254test_xmlUCSIsCatLu(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035255 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035256
35257#ifdef LIBXML_UNICODE_ENABLED
35258 int mem_base;
35259 int ret_val;
35260 int code; /* UCS code point */
35261 int n_code;
35262
35263 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35264 mem_base = xmlMemBlocks();
35265 code = gen_int(n_code, 0);
35266
35267 ret_val = xmlUCSIsCatLu(code);
35268 desret_int(ret_val);
35269 call_tests++;
35270 des_int(n_code, code, 0);
35271 xmlResetLastError();
35272 if (mem_base != xmlMemBlocks()) {
35273 printf("Leak of %d blocks found in xmlUCSIsCatLu",
35274 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035275 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035276 printf(" %d", n_code);
35277 printf("\n");
35278 }
35279 }
35280#endif
35281
35282 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000035283 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035284}
35285
35286
35287static int
35288test_xmlUCSIsCatM(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035289 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035290
35291#ifdef LIBXML_UNICODE_ENABLED
35292 int mem_base;
35293 int ret_val;
35294 int code; /* UCS code point */
35295 int n_code;
35296
35297 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35298 mem_base = xmlMemBlocks();
35299 code = gen_int(n_code, 0);
35300
35301 ret_val = xmlUCSIsCatM(code);
35302 desret_int(ret_val);
35303 call_tests++;
35304 des_int(n_code, code, 0);
35305 xmlResetLastError();
35306 if (mem_base != xmlMemBlocks()) {
35307 printf("Leak of %d blocks found in xmlUCSIsCatM",
35308 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035309 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035310 printf(" %d", n_code);
35311 printf("\n");
35312 }
35313 }
35314#endif
35315
35316 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000035317 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035318}
35319
35320
35321static int
35322test_xmlUCSIsCatMc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035323 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035324
35325#ifdef LIBXML_UNICODE_ENABLED
35326 int mem_base;
35327 int ret_val;
35328 int code; /* UCS code point */
35329 int n_code;
35330
35331 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35332 mem_base = xmlMemBlocks();
35333 code = gen_int(n_code, 0);
35334
35335 ret_val = xmlUCSIsCatMc(code);
35336 desret_int(ret_val);
35337 call_tests++;
35338 des_int(n_code, code, 0);
35339 xmlResetLastError();
35340 if (mem_base != xmlMemBlocks()) {
35341 printf("Leak of %d blocks found in xmlUCSIsCatMc",
35342 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035343 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035344 printf(" %d", n_code);
35345 printf("\n");
35346 }
35347 }
35348#endif
35349
35350 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000035351 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035352}
35353
35354
35355static int
35356test_xmlUCSIsCatMe(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035357 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035358
35359#ifdef LIBXML_UNICODE_ENABLED
35360 int mem_base;
35361 int ret_val;
35362 int code; /* UCS code point */
35363 int n_code;
35364
35365 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35366 mem_base = xmlMemBlocks();
35367 code = gen_int(n_code, 0);
35368
35369 ret_val = xmlUCSIsCatMe(code);
35370 desret_int(ret_val);
35371 call_tests++;
35372 des_int(n_code, code, 0);
35373 xmlResetLastError();
35374 if (mem_base != xmlMemBlocks()) {
35375 printf("Leak of %d blocks found in xmlUCSIsCatMe",
35376 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035377 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035378 printf(" %d", n_code);
35379 printf("\n");
35380 }
35381 }
35382#endif
35383
35384 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000035385 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035386}
35387
35388
35389static int
35390test_xmlUCSIsCatMn(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035391 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035392
35393#ifdef LIBXML_UNICODE_ENABLED
35394 int mem_base;
35395 int ret_val;
35396 int code; /* UCS code point */
35397 int n_code;
35398
35399 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35400 mem_base = xmlMemBlocks();
35401 code = gen_int(n_code, 0);
35402
35403 ret_val = xmlUCSIsCatMn(code);
35404 desret_int(ret_val);
35405 call_tests++;
35406 des_int(n_code, code, 0);
35407 xmlResetLastError();
35408 if (mem_base != xmlMemBlocks()) {
35409 printf("Leak of %d blocks found in xmlUCSIsCatMn",
35410 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035411 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035412 printf(" %d", n_code);
35413 printf("\n");
35414 }
35415 }
35416#endif
35417
35418 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000035419 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035420}
35421
35422
35423static int
35424test_xmlUCSIsCatN(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035425 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035426
35427#ifdef LIBXML_UNICODE_ENABLED
35428 int mem_base;
35429 int ret_val;
35430 int code; /* UCS code point */
35431 int n_code;
35432
35433 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35434 mem_base = xmlMemBlocks();
35435 code = gen_int(n_code, 0);
35436
35437 ret_val = xmlUCSIsCatN(code);
35438 desret_int(ret_val);
35439 call_tests++;
35440 des_int(n_code, code, 0);
35441 xmlResetLastError();
35442 if (mem_base != xmlMemBlocks()) {
35443 printf("Leak of %d blocks found in xmlUCSIsCatN",
35444 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035445 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035446 printf(" %d", n_code);
35447 printf("\n");
35448 }
35449 }
35450#endif
35451
35452 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000035453 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035454}
35455
35456
35457static int
35458test_xmlUCSIsCatNd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035459 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035460
35461#ifdef LIBXML_UNICODE_ENABLED
35462 int mem_base;
35463 int ret_val;
35464 int code; /* UCS code point */
35465 int n_code;
35466
35467 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35468 mem_base = xmlMemBlocks();
35469 code = gen_int(n_code, 0);
35470
35471 ret_val = xmlUCSIsCatNd(code);
35472 desret_int(ret_val);
35473 call_tests++;
35474 des_int(n_code, code, 0);
35475 xmlResetLastError();
35476 if (mem_base != xmlMemBlocks()) {
35477 printf("Leak of %d blocks found in xmlUCSIsCatNd",
35478 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035479 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035480 printf(" %d", n_code);
35481 printf("\n");
35482 }
35483 }
35484#endif
35485
35486 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000035487 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035488}
35489
35490
35491static int
35492test_xmlUCSIsCatNl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035493 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035494
35495#ifdef LIBXML_UNICODE_ENABLED
35496 int mem_base;
35497 int ret_val;
35498 int code; /* UCS code point */
35499 int n_code;
35500
35501 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35502 mem_base = xmlMemBlocks();
35503 code = gen_int(n_code, 0);
35504
35505 ret_val = xmlUCSIsCatNl(code);
35506 desret_int(ret_val);
35507 call_tests++;
35508 des_int(n_code, code, 0);
35509 xmlResetLastError();
35510 if (mem_base != xmlMemBlocks()) {
35511 printf("Leak of %d blocks found in xmlUCSIsCatNl",
35512 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035513 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035514 printf(" %d", n_code);
35515 printf("\n");
35516 }
35517 }
35518#endif
35519
35520 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000035521 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035522}
35523
35524
35525static int
35526test_xmlUCSIsCatNo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035527 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035528
35529#ifdef LIBXML_UNICODE_ENABLED
35530 int mem_base;
35531 int ret_val;
35532 int code; /* UCS code point */
35533 int n_code;
35534
35535 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35536 mem_base = xmlMemBlocks();
35537 code = gen_int(n_code, 0);
35538
35539 ret_val = xmlUCSIsCatNo(code);
35540 desret_int(ret_val);
35541 call_tests++;
35542 des_int(n_code, code, 0);
35543 xmlResetLastError();
35544 if (mem_base != xmlMemBlocks()) {
35545 printf("Leak of %d blocks found in xmlUCSIsCatNo",
35546 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035547 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035548 printf(" %d", n_code);
35549 printf("\n");
35550 }
35551 }
35552#endif
35553
35554 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000035555 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035556}
35557
35558
35559static int
35560test_xmlUCSIsCatP(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035561 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035562
35563#ifdef LIBXML_UNICODE_ENABLED
35564 int mem_base;
35565 int ret_val;
35566 int code; /* UCS code point */
35567 int n_code;
35568
35569 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35570 mem_base = xmlMemBlocks();
35571 code = gen_int(n_code, 0);
35572
35573 ret_val = xmlUCSIsCatP(code);
35574 desret_int(ret_val);
35575 call_tests++;
35576 des_int(n_code, code, 0);
35577 xmlResetLastError();
35578 if (mem_base != xmlMemBlocks()) {
35579 printf("Leak of %d blocks found in xmlUCSIsCatP",
35580 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035581 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035582 printf(" %d", n_code);
35583 printf("\n");
35584 }
35585 }
35586#endif
35587
35588 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000035589 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035590}
35591
35592
35593static int
35594test_xmlUCSIsCatPc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035595 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035596
35597#ifdef LIBXML_UNICODE_ENABLED
35598 int mem_base;
35599 int ret_val;
35600 int code; /* UCS code point */
35601 int n_code;
35602
35603 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35604 mem_base = xmlMemBlocks();
35605 code = gen_int(n_code, 0);
35606
35607 ret_val = xmlUCSIsCatPc(code);
35608 desret_int(ret_val);
35609 call_tests++;
35610 des_int(n_code, code, 0);
35611 xmlResetLastError();
35612 if (mem_base != xmlMemBlocks()) {
35613 printf("Leak of %d blocks found in xmlUCSIsCatPc",
35614 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035615 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035616 printf(" %d", n_code);
35617 printf("\n");
35618 }
35619 }
35620#endif
35621
35622 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000035623 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035624}
35625
35626
35627static int
35628test_xmlUCSIsCatPd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035629 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035630
35631#ifdef LIBXML_UNICODE_ENABLED
35632 int mem_base;
35633 int ret_val;
35634 int code; /* UCS code point */
35635 int n_code;
35636
35637 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35638 mem_base = xmlMemBlocks();
35639 code = gen_int(n_code, 0);
35640
35641 ret_val = xmlUCSIsCatPd(code);
35642 desret_int(ret_val);
35643 call_tests++;
35644 des_int(n_code, code, 0);
35645 xmlResetLastError();
35646 if (mem_base != xmlMemBlocks()) {
35647 printf("Leak of %d blocks found in xmlUCSIsCatPd",
35648 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035649 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035650 printf(" %d", n_code);
35651 printf("\n");
35652 }
35653 }
35654#endif
35655
35656 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000035657 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035658}
35659
35660
35661static int
35662test_xmlUCSIsCatPe(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035663 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035664
35665#ifdef LIBXML_UNICODE_ENABLED
35666 int mem_base;
35667 int ret_val;
35668 int code; /* UCS code point */
35669 int n_code;
35670
35671 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35672 mem_base = xmlMemBlocks();
35673 code = gen_int(n_code, 0);
35674
35675 ret_val = xmlUCSIsCatPe(code);
35676 desret_int(ret_val);
35677 call_tests++;
35678 des_int(n_code, code, 0);
35679 xmlResetLastError();
35680 if (mem_base != xmlMemBlocks()) {
35681 printf("Leak of %d blocks found in xmlUCSIsCatPe",
35682 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035683 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035684 printf(" %d", n_code);
35685 printf("\n");
35686 }
35687 }
35688#endif
35689
35690 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000035691 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035692}
35693
35694
35695static int
35696test_xmlUCSIsCatPf(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035697 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035698
35699#ifdef LIBXML_UNICODE_ENABLED
35700 int mem_base;
35701 int ret_val;
35702 int code; /* UCS code point */
35703 int n_code;
35704
35705 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35706 mem_base = xmlMemBlocks();
35707 code = gen_int(n_code, 0);
35708
35709 ret_val = xmlUCSIsCatPf(code);
35710 desret_int(ret_val);
35711 call_tests++;
35712 des_int(n_code, code, 0);
35713 xmlResetLastError();
35714 if (mem_base != xmlMemBlocks()) {
35715 printf("Leak of %d blocks found in xmlUCSIsCatPf",
35716 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035717 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035718 printf(" %d", n_code);
35719 printf("\n");
35720 }
35721 }
35722#endif
35723
35724 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000035725 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035726}
35727
35728
35729static int
35730test_xmlUCSIsCatPi(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035731 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035732
35733#ifdef LIBXML_UNICODE_ENABLED
35734 int mem_base;
35735 int ret_val;
35736 int code; /* UCS code point */
35737 int n_code;
35738
35739 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35740 mem_base = xmlMemBlocks();
35741 code = gen_int(n_code, 0);
35742
35743 ret_val = xmlUCSIsCatPi(code);
35744 desret_int(ret_val);
35745 call_tests++;
35746 des_int(n_code, code, 0);
35747 xmlResetLastError();
35748 if (mem_base != xmlMemBlocks()) {
35749 printf("Leak of %d blocks found in xmlUCSIsCatPi",
35750 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035751 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035752 printf(" %d", n_code);
35753 printf("\n");
35754 }
35755 }
35756#endif
35757
35758 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000035759 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035760}
35761
35762
35763static int
35764test_xmlUCSIsCatPo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035765 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035766
35767#ifdef LIBXML_UNICODE_ENABLED
35768 int mem_base;
35769 int ret_val;
35770 int code; /* UCS code point */
35771 int n_code;
35772
35773 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35774 mem_base = xmlMemBlocks();
35775 code = gen_int(n_code, 0);
35776
35777 ret_val = xmlUCSIsCatPo(code);
35778 desret_int(ret_val);
35779 call_tests++;
35780 des_int(n_code, code, 0);
35781 xmlResetLastError();
35782 if (mem_base != xmlMemBlocks()) {
35783 printf("Leak of %d blocks found in xmlUCSIsCatPo",
35784 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035785 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035786 printf(" %d", n_code);
35787 printf("\n");
35788 }
35789 }
35790#endif
35791
35792 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000035793 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035794}
35795
35796
35797static int
35798test_xmlUCSIsCatPs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035799 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035800
35801#ifdef LIBXML_UNICODE_ENABLED
35802 int mem_base;
35803 int ret_val;
35804 int code; /* UCS code point */
35805 int n_code;
35806
35807 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35808 mem_base = xmlMemBlocks();
35809 code = gen_int(n_code, 0);
35810
35811 ret_val = xmlUCSIsCatPs(code);
35812 desret_int(ret_val);
35813 call_tests++;
35814 des_int(n_code, code, 0);
35815 xmlResetLastError();
35816 if (mem_base != xmlMemBlocks()) {
35817 printf("Leak of %d blocks found in xmlUCSIsCatPs",
35818 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035819 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035820 printf(" %d", n_code);
35821 printf("\n");
35822 }
35823 }
35824#endif
35825
35826 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000035827 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035828}
35829
35830
35831static int
35832test_xmlUCSIsCatS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035833 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035834
35835#ifdef LIBXML_UNICODE_ENABLED
35836 int mem_base;
35837 int ret_val;
35838 int code; /* UCS code point */
35839 int n_code;
35840
35841 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35842 mem_base = xmlMemBlocks();
35843 code = gen_int(n_code, 0);
35844
35845 ret_val = xmlUCSIsCatS(code);
35846 desret_int(ret_val);
35847 call_tests++;
35848 des_int(n_code, code, 0);
35849 xmlResetLastError();
35850 if (mem_base != xmlMemBlocks()) {
35851 printf("Leak of %d blocks found in xmlUCSIsCatS",
35852 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035853 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035854 printf(" %d", n_code);
35855 printf("\n");
35856 }
35857 }
35858#endif
35859
35860 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000035861 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035862}
35863
35864
35865static int
35866test_xmlUCSIsCatSc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035867 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035868
35869#ifdef LIBXML_UNICODE_ENABLED
35870 int mem_base;
35871 int ret_val;
35872 int code; /* UCS code point */
35873 int n_code;
35874
35875 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35876 mem_base = xmlMemBlocks();
35877 code = gen_int(n_code, 0);
35878
35879 ret_val = xmlUCSIsCatSc(code);
35880 desret_int(ret_val);
35881 call_tests++;
35882 des_int(n_code, code, 0);
35883 xmlResetLastError();
35884 if (mem_base != xmlMemBlocks()) {
35885 printf("Leak of %d blocks found in xmlUCSIsCatSc",
35886 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035887 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035888 printf(" %d", n_code);
35889 printf("\n");
35890 }
35891 }
35892#endif
35893
35894 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000035895 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035896}
35897
35898
35899static int
35900test_xmlUCSIsCatSk(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035901 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035902
35903#ifdef LIBXML_UNICODE_ENABLED
35904 int mem_base;
35905 int ret_val;
35906 int code; /* UCS code point */
35907 int n_code;
35908
35909 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35910 mem_base = xmlMemBlocks();
35911 code = gen_int(n_code, 0);
35912
35913 ret_val = xmlUCSIsCatSk(code);
35914 desret_int(ret_val);
35915 call_tests++;
35916 des_int(n_code, code, 0);
35917 xmlResetLastError();
35918 if (mem_base != xmlMemBlocks()) {
35919 printf("Leak of %d blocks found in xmlUCSIsCatSk",
35920 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035921 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035922 printf(" %d", n_code);
35923 printf("\n");
35924 }
35925 }
35926#endif
35927
35928 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000035929 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035930}
35931
35932
35933static int
35934test_xmlUCSIsCatSm(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035935 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035936
35937#ifdef LIBXML_UNICODE_ENABLED
35938 int mem_base;
35939 int ret_val;
35940 int code; /* UCS code point */
35941 int n_code;
35942
35943 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35944 mem_base = xmlMemBlocks();
35945 code = gen_int(n_code, 0);
35946
35947 ret_val = xmlUCSIsCatSm(code);
35948 desret_int(ret_val);
35949 call_tests++;
35950 des_int(n_code, code, 0);
35951 xmlResetLastError();
35952 if (mem_base != xmlMemBlocks()) {
35953 printf("Leak of %d blocks found in xmlUCSIsCatSm",
35954 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035955 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035956 printf(" %d", n_code);
35957 printf("\n");
35958 }
35959 }
35960#endif
35961
35962 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000035963 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035964}
35965
35966
35967static int
35968test_xmlUCSIsCatSo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035969 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035970
35971#ifdef LIBXML_UNICODE_ENABLED
35972 int mem_base;
35973 int ret_val;
35974 int code; /* UCS code point */
35975 int n_code;
35976
35977 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35978 mem_base = xmlMemBlocks();
35979 code = gen_int(n_code, 0);
35980
35981 ret_val = xmlUCSIsCatSo(code);
35982 desret_int(ret_val);
35983 call_tests++;
35984 des_int(n_code, code, 0);
35985 xmlResetLastError();
35986 if (mem_base != xmlMemBlocks()) {
35987 printf("Leak of %d blocks found in xmlUCSIsCatSo",
35988 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035989 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035990 printf(" %d", n_code);
35991 printf("\n");
35992 }
35993 }
35994#endif
35995
35996 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000035997 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035998}
35999
36000
36001static int
36002test_xmlUCSIsCatZ(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036003 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036004
36005#ifdef LIBXML_UNICODE_ENABLED
36006 int mem_base;
36007 int ret_val;
36008 int code; /* UCS code point */
36009 int n_code;
36010
36011 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36012 mem_base = xmlMemBlocks();
36013 code = gen_int(n_code, 0);
36014
36015 ret_val = xmlUCSIsCatZ(code);
36016 desret_int(ret_val);
36017 call_tests++;
36018 des_int(n_code, code, 0);
36019 xmlResetLastError();
36020 if (mem_base != xmlMemBlocks()) {
36021 printf("Leak of %d blocks found in xmlUCSIsCatZ",
36022 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036023 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036024 printf(" %d", n_code);
36025 printf("\n");
36026 }
36027 }
36028#endif
36029
36030 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000036031 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036032}
36033
36034
36035static int
36036test_xmlUCSIsCatZl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036037 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036038
36039#ifdef LIBXML_UNICODE_ENABLED
36040 int mem_base;
36041 int ret_val;
36042 int code; /* UCS code point */
36043 int n_code;
36044
36045 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36046 mem_base = xmlMemBlocks();
36047 code = gen_int(n_code, 0);
36048
36049 ret_val = xmlUCSIsCatZl(code);
36050 desret_int(ret_val);
36051 call_tests++;
36052 des_int(n_code, code, 0);
36053 xmlResetLastError();
36054 if (mem_base != xmlMemBlocks()) {
36055 printf("Leak of %d blocks found in xmlUCSIsCatZl",
36056 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036057 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036058 printf(" %d", n_code);
36059 printf("\n");
36060 }
36061 }
36062#endif
36063
36064 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000036065 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036066}
36067
36068
36069static int
36070test_xmlUCSIsCatZp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036071 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036072
36073#ifdef LIBXML_UNICODE_ENABLED
36074 int mem_base;
36075 int ret_val;
36076 int code; /* UCS code point */
36077 int n_code;
36078
36079 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36080 mem_base = xmlMemBlocks();
36081 code = gen_int(n_code, 0);
36082
36083 ret_val = xmlUCSIsCatZp(code);
36084 desret_int(ret_val);
36085 call_tests++;
36086 des_int(n_code, code, 0);
36087 xmlResetLastError();
36088 if (mem_base != xmlMemBlocks()) {
36089 printf("Leak of %d blocks found in xmlUCSIsCatZp",
36090 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036091 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036092 printf(" %d", n_code);
36093 printf("\n");
36094 }
36095 }
36096#endif
36097
36098 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000036099 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036100}
36101
36102
36103static int
36104test_xmlUCSIsCatZs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036105 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036106
36107#ifdef LIBXML_UNICODE_ENABLED
36108 int mem_base;
36109 int ret_val;
36110 int code; /* UCS code point */
36111 int n_code;
36112
36113 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36114 mem_base = xmlMemBlocks();
36115 code = gen_int(n_code, 0);
36116
36117 ret_val = xmlUCSIsCatZs(code);
36118 desret_int(ret_val);
36119 call_tests++;
36120 des_int(n_code, code, 0);
36121 xmlResetLastError();
36122 if (mem_base != xmlMemBlocks()) {
36123 printf("Leak of %d blocks found in xmlUCSIsCatZs",
36124 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036125 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036126 printf(" %d", n_code);
36127 printf("\n");
36128 }
36129 }
36130#endif
36131
36132 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000036133 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036134}
36135
36136
36137static int
36138test_xmlUCSIsCherokee(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036139 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036140
36141#ifdef LIBXML_UNICODE_ENABLED
36142 int mem_base;
36143 int ret_val;
36144 int code; /* UCS code point */
36145 int n_code;
36146
36147 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36148 mem_base = xmlMemBlocks();
36149 code = gen_int(n_code, 0);
36150
36151 ret_val = xmlUCSIsCherokee(code);
36152 desret_int(ret_val);
36153 call_tests++;
36154 des_int(n_code, code, 0);
36155 xmlResetLastError();
36156 if (mem_base != xmlMemBlocks()) {
36157 printf("Leak of %d blocks found in xmlUCSIsCherokee",
36158 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036159 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036160 printf(" %d", n_code);
36161 printf("\n");
36162 }
36163 }
36164#endif
36165
36166 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000036167 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036168}
36169
36170
36171static int
36172test_xmlUCSIsCombiningDiacriticalMarks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036173 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036174
36175#ifdef LIBXML_UNICODE_ENABLED
36176 int mem_base;
36177 int ret_val;
36178 int code; /* UCS code point */
36179 int n_code;
36180
36181 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36182 mem_base = xmlMemBlocks();
36183 code = gen_int(n_code, 0);
36184
36185 ret_val = xmlUCSIsCombiningDiacriticalMarks(code);
36186 desret_int(ret_val);
36187 call_tests++;
36188 des_int(n_code, code, 0);
36189 xmlResetLastError();
36190 if (mem_base != xmlMemBlocks()) {
36191 printf("Leak of %d blocks found in xmlUCSIsCombiningDiacriticalMarks",
36192 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036193 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036194 printf(" %d", n_code);
36195 printf("\n");
36196 }
36197 }
36198#endif
36199
36200 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000036201 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036202}
36203
36204
36205static int
36206test_xmlUCSIsCombiningDiacriticalMarksforSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036207 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036208
36209#ifdef LIBXML_UNICODE_ENABLED
36210 int mem_base;
36211 int ret_val;
36212 int code; /* UCS code point */
36213 int n_code;
36214
36215 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36216 mem_base = xmlMemBlocks();
36217 code = gen_int(n_code, 0);
36218
36219 ret_val = xmlUCSIsCombiningDiacriticalMarksforSymbols(code);
36220 desret_int(ret_val);
36221 call_tests++;
36222 des_int(n_code, code, 0);
36223 xmlResetLastError();
36224 if (mem_base != xmlMemBlocks()) {
36225 printf("Leak of %d blocks found in xmlUCSIsCombiningDiacriticalMarksforSymbols",
36226 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036227 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036228 printf(" %d", n_code);
36229 printf("\n");
36230 }
36231 }
36232#endif
36233
36234 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000036235 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036236}
36237
36238
36239static int
36240test_xmlUCSIsCombiningHalfMarks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036241 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036242
36243#ifdef LIBXML_UNICODE_ENABLED
36244 int mem_base;
36245 int ret_val;
36246 int code; /* UCS code point */
36247 int n_code;
36248
36249 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36250 mem_base = xmlMemBlocks();
36251 code = gen_int(n_code, 0);
36252
36253 ret_val = xmlUCSIsCombiningHalfMarks(code);
36254 desret_int(ret_val);
36255 call_tests++;
36256 des_int(n_code, code, 0);
36257 xmlResetLastError();
36258 if (mem_base != xmlMemBlocks()) {
36259 printf("Leak of %d blocks found in xmlUCSIsCombiningHalfMarks",
36260 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036261 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036262 printf(" %d", n_code);
36263 printf("\n");
36264 }
36265 }
36266#endif
36267
36268 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000036269 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036270}
36271
36272
36273static int
36274test_xmlUCSIsCombiningMarksforSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036275 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036276
36277#ifdef LIBXML_UNICODE_ENABLED
36278 int mem_base;
36279 int ret_val;
36280 int code; /* UCS code point */
36281 int n_code;
36282
36283 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36284 mem_base = xmlMemBlocks();
36285 code = gen_int(n_code, 0);
36286
36287 ret_val = xmlUCSIsCombiningMarksforSymbols(code);
36288 desret_int(ret_val);
36289 call_tests++;
36290 des_int(n_code, code, 0);
36291 xmlResetLastError();
36292 if (mem_base != xmlMemBlocks()) {
36293 printf("Leak of %d blocks found in xmlUCSIsCombiningMarksforSymbols",
36294 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036295 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036296 printf(" %d", n_code);
36297 printf("\n");
36298 }
36299 }
36300#endif
36301
36302 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000036303 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036304}
36305
36306
36307static int
36308test_xmlUCSIsControlPictures(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036309 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036310
36311#ifdef LIBXML_UNICODE_ENABLED
36312 int mem_base;
36313 int ret_val;
36314 int code; /* UCS code point */
36315 int n_code;
36316
36317 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36318 mem_base = xmlMemBlocks();
36319 code = gen_int(n_code, 0);
36320
36321 ret_val = xmlUCSIsControlPictures(code);
36322 desret_int(ret_val);
36323 call_tests++;
36324 des_int(n_code, code, 0);
36325 xmlResetLastError();
36326 if (mem_base != xmlMemBlocks()) {
36327 printf("Leak of %d blocks found in xmlUCSIsControlPictures",
36328 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036329 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036330 printf(" %d", n_code);
36331 printf("\n");
36332 }
36333 }
36334#endif
36335
36336 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000036337 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036338}
36339
36340
36341static int
36342test_xmlUCSIsCurrencySymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036343 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036344
36345#ifdef LIBXML_UNICODE_ENABLED
36346 int mem_base;
36347 int ret_val;
36348 int code; /* UCS code point */
36349 int n_code;
36350
36351 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36352 mem_base = xmlMemBlocks();
36353 code = gen_int(n_code, 0);
36354
36355 ret_val = xmlUCSIsCurrencySymbols(code);
36356 desret_int(ret_val);
36357 call_tests++;
36358 des_int(n_code, code, 0);
36359 xmlResetLastError();
36360 if (mem_base != xmlMemBlocks()) {
36361 printf("Leak of %d blocks found in xmlUCSIsCurrencySymbols",
36362 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036363 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036364 printf(" %d", n_code);
36365 printf("\n");
36366 }
36367 }
36368#endif
36369
36370 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000036371 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036372}
36373
36374
36375static int
36376test_xmlUCSIsCypriotSyllabary(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036377 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036378
36379#ifdef LIBXML_UNICODE_ENABLED
36380 int mem_base;
36381 int ret_val;
36382 int code; /* UCS code point */
36383 int n_code;
36384
36385 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36386 mem_base = xmlMemBlocks();
36387 code = gen_int(n_code, 0);
36388
36389 ret_val = xmlUCSIsCypriotSyllabary(code);
36390 desret_int(ret_val);
36391 call_tests++;
36392 des_int(n_code, code, 0);
36393 xmlResetLastError();
36394 if (mem_base != xmlMemBlocks()) {
36395 printf("Leak of %d blocks found in xmlUCSIsCypriotSyllabary",
36396 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036397 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036398 printf(" %d", n_code);
36399 printf("\n");
36400 }
36401 }
36402#endif
36403
36404 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000036405 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036406}
36407
36408
36409static int
36410test_xmlUCSIsCyrillic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036411 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036412
36413#ifdef LIBXML_UNICODE_ENABLED
36414 int mem_base;
36415 int ret_val;
36416 int code; /* UCS code point */
36417 int n_code;
36418
36419 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36420 mem_base = xmlMemBlocks();
36421 code = gen_int(n_code, 0);
36422
36423 ret_val = xmlUCSIsCyrillic(code);
36424 desret_int(ret_val);
36425 call_tests++;
36426 des_int(n_code, code, 0);
36427 xmlResetLastError();
36428 if (mem_base != xmlMemBlocks()) {
36429 printf("Leak of %d blocks found in xmlUCSIsCyrillic",
36430 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036431 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036432 printf(" %d", n_code);
36433 printf("\n");
36434 }
36435 }
36436#endif
36437
36438 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000036439 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036440}
36441
36442
36443static int
36444test_xmlUCSIsCyrillicSupplement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036445 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036446
36447#ifdef LIBXML_UNICODE_ENABLED
36448 int mem_base;
36449 int ret_val;
36450 int code; /* UCS code point */
36451 int n_code;
36452
36453 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36454 mem_base = xmlMemBlocks();
36455 code = gen_int(n_code, 0);
36456
36457 ret_val = xmlUCSIsCyrillicSupplement(code);
36458 desret_int(ret_val);
36459 call_tests++;
36460 des_int(n_code, code, 0);
36461 xmlResetLastError();
36462 if (mem_base != xmlMemBlocks()) {
36463 printf("Leak of %d blocks found in xmlUCSIsCyrillicSupplement",
36464 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036465 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036466 printf(" %d", n_code);
36467 printf("\n");
36468 }
36469 }
36470#endif
36471
36472 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000036473 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036474}
36475
36476
36477static int
36478test_xmlUCSIsDeseret(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036479 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036480
36481#ifdef LIBXML_UNICODE_ENABLED
36482 int mem_base;
36483 int ret_val;
36484 int code; /* UCS code point */
36485 int n_code;
36486
36487 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36488 mem_base = xmlMemBlocks();
36489 code = gen_int(n_code, 0);
36490
36491 ret_val = xmlUCSIsDeseret(code);
36492 desret_int(ret_val);
36493 call_tests++;
36494 des_int(n_code, code, 0);
36495 xmlResetLastError();
36496 if (mem_base != xmlMemBlocks()) {
36497 printf("Leak of %d blocks found in xmlUCSIsDeseret",
36498 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036499 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036500 printf(" %d", n_code);
36501 printf("\n");
36502 }
36503 }
36504#endif
36505
36506 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000036507 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036508}
36509
36510
36511static int
36512test_xmlUCSIsDevanagari(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036513 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036514
36515#ifdef LIBXML_UNICODE_ENABLED
36516 int mem_base;
36517 int ret_val;
36518 int code; /* UCS code point */
36519 int n_code;
36520
36521 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36522 mem_base = xmlMemBlocks();
36523 code = gen_int(n_code, 0);
36524
36525 ret_val = xmlUCSIsDevanagari(code);
36526 desret_int(ret_val);
36527 call_tests++;
36528 des_int(n_code, code, 0);
36529 xmlResetLastError();
36530 if (mem_base != xmlMemBlocks()) {
36531 printf("Leak of %d blocks found in xmlUCSIsDevanagari",
36532 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036533 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036534 printf(" %d", n_code);
36535 printf("\n");
36536 }
36537 }
36538#endif
36539
36540 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000036541 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036542}
36543
36544
36545static int
36546test_xmlUCSIsDingbats(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036547 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036548
36549#ifdef LIBXML_UNICODE_ENABLED
36550 int mem_base;
36551 int ret_val;
36552 int code; /* UCS code point */
36553 int n_code;
36554
36555 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36556 mem_base = xmlMemBlocks();
36557 code = gen_int(n_code, 0);
36558
36559 ret_val = xmlUCSIsDingbats(code);
36560 desret_int(ret_val);
36561 call_tests++;
36562 des_int(n_code, code, 0);
36563 xmlResetLastError();
36564 if (mem_base != xmlMemBlocks()) {
36565 printf("Leak of %d blocks found in xmlUCSIsDingbats",
36566 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036567 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036568 printf(" %d", n_code);
36569 printf("\n");
36570 }
36571 }
36572#endif
36573
36574 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000036575 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036576}
36577
36578
36579static int
36580test_xmlUCSIsEnclosedAlphanumerics(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036581 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036582
36583#ifdef LIBXML_UNICODE_ENABLED
36584 int mem_base;
36585 int ret_val;
36586 int code; /* UCS code point */
36587 int n_code;
36588
36589 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36590 mem_base = xmlMemBlocks();
36591 code = gen_int(n_code, 0);
36592
36593 ret_val = xmlUCSIsEnclosedAlphanumerics(code);
36594 desret_int(ret_val);
36595 call_tests++;
36596 des_int(n_code, code, 0);
36597 xmlResetLastError();
36598 if (mem_base != xmlMemBlocks()) {
36599 printf("Leak of %d blocks found in xmlUCSIsEnclosedAlphanumerics",
36600 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036601 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036602 printf(" %d", n_code);
36603 printf("\n");
36604 }
36605 }
36606#endif
36607
36608 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000036609 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036610}
36611
36612
36613static int
36614test_xmlUCSIsEnclosedCJKLettersandMonths(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036615 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036616
36617#ifdef LIBXML_UNICODE_ENABLED
36618 int mem_base;
36619 int ret_val;
36620 int code; /* UCS code point */
36621 int n_code;
36622
36623 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36624 mem_base = xmlMemBlocks();
36625 code = gen_int(n_code, 0);
36626
36627 ret_val = xmlUCSIsEnclosedCJKLettersandMonths(code);
36628 desret_int(ret_val);
36629 call_tests++;
36630 des_int(n_code, code, 0);
36631 xmlResetLastError();
36632 if (mem_base != xmlMemBlocks()) {
36633 printf("Leak of %d blocks found in xmlUCSIsEnclosedCJKLettersandMonths",
36634 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036635 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036636 printf(" %d", n_code);
36637 printf("\n");
36638 }
36639 }
36640#endif
36641
36642 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000036643 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036644}
36645
36646
36647static int
36648test_xmlUCSIsEthiopic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036649 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036650
36651#ifdef LIBXML_UNICODE_ENABLED
36652 int mem_base;
36653 int ret_val;
36654 int code; /* UCS code point */
36655 int n_code;
36656
36657 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36658 mem_base = xmlMemBlocks();
36659 code = gen_int(n_code, 0);
36660
36661 ret_val = xmlUCSIsEthiopic(code);
36662 desret_int(ret_val);
36663 call_tests++;
36664 des_int(n_code, code, 0);
36665 xmlResetLastError();
36666 if (mem_base != xmlMemBlocks()) {
36667 printf("Leak of %d blocks found in xmlUCSIsEthiopic",
36668 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036669 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036670 printf(" %d", n_code);
36671 printf("\n");
36672 }
36673 }
36674#endif
36675
36676 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000036677 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036678}
36679
36680
36681static int
36682test_xmlUCSIsGeneralPunctuation(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036683 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036684
36685#ifdef LIBXML_UNICODE_ENABLED
36686 int mem_base;
36687 int ret_val;
36688 int code; /* UCS code point */
36689 int n_code;
36690
36691 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36692 mem_base = xmlMemBlocks();
36693 code = gen_int(n_code, 0);
36694
36695 ret_val = xmlUCSIsGeneralPunctuation(code);
36696 desret_int(ret_val);
36697 call_tests++;
36698 des_int(n_code, code, 0);
36699 xmlResetLastError();
36700 if (mem_base != xmlMemBlocks()) {
36701 printf("Leak of %d blocks found in xmlUCSIsGeneralPunctuation",
36702 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036703 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036704 printf(" %d", n_code);
36705 printf("\n");
36706 }
36707 }
36708#endif
36709
36710 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000036711 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036712}
36713
36714
36715static int
36716test_xmlUCSIsGeometricShapes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036717 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036718
36719#ifdef LIBXML_UNICODE_ENABLED
36720 int mem_base;
36721 int ret_val;
36722 int code; /* UCS code point */
36723 int n_code;
36724
36725 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36726 mem_base = xmlMemBlocks();
36727 code = gen_int(n_code, 0);
36728
36729 ret_val = xmlUCSIsGeometricShapes(code);
36730 desret_int(ret_val);
36731 call_tests++;
36732 des_int(n_code, code, 0);
36733 xmlResetLastError();
36734 if (mem_base != xmlMemBlocks()) {
36735 printf("Leak of %d blocks found in xmlUCSIsGeometricShapes",
36736 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036737 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036738 printf(" %d", n_code);
36739 printf("\n");
36740 }
36741 }
36742#endif
36743
36744 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000036745 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036746}
36747
36748
36749static int
36750test_xmlUCSIsGeorgian(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036751 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036752
36753#ifdef LIBXML_UNICODE_ENABLED
36754 int mem_base;
36755 int ret_val;
36756 int code; /* UCS code point */
36757 int n_code;
36758
36759 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36760 mem_base = xmlMemBlocks();
36761 code = gen_int(n_code, 0);
36762
36763 ret_val = xmlUCSIsGeorgian(code);
36764 desret_int(ret_val);
36765 call_tests++;
36766 des_int(n_code, code, 0);
36767 xmlResetLastError();
36768 if (mem_base != xmlMemBlocks()) {
36769 printf("Leak of %d blocks found in xmlUCSIsGeorgian",
36770 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036771 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036772 printf(" %d", n_code);
36773 printf("\n");
36774 }
36775 }
36776#endif
36777
36778 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000036779 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036780}
36781
36782
36783static int
36784test_xmlUCSIsGothic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036785 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036786
36787#ifdef LIBXML_UNICODE_ENABLED
36788 int mem_base;
36789 int ret_val;
36790 int code; /* UCS code point */
36791 int n_code;
36792
36793 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36794 mem_base = xmlMemBlocks();
36795 code = gen_int(n_code, 0);
36796
36797 ret_val = xmlUCSIsGothic(code);
36798 desret_int(ret_val);
36799 call_tests++;
36800 des_int(n_code, code, 0);
36801 xmlResetLastError();
36802 if (mem_base != xmlMemBlocks()) {
36803 printf("Leak of %d blocks found in xmlUCSIsGothic",
36804 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036805 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036806 printf(" %d", n_code);
36807 printf("\n");
36808 }
36809 }
36810#endif
36811
36812 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000036813 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036814}
36815
36816
36817static int
36818test_xmlUCSIsGreek(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036819 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036820
36821#ifdef LIBXML_UNICODE_ENABLED
36822 int mem_base;
36823 int ret_val;
36824 int code; /* UCS code point */
36825 int n_code;
36826
36827 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36828 mem_base = xmlMemBlocks();
36829 code = gen_int(n_code, 0);
36830
36831 ret_val = xmlUCSIsGreek(code);
36832 desret_int(ret_val);
36833 call_tests++;
36834 des_int(n_code, code, 0);
36835 xmlResetLastError();
36836 if (mem_base != xmlMemBlocks()) {
36837 printf("Leak of %d blocks found in xmlUCSIsGreek",
36838 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036839 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036840 printf(" %d", n_code);
36841 printf("\n");
36842 }
36843 }
36844#endif
36845
36846 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000036847 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036848}
36849
36850
36851static int
36852test_xmlUCSIsGreekExtended(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036853 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036854
36855#ifdef LIBXML_UNICODE_ENABLED
36856 int mem_base;
36857 int ret_val;
36858 int code; /* UCS code point */
36859 int n_code;
36860
36861 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36862 mem_base = xmlMemBlocks();
36863 code = gen_int(n_code, 0);
36864
36865 ret_val = xmlUCSIsGreekExtended(code);
36866 desret_int(ret_val);
36867 call_tests++;
36868 des_int(n_code, code, 0);
36869 xmlResetLastError();
36870 if (mem_base != xmlMemBlocks()) {
36871 printf("Leak of %d blocks found in xmlUCSIsGreekExtended",
36872 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036873 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036874 printf(" %d", n_code);
36875 printf("\n");
36876 }
36877 }
36878#endif
36879
36880 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000036881 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036882}
36883
36884
36885static int
36886test_xmlUCSIsGreekandCoptic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036887 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036888
36889#ifdef LIBXML_UNICODE_ENABLED
36890 int mem_base;
36891 int ret_val;
36892 int code; /* UCS code point */
36893 int n_code;
36894
36895 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36896 mem_base = xmlMemBlocks();
36897 code = gen_int(n_code, 0);
36898
36899 ret_val = xmlUCSIsGreekandCoptic(code);
36900 desret_int(ret_val);
36901 call_tests++;
36902 des_int(n_code, code, 0);
36903 xmlResetLastError();
36904 if (mem_base != xmlMemBlocks()) {
36905 printf("Leak of %d blocks found in xmlUCSIsGreekandCoptic",
36906 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036907 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036908 printf(" %d", n_code);
36909 printf("\n");
36910 }
36911 }
36912#endif
36913
36914 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000036915 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036916}
36917
36918
36919static int
36920test_xmlUCSIsGujarati(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036921 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036922
36923#ifdef LIBXML_UNICODE_ENABLED
36924 int mem_base;
36925 int ret_val;
36926 int code; /* UCS code point */
36927 int n_code;
36928
36929 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36930 mem_base = xmlMemBlocks();
36931 code = gen_int(n_code, 0);
36932
36933 ret_val = xmlUCSIsGujarati(code);
36934 desret_int(ret_val);
36935 call_tests++;
36936 des_int(n_code, code, 0);
36937 xmlResetLastError();
36938 if (mem_base != xmlMemBlocks()) {
36939 printf("Leak of %d blocks found in xmlUCSIsGujarati",
36940 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036941 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036942 printf(" %d", n_code);
36943 printf("\n");
36944 }
36945 }
36946#endif
36947
36948 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000036949 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036950}
36951
36952
36953static int
36954test_xmlUCSIsGurmukhi(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036955 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036956
36957#ifdef LIBXML_UNICODE_ENABLED
36958 int mem_base;
36959 int ret_val;
36960 int code; /* UCS code point */
36961 int n_code;
36962
36963 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36964 mem_base = xmlMemBlocks();
36965 code = gen_int(n_code, 0);
36966
36967 ret_val = xmlUCSIsGurmukhi(code);
36968 desret_int(ret_val);
36969 call_tests++;
36970 des_int(n_code, code, 0);
36971 xmlResetLastError();
36972 if (mem_base != xmlMemBlocks()) {
36973 printf("Leak of %d blocks found in xmlUCSIsGurmukhi",
36974 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036975 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036976 printf(" %d", n_code);
36977 printf("\n");
36978 }
36979 }
36980#endif
36981
36982 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000036983 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036984}
36985
36986
36987static int
36988test_xmlUCSIsHalfwidthandFullwidthForms(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036989 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036990
36991#ifdef LIBXML_UNICODE_ENABLED
36992 int mem_base;
36993 int ret_val;
36994 int code; /* UCS code point */
36995 int n_code;
36996
36997 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36998 mem_base = xmlMemBlocks();
36999 code = gen_int(n_code, 0);
37000
37001 ret_val = xmlUCSIsHalfwidthandFullwidthForms(code);
37002 desret_int(ret_val);
37003 call_tests++;
37004 des_int(n_code, code, 0);
37005 xmlResetLastError();
37006 if (mem_base != xmlMemBlocks()) {
37007 printf("Leak of %d blocks found in xmlUCSIsHalfwidthandFullwidthForms",
37008 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037009 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037010 printf(" %d", n_code);
37011 printf("\n");
37012 }
37013 }
37014#endif
37015
37016 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000037017 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037018}
37019
37020
37021static int
37022test_xmlUCSIsHangulCompatibilityJamo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037023 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037024
37025#ifdef LIBXML_UNICODE_ENABLED
37026 int mem_base;
37027 int ret_val;
37028 int code; /* UCS code point */
37029 int n_code;
37030
37031 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37032 mem_base = xmlMemBlocks();
37033 code = gen_int(n_code, 0);
37034
37035 ret_val = xmlUCSIsHangulCompatibilityJamo(code);
37036 desret_int(ret_val);
37037 call_tests++;
37038 des_int(n_code, code, 0);
37039 xmlResetLastError();
37040 if (mem_base != xmlMemBlocks()) {
37041 printf("Leak of %d blocks found in xmlUCSIsHangulCompatibilityJamo",
37042 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037043 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037044 printf(" %d", n_code);
37045 printf("\n");
37046 }
37047 }
37048#endif
37049
37050 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000037051 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037052}
37053
37054
37055static int
37056test_xmlUCSIsHangulJamo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037057 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037058
37059#ifdef LIBXML_UNICODE_ENABLED
37060 int mem_base;
37061 int ret_val;
37062 int code; /* UCS code point */
37063 int n_code;
37064
37065 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37066 mem_base = xmlMemBlocks();
37067 code = gen_int(n_code, 0);
37068
37069 ret_val = xmlUCSIsHangulJamo(code);
37070 desret_int(ret_val);
37071 call_tests++;
37072 des_int(n_code, code, 0);
37073 xmlResetLastError();
37074 if (mem_base != xmlMemBlocks()) {
37075 printf("Leak of %d blocks found in xmlUCSIsHangulJamo",
37076 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037077 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037078 printf(" %d", n_code);
37079 printf("\n");
37080 }
37081 }
37082#endif
37083
37084 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000037085 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037086}
37087
37088
37089static int
37090test_xmlUCSIsHangulSyllables(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037091 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037092
37093#ifdef LIBXML_UNICODE_ENABLED
37094 int mem_base;
37095 int ret_val;
37096 int code; /* UCS code point */
37097 int n_code;
37098
37099 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37100 mem_base = xmlMemBlocks();
37101 code = gen_int(n_code, 0);
37102
37103 ret_val = xmlUCSIsHangulSyllables(code);
37104 desret_int(ret_val);
37105 call_tests++;
37106 des_int(n_code, code, 0);
37107 xmlResetLastError();
37108 if (mem_base != xmlMemBlocks()) {
37109 printf("Leak of %d blocks found in xmlUCSIsHangulSyllables",
37110 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037111 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037112 printf(" %d", n_code);
37113 printf("\n");
37114 }
37115 }
37116#endif
37117
37118 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000037119 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037120}
37121
37122
37123static int
37124test_xmlUCSIsHanunoo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037125 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037126
37127#ifdef LIBXML_UNICODE_ENABLED
37128 int mem_base;
37129 int ret_val;
37130 int code; /* UCS code point */
37131 int n_code;
37132
37133 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37134 mem_base = xmlMemBlocks();
37135 code = gen_int(n_code, 0);
37136
37137 ret_val = xmlUCSIsHanunoo(code);
37138 desret_int(ret_val);
37139 call_tests++;
37140 des_int(n_code, code, 0);
37141 xmlResetLastError();
37142 if (mem_base != xmlMemBlocks()) {
37143 printf("Leak of %d blocks found in xmlUCSIsHanunoo",
37144 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037145 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037146 printf(" %d", n_code);
37147 printf("\n");
37148 }
37149 }
37150#endif
37151
37152 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000037153 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037154}
37155
37156
37157static int
37158test_xmlUCSIsHebrew(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037159 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037160
37161#ifdef LIBXML_UNICODE_ENABLED
37162 int mem_base;
37163 int ret_val;
37164 int code; /* UCS code point */
37165 int n_code;
37166
37167 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37168 mem_base = xmlMemBlocks();
37169 code = gen_int(n_code, 0);
37170
37171 ret_val = xmlUCSIsHebrew(code);
37172 desret_int(ret_val);
37173 call_tests++;
37174 des_int(n_code, code, 0);
37175 xmlResetLastError();
37176 if (mem_base != xmlMemBlocks()) {
37177 printf("Leak of %d blocks found in xmlUCSIsHebrew",
37178 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037179 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037180 printf(" %d", n_code);
37181 printf("\n");
37182 }
37183 }
37184#endif
37185
37186 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000037187 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037188}
37189
37190
37191static int
37192test_xmlUCSIsHighPrivateUseSurrogates(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037193 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037194
37195#ifdef LIBXML_UNICODE_ENABLED
37196 int mem_base;
37197 int ret_val;
37198 int code; /* UCS code point */
37199 int n_code;
37200
37201 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37202 mem_base = xmlMemBlocks();
37203 code = gen_int(n_code, 0);
37204
37205 ret_val = xmlUCSIsHighPrivateUseSurrogates(code);
37206 desret_int(ret_val);
37207 call_tests++;
37208 des_int(n_code, code, 0);
37209 xmlResetLastError();
37210 if (mem_base != xmlMemBlocks()) {
37211 printf("Leak of %d blocks found in xmlUCSIsHighPrivateUseSurrogates",
37212 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037213 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037214 printf(" %d", n_code);
37215 printf("\n");
37216 }
37217 }
37218#endif
37219
37220 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000037221 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037222}
37223
37224
37225static int
37226test_xmlUCSIsHighSurrogates(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037227 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037228
37229#ifdef LIBXML_UNICODE_ENABLED
37230 int mem_base;
37231 int ret_val;
37232 int code; /* UCS code point */
37233 int n_code;
37234
37235 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37236 mem_base = xmlMemBlocks();
37237 code = gen_int(n_code, 0);
37238
37239 ret_val = xmlUCSIsHighSurrogates(code);
37240 desret_int(ret_val);
37241 call_tests++;
37242 des_int(n_code, code, 0);
37243 xmlResetLastError();
37244 if (mem_base != xmlMemBlocks()) {
37245 printf("Leak of %d blocks found in xmlUCSIsHighSurrogates",
37246 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037247 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037248 printf(" %d", n_code);
37249 printf("\n");
37250 }
37251 }
37252#endif
37253
37254 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000037255 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037256}
37257
37258
37259static int
37260test_xmlUCSIsHiragana(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037261 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037262
37263#ifdef LIBXML_UNICODE_ENABLED
37264 int mem_base;
37265 int ret_val;
37266 int code; /* UCS code point */
37267 int n_code;
37268
37269 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37270 mem_base = xmlMemBlocks();
37271 code = gen_int(n_code, 0);
37272
37273 ret_val = xmlUCSIsHiragana(code);
37274 desret_int(ret_val);
37275 call_tests++;
37276 des_int(n_code, code, 0);
37277 xmlResetLastError();
37278 if (mem_base != xmlMemBlocks()) {
37279 printf("Leak of %d blocks found in xmlUCSIsHiragana",
37280 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037281 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037282 printf(" %d", n_code);
37283 printf("\n");
37284 }
37285 }
37286#endif
37287
37288 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000037289 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037290}
37291
37292
37293static int
37294test_xmlUCSIsIPAExtensions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037295 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037296
37297#ifdef LIBXML_UNICODE_ENABLED
37298 int mem_base;
37299 int ret_val;
37300 int code; /* UCS code point */
37301 int n_code;
37302
37303 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37304 mem_base = xmlMemBlocks();
37305 code = gen_int(n_code, 0);
37306
37307 ret_val = xmlUCSIsIPAExtensions(code);
37308 desret_int(ret_val);
37309 call_tests++;
37310 des_int(n_code, code, 0);
37311 xmlResetLastError();
37312 if (mem_base != xmlMemBlocks()) {
37313 printf("Leak of %d blocks found in xmlUCSIsIPAExtensions",
37314 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037315 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037316 printf(" %d", n_code);
37317 printf("\n");
37318 }
37319 }
37320#endif
37321
37322 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000037323 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037324}
37325
37326
37327static int
37328test_xmlUCSIsIdeographicDescriptionCharacters(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037329 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037330
37331#ifdef LIBXML_UNICODE_ENABLED
37332 int mem_base;
37333 int ret_val;
37334 int code; /* UCS code point */
37335 int n_code;
37336
37337 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37338 mem_base = xmlMemBlocks();
37339 code = gen_int(n_code, 0);
37340
37341 ret_val = xmlUCSIsIdeographicDescriptionCharacters(code);
37342 desret_int(ret_val);
37343 call_tests++;
37344 des_int(n_code, code, 0);
37345 xmlResetLastError();
37346 if (mem_base != xmlMemBlocks()) {
37347 printf("Leak of %d blocks found in xmlUCSIsIdeographicDescriptionCharacters",
37348 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037349 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037350 printf(" %d", n_code);
37351 printf("\n");
37352 }
37353 }
37354#endif
37355
37356 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000037357 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037358}
37359
37360
37361static int
37362test_xmlUCSIsKanbun(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037363 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037364
37365#ifdef LIBXML_UNICODE_ENABLED
37366 int mem_base;
37367 int ret_val;
37368 int code; /* UCS code point */
37369 int n_code;
37370
37371 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37372 mem_base = xmlMemBlocks();
37373 code = gen_int(n_code, 0);
37374
37375 ret_val = xmlUCSIsKanbun(code);
37376 desret_int(ret_val);
37377 call_tests++;
37378 des_int(n_code, code, 0);
37379 xmlResetLastError();
37380 if (mem_base != xmlMemBlocks()) {
37381 printf("Leak of %d blocks found in xmlUCSIsKanbun",
37382 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037383 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037384 printf(" %d", n_code);
37385 printf("\n");
37386 }
37387 }
37388#endif
37389
37390 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000037391 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037392}
37393
37394
37395static int
37396test_xmlUCSIsKangxiRadicals(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037397 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037398
37399#ifdef LIBXML_UNICODE_ENABLED
37400 int mem_base;
37401 int ret_val;
37402 int code; /* UCS code point */
37403 int n_code;
37404
37405 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37406 mem_base = xmlMemBlocks();
37407 code = gen_int(n_code, 0);
37408
37409 ret_val = xmlUCSIsKangxiRadicals(code);
37410 desret_int(ret_val);
37411 call_tests++;
37412 des_int(n_code, code, 0);
37413 xmlResetLastError();
37414 if (mem_base != xmlMemBlocks()) {
37415 printf("Leak of %d blocks found in xmlUCSIsKangxiRadicals",
37416 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037417 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037418 printf(" %d", n_code);
37419 printf("\n");
37420 }
37421 }
37422#endif
37423
37424 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000037425 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037426}
37427
37428
37429static int
37430test_xmlUCSIsKannada(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037431 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037432
37433#ifdef LIBXML_UNICODE_ENABLED
37434 int mem_base;
37435 int ret_val;
37436 int code; /* UCS code point */
37437 int n_code;
37438
37439 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37440 mem_base = xmlMemBlocks();
37441 code = gen_int(n_code, 0);
37442
37443 ret_val = xmlUCSIsKannada(code);
37444 desret_int(ret_val);
37445 call_tests++;
37446 des_int(n_code, code, 0);
37447 xmlResetLastError();
37448 if (mem_base != xmlMemBlocks()) {
37449 printf("Leak of %d blocks found in xmlUCSIsKannada",
37450 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037451 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037452 printf(" %d", n_code);
37453 printf("\n");
37454 }
37455 }
37456#endif
37457
37458 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000037459 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037460}
37461
37462
37463static int
37464test_xmlUCSIsKatakana(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037465 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037466
37467#ifdef LIBXML_UNICODE_ENABLED
37468 int mem_base;
37469 int ret_val;
37470 int code; /* UCS code point */
37471 int n_code;
37472
37473 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37474 mem_base = xmlMemBlocks();
37475 code = gen_int(n_code, 0);
37476
37477 ret_val = xmlUCSIsKatakana(code);
37478 desret_int(ret_val);
37479 call_tests++;
37480 des_int(n_code, code, 0);
37481 xmlResetLastError();
37482 if (mem_base != xmlMemBlocks()) {
37483 printf("Leak of %d blocks found in xmlUCSIsKatakana",
37484 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037485 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037486 printf(" %d", n_code);
37487 printf("\n");
37488 }
37489 }
37490#endif
37491
37492 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000037493 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037494}
37495
37496
37497static int
37498test_xmlUCSIsKatakanaPhoneticExtensions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037499 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037500
37501#ifdef LIBXML_UNICODE_ENABLED
37502 int mem_base;
37503 int ret_val;
37504 int code; /* UCS code point */
37505 int n_code;
37506
37507 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37508 mem_base = xmlMemBlocks();
37509 code = gen_int(n_code, 0);
37510
37511 ret_val = xmlUCSIsKatakanaPhoneticExtensions(code);
37512 desret_int(ret_val);
37513 call_tests++;
37514 des_int(n_code, code, 0);
37515 xmlResetLastError();
37516 if (mem_base != xmlMemBlocks()) {
37517 printf("Leak of %d blocks found in xmlUCSIsKatakanaPhoneticExtensions",
37518 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037519 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037520 printf(" %d", n_code);
37521 printf("\n");
37522 }
37523 }
37524#endif
37525
37526 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000037527 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037528}
37529
37530
37531static int
37532test_xmlUCSIsKhmer(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037533 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037534
37535#ifdef LIBXML_UNICODE_ENABLED
37536 int mem_base;
37537 int ret_val;
37538 int code; /* UCS code point */
37539 int n_code;
37540
37541 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37542 mem_base = xmlMemBlocks();
37543 code = gen_int(n_code, 0);
37544
37545 ret_val = xmlUCSIsKhmer(code);
37546 desret_int(ret_val);
37547 call_tests++;
37548 des_int(n_code, code, 0);
37549 xmlResetLastError();
37550 if (mem_base != xmlMemBlocks()) {
37551 printf("Leak of %d blocks found in xmlUCSIsKhmer",
37552 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037553 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037554 printf(" %d", n_code);
37555 printf("\n");
37556 }
37557 }
37558#endif
37559
37560 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000037561 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037562}
37563
37564
37565static int
37566test_xmlUCSIsKhmerSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037567 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037568
37569#ifdef LIBXML_UNICODE_ENABLED
37570 int mem_base;
37571 int ret_val;
37572 int code; /* UCS code point */
37573 int n_code;
37574
37575 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37576 mem_base = xmlMemBlocks();
37577 code = gen_int(n_code, 0);
37578
37579 ret_val = xmlUCSIsKhmerSymbols(code);
37580 desret_int(ret_val);
37581 call_tests++;
37582 des_int(n_code, code, 0);
37583 xmlResetLastError();
37584 if (mem_base != xmlMemBlocks()) {
37585 printf("Leak of %d blocks found in xmlUCSIsKhmerSymbols",
37586 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037587 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037588 printf(" %d", n_code);
37589 printf("\n");
37590 }
37591 }
37592#endif
37593
37594 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000037595 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037596}
37597
37598
37599static int
37600test_xmlUCSIsLao(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037601 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037602
37603#ifdef LIBXML_UNICODE_ENABLED
37604 int mem_base;
37605 int ret_val;
37606 int code; /* UCS code point */
37607 int n_code;
37608
37609 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37610 mem_base = xmlMemBlocks();
37611 code = gen_int(n_code, 0);
37612
37613 ret_val = xmlUCSIsLao(code);
37614 desret_int(ret_val);
37615 call_tests++;
37616 des_int(n_code, code, 0);
37617 xmlResetLastError();
37618 if (mem_base != xmlMemBlocks()) {
37619 printf("Leak of %d blocks found in xmlUCSIsLao",
37620 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037621 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037622 printf(" %d", n_code);
37623 printf("\n");
37624 }
37625 }
37626#endif
37627
37628 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000037629 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037630}
37631
37632
37633static int
37634test_xmlUCSIsLatin1Supplement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037635 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037636
37637#ifdef LIBXML_UNICODE_ENABLED
37638 int mem_base;
37639 int ret_val;
37640 int code; /* UCS code point */
37641 int n_code;
37642
37643 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37644 mem_base = xmlMemBlocks();
37645 code = gen_int(n_code, 0);
37646
37647 ret_val = xmlUCSIsLatin1Supplement(code);
37648 desret_int(ret_val);
37649 call_tests++;
37650 des_int(n_code, code, 0);
37651 xmlResetLastError();
37652 if (mem_base != xmlMemBlocks()) {
37653 printf("Leak of %d blocks found in xmlUCSIsLatin1Supplement",
37654 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037655 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037656 printf(" %d", n_code);
37657 printf("\n");
37658 }
37659 }
37660#endif
37661
37662 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000037663 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037664}
37665
37666
37667static int
37668test_xmlUCSIsLatinExtendedA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037669 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037670
37671#ifdef LIBXML_UNICODE_ENABLED
37672 int mem_base;
37673 int ret_val;
37674 int code; /* UCS code point */
37675 int n_code;
37676
37677 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37678 mem_base = xmlMemBlocks();
37679 code = gen_int(n_code, 0);
37680
37681 ret_val = xmlUCSIsLatinExtendedA(code);
37682 desret_int(ret_val);
37683 call_tests++;
37684 des_int(n_code, code, 0);
37685 xmlResetLastError();
37686 if (mem_base != xmlMemBlocks()) {
37687 printf("Leak of %d blocks found in xmlUCSIsLatinExtendedA",
37688 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037689 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037690 printf(" %d", n_code);
37691 printf("\n");
37692 }
37693 }
37694#endif
37695
37696 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000037697 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037698}
37699
37700
37701static int
37702test_xmlUCSIsLatinExtendedAdditional(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037703 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037704
37705#ifdef LIBXML_UNICODE_ENABLED
37706 int mem_base;
37707 int ret_val;
37708 int code; /* UCS code point */
37709 int n_code;
37710
37711 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37712 mem_base = xmlMemBlocks();
37713 code = gen_int(n_code, 0);
37714
37715 ret_val = xmlUCSIsLatinExtendedAdditional(code);
37716 desret_int(ret_val);
37717 call_tests++;
37718 des_int(n_code, code, 0);
37719 xmlResetLastError();
37720 if (mem_base != xmlMemBlocks()) {
37721 printf("Leak of %d blocks found in xmlUCSIsLatinExtendedAdditional",
37722 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037723 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037724 printf(" %d", n_code);
37725 printf("\n");
37726 }
37727 }
37728#endif
37729
37730 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000037731 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037732}
37733
37734
37735static int
37736test_xmlUCSIsLatinExtendedB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037737 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037738
37739#ifdef LIBXML_UNICODE_ENABLED
37740 int mem_base;
37741 int ret_val;
37742 int code; /* UCS code point */
37743 int n_code;
37744
37745 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37746 mem_base = xmlMemBlocks();
37747 code = gen_int(n_code, 0);
37748
37749 ret_val = xmlUCSIsLatinExtendedB(code);
37750 desret_int(ret_val);
37751 call_tests++;
37752 des_int(n_code, code, 0);
37753 xmlResetLastError();
37754 if (mem_base != xmlMemBlocks()) {
37755 printf("Leak of %d blocks found in xmlUCSIsLatinExtendedB",
37756 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037757 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037758 printf(" %d", n_code);
37759 printf("\n");
37760 }
37761 }
37762#endif
37763
37764 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000037765 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037766}
37767
37768
37769static int
37770test_xmlUCSIsLetterlikeSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037771 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037772
37773#ifdef LIBXML_UNICODE_ENABLED
37774 int mem_base;
37775 int ret_val;
37776 int code; /* UCS code point */
37777 int n_code;
37778
37779 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37780 mem_base = xmlMemBlocks();
37781 code = gen_int(n_code, 0);
37782
37783 ret_val = xmlUCSIsLetterlikeSymbols(code);
37784 desret_int(ret_val);
37785 call_tests++;
37786 des_int(n_code, code, 0);
37787 xmlResetLastError();
37788 if (mem_base != xmlMemBlocks()) {
37789 printf("Leak of %d blocks found in xmlUCSIsLetterlikeSymbols",
37790 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037791 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037792 printf(" %d", n_code);
37793 printf("\n");
37794 }
37795 }
37796#endif
37797
37798 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000037799 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037800}
37801
37802
37803static int
37804test_xmlUCSIsLimbu(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037805 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037806
37807#ifdef LIBXML_UNICODE_ENABLED
37808 int mem_base;
37809 int ret_val;
37810 int code; /* UCS code point */
37811 int n_code;
37812
37813 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37814 mem_base = xmlMemBlocks();
37815 code = gen_int(n_code, 0);
37816
37817 ret_val = xmlUCSIsLimbu(code);
37818 desret_int(ret_val);
37819 call_tests++;
37820 des_int(n_code, code, 0);
37821 xmlResetLastError();
37822 if (mem_base != xmlMemBlocks()) {
37823 printf("Leak of %d blocks found in xmlUCSIsLimbu",
37824 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037825 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037826 printf(" %d", n_code);
37827 printf("\n");
37828 }
37829 }
37830#endif
37831
37832 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000037833 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037834}
37835
37836
37837static int
37838test_xmlUCSIsLinearBIdeograms(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037839 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037840
37841#ifdef LIBXML_UNICODE_ENABLED
37842 int mem_base;
37843 int ret_val;
37844 int code; /* UCS code point */
37845 int n_code;
37846
37847 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37848 mem_base = xmlMemBlocks();
37849 code = gen_int(n_code, 0);
37850
37851 ret_val = xmlUCSIsLinearBIdeograms(code);
37852 desret_int(ret_val);
37853 call_tests++;
37854 des_int(n_code, code, 0);
37855 xmlResetLastError();
37856 if (mem_base != xmlMemBlocks()) {
37857 printf("Leak of %d blocks found in xmlUCSIsLinearBIdeograms",
37858 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037859 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037860 printf(" %d", n_code);
37861 printf("\n");
37862 }
37863 }
37864#endif
37865
37866 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000037867 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037868}
37869
37870
37871static int
37872test_xmlUCSIsLinearBSyllabary(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037873 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037874
37875#ifdef LIBXML_UNICODE_ENABLED
37876 int mem_base;
37877 int ret_val;
37878 int code; /* UCS code point */
37879 int n_code;
37880
37881 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37882 mem_base = xmlMemBlocks();
37883 code = gen_int(n_code, 0);
37884
37885 ret_val = xmlUCSIsLinearBSyllabary(code);
37886 desret_int(ret_val);
37887 call_tests++;
37888 des_int(n_code, code, 0);
37889 xmlResetLastError();
37890 if (mem_base != xmlMemBlocks()) {
37891 printf("Leak of %d blocks found in xmlUCSIsLinearBSyllabary",
37892 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037893 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037894 printf(" %d", n_code);
37895 printf("\n");
37896 }
37897 }
37898#endif
37899
37900 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000037901 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037902}
37903
37904
37905static int
37906test_xmlUCSIsLowSurrogates(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037907 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037908
37909#ifdef LIBXML_UNICODE_ENABLED
37910 int mem_base;
37911 int ret_val;
37912 int code; /* UCS code point */
37913 int n_code;
37914
37915 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37916 mem_base = xmlMemBlocks();
37917 code = gen_int(n_code, 0);
37918
37919 ret_val = xmlUCSIsLowSurrogates(code);
37920 desret_int(ret_val);
37921 call_tests++;
37922 des_int(n_code, code, 0);
37923 xmlResetLastError();
37924 if (mem_base != xmlMemBlocks()) {
37925 printf("Leak of %d blocks found in xmlUCSIsLowSurrogates",
37926 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037927 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037928 printf(" %d", n_code);
37929 printf("\n");
37930 }
37931 }
37932#endif
37933
37934 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000037935 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037936}
37937
37938
37939static int
37940test_xmlUCSIsMalayalam(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037941 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037942
37943#ifdef LIBXML_UNICODE_ENABLED
37944 int mem_base;
37945 int ret_val;
37946 int code; /* UCS code point */
37947 int n_code;
37948
37949 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37950 mem_base = xmlMemBlocks();
37951 code = gen_int(n_code, 0);
37952
37953 ret_val = xmlUCSIsMalayalam(code);
37954 desret_int(ret_val);
37955 call_tests++;
37956 des_int(n_code, code, 0);
37957 xmlResetLastError();
37958 if (mem_base != xmlMemBlocks()) {
37959 printf("Leak of %d blocks found in xmlUCSIsMalayalam",
37960 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037961 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037962 printf(" %d", n_code);
37963 printf("\n");
37964 }
37965 }
37966#endif
37967
37968 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000037969 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037970}
37971
37972
37973static int
37974test_xmlUCSIsMathematicalAlphanumericSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037975 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037976
37977#ifdef LIBXML_UNICODE_ENABLED
37978 int mem_base;
37979 int ret_val;
37980 int code; /* UCS code point */
37981 int n_code;
37982
37983 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37984 mem_base = xmlMemBlocks();
37985 code = gen_int(n_code, 0);
37986
37987 ret_val = xmlUCSIsMathematicalAlphanumericSymbols(code);
37988 desret_int(ret_val);
37989 call_tests++;
37990 des_int(n_code, code, 0);
37991 xmlResetLastError();
37992 if (mem_base != xmlMemBlocks()) {
37993 printf("Leak of %d blocks found in xmlUCSIsMathematicalAlphanumericSymbols",
37994 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037995 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037996 printf(" %d", n_code);
37997 printf("\n");
37998 }
37999 }
38000#endif
38001
38002 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000038003 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038004}
38005
38006
38007static int
38008test_xmlUCSIsMathematicalOperators(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038009 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038010
38011#ifdef LIBXML_UNICODE_ENABLED
38012 int mem_base;
38013 int ret_val;
38014 int code; /* UCS code point */
38015 int n_code;
38016
38017 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38018 mem_base = xmlMemBlocks();
38019 code = gen_int(n_code, 0);
38020
38021 ret_val = xmlUCSIsMathematicalOperators(code);
38022 desret_int(ret_val);
38023 call_tests++;
38024 des_int(n_code, code, 0);
38025 xmlResetLastError();
38026 if (mem_base != xmlMemBlocks()) {
38027 printf("Leak of %d blocks found in xmlUCSIsMathematicalOperators",
38028 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038029 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038030 printf(" %d", n_code);
38031 printf("\n");
38032 }
38033 }
38034#endif
38035
38036 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000038037 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038038}
38039
38040
38041static int
38042test_xmlUCSIsMiscellaneousMathematicalSymbolsA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038043 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038044
38045#ifdef LIBXML_UNICODE_ENABLED
38046 int mem_base;
38047 int ret_val;
38048 int code; /* UCS code point */
38049 int n_code;
38050
38051 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38052 mem_base = xmlMemBlocks();
38053 code = gen_int(n_code, 0);
38054
38055 ret_val = xmlUCSIsMiscellaneousMathematicalSymbolsA(code);
38056 desret_int(ret_val);
38057 call_tests++;
38058 des_int(n_code, code, 0);
38059 xmlResetLastError();
38060 if (mem_base != xmlMemBlocks()) {
38061 printf("Leak of %d blocks found in xmlUCSIsMiscellaneousMathematicalSymbolsA",
38062 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038063 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038064 printf(" %d", n_code);
38065 printf("\n");
38066 }
38067 }
38068#endif
38069
38070 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000038071 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038072}
38073
38074
38075static int
38076test_xmlUCSIsMiscellaneousMathematicalSymbolsB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038077 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038078
38079#ifdef LIBXML_UNICODE_ENABLED
38080 int mem_base;
38081 int ret_val;
38082 int code; /* UCS code point */
38083 int n_code;
38084
38085 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38086 mem_base = xmlMemBlocks();
38087 code = gen_int(n_code, 0);
38088
38089 ret_val = xmlUCSIsMiscellaneousMathematicalSymbolsB(code);
38090 desret_int(ret_val);
38091 call_tests++;
38092 des_int(n_code, code, 0);
38093 xmlResetLastError();
38094 if (mem_base != xmlMemBlocks()) {
38095 printf("Leak of %d blocks found in xmlUCSIsMiscellaneousMathematicalSymbolsB",
38096 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038097 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038098 printf(" %d", n_code);
38099 printf("\n");
38100 }
38101 }
38102#endif
38103
38104 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000038105 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038106}
38107
38108
38109static int
38110test_xmlUCSIsMiscellaneousSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038111 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038112
38113#ifdef LIBXML_UNICODE_ENABLED
38114 int mem_base;
38115 int ret_val;
38116 int code; /* UCS code point */
38117 int n_code;
38118
38119 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38120 mem_base = xmlMemBlocks();
38121 code = gen_int(n_code, 0);
38122
38123 ret_val = xmlUCSIsMiscellaneousSymbols(code);
38124 desret_int(ret_val);
38125 call_tests++;
38126 des_int(n_code, code, 0);
38127 xmlResetLastError();
38128 if (mem_base != xmlMemBlocks()) {
38129 printf("Leak of %d blocks found in xmlUCSIsMiscellaneousSymbols",
38130 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038131 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038132 printf(" %d", n_code);
38133 printf("\n");
38134 }
38135 }
38136#endif
38137
38138 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000038139 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038140}
38141
38142
38143static int
38144test_xmlUCSIsMiscellaneousSymbolsandArrows(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038145 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038146
38147#ifdef LIBXML_UNICODE_ENABLED
38148 int mem_base;
38149 int ret_val;
38150 int code; /* UCS code point */
38151 int n_code;
38152
38153 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38154 mem_base = xmlMemBlocks();
38155 code = gen_int(n_code, 0);
38156
38157 ret_val = xmlUCSIsMiscellaneousSymbolsandArrows(code);
38158 desret_int(ret_val);
38159 call_tests++;
38160 des_int(n_code, code, 0);
38161 xmlResetLastError();
38162 if (mem_base != xmlMemBlocks()) {
38163 printf("Leak of %d blocks found in xmlUCSIsMiscellaneousSymbolsandArrows",
38164 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038165 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038166 printf(" %d", n_code);
38167 printf("\n");
38168 }
38169 }
38170#endif
38171
38172 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000038173 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038174}
38175
38176
38177static int
38178test_xmlUCSIsMiscellaneousTechnical(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038179 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038180
38181#ifdef LIBXML_UNICODE_ENABLED
38182 int mem_base;
38183 int ret_val;
38184 int code; /* UCS code point */
38185 int n_code;
38186
38187 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38188 mem_base = xmlMemBlocks();
38189 code = gen_int(n_code, 0);
38190
38191 ret_val = xmlUCSIsMiscellaneousTechnical(code);
38192 desret_int(ret_val);
38193 call_tests++;
38194 des_int(n_code, code, 0);
38195 xmlResetLastError();
38196 if (mem_base != xmlMemBlocks()) {
38197 printf("Leak of %d blocks found in xmlUCSIsMiscellaneousTechnical",
38198 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038199 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038200 printf(" %d", n_code);
38201 printf("\n");
38202 }
38203 }
38204#endif
38205
38206 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000038207 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038208}
38209
38210
38211static int
38212test_xmlUCSIsMongolian(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038213 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038214
38215#ifdef LIBXML_UNICODE_ENABLED
38216 int mem_base;
38217 int ret_val;
38218 int code; /* UCS code point */
38219 int n_code;
38220
38221 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38222 mem_base = xmlMemBlocks();
38223 code = gen_int(n_code, 0);
38224
38225 ret_val = xmlUCSIsMongolian(code);
38226 desret_int(ret_val);
38227 call_tests++;
38228 des_int(n_code, code, 0);
38229 xmlResetLastError();
38230 if (mem_base != xmlMemBlocks()) {
38231 printf("Leak of %d blocks found in xmlUCSIsMongolian",
38232 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038233 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038234 printf(" %d", n_code);
38235 printf("\n");
38236 }
38237 }
38238#endif
38239
38240 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000038241 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038242}
38243
38244
38245static int
38246test_xmlUCSIsMusicalSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038247 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038248
38249#ifdef LIBXML_UNICODE_ENABLED
38250 int mem_base;
38251 int ret_val;
38252 int code; /* UCS code point */
38253 int n_code;
38254
38255 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38256 mem_base = xmlMemBlocks();
38257 code = gen_int(n_code, 0);
38258
38259 ret_val = xmlUCSIsMusicalSymbols(code);
38260 desret_int(ret_val);
38261 call_tests++;
38262 des_int(n_code, code, 0);
38263 xmlResetLastError();
38264 if (mem_base != xmlMemBlocks()) {
38265 printf("Leak of %d blocks found in xmlUCSIsMusicalSymbols",
38266 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038267 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038268 printf(" %d", n_code);
38269 printf("\n");
38270 }
38271 }
38272#endif
38273
38274 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000038275 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038276}
38277
38278
38279static int
38280test_xmlUCSIsMyanmar(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038281 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038282
38283#ifdef LIBXML_UNICODE_ENABLED
38284 int mem_base;
38285 int ret_val;
38286 int code; /* UCS code point */
38287 int n_code;
38288
38289 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38290 mem_base = xmlMemBlocks();
38291 code = gen_int(n_code, 0);
38292
38293 ret_val = xmlUCSIsMyanmar(code);
38294 desret_int(ret_val);
38295 call_tests++;
38296 des_int(n_code, code, 0);
38297 xmlResetLastError();
38298 if (mem_base != xmlMemBlocks()) {
38299 printf("Leak of %d blocks found in xmlUCSIsMyanmar",
38300 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038301 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038302 printf(" %d", n_code);
38303 printf("\n");
38304 }
38305 }
38306#endif
38307
38308 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000038309 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038310}
38311
38312
38313static int
38314test_xmlUCSIsNumberForms(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038315 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038316
38317#ifdef LIBXML_UNICODE_ENABLED
38318 int mem_base;
38319 int ret_val;
38320 int code; /* UCS code point */
38321 int n_code;
38322
38323 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38324 mem_base = xmlMemBlocks();
38325 code = gen_int(n_code, 0);
38326
38327 ret_val = xmlUCSIsNumberForms(code);
38328 desret_int(ret_val);
38329 call_tests++;
38330 des_int(n_code, code, 0);
38331 xmlResetLastError();
38332 if (mem_base != xmlMemBlocks()) {
38333 printf("Leak of %d blocks found in xmlUCSIsNumberForms",
38334 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038335 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038336 printf(" %d", n_code);
38337 printf("\n");
38338 }
38339 }
38340#endif
38341
38342 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000038343 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038344}
38345
38346
38347static int
38348test_xmlUCSIsOgham(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038349 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038350
38351#ifdef LIBXML_UNICODE_ENABLED
38352 int mem_base;
38353 int ret_val;
38354 int code; /* UCS code point */
38355 int n_code;
38356
38357 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38358 mem_base = xmlMemBlocks();
38359 code = gen_int(n_code, 0);
38360
38361 ret_val = xmlUCSIsOgham(code);
38362 desret_int(ret_val);
38363 call_tests++;
38364 des_int(n_code, code, 0);
38365 xmlResetLastError();
38366 if (mem_base != xmlMemBlocks()) {
38367 printf("Leak of %d blocks found in xmlUCSIsOgham",
38368 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038369 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038370 printf(" %d", n_code);
38371 printf("\n");
38372 }
38373 }
38374#endif
38375
38376 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000038377 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038378}
38379
38380
38381static int
38382test_xmlUCSIsOldItalic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038383 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038384
38385#ifdef LIBXML_UNICODE_ENABLED
38386 int mem_base;
38387 int ret_val;
38388 int code; /* UCS code point */
38389 int n_code;
38390
38391 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38392 mem_base = xmlMemBlocks();
38393 code = gen_int(n_code, 0);
38394
38395 ret_val = xmlUCSIsOldItalic(code);
38396 desret_int(ret_val);
38397 call_tests++;
38398 des_int(n_code, code, 0);
38399 xmlResetLastError();
38400 if (mem_base != xmlMemBlocks()) {
38401 printf("Leak of %d blocks found in xmlUCSIsOldItalic",
38402 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038403 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038404 printf(" %d", n_code);
38405 printf("\n");
38406 }
38407 }
38408#endif
38409
38410 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000038411 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038412}
38413
38414
38415static int
38416test_xmlUCSIsOpticalCharacterRecognition(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038417 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038418
38419#ifdef LIBXML_UNICODE_ENABLED
38420 int mem_base;
38421 int ret_val;
38422 int code; /* UCS code point */
38423 int n_code;
38424
38425 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38426 mem_base = xmlMemBlocks();
38427 code = gen_int(n_code, 0);
38428
38429 ret_val = xmlUCSIsOpticalCharacterRecognition(code);
38430 desret_int(ret_val);
38431 call_tests++;
38432 des_int(n_code, code, 0);
38433 xmlResetLastError();
38434 if (mem_base != xmlMemBlocks()) {
38435 printf("Leak of %d blocks found in xmlUCSIsOpticalCharacterRecognition",
38436 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038437 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038438 printf(" %d", n_code);
38439 printf("\n");
38440 }
38441 }
38442#endif
38443
38444 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000038445 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038446}
38447
38448
38449static int
38450test_xmlUCSIsOriya(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038451 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038452
38453#ifdef LIBXML_UNICODE_ENABLED
38454 int mem_base;
38455 int ret_val;
38456 int code; /* UCS code point */
38457 int n_code;
38458
38459 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38460 mem_base = xmlMemBlocks();
38461 code = gen_int(n_code, 0);
38462
38463 ret_val = xmlUCSIsOriya(code);
38464 desret_int(ret_val);
38465 call_tests++;
38466 des_int(n_code, code, 0);
38467 xmlResetLastError();
38468 if (mem_base != xmlMemBlocks()) {
38469 printf("Leak of %d blocks found in xmlUCSIsOriya",
38470 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038471 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038472 printf(" %d", n_code);
38473 printf("\n");
38474 }
38475 }
38476#endif
38477
38478 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000038479 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038480}
38481
38482
38483static int
38484test_xmlUCSIsOsmanya(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038485 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038486
38487#ifdef LIBXML_UNICODE_ENABLED
38488 int mem_base;
38489 int ret_val;
38490 int code; /* UCS code point */
38491 int n_code;
38492
38493 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38494 mem_base = xmlMemBlocks();
38495 code = gen_int(n_code, 0);
38496
38497 ret_val = xmlUCSIsOsmanya(code);
38498 desret_int(ret_val);
38499 call_tests++;
38500 des_int(n_code, code, 0);
38501 xmlResetLastError();
38502 if (mem_base != xmlMemBlocks()) {
38503 printf("Leak of %d blocks found in xmlUCSIsOsmanya",
38504 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038505 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038506 printf(" %d", n_code);
38507 printf("\n");
38508 }
38509 }
38510#endif
38511
38512 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000038513 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038514}
38515
38516
38517static int
38518test_xmlUCSIsPhoneticExtensions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038519 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038520
38521#ifdef LIBXML_UNICODE_ENABLED
38522 int mem_base;
38523 int ret_val;
38524 int code; /* UCS code point */
38525 int n_code;
38526
38527 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38528 mem_base = xmlMemBlocks();
38529 code = gen_int(n_code, 0);
38530
38531 ret_val = xmlUCSIsPhoneticExtensions(code);
38532 desret_int(ret_val);
38533 call_tests++;
38534 des_int(n_code, code, 0);
38535 xmlResetLastError();
38536 if (mem_base != xmlMemBlocks()) {
38537 printf("Leak of %d blocks found in xmlUCSIsPhoneticExtensions",
38538 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038539 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038540 printf(" %d", n_code);
38541 printf("\n");
38542 }
38543 }
38544#endif
38545
38546 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000038547 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038548}
38549
38550
38551static int
38552test_xmlUCSIsPrivateUse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038553 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038554
38555#ifdef LIBXML_UNICODE_ENABLED
38556 int mem_base;
38557 int ret_val;
38558 int code; /* UCS code point */
38559 int n_code;
38560
38561 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38562 mem_base = xmlMemBlocks();
38563 code = gen_int(n_code, 0);
38564
38565 ret_val = xmlUCSIsPrivateUse(code);
38566 desret_int(ret_val);
38567 call_tests++;
38568 des_int(n_code, code, 0);
38569 xmlResetLastError();
38570 if (mem_base != xmlMemBlocks()) {
38571 printf("Leak of %d blocks found in xmlUCSIsPrivateUse",
38572 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038573 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038574 printf(" %d", n_code);
38575 printf("\n");
38576 }
38577 }
38578#endif
38579
38580 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000038581 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038582}
38583
38584
38585static int
38586test_xmlUCSIsPrivateUseArea(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038587 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038588
38589#ifdef LIBXML_UNICODE_ENABLED
38590 int mem_base;
38591 int ret_val;
38592 int code; /* UCS code point */
38593 int n_code;
38594
38595 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38596 mem_base = xmlMemBlocks();
38597 code = gen_int(n_code, 0);
38598
38599 ret_val = xmlUCSIsPrivateUseArea(code);
38600 desret_int(ret_val);
38601 call_tests++;
38602 des_int(n_code, code, 0);
38603 xmlResetLastError();
38604 if (mem_base != xmlMemBlocks()) {
38605 printf("Leak of %d blocks found in xmlUCSIsPrivateUseArea",
38606 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038607 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038608 printf(" %d", n_code);
38609 printf("\n");
38610 }
38611 }
38612#endif
38613
38614 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000038615 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038616}
38617
38618
38619static int
38620test_xmlUCSIsRunic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038621 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038622
38623#ifdef LIBXML_UNICODE_ENABLED
38624 int mem_base;
38625 int ret_val;
38626 int code; /* UCS code point */
38627 int n_code;
38628
38629 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38630 mem_base = xmlMemBlocks();
38631 code = gen_int(n_code, 0);
38632
38633 ret_val = xmlUCSIsRunic(code);
38634 desret_int(ret_val);
38635 call_tests++;
38636 des_int(n_code, code, 0);
38637 xmlResetLastError();
38638 if (mem_base != xmlMemBlocks()) {
38639 printf("Leak of %d blocks found in xmlUCSIsRunic",
38640 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038641 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038642 printf(" %d", n_code);
38643 printf("\n");
38644 }
38645 }
38646#endif
38647
38648 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000038649 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038650}
38651
38652
38653static int
38654test_xmlUCSIsShavian(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038655 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038656
38657#ifdef LIBXML_UNICODE_ENABLED
38658 int mem_base;
38659 int ret_val;
38660 int code; /* UCS code point */
38661 int n_code;
38662
38663 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38664 mem_base = xmlMemBlocks();
38665 code = gen_int(n_code, 0);
38666
38667 ret_val = xmlUCSIsShavian(code);
38668 desret_int(ret_val);
38669 call_tests++;
38670 des_int(n_code, code, 0);
38671 xmlResetLastError();
38672 if (mem_base != xmlMemBlocks()) {
38673 printf("Leak of %d blocks found in xmlUCSIsShavian",
38674 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038675 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038676 printf(" %d", n_code);
38677 printf("\n");
38678 }
38679 }
38680#endif
38681
38682 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000038683 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038684}
38685
38686
38687static int
38688test_xmlUCSIsSinhala(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038689 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038690
38691#ifdef LIBXML_UNICODE_ENABLED
38692 int mem_base;
38693 int ret_val;
38694 int code; /* UCS code point */
38695 int n_code;
38696
38697 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38698 mem_base = xmlMemBlocks();
38699 code = gen_int(n_code, 0);
38700
38701 ret_val = xmlUCSIsSinhala(code);
38702 desret_int(ret_val);
38703 call_tests++;
38704 des_int(n_code, code, 0);
38705 xmlResetLastError();
38706 if (mem_base != xmlMemBlocks()) {
38707 printf("Leak of %d blocks found in xmlUCSIsSinhala",
38708 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038709 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038710 printf(" %d", n_code);
38711 printf("\n");
38712 }
38713 }
38714#endif
38715
38716 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000038717 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038718}
38719
38720
38721static int
38722test_xmlUCSIsSmallFormVariants(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038723 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038724
38725#ifdef LIBXML_UNICODE_ENABLED
38726 int mem_base;
38727 int ret_val;
38728 int code; /* UCS code point */
38729 int n_code;
38730
38731 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38732 mem_base = xmlMemBlocks();
38733 code = gen_int(n_code, 0);
38734
38735 ret_val = xmlUCSIsSmallFormVariants(code);
38736 desret_int(ret_val);
38737 call_tests++;
38738 des_int(n_code, code, 0);
38739 xmlResetLastError();
38740 if (mem_base != xmlMemBlocks()) {
38741 printf("Leak of %d blocks found in xmlUCSIsSmallFormVariants",
38742 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038743 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038744 printf(" %d", n_code);
38745 printf("\n");
38746 }
38747 }
38748#endif
38749
38750 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000038751 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038752}
38753
38754
38755static int
38756test_xmlUCSIsSpacingModifierLetters(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038757 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038758
38759#ifdef LIBXML_UNICODE_ENABLED
38760 int mem_base;
38761 int ret_val;
38762 int code; /* UCS code point */
38763 int n_code;
38764
38765 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38766 mem_base = xmlMemBlocks();
38767 code = gen_int(n_code, 0);
38768
38769 ret_val = xmlUCSIsSpacingModifierLetters(code);
38770 desret_int(ret_val);
38771 call_tests++;
38772 des_int(n_code, code, 0);
38773 xmlResetLastError();
38774 if (mem_base != xmlMemBlocks()) {
38775 printf("Leak of %d blocks found in xmlUCSIsSpacingModifierLetters",
38776 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038777 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038778 printf(" %d", n_code);
38779 printf("\n");
38780 }
38781 }
38782#endif
38783
38784 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000038785 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038786}
38787
38788
38789static int
38790test_xmlUCSIsSpecials(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038791 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038792
38793#ifdef LIBXML_UNICODE_ENABLED
38794 int mem_base;
38795 int ret_val;
38796 int code; /* UCS code point */
38797 int n_code;
38798
38799 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38800 mem_base = xmlMemBlocks();
38801 code = gen_int(n_code, 0);
38802
38803 ret_val = xmlUCSIsSpecials(code);
38804 desret_int(ret_val);
38805 call_tests++;
38806 des_int(n_code, code, 0);
38807 xmlResetLastError();
38808 if (mem_base != xmlMemBlocks()) {
38809 printf("Leak of %d blocks found in xmlUCSIsSpecials",
38810 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038811 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038812 printf(" %d", n_code);
38813 printf("\n");
38814 }
38815 }
38816#endif
38817
38818 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000038819 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038820}
38821
38822
38823static int
38824test_xmlUCSIsSuperscriptsandSubscripts(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038825 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038826
38827#ifdef LIBXML_UNICODE_ENABLED
38828 int mem_base;
38829 int ret_val;
38830 int code; /* UCS code point */
38831 int n_code;
38832
38833 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38834 mem_base = xmlMemBlocks();
38835 code = gen_int(n_code, 0);
38836
38837 ret_val = xmlUCSIsSuperscriptsandSubscripts(code);
38838 desret_int(ret_val);
38839 call_tests++;
38840 des_int(n_code, code, 0);
38841 xmlResetLastError();
38842 if (mem_base != xmlMemBlocks()) {
38843 printf("Leak of %d blocks found in xmlUCSIsSuperscriptsandSubscripts",
38844 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038845 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038846 printf(" %d", n_code);
38847 printf("\n");
38848 }
38849 }
38850#endif
38851
38852 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000038853 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038854}
38855
38856
38857static int
38858test_xmlUCSIsSupplementalArrowsA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038859 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038860
38861#ifdef LIBXML_UNICODE_ENABLED
38862 int mem_base;
38863 int ret_val;
38864 int code; /* UCS code point */
38865 int n_code;
38866
38867 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38868 mem_base = xmlMemBlocks();
38869 code = gen_int(n_code, 0);
38870
38871 ret_val = xmlUCSIsSupplementalArrowsA(code);
38872 desret_int(ret_val);
38873 call_tests++;
38874 des_int(n_code, code, 0);
38875 xmlResetLastError();
38876 if (mem_base != xmlMemBlocks()) {
38877 printf("Leak of %d blocks found in xmlUCSIsSupplementalArrowsA",
38878 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038879 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038880 printf(" %d", n_code);
38881 printf("\n");
38882 }
38883 }
38884#endif
38885
38886 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000038887 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038888}
38889
38890
38891static int
38892test_xmlUCSIsSupplementalArrowsB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038893 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038894
38895#ifdef LIBXML_UNICODE_ENABLED
38896 int mem_base;
38897 int ret_val;
38898 int code; /* UCS code point */
38899 int n_code;
38900
38901 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38902 mem_base = xmlMemBlocks();
38903 code = gen_int(n_code, 0);
38904
38905 ret_val = xmlUCSIsSupplementalArrowsB(code);
38906 desret_int(ret_val);
38907 call_tests++;
38908 des_int(n_code, code, 0);
38909 xmlResetLastError();
38910 if (mem_base != xmlMemBlocks()) {
38911 printf("Leak of %d blocks found in xmlUCSIsSupplementalArrowsB",
38912 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038913 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038914 printf(" %d", n_code);
38915 printf("\n");
38916 }
38917 }
38918#endif
38919
38920 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000038921 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038922}
38923
38924
38925static int
38926test_xmlUCSIsSupplementalMathematicalOperators(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038927 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038928
38929#ifdef LIBXML_UNICODE_ENABLED
38930 int mem_base;
38931 int ret_val;
38932 int code; /* UCS code point */
38933 int n_code;
38934
38935 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38936 mem_base = xmlMemBlocks();
38937 code = gen_int(n_code, 0);
38938
38939 ret_val = xmlUCSIsSupplementalMathematicalOperators(code);
38940 desret_int(ret_val);
38941 call_tests++;
38942 des_int(n_code, code, 0);
38943 xmlResetLastError();
38944 if (mem_base != xmlMemBlocks()) {
38945 printf("Leak of %d blocks found in xmlUCSIsSupplementalMathematicalOperators",
38946 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038947 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038948 printf(" %d", n_code);
38949 printf("\n");
38950 }
38951 }
38952#endif
38953
38954 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000038955 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038956}
38957
38958
38959static int
38960test_xmlUCSIsSupplementaryPrivateUseAreaA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038961 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038962
38963#ifdef LIBXML_UNICODE_ENABLED
38964 int mem_base;
38965 int ret_val;
38966 int code; /* UCS code point */
38967 int n_code;
38968
38969 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38970 mem_base = xmlMemBlocks();
38971 code = gen_int(n_code, 0);
38972
38973 ret_val = xmlUCSIsSupplementaryPrivateUseAreaA(code);
38974 desret_int(ret_val);
38975 call_tests++;
38976 des_int(n_code, code, 0);
38977 xmlResetLastError();
38978 if (mem_base != xmlMemBlocks()) {
38979 printf("Leak of %d blocks found in xmlUCSIsSupplementaryPrivateUseAreaA",
38980 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038981 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038982 printf(" %d", n_code);
38983 printf("\n");
38984 }
38985 }
38986#endif
38987
38988 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000038989 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038990}
38991
38992
38993static int
38994test_xmlUCSIsSupplementaryPrivateUseAreaB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038995 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038996
38997#ifdef LIBXML_UNICODE_ENABLED
38998 int mem_base;
38999 int ret_val;
39000 int code; /* UCS code point */
39001 int n_code;
39002
39003 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39004 mem_base = xmlMemBlocks();
39005 code = gen_int(n_code, 0);
39006
39007 ret_val = xmlUCSIsSupplementaryPrivateUseAreaB(code);
39008 desret_int(ret_val);
39009 call_tests++;
39010 des_int(n_code, code, 0);
39011 xmlResetLastError();
39012 if (mem_base != xmlMemBlocks()) {
39013 printf("Leak of %d blocks found in xmlUCSIsSupplementaryPrivateUseAreaB",
39014 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039015 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039016 printf(" %d", n_code);
39017 printf("\n");
39018 }
39019 }
39020#endif
39021
39022 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000039023 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039024}
39025
39026
39027static int
39028test_xmlUCSIsSyriac(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039029 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039030
39031#ifdef LIBXML_UNICODE_ENABLED
39032 int mem_base;
39033 int ret_val;
39034 int code; /* UCS code point */
39035 int n_code;
39036
39037 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39038 mem_base = xmlMemBlocks();
39039 code = gen_int(n_code, 0);
39040
39041 ret_val = xmlUCSIsSyriac(code);
39042 desret_int(ret_val);
39043 call_tests++;
39044 des_int(n_code, code, 0);
39045 xmlResetLastError();
39046 if (mem_base != xmlMemBlocks()) {
39047 printf("Leak of %d blocks found in xmlUCSIsSyriac",
39048 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039049 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039050 printf(" %d", n_code);
39051 printf("\n");
39052 }
39053 }
39054#endif
39055
39056 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000039057 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039058}
39059
39060
39061static int
39062test_xmlUCSIsTagalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039063 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039064
39065#ifdef LIBXML_UNICODE_ENABLED
39066 int mem_base;
39067 int ret_val;
39068 int code; /* UCS code point */
39069 int n_code;
39070
39071 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39072 mem_base = xmlMemBlocks();
39073 code = gen_int(n_code, 0);
39074
39075 ret_val = xmlUCSIsTagalog(code);
39076 desret_int(ret_val);
39077 call_tests++;
39078 des_int(n_code, code, 0);
39079 xmlResetLastError();
39080 if (mem_base != xmlMemBlocks()) {
39081 printf("Leak of %d blocks found in xmlUCSIsTagalog",
39082 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039083 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039084 printf(" %d", n_code);
39085 printf("\n");
39086 }
39087 }
39088#endif
39089
39090 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000039091 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039092}
39093
39094
39095static int
39096test_xmlUCSIsTagbanwa(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039097 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039098
39099#ifdef LIBXML_UNICODE_ENABLED
39100 int mem_base;
39101 int ret_val;
39102 int code; /* UCS code point */
39103 int n_code;
39104
39105 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39106 mem_base = xmlMemBlocks();
39107 code = gen_int(n_code, 0);
39108
39109 ret_val = xmlUCSIsTagbanwa(code);
39110 desret_int(ret_val);
39111 call_tests++;
39112 des_int(n_code, code, 0);
39113 xmlResetLastError();
39114 if (mem_base != xmlMemBlocks()) {
39115 printf("Leak of %d blocks found in xmlUCSIsTagbanwa",
39116 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039117 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039118 printf(" %d", n_code);
39119 printf("\n");
39120 }
39121 }
39122#endif
39123
39124 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000039125 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039126}
39127
39128
39129static int
39130test_xmlUCSIsTags(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039131 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039132
39133#ifdef LIBXML_UNICODE_ENABLED
39134 int mem_base;
39135 int ret_val;
39136 int code; /* UCS code point */
39137 int n_code;
39138
39139 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39140 mem_base = xmlMemBlocks();
39141 code = gen_int(n_code, 0);
39142
39143 ret_val = xmlUCSIsTags(code);
39144 desret_int(ret_val);
39145 call_tests++;
39146 des_int(n_code, code, 0);
39147 xmlResetLastError();
39148 if (mem_base != xmlMemBlocks()) {
39149 printf("Leak of %d blocks found in xmlUCSIsTags",
39150 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039151 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039152 printf(" %d", n_code);
39153 printf("\n");
39154 }
39155 }
39156#endif
39157
39158 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000039159 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039160}
39161
39162
39163static int
39164test_xmlUCSIsTaiLe(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039165 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039166
39167#ifdef LIBXML_UNICODE_ENABLED
39168 int mem_base;
39169 int ret_val;
39170 int code; /* UCS code point */
39171 int n_code;
39172
39173 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39174 mem_base = xmlMemBlocks();
39175 code = gen_int(n_code, 0);
39176
39177 ret_val = xmlUCSIsTaiLe(code);
39178 desret_int(ret_val);
39179 call_tests++;
39180 des_int(n_code, code, 0);
39181 xmlResetLastError();
39182 if (mem_base != xmlMemBlocks()) {
39183 printf("Leak of %d blocks found in xmlUCSIsTaiLe",
39184 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039185 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039186 printf(" %d", n_code);
39187 printf("\n");
39188 }
39189 }
39190#endif
39191
39192 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000039193 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039194}
39195
39196
39197static int
39198test_xmlUCSIsTaiXuanJingSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039199 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039200
39201#ifdef LIBXML_UNICODE_ENABLED
39202 int mem_base;
39203 int ret_val;
39204 int code; /* UCS code point */
39205 int n_code;
39206
39207 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39208 mem_base = xmlMemBlocks();
39209 code = gen_int(n_code, 0);
39210
39211 ret_val = xmlUCSIsTaiXuanJingSymbols(code);
39212 desret_int(ret_val);
39213 call_tests++;
39214 des_int(n_code, code, 0);
39215 xmlResetLastError();
39216 if (mem_base != xmlMemBlocks()) {
39217 printf("Leak of %d blocks found in xmlUCSIsTaiXuanJingSymbols",
39218 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039219 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039220 printf(" %d", n_code);
39221 printf("\n");
39222 }
39223 }
39224#endif
39225
39226 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000039227 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039228}
39229
39230
39231static int
39232test_xmlUCSIsTamil(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039233 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039234
39235#ifdef LIBXML_UNICODE_ENABLED
39236 int mem_base;
39237 int ret_val;
39238 int code; /* UCS code point */
39239 int n_code;
39240
39241 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39242 mem_base = xmlMemBlocks();
39243 code = gen_int(n_code, 0);
39244
39245 ret_val = xmlUCSIsTamil(code);
39246 desret_int(ret_val);
39247 call_tests++;
39248 des_int(n_code, code, 0);
39249 xmlResetLastError();
39250 if (mem_base != xmlMemBlocks()) {
39251 printf("Leak of %d blocks found in xmlUCSIsTamil",
39252 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039253 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039254 printf(" %d", n_code);
39255 printf("\n");
39256 }
39257 }
39258#endif
39259
39260 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000039261 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039262}
39263
39264
39265static int
39266test_xmlUCSIsTelugu(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039267 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039268
39269#ifdef LIBXML_UNICODE_ENABLED
39270 int mem_base;
39271 int ret_val;
39272 int code; /* UCS code point */
39273 int n_code;
39274
39275 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39276 mem_base = xmlMemBlocks();
39277 code = gen_int(n_code, 0);
39278
39279 ret_val = xmlUCSIsTelugu(code);
39280 desret_int(ret_val);
39281 call_tests++;
39282 des_int(n_code, code, 0);
39283 xmlResetLastError();
39284 if (mem_base != xmlMemBlocks()) {
39285 printf("Leak of %d blocks found in xmlUCSIsTelugu",
39286 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039287 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039288 printf(" %d", n_code);
39289 printf("\n");
39290 }
39291 }
39292#endif
39293
39294 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000039295 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039296}
39297
39298
39299static int
39300test_xmlUCSIsThaana(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039301 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039302
39303#ifdef LIBXML_UNICODE_ENABLED
39304 int mem_base;
39305 int ret_val;
39306 int code; /* UCS code point */
39307 int n_code;
39308
39309 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39310 mem_base = xmlMemBlocks();
39311 code = gen_int(n_code, 0);
39312
39313 ret_val = xmlUCSIsThaana(code);
39314 desret_int(ret_val);
39315 call_tests++;
39316 des_int(n_code, code, 0);
39317 xmlResetLastError();
39318 if (mem_base != xmlMemBlocks()) {
39319 printf("Leak of %d blocks found in xmlUCSIsThaana",
39320 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039321 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039322 printf(" %d", n_code);
39323 printf("\n");
39324 }
39325 }
39326#endif
39327
39328 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000039329 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039330}
39331
39332
39333static int
39334test_xmlUCSIsThai(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039335 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039336
39337#ifdef LIBXML_UNICODE_ENABLED
39338 int mem_base;
39339 int ret_val;
39340 int code; /* UCS code point */
39341 int n_code;
39342
39343 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39344 mem_base = xmlMemBlocks();
39345 code = gen_int(n_code, 0);
39346
39347 ret_val = xmlUCSIsThai(code);
39348 desret_int(ret_val);
39349 call_tests++;
39350 des_int(n_code, code, 0);
39351 xmlResetLastError();
39352 if (mem_base != xmlMemBlocks()) {
39353 printf("Leak of %d blocks found in xmlUCSIsThai",
39354 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039355 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039356 printf(" %d", n_code);
39357 printf("\n");
39358 }
39359 }
39360#endif
39361
39362 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000039363 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039364}
39365
39366
39367static int
39368test_xmlUCSIsTibetan(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039369 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039370
39371#ifdef LIBXML_UNICODE_ENABLED
39372 int mem_base;
39373 int ret_val;
39374 int code; /* UCS code point */
39375 int n_code;
39376
39377 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39378 mem_base = xmlMemBlocks();
39379 code = gen_int(n_code, 0);
39380
39381 ret_val = xmlUCSIsTibetan(code);
39382 desret_int(ret_val);
39383 call_tests++;
39384 des_int(n_code, code, 0);
39385 xmlResetLastError();
39386 if (mem_base != xmlMemBlocks()) {
39387 printf("Leak of %d blocks found in xmlUCSIsTibetan",
39388 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039389 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039390 printf(" %d", n_code);
39391 printf("\n");
39392 }
39393 }
39394#endif
39395
39396 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000039397 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039398}
39399
39400
39401static int
39402test_xmlUCSIsUgaritic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039403 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039404
39405#ifdef LIBXML_UNICODE_ENABLED
39406 int mem_base;
39407 int ret_val;
39408 int code; /* UCS code point */
39409 int n_code;
39410
39411 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39412 mem_base = xmlMemBlocks();
39413 code = gen_int(n_code, 0);
39414
39415 ret_val = xmlUCSIsUgaritic(code);
39416 desret_int(ret_val);
39417 call_tests++;
39418 des_int(n_code, code, 0);
39419 xmlResetLastError();
39420 if (mem_base != xmlMemBlocks()) {
39421 printf("Leak of %d blocks found in xmlUCSIsUgaritic",
39422 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039423 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039424 printf(" %d", n_code);
39425 printf("\n");
39426 }
39427 }
39428#endif
39429
39430 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000039431 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039432}
39433
39434
39435static int
39436test_xmlUCSIsUnifiedCanadianAboriginalSyllabics(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039437 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039438
39439#ifdef LIBXML_UNICODE_ENABLED
39440 int mem_base;
39441 int ret_val;
39442 int code; /* UCS code point */
39443 int n_code;
39444
39445 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39446 mem_base = xmlMemBlocks();
39447 code = gen_int(n_code, 0);
39448
39449 ret_val = xmlUCSIsUnifiedCanadianAboriginalSyllabics(code);
39450 desret_int(ret_val);
39451 call_tests++;
39452 des_int(n_code, code, 0);
39453 xmlResetLastError();
39454 if (mem_base != xmlMemBlocks()) {
39455 printf("Leak of %d blocks found in xmlUCSIsUnifiedCanadianAboriginalSyllabics",
39456 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039457 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039458 printf(" %d", n_code);
39459 printf("\n");
39460 }
39461 }
39462#endif
39463
39464 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000039465 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039466}
39467
39468
39469static int
39470test_xmlUCSIsVariationSelectors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039471 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039472
39473#ifdef LIBXML_UNICODE_ENABLED
39474 int mem_base;
39475 int ret_val;
39476 int code; /* UCS code point */
39477 int n_code;
39478
39479 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39480 mem_base = xmlMemBlocks();
39481 code = gen_int(n_code, 0);
39482
39483 ret_val = xmlUCSIsVariationSelectors(code);
39484 desret_int(ret_val);
39485 call_tests++;
39486 des_int(n_code, code, 0);
39487 xmlResetLastError();
39488 if (mem_base != xmlMemBlocks()) {
39489 printf("Leak of %d blocks found in xmlUCSIsVariationSelectors",
39490 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039491 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039492 printf(" %d", n_code);
39493 printf("\n");
39494 }
39495 }
39496#endif
39497
39498 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000039499 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039500}
39501
39502
39503static int
39504test_xmlUCSIsVariationSelectorsSupplement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039505 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039506
39507#ifdef LIBXML_UNICODE_ENABLED
39508 int mem_base;
39509 int ret_val;
39510 int code; /* UCS code point */
39511 int n_code;
39512
39513 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39514 mem_base = xmlMemBlocks();
39515 code = gen_int(n_code, 0);
39516
39517 ret_val = xmlUCSIsVariationSelectorsSupplement(code);
39518 desret_int(ret_val);
39519 call_tests++;
39520 des_int(n_code, code, 0);
39521 xmlResetLastError();
39522 if (mem_base != xmlMemBlocks()) {
39523 printf("Leak of %d blocks found in xmlUCSIsVariationSelectorsSupplement",
39524 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039525 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039526 printf(" %d", n_code);
39527 printf("\n");
39528 }
39529 }
39530#endif
39531
39532 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000039533 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039534}
39535
39536
39537static int
39538test_xmlUCSIsYiRadicals(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039539 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039540
39541#ifdef LIBXML_UNICODE_ENABLED
39542 int mem_base;
39543 int ret_val;
39544 int code; /* UCS code point */
39545 int n_code;
39546
39547 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39548 mem_base = xmlMemBlocks();
39549 code = gen_int(n_code, 0);
39550
39551 ret_val = xmlUCSIsYiRadicals(code);
39552 desret_int(ret_val);
39553 call_tests++;
39554 des_int(n_code, code, 0);
39555 xmlResetLastError();
39556 if (mem_base != xmlMemBlocks()) {
39557 printf("Leak of %d blocks found in xmlUCSIsYiRadicals",
39558 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039559 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039560 printf(" %d", n_code);
39561 printf("\n");
39562 }
39563 }
39564#endif
39565
39566 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000039567 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039568}
39569
39570
39571static int
39572test_xmlUCSIsYiSyllables(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039573 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039574
39575#ifdef LIBXML_UNICODE_ENABLED
39576 int mem_base;
39577 int ret_val;
39578 int code; /* UCS code point */
39579 int n_code;
39580
39581 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39582 mem_base = xmlMemBlocks();
39583 code = gen_int(n_code, 0);
39584
39585 ret_val = xmlUCSIsYiSyllables(code);
39586 desret_int(ret_val);
39587 call_tests++;
39588 des_int(n_code, code, 0);
39589 xmlResetLastError();
39590 if (mem_base != xmlMemBlocks()) {
39591 printf("Leak of %d blocks found in xmlUCSIsYiSyllables",
39592 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039593 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039594 printf(" %d", n_code);
39595 printf("\n");
39596 }
39597 }
39598#endif
39599
39600 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000039601 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039602}
39603
39604
39605static int
39606test_xmlUCSIsYijingHexagramSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039607 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039608
39609#ifdef LIBXML_UNICODE_ENABLED
39610 int mem_base;
39611 int ret_val;
39612 int code; /* UCS code point */
39613 int n_code;
39614
39615 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39616 mem_base = xmlMemBlocks();
39617 code = gen_int(n_code, 0);
39618
39619 ret_val = xmlUCSIsYijingHexagramSymbols(code);
39620 desret_int(ret_val);
39621 call_tests++;
39622 des_int(n_code, code, 0);
39623 xmlResetLastError();
39624 if (mem_base != xmlMemBlocks()) {
39625 printf("Leak of %d blocks found in xmlUCSIsYijingHexagramSymbols",
39626 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039627 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039628 printf(" %d", n_code);
39629 printf("\n");
39630 }
39631 }
39632#endif
39633
39634 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000039635 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039636}
39637
39638static int
39639test_xmlunicode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039640 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039641
39642 printf("Testing xmlunicode : 166 of 166 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000039643 test_ret += test_xmlUCSIsAegeanNumbers();
39644 test_ret += test_xmlUCSIsAlphabeticPresentationForms();
39645 test_ret += test_xmlUCSIsArabic();
39646 test_ret += test_xmlUCSIsArabicPresentationFormsA();
39647 test_ret += test_xmlUCSIsArabicPresentationFormsB();
39648 test_ret += test_xmlUCSIsArmenian();
39649 test_ret += test_xmlUCSIsArrows();
39650 test_ret += test_xmlUCSIsBasicLatin();
39651 test_ret += test_xmlUCSIsBengali();
39652 test_ret += test_xmlUCSIsBlock();
39653 test_ret += test_xmlUCSIsBlockElements();
39654 test_ret += test_xmlUCSIsBopomofo();
39655 test_ret += test_xmlUCSIsBopomofoExtended();
39656 test_ret += test_xmlUCSIsBoxDrawing();
39657 test_ret += test_xmlUCSIsBraillePatterns();
39658 test_ret += test_xmlUCSIsBuhid();
39659 test_ret += test_xmlUCSIsByzantineMusicalSymbols();
39660 test_ret += test_xmlUCSIsCJKCompatibility();
39661 test_ret += test_xmlUCSIsCJKCompatibilityForms();
39662 test_ret += test_xmlUCSIsCJKCompatibilityIdeographs();
39663 test_ret += test_xmlUCSIsCJKCompatibilityIdeographsSupplement();
39664 test_ret += test_xmlUCSIsCJKRadicalsSupplement();
39665 test_ret += test_xmlUCSIsCJKSymbolsandPunctuation();
39666 test_ret += test_xmlUCSIsCJKUnifiedIdeographs();
39667 test_ret += test_xmlUCSIsCJKUnifiedIdeographsExtensionA();
39668 test_ret += test_xmlUCSIsCJKUnifiedIdeographsExtensionB();
39669 test_ret += test_xmlUCSIsCat();
39670 test_ret += test_xmlUCSIsCatC();
39671 test_ret += test_xmlUCSIsCatCc();
39672 test_ret += test_xmlUCSIsCatCf();
39673 test_ret += test_xmlUCSIsCatCo();
39674 test_ret += test_xmlUCSIsCatCs();
39675 test_ret += test_xmlUCSIsCatL();
39676 test_ret += test_xmlUCSIsCatLl();
39677 test_ret += test_xmlUCSIsCatLm();
39678 test_ret += test_xmlUCSIsCatLo();
39679 test_ret += test_xmlUCSIsCatLt();
39680 test_ret += test_xmlUCSIsCatLu();
39681 test_ret += test_xmlUCSIsCatM();
39682 test_ret += test_xmlUCSIsCatMc();
39683 test_ret += test_xmlUCSIsCatMe();
39684 test_ret += test_xmlUCSIsCatMn();
39685 test_ret += test_xmlUCSIsCatN();
39686 test_ret += test_xmlUCSIsCatNd();
39687 test_ret += test_xmlUCSIsCatNl();
39688 test_ret += test_xmlUCSIsCatNo();
39689 test_ret += test_xmlUCSIsCatP();
39690 test_ret += test_xmlUCSIsCatPc();
39691 test_ret += test_xmlUCSIsCatPd();
39692 test_ret += test_xmlUCSIsCatPe();
39693 test_ret += test_xmlUCSIsCatPf();
39694 test_ret += test_xmlUCSIsCatPi();
39695 test_ret += test_xmlUCSIsCatPo();
39696 test_ret += test_xmlUCSIsCatPs();
39697 test_ret += test_xmlUCSIsCatS();
39698 test_ret += test_xmlUCSIsCatSc();
39699 test_ret += test_xmlUCSIsCatSk();
39700 test_ret += test_xmlUCSIsCatSm();
39701 test_ret += test_xmlUCSIsCatSo();
39702 test_ret += test_xmlUCSIsCatZ();
39703 test_ret += test_xmlUCSIsCatZl();
39704 test_ret += test_xmlUCSIsCatZp();
39705 test_ret += test_xmlUCSIsCatZs();
39706 test_ret += test_xmlUCSIsCherokee();
39707 test_ret += test_xmlUCSIsCombiningDiacriticalMarks();
39708 test_ret += test_xmlUCSIsCombiningDiacriticalMarksforSymbols();
39709 test_ret += test_xmlUCSIsCombiningHalfMarks();
39710 test_ret += test_xmlUCSIsCombiningMarksforSymbols();
39711 test_ret += test_xmlUCSIsControlPictures();
39712 test_ret += test_xmlUCSIsCurrencySymbols();
39713 test_ret += test_xmlUCSIsCypriotSyllabary();
39714 test_ret += test_xmlUCSIsCyrillic();
39715 test_ret += test_xmlUCSIsCyrillicSupplement();
39716 test_ret += test_xmlUCSIsDeseret();
39717 test_ret += test_xmlUCSIsDevanagari();
39718 test_ret += test_xmlUCSIsDingbats();
39719 test_ret += test_xmlUCSIsEnclosedAlphanumerics();
39720 test_ret += test_xmlUCSIsEnclosedCJKLettersandMonths();
39721 test_ret += test_xmlUCSIsEthiopic();
39722 test_ret += test_xmlUCSIsGeneralPunctuation();
39723 test_ret += test_xmlUCSIsGeometricShapes();
39724 test_ret += test_xmlUCSIsGeorgian();
39725 test_ret += test_xmlUCSIsGothic();
39726 test_ret += test_xmlUCSIsGreek();
39727 test_ret += test_xmlUCSIsGreekExtended();
39728 test_ret += test_xmlUCSIsGreekandCoptic();
39729 test_ret += test_xmlUCSIsGujarati();
39730 test_ret += test_xmlUCSIsGurmukhi();
39731 test_ret += test_xmlUCSIsHalfwidthandFullwidthForms();
39732 test_ret += test_xmlUCSIsHangulCompatibilityJamo();
39733 test_ret += test_xmlUCSIsHangulJamo();
39734 test_ret += test_xmlUCSIsHangulSyllables();
39735 test_ret += test_xmlUCSIsHanunoo();
39736 test_ret += test_xmlUCSIsHebrew();
39737 test_ret += test_xmlUCSIsHighPrivateUseSurrogates();
39738 test_ret += test_xmlUCSIsHighSurrogates();
39739 test_ret += test_xmlUCSIsHiragana();
39740 test_ret += test_xmlUCSIsIPAExtensions();
39741 test_ret += test_xmlUCSIsIdeographicDescriptionCharacters();
39742 test_ret += test_xmlUCSIsKanbun();
39743 test_ret += test_xmlUCSIsKangxiRadicals();
39744 test_ret += test_xmlUCSIsKannada();
39745 test_ret += test_xmlUCSIsKatakana();
39746 test_ret += test_xmlUCSIsKatakanaPhoneticExtensions();
39747 test_ret += test_xmlUCSIsKhmer();
39748 test_ret += test_xmlUCSIsKhmerSymbols();
39749 test_ret += test_xmlUCSIsLao();
39750 test_ret += test_xmlUCSIsLatin1Supplement();
39751 test_ret += test_xmlUCSIsLatinExtendedA();
39752 test_ret += test_xmlUCSIsLatinExtendedAdditional();
39753 test_ret += test_xmlUCSIsLatinExtendedB();
39754 test_ret += test_xmlUCSIsLetterlikeSymbols();
39755 test_ret += test_xmlUCSIsLimbu();
39756 test_ret += test_xmlUCSIsLinearBIdeograms();
39757 test_ret += test_xmlUCSIsLinearBSyllabary();
39758 test_ret += test_xmlUCSIsLowSurrogates();
39759 test_ret += test_xmlUCSIsMalayalam();
39760 test_ret += test_xmlUCSIsMathematicalAlphanumericSymbols();
39761 test_ret += test_xmlUCSIsMathematicalOperators();
39762 test_ret += test_xmlUCSIsMiscellaneousMathematicalSymbolsA();
39763 test_ret += test_xmlUCSIsMiscellaneousMathematicalSymbolsB();
39764 test_ret += test_xmlUCSIsMiscellaneousSymbols();
39765 test_ret += test_xmlUCSIsMiscellaneousSymbolsandArrows();
39766 test_ret += test_xmlUCSIsMiscellaneousTechnical();
39767 test_ret += test_xmlUCSIsMongolian();
39768 test_ret += test_xmlUCSIsMusicalSymbols();
39769 test_ret += test_xmlUCSIsMyanmar();
39770 test_ret += test_xmlUCSIsNumberForms();
39771 test_ret += test_xmlUCSIsOgham();
39772 test_ret += test_xmlUCSIsOldItalic();
39773 test_ret += test_xmlUCSIsOpticalCharacterRecognition();
39774 test_ret += test_xmlUCSIsOriya();
39775 test_ret += test_xmlUCSIsOsmanya();
39776 test_ret += test_xmlUCSIsPhoneticExtensions();
39777 test_ret += test_xmlUCSIsPrivateUse();
39778 test_ret += test_xmlUCSIsPrivateUseArea();
39779 test_ret += test_xmlUCSIsRunic();
39780 test_ret += test_xmlUCSIsShavian();
39781 test_ret += test_xmlUCSIsSinhala();
39782 test_ret += test_xmlUCSIsSmallFormVariants();
39783 test_ret += test_xmlUCSIsSpacingModifierLetters();
39784 test_ret += test_xmlUCSIsSpecials();
39785 test_ret += test_xmlUCSIsSuperscriptsandSubscripts();
39786 test_ret += test_xmlUCSIsSupplementalArrowsA();
39787 test_ret += test_xmlUCSIsSupplementalArrowsB();
39788 test_ret += test_xmlUCSIsSupplementalMathematicalOperators();
39789 test_ret += test_xmlUCSIsSupplementaryPrivateUseAreaA();
39790 test_ret += test_xmlUCSIsSupplementaryPrivateUseAreaB();
39791 test_ret += test_xmlUCSIsSyriac();
39792 test_ret += test_xmlUCSIsTagalog();
39793 test_ret += test_xmlUCSIsTagbanwa();
39794 test_ret += test_xmlUCSIsTags();
39795 test_ret += test_xmlUCSIsTaiLe();
39796 test_ret += test_xmlUCSIsTaiXuanJingSymbols();
39797 test_ret += test_xmlUCSIsTamil();
39798 test_ret += test_xmlUCSIsTelugu();
39799 test_ret += test_xmlUCSIsThaana();
39800 test_ret += test_xmlUCSIsThai();
39801 test_ret += test_xmlUCSIsTibetan();
39802 test_ret += test_xmlUCSIsUgaritic();
39803 test_ret += test_xmlUCSIsUnifiedCanadianAboriginalSyllabics();
39804 test_ret += test_xmlUCSIsVariationSelectors();
39805 test_ret += test_xmlUCSIsVariationSelectorsSupplement();
39806 test_ret += test_xmlUCSIsYiRadicals();
39807 test_ret += test_xmlUCSIsYiSyllables();
39808 test_ret += test_xmlUCSIsYijingHexagramSymbols();
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039809
Daniel Veillard42595322004-11-08 10:52:06 +000039810 if (test_ret != 0)
39811 printf("Module xmlunicode: %d errors\n", test_ret);
39812 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039813}
39814
39815static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000039816test_xmlNewTextWriter(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039817 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039818
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039819#ifdef LIBXML_WRITER_ENABLED
39820 int mem_base;
39821 xmlTextWriterPtr ret_val;
39822 xmlOutputBufferPtr out; /* an xmlOutputBufferPtr */
39823 int n_out;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039824
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039825 for (n_out = 0;n_out < gen_nb_xmlOutputBufferPtr;n_out++) {
39826 mem_base = xmlMemBlocks();
39827 out = gen_xmlOutputBufferPtr(n_out, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000039828
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039829 ret_val = xmlNewTextWriter(out);
39830 if (ret_val != NULL) out = NULL;
39831 desret_xmlTextWriterPtr(ret_val);
39832 call_tests++;
39833 des_xmlOutputBufferPtr(n_out, out, 0);
39834 xmlResetLastError();
39835 if (mem_base != xmlMemBlocks()) {
39836 printf("Leak of %d blocks found in xmlNewTextWriter",
39837 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039838 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039839 printf(" %d", n_out);
39840 printf("\n");
39841 }
39842 }
39843#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000039844
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039845 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000039846 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000039847}
39848
39849
39850static int
39851test_xmlNewTextWriterFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039852 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039853
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039854#ifdef LIBXML_WRITER_ENABLED
39855 int mem_base;
39856 xmlTextWriterPtr ret_val;
39857 const char * uri; /* the URI of the resource for the output */
39858 int n_uri;
39859 int compression; /* compress the output? */
39860 int n_compression;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039861
Daniel Veillard42595322004-11-08 10:52:06 +000039862 for (n_uri = 0;n_uri < gen_nb_fileoutput;n_uri++) {
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039863 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
39864 mem_base = xmlMemBlocks();
Daniel Veillard42595322004-11-08 10:52:06 +000039865 uri = gen_fileoutput(n_uri, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039866 compression = gen_int(n_compression, 1);
39867
39868 ret_val = xmlNewTextWriterFilename(uri, compression);
39869 desret_xmlTextWriterPtr(ret_val);
39870 call_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000039871 des_fileoutput(n_uri, uri, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039872 des_int(n_compression, compression, 1);
39873 xmlResetLastError();
39874 if (mem_base != xmlMemBlocks()) {
39875 printf("Leak of %d blocks found in xmlNewTextWriterFilename",
39876 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039877 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039878 printf(" %d", n_uri);
39879 printf(" %d", n_compression);
39880 printf("\n");
39881 }
39882 }
39883 }
39884#endif
39885
39886 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000039887 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000039888}
39889
39890
39891static int
39892test_xmlNewTextWriterMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039893 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039894
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039895#ifdef LIBXML_WRITER_ENABLED
39896 int mem_base;
39897 xmlTextWriterPtr ret_val;
39898 xmlBufferPtr buf; /* xmlBufferPtr */
39899 int n_buf;
39900 int compression; /* compress the output? */
39901 int n_compression;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039902
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039903 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
39904 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
39905 mem_base = xmlMemBlocks();
39906 buf = gen_xmlBufferPtr(n_buf, 0);
39907 compression = gen_int(n_compression, 1);
39908
39909 ret_val = xmlNewTextWriterMemory(buf, compression);
39910 desret_xmlTextWriterPtr(ret_val);
39911 call_tests++;
39912 des_xmlBufferPtr(n_buf, buf, 0);
39913 des_int(n_compression, compression, 1);
39914 xmlResetLastError();
39915 if (mem_base != xmlMemBlocks()) {
39916 printf("Leak of %d blocks found in xmlNewTextWriterMemory",
39917 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039918 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039919 printf(" %d", n_buf);
39920 printf(" %d", n_compression);
39921 printf("\n");
39922 }
39923 }
39924 }
39925#endif
39926
39927 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000039928 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000039929}
39930
39931
39932static int
39933test_xmlNewTextWriterPushParser(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039934 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039935
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039936#ifdef LIBXML_WRITER_ENABLED
39937 int mem_base;
39938 xmlTextWriterPtr ret_val;
39939 xmlParserCtxtPtr ctxt; /* xmlParserCtxtPtr to hold the new XML document tree */
39940 int n_ctxt;
39941 int compression; /* compress the output? */
39942 int n_compression;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039943
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039944 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
39945 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
39946 mem_base = xmlMemBlocks();
39947 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
39948 compression = gen_int(n_compression, 1);
39949
39950 ret_val = xmlNewTextWriterPushParser(ctxt, compression);
Daniel Veillarda521d282004-11-09 14:59:59 +000039951 if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;} if (ret_val != NULL) ctxt = NULL;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039952 desret_xmlTextWriterPtr(ret_val);
39953 call_tests++;
39954 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
39955 des_int(n_compression, compression, 1);
39956 xmlResetLastError();
39957 if (mem_base != xmlMemBlocks()) {
39958 printf("Leak of %d blocks found in xmlNewTextWriterPushParser",
39959 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039960 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039961 printf(" %d", n_ctxt);
39962 printf(" %d", n_compression);
39963 printf("\n");
39964 }
39965 }
39966 }
39967#endif
39968
39969 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000039970 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000039971}
39972
39973
39974static int
39975test_xmlNewTextWriterTree(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039976 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039977
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039978#ifdef LIBXML_WRITER_ENABLED
39979 int mem_base;
39980 xmlTextWriterPtr ret_val;
39981 xmlDocPtr doc; /* xmlDocPtr */
39982 int n_doc;
39983 xmlNodePtr node; /* xmlNodePtr or NULL for doc->children */
39984 int n_node;
39985 int compression; /* compress the output? */
39986 int n_compression;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039987
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039988 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
39989 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
39990 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
39991 mem_base = xmlMemBlocks();
39992 doc = gen_xmlDocPtr(n_doc, 0);
39993 node = gen_xmlNodePtr(n_node, 1);
39994 compression = gen_int(n_compression, 2);
39995
39996 ret_val = xmlNewTextWriterTree(doc, node, compression);
39997 desret_xmlTextWriterPtr(ret_val);
39998 call_tests++;
39999 des_xmlDocPtr(n_doc, doc, 0);
40000 des_xmlNodePtr(n_node, node, 1);
40001 des_int(n_compression, compression, 2);
40002 xmlResetLastError();
40003 if (mem_base != xmlMemBlocks()) {
40004 printf("Leak of %d blocks found in xmlNewTextWriterTree",
40005 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040006 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040007 printf(" %d", n_doc);
40008 printf(" %d", n_node);
40009 printf(" %d", n_compression);
40010 printf("\n");
40011 }
40012 }
40013 }
40014 }
40015#endif
40016
40017 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000040018 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040019}
40020
40021
40022static int
40023test_xmlTextWriterEndAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040024 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040025
Daniel Veillarde43cc572004-11-03 11:50:29 +000040026#ifdef LIBXML_WRITER_ENABLED
40027 int mem_base;
40028 int ret_val;
40029 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40030 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040031
Daniel Veillarde43cc572004-11-03 11:50:29 +000040032 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40033 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040034 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040035
40036 ret_val = xmlTextWriterEndAttribute(writer);
40037 desret_int(ret_val);
40038 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040039 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040040 xmlResetLastError();
40041 if (mem_base != xmlMemBlocks()) {
40042 printf("Leak of %d blocks found in xmlTextWriterEndAttribute",
40043 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040044 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040045 printf(" %d", n_writer);
40046 printf("\n");
40047 }
40048 }
40049#endif
40050
Daniel Veillard3d97e662004-11-04 10:49:00 +000040051 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000040052 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040053}
40054
40055
40056static int
40057test_xmlTextWriterEndCDATA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040058 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040059
Daniel Veillarde43cc572004-11-03 11:50:29 +000040060#ifdef LIBXML_WRITER_ENABLED
40061 int mem_base;
40062 int ret_val;
40063 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40064 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040065
Daniel Veillarde43cc572004-11-03 11:50:29 +000040066 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40067 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040068 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040069
40070 ret_val = xmlTextWriterEndCDATA(writer);
40071 desret_int(ret_val);
40072 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040073 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040074 xmlResetLastError();
40075 if (mem_base != xmlMemBlocks()) {
40076 printf("Leak of %d blocks found in xmlTextWriterEndCDATA",
40077 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040078 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040079 printf(" %d", n_writer);
40080 printf("\n");
40081 }
40082 }
40083#endif
40084
Daniel Veillard3d97e662004-11-04 10:49:00 +000040085 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000040086 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040087}
40088
40089
40090static int
40091test_xmlTextWriterEndComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040092 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040093
Daniel Veillarde43cc572004-11-03 11:50:29 +000040094#ifdef LIBXML_WRITER_ENABLED
40095 int mem_base;
40096 int ret_val;
40097 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40098 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040099
Daniel Veillarde43cc572004-11-03 11:50:29 +000040100 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40101 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040102 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040103
40104 ret_val = xmlTextWriterEndComment(writer);
40105 desret_int(ret_val);
40106 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040107 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040108 xmlResetLastError();
40109 if (mem_base != xmlMemBlocks()) {
40110 printf("Leak of %d blocks found in xmlTextWriterEndComment",
40111 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040112 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040113 printf(" %d", n_writer);
40114 printf("\n");
40115 }
40116 }
40117#endif
40118
Daniel Veillard3d97e662004-11-04 10:49:00 +000040119 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000040120 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040121}
40122
40123
40124static int
40125test_xmlTextWriterEndDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040126 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040127
Daniel Veillarde43cc572004-11-03 11:50:29 +000040128#ifdef LIBXML_WRITER_ENABLED
40129 int mem_base;
40130 int ret_val;
40131 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40132 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040133
Daniel Veillarde43cc572004-11-03 11:50:29 +000040134 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40135 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040136 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040137
40138 ret_val = xmlTextWriterEndDTD(writer);
40139 desret_int(ret_val);
40140 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040141 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040142 xmlResetLastError();
40143 if (mem_base != xmlMemBlocks()) {
40144 printf("Leak of %d blocks found in xmlTextWriterEndDTD",
40145 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040146 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040147 printf(" %d", n_writer);
40148 printf("\n");
40149 }
40150 }
40151#endif
40152
Daniel Veillard3d97e662004-11-04 10:49:00 +000040153 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000040154 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040155}
40156
40157
40158static int
40159test_xmlTextWriterEndDTDAttlist(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040160 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040161
Daniel Veillarde43cc572004-11-03 11:50:29 +000040162#ifdef LIBXML_WRITER_ENABLED
40163 int mem_base;
40164 int ret_val;
40165 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40166 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040167
Daniel Veillarde43cc572004-11-03 11:50:29 +000040168 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40169 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040170 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040171
40172 ret_val = xmlTextWriterEndDTDAttlist(writer);
40173 desret_int(ret_val);
40174 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040175 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040176 xmlResetLastError();
40177 if (mem_base != xmlMemBlocks()) {
40178 printf("Leak of %d blocks found in xmlTextWriterEndDTDAttlist",
40179 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040180 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040181 printf(" %d", n_writer);
40182 printf("\n");
40183 }
40184 }
40185#endif
40186
Daniel Veillard3d97e662004-11-04 10:49:00 +000040187 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000040188 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040189}
40190
40191
40192static int
40193test_xmlTextWriterEndDTDElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040194 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040195
Daniel Veillarde43cc572004-11-03 11:50:29 +000040196#ifdef LIBXML_WRITER_ENABLED
40197 int mem_base;
40198 int ret_val;
40199 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40200 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040201
Daniel Veillarde43cc572004-11-03 11:50:29 +000040202 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40203 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040204 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040205
40206 ret_val = xmlTextWriterEndDTDElement(writer);
40207 desret_int(ret_val);
40208 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040209 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040210 xmlResetLastError();
40211 if (mem_base != xmlMemBlocks()) {
40212 printf("Leak of %d blocks found in xmlTextWriterEndDTDElement",
40213 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040214 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040215 printf(" %d", n_writer);
40216 printf("\n");
40217 }
40218 }
40219#endif
40220
Daniel Veillard3d97e662004-11-04 10:49:00 +000040221 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000040222 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040223}
40224
40225
40226static int
40227test_xmlTextWriterEndDTDEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040228 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040229
Daniel Veillarde43cc572004-11-03 11:50:29 +000040230#ifdef LIBXML_WRITER_ENABLED
40231 int mem_base;
40232 int ret_val;
40233 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40234 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040235
Daniel Veillarde43cc572004-11-03 11:50:29 +000040236 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40237 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040238 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040239
40240 ret_val = xmlTextWriterEndDTDEntity(writer);
40241 desret_int(ret_val);
40242 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040243 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040244 xmlResetLastError();
40245 if (mem_base != xmlMemBlocks()) {
40246 printf("Leak of %d blocks found in xmlTextWriterEndDTDEntity",
40247 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040248 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040249 printf(" %d", n_writer);
40250 printf("\n");
40251 }
40252 }
40253#endif
40254
Daniel Veillard3d97e662004-11-04 10:49:00 +000040255 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000040256 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040257}
40258
40259
40260static int
40261test_xmlTextWriterEndDocument(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040262 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040263
Daniel Veillarde43cc572004-11-03 11:50:29 +000040264#ifdef LIBXML_WRITER_ENABLED
40265 int mem_base;
40266 int ret_val;
40267 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40268 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040269
Daniel Veillarde43cc572004-11-03 11:50:29 +000040270 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40271 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040272 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040273
40274 ret_val = xmlTextWriterEndDocument(writer);
40275 desret_int(ret_val);
40276 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040277 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040278 xmlResetLastError();
40279 if (mem_base != xmlMemBlocks()) {
40280 printf("Leak of %d blocks found in xmlTextWriterEndDocument",
40281 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040282 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040283 printf(" %d", n_writer);
40284 printf("\n");
40285 }
40286 }
40287#endif
40288
Daniel Veillard3d97e662004-11-04 10:49:00 +000040289 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000040290 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040291}
40292
40293
40294static int
40295test_xmlTextWriterEndElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040296 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040297
Daniel Veillarde43cc572004-11-03 11:50:29 +000040298#ifdef LIBXML_WRITER_ENABLED
40299 int mem_base;
40300 int ret_val;
40301 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40302 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040303
Daniel Veillarde43cc572004-11-03 11:50:29 +000040304 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40305 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040306 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040307
40308 ret_val = xmlTextWriterEndElement(writer);
40309 desret_int(ret_val);
40310 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040311 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040312 xmlResetLastError();
40313 if (mem_base != xmlMemBlocks()) {
40314 printf("Leak of %d blocks found in xmlTextWriterEndElement",
40315 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040316 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040317 printf(" %d", n_writer);
40318 printf("\n");
40319 }
40320 }
40321#endif
40322
Daniel Veillard3d97e662004-11-04 10:49:00 +000040323 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000040324 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040325}
40326
40327
40328static int
40329test_xmlTextWriterEndPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040330 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040331
Daniel Veillarde43cc572004-11-03 11:50:29 +000040332#ifdef LIBXML_WRITER_ENABLED
40333 int mem_base;
40334 int ret_val;
40335 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40336 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040337
Daniel Veillarde43cc572004-11-03 11:50:29 +000040338 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40339 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040340 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040341
40342 ret_val = xmlTextWriterEndPI(writer);
40343 desret_int(ret_val);
40344 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040345 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040346 xmlResetLastError();
40347 if (mem_base != xmlMemBlocks()) {
40348 printf("Leak of %d blocks found in xmlTextWriterEndPI",
40349 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040350 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040351 printf(" %d", n_writer);
40352 printf("\n");
40353 }
40354 }
40355#endif
40356
Daniel Veillard3d97e662004-11-04 10:49:00 +000040357 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000040358 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040359}
40360
40361
40362static int
40363test_xmlTextWriterFlush(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040364 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040365
Daniel Veillarde43cc572004-11-03 11:50:29 +000040366#ifdef LIBXML_WRITER_ENABLED
40367 int mem_base;
40368 int ret_val;
40369 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40370 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040371
Daniel Veillarde43cc572004-11-03 11:50:29 +000040372 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40373 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040374 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040375
40376 ret_val = xmlTextWriterFlush(writer);
40377 desret_int(ret_val);
40378 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040379 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040380 xmlResetLastError();
40381 if (mem_base != xmlMemBlocks()) {
40382 printf("Leak of %d blocks found in xmlTextWriterFlush",
40383 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040384 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040385 printf(" %d", n_writer);
40386 printf("\n");
40387 }
40388 }
40389#endif
40390
Daniel Veillard3d97e662004-11-04 10:49:00 +000040391 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000040392 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040393}
40394
40395
40396static int
40397test_xmlTextWriterFullEndElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040398 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040399
Daniel Veillarde43cc572004-11-03 11:50:29 +000040400#ifdef LIBXML_WRITER_ENABLED
40401 int mem_base;
40402 int ret_val;
40403 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40404 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040405
Daniel Veillarde43cc572004-11-03 11:50:29 +000040406 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40407 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040408 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040409
40410 ret_val = xmlTextWriterFullEndElement(writer);
40411 desret_int(ret_val);
40412 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040413 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040414 xmlResetLastError();
40415 if (mem_base != xmlMemBlocks()) {
40416 printf("Leak of %d blocks found in xmlTextWriterFullEndElement",
40417 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040418 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040419 printf(" %d", n_writer);
40420 printf("\n");
40421 }
40422 }
40423#endif
40424
Daniel Veillard3d97e662004-11-04 10:49:00 +000040425 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000040426 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040427}
40428
40429
40430static int
40431test_xmlTextWriterSetIndent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040432 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040433
Daniel Veillarde43cc572004-11-03 11:50:29 +000040434#ifdef LIBXML_WRITER_ENABLED
40435 int mem_base;
40436 int ret_val;
40437 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40438 int n_writer;
40439 int indent; /* do indentation? */
40440 int n_indent;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040441
Daniel Veillarde43cc572004-11-03 11:50:29 +000040442 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40443 for (n_indent = 0;n_indent < gen_nb_int;n_indent++) {
40444 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040445 writer = gen_xmlTextWriterPtr(n_writer, 0);
40446 indent = gen_int(n_indent, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040447
40448 ret_val = xmlTextWriterSetIndent(writer, indent);
40449 desret_int(ret_val);
40450 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040451 des_xmlTextWriterPtr(n_writer, writer, 0);
40452 des_int(n_indent, indent, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040453 xmlResetLastError();
40454 if (mem_base != xmlMemBlocks()) {
40455 printf("Leak of %d blocks found in xmlTextWriterSetIndent",
40456 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040457 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040458 printf(" %d", n_writer);
40459 printf(" %d", n_indent);
40460 printf("\n");
40461 }
40462 }
40463 }
40464#endif
40465
Daniel Veillard3d97e662004-11-04 10:49:00 +000040466 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000040467 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040468}
40469
40470
40471static int
40472test_xmlTextWriterSetIndentString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040473 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040474
Daniel Veillarde43cc572004-11-03 11:50:29 +000040475#ifdef LIBXML_WRITER_ENABLED
40476 int mem_base;
40477 int ret_val;
40478 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40479 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040480 xmlChar * str; /* the xmlChar string */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040481 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040482
Daniel Veillarde43cc572004-11-03 11:50:29 +000040483 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40484 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
40485 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040486 writer = gen_xmlTextWriterPtr(n_writer, 0);
40487 str = gen_const_xmlChar_ptr(n_str, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040488
40489 ret_val = xmlTextWriterSetIndentString(writer, str);
40490 desret_int(ret_val);
40491 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040492 des_xmlTextWriterPtr(n_writer, writer, 0);
40493 des_const_xmlChar_ptr(n_str, str, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040494 xmlResetLastError();
40495 if (mem_base != xmlMemBlocks()) {
40496 printf("Leak of %d blocks found in xmlTextWriterSetIndentString",
40497 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040498 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040499 printf(" %d", n_writer);
40500 printf(" %d", n_str);
40501 printf("\n");
40502 }
40503 }
40504 }
40505#endif
40506
Daniel Veillard3d97e662004-11-04 10:49:00 +000040507 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000040508 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040509}
40510
40511
40512static int
40513test_xmlTextWriterStartAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040514 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040515
Daniel Veillarde43cc572004-11-03 11:50:29 +000040516#ifdef LIBXML_WRITER_ENABLED
40517 int mem_base;
40518 int ret_val;
40519 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40520 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040521 xmlChar * name; /* element name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040522 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040523
Daniel Veillarde43cc572004-11-03 11:50:29 +000040524 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40525 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
40526 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040527 writer = gen_xmlTextWriterPtr(n_writer, 0);
40528 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040529
40530 ret_val = xmlTextWriterStartAttribute(writer, name);
40531 desret_int(ret_val);
40532 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040533 des_xmlTextWriterPtr(n_writer, writer, 0);
40534 des_const_xmlChar_ptr(n_name, name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040535 xmlResetLastError();
40536 if (mem_base != xmlMemBlocks()) {
40537 printf("Leak of %d blocks found in xmlTextWriterStartAttribute",
40538 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040539 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040540 printf(" %d", n_writer);
40541 printf(" %d", n_name);
40542 printf("\n");
40543 }
40544 }
40545 }
40546#endif
40547
Daniel Veillard3d97e662004-11-04 10:49:00 +000040548 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000040549 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040550}
40551
40552
40553static int
40554test_xmlTextWriterStartAttributeNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040555 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040556
Daniel Veillarde43cc572004-11-03 11:50:29 +000040557#ifdef LIBXML_WRITER_ENABLED
40558 int mem_base;
40559 int ret_val;
40560 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40561 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040562 xmlChar * prefix; /* namespace prefix or NULL */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040563 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040564 xmlChar * name; /* element local name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040565 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040566 xmlChar * namespaceURI; /* namespace URI or NULL */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040567 int n_namespaceURI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040568
Daniel Veillarde43cc572004-11-03 11:50:29 +000040569 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40570 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
40571 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
40572 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
40573 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040574 writer = gen_xmlTextWriterPtr(n_writer, 0);
40575 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
40576 name = gen_const_xmlChar_ptr(n_name, 2);
40577 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040578
40579 ret_val = xmlTextWriterStartAttributeNS(writer, prefix, name, namespaceURI);
40580 desret_int(ret_val);
40581 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040582 des_xmlTextWriterPtr(n_writer, writer, 0);
40583 des_const_xmlChar_ptr(n_prefix, prefix, 1);
40584 des_const_xmlChar_ptr(n_name, name, 2);
40585 des_const_xmlChar_ptr(n_namespaceURI, namespaceURI, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040586 xmlResetLastError();
40587 if (mem_base != xmlMemBlocks()) {
40588 printf("Leak of %d blocks found in xmlTextWriterStartAttributeNS",
40589 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040590 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040591 printf(" %d", n_writer);
40592 printf(" %d", n_prefix);
40593 printf(" %d", n_name);
40594 printf(" %d", n_namespaceURI);
40595 printf("\n");
40596 }
40597 }
40598 }
40599 }
40600 }
40601#endif
40602
Daniel Veillard3d97e662004-11-04 10:49:00 +000040603 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000040604 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040605}
40606
40607
40608static int
40609test_xmlTextWriterStartCDATA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040610 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040611
Daniel Veillarde43cc572004-11-03 11:50:29 +000040612#ifdef LIBXML_WRITER_ENABLED
40613 int mem_base;
40614 int ret_val;
40615 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40616 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040617
Daniel Veillarde43cc572004-11-03 11:50:29 +000040618 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40619 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040620 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040621
40622 ret_val = xmlTextWriterStartCDATA(writer);
40623 desret_int(ret_val);
40624 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040625 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040626 xmlResetLastError();
40627 if (mem_base != xmlMemBlocks()) {
40628 printf("Leak of %d blocks found in xmlTextWriterStartCDATA",
40629 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040630 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040631 printf(" %d", n_writer);
40632 printf("\n");
40633 }
40634 }
40635#endif
40636
Daniel Veillard3d97e662004-11-04 10:49:00 +000040637 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000040638 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040639}
40640
40641
40642static int
40643test_xmlTextWriterStartComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040644 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040645
Daniel Veillarde43cc572004-11-03 11:50:29 +000040646#ifdef LIBXML_WRITER_ENABLED
40647 int mem_base;
40648 int ret_val;
40649 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40650 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040651
Daniel Veillarde43cc572004-11-03 11:50:29 +000040652 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40653 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040654 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040655
40656 ret_val = xmlTextWriterStartComment(writer);
40657 desret_int(ret_val);
40658 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040659 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040660 xmlResetLastError();
40661 if (mem_base != xmlMemBlocks()) {
40662 printf("Leak of %d blocks found in xmlTextWriterStartComment",
40663 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040664 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040665 printf(" %d", n_writer);
40666 printf("\n");
40667 }
40668 }
40669#endif
40670
Daniel Veillard3d97e662004-11-04 10:49:00 +000040671 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000040672 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040673}
40674
40675
40676static int
40677test_xmlTextWriterStartDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040678 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040679
Daniel Veillarde43cc572004-11-03 11:50:29 +000040680#ifdef LIBXML_WRITER_ENABLED
40681 int mem_base;
40682 int ret_val;
40683 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40684 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040685 xmlChar * name; /* the name of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040686 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040687 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040688 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040689 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040690 int n_sysid;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040691
Daniel Veillarde43cc572004-11-03 11:50:29 +000040692 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40693 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
40694 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
40695 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
40696 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040697 writer = gen_xmlTextWriterPtr(n_writer, 0);
40698 name = gen_const_xmlChar_ptr(n_name, 1);
40699 pubid = gen_const_xmlChar_ptr(n_pubid, 2);
40700 sysid = gen_const_xmlChar_ptr(n_sysid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040701
40702 ret_val = xmlTextWriterStartDTD(writer, name, pubid, sysid);
40703 desret_int(ret_val);
40704 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040705 des_xmlTextWriterPtr(n_writer, writer, 0);
40706 des_const_xmlChar_ptr(n_name, name, 1);
40707 des_const_xmlChar_ptr(n_pubid, pubid, 2);
40708 des_const_xmlChar_ptr(n_sysid, sysid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040709 xmlResetLastError();
40710 if (mem_base != xmlMemBlocks()) {
40711 printf("Leak of %d blocks found in xmlTextWriterStartDTD",
40712 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040713 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040714 printf(" %d", n_writer);
40715 printf(" %d", n_name);
40716 printf(" %d", n_pubid);
40717 printf(" %d", n_sysid);
40718 printf("\n");
40719 }
40720 }
40721 }
40722 }
40723 }
40724#endif
40725
Daniel Veillard3d97e662004-11-04 10:49:00 +000040726 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000040727 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040728}
40729
40730
40731static int
40732test_xmlTextWriterStartDTDAttlist(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040733 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040734
Daniel Veillarde43cc572004-11-03 11:50:29 +000040735#ifdef LIBXML_WRITER_ENABLED
40736 int mem_base;
40737 int ret_val;
40738 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40739 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040740 xmlChar * name; /* the name of the DTD ATTLIST */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040741 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040742
Daniel Veillarde43cc572004-11-03 11:50:29 +000040743 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40744 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
40745 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040746 writer = gen_xmlTextWriterPtr(n_writer, 0);
40747 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040748
40749 ret_val = xmlTextWriterStartDTDAttlist(writer, name);
40750 desret_int(ret_val);
40751 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040752 des_xmlTextWriterPtr(n_writer, writer, 0);
40753 des_const_xmlChar_ptr(n_name, name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040754 xmlResetLastError();
40755 if (mem_base != xmlMemBlocks()) {
40756 printf("Leak of %d blocks found in xmlTextWriterStartDTDAttlist",
40757 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040758 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040759 printf(" %d", n_writer);
40760 printf(" %d", n_name);
40761 printf("\n");
40762 }
40763 }
40764 }
40765#endif
40766
Daniel Veillard3d97e662004-11-04 10:49:00 +000040767 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000040768 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040769}
40770
40771
40772static int
40773test_xmlTextWriterStartDTDElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040774 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040775
Daniel Veillarde43cc572004-11-03 11:50:29 +000040776#ifdef LIBXML_WRITER_ENABLED
40777 int mem_base;
40778 int ret_val;
40779 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40780 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040781 xmlChar * name; /* the name of the DTD element */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040782 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040783
Daniel Veillarde43cc572004-11-03 11:50:29 +000040784 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40785 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
40786 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040787 writer = gen_xmlTextWriterPtr(n_writer, 0);
40788 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040789
40790 ret_val = xmlTextWriterStartDTDElement(writer, name);
40791 desret_int(ret_val);
40792 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040793 des_xmlTextWriterPtr(n_writer, writer, 0);
40794 des_const_xmlChar_ptr(n_name, name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040795 xmlResetLastError();
40796 if (mem_base != xmlMemBlocks()) {
40797 printf("Leak of %d blocks found in xmlTextWriterStartDTDElement",
40798 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040799 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040800 printf(" %d", n_writer);
40801 printf(" %d", n_name);
40802 printf("\n");
40803 }
40804 }
40805 }
40806#endif
40807
Daniel Veillard3d97e662004-11-04 10:49:00 +000040808 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000040809 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040810}
40811
40812
40813static int
40814test_xmlTextWriterStartDTDEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040815 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040816
Daniel Veillarde43cc572004-11-03 11:50:29 +000040817#ifdef LIBXML_WRITER_ENABLED
40818 int mem_base;
40819 int ret_val;
40820 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40821 int n_writer;
40822 int pe; /* TRUE if this is a parameter entity, FALSE if not */
40823 int n_pe;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040824 xmlChar * name; /* the name of the DTD ATTLIST */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040825 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040826
Daniel Veillarde43cc572004-11-03 11:50:29 +000040827 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40828 for (n_pe = 0;n_pe < gen_nb_int;n_pe++) {
40829 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
40830 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040831 writer = gen_xmlTextWriterPtr(n_writer, 0);
40832 pe = gen_int(n_pe, 1);
40833 name = gen_const_xmlChar_ptr(n_name, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040834
40835 ret_val = xmlTextWriterStartDTDEntity(writer, pe, name);
40836 desret_int(ret_val);
40837 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040838 des_xmlTextWriterPtr(n_writer, writer, 0);
40839 des_int(n_pe, pe, 1);
40840 des_const_xmlChar_ptr(n_name, name, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040841 xmlResetLastError();
40842 if (mem_base != xmlMemBlocks()) {
40843 printf("Leak of %d blocks found in xmlTextWriterStartDTDEntity",
40844 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040845 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040846 printf(" %d", n_writer);
40847 printf(" %d", n_pe);
40848 printf(" %d", n_name);
40849 printf("\n");
40850 }
40851 }
40852 }
40853 }
40854#endif
40855
Daniel Veillard3d97e662004-11-04 10:49:00 +000040856 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000040857 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040858}
40859
40860
40861static int
40862test_xmlTextWriterStartDocument(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040863 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040864
Daniel Veillarde43cc572004-11-03 11:50:29 +000040865#ifdef LIBXML_WRITER_ENABLED
40866 int mem_base;
40867 int ret_val;
40868 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40869 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040870 char * version; /* the xml version ("1.0") or NULL for default ("1.0") */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040871 int n_version;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040872 char * encoding; /* the encoding or NULL for default */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040873 int n_encoding;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040874 char * standalone; /* "yes" or "no" or NULL for default */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040875 int n_standalone;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040876
Daniel Veillarde43cc572004-11-03 11:50:29 +000040877 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40878 for (n_version = 0;n_version < gen_nb_const_char_ptr;n_version++) {
40879 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
40880 for (n_standalone = 0;n_standalone < gen_nb_const_char_ptr;n_standalone++) {
40881 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040882 writer = gen_xmlTextWriterPtr(n_writer, 0);
40883 version = gen_const_char_ptr(n_version, 1);
40884 encoding = gen_const_char_ptr(n_encoding, 2);
40885 standalone = gen_const_char_ptr(n_standalone, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040886
40887 ret_val = xmlTextWriterStartDocument(writer, version, encoding, standalone);
40888 desret_int(ret_val);
40889 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040890 des_xmlTextWriterPtr(n_writer, writer, 0);
40891 des_const_char_ptr(n_version, version, 1);
40892 des_const_char_ptr(n_encoding, encoding, 2);
40893 des_const_char_ptr(n_standalone, standalone, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040894 xmlResetLastError();
40895 if (mem_base != xmlMemBlocks()) {
40896 printf("Leak of %d blocks found in xmlTextWriterStartDocument",
40897 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040898 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040899 printf(" %d", n_writer);
40900 printf(" %d", n_version);
40901 printf(" %d", n_encoding);
40902 printf(" %d", n_standalone);
40903 printf("\n");
40904 }
40905 }
40906 }
40907 }
40908 }
40909#endif
40910
Daniel Veillard3d97e662004-11-04 10:49:00 +000040911 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000040912 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040913}
40914
40915
40916static int
40917test_xmlTextWriterStartElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040918 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040919
Daniel Veillarde43cc572004-11-03 11:50:29 +000040920#ifdef LIBXML_WRITER_ENABLED
40921 int mem_base;
40922 int ret_val;
40923 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40924 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040925 xmlChar * name; /* element name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040926 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040927
Daniel Veillarde43cc572004-11-03 11:50:29 +000040928 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40929 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
40930 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040931 writer = gen_xmlTextWriterPtr(n_writer, 0);
40932 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040933
40934 ret_val = xmlTextWriterStartElement(writer, name);
40935 desret_int(ret_val);
40936 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040937 des_xmlTextWriterPtr(n_writer, writer, 0);
40938 des_const_xmlChar_ptr(n_name, name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040939 xmlResetLastError();
40940 if (mem_base != xmlMemBlocks()) {
40941 printf("Leak of %d blocks found in xmlTextWriterStartElement",
40942 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040943 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040944 printf(" %d", n_writer);
40945 printf(" %d", n_name);
40946 printf("\n");
40947 }
40948 }
40949 }
40950#endif
40951
Daniel Veillard3d97e662004-11-04 10:49:00 +000040952 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000040953 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040954}
40955
40956
40957static int
40958test_xmlTextWriterStartElementNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040959 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040960
Daniel Veillarde43cc572004-11-03 11:50:29 +000040961#ifdef LIBXML_WRITER_ENABLED
40962 int mem_base;
40963 int ret_val;
40964 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40965 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040966 xmlChar * prefix; /* namespace prefix or NULL */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040967 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040968 xmlChar * name; /* element local name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040969 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040970 xmlChar * namespaceURI; /* namespace URI or NULL */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040971 int n_namespaceURI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040972
Daniel Veillarde43cc572004-11-03 11:50:29 +000040973 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40974 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
40975 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
40976 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
40977 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040978 writer = gen_xmlTextWriterPtr(n_writer, 0);
40979 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
40980 name = gen_const_xmlChar_ptr(n_name, 2);
40981 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040982
40983 ret_val = xmlTextWriterStartElementNS(writer, prefix, name, namespaceURI);
40984 desret_int(ret_val);
40985 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040986 des_xmlTextWriterPtr(n_writer, writer, 0);
40987 des_const_xmlChar_ptr(n_prefix, prefix, 1);
40988 des_const_xmlChar_ptr(n_name, name, 2);
40989 des_const_xmlChar_ptr(n_namespaceURI, namespaceURI, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040990 xmlResetLastError();
40991 if (mem_base != xmlMemBlocks()) {
40992 printf("Leak of %d blocks found in xmlTextWriterStartElementNS",
40993 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040994 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040995 printf(" %d", n_writer);
40996 printf(" %d", n_prefix);
40997 printf(" %d", n_name);
40998 printf(" %d", n_namespaceURI);
40999 printf("\n");
41000 }
41001 }
41002 }
41003 }
41004 }
41005#endif
41006
Daniel Veillard3d97e662004-11-04 10:49:00 +000041007 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000041008 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041009}
41010
41011
41012static int
41013test_xmlTextWriterStartPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041014 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041015
Daniel Veillarde43cc572004-11-03 11:50:29 +000041016#ifdef LIBXML_WRITER_ENABLED
41017 int mem_base;
41018 int ret_val;
41019 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41020 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041021 xmlChar * target; /* PI target */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041022 int n_target;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041023
Daniel Veillarde43cc572004-11-03 11:50:29 +000041024 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41025 for (n_target = 0;n_target < gen_nb_const_xmlChar_ptr;n_target++) {
41026 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041027 writer = gen_xmlTextWriterPtr(n_writer, 0);
41028 target = gen_const_xmlChar_ptr(n_target, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041029
41030 ret_val = xmlTextWriterStartPI(writer, target);
41031 desret_int(ret_val);
41032 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041033 des_xmlTextWriterPtr(n_writer, writer, 0);
41034 des_const_xmlChar_ptr(n_target, target, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041035 xmlResetLastError();
41036 if (mem_base != xmlMemBlocks()) {
41037 printf("Leak of %d blocks found in xmlTextWriterStartPI",
41038 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041039 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041040 printf(" %d", n_writer);
41041 printf(" %d", n_target);
41042 printf("\n");
41043 }
41044 }
41045 }
41046#endif
41047
Daniel Veillard3d97e662004-11-04 10:49:00 +000041048 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000041049 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041050}
41051
41052
41053static int
41054test_xmlTextWriterWriteAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041055 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041056
Daniel Veillarde43cc572004-11-03 11:50:29 +000041057#ifdef LIBXML_WRITER_ENABLED
41058 int mem_base;
41059 int ret_val;
41060 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41061 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041062 xmlChar * name; /* attribute name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041063 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041064 xmlChar * content; /* attribute content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041065 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041066
Daniel Veillarde43cc572004-11-03 11:50:29 +000041067 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41068 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41069 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41070 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041071 writer = gen_xmlTextWriterPtr(n_writer, 0);
41072 name = gen_const_xmlChar_ptr(n_name, 1);
41073 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041074
41075 ret_val = xmlTextWriterWriteAttribute(writer, name, content);
41076 desret_int(ret_val);
41077 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041078 des_xmlTextWriterPtr(n_writer, writer, 0);
41079 des_const_xmlChar_ptr(n_name, name, 1);
41080 des_const_xmlChar_ptr(n_content, content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041081 xmlResetLastError();
41082 if (mem_base != xmlMemBlocks()) {
41083 printf("Leak of %d blocks found in xmlTextWriterWriteAttribute",
41084 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041085 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041086 printf(" %d", n_writer);
41087 printf(" %d", n_name);
41088 printf(" %d", n_content);
41089 printf("\n");
41090 }
41091 }
41092 }
41093 }
41094#endif
41095
Daniel Veillard3d97e662004-11-04 10:49:00 +000041096 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000041097 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041098}
41099
41100
41101static int
41102test_xmlTextWriterWriteAttributeNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041103 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041104
Daniel Veillarde43cc572004-11-03 11:50:29 +000041105#ifdef LIBXML_WRITER_ENABLED
41106 int mem_base;
41107 int ret_val;
41108 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41109 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041110 xmlChar * prefix; /* namespace prefix */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041111 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041112 xmlChar * name; /* attribute local name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041113 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041114 xmlChar * namespaceURI; /* namespace URI */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041115 int n_namespaceURI;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041116 xmlChar * content; /* attribute content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041117 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041118
Daniel Veillarde43cc572004-11-03 11:50:29 +000041119 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41120 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
41121 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41122 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
41123 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41124 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041125 writer = gen_xmlTextWriterPtr(n_writer, 0);
41126 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
41127 name = gen_const_xmlChar_ptr(n_name, 2);
41128 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 3);
41129 content = gen_const_xmlChar_ptr(n_content, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041130
41131 ret_val = xmlTextWriterWriteAttributeNS(writer, prefix, name, namespaceURI, content);
41132 desret_int(ret_val);
41133 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041134 des_xmlTextWriterPtr(n_writer, writer, 0);
41135 des_const_xmlChar_ptr(n_prefix, prefix, 1);
41136 des_const_xmlChar_ptr(n_name, name, 2);
41137 des_const_xmlChar_ptr(n_namespaceURI, namespaceURI, 3);
41138 des_const_xmlChar_ptr(n_content, content, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041139 xmlResetLastError();
41140 if (mem_base != xmlMemBlocks()) {
41141 printf("Leak of %d blocks found in xmlTextWriterWriteAttributeNS",
41142 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041143 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041144 printf(" %d", n_writer);
41145 printf(" %d", n_prefix);
41146 printf(" %d", n_name);
41147 printf(" %d", n_namespaceURI);
41148 printf(" %d", n_content);
41149 printf("\n");
41150 }
41151 }
41152 }
41153 }
41154 }
41155 }
41156#endif
41157
Daniel Veillard3d97e662004-11-04 10:49:00 +000041158 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000041159 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041160}
41161
41162
41163static int
41164test_xmlTextWriterWriteBase64(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041165 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041166
Daniel Veillarde43cc572004-11-03 11:50:29 +000041167#ifdef LIBXML_WRITER_ENABLED
41168 int mem_base;
41169 int ret_val;
41170 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41171 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041172 char * data; /* binary data */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041173 int n_data;
41174 int start; /* the position within the data of the first byte to encode */
41175 int n_start;
41176 int len; /* the number of bytes to encode */
41177 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041178
Daniel Veillarde43cc572004-11-03 11:50:29 +000041179 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41180 for (n_data = 0;n_data < gen_nb_const_char_ptr;n_data++) {
41181 for (n_start = 0;n_start < gen_nb_int;n_start++) {
41182 for (n_len = 0;n_len < gen_nb_int;n_len++) {
41183 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041184 writer = gen_xmlTextWriterPtr(n_writer, 0);
41185 data = gen_const_char_ptr(n_data, 1);
41186 start = gen_int(n_start, 2);
41187 len = gen_int(n_len, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041188
41189 ret_val = xmlTextWriterWriteBase64(writer, data, start, len);
41190 desret_int(ret_val);
41191 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041192 des_xmlTextWriterPtr(n_writer, writer, 0);
41193 des_const_char_ptr(n_data, data, 1);
41194 des_int(n_start, start, 2);
41195 des_int(n_len, len, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041196 xmlResetLastError();
41197 if (mem_base != xmlMemBlocks()) {
41198 printf("Leak of %d blocks found in xmlTextWriterWriteBase64",
41199 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041200 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041201 printf(" %d", n_writer);
41202 printf(" %d", n_data);
41203 printf(" %d", n_start);
41204 printf(" %d", n_len);
41205 printf("\n");
41206 }
41207 }
41208 }
41209 }
41210 }
41211#endif
41212
Daniel Veillard3d97e662004-11-04 10:49:00 +000041213 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000041214 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041215}
41216
41217
41218static int
41219test_xmlTextWriterWriteBinHex(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041220 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041221
Daniel Veillarde43cc572004-11-03 11:50:29 +000041222#ifdef LIBXML_WRITER_ENABLED
41223 int mem_base;
41224 int ret_val;
41225 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41226 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041227 char * data; /* binary data */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041228 int n_data;
41229 int start; /* the position within the data of the first byte to encode */
41230 int n_start;
41231 int len; /* the number of bytes to encode */
41232 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041233
Daniel Veillarde43cc572004-11-03 11:50:29 +000041234 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41235 for (n_data = 0;n_data < gen_nb_const_char_ptr;n_data++) {
41236 for (n_start = 0;n_start < gen_nb_int;n_start++) {
41237 for (n_len = 0;n_len < gen_nb_int;n_len++) {
41238 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041239 writer = gen_xmlTextWriterPtr(n_writer, 0);
41240 data = gen_const_char_ptr(n_data, 1);
41241 start = gen_int(n_start, 2);
41242 len = gen_int(n_len, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041243
41244 ret_val = xmlTextWriterWriteBinHex(writer, data, start, len);
41245 desret_int(ret_val);
41246 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041247 des_xmlTextWriterPtr(n_writer, writer, 0);
41248 des_const_char_ptr(n_data, data, 1);
41249 des_int(n_start, start, 2);
41250 des_int(n_len, len, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041251 xmlResetLastError();
41252 if (mem_base != xmlMemBlocks()) {
41253 printf("Leak of %d blocks found in xmlTextWriterWriteBinHex",
41254 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041255 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041256 printf(" %d", n_writer);
41257 printf(" %d", n_data);
41258 printf(" %d", n_start);
41259 printf(" %d", n_len);
41260 printf("\n");
41261 }
41262 }
41263 }
41264 }
41265 }
41266#endif
41267
Daniel Veillard3d97e662004-11-04 10:49:00 +000041268 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000041269 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041270}
41271
41272
41273static int
41274test_xmlTextWriterWriteCDATA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041275 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041276
Daniel Veillarde43cc572004-11-03 11:50:29 +000041277#ifdef LIBXML_WRITER_ENABLED
41278 int mem_base;
41279 int ret_val;
41280 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41281 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041282 xmlChar * content; /* CDATA content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041283 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041284
Daniel Veillarde43cc572004-11-03 11:50:29 +000041285 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41286 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41287 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041288 writer = gen_xmlTextWriterPtr(n_writer, 0);
41289 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041290
41291 ret_val = xmlTextWriterWriteCDATA(writer, content);
41292 desret_int(ret_val);
41293 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041294 des_xmlTextWriterPtr(n_writer, writer, 0);
41295 des_const_xmlChar_ptr(n_content, content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041296 xmlResetLastError();
41297 if (mem_base != xmlMemBlocks()) {
41298 printf("Leak of %d blocks found in xmlTextWriterWriteCDATA",
41299 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041300 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041301 printf(" %d", n_writer);
41302 printf(" %d", n_content);
41303 printf("\n");
41304 }
41305 }
41306 }
41307#endif
41308
Daniel Veillard3d97e662004-11-04 10:49:00 +000041309 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000041310 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041311}
41312
41313
41314static int
41315test_xmlTextWriterWriteComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041316 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041317
Daniel Veillarde43cc572004-11-03 11:50:29 +000041318#ifdef LIBXML_WRITER_ENABLED
41319 int mem_base;
41320 int ret_val;
41321 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41322 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041323 xmlChar * content; /* comment string */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041324 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041325
Daniel Veillarde43cc572004-11-03 11:50:29 +000041326 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41327 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41328 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041329 writer = gen_xmlTextWriterPtr(n_writer, 0);
41330 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041331
41332 ret_val = xmlTextWriterWriteComment(writer, content);
41333 desret_int(ret_val);
41334 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041335 des_xmlTextWriterPtr(n_writer, writer, 0);
41336 des_const_xmlChar_ptr(n_content, content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041337 xmlResetLastError();
41338 if (mem_base != xmlMemBlocks()) {
41339 printf("Leak of %d blocks found in xmlTextWriterWriteComment",
41340 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041341 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041342 printf(" %d", n_writer);
41343 printf(" %d", n_content);
41344 printf("\n");
41345 }
41346 }
41347 }
41348#endif
41349
Daniel Veillard3d97e662004-11-04 10:49:00 +000041350 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000041351 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041352}
41353
41354
41355static int
41356test_xmlTextWriterWriteDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041357 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041358
Daniel Veillarde43cc572004-11-03 11:50:29 +000041359#ifdef LIBXML_WRITER_ENABLED
41360 int mem_base;
41361 int ret_val;
41362 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41363 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041364 xmlChar * name; /* the name of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041365 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041366 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041367 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041368 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041369 int n_sysid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041370 xmlChar * subset; /* string content of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041371 int n_subset;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041372
Daniel Veillarde43cc572004-11-03 11:50:29 +000041373 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41374 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41375 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
41376 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
41377 for (n_subset = 0;n_subset < gen_nb_const_xmlChar_ptr;n_subset++) {
41378 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041379 writer = gen_xmlTextWriterPtr(n_writer, 0);
41380 name = gen_const_xmlChar_ptr(n_name, 1);
41381 pubid = gen_const_xmlChar_ptr(n_pubid, 2);
41382 sysid = gen_const_xmlChar_ptr(n_sysid, 3);
41383 subset = gen_const_xmlChar_ptr(n_subset, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041384
41385 ret_val = xmlTextWriterWriteDTD(writer, name, pubid, sysid, subset);
41386 desret_int(ret_val);
41387 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041388 des_xmlTextWriterPtr(n_writer, writer, 0);
41389 des_const_xmlChar_ptr(n_name, name, 1);
41390 des_const_xmlChar_ptr(n_pubid, pubid, 2);
41391 des_const_xmlChar_ptr(n_sysid, sysid, 3);
41392 des_const_xmlChar_ptr(n_subset, subset, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041393 xmlResetLastError();
41394 if (mem_base != xmlMemBlocks()) {
41395 printf("Leak of %d blocks found in xmlTextWriterWriteDTD",
41396 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041397 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041398 printf(" %d", n_writer);
41399 printf(" %d", n_name);
41400 printf(" %d", n_pubid);
41401 printf(" %d", n_sysid);
41402 printf(" %d", n_subset);
41403 printf("\n");
41404 }
41405 }
41406 }
41407 }
41408 }
41409 }
41410#endif
41411
Daniel Veillard3d97e662004-11-04 10:49:00 +000041412 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000041413 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041414}
41415
41416
41417static int
41418test_xmlTextWriterWriteDTDAttlist(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041419 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041420
Daniel Veillarde43cc572004-11-03 11:50:29 +000041421#ifdef LIBXML_WRITER_ENABLED
41422 int mem_base;
41423 int ret_val;
41424 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41425 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041426 xmlChar * name; /* the name of the DTD ATTLIST */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041427 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041428 xmlChar * content; /* content of the ATTLIST */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041429 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041430
Daniel Veillarde43cc572004-11-03 11:50:29 +000041431 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41432 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41433 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41434 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041435 writer = gen_xmlTextWriterPtr(n_writer, 0);
41436 name = gen_const_xmlChar_ptr(n_name, 1);
41437 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041438
41439 ret_val = xmlTextWriterWriteDTDAttlist(writer, name, content);
41440 desret_int(ret_val);
41441 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041442 des_xmlTextWriterPtr(n_writer, writer, 0);
41443 des_const_xmlChar_ptr(n_name, name, 1);
41444 des_const_xmlChar_ptr(n_content, content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041445 xmlResetLastError();
41446 if (mem_base != xmlMemBlocks()) {
41447 printf("Leak of %d blocks found in xmlTextWriterWriteDTDAttlist",
41448 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041449 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041450 printf(" %d", n_writer);
41451 printf(" %d", n_name);
41452 printf(" %d", n_content);
41453 printf("\n");
41454 }
41455 }
41456 }
41457 }
41458#endif
41459
Daniel Veillard3d97e662004-11-04 10:49:00 +000041460 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000041461 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041462}
41463
41464
41465static int
41466test_xmlTextWriterWriteDTDElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041467 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041468
Daniel Veillarde43cc572004-11-03 11:50:29 +000041469#ifdef LIBXML_WRITER_ENABLED
41470 int mem_base;
41471 int ret_val;
41472 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41473 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041474 xmlChar * name; /* the name of the DTD element */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041475 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041476 xmlChar * content; /* content of the element */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041477 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041478
Daniel Veillarde43cc572004-11-03 11:50:29 +000041479 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41480 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41481 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41482 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041483 writer = gen_xmlTextWriterPtr(n_writer, 0);
41484 name = gen_const_xmlChar_ptr(n_name, 1);
41485 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041486
41487 ret_val = xmlTextWriterWriteDTDElement(writer, name, content);
41488 desret_int(ret_val);
41489 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041490 des_xmlTextWriterPtr(n_writer, writer, 0);
41491 des_const_xmlChar_ptr(n_name, name, 1);
41492 des_const_xmlChar_ptr(n_content, content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041493 xmlResetLastError();
41494 if (mem_base != xmlMemBlocks()) {
41495 printf("Leak of %d blocks found in xmlTextWriterWriteDTDElement",
41496 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041497 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041498 printf(" %d", n_writer);
41499 printf(" %d", n_name);
41500 printf(" %d", n_content);
41501 printf("\n");
41502 }
41503 }
41504 }
41505 }
41506#endif
41507
Daniel Veillard3d97e662004-11-04 10:49:00 +000041508 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000041509 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041510}
41511
41512
41513static int
41514test_xmlTextWriterWriteDTDEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041515 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041516
Daniel Veillarde43cc572004-11-03 11:50:29 +000041517#ifdef LIBXML_WRITER_ENABLED
41518 int mem_base;
41519 int ret_val;
41520 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41521 int n_writer;
41522 int pe; /* TRUE if this is a parameter entity, FALSE if not */
41523 int n_pe;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041524 xmlChar * name; /* the name of the DTD entity */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041525 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041526 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041527 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041528 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041529 int n_sysid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041530 xmlChar * ndataid; /* the xml notation name. */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041531 int n_ndataid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041532 xmlChar * content; /* content of the entity */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041533 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041534
Daniel Veillarde43cc572004-11-03 11:50:29 +000041535 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41536 for (n_pe = 0;n_pe < gen_nb_int;n_pe++) {
41537 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41538 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
41539 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
41540 for (n_ndataid = 0;n_ndataid < gen_nb_const_xmlChar_ptr;n_ndataid++) {
41541 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41542 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041543 writer = gen_xmlTextWriterPtr(n_writer, 0);
41544 pe = gen_int(n_pe, 1);
41545 name = gen_const_xmlChar_ptr(n_name, 2);
41546 pubid = gen_const_xmlChar_ptr(n_pubid, 3);
41547 sysid = gen_const_xmlChar_ptr(n_sysid, 4);
41548 ndataid = gen_const_xmlChar_ptr(n_ndataid, 5);
41549 content = gen_const_xmlChar_ptr(n_content, 6);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041550
41551 ret_val = xmlTextWriterWriteDTDEntity(writer, pe, name, pubid, sysid, ndataid, content);
41552 desret_int(ret_val);
41553 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041554 des_xmlTextWriterPtr(n_writer, writer, 0);
41555 des_int(n_pe, pe, 1);
41556 des_const_xmlChar_ptr(n_name, name, 2);
41557 des_const_xmlChar_ptr(n_pubid, pubid, 3);
41558 des_const_xmlChar_ptr(n_sysid, sysid, 4);
41559 des_const_xmlChar_ptr(n_ndataid, ndataid, 5);
41560 des_const_xmlChar_ptr(n_content, content, 6);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041561 xmlResetLastError();
41562 if (mem_base != xmlMemBlocks()) {
41563 printf("Leak of %d blocks found in xmlTextWriterWriteDTDEntity",
41564 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041565 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041566 printf(" %d", n_writer);
41567 printf(" %d", n_pe);
41568 printf(" %d", n_name);
41569 printf(" %d", n_pubid);
41570 printf(" %d", n_sysid);
41571 printf(" %d", n_ndataid);
41572 printf(" %d", n_content);
41573 printf("\n");
41574 }
41575 }
41576 }
41577 }
41578 }
41579 }
41580 }
41581 }
41582#endif
41583
Daniel Veillard3d97e662004-11-04 10:49:00 +000041584 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000041585 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041586}
41587
41588
41589static int
41590test_xmlTextWriterWriteDTDExternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041591 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041592
Daniel Veillarde43cc572004-11-03 11:50:29 +000041593#ifdef LIBXML_WRITER_ENABLED
41594 int mem_base;
41595 int ret_val;
41596 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41597 int n_writer;
41598 int pe; /* TRUE if this is a parameter entity, FALSE if not */
41599 int n_pe;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041600 xmlChar * name; /* the name of the DTD entity */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041601 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041602 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041603 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041604 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041605 int n_sysid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041606 xmlChar * ndataid; /* the xml notation name. */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041607 int n_ndataid;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041608
Daniel Veillarde43cc572004-11-03 11:50:29 +000041609 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41610 for (n_pe = 0;n_pe < gen_nb_int;n_pe++) {
41611 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41612 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
41613 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
41614 for (n_ndataid = 0;n_ndataid < gen_nb_const_xmlChar_ptr;n_ndataid++) {
41615 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041616 writer = gen_xmlTextWriterPtr(n_writer, 0);
41617 pe = gen_int(n_pe, 1);
41618 name = gen_const_xmlChar_ptr(n_name, 2);
41619 pubid = gen_const_xmlChar_ptr(n_pubid, 3);
41620 sysid = gen_const_xmlChar_ptr(n_sysid, 4);
41621 ndataid = gen_const_xmlChar_ptr(n_ndataid, 5);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041622
41623 ret_val = xmlTextWriterWriteDTDExternalEntity(writer, pe, name, pubid, sysid, ndataid);
41624 desret_int(ret_val);
41625 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041626 des_xmlTextWriterPtr(n_writer, writer, 0);
41627 des_int(n_pe, pe, 1);
41628 des_const_xmlChar_ptr(n_name, name, 2);
41629 des_const_xmlChar_ptr(n_pubid, pubid, 3);
41630 des_const_xmlChar_ptr(n_sysid, sysid, 4);
41631 des_const_xmlChar_ptr(n_ndataid, ndataid, 5);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041632 xmlResetLastError();
41633 if (mem_base != xmlMemBlocks()) {
41634 printf("Leak of %d blocks found in xmlTextWriterWriteDTDExternalEntity",
41635 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041636 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041637 printf(" %d", n_writer);
41638 printf(" %d", n_pe);
41639 printf(" %d", n_name);
41640 printf(" %d", n_pubid);
41641 printf(" %d", n_sysid);
41642 printf(" %d", n_ndataid);
41643 printf("\n");
41644 }
41645 }
41646 }
41647 }
41648 }
41649 }
41650 }
41651#endif
41652
Daniel Veillard3d97e662004-11-04 10:49:00 +000041653 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000041654 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041655}
41656
41657
41658static int
41659test_xmlTextWriterWriteDTDExternalEntityContents(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041660 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041661
Daniel Veillarde43cc572004-11-03 11:50:29 +000041662#ifdef LIBXML_WRITER_ENABLED
41663 int mem_base;
41664 int ret_val;
41665 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41666 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041667 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041668 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041669 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041670 int n_sysid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041671 xmlChar * ndataid; /* the xml notation name. */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041672 int n_ndataid;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041673
Daniel Veillarde43cc572004-11-03 11:50:29 +000041674 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41675 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
41676 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
41677 for (n_ndataid = 0;n_ndataid < gen_nb_const_xmlChar_ptr;n_ndataid++) {
41678 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041679 writer = gen_xmlTextWriterPtr(n_writer, 0);
41680 pubid = gen_const_xmlChar_ptr(n_pubid, 1);
41681 sysid = gen_const_xmlChar_ptr(n_sysid, 2);
41682 ndataid = gen_const_xmlChar_ptr(n_ndataid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041683
41684 ret_val = xmlTextWriterWriteDTDExternalEntityContents(writer, pubid, sysid, ndataid);
41685 desret_int(ret_val);
41686 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041687 des_xmlTextWriterPtr(n_writer, writer, 0);
41688 des_const_xmlChar_ptr(n_pubid, pubid, 1);
41689 des_const_xmlChar_ptr(n_sysid, sysid, 2);
41690 des_const_xmlChar_ptr(n_ndataid, ndataid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041691 xmlResetLastError();
41692 if (mem_base != xmlMemBlocks()) {
41693 printf("Leak of %d blocks found in xmlTextWriterWriteDTDExternalEntityContents",
41694 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041695 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041696 printf(" %d", n_writer);
41697 printf(" %d", n_pubid);
41698 printf(" %d", n_sysid);
41699 printf(" %d", n_ndataid);
41700 printf("\n");
41701 }
41702 }
41703 }
41704 }
41705 }
41706#endif
41707
Daniel Veillard3d97e662004-11-04 10:49:00 +000041708 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000041709 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041710}
41711
41712
41713static int
41714test_xmlTextWriterWriteDTDInternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041715 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041716
Daniel Veillarde43cc572004-11-03 11:50:29 +000041717#ifdef LIBXML_WRITER_ENABLED
41718 int mem_base;
41719 int ret_val;
41720 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41721 int n_writer;
41722 int pe; /* TRUE if this is a parameter entity, FALSE if not */
41723 int n_pe;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041724 xmlChar * name; /* the name of the DTD entity */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041725 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041726 xmlChar * content; /* content of the entity */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041727 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041728
Daniel Veillarde43cc572004-11-03 11:50:29 +000041729 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41730 for (n_pe = 0;n_pe < gen_nb_int;n_pe++) {
41731 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41732 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41733 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041734 writer = gen_xmlTextWriterPtr(n_writer, 0);
41735 pe = gen_int(n_pe, 1);
41736 name = gen_const_xmlChar_ptr(n_name, 2);
41737 content = gen_const_xmlChar_ptr(n_content, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041738
41739 ret_val = xmlTextWriterWriteDTDInternalEntity(writer, pe, name, content);
41740 desret_int(ret_val);
41741 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041742 des_xmlTextWriterPtr(n_writer, writer, 0);
41743 des_int(n_pe, pe, 1);
41744 des_const_xmlChar_ptr(n_name, name, 2);
41745 des_const_xmlChar_ptr(n_content, content, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041746 xmlResetLastError();
41747 if (mem_base != xmlMemBlocks()) {
41748 printf("Leak of %d blocks found in xmlTextWriterWriteDTDInternalEntity",
41749 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041750 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041751 printf(" %d", n_writer);
41752 printf(" %d", n_pe);
41753 printf(" %d", n_name);
41754 printf(" %d", n_content);
41755 printf("\n");
41756 }
41757 }
41758 }
41759 }
41760 }
41761#endif
41762
Daniel Veillard3d97e662004-11-04 10:49:00 +000041763 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000041764 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041765}
41766
41767
41768static int
41769test_xmlTextWriterWriteDTDNotation(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041770 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041771
Daniel Veillarde43cc572004-11-03 11:50:29 +000041772#ifdef LIBXML_WRITER_ENABLED
41773 int mem_base;
41774 int ret_val;
41775 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41776 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041777 xmlChar * name; /* the name of the xml notation */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041778 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041779 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041780 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041781 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041782 int n_sysid;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041783
Daniel Veillarde43cc572004-11-03 11:50:29 +000041784 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41785 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41786 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
41787 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
41788 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041789 writer = gen_xmlTextWriterPtr(n_writer, 0);
41790 name = gen_const_xmlChar_ptr(n_name, 1);
41791 pubid = gen_const_xmlChar_ptr(n_pubid, 2);
41792 sysid = gen_const_xmlChar_ptr(n_sysid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041793
41794 ret_val = xmlTextWriterWriteDTDNotation(writer, name, pubid, sysid);
41795 desret_int(ret_val);
41796 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041797 des_xmlTextWriterPtr(n_writer, writer, 0);
41798 des_const_xmlChar_ptr(n_name, name, 1);
41799 des_const_xmlChar_ptr(n_pubid, pubid, 2);
41800 des_const_xmlChar_ptr(n_sysid, sysid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041801 xmlResetLastError();
41802 if (mem_base != xmlMemBlocks()) {
41803 printf("Leak of %d blocks found in xmlTextWriterWriteDTDNotation",
41804 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041805 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041806 printf(" %d", n_writer);
41807 printf(" %d", n_name);
41808 printf(" %d", n_pubid);
41809 printf(" %d", n_sysid);
41810 printf("\n");
41811 }
41812 }
41813 }
41814 }
41815 }
41816#endif
41817
Daniel Veillard3d97e662004-11-04 10:49:00 +000041818 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000041819 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041820}
41821
41822
41823static int
41824test_xmlTextWriterWriteElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041825 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041826
Daniel Veillarde43cc572004-11-03 11:50:29 +000041827#ifdef LIBXML_WRITER_ENABLED
41828 int mem_base;
41829 int ret_val;
41830 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41831 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041832 xmlChar * name; /* element name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041833 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041834 xmlChar * content; /* element content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041835 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041836
Daniel Veillarde43cc572004-11-03 11:50:29 +000041837 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41838 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41839 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41840 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041841 writer = gen_xmlTextWriterPtr(n_writer, 0);
41842 name = gen_const_xmlChar_ptr(n_name, 1);
41843 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041844
41845 ret_val = xmlTextWriterWriteElement(writer, name, content);
41846 desret_int(ret_val);
41847 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041848 des_xmlTextWriterPtr(n_writer, writer, 0);
41849 des_const_xmlChar_ptr(n_name, name, 1);
41850 des_const_xmlChar_ptr(n_content, content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041851 xmlResetLastError();
41852 if (mem_base != xmlMemBlocks()) {
41853 printf("Leak of %d blocks found in xmlTextWriterWriteElement",
41854 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041855 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041856 printf(" %d", n_writer);
41857 printf(" %d", n_name);
41858 printf(" %d", n_content);
41859 printf("\n");
41860 }
41861 }
41862 }
41863 }
41864#endif
41865
Daniel Veillard3d97e662004-11-04 10:49:00 +000041866 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000041867 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041868}
41869
41870
41871static int
41872test_xmlTextWriterWriteElementNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041873 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041874
Daniel Veillarde43cc572004-11-03 11:50:29 +000041875#ifdef LIBXML_WRITER_ENABLED
41876 int mem_base;
41877 int ret_val;
41878 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41879 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041880 xmlChar * prefix; /* namespace prefix */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041881 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041882 xmlChar * name; /* element local name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041883 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041884 xmlChar * namespaceURI; /* namespace URI */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041885 int n_namespaceURI;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041886 xmlChar * content; /* element content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041887 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041888
Daniel Veillarde43cc572004-11-03 11:50:29 +000041889 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41890 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
41891 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41892 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
41893 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41894 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041895 writer = gen_xmlTextWriterPtr(n_writer, 0);
41896 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
41897 name = gen_const_xmlChar_ptr(n_name, 2);
41898 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 3);
41899 content = gen_const_xmlChar_ptr(n_content, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041900
41901 ret_val = xmlTextWriterWriteElementNS(writer, prefix, name, namespaceURI, content);
41902 desret_int(ret_val);
41903 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041904 des_xmlTextWriterPtr(n_writer, writer, 0);
41905 des_const_xmlChar_ptr(n_prefix, prefix, 1);
41906 des_const_xmlChar_ptr(n_name, name, 2);
41907 des_const_xmlChar_ptr(n_namespaceURI, namespaceURI, 3);
41908 des_const_xmlChar_ptr(n_content, content, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041909 xmlResetLastError();
41910 if (mem_base != xmlMemBlocks()) {
41911 printf("Leak of %d blocks found in xmlTextWriterWriteElementNS",
41912 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041913 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041914 printf(" %d", n_writer);
41915 printf(" %d", n_prefix);
41916 printf(" %d", n_name);
41917 printf(" %d", n_namespaceURI);
41918 printf(" %d", n_content);
41919 printf("\n");
41920 }
41921 }
41922 }
41923 }
41924 }
41925 }
41926#endif
41927
Daniel Veillard3d97e662004-11-04 10:49:00 +000041928 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000041929 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041930}
41931
41932
41933static int
41934test_xmlTextWriterWriteFormatAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041935 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041936
41937
41938 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000041939 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041940}
41941
41942
41943static int
41944test_xmlTextWriterWriteFormatAttributeNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041945 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041946
41947
41948 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000041949 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041950}
41951
41952
41953static int
41954test_xmlTextWriterWriteFormatCDATA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041955 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041956
41957
41958 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000041959 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041960}
41961
41962
41963static int
41964test_xmlTextWriterWriteFormatComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041965 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041966
41967
41968 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000041969 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041970}
41971
41972
41973static int
41974test_xmlTextWriterWriteFormatDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041975 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041976
41977
41978 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000041979 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041980}
41981
41982
41983static int
41984test_xmlTextWriterWriteFormatDTDAttlist(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041985 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041986
41987
41988 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000041989 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041990}
41991
41992
41993static int
41994test_xmlTextWriterWriteFormatDTDElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041995 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041996
41997
41998 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000041999 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042000}
42001
42002
42003static int
42004test_xmlTextWriterWriteFormatDTDInternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042005 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042006
42007
42008 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042009 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042010}
42011
42012
42013static int
42014test_xmlTextWriterWriteFormatElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042015 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042016
42017
42018 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042019 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042020}
42021
42022
42023static int
42024test_xmlTextWriterWriteFormatElementNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042025 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042026
42027
42028 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042029 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042030}
42031
42032
42033static int
42034test_xmlTextWriterWriteFormatPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042035 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042036
42037
42038 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042039 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042040}
42041
42042
42043static int
42044test_xmlTextWriterWriteFormatRaw(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042045 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042046
42047
42048 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042049 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042050}
42051
42052
42053static int
42054test_xmlTextWriterWriteFormatString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042055 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042056
42057
42058 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042059 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042060}
42061
42062
42063static int
42064test_xmlTextWriterWritePI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042065 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042066
Daniel Veillarde43cc572004-11-03 11:50:29 +000042067#ifdef LIBXML_WRITER_ENABLED
42068 int mem_base;
42069 int ret_val;
42070 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42071 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042072 xmlChar * target; /* PI target */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042073 int n_target;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042074 xmlChar * content; /* PI content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042075 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042076
Daniel Veillarde43cc572004-11-03 11:50:29 +000042077 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42078 for (n_target = 0;n_target < gen_nb_const_xmlChar_ptr;n_target++) {
42079 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
42080 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042081 writer = gen_xmlTextWriterPtr(n_writer, 0);
42082 target = gen_const_xmlChar_ptr(n_target, 1);
42083 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042084
42085 ret_val = xmlTextWriterWritePI(writer, target, content);
42086 desret_int(ret_val);
42087 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042088 des_xmlTextWriterPtr(n_writer, writer, 0);
42089 des_const_xmlChar_ptr(n_target, target, 1);
42090 des_const_xmlChar_ptr(n_content, content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042091 xmlResetLastError();
42092 if (mem_base != xmlMemBlocks()) {
42093 printf("Leak of %d blocks found in xmlTextWriterWritePI",
42094 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042095 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042096 printf(" %d", n_writer);
42097 printf(" %d", n_target);
42098 printf(" %d", n_content);
42099 printf("\n");
42100 }
42101 }
42102 }
42103 }
42104#endif
42105
Daniel Veillard3d97e662004-11-04 10:49:00 +000042106 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000042107 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042108}
42109
42110
42111static int
42112test_xmlTextWriterWriteRaw(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042113 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042114
Daniel Veillarde43cc572004-11-03 11:50:29 +000042115#ifdef LIBXML_WRITER_ENABLED
42116 int mem_base;
42117 int ret_val;
42118 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42119 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042120 xmlChar * content; /* text string */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042121 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042122
Daniel Veillarde43cc572004-11-03 11:50:29 +000042123 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42124 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
42125 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042126 writer = gen_xmlTextWriterPtr(n_writer, 0);
42127 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042128
42129 ret_val = xmlTextWriterWriteRaw(writer, content);
42130 desret_int(ret_val);
42131 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042132 des_xmlTextWriterPtr(n_writer, writer, 0);
42133 des_const_xmlChar_ptr(n_content, content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042134 xmlResetLastError();
42135 if (mem_base != xmlMemBlocks()) {
42136 printf("Leak of %d blocks found in xmlTextWriterWriteRaw",
42137 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042138 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042139 printf(" %d", n_writer);
42140 printf(" %d", n_content);
42141 printf("\n");
42142 }
42143 }
42144 }
42145#endif
42146
Daniel Veillard3d97e662004-11-04 10:49:00 +000042147 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000042148 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042149}
42150
42151
42152static int
42153test_xmlTextWriterWriteRawLen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042154 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042155
Daniel Veillarde43cc572004-11-03 11:50:29 +000042156#ifdef LIBXML_WRITER_ENABLED
42157 int mem_base;
42158 int ret_val;
42159 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42160 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042161 xmlChar * content; /* text string */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042162 int n_content;
42163 int len; /* length of the text string */
42164 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042165
Daniel Veillarde43cc572004-11-03 11:50:29 +000042166 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42167 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
42168 for (n_len = 0;n_len < gen_nb_int;n_len++) {
42169 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042170 writer = gen_xmlTextWriterPtr(n_writer, 0);
42171 content = gen_const_xmlChar_ptr(n_content, 1);
42172 len = gen_int(n_len, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042173
42174 ret_val = xmlTextWriterWriteRawLen(writer, content, len);
42175 desret_int(ret_val);
42176 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042177 des_xmlTextWriterPtr(n_writer, writer, 0);
42178 des_const_xmlChar_ptr(n_content, content, 1);
42179 des_int(n_len, len, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042180 xmlResetLastError();
42181 if (mem_base != xmlMemBlocks()) {
42182 printf("Leak of %d blocks found in xmlTextWriterWriteRawLen",
42183 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042184 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042185 printf(" %d", n_writer);
42186 printf(" %d", n_content);
42187 printf(" %d", n_len);
42188 printf("\n");
42189 }
42190 }
42191 }
42192 }
42193#endif
42194
Daniel Veillard3d97e662004-11-04 10:49:00 +000042195 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000042196 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042197}
42198
42199
42200static int
42201test_xmlTextWriterWriteString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042202 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042203
Daniel Veillarde43cc572004-11-03 11:50:29 +000042204#ifdef LIBXML_WRITER_ENABLED
42205 int mem_base;
42206 int ret_val;
42207 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42208 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042209 xmlChar * content; /* text string */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042210 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042211
Daniel Veillarde43cc572004-11-03 11:50:29 +000042212 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42213 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
42214 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042215 writer = gen_xmlTextWriterPtr(n_writer, 0);
42216 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042217
42218 ret_val = xmlTextWriterWriteString(writer, content);
42219 desret_int(ret_val);
42220 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042221 des_xmlTextWriterPtr(n_writer, writer, 0);
42222 des_const_xmlChar_ptr(n_content, content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042223 xmlResetLastError();
42224 if (mem_base != xmlMemBlocks()) {
42225 printf("Leak of %d blocks found in xmlTextWriterWriteString",
42226 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042227 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042228 printf(" %d", n_writer);
42229 printf(" %d", n_content);
42230 printf("\n");
42231 }
42232 }
42233 }
42234#endif
42235
Daniel Veillard3d97e662004-11-04 10:49:00 +000042236 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000042237 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042238}
42239
42240
42241static int
42242test_xmlTextWriterWriteVFormatAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042243 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042244
42245
42246 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042247 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042248}
42249
42250
42251static int
42252test_xmlTextWriterWriteVFormatAttributeNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042253 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042254
42255
42256 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042257 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042258}
42259
42260
42261static int
42262test_xmlTextWriterWriteVFormatCDATA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042263 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042264
42265
42266 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042267 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042268}
42269
42270
42271static int
42272test_xmlTextWriterWriteVFormatComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042273 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042274
42275
42276 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042277 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042278}
42279
42280
42281static int
42282test_xmlTextWriterWriteVFormatDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042283 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042284
42285
42286 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042287 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042288}
42289
42290
42291static int
42292test_xmlTextWriterWriteVFormatDTDAttlist(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042293 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042294
42295
42296 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042297 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042298}
42299
42300
42301static int
42302test_xmlTextWriterWriteVFormatDTDElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042303 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042304
42305
42306 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042307 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042308}
42309
42310
42311static int
42312test_xmlTextWriterWriteVFormatDTDInternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042313 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042314
42315
42316 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042317 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042318}
42319
42320
42321static int
42322test_xmlTextWriterWriteVFormatElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042323 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042324
42325
42326 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042327 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042328}
42329
42330
42331static int
42332test_xmlTextWriterWriteVFormatElementNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042333 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042334
42335
42336 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042337 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042338}
42339
42340
42341static int
42342test_xmlTextWriterWriteVFormatPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042343 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042344
42345
42346 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042347 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042348}
42349
42350
42351static int
42352test_xmlTextWriterWriteVFormatRaw(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042353 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042354
42355
42356 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042357 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042358}
42359
42360
42361static int
42362test_xmlTextWriterWriteVFormatString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042363 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042364
42365
42366 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042367 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042368}
42369
42370static int
42371test_xmlwriter(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042372 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042373
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000042374 printf("Testing xmlwriter : 51 of 79 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000042375 test_ret += test_xmlNewTextWriter();
42376 test_ret += test_xmlNewTextWriterFilename();
42377 test_ret += test_xmlNewTextWriterMemory();
42378 test_ret += test_xmlNewTextWriterPushParser();
42379 test_ret += test_xmlNewTextWriterTree();
42380 test_ret += test_xmlTextWriterEndAttribute();
42381 test_ret += test_xmlTextWriterEndCDATA();
42382 test_ret += test_xmlTextWriterEndComment();
42383 test_ret += test_xmlTextWriterEndDTD();
42384 test_ret += test_xmlTextWriterEndDTDAttlist();
42385 test_ret += test_xmlTextWriterEndDTDElement();
42386 test_ret += test_xmlTextWriterEndDTDEntity();
42387 test_ret += test_xmlTextWriterEndDocument();
42388 test_ret += test_xmlTextWriterEndElement();
42389 test_ret += test_xmlTextWriterEndPI();
42390 test_ret += test_xmlTextWriterFlush();
42391 test_ret += test_xmlTextWriterFullEndElement();
42392 test_ret += test_xmlTextWriterSetIndent();
42393 test_ret += test_xmlTextWriterSetIndentString();
42394 test_ret += test_xmlTextWriterStartAttribute();
42395 test_ret += test_xmlTextWriterStartAttributeNS();
42396 test_ret += test_xmlTextWriterStartCDATA();
42397 test_ret += test_xmlTextWriterStartComment();
42398 test_ret += test_xmlTextWriterStartDTD();
42399 test_ret += test_xmlTextWriterStartDTDAttlist();
42400 test_ret += test_xmlTextWriterStartDTDElement();
42401 test_ret += test_xmlTextWriterStartDTDEntity();
42402 test_ret += test_xmlTextWriterStartDocument();
42403 test_ret += test_xmlTextWriterStartElement();
42404 test_ret += test_xmlTextWriterStartElementNS();
42405 test_ret += test_xmlTextWriterStartPI();
42406 test_ret += test_xmlTextWriterWriteAttribute();
42407 test_ret += test_xmlTextWriterWriteAttributeNS();
42408 test_ret += test_xmlTextWriterWriteBase64();
42409 test_ret += test_xmlTextWriterWriteBinHex();
42410 test_ret += test_xmlTextWriterWriteCDATA();
42411 test_ret += test_xmlTextWriterWriteComment();
42412 test_ret += test_xmlTextWriterWriteDTD();
42413 test_ret += test_xmlTextWriterWriteDTDAttlist();
42414 test_ret += test_xmlTextWriterWriteDTDElement();
42415 test_ret += test_xmlTextWriterWriteDTDEntity();
42416 test_ret += test_xmlTextWriterWriteDTDExternalEntity();
42417 test_ret += test_xmlTextWriterWriteDTDExternalEntityContents();
42418 test_ret += test_xmlTextWriterWriteDTDInternalEntity();
42419 test_ret += test_xmlTextWriterWriteDTDNotation();
42420 test_ret += test_xmlTextWriterWriteElement();
42421 test_ret += test_xmlTextWriterWriteElementNS();
42422 test_ret += test_xmlTextWriterWriteFormatAttribute();
42423 test_ret += test_xmlTextWriterWriteFormatAttributeNS();
42424 test_ret += test_xmlTextWriterWriteFormatCDATA();
42425 test_ret += test_xmlTextWriterWriteFormatComment();
42426 test_ret += test_xmlTextWriterWriteFormatDTD();
42427 test_ret += test_xmlTextWriterWriteFormatDTDAttlist();
42428 test_ret += test_xmlTextWriterWriteFormatDTDElement();
42429 test_ret += test_xmlTextWriterWriteFormatDTDInternalEntity();
42430 test_ret += test_xmlTextWriterWriteFormatElement();
42431 test_ret += test_xmlTextWriterWriteFormatElementNS();
42432 test_ret += test_xmlTextWriterWriteFormatPI();
42433 test_ret += test_xmlTextWriterWriteFormatRaw();
42434 test_ret += test_xmlTextWriterWriteFormatString();
42435 test_ret += test_xmlTextWriterWritePI();
42436 test_ret += test_xmlTextWriterWriteRaw();
42437 test_ret += test_xmlTextWriterWriteRawLen();
42438 test_ret += test_xmlTextWriterWriteString();
42439 test_ret += test_xmlTextWriterWriteVFormatAttribute();
42440 test_ret += test_xmlTextWriterWriteVFormatAttributeNS();
42441 test_ret += test_xmlTextWriterWriteVFormatCDATA();
42442 test_ret += test_xmlTextWriterWriteVFormatComment();
42443 test_ret += test_xmlTextWriterWriteVFormatDTD();
42444 test_ret += test_xmlTextWriterWriteVFormatDTDAttlist();
42445 test_ret += test_xmlTextWriterWriteVFormatDTDElement();
42446 test_ret += test_xmlTextWriterWriteVFormatDTDInternalEntity();
42447 test_ret += test_xmlTextWriterWriteVFormatElement();
42448 test_ret += test_xmlTextWriterWriteVFormatElementNS();
42449 test_ret += test_xmlTextWriterWriteVFormatPI();
42450 test_ret += test_xmlTextWriterWriteVFormatRaw();
42451 test_ret += test_xmlTextWriterWriteVFormatString();
Daniel Veillardd93f6252004-11-02 15:53:51 +000042452
Daniel Veillard42595322004-11-08 10:52:06 +000042453 if (test_ret != 0)
42454 printf("Module xmlwriter: %d errors\n", test_ret);
42455 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042456}
42457
42458static int
42459test_xmlXPathCastBooleanToNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042460 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042461
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042462#ifdef LIBXML_XPATH_ENABLED
42463 int mem_base;
42464 double ret_val;
42465 int val; /* a boolean */
42466 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042467
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042468 for (n_val = 0;n_val < gen_nb_int;n_val++) {
42469 mem_base = xmlMemBlocks();
42470 val = gen_int(n_val, 0);
42471
42472 ret_val = xmlXPathCastBooleanToNumber(val);
42473 desret_double(ret_val);
42474 call_tests++;
42475 des_int(n_val, val, 0);
42476 xmlResetLastError();
42477 if (mem_base != xmlMemBlocks()) {
42478 printf("Leak of %d blocks found in xmlXPathCastBooleanToNumber",
42479 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042480 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042481 printf(" %d", n_val);
42482 printf("\n");
42483 }
42484 }
42485#endif
42486
42487 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000042488 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042489}
42490
42491
42492static int
42493test_xmlXPathCastBooleanToString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042494 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042495
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042496#ifdef LIBXML_XPATH_ENABLED
42497 int mem_base;
42498 xmlChar * ret_val;
42499 int val; /* a boolean */
42500 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042501
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042502 for (n_val = 0;n_val < gen_nb_int;n_val++) {
42503 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042504 val = gen_int(n_val, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042505
42506 ret_val = xmlXPathCastBooleanToString(val);
42507 desret_xmlChar_ptr(ret_val);
42508 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042509 des_int(n_val, val, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042510 xmlResetLastError();
42511 if (mem_base != xmlMemBlocks()) {
42512 printf("Leak of %d blocks found in xmlXPathCastBooleanToString",
42513 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042514 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042515 printf(" %d", n_val);
42516 printf("\n");
42517 }
42518 }
42519#endif
42520
Daniel Veillard3d97e662004-11-04 10:49:00 +000042521 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000042522 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042523}
42524
42525
42526static int
42527test_xmlXPathCastNodeSetToBoolean(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042528 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042529
Daniel Veillardce682bc2004-11-05 17:22:25 +000042530#ifdef LIBXML_XPATH_ENABLED
42531 int mem_base;
42532 int ret_val;
42533 xmlNodeSetPtr ns; /* a node-set */
42534 int n_ns;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042535
Daniel Veillardce682bc2004-11-05 17:22:25 +000042536 for (n_ns = 0;n_ns < gen_nb_xmlNodeSetPtr;n_ns++) {
42537 mem_base = xmlMemBlocks();
42538 ns = gen_xmlNodeSetPtr(n_ns, 0);
42539
42540 ret_val = xmlXPathCastNodeSetToBoolean(ns);
42541 desret_int(ret_val);
42542 call_tests++;
42543 des_xmlNodeSetPtr(n_ns, ns, 0);
42544 xmlResetLastError();
42545 if (mem_base != xmlMemBlocks()) {
42546 printf("Leak of %d blocks found in xmlXPathCastNodeSetToBoolean",
42547 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042548 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042549 printf(" %d", n_ns);
42550 printf("\n");
42551 }
42552 }
42553#endif
42554
42555 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000042556 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042557}
42558
42559
42560static int
42561test_xmlXPathCastNodeSetToNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042562 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042563
Daniel Veillardce682bc2004-11-05 17:22:25 +000042564#ifdef LIBXML_XPATH_ENABLED
42565 int mem_base;
42566 double ret_val;
42567 xmlNodeSetPtr ns; /* a node-set */
42568 int n_ns;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042569
Daniel Veillardce682bc2004-11-05 17:22:25 +000042570 for (n_ns = 0;n_ns < gen_nb_xmlNodeSetPtr;n_ns++) {
42571 mem_base = xmlMemBlocks();
42572 ns = gen_xmlNodeSetPtr(n_ns, 0);
42573
42574 ret_val = xmlXPathCastNodeSetToNumber(ns);
42575 desret_double(ret_val);
42576 call_tests++;
42577 des_xmlNodeSetPtr(n_ns, ns, 0);
42578 xmlResetLastError();
42579 if (mem_base != xmlMemBlocks()) {
42580 printf("Leak of %d blocks found in xmlXPathCastNodeSetToNumber",
42581 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042582 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042583 printf(" %d", n_ns);
42584 printf("\n");
42585 }
42586 }
42587#endif
42588
42589 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000042590 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042591}
42592
42593
42594static int
42595test_xmlXPathCastNodeSetToString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042596 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042597
Daniel Veillardce682bc2004-11-05 17:22:25 +000042598#ifdef LIBXML_XPATH_ENABLED
42599 int mem_base;
42600 xmlChar * ret_val;
42601 xmlNodeSetPtr ns; /* a node-set */
42602 int n_ns;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042603
Daniel Veillardce682bc2004-11-05 17:22:25 +000042604 for (n_ns = 0;n_ns < gen_nb_xmlNodeSetPtr;n_ns++) {
42605 mem_base = xmlMemBlocks();
42606 ns = gen_xmlNodeSetPtr(n_ns, 0);
42607
42608 ret_val = xmlXPathCastNodeSetToString(ns);
42609 desret_xmlChar_ptr(ret_val);
42610 call_tests++;
42611 des_xmlNodeSetPtr(n_ns, ns, 0);
42612 xmlResetLastError();
42613 if (mem_base != xmlMemBlocks()) {
42614 printf("Leak of %d blocks found in xmlXPathCastNodeSetToString",
42615 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042616 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042617 printf(" %d", n_ns);
42618 printf("\n");
42619 }
42620 }
42621#endif
42622
42623 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000042624 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042625}
42626
42627
42628static int
42629test_xmlXPathCastNodeToNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042630 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042631
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042632#ifdef LIBXML_XPATH_ENABLED
42633 int mem_base;
42634 double ret_val;
42635 xmlNodePtr node; /* a node */
42636 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042637
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042638 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
42639 mem_base = xmlMemBlocks();
42640 node = gen_xmlNodePtr(n_node, 0);
42641
42642 ret_val = xmlXPathCastNodeToNumber(node);
42643 desret_double(ret_val);
42644 call_tests++;
42645 des_xmlNodePtr(n_node, node, 0);
42646 xmlResetLastError();
42647 if (mem_base != xmlMemBlocks()) {
42648 printf("Leak of %d blocks found in xmlXPathCastNodeToNumber",
42649 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042650 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042651 printf(" %d", n_node);
42652 printf("\n");
42653 }
42654 }
42655#endif
42656
42657 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000042658 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042659}
42660
42661
42662static int
42663test_xmlXPathCastNodeToString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042664 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042665
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042666#ifdef LIBXML_XPATH_ENABLED
42667 int mem_base;
42668 xmlChar * ret_val;
42669 xmlNodePtr node; /* a node */
42670 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042671
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042672 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
42673 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042674 node = gen_xmlNodePtr(n_node, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042675
42676 ret_val = xmlXPathCastNodeToString(node);
42677 desret_xmlChar_ptr(ret_val);
42678 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042679 des_xmlNodePtr(n_node, node, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042680 xmlResetLastError();
42681 if (mem_base != xmlMemBlocks()) {
42682 printf("Leak of %d blocks found in xmlXPathCastNodeToString",
42683 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042684 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042685 printf(" %d", n_node);
42686 printf("\n");
42687 }
42688 }
42689#endif
42690
Daniel Veillard3d97e662004-11-04 10:49:00 +000042691 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000042692 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042693}
42694
42695
42696static int
42697test_xmlXPathCastNumberToBoolean(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042698 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042699
Daniel Veillard3d95c732004-11-06 22:25:14 +000042700#ifdef LIBXML_XPATH_ENABLED
42701 int mem_base;
42702 int ret_val;
42703 double val; /* a number */
42704 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042705
Daniel Veillard3d95c732004-11-06 22:25:14 +000042706 for (n_val = 0;n_val < gen_nb_double;n_val++) {
42707 mem_base = xmlMemBlocks();
42708 val = gen_double(n_val, 0);
42709
42710 ret_val = xmlXPathCastNumberToBoolean(val);
42711 desret_int(ret_val);
42712 call_tests++;
42713 des_double(n_val, val, 0);
42714 xmlResetLastError();
42715 if (mem_base != xmlMemBlocks()) {
42716 printf("Leak of %d blocks found in xmlXPathCastNumberToBoolean",
42717 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042718 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000042719 printf(" %d", n_val);
42720 printf("\n");
42721 }
42722 }
42723#endif
42724
42725 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000042726 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042727}
42728
42729
42730static int
42731test_xmlXPathCastNumberToString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042732 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042733
Daniel Veillard3d95c732004-11-06 22:25:14 +000042734#ifdef LIBXML_XPATH_ENABLED
42735 int mem_base;
42736 xmlChar * ret_val;
42737 double val; /* a number */
42738 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042739
Daniel Veillard3d95c732004-11-06 22:25:14 +000042740 for (n_val = 0;n_val < gen_nb_double;n_val++) {
42741 mem_base = xmlMemBlocks();
42742 val = gen_double(n_val, 0);
42743
42744 ret_val = xmlXPathCastNumberToString(val);
42745 desret_xmlChar_ptr(ret_val);
42746 call_tests++;
42747 des_double(n_val, val, 0);
42748 xmlResetLastError();
42749 if (mem_base != xmlMemBlocks()) {
42750 printf("Leak of %d blocks found in xmlXPathCastNumberToString",
42751 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042752 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000042753 printf(" %d", n_val);
42754 printf("\n");
42755 }
42756 }
42757#endif
42758
42759 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000042760 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042761}
42762
42763
42764static int
42765test_xmlXPathCastStringToBoolean(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042766 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042767
42768#ifdef LIBXML_XPATH_ENABLED
42769 int mem_base;
42770 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042771 xmlChar * val; /* a string */
Daniel Veillardd93f6252004-11-02 15:53:51 +000042772 int n_val;
42773
42774 for (n_val = 0;n_val < gen_nb_const_xmlChar_ptr;n_val++) {
42775 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042776 val = gen_const_xmlChar_ptr(n_val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042777
42778 ret_val = xmlXPathCastStringToBoolean(val);
42779 desret_int(ret_val);
42780 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042781 des_const_xmlChar_ptr(n_val, val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042782 xmlResetLastError();
42783 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000042784 printf("Leak of %d blocks found in xmlXPathCastStringToBoolean",
Daniel Veillardd93f6252004-11-02 15:53:51 +000042785 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042786 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000042787 printf(" %d", n_val);
42788 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000042789 }
42790 }
42791#endif
42792
Daniel Veillard3d97e662004-11-04 10:49:00 +000042793 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000042794 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042795}
42796
42797
42798static int
42799test_xmlXPathCastStringToNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042800 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042801
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042802#ifdef LIBXML_XPATH_ENABLED
42803 int mem_base;
42804 double ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042805 xmlChar * val; /* a string */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042806 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042807
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042808 for (n_val = 0;n_val < gen_nb_const_xmlChar_ptr;n_val++) {
42809 mem_base = xmlMemBlocks();
42810 val = gen_const_xmlChar_ptr(n_val, 0);
42811
42812 ret_val = xmlXPathCastStringToNumber(val);
42813 desret_double(ret_val);
42814 call_tests++;
42815 des_const_xmlChar_ptr(n_val, val, 0);
42816 xmlResetLastError();
42817 if (mem_base != xmlMemBlocks()) {
42818 printf("Leak of %d blocks found in xmlXPathCastStringToNumber",
42819 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042820 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042821 printf(" %d", n_val);
42822 printf("\n");
42823 }
42824 }
42825#endif
42826
42827 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000042828 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042829}
42830
42831
42832static int
42833test_xmlXPathCastToBoolean(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042834 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042835
Daniel Veillardd005b9e2004-11-03 17:07:05 +000042836#ifdef LIBXML_XPATH_ENABLED
42837 int mem_base;
42838 int ret_val;
42839 xmlXPathObjectPtr val; /* an XPath object */
42840 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042841
Daniel Veillardd005b9e2004-11-03 17:07:05 +000042842 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
42843 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042844 val = gen_xmlXPathObjectPtr(n_val, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000042845
42846 ret_val = xmlXPathCastToBoolean(val);
42847 desret_int(ret_val);
42848 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042849 des_xmlXPathObjectPtr(n_val, val, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000042850 xmlResetLastError();
42851 if (mem_base != xmlMemBlocks()) {
42852 printf("Leak of %d blocks found in xmlXPathCastToBoolean",
42853 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042854 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000042855 printf(" %d", n_val);
42856 printf("\n");
42857 }
42858 }
42859#endif
42860
Daniel Veillard3d97e662004-11-04 10:49:00 +000042861 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000042862 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042863}
42864
42865
42866static int
42867test_xmlXPathCastToNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042868 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042869
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042870#ifdef LIBXML_XPATH_ENABLED
42871 int mem_base;
42872 double ret_val;
42873 xmlXPathObjectPtr val; /* an XPath object */
42874 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042875
Daniel Veillard1ba06bb2004-11-04 12:32:18 +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 = xmlXPathCastToNumber(val);
42881 desret_double(ret_val);
42882 call_tests++;
42883 des_xmlXPathObjectPtr(n_val, val, 0);
42884 xmlResetLastError();
42885 if (mem_base != xmlMemBlocks()) {
42886 printf("Leak of %d blocks found in xmlXPathCastToNumber",
42887 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042888 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042889 printf(" %d", n_val);
42890 printf("\n");
42891 }
42892 }
42893#endif
42894
42895 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000042896 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042897}
42898
42899
42900static int
42901test_xmlXPathCastToString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042902 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042903
Daniel Veillardd005b9e2004-11-03 17:07:05 +000042904#ifdef LIBXML_XPATH_ENABLED
42905 int mem_base;
42906 xmlChar * ret_val;
42907 xmlXPathObjectPtr val; /* an XPath object */
42908 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042909
Daniel Veillardd005b9e2004-11-03 17:07:05 +000042910 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
42911 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042912 val = gen_xmlXPathObjectPtr(n_val, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000042913
42914 ret_val = xmlXPathCastToString(val);
42915 desret_xmlChar_ptr(ret_val);
42916 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042917 des_xmlXPathObjectPtr(n_val, val, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000042918 xmlResetLastError();
42919 if (mem_base != xmlMemBlocks()) {
42920 printf("Leak of %d blocks found in xmlXPathCastToString",
42921 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042922 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000042923 printf(" %d", n_val);
42924 printf("\n");
42925 }
42926 }
42927#endif
42928
Daniel Veillard3d97e662004-11-04 10:49:00 +000042929 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000042930 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042931}
42932
42933
42934static int
42935test_xmlXPathCmpNodes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042936 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042937
42938#ifdef LIBXML_XPATH_ENABLED
42939 int mem_base;
42940 int ret_val;
42941 xmlNodePtr node1; /* the first node */
42942 int n_node1;
42943 xmlNodePtr node2; /* the second node */
42944 int n_node2;
42945
42946 for (n_node1 = 0;n_node1 < gen_nb_xmlNodePtr;n_node1++) {
42947 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
42948 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042949 node1 = gen_xmlNodePtr(n_node1, 0);
42950 node2 = gen_xmlNodePtr(n_node2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042951
42952 ret_val = xmlXPathCmpNodes(node1, node2);
42953 desret_int(ret_val);
42954 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042955 des_xmlNodePtr(n_node1, node1, 0);
42956 des_xmlNodePtr(n_node2, node2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042957 xmlResetLastError();
42958 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000042959 printf("Leak of %d blocks found in xmlXPathCmpNodes",
Daniel Veillardd93f6252004-11-02 15:53:51 +000042960 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042961 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000042962 printf(" %d", n_node1);
42963 printf(" %d", n_node2);
42964 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000042965 }
42966 }
42967 }
42968#endif
42969
Daniel Veillard3d97e662004-11-04 10:49:00 +000042970 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000042971 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042972}
42973
42974
42975static int
42976test_xmlXPathCompile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042977 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042978
42979
42980 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042981 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042982}
42983
Daniel Veillarda521d282004-11-09 14:59:59 +000042984#ifdef LIBXML_XPATH_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000042985
Daniel Veillardce682bc2004-11-05 17:22:25 +000042986#define gen_nb_xmlXPathCompExprPtr 1
42987static xmlXPathCompExprPtr gen_xmlXPathCompExprPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
42988 return(NULL);
42989}
42990static void des_xmlXPathCompExprPtr(int no ATTRIBUTE_UNUSED, xmlXPathCompExprPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
42991}
Daniel Veillarda521d282004-11-09 14:59:59 +000042992#endif
42993
42994#ifdef LIBXML_XPATH_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000042995
42996#define gen_nb_xmlXPathContextPtr 1
42997static xmlXPathContextPtr gen_xmlXPathContextPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
42998 return(NULL);
42999}
43000static void des_xmlXPathContextPtr(int no ATTRIBUTE_UNUSED, xmlXPathContextPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
43001}
Daniel Veillarda521d282004-11-09 14:59:59 +000043002#endif
43003
Daniel Veillardce682bc2004-11-05 17:22:25 +000043004
Daniel Veillardd93f6252004-11-02 15:53:51 +000043005static int
43006test_xmlXPathCompiledEval(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043007 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043008
Daniel Veillardce682bc2004-11-05 17:22:25 +000043009#ifdef LIBXML_XPATH_ENABLED
43010 int mem_base;
43011 xmlXPathObjectPtr ret_val;
43012 xmlXPathCompExprPtr comp; /* the compiled XPath expression */
43013 int n_comp;
43014 xmlXPathContextPtr ctx; /* the XPath context */
43015 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043016
Daniel Veillardce682bc2004-11-05 17:22:25 +000043017 for (n_comp = 0;n_comp < gen_nb_xmlXPathCompExprPtr;n_comp++) {
43018 for (n_ctx = 0;n_ctx < gen_nb_xmlXPathContextPtr;n_ctx++) {
43019 mem_base = xmlMemBlocks();
43020 comp = gen_xmlXPathCompExprPtr(n_comp, 0);
43021 ctx = gen_xmlXPathContextPtr(n_ctx, 1);
43022
43023 ret_val = xmlXPathCompiledEval(comp, ctx);
43024 desret_xmlXPathObjectPtr(ret_val);
43025 call_tests++;
43026 des_xmlXPathCompExprPtr(n_comp, comp, 0);
43027 des_xmlXPathContextPtr(n_ctx, ctx, 1);
43028 xmlResetLastError();
43029 if (mem_base != xmlMemBlocks()) {
43030 printf("Leak of %d blocks found in xmlXPathCompiledEval",
43031 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043032 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043033 printf(" %d", n_comp);
43034 printf(" %d", n_ctx);
43035 printf("\n");
43036 }
43037 }
43038 }
43039#endif
43040
43041 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000043042 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043043}
43044
43045
43046static int
43047test_xmlXPathConvertBoolean(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043048 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043049
Daniel Veillard3d97e662004-11-04 10:49:00 +000043050#ifdef LIBXML_XPATH_ENABLED
43051 int mem_base;
43052 xmlXPathObjectPtr ret_val;
43053 xmlXPathObjectPtr val; /* an XPath object */
43054 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043055
Daniel Veillard3d97e662004-11-04 10:49:00 +000043056 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
43057 mem_base = xmlMemBlocks();
43058 val = gen_xmlXPathObjectPtr(n_val, 0);
43059
43060 ret_val = xmlXPathConvertBoolean(val);
43061 val = NULL;
43062 desret_xmlXPathObjectPtr(ret_val);
43063 call_tests++;
43064 des_xmlXPathObjectPtr(n_val, val, 0);
43065 xmlResetLastError();
43066 if (mem_base != xmlMemBlocks()) {
43067 printf("Leak of %d blocks found in xmlXPathConvertBoolean",
43068 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043069 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043070 printf(" %d", n_val);
43071 printf("\n");
43072 }
43073 }
43074#endif
43075
43076 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000043077 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043078}
43079
43080
43081static int
43082test_xmlXPathConvertNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043083 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043084
Daniel Veillard3d97e662004-11-04 10:49:00 +000043085#ifdef LIBXML_XPATH_ENABLED
43086 int mem_base;
43087 xmlXPathObjectPtr ret_val;
43088 xmlXPathObjectPtr val; /* an XPath object */
43089 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043090
Daniel Veillard3d97e662004-11-04 10:49:00 +000043091 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
43092 mem_base = xmlMemBlocks();
43093 val = gen_xmlXPathObjectPtr(n_val, 0);
43094
43095 ret_val = xmlXPathConvertNumber(val);
43096 val = NULL;
43097 desret_xmlXPathObjectPtr(ret_val);
43098 call_tests++;
43099 des_xmlXPathObjectPtr(n_val, val, 0);
43100 xmlResetLastError();
43101 if (mem_base != xmlMemBlocks()) {
43102 printf("Leak of %d blocks found in xmlXPathConvertNumber",
43103 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043104 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043105 printf(" %d", n_val);
43106 printf("\n");
43107 }
43108 }
43109#endif
43110
43111 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000043112 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043113}
43114
43115
43116static int
43117test_xmlXPathConvertString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043118 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043119
Daniel Veillard3d97e662004-11-04 10:49:00 +000043120#ifdef LIBXML_XPATH_ENABLED
43121 int mem_base;
43122 xmlXPathObjectPtr ret_val;
43123 xmlXPathObjectPtr val; /* an XPath object */
43124 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043125
Daniel Veillard3d97e662004-11-04 10:49:00 +000043126 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
43127 mem_base = xmlMemBlocks();
43128 val = gen_xmlXPathObjectPtr(n_val, 0);
43129
43130 ret_val = xmlXPathConvertString(val);
43131 val = NULL;
43132 desret_xmlXPathObjectPtr(ret_val);
43133 call_tests++;
43134 des_xmlXPathObjectPtr(n_val, val, 0);
43135 xmlResetLastError();
43136 if (mem_base != xmlMemBlocks()) {
43137 printf("Leak of %d blocks found in xmlXPathConvertString",
43138 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043139 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043140 printf(" %d", n_val);
43141 printf("\n");
43142 }
43143 }
43144#endif
43145
43146 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000043147 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043148}
43149
43150
43151static int
43152test_xmlXPathCtxtCompile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043153 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043154
43155
43156 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000043157 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043158}
43159
43160
43161static int
43162test_xmlXPathEval(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043163 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043164
Daniel Veillardce682bc2004-11-05 17:22:25 +000043165#ifdef LIBXML_XPATH_ENABLED
43166 int mem_base;
43167 xmlXPathObjectPtr ret_val;
43168 xmlChar * str; /* the XPath expression */
43169 int n_str;
43170 xmlXPathContextPtr ctx; /* the XPath context */
43171 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043172
Daniel Veillardce682bc2004-11-05 17:22:25 +000043173 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
43174 for (n_ctx = 0;n_ctx < gen_nb_xmlXPathContextPtr;n_ctx++) {
43175 mem_base = xmlMemBlocks();
43176 str = gen_const_xmlChar_ptr(n_str, 0);
43177 ctx = gen_xmlXPathContextPtr(n_ctx, 1);
43178
43179 ret_val = xmlXPathEval(str, ctx);
43180 desret_xmlXPathObjectPtr(ret_val);
43181 call_tests++;
43182 des_const_xmlChar_ptr(n_str, str, 0);
43183 des_xmlXPathContextPtr(n_ctx, ctx, 1);
43184 xmlResetLastError();
43185 if (mem_base != xmlMemBlocks()) {
43186 printf("Leak of %d blocks found in xmlXPathEval",
43187 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043188 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043189 printf(" %d", n_str);
43190 printf(" %d", n_ctx);
43191 printf("\n");
43192 }
43193 }
43194 }
43195#endif
43196
43197 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000043198 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043199}
43200
43201
43202static int
43203test_xmlXPathEvalExpression(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043204 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043205
Daniel Veillardce682bc2004-11-05 17:22:25 +000043206#ifdef LIBXML_XPATH_ENABLED
43207 int mem_base;
43208 xmlXPathObjectPtr ret_val;
43209 xmlChar * str; /* the XPath expression */
43210 int n_str;
43211 xmlXPathContextPtr ctxt; /* the XPath context */
43212 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043213
Daniel Veillardce682bc2004-11-05 17:22:25 +000043214 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
43215 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
43216 mem_base = xmlMemBlocks();
43217 str = gen_const_xmlChar_ptr(n_str, 0);
43218 ctxt = gen_xmlXPathContextPtr(n_ctxt, 1);
43219
43220 ret_val = xmlXPathEvalExpression(str, ctxt);
43221 desret_xmlXPathObjectPtr(ret_val);
43222 call_tests++;
43223 des_const_xmlChar_ptr(n_str, str, 0);
43224 des_xmlXPathContextPtr(n_ctxt, ctxt, 1);
43225 xmlResetLastError();
43226 if (mem_base != xmlMemBlocks()) {
43227 printf("Leak of %d blocks found in xmlXPathEvalExpression",
43228 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043229 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043230 printf(" %d", n_str);
43231 printf(" %d", n_ctxt);
43232 printf("\n");
43233 }
43234 }
43235 }
43236#endif
43237
43238 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000043239 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043240}
43241
43242
43243static int
43244test_xmlXPathEvalPredicate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043245 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043246
Daniel Veillardce682bc2004-11-05 17:22:25 +000043247#ifdef LIBXML_XPATH_ENABLED
43248 int mem_base;
43249 int ret_val;
43250 xmlXPathContextPtr ctxt; /* the XPath context */
43251 int n_ctxt;
43252 xmlXPathObjectPtr res; /* the Predicate Expression evaluation result */
43253 int n_res;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043254
Daniel Veillardce682bc2004-11-05 17:22:25 +000043255 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
43256 for (n_res = 0;n_res < gen_nb_xmlXPathObjectPtr;n_res++) {
43257 mem_base = xmlMemBlocks();
43258 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
43259 res = gen_xmlXPathObjectPtr(n_res, 1);
43260
43261 ret_val = xmlXPathEvalPredicate(ctxt, res);
43262 desret_int(ret_val);
43263 call_tests++;
43264 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
43265 des_xmlXPathObjectPtr(n_res, res, 1);
43266 xmlResetLastError();
43267 if (mem_base != xmlMemBlocks()) {
43268 printf("Leak of %d blocks found in xmlXPathEvalPredicate",
43269 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043270 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043271 printf(" %d", n_ctxt);
43272 printf(" %d", n_res);
43273 printf("\n");
43274 }
43275 }
43276 }
43277#endif
43278
43279 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000043280 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043281}
43282
43283
43284static int
43285test_xmlXPathInit(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043286 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043287
43288#ifdef LIBXML_XPATH_ENABLED
43289 int mem_base;
43290
43291 mem_base = xmlMemBlocks();
43292
43293 xmlXPathInit();
43294 call_tests++;
43295 xmlResetLastError();
43296 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000043297 printf("Leak of %d blocks found in xmlXPathInit",
Daniel Veillardd93f6252004-11-02 15:53:51 +000043298 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043299 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000043300 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000043301 }
43302#endif
43303
Daniel Veillard3d97e662004-11-04 10:49:00 +000043304 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000043305 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043306}
43307
43308
43309static int
43310test_xmlXPathIsInf(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043311 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043312
Daniel Veillard3d95c732004-11-06 22:25:14 +000043313#ifdef LIBXML_XPATH_ENABLED
43314 int mem_base;
43315 int ret_val;
43316 double val; /* a double value */
43317 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043318
Daniel Veillard3d95c732004-11-06 22:25:14 +000043319 for (n_val = 0;n_val < gen_nb_double;n_val++) {
43320 mem_base = xmlMemBlocks();
43321 val = gen_double(n_val, 0);
43322
43323 ret_val = xmlXPathIsInf(val);
43324 desret_int(ret_val);
43325 call_tests++;
43326 des_double(n_val, val, 0);
43327 xmlResetLastError();
43328 if (mem_base != xmlMemBlocks()) {
43329 printf("Leak of %d blocks found in xmlXPathIsInf",
43330 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043331 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000043332 printf(" %d", n_val);
43333 printf("\n");
43334 }
43335 }
43336#endif
43337
43338 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000043339 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043340}
43341
43342
43343static int
43344test_xmlXPathIsNaN(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043345 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043346
Daniel Veillard3d95c732004-11-06 22:25:14 +000043347#ifdef LIBXML_XPATH_ENABLED
43348 int mem_base;
43349 int ret_val;
43350 double val; /* a double value */
43351 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043352
Daniel Veillard3d95c732004-11-06 22:25:14 +000043353 for (n_val = 0;n_val < gen_nb_double;n_val++) {
43354 mem_base = xmlMemBlocks();
43355 val = gen_double(n_val, 0);
43356
43357 ret_val = xmlXPathIsNaN(val);
43358 desret_int(ret_val);
43359 call_tests++;
43360 des_double(n_val, val, 0);
43361 xmlResetLastError();
43362 if (mem_base != xmlMemBlocks()) {
43363 printf("Leak of %d blocks found in xmlXPathIsNaN",
43364 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043365 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000043366 printf(" %d", n_val);
43367 printf("\n");
43368 }
43369 }
43370#endif
43371
43372 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000043373 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043374}
43375
43376
43377static int
43378test_xmlXPathNewContext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043379 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043380
43381
43382 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000043383 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043384}
43385
43386
43387static int
43388test_xmlXPathNodeSetCreate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043389 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043390
Daniel Veillardf2a36f92004-11-08 17:55:01 +000043391#ifdef LIBXML_XPATH_ENABLED
43392 int mem_base;
43393 xmlNodeSetPtr ret_val;
43394 xmlNodePtr val; /* an initial xmlNodePtr, or NULL */
43395 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043396
Daniel Veillardf2a36f92004-11-08 17:55:01 +000043397 for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
43398 mem_base = xmlMemBlocks();
43399 val = gen_xmlNodePtr(n_val, 0);
43400
43401 ret_val = xmlXPathNodeSetCreate(val);
43402 desret_xmlNodeSetPtr(ret_val);
43403 call_tests++;
43404 des_xmlNodePtr(n_val, val, 0);
43405 xmlResetLastError();
43406 if (mem_base != xmlMemBlocks()) {
43407 printf("Leak of %d blocks found in xmlXPathNodeSetCreate",
43408 xmlMemBlocks() - mem_base);
43409 test_ret++;
43410 printf(" %d", n_val);
43411 printf("\n");
43412 }
43413 }
43414#endif
43415
43416 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000043417 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043418}
43419
43420
43421static int
43422test_xmlXPathObjectCopy(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043423 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043424
Daniel Veillard3d97e662004-11-04 10:49:00 +000043425#ifdef LIBXML_XPATH_ENABLED
43426 int mem_base;
43427 xmlXPathObjectPtr ret_val;
43428 xmlXPathObjectPtr val; /* the original object */
43429 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043430
Daniel Veillard3d97e662004-11-04 10:49:00 +000043431 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
43432 mem_base = xmlMemBlocks();
43433 val = gen_xmlXPathObjectPtr(n_val, 0);
43434
43435 ret_val = xmlXPathObjectCopy(val);
43436 desret_xmlXPathObjectPtr(ret_val);
43437 call_tests++;
43438 des_xmlXPathObjectPtr(n_val, val, 0);
43439 xmlResetLastError();
43440 if (mem_base != xmlMemBlocks()) {
43441 printf("Leak of %d blocks found in xmlXPathObjectCopy",
43442 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043443 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043444 printf(" %d", n_val);
43445 printf("\n");
43446 }
43447 }
43448#endif
43449
43450 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000043451 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043452}
43453
43454
43455static int
43456test_xmlXPathOrderDocElems(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043457 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043458
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043459#ifdef LIBXML_XPATH_ENABLED
43460 int mem_base;
43461 long ret_val;
43462 xmlDocPtr doc; /* an input document */
43463 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043464
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043465 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
43466 mem_base = xmlMemBlocks();
43467 doc = gen_xmlDocPtr(n_doc, 0);
43468
43469 ret_val = xmlXPathOrderDocElems(doc);
43470 desret_long(ret_val);
43471 call_tests++;
43472 des_xmlDocPtr(n_doc, doc, 0);
43473 xmlResetLastError();
43474 if (mem_base != xmlMemBlocks()) {
43475 printf("Leak of %d blocks found in xmlXPathOrderDocElems",
43476 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043477 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043478 printf(" %d", n_doc);
43479 printf("\n");
43480 }
43481 }
43482#endif
43483
43484 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000043485 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043486}
43487
43488static int
43489test_xpath(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043490 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043491
Daniel Veillardf2a36f92004-11-08 17:55:01 +000043492 printf("Testing xpath : 28 of 36 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000043493 test_ret += test_xmlXPathCastBooleanToNumber();
43494 test_ret += test_xmlXPathCastBooleanToString();
43495 test_ret += test_xmlXPathCastNodeSetToBoolean();
43496 test_ret += test_xmlXPathCastNodeSetToNumber();
43497 test_ret += test_xmlXPathCastNodeSetToString();
43498 test_ret += test_xmlXPathCastNodeToNumber();
43499 test_ret += test_xmlXPathCastNodeToString();
43500 test_ret += test_xmlXPathCastNumberToBoolean();
43501 test_ret += test_xmlXPathCastNumberToString();
43502 test_ret += test_xmlXPathCastStringToBoolean();
43503 test_ret += test_xmlXPathCastStringToNumber();
43504 test_ret += test_xmlXPathCastToBoolean();
43505 test_ret += test_xmlXPathCastToNumber();
43506 test_ret += test_xmlXPathCastToString();
43507 test_ret += test_xmlXPathCmpNodes();
43508 test_ret += test_xmlXPathCompile();
43509 test_ret += test_xmlXPathCompiledEval();
43510 test_ret += test_xmlXPathConvertBoolean();
43511 test_ret += test_xmlXPathConvertNumber();
43512 test_ret += test_xmlXPathConvertString();
43513 test_ret += test_xmlXPathCtxtCompile();
43514 test_ret += test_xmlXPathEval();
43515 test_ret += test_xmlXPathEvalExpression();
43516 test_ret += test_xmlXPathEvalPredicate();
43517 test_ret += test_xmlXPathInit();
43518 test_ret += test_xmlXPathIsInf();
43519 test_ret += test_xmlXPathIsNaN();
43520 test_ret += test_xmlXPathNewContext();
43521 test_ret += test_xmlXPathNodeSetCreate();
43522 test_ret += test_xmlXPathObjectCopy();
43523 test_ret += test_xmlXPathOrderDocElems();
Daniel Veillardd93f6252004-11-02 15:53:51 +000043524
Daniel Veillard42595322004-11-08 10:52:06 +000043525 if (test_ret != 0)
43526 printf("Module xpath: %d errors\n", test_ret);
43527 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043528}
Daniel Veillarda521d282004-11-09 14:59:59 +000043529#ifdef LIBXML_XPATH_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000043530
Daniel Veillarda82b1822004-11-08 16:24:57 +000043531#define gen_nb_xmlXPathParserContextPtr 1
43532static xmlXPathParserContextPtr gen_xmlXPathParserContextPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
43533 return(NULL);
43534}
43535static void des_xmlXPathParserContextPtr(int no ATTRIBUTE_UNUSED, xmlXPathParserContextPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
43536}
Daniel Veillarda521d282004-11-09 14:59:59 +000043537#endif
43538
Daniel Veillarda82b1822004-11-08 16:24:57 +000043539
43540static int
43541test_valuePop(void) {
43542 int test_ret = 0;
43543
43544#ifdef LIBXML_XPATH_ENABLED
43545 int mem_base;
43546 xmlXPathObjectPtr ret_val;
43547 xmlXPathParserContextPtr ctxt; /* an XPath evaluation context */
43548 int n_ctxt;
43549
43550 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43551 mem_base = xmlMemBlocks();
43552 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43553
43554 ret_val = valuePop(ctxt);
43555 desret_xmlXPathObjectPtr(ret_val);
43556 call_tests++;
43557 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43558 xmlResetLastError();
43559 if (mem_base != xmlMemBlocks()) {
43560 printf("Leak of %d blocks found in valuePop",
43561 xmlMemBlocks() - mem_base);
43562 test_ret++;
43563 printf(" %d", n_ctxt);
43564 printf("\n");
43565 }
43566 }
43567#endif
43568
43569 function_tests++;
43570 return(test_ret);
43571}
43572
43573
43574static int
43575test_valuePush(void) {
43576 int test_ret = 0;
43577
43578#ifdef LIBXML_XPATH_ENABLED
43579 int mem_base;
43580 int ret_val;
43581 xmlXPathParserContextPtr ctxt; /* an XPath evaluation context */
43582 int n_ctxt;
43583 xmlXPathObjectPtr value; /* the XPath object */
43584 int n_value;
43585
43586 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43587 for (n_value = 0;n_value < gen_nb_xmlXPathObjectPtr;n_value++) {
43588 mem_base = xmlMemBlocks();
43589 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43590 value = gen_xmlXPathObjectPtr(n_value, 1);
43591
43592 ret_val = valuePush(ctxt, value);
43593 desret_int(ret_val);
43594 call_tests++;
43595 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43596 des_xmlXPathObjectPtr(n_value, value, 1);
43597 xmlResetLastError();
43598 if (mem_base != xmlMemBlocks()) {
43599 printf("Leak of %d blocks found in valuePush",
43600 xmlMemBlocks() - mem_base);
43601 test_ret++;
43602 printf(" %d", n_ctxt);
43603 printf(" %d", n_value);
43604 printf("\n");
43605 }
43606 }
43607 }
43608#endif
43609
43610 function_tests++;
43611 return(test_ret);
43612}
43613
43614
43615static int
43616test_xmlXPathAddValues(void) {
43617 int test_ret = 0;
43618
43619#ifdef LIBXML_XPATH_ENABLED
43620 int mem_base;
43621 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
43622 int n_ctxt;
43623
43624 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43625 mem_base = xmlMemBlocks();
43626 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43627
43628 xmlXPathAddValues(ctxt);
43629 call_tests++;
43630 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43631 xmlResetLastError();
43632 if (mem_base != xmlMemBlocks()) {
43633 printf("Leak of %d blocks found in xmlXPathAddValues",
43634 xmlMemBlocks() - mem_base);
43635 test_ret++;
43636 printf(" %d", n_ctxt);
43637 printf("\n");
43638 }
43639 }
43640#endif
43641
43642 function_tests++;
43643 return(test_ret);
43644}
43645
43646
43647static int
43648test_xmlXPathBooleanFunction(void) {
43649 int test_ret = 0;
43650
43651#ifdef LIBXML_XPATH_ENABLED
43652 int mem_base;
43653 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
43654 int n_ctxt;
43655 int nargs; /* the number of arguments */
43656 int n_nargs;
43657
43658 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43659 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
43660 mem_base = xmlMemBlocks();
43661 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43662 nargs = gen_int(n_nargs, 1);
43663
43664 xmlXPathBooleanFunction(ctxt, nargs);
43665 call_tests++;
43666 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43667 des_int(n_nargs, nargs, 1);
43668 xmlResetLastError();
43669 if (mem_base != xmlMemBlocks()) {
43670 printf("Leak of %d blocks found in xmlXPathBooleanFunction",
43671 xmlMemBlocks() - mem_base);
43672 test_ret++;
43673 printf(" %d", n_ctxt);
43674 printf(" %d", n_nargs);
43675 printf("\n");
43676 }
43677 }
43678 }
43679#endif
43680
43681 function_tests++;
43682 return(test_ret);
43683}
43684
43685
43686static int
43687test_xmlXPathCeilingFunction(void) {
43688 int test_ret = 0;
43689
43690#ifdef LIBXML_XPATH_ENABLED
43691 int mem_base;
43692 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
43693 int n_ctxt;
43694 int nargs; /* the number of arguments */
43695 int n_nargs;
43696
43697 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43698 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
43699 mem_base = xmlMemBlocks();
43700 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43701 nargs = gen_int(n_nargs, 1);
43702
43703 xmlXPathCeilingFunction(ctxt, nargs);
43704 call_tests++;
43705 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43706 des_int(n_nargs, nargs, 1);
43707 xmlResetLastError();
43708 if (mem_base != xmlMemBlocks()) {
43709 printf("Leak of %d blocks found in xmlXPathCeilingFunction",
43710 xmlMemBlocks() - mem_base);
43711 test_ret++;
43712 printf(" %d", n_ctxt);
43713 printf(" %d", n_nargs);
43714 printf("\n");
43715 }
43716 }
43717 }
43718#endif
43719
43720 function_tests++;
43721 return(test_ret);
43722}
43723
43724
43725static int
43726test_xmlXPathCompareValues(void) {
43727 int test_ret = 0;
43728
43729#ifdef LIBXML_XPATH_ENABLED
43730 int mem_base;
43731 int ret_val;
43732 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
43733 int n_ctxt;
43734 int inf; /* less than (1) or greater than (0) */
43735 int n_inf;
43736 int strict; /* is the comparison strict */
43737 int n_strict;
43738
43739 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43740 for (n_inf = 0;n_inf < gen_nb_int;n_inf++) {
43741 for (n_strict = 0;n_strict < gen_nb_int;n_strict++) {
43742 mem_base = xmlMemBlocks();
43743 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43744 inf = gen_int(n_inf, 1);
43745 strict = gen_int(n_strict, 2);
43746
43747 ret_val = xmlXPathCompareValues(ctxt, inf, strict);
43748 desret_int(ret_val);
43749 call_tests++;
43750 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43751 des_int(n_inf, inf, 1);
43752 des_int(n_strict, strict, 2);
43753 xmlResetLastError();
43754 if (mem_base != xmlMemBlocks()) {
43755 printf("Leak of %d blocks found in xmlXPathCompareValues",
43756 xmlMemBlocks() - mem_base);
43757 test_ret++;
43758 printf(" %d", n_ctxt);
43759 printf(" %d", n_inf);
43760 printf(" %d", n_strict);
43761 printf("\n");
43762 }
43763 }
43764 }
43765 }
43766#endif
43767
43768 function_tests++;
43769 return(test_ret);
43770}
43771
43772
43773static int
43774test_xmlXPathConcatFunction(void) {
43775 int test_ret = 0;
43776
43777#ifdef LIBXML_XPATH_ENABLED
43778 int mem_base;
43779 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
43780 int n_ctxt;
43781 int nargs; /* the number of arguments */
43782 int n_nargs;
43783
43784 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43785 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
43786 mem_base = xmlMemBlocks();
43787 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43788 nargs = gen_int(n_nargs, 1);
43789
43790 xmlXPathConcatFunction(ctxt, nargs);
43791 call_tests++;
43792 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43793 des_int(n_nargs, nargs, 1);
43794 xmlResetLastError();
43795 if (mem_base != xmlMemBlocks()) {
43796 printf("Leak of %d blocks found in xmlXPathConcatFunction",
43797 xmlMemBlocks() - mem_base);
43798 test_ret++;
43799 printf(" %d", n_ctxt);
43800 printf(" %d", n_nargs);
43801 printf("\n");
43802 }
43803 }
43804 }
43805#endif
43806
43807 function_tests++;
43808 return(test_ret);
43809}
43810
43811
43812static int
43813test_xmlXPathContainsFunction(void) {
43814 int test_ret = 0;
43815
43816#ifdef LIBXML_XPATH_ENABLED
43817 int mem_base;
43818 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
43819 int n_ctxt;
43820 int nargs; /* the number of arguments */
43821 int n_nargs;
43822
43823 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43824 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
43825 mem_base = xmlMemBlocks();
43826 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43827 nargs = gen_int(n_nargs, 1);
43828
43829 xmlXPathContainsFunction(ctxt, nargs);
43830 call_tests++;
43831 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43832 des_int(n_nargs, nargs, 1);
43833 xmlResetLastError();
43834 if (mem_base != xmlMemBlocks()) {
43835 printf("Leak of %d blocks found in xmlXPathContainsFunction",
43836 xmlMemBlocks() - mem_base);
43837 test_ret++;
43838 printf(" %d", n_ctxt);
43839 printf(" %d", n_nargs);
43840 printf("\n");
43841 }
43842 }
43843 }
43844#endif
43845
43846 function_tests++;
43847 return(test_ret);
43848}
43849
43850
43851static int
43852test_xmlXPathCountFunction(void) {
43853 int test_ret = 0;
43854
43855#ifdef LIBXML_XPATH_ENABLED
43856 int mem_base;
43857 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
43858 int n_ctxt;
43859 int nargs; /* the number of arguments */
43860 int n_nargs;
43861
43862 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43863 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
43864 mem_base = xmlMemBlocks();
43865 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43866 nargs = gen_int(n_nargs, 1);
43867
43868 xmlXPathCountFunction(ctxt, nargs);
43869 call_tests++;
43870 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43871 des_int(n_nargs, nargs, 1);
43872 xmlResetLastError();
43873 if (mem_base != xmlMemBlocks()) {
43874 printf("Leak of %d blocks found in xmlXPathCountFunction",
43875 xmlMemBlocks() - mem_base);
43876 test_ret++;
43877 printf(" %d", n_ctxt);
43878 printf(" %d", n_nargs);
43879 printf("\n");
43880 }
43881 }
43882 }
43883#endif
43884
43885 function_tests++;
43886 return(test_ret);
43887}
43888
43889
43890static int
43891test_xmlXPathDebugDumpCompExpr(void) {
43892 int test_ret = 0;
43893
43894#ifdef LIBXML_XPATH_ENABLED
43895#ifdef LIBXML_DEBUG_ENABLED
43896 int mem_base;
43897 FILE * output; /* the FILE * for the output */
43898 int n_output;
43899 xmlXPathCompExprPtr comp; /* the precompiled XPath expression */
43900 int n_comp;
43901 int depth; /* the indentation level. */
43902 int n_depth;
43903
43904 for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
43905 for (n_comp = 0;n_comp < gen_nb_xmlXPathCompExprPtr;n_comp++) {
43906 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
43907 mem_base = xmlMemBlocks();
43908 output = gen_FILE_ptr(n_output, 0);
43909 comp = gen_xmlXPathCompExprPtr(n_comp, 1);
43910 depth = gen_int(n_depth, 2);
43911
43912 xmlXPathDebugDumpCompExpr(output, comp, depth);
43913 call_tests++;
43914 des_FILE_ptr(n_output, output, 0);
43915 des_xmlXPathCompExprPtr(n_comp, comp, 1);
43916 des_int(n_depth, depth, 2);
43917 xmlResetLastError();
43918 if (mem_base != xmlMemBlocks()) {
43919 printf("Leak of %d blocks found in xmlXPathDebugDumpCompExpr",
43920 xmlMemBlocks() - mem_base);
43921 test_ret++;
43922 printf(" %d", n_output);
43923 printf(" %d", n_comp);
43924 printf(" %d", n_depth);
43925 printf("\n");
43926 }
43927 }
43928 }
43929 }
43930#endif
43931#endif
43932
43933 function_tests++;
43934 return(test_ret);
43935}
43936
43937
43938static int
43939test_xmlXPathDebugDumpObject(void) {
43940 int test_ret = 0;
43941
43942#ifdef LIBXML_XPATH_ENABLED
43943#ifdef LIBXML_DEBUG_ENABLED
43944 int mem_base;
43945 FILE * output; /* the FILE * to dump the output */
43946 int n_output;
43947 xmlXPathObjectPtr cur; /* the object to inspect */
43948 int n_cur;
43949 int depth; /* indentation level */
43950 int n_depth;
43951
43952 for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
43953 for (n_cur = 0;n_cur < gen_nb_xmlXPathObjectPtr;n_cur++) {
43954 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
43955 mem_base = xmlMemBlocks();
43956 output = gen_FILE_ptr(n_output, 0);
43957 cur = gen_xmlXPathObjectPtr(n_cur, 1);
43958 depth = gen_int(n_depth, 2);
43959
43960 xmlXPathDebugDumpObject(output, cur, depth);
43961 call_tests++;
43962 des_FILE_ptr(n_output, output, 0);
43963 des_xmlXPathObjectPtr(n_cur, cur, 1);
43964 des_int(n_depth, depth, 2);
43965 xmlResetLastError();
43966 if (mem_base != xmlMemBlocks()) {
43967 printf("Leak of %d blocks found in xmlXPathDebugDumpObject",
43968 xmlMemBlocks() - mem_base);
43969 test_ret++;
43970 printf(" %d", n_output);
43971 printf(" %d", n_cur);
43972 printf(" %d", n_depth);
43973 printf("\n");
43974 }
43975 }
43976 }
43977 }
43978#endif
43979#endif
43980
43981 function_tests++;
43982 return(test_ret);
43983}
43984
43985
43986static int
43987test_xmlXPathDifference(void) {
43988 int test_ret = 0;
43989
Daniel Veillardf2a36f92004-11-08 17:55:01 +000043990#ifdef LIBXML_XPATH_ENABLED
43991 int mem_base;
43992 xmlNodeSetPtr ret_val;
43993 xmlNodeSetPtr nodes1; /* a node-set */
43994 int n_nodes1;
43995 xmlNodeSetPtr nodes2; /* a node-set */
43996 int n_nodes2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000043997
Daniel Veillardf2a36f92004-11-08 17:55:01 +000043998 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
43999 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
44000 mem_base = xmlMemBlocks();
44001 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
44002 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
44003
44004 ret_val = xmlXPathDifference(nodes1, nodes2);
44005 desret_xmlNodeSetPtr(ret_val);
44006 call_tests++;
44007 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
44008 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
44009 xmlResetLastError();
44010 if (mem_base != xmlMemBlocks()) {
44011 printf("Leak of %d blocks found in xmlXPathDifference",
44012 xmlMemBlocks() - mem_base);
44013 test_ret++;
44014 printf(" %d", n_nodes1);
44015 printf(" %d", n_nodes2);
44016 printf("\n");
44017 }
44018 }
44019 }
44020#endif
44021
44022 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044023 return(test_ret);
44024}
44025
44026
44027static int
44028test_xmlXPathDistinct(void) {
44029 int test_ret = 0;
44030
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044031#ifdef LIBXML_XPATH_ENABLED
44032 int mem_base;
44033 xmlNodeSetPtr ret_val;
44034 xmlNodeSetPtr nodes; /* a node-set */
44035 int n_nodes;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044036
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044037 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
44038 mem_base = xmlMemBlocks();
44039 nodes = gen_xmlNodeSetPtr(n_nodes, 0);
44040
44041 ret_val = xmlXPathDistinct(nodes);
44042 desret_xmlNodeSetPtr(ret_val);
44043 call_tests++;
44044 des_xmlNodeSetPtr(n_nodes, nodes, 0);
44045 xmlResetLastError();
44046 if (mem_base != xmlMemBlocks()) {
44047 printf("Leak of %d blocks found in xmlXPathDistinct",
44048 xmlMemBlocks() - mem_base);
44049 test_ret++;
44050 printf(" %d", n_nodes);
44051 printf("\n");
44052 }
44053 }
44054#endif
44055
44056 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044057 return(test_ret);
44058}
44059
44060
44061static int
44062test_xmlXPathDistinctSorted(void) {
44063 int test_ret = 0;
44064
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044065#ifdef LIBXML_XPATH_ENABLED
44066 int mem_base;
44067 xmlNodeSetPtr ret_val;
44068 xmlNodeSetPtr nodes; /* a node-set, sorted by document order */
44069 int n_nodes;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044070
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044071 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
44072 mem_base = xmlMemBlocks();
44073 nodes = gen_xmlNodeSetPtr(n_nodes, 0);
44074
44075 ret_val = xmlXPathDistinctSorted(nodes);
44076 desret_xmlNodeSetPtr(ret_val);
44077 call_tests++;
44078 des_xmlNodeSetPtr(n_nodes, nodes, 0);
44079 xmlResetLastError();
44080 if (mem_base != xmlMemBlocks()) {
44081 printf("Leak of %d blocks found in xmlXPathDistinctSorted",
44082 xmlMemBlocks() - mem_base);
44083 test_ret++;
44084 printf(" %d", n_nodes);
44085 printf("\n");
44086 }
44087 }
44088#endif
44089
44090 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044091 return(test_ret);
44092}
44093
44094
44095static int
44096test_xmlXPathDivValues(void) {
44097 int test_ret = 0;
44098
44099#ifdef LIBXML_XPATH_ENABLED
44100 int mem_base;
44101 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44102 int n_ctxt;
44103
44104 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44105 mem_base = xmlMemBlocks();
44106 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44107
44108 xmlXPathDivValues(ctxt);
44109 call_tests++;
44110 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44111 xmlResetLastError();
44112 if (mem_base != xmlMemBlocks()) {
44113 printf("Leak of %d blocks found in xmlXPathDivValues",
44114 xmlMemBlocks() - mem_base);
44115 test_ret++;
44116 printf(" %d", n_ctxt);
44117 printf("\n");
44118 }
44119 }
44120#endif
44121
44122 function_tests++;
44123 return(test_ret);
44124}
44125
44126
44127static int
44128test_xmlXPathEqualValues(void) {
44129 int test_ret = 0;
44130
44131#ifdef LIBXML_XPATH_ENABLED
44132 int mem_base;
44133 int ret_val;
44134 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44135 int n_ctxt;
44136
44137 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44138 mem_base = xmlMemBlocks();
44139 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44140
44141 ret_val = xmlXPathEqualValues(ctxt);
44142 desret_int(ret_val);
44143 call_tests++;
44144 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44145 xmlResetLastError();
44146 if (mem_base != xmlMemBlocks()) {
44147 printf("Leak of %d blocks found in xmlXPathEqualValues",
44148 xmlMemBlocks() - mem_base);
44149 test_ret++;
44150 printf(" %d", n_ctxt);
44151 printf("\n");
44152 }
44153 }
44154#endif
44155
44156 function_tests++;
44157 return(test_ret);
44158}
44159
44160
44161static int
44162test_xmlXPathErr(void) {
44163 int test_ret = 0;
44164
44165#ifdef LIBXML_XPATH_ENABLED
44166 int mem_base;
44167 xmlXPathParserContextPtr ctxt; /* a XPath parser context */
44168 int n_ctxt;
44169 int error; /* the error code */
44170 int n_error;
44171
44172 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44173 for (n_error = 0;n_error < gen_nb_int;n_error++) {
44174 mem_base = xmlMemBlocks();
44175 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44176 error = gen_int(n_error, 1);
44177
44178 xmlXPathErr(ctxt, error);
44179 call_tests++;
44180 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44181 des_int(n_error, error, 1);
44182 xmlResetLastError();
44183 if (mem_base != xmlMemBlocks()) {
44184 printf("Leak of %d blocks found in xmlXPathErr",
44185 xmlMemBlocks() - mem_base);
44186 test_ret++;
44187 printf(" %d", n_ctxt);
44188 printf(" %d", n_error);
44189 printf("\n");
44190 }
44191 }
44192 }
44193#endif
44194
44195 function_tests++;
44196 return(test_ret);
44197}
44198
44199
44200static int
44201test_xmlXPathEvalExpr(void) {
44202 int test_ret = 0;
44203
44204#ifdef LIBXML_XPATH_ENABLED
44205 int mem_base;
44206 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44207 int n_ctxt;
44208
44209 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44210 mem_base = xmlMemBlocks();
44211 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44212
44213 xmlXPathEvalExpr(ctxt);
44214 call_tests++;
44215 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44216 xmlResetLastError();
44217 if (mem_base != xmlMemBlocks()) {
44218 printf("Leak of %d blocks found in xmlXPathEvalExpr",
44219 xmlMemBlocks() - mem_base);
44220 test_ret++;
44221 printf(" %d", n_ctxt);
44222 printf("\n");
44223 }
44224 }
44225#endif
44226
44227 function_tests++;
44228 return(test_ret);
44229}
44230
44231
44232static int
44233test_xmlXPathEvaluatePredicateResult(void) {
44234 int test_ret = 0;
44235
44236#ifdef LIBXML_XPATH_ENABLED
44237 int mem_base;
44238 int ret_val;
44239 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44240 int n_ctxt;
44241 xmlXPathObjectPtr res; /* the Predicate Expression evaluation result */
44242 int n_res;
44243
44244 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44245 for (n_res = 0;n_res < gen_nb_xmlXPathObjectPtr;n_res++) {
44246 mem_base = xmlMemBlocks();
44247 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44248 res = gen_xmlXPathObjectPtr(n_res, 1);
44249
44250 ret_val = xmlXPathEvaluatePredicateResult(ctxt, res);
44251 desret_int(ret_val);
44252 call_tests++;
44253 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44254 des_xmlXPathObjectPtr(n_res, res, 1);
44255 xmlResetLastError();
44256 if (mem_base != xmlMemBlocks()) {
44257 printf("Leak of %d blocks found in xmlXPathEvaluatePredicateResult",
44258 xmlMemBlocks() - mem_base);
44259 test_ret++;
44260 printf(" %d", n_ctxt);
44261 printf(" %d", n_res);
44262 printf("\n");
44263 }
44264 }
44265 }
44266#endif
44267
44268 function_tests++;
44269 return(test_ret);
44270}
44271
44272
44273static int
44274test_xmlXPathFalseFunction(void) {
44275 int test_ret = 0;
44276
44277#ifdef LIBXML_XPATH_ENABLED
44278 int mem_base;
44279 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44280 int n_ctxt;
44281 int nargs; /* the number of arguments */
44282 int n_nargs;
44283
44284 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44285 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44286 mem_base = xmlMemBlocks();
44287 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44288 nargs = gen_int(n_nargs, 1);
44289
44290 xmlXPathFalseFunction(ctxt, nargs);
44291 call_tests++;
44292 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44293 des_int(n_nargs, nargs, 1);
44294 xmlResetLastError();
44295 if (mem_base != xmlMemBlocks()) {
44296 printf("Leak of %d blocks found in xmlXPathFalseFunction",
44297 xmlMemBlocks() - mem_base);
44298 test_ret++;
44299 printf(" %d", n_ctxt);
44300 printf(" %d", n_nargs);
44301 printf("\n");
44302 }
44303 }
44304 }
44305#endif
44306
44307 function_tests++;
44308 return(test_ret);
44309}
44310
44311
44312static int
44313test_xmlXPathFloorFunction(void) {
44314 int test_ret = 0;
44315
44316#ifdef LIBXML_XPATH_ENABLED
44317 int mem_base;
44318 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44319 int n_ctxt;
44320 int nargs; /* the number of arguments */
44321 int n_nargs;
44322
44323 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44324 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44325 mem_base = xmlMemBlocks();
44326 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44327 nargs = gen_int(n_nargs, 1);
44328
44329 xmlXPathFloorFunction(ctxt, nargs);
44330 call_tests++;
44331 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44332 des_int(n_nargs, nargs, 1);
44333 xmlResetLastError();
44334 if (mem_base != xmlMemBlocks()) {
44335 printf("Leak of %d blocks found in xmlXPathFloorFunction",
44336 xmlMemBlocks() - mem_base);
44337 test_ret++;
44338 printf(" %d", n_ctxt);
44339 printf(" %d", n_nargs);
44340 printf("\n");
44341 }
44342 }
44343 }
44344#endif
44345
44346 function_tests++;
44347 return(test_ret);
44348}
44349
44350
44351static int
44352test_xmlXPathFunctionLookup(void) {
44353 int test_ret = 0;
44354
44355
44356 /* missing type support */
44357 return(test_ret);
44358}
44359
44360
44361static int
44362test_xmlXPathFunctionLookupNS(void) {
44363 int test_ret = 0;
44364
44365
44366 /* missing type support */
44367 return(test_ret);
44368}
44369
44370
44371static int
44372test_xmlXPathHasSameNodes(void) {
44373 int test_ret = 0;
44374
44375#ifdef LIBXML_XPATH_ENABLED
44376 int mem_base;
44377 int ret_val;
44378 xmlNodeSetPtr nodes1; /* a node-set */
44379 int n_nodes1;
44380 xmlNodeSetPtr nodes2; /* a node-set */
44381 int n_nodes2;
44382
44383 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
44384 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
44385 mem_base = xmlMemBlocks();
44386 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
44387 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
44388
44389 ret_val = xmlXPathHasSameNodes(nodes1, nodes2);
44390 desret_int(ret_val);
44391 call_tests++;
44392 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
44393 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
44394 xmlResetLastError();
44395 if (mem_base != xmlMemBlocks()) {
44396 printf("Leak of %d blocks found in xmlXPathHasSameNodes",
44397 xmlMemBlocks() - mem_base);
44398 test_ret++;
44399 printf(" %d", n_nodes1);
44400 printf(" %d", n_nodes2);
44401 printf("\n");
44402 }
44403 }
44404 }
44405#endif
44406
44407 function_tests++;
44408 return(test_ret);
44409}
44410
44411
44412static int
44413test_xmlXPathIdFunction(void) {
44414 int test_ret = 0;
44415
44416#ifdef LIBXML_XPATH_ENABLED
44417 int mem_base;
44418 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44419 int n_ctxt;
44420 int nargs; /* the number of arguments */
44421 int n_nargs;
44422
44423 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44424 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44425 mem_base = xmlMemBlocks();
44426 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44427 nargs = gen_int(n_nargs, 1);
44428
44429 xmlXPathIdFunction(ctxt, nargs);
44430 call_tests++;
44431 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44432 des_int(n_nargs, nargs, 1);
44433 xmlResetLastError();
44434 if (mem_base != xmlMemBlocks()) {
44435 printf("Leak of %d blocks found in xmlXPathIdFunction",
44436 xmlMemBlocks() - mem_base);
44437 test_ret++;
44438 printf(" %d", n_ctxt);
44439 printf(" %d", n_nargs);
44440 printf("\n");
44441 }
44442 }
44443 }
44444#endif
44445
44446 function_tests++;
44447 return(test_ret);
44448}
44449
44450
44451static int
44452test_xmlXPathIntersection(void) {
44453 int test_ret = 0;
44454
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044455#ifdef LIBXML_XPATH_ENABLED
44456 int mem_base;
44457 xmlNodeSetPtr ret_val;
44458 xmlNodeSetPtr nodes1; /* a node-set */
44459 int n_nodes1;
44460 xmlNodeSetPtr nodes2; /* a node-set */
44461 int n_nodes2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044462
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044463 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
44464 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
44465 mem_base = xmlMemBlocks();
44466 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
44467 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
44468
44469 ret_val = xmlXPathIntersection(nodes1, nodes2);
44470 desret_xmlNodeSetPtr(ret_val);
44471 call_tests++;
44472 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
44473 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
44474 xmlResetLastError();
44475 if (mem_base != xmlMemBlocks()) {
44476 printf("Leak of %d blocks found in xmlXPathIntersection",
44477 xmlMemBlocks() - mem_base);
44478 test_ret++;
44479 printf(" %d", n_nodes1);
44480 printf(" %d", n_nodes2);
44481 printf("\n");
44482 }
44483 }
44484 }
44485#endif
44486
44487 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044488 return(test_ret);
44489}
44490
44491
44492static int
44493test_xmlXPathIsNodeType(void) {
44494 int test_ret = 0;
44495
44496#ifdef LIBXML_XPATH_ENABLED
44497 int mem_base;
44498 int ret_val;
44499 xmlChar * name; /* a name string */
44500 int n_name;
44501
44502 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
44503 mem_base = xmlMemBlocks();
44504 name = gen_const_xmlChar_ptr(n_name, 0);
44505
44506 ret_val = xmlXPathIsNodeType(name);
44507 desret_int(ret_val);
44508 call_tests++;
44509 des_const_xmlChar_ptr(n_name, name, 0);
44510 xmlResetLastError();
44511 if (mem_base != xmlMemBlocks()) {
44512 printf("Leak of %d blocks found in xmlXPathIsNodeType",
44513 xmlMemBlocks() - mem_base);
44514 test_ret++;
44515 printf(" %d", n_name);
44516 printf("\n");
44517 }
44518 }
44519#endif
44520
44521 function_tests++;
44522 return(test_ret);
44523}
44524
44525
44526static int
44527test_xmlXPathLangFunction(void) {
44528 int test_ret = 0;
44529
44530#ifdef LIBXML_XPATH_ENABLED
44531 int mem_base;
44532 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44533 int n_ctxt;
44534 int nargs; /* the number of arguments */
44535 int n_nargs;
44536
44537 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44538 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44539 mem_base = xmlMemBlocks();
44540 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44541 nargs = gen_int(n_nargs, 1);
44542
44543 xmlXPathLangFunction(ctxt, nargs);
44544 call_tests++;
44545 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44546 des_int(n_nargs, nargs, 1);
44547 xmlResetLastError();
44548 if (mem_base != xmlMemBlocks()) {
44549 printf("Leak of %d blocks found in xmlXPathLangFunction",
44550 xmlMemBlocks() - mem_base);
44551 test_ret++;
44552 printf(" %d", n_ctxt);
44553 printf(" %d", n_nargs);
44554 printf("\n");
44555 }
44556 }
44557 }
44558#endif
44559
44560 function_tests++;
44561 return(test_ret);
44562}
44563
44564
44565static int
44566test_xmlXPathLastFunction(void) {
44567 int test_ret = 0;
44568
44569#ifdef LIBXML_XPATH_ENABLED
44570 int mem_base;
44571 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44572 int n_ctxt;
44573 int nargs; /* the number of arguments */
44574 int n_nargs;
44575
44576 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44577 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44578 mem_base = xmlMemBlocks();
44579 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44580 nargs = gen_int(n_nargs, 1);
44581
44582 xmlXPathLastFunction(ctxt, nargs);
44583 call_tests++;
44584 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44585 des_int(n_nargs, nargs, 1);
44586 xmlResetLastError();
44587 if (mem_base != xmlMemBlocks()) {
44588 printf("Leak of %d blocks found in xmlXPathLastFunction",
44589 xmlMemBlocks() - mem_base);
44590 test_ret++;
44591 printf(" %d", n_ctxt);
44592 printf(" %d", n_nargs);
44593 printf("\n");
44594 }
44595 }
44596 }
44597#endif
44598
44599 function_tests++;
44600 return(test_ret);
44601}
44602
44603
44604static int
44605test_xmlXPathLeading(void) {
44606 int test_ret = 0;
44607
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044608#ifdef LIBXML_XPATH_ENABLED
44609 int mem_base;
44610 xmlNodeSetPtr ret_val;
44611 xmlNodeSetPtr nodes1; /* a node-set */
44612 int n_nodes1;
44613 xmlNodeSetPtr nodes2; /* a node-set */
44614 int n_nodes2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044615
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044616 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
44617 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
44618 mem_base = xmlMemBlocks();
44619 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
44620 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
44621
44622 ret_val = xmlXPathLeading(nodes1, nodes2);
44623 desret_xmlNodeSetPtr(ret_val);
44624 call_tests++;
44625 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
44626 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
44627 xmlResetLastError();
44628 if (mem_base != xmlMemBlocks()) {
44629 printf("Leak of %d blocks found in xmlXPathLeading",
44630 xmlMemBlocks() - mem_base);
44631 test_ret++;
44632 printf(" %d", n_nodes1);
44633 printf(" %d", n_nodes2);
44634 printf("\n");
44635 }
44636 }
44637 }
44638#endif
44639
44640 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044641 return(test_ret);
44642}
44643
44644
44645static int
44646test_xmlXPathLeadingSorted(void) {
44647 int test_ret = 0;
44648
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044649#ifdef LIBXML_XPATH_ENABLED
44650 int mem_base;
44651 xmlNodeSetPtr ret_val;
44652 xmlNodeSetPtr nodes1; /* a node-set, sorted by document order */
44653 int n_nodes1;
44654 xmlNodeSetPtr nodes2; /* a node-set, sorted by document order */
44655 int n_nodes2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044656
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044657 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
44658 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
44659 mem_base = xmlMemBlocks();
44660 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
44661 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
44662
44663 ret_val = xmlXPathLeadingSorted(nodes1, nodes2);
44664 desret_xmlNodeSetPtr(ret_val);
44665 call_tests++;
44666 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
44667 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
44668 xmlResetLastError();
44669 if (mem_base != xmlMemBlocks()) {
44670 printf("Leak of %d blocks found in xmlXPathLeadingSorted",
44671 xmlMemBlocks() - mem_base);
44672 test_ret++;
44673 printf(" %d", n_nodes1);
44674 printf(" %d", n_nodes2);
44675 printf("\n");
44676 }
44677 }
44678 }
44679#endif
44680
44681 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044682 return(test_ret);
44683}
44684
44685
44686static int
44687test_xmlXPathLocalNameFunction(void) {
44688 int test_ret = 0;
44689
44690#ifdef LIBXML_XPATH_ENABLED
44691 int mem_base;
44692 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44693 int n_ctxt;
44694 int nargs; /* the number of arguments */
44695 int n_nargs;
44696
44697 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44698 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44699 mem_base = xmlMemBlocks();
44700 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44701 nargs = gen_int(n_nargs, 1);
44702
44703 xmlXPathLocalNameFunction(ctxt, nargs);
44704 call_tests++;
44705 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44706 des_int(n_nargs, nargs, 1);
44707 xmlResetLastError();
44708 if (mem_base != xmlMemBlocks()) {
44709 printf("Leak of %d blocks found in xmlXPathLocalNameFunction",
44710 xmlMemBlocks() - mem_base);
44711 test_ret++;
44712 printf(" %d", n_ctxt);
44713 printf(" %d", n_nargs);
44714 printf("\n");
44715 }
44716 }
44717 }
44718#endif
44719
44720 function_tests++;
44721 return(test_ret);
44722}
44723
44724
44725static int
44726test_xmlXPathModValues(void) {
44727 int test_ret = 0;
44728
44729#ifdef LIBXML_XPATH_ENABLED
44730 int mem_base;
44731 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44732 int n_ctxt;
44733
44734 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44735 mem_base = xmlMemBlocks();
44736 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44737
44738 xmlXPathModValues(ctxt);
44739 call_tests++;
44740 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44741 xmlResetLastError();
44742 if (mem_base != xmlMemBlocks()) {
44743 printf("Leak of %d blocks found in xmlXPathModValues",
44744 xmlMemBlocks() - mem_base);
44745 test_ret++;
44746 printf(" %d", n_ctxt);
44747 printf("\n");
44748 }
44749 }
44750#endif
44751
44752 function_tests++;
44753 return(test_ret);
44754}
44755
44756
44757static int
44758test_xmlXPathMultValues(void) {
44759 int test_ret = 0;
44760
44761#ifdef LIBXML_XPATH_ENABLED
44762 int mem_base;
44763 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44764 int n_ctxt;
44765
44766 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44767 mem_base = xmlMemBlocks();
44768 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44769
44770 xmlXPathMultValues(ctxt);
44771 call_tests++;
44772 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44773 xmlResetLastError();
44774 if (mem_base != xmlMemBlocks()) {
44775 printf("Leak of %d blocks found in xmlXPathMultValues",
44776 xmlMemBlocks() - mem_base);
44777 test_ret++;
44778 printf(" %d", n_ctxt);
44779 printf("\n");
44780 }
44781 }
44782#endif
44783
44784 function_tests++;
44785 return(test_ret);
44786}
44787
44788
44789static int
44790test_xmlXPathNamespaceURIFunction(void) {
44791 int test_ret = 0;
44792
44793#ifdef LIBXML_XPATH_ENABLED
44794 int mem_base;
44795 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44796 int n_ctxt;
44797 int nargs; /* the number of arguments */
44798 int n_nargs;
44799
44800 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44801 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44802 mem_base = xmlMemBlocks();
44803 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44804 nargs = gen_int(n_nargs, 1);
44805
44806 xmlXPathNamespaceURIFunction(ctxt, nargs);
44807 call_tests++;
44808 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44809 des_int(n_nargs, nargs, 1);
44810 xmlResetLastError();
44811 if (mem_base != xmlMemBlocks()) {
44812 printf("Leak of %d blocks found in xmlXPathNamespaceURIFunction",
44813 xmlMemBlocks() - mem_base);
44814 test_ret++;
44815 printf(" %d", n_ctxt);
44816 printf(" %d", n_nargs);
44817 printf("\n");
44818 }
44819 }
44820 }
44821#endif
44822
44823 function_tests++;
44824 return(test_ret);
44825}
44826
44827
44828static int
44829test_xmlXPathNewBoolean(void) {
44830 int test_ret = 0;
44831
44832#ifdef LIBXML_XPATH_ENABLED
44833 int mem_base;
44834 xmlXPathObjectPtr ret_val;
44835 int val; /* the boolean value */
44836 int n_val;
44837
44838 for (n_val = 0;n_val < gen_nb_int;n_val++) {
44839 mem_base = xmlMemBlocks();
44840 val = gen_int(n_val, 0);
44841
44842 ret_val = xmlXPathNewBoolean(val);
44843 desret_xmlXPathObjectPtr(ret_val);
44844 call_tests++;
44845 des_int(n_val, val, 0);
44846 xmlResetLastError();
44847 if (mem_base != xmlMemBlocks()) {
44848 printf("Leak of %d blocks found in xmlXPathNewBoolean",
44849 xmlMemBlocks() - mem_base);
44850 test_ret++;
44851 printf(" %d", n_val);
44852 printf("\n");
44853 }
44854 }
44855#endif
44856
44857 function_tests++;
44858 return(test_ret);
44859}
44860
44861
44862static int
44863test_xmlXPathNewCString(void) {
44864 int test_ret = 0;
44865
44866#ifdef LIBXML_XPATH_ENABLED
44867 int mem_base;
44868 xmlXPathObjectPtr ret_val;
44869 char * val; /* the char * value */
44870 int n_val;
44871
44872 for (n_val = 0;n_val < gen_nb_const_char_ptr;n_val++) {
44873 mem_base = xmlMemBlocks();
44874 val = gen_const_char_ptr(n_val, 0);
44875
44876 ret_val = xmlXPathNewCString(val);
44877 desret_xmlXPathObjectPtr(ret_val);
44878 call_tests++;
44879 des_const_char_ptr(n_val, val, 0);
44880 xmlResetLastError();
44881 if (mem_base != xmlMemBlocks()) {
44882 printf("Leak of %d blocks found in xmlXPathNewCString",
44883 xmlMemBlocks() - mem_base);
44884 test_ret++;
44885 printf(" %d", n_val);
44886 printf("\n");
44887 }
44888 }
44889#endif
44890
44891 function_tests++;
44892 return(test_ret);
44893}
44894
44895
44896static int
44897test_xmlXPathNewFloat(void) {
44898 int test_ret = 0;
44899
44900#ifdef LIBXML_XPATH_ENABLED
44901 int mem_base;
44902 xmlXPathObjectPtr ret_val;
44903 double val; /* the double value */
44904 int n_val;
44905
44906 for (n_val = 0;n_val < gen_nb_double;n_val++) {
44907 mem_base = xmlMemBlocks();
44908 val = gen_double(n_val, 0);
44909
44910 ret_val = xmlXPathNewFloat(val);
44911 desret_xmlXPathObjectPtr(ret_val);
44912 call_tests++;
44913 des_double(n_val, val, 0);
44914 xmlResetLastError();
44915 if (mem_base != xmlMemBlocks()) {
44916 printf("Leak of %d blocks found in xmlXPathNewFloat",
44917 xmlMemBlocks() - mem_base);
44918 test_ret++;
44919 printf(" %d", n_val);
44920 printf("\n");
44921 }
44922 }
44923#endif
44924
44925 function_tests++;
44926 return(test_ret);
44927}
44928
44929
44930static int
44931test_xmlXPathNewNodeSet(void) {
44932 int test_ret = 0;
44933
44934#ifdef LIBXML_XPATH_ENABLED
44935 int mem_base;
44936 xmlXPathObjectPtr ret_val;
44937 xmlNodePtr val; /* the NodePtr value */
44938 int n_val;
44939
44940 for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
44941 mem_base = xmlMemBlocks();
44942 val = gen_xmlNodePtr(n_val, 0);
44943
44944 ret_val = xmlXPathNewNodeSet(val);
44945 desret_xmlXPathObjectPtr(ret_val);
44946 call_tests++;
44947 des_xmlNodePtr(n_val, val, 0);
44948 xmlResetLastError();
44949 if (mem_base != xmlMemBlocks()) {
44950 printf("Leak of %d blocks found in xmlXPathNewNodeSet",
44951 xmlMemBlocks() - mem_base);
44952 test_ret++;
44953 printf(" %d", n_val);
44954 printf("\n");
44955 }
44956 }
44957#endif
44958
44959 function_tests++;
44960 return(test_ret);
44961}
44962
44963
44964static int
44965test_xmlXPathNewNodeSetList(void) {
44966 int test_ret = 0;
44967
44968#ifdef LIBXML_XPATH_ENABLED
44969 int mem_base;
44970 xmlXPathObjectPtr ret_val;
44971 xmlNodeSetPtr val; /* an existing NodeSet */
44972 int n_val;
44973
44974 for (n_val = 0;n_val < gen_nb_xmlNodeSetPtr;n_val++) {
44975 mem_base = xmlMemBlocks();
44976 val = gen_xmlNodeSetPtr(n_val, 0);
44977
44978 ret_val = xmlXPathNewNodeSetList(val);
44979 desret_xmlXPathObjectPtr(ret_val);
44980 call_tests++;
44981 des_xmlNodeSetPtr(n_val, val, 0);
44982 xmlResetLastError();
44983 if (mem_base != xmlMemBlocks()) {
44984 printf("Leak of %d blocks found in xmlXPathNewNodeSetList",
44985 xmlMemBlocks() - mem_base);
44986 test_ret++;
44987 printf(" %d", n_val);
44988 printf("\n");
44989 }
44990 }
44991#endif
44992
44993 function_tests++;
44994 return(test_ret);
44995}
44996
44997
44998static int
44999test_xmlXPathNewParserContext(void) {
45000 int test_ret = 0;
45001
45002
45003 /* missing type support */
45004 return(test_ret);
45005}
45006
45007
45008static int
45009test_xmlXPathNewString(void) {
45010 int test_ret = 0;
45011
45012#ifdef LIBXML_XPATH_ENABLED
45013 int mem_base;
45014 xmlXPathObjectPtr ret_val;
45015 xmlChar * val; /* the xmlChar * value */
45016 int n_val;
45017
45018 for (n_val = 0;n_val < gen_nb_const_xmlChar_ptr;n_val++) {
45019 mem_base = xmlMemBlocks();
45020 val = gen_const_xmlChar_ptr(n_val, 0);
45021
45022 ret_val = xmlXPathNewString(val);
45023 desret_xmlXPathObjectPtr(ret_val);
45024 call_tests++;
45025 des_const_xmlChar_ptr(n_val, val, 0);
45026 xmlResetLastError();
45027 if (mem_base != xmlMemBlocks()) {
45028 printf("Leak of %d blocks found in xmlXPathNewString",
45029 xmlMemBlocks() - mem_base);
45030 test_ret++;
45031 printf(" %d", n_val);
45032 printf("\n");
45033 }
45034 }
45035#endif
45036
45037 function_tests++;
45038 return(test_ret);
45039}
45040
45041
45042static int
45043test_xmlXPathNextAncestor(void) {
45044 int test_ret = 0;
45045
45046#ifdef LIBXML_XPATH_ENABLED
45047 int mem_base;
45048 xmlNodePtr ret_val;
45049 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45050 int n_ctxt;
45051 xmlNodePtr cur; /* the current node in the traversal */
45052 int n_cur;
45053
45054 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45055 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45056 mem_base = xmlMemBlocks();
45057 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45058 cur = gen_xmlNodePtr(n_cur, 1);
45059
45060 ret_val = xmlXPathNextAncestor(ctxt, cur);
45061 desret_xmlNodePtr(ret_val);
45062 call_tests++;
45063 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45064 des_xmlNodePtr(n_cur, cur, 1);
45065 xmlResetLastError();
45066 if (mem_base != xmlMemBlocks()) {
45067 printf("Leak of %d blocks found in xmlXPathNextAncestor",
45068 xmlMemBlocks() - mem_base);
45069 test_ret++;
45070 printf(" %d", n_ctxt);
45071 printf(" %d", n_cur);
45072 printf("\n");
45073 }
45074 }
45075 }
45076#endif
45077
45078 function_tests++;
45079 return(test_ret);
45080}
45081
45082
45083static int
45084test_xmlXPathNextAncestorOrSelf(void) {
45085 int test_ret = 0;
45086
45087#ifdef LIBXML_XPATH_ENABLED
45088 int mem_base;
45089 xmlNodePtr ret_val;
45090 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45091 int n_ctxt;
45092 xmlNodePtr cur; /* the current node in the traversal */
45093 int n_cur;
45094
45095 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45096 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45097 mem_base = xmlMemBlocks();
45098 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45099 cur = gen_xmlNodePtr(n_cur, 1);
45100
45101 ret_val = xmlXPathNextAncestorOrSelf(ctxt, cur);
45102 desret_xmlNodePtr(ret_val);
45103 call_tests++;
45104 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45105 des_xmlNodePtr(n_cur, cur, 1);
45106 xmlResetLastError();
45107 if (mem_base != xmlMemBlocks()) {
45108 printf("Leak of %d blocks found in xmlXPathNextAncestorOrSelf",
45109 xmlMemBlocks() - mem_base);
45110 test_ret++;
45111 printf(" %d", n_ctxt);
45112 printf(" %d", n_cur);
45113 printf("\n");
45114 }
45115 }
45116 }
45117#endif
45118
45119 function_tests++;
45120 return(test_ret);
45121}
45122
45123
45124static int
45125test_xmlXPathNextAttribute(void) {
45126 int test_ret = 0;
45127
45128#ifdef LIBXML_XPATH_ENABLED
45129 int mem_base;
45130 xmlNodePtr ret_val;
45131 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45132 int n_ctxt;
45133 xmlNodePtr cur; /* the current attribute in the traversal */
45134 int n_cur;
45135
45136 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45137 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45138 mem_base = xmlMemBlocks();
45139 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45140 cur = gen_xmlNodePtr(n_cur, 1);
45141
45142 ret_val = xmlXPathNextAttribute(ctxt, cur);
45143 desret_xmlNodePtr(ret_val);
45144 call_tests++;
45145 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45146 des_xmlNodePtr(n_cur, cur, 1);
45147 xmlResetLastError();
45148 if (mem_base != xmlMemBlocks()) {
45149 printf("Leak of %d blocks found in xmlXPathNextAttribute",
45150 xmlMemBlocks() - mem_base);
45151 test_ret++;
45152 printf(" %d", n_ctxt);
45153 printf(" %d", n_cur);
45154 printf("\n");
45155 }
45156 }
45157 }
45158#endif
45159
45160 function_tests++;
45161 return(test_ret);
45162}
45163
45164
45165static int
45166test_xmlXPathNextChild(void) {
45167 int test_ret = 0;
45168
45169#ifdef LIBXML_XPATH_ENABLED
45170 int mem_base;
45171 xmlNodePtr ret_val;
45172 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45173 int n_ctxt;
45174 xmlNodePtr cur; /* the current node in the traversal */
45175 int n_cur;
45176
45177 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45178 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45179 mem_base = xmlMemBlocks();
45180 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45181 cur = gen_xmlNodePtr(n_cur, 1);
45182
45183 ret_val = xmlXPathNextChild(ctxt, cur);
45184 desret_xmlNodePtr(ret_val);
45185 call_tests++;
45186 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45187 des_xmlNodePtr(n_cur, cur, 1);
45188 xmlResetLastError();
45189 if (mem_base != xmlMemBlocks()) {
45190 printf("Leak of %d blocks found in xmlXPathNextChild",
45191 xmlMemBlocks() - mem_base);
45192 test_ret++;
45193 printf(" %d", n_ctxt);
45194 printf(" %d", n_cur);
45195 printf("\n");
45196 }
45197 }
45198 }
45199#endif
45200
45201 function_tests++;
45202 return(test_ret);
45203}
45204
45205
45206static int
45207test_xmlXPathNextDescendant(void) {
45208 int test_ret = 0;
45209
45210#ifdef LIBXML_XPATH_ENABLED
45211 int mem_base;
45212 xmlNodePtr ret_val;
45213 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45214 int n_ctxt;
45215 xmlNodePtr cur; /* the current node in the traversal */
45216 int n_cur;
45217
45218 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45219 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45220 mem_base = xmlMemBlocks();
45221 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45222 cur = gen_xmlNodePtr(n_cur, 1);
45223
45224 ret_val = xmlXPathNextDescendant(ctxt, cur);
45225 desret_xmlNodePtr(ret_val);
45226 call_tests++;
45227 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45228 des_xmlNodePtr(n_cur, cur, 1);
45229 xmlResetLastError();
45230 if (mem_base != xmlMemBlocks()) {
45231 printf("Leak of %d blocks found in xmlXPathNextDescendant",
45232 xmlMemBlocks() - mem_base);
45233 test_ret++;
45234 printf(" %d", n_ctxt);
45235 printf(" %d", n_cur);
45236 printf("\n");
45237 }
45238 }
45239 }
45240#endif
45241
45242 function_tests++;
45243 return(test_ret);
45244}
45245
45246
45247static int
45248test_xmlXPathNextDescendantOrSelf(void) {
45249 int test_ret = 0;
45250
45251#ifdef LIBXML_XPATH_ENABLED
45252 int mem_base;
45253 xmlNodePtr ret_val;
45254 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45255 int n_ctxt;
45256 xmlNodePtr cur; /* the current node in the traversal */
45257 int n_cur;
45258
45259 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45260 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45261 mem_base = xmlMemBlocks();
45262 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45263 cur = gen_xmlNodePtr(n_cur, 1);
45264
45265 ret_val = xmlXPathNextDescendantOrSelf(ctxt, cur);
45266 desret_xmlNodePtr(ret_val);
45267 call_tests++;
45268 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45269 des_xmlNodePtr(n_cur, cur, 1);
45270 xmlResetLastError();
45271 if (mem_base != xmlMemBlocks()) {
45272 printf("Leak of %d blocks found in xmlXPathNextDescendantOrSelf",
45273 xmlMemBlocks() - mem_base);
45274 test_ret++;
45275 printf(" %d", n_ctxt);
45276 printf(" %d", n_cur);
45277 printf("\n");
45278 }
45279 }
45280 }
45281#endif
45282
45283 function_tests++;
45284 return(test_ret);
45285}
45286
45287
45288static int
45289test_xmlXPathNextFollowing(void) {
45290 int test_ret = 0;
45291
45292#ifdef LIBXML_XPATH_ENABLED
45293 int mem_base;
45294 xmlNodePtr ret_val;
45295 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45296 int n_ctxt;
45297 xmlNodePtr cur; /* the current node in the traversal */
45298 int n_cur;
45299
45300 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45301 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45302 mem_base = xmlMemBlocks();
45303 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45304 cur = gen_xmlNodePtr(n_cur, 1);
45305
45306 ret_val = xmlXPathNextFollowing(ctxt, cur);
45307 desret_xmlNodePtr(ret_val);
45308 call_tests++;
45309 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45310 des_xmlNodePtr(n_cur, cur, 1);
45311 xmlResetLastError();
45312 if (mem_base != xmlMemBlocks()) {
45313 printf("Leak of %d blocks found in xmlXPathNextFollowing",
45314 xmlMemBlocks() - mem_base);
45315 test_ret++;
45316 printf(" %d", n_ctxt);
45317 printf(" %d", n_cur);
45318 printf("\n");
45319 }
45320 }
45321 }
45322#endif
45323
45324 function_tests++;
45325 return(test_ret);
45326}
45327
45328
45329static int
45330test_xmlXPathNextFollowingSibling(void) {
45331 int test_ret = 0;
45332
45333#ifdef LIBXML_XPATH_ENABLED
45334 int mem_base;
45335 xmlNodePtr ret_val;
45336 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45337 int n_ctxt;
45338 xmlNodePtr cur; /* the current node in the traversal */
45339 int n_cur;
45340
45341 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45342 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45343 mem_base = xmlMemBlocks();
45344 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45345 cur = gen_xmlNodePtr(n_cur, 1);
45346
45347 ret_val = xmlXPathNextFollowingSibling(ctxt, cur);
45348 desret_xmlNodePtr(ret_val);
45349 call_tests++;
45350 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45351 des_xmlNodePtr(n_cur, cur, 1);
45352 xmlResetLastError();
45353 if (mem_base != xmlMemBlocks()) {
45354 printf("Leak of %d blocks found in xmlXPathNextFollowingSibling",
45355 xmlMemBlocks() - mem_base);
45356 test_ret++;
45357 printf(" %d", n_ctxt);
45358 printf(" %d", n_cur);
45359 printf("\n");
45360 }
45361 }
45362 }
45363#endif
45364
45365 function_tests++;
45366 return(test_ret);
45367}
45368
45369
45370static int
45371test_xmlXPathNextNamespace(void) {
45372 int test_ret = 0;
45373
45374#ifdef LIBXML_XPATH_ENABLED
45375 int mem_base;
45376 xmlNodePtr ret_val;
45377 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45378 int n_ctxt;
45379 xmlNodePtr cur; /* the current attribute in the traversal */
45380 int n_cur;
45381
45382 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45383 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45384 mem_base = xmlMemBlocks();
45385 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45386 cur = gen_xmlNodePtr(n_cur, 1);
45387
45388 ret_val = xmlXPathNextNamespace(ctxt, cur);
45389 desret_xmlNodePtr(ret_val);
45390 call_tests++;
45391 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45392 des_xmlNodePtr(n_cur, cur, 1);
45393 xmlResetLastError();
45394 if (mem_base != xmlMemBlocks()) {
45395 printf("Leak of %d blocks found in xmlXPathNextNamespace",
45396 xmlMemBlocks() - mem_base);
45397 test_ret++;
45398 printf(" %d", n_ctxt);
45399 printf(" %d", n_cur);
45400 printf("\n");
45401 }
45402 }
45403 }
45404#endif
45405
45406 function_tests++;
45407 return(test_ret);
45408}
45409
45410
45411static int
45412test_xmlXPathNextParent(void) {
45413 int test_ret = 0;
45414
45415#ifdef LIBXML_XPATH_ENABLED
45416 int mem_base;
45417 xmlNodePtr ret_val;
45418 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45419 int n_ctxt;
45420 xmlNodePtr cur; /* the current node in the traversal */
45421 int n_cur;
45422
45423 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45424 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45425 mem_base = xmlMemBlocks();
45426 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45427 cur = gen_xmlNodePtr(n_cur, 1);
45428
45429 ret_val = xmlXPathNextParent(ctxt, cur);
45430 desret_xmlNodePtr(ret_val);
45431 call_tests++;
45432 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45433 des_xmlNodePtr(n_cur, cur, 1);
45434 xmlResetLastError();
45435 if (mem_base != xmlMemBlocks()) {
45436 printf("Leak of %d blocks found in xmlXPathNextParent",
45437 xmlMemBlocks() - mem_base);
45438 test_ret++;
45439 printf(" %d", n_ctxt);
45440 printf(" %d", n_cur);
45441 printf("\n");
45442 }
45443 }
45444 }
45445#endif
45446
45447 function_tests++;
45448 return(test_ret);
45449}
45450
45451
45452static int
45453test_xmlXPathNextPreceding(void) {
45454 int test_ret = 0;
45455
45456#ifdef LIBXML_XPATH_ENABLED
45457 int mem_base;
45458 xmlNodePtr ret_val;
45459 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45460 int n_ctxt;
45461 xmlNodePtr cur; /* the current node in the traversal */
45462 int n_cur;
45463
45464 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45465 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45466 mem_base = xmlMemBlocks();
45467 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45468 cur = gen_xmlNodePtr(n_cur, 1);
45469
45470 ret_val = xmlXPathNextPreceding(ctxt, cur);
45471 desret_xmlNodePtr(ret_val);
45472 call_tests++;
45473 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45474 des_xmlNodePtr(n_cur, cur, 1);
45475 xmlResetLastError();
45476 if (mem_base != xmlMemBlocks()) {
45477 printf("Leak of %d blocks found in xmlXPathNextPreceding",
45478 xmlMemBlocks() - mem_base);
45479 test_ret++;
45480 printf(" %d", n_ctxt);
45481 printf(" %d", n_cur);
45482 printf("\n");
45483 }
45484 }
45485 }
45486#endif
45487
45488 function_tests++;
45489 return(test_ret);
45490}
45491
45492
45493static int
45494test_xmlXPathNextPrecedingSibling(void) {
45495 int test_ret = 0;
45496
45497#ifdef LIBXML_XPATH_ENABLED
45498 int mem_base;
45499 xmlNodePtr ret_val;
45500 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45501 int n_ctxt;
45502 xmlNodePtr cur; /* the current node in the traversal */
45503 int n_cur;
45504
45505 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45506 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45507 mem_base = xmlMemBlocks();
45508 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45509 cur = gen_xmlNodePtr(n_cur, 1);
45510
45511 ret_val = xmlXPathNextPrecedingSibling(ctxt, cur);
45512 desret_xmlNodePtr(ret_val);
45513 call_tests++;
45514 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45515 des_xmlNodePtr(n_cur, cur, 1);
45516 xmlResetLastError();
45517 if (mem_base != xmlMemBlocks()) {
45518 printf("Leak of %d blocks found in xmlXPathNextPrecedingSibling",
45519 xmlMemBlocks() - mem_base);
45520 test_ret++;
45521 printf(" %d", n_ctxt);
45522 printf(" %d", n_cur);
45523 printf("\n");
45524 }
45525 }
45526 }
45527#endif
45528
45529 function_tests++;
45530 return(test_ret);
45531}
45532
45533
45534static int
45535test_xmlXPathNextSelf(void) {
45536 int test_ret = 0;
45537
45538#ifdef LIBXML_XPATH_ENABLED
45539 int mem_base;
45540 xmlNodePtr ret_val;
45541 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45542 int n_ctxt;
45543 xmlNodePtr cur; /* the current node in the traversal */
45544 int n_cur;
45545
45546 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45547 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45548 mem_base = xmlMemBlocks();
45549 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45550 cur = gen_xmlNodePtr(n_cur, 1);
45551
45552 ret_val = xmlXPathNextSelf(ctxt, cur);
45553 desret_xmlNodePtr(ret_val);
45554 call_tests++;
45555 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45556 des_xmlNodePtr(n_cur, cur, 1);
45557 xmlResetLastError();
45558 if (mem_base != xmlMemBlocks()) {
45559 printf("Leak of %d blocks found in xmlXPathNextSelf",
45560 xmlMemBlocks() - mem_base);
45561 test_ret++;
45562 printf(" %d", n_ctxt);
45563 printf(" %d", n_cur);
45564 printf("\n");
45565 }
45566 }
45567 }
45568#endif
45569
45570 function_tests++;
45571 return(test_ret);
45572}
45573
45574
45575static int
45576test_xmlXPathNodeLeading(void) {
45577 int test_ret = 0;
45578
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045579#ifdef LIBXML_XPATH_ENABLED
45580 int mem_base;
45581 xmlNodeSetPtr ret_val;
45582 xmlNodeSetPtr nodes; /* a node-set */
45583 int n_nodes;
45584 xmlNodePtr node; /* a node */
45585 int n_node;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045586
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045587 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
45588 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
45589 mem_base = xmlMemBlocks();
45590 nodes = gen_xmlNodeSetPtr(n_nodes, 0);
45591 node = gen_xmlNodePtr(n_node, 1);
45592
45593 ret_val = xmlXPathNodeLeading(nodes, node);
45594 desret_xmlNodeSetPtr(ret_val);
45595 call_tests++;
45596 des_xmlNodeSetPtr(n_nodes, nodes, 0);
45597 des_xmlNodePtr(n_node, node, 1);
45598 xmlResetLastError();
45599 if (mem_base != xmlMemBlocks()) {
45600 printf("Leak of %d blocks found in xmlXPathNodeLeading",
45601 xmlMemBlocks() - mem_base);
45602 test_ret++;
45603 printf(" %d", n_nodes);
45604 printf(" %d", n_node);
45605 printf("\n");
45606 }
45607 }
45608 }
45609#endif
45610
45611 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045612 return(test_ret);
45613}
45614
45615
45616static int
45617test_xmlXPathNodeLeadingSorted(void) {
45618 int test_ret = 0;
45619
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045620#ifdef LIBXML_XPATH_ENABLED
45621 int mem_base;
45622 xmlNodeSetPtr ret_val;
45623 xmlNodeSetPtr nodes; /* a node-set, sorted by document order */
45624 int n_nodes;
45625 xmlNodePtr node; /* a node */
45626 int n_node;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045627
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045628 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
45629 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
45630 mem_base = xmlMemBlocks();
45631 nodes = gen_xmlNodeSetPtr(n_nodes, 0);
45632 node = gen_xmlNodePtr(n_node, 1);
45633
45634 ret_val = xmlXPathNodeLeadingSorted(nodes, node);
45635 desret_xmlNodeSetPtr(ret_val);
45636 call_tests++;
45637 des_xmlNodeSetPtr(n_nodes, nodes, 0);
45638 des_xmlNodePtr(n_node, node, 1);
45639 xmlResetLastError();
45640 if (mem_base != xmlMemBlocks()) {
45641 printf("Leak of %d blocks found in xmlXPathNodeLeadingSorted",
45642 xmlMemBlocks() - mem_base);
45643 test_ret++;
45644 printf(" %d", n_nodes);
45645 printf(" %d", n_node);
45646 printf("\n");
45647 }
45648 }
45649 }
45650#endif
45651
45652 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045653 return(test_ret);
45654}
45655
45656
45657static int
45658test_xmlXPathNodeSetAdd(void) {
45659 int test_ret = 0;
45660
45661#ifdef LIBXML_XPATH_ENABLED
45662 int mem_base;
45663 xmlNodeSetPtr cur; /* the initial node set */
45664 int n_cur;
45665 xmlNodePtr val; /* a new xmlNodePtr */
45666 int n_val;
45667
45668 for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
45669 for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
45670 mem_base = xmlMemBlocks();
45671 cur = gen_xmlNodeSetPtr(n_cur, 0);
45672 val = gen_xmlNodePtr(n_val, 1);
45673
45674 xmlXPathNodeSetAdd(cur, val);
45675 call_tests++;
45676 des_xmlNodeSetPtr(n_cur, cur, 0);
45677 des_xmlNodePtr(n_val, val, 1);
45678 xmlResetLastError();
45679 if (mem_base != xmlMemBlocks()) {
45680 printf("Leak of %d blocks found in xmlXPathNodeSetAdd",
45681 xmlMemBlocks() - mem_base);
45682 test_ret++;
45683 printf(" %d", n_cur);
45684 printf(" %d", n_val);
45685 printf("\n");
45686 }
45687 }
45688 }
45689#endif
45690
45691 function_tests++;
45692 return(test_ret);
45693}
45694
45695
45696static int
45697test_xmlXPathNodeSetAddNs(void) {
45698 int test_ret = 0;
45699
45700#ifdef LIBXML_XPATH_ENABLED
45701 int mem_base;
45702 xmlNodeSetPtr cur; /* the initial node set */
45703 int n_cur;
45704 xmlNodePtr node; /* the hosting node */
45705 int n_node;
45706 xmlNsPtr ns; /* a the namespace node */
45707 int n_ns;
45708
45709 for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
45710 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
45711 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
45712 mem_base = xmlMemBlocks();
45713 cur = gen_xmlNodeSetPtr(n_cur, 0);
45714 node = gen_xmlNodePtr(n_node, 1);
45715 ns = gen_xmlNsPtr(n_ns, 2);
45716
45717 xmlXPathNodeSetAddNs(cur, node, ns);
45718 call_tests++;
45719 des_xmlNodeSetPtr(n_cur, cur, 0);
45720 des_xmlNodePtr(n_node, node, 1);
45721 des_xmlNsPtr(n_ns, ns, 2);
45722 xmlResetLastError();
45723 if (mem_base != xmlMemBlocks()) {
45724 printf("Leak of %d blocks found in xmlXPathNodeSetAddNs",
45725 xmlMemBlocks() - mem_base);
45726 test_ret++;
45727 printf(" %d", n_cur);
45728 printf(" %d", n_node);
45729 printf(" %d", n_ns);
45730 printf("\n");
45731 }
45732 }
45733 }
45734 }
45735#endif
45736
45737 function_tests++;
45738 return(test_ret);
45739}
45740
45741
45742static int
45743test_xmlXPathNodeSetAddUnique(void) {
45744 int test_ret = 0;
45745
45746#ifdef LIBXML_XPATH_ENABLED
45747 int mem_base;
45748 xmlNodeSetPtr cur; /* the initial node set */
45749 int n_cur;
45750 xmlNodePtr val; /* a new xmlNodePtr */
45751 int n_val;
45752
45753 for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
45754 for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
45755 mem_base = xmlMemBlocks();
45756 cur = gen_xmlNodeSetPtr(n_cur, 0);
45757 val = gen_xmlNodePtr(n_val, 1);
45758
45759 xmlXPathNodeSetAddUnique(cur, val);
45760 call_tests++;
45761 des_xmlNodeSetPtr(n_cur, cur, 0);
45762 des_xmlNodePtr(n_val, val, 1);
45763 xmlResetLastError();
45764 if (mem_base != xmlMemBlocks()) {
45765 printf("Leak of %d blocks found in xmlXPathNodeSetAddUnique",
45766 xmlMemBlocks() - mem_base);
45767 test_ret++;
45768 printf(" %d", n_cur);
45769 printf(" %d", n_val);
45770 printf("\n");
45771 }
45772 }
45773 }
45774#endif
45775
45776 function_tests++;
45777 return(test_ret);
45778}
45779
45780
45781static int
45782test_xmlXPathNodeSetContains(void) {
45783 int test_ret = 0;
45784
45785#ifdef LIBXML_XPATH_ENABLED
45786 int mem_base;
45787 int ret_val;
45788 xmlNodeSetPtr cur; /* the node-set */
45789 int n_cur;
45790 xmlNodePtr val; /* the node */
45791 int n_val;
45792
45793 for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
45794 for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
45795 mem_base = xmlMemBlocks();
45796 cur = gen_xmlNodeSetPtr(n_cur, 0);
45797 val = gen_xmlNodePtr(n_val, 1);
45798
45799 ret_val = xmlXPathNodeSetContains(cur, val);
45800 desret_int(ret_val);
45801 call_tests++;
45802 des_xmlNodeSetPtr(n_cur, cur, 0);
45803 des_xmlNodePtr(n_val, val, 1);
45804 xmlResetLastError();
45805 if (mem_base != xmlMemBlocks()) {
45806 printf("Leak of %d blocks found in xmlXPathNodeSetContains",
45807 xmlMemBlocks() - mem_base);
45808 test_ret++;
45809 printf(" %d", n_cur);
45810 printf(" %d", n_val);
45811 printf("\n");
45812 }
45813 }
45814 }
45815#endif
45816
45817 function_tests++;
45818 return(test_ret);
45819}
45820
45821
45822static int
45823test_xmlXPathNodeSetDel(void) {
45824 int test_ret = 0;
45825
45826#ifdef LIBXML_XPATH_ENABLED
45827 int mem_base;
45828 xmlNodeSetPtr cur; /* the initial node set */
45829 int n_cur;
45830 xmlNodePtr val; /* an xmlNodePtr */
45831 int n_val;
45832
45833 for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
45834 for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
45835 mem_base = xmlMemBlocks();
45836 cur = gen_xmlNodeSetPtr(n_cur, 0);
45837 val = gen_xmlNodePtr(n_val, 1);
45838
45839 xmlXPathNodeSetDel(cur, val);
45840 call_tests++;
45841 des_xmlNodeSetPtr(n_cur, cur, 0);
45842 des_xmlNodePtr(n_val, val, 1);
45843 xmlResetLastError();
45844 if (mem_base != xmlMemBlocks()) {
45845 printf("Leak of %d blocks found in xmlXPathNodeSetDel",
45846 xmlMemBlocks() - mem_base);
45847 test_ret++;
45848 printf(" %d", n_cur);
45849 printf(" %d", n_val);
45850 printf("\n");
45851 }
45852 }
45853 }
45854#endif
45855
45856 function_tests++;
45857 return(test_ret);
45858}
45859
45860
45861static int
45862test_xmlXPathNodeSetMerge(void) {
45863 int test_ret = 0;
45864
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045865#ifdef LIBXML_XPATH_ENABLED
45866 int mem_base;
45867 xmlNodeSetPtr ret_val;
45868 xmlNodeSetPtr val1; /* the first NodeSet or NULL */
45869 int n_val1;
45870 xmlNodeSetPtr val2; /* the second NodeSet */
45871 int n_val2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045872
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045873 for (n_val1 = 0;n_val1 < gen_nb_xmlNodeSetPtr;n_val1++) {
45874 for (n_val2 = 0;n_val2 < gen_nb_xmlNodeSetPtr;n_val2++) {
45875 mem_base = xmlMemBlocks();
45876 val1 = gen_xmlNodeSetPtr(n_val1, 0);
45877 val2 = gen_xmlNodeSetPtr(n_val2, 1);
45878
45879 ret_val = xmlXPathNodeSetMerge(val1, val2);
45880 desret_xmlNodeSetPtr(ret_val);
45881 call_tests++;
45882 des_xmlNodeSetPtr(n_val1, val1, 0);
45883 des_xmlNodeSetPtr(n_val2, val2, 1);
45884 xmlResetLastError();
45885 if (mem_base != xmlMemBlocks()) {
45886 printf("Leak of %d blocks found in xmlXPathNodeSetMerge",
45887 xmlMemBlocks() - mem_base);
45888 test_ret++;
45889 printf(" %d", n_val1);
45890 printf(" %d", n_val2);
45891 printf("\n");
45892 }
45893 }
45894 }
45895#endif
45896
45897 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045898 return(test_ret);
45899}
45900
45901
45902static int
45903test_xmlXPathNodeSetRemove(void) {
45904 int test_ret = 0;
45905
45906#ifdef LIBXML_XPATH_ENABLED
45907 int mem_base;
45908 xmlNodeSetPtr cur; /* the initial node set */
45909 int n_cur;
45910 int val; /* the index to remove */
45911 int n_val;
45912
45913 for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
45914 for (n_val = 0;n_val < gen_nb_int;n_val++) {
45915 mem_base = xmlMemBlocks();
45916 cur = gen_xmlNodeSetPtr(n_cur, 0);
45917 val = gen_int(n_val, 1);
45918
45919 xmlXPathNodeSetRemove(cur, val);
45920 call_tests++;
45921 des_xmlNodeSetPtr(n_cur, cur, 0);
45922 des_int(n_val, val, 1);
45923 xmlResetLastError();
45924 if (mem_base != xmlMemBlocks()) {
45925 printf("Leak of %d blocks found in xmlXPathNodeSetRemove",
45926 xmlMemBlocks() - mem_base);
45927 test_ret++;
45928 printf(" %d", n_cur);
45929 printf(" %d", n_val);
45930 printf("\n");
45931 }
45932 }
45933 }
45934#endif
45935
45936 function_tests++;
45937 return(test_ret);
45938}
45939
45940
45941static int
45942test_xmlXPathNodeSetSort(void) {
45943 int test_ret = 0;
45944
45945#ifdef LIBXML_XPATH_ENABLED
45946 int mem_base;
45947 xmlNodeSetPtr set; /* the node set */
45948 int n_set;
45949
45950 for (n_set = 0;n_set < gen_nb_xmlNodeSetPtr;n_set++) {
45951 mem_base = xmlMemBlocks();
45952 set = gen_xmlNodeSetPtr(n_set, 0);
45953
45954 xmlXPathNodeSetSort(set);
45955 call_tests++;
45956 des_xmlNodeSetPtr(n_set, set, 0);
45957 xmlResetLastError();
45958 if (mem_base != xmlMemBlocks()) {
45959 printf("Leak of %d blocks found in xmlXPathNodeSetSort",
45960 xmlMemBlocks() - mem_base);
45961 test_ret++;
45962 printf(" %d", n_set);
45963 printf("\n");
45964 }
45965 }
45966#endif
45967
45968 function_tests++;
45969 return(test_ret);
45970}
45971
45972
45973static int
45974test_xmlXPathNodeTrailing(void) {
45975 int test_ret = 0;
45976
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045977#ifdef LIBXML_XPATH_ENABLED
45978 int mem_base;
45979 xmlNodeSetPtr ret_val;
45980 xmlNodeSetPtr nodes; /* a node-set */
45981 int n_nodes;
45982 xmlNodePtr node; /* a node */
45983 int n_node;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045984
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045985 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
45986 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
45987 mem_base = xmlMemBlocks();
45988 nodes = gen_xmlNodeSetPtr(n_nodes, 0);
45989 node = gen_xmlNodePtr(n_node, 1);
45990
45991 ret_val = xmlXPathNodeTrailing(nodes, node);
45992 desret_xmlNodeSetPtr(ret_val);
45993 call_tests++;
45994 des_xmlNodeSetPtr(n_nodes, nodes, 0);
45995 des_xmlNodePtr(n_node, node, 1);
45996 xmlResetLastError();
45997 if (mem_base != xmlMemBlocks()) {
45998 printf("Leak of %d blocks found in xmlXPathNodeTrailing",
45999 xmlMemBlocks() - mem_base);
46000 test_ret++;
46001 printf(" %d", n_nodes);
46002 printf(" %d", n_node);
46003 printf("\n");
46004 }
46005 }
46006 }
46007#endif
46008
46009 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046010 return(test_ret);
46011}
46012
46013
46014static int
46015test_xmlXPathNodeTrailingSorted(void) {
46016 int test_ret = 0;
46017
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046018#ifdef LIBXML_XPATH_ENABLED
46019 int mem_base;
46020 xmlNodeSetPtr ret_val;
46021 xmlNodeSetPtr nodes; /* a node-set, sorted by document order */
46022 int n_nodes;
46023 xmlNodePtr node; /* a node */
46024 int n_node;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046025
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046026 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
46027 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
46028 mem_base = xmlMemBlocks();
46029 nodes = gen_xmlNodeSetPtr(n_nodes, 0);
46030 node = gen_xmlNodePtr(n_node, 1);
46031
46032 ret_val = xmlXPathNodeTrailingSorted(nodes, node);
46033 desret_xmlNodeSetPtr(ret_val);
46034 call_tests++;
46035 des_xmlNodeSetPtr(n_nodes, nodes, 0);
46036 des_xmlNodePtr(n_node, node, 1);
46037 xmlResetLastError();
46038 if (mem_base != xmlMemBlocks()) {
46039 printf("Leak of %d blocks found in xmlXPathNodeTrailingSorted",
46040 xmlMemBlocks() - mem_base);
46041 test_ret++;
46042 printf(" %d", n_nodes);
46043 printf(" %d", n_node);
46044 printf("\n");
46045 }
46046 }
46047 }
46048#endif
46049
46050 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046051 return(test_ret);
46052}
46053
46054
46055static int
46056test_xmlXPathNormalizeFunction(void) {
46057 int test_ret = 0;
46058
46059#ifdef LIBXML_XPATH_ENABLED
46060 int mem_base;
46061 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46062 int n_ctxt;
46063 int nargs; /* the number of arguments */
46064 int n_nargs;
46065
46066 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46067 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
46068 mem_base = xmlMemBlocks();
46069 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46070 nargs = gen_int(n_nargs, 1);
46071
46072 xmlXPathNormalizeFunction(ctxt, nargs);
46073 call_tests++;
46074 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46075 des_int(n_nargs, nargs, 1);
46076 xmlResetLastError();
46077 if (mem_base != xmlMemBlocks()) {
46078 printf("Leak of %d blocks found in xmlXPathNormalizeFunction",
46079 xmlMemBlocks() - mem_base);
46080 test_ret++;
46081 printf(" %d", n_ctxt);
46082 printf(" %d", n_nargs);
46083 printf("\n");
46084 }
46085 }
46086 }
46087#endif
46088
46089 function_tests++;
46090 return(test_ret);
46091}
46092
46093
46094static int
46095test_xmlXPathNotEqualValues(void) {
46096 int test_ret = 0;
46097
46098#ifdef LIBXML_XPATH_ENABLED
46099 int mem_base;
46100 int ret_val;
46101 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46102 int n_ctxt;
46103
46104 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46105 mem_base = xmlMemBlocks();
46106 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46107
46108 ret_val = xmlXPathNotEqualValues(ctxt);
46109 desret_int(ret_val);
46110 call_tests++;
46111 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46112 xmlResetLastError();
46113 if (mem_base != xmlMemBlocks()) {
46114 printf("Leak of %d blocks found in xmlXPathNotEqualValues",
46115 xmlMemBlocks() - mem_base);
46116 test_ret++;
46117 printf(" %d", n_ctxt);
46118 printf("\n");
46119 }
46120 }
46121#endif
46122
46123 function_tests++;
46124 return(test_ret);
46125}
46126
46127
46128static int
46129test_xmlXPathNotFunction(void) {
46130 int test_ret = 0;
46131
46132#ifdef LIBXML_XPATH_ENABLED
46133 int mem_base;
46134 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46135 int n_ctxt;
46136 int nargs; /* the number of arguments */
46137 int n_nargs;
46138
46139 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46140 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
46141 mem_base = xmlMemBlocks();
46142 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46143 nargs = gen_int(n_nargs, 1);
46144
46145 xmlXPathNotFunction(ctxt, nargs);
46146 call_tests++;
46147 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46148 des_int(n_nargs, nargs, 1);
46149 xmlResetLastError();
46150 if (mem_base != xmlMemBlocks()) {
46151 printf("Leak of %d blocks found in xmlXPathNotFunction",
46152 xmlMemBlocks() - mem_base);
46153 test_ret++;
46154 printf(" %d", n_ctxt);
46155 printf(" %d", n_nargs);
46156 printf("\n");
46157 }
46158 }
46159 }
46160#endif
46161
46162 function_tests++;
46163 return(test_ret);
46164}
46165
46166
46167static int
46168test_xmlXPathNsLookup(void) {
46169 int test_ret = 0;
46170
46171#ifdef LIBXML_XPATH_ENABLED
46172 int mem_base;
46173 const xmlChar * ret_val;
46174 xmlXPathContextPtr ctxt; /* the XPath context */
46175 int n_ctxt;
46176 xmlChar * prefix; /* the namespace prefix value */
46177 int n_prefix;
46178
46179 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
46180 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
46181 mem_base = xmlMemBlocks();
46182 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
46183 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
46184
46185 ret_val = xmlXPathNsLookup(ctxt, prefix);
46186 desret_const_xmlChar_ptr(ret_val);
46187 call_tests++;
46188 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
46189 des_const_xmlChar_ptr(n_prefix, prefix, 1);
46190 xmlResetLastError();
46191 if (mem_base != xmlMemBlocks()) {
46192 printf("Leak of %d blocks found in xmlXPathNsLookup",
46193 xmlMemBlocks() - mem_base);
46194 test_ret++;
46195 printf(" %d", n_ctxt);
46196 printf(" %d", n_prefix);
46197 printf("\n");
46198 }
46199 }
46200 }
46201#endif
46202
46203 function_tests++;
46204 return(test_ret);
46205}
46206
46207
46208static int
46209test_xmlXPathNumberFunction(void) {
46210 int test_ret = 0;
46211
46212#ifdef LIBXML_XPATH_ENABLED
46213 int mem_base;
46214 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46215 int n_ctxt;
46216 int nargs; /* the number of arguments */
46217 int n_nargs;
46218
46219 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46220 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
46221 mem_base = xmlMemBlocks();
46222 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46223 nargs = gen_int(n_nargs, 1);
46224
46225 xmlXPathNumberFunction(ctxt, nargs);
46226 call_tests++;
46227 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46228 des_int(n_nargs, nargs, 1);
46229 xmlResetLastError();
46230 if (mem_base != xmlMemBlocks()) {
46231 printf("Leak of %d blocks found in xmlXPathNumberFunction",
46232 xmlMemBlocks() - mem_base);
46233 test_ret++;
46234 printf(" %d", n_ctxt);
46235 printf(" %d", n_nargs);
46236 printf("\n");
46237 }
46238 }
46239 }
46240#endif
46241
46242 function_tests++;
46243 return(test_ret);
46244}
46245
46246
46247static int
46248test_xmlXPathParseNCName(void) {
46249 int test_ret = 0;
46250
46251#ifdef LIBXML_XPATH_ENABLED
46252 int mem_base;
46253 xmlChar * ret_val;
46254 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46255 int n_ctxt;
46256
46257 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46258 mem_base = xmlMemBlocks();
46259 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46260
46261 ret_val = xmlXPathParseNCName(ctxt);
46262 desret_xmlChar_ptr(ret_val);
46263 call_tests++;
46264 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46265 xmlResetLastError();
46266 if (mem_base != xmlMemBlocks()) {
46267 printf("Leak of %d blocks found in xmlXPathParseNCName",
46268 xmlMemBlocks() - mem_base);
46269 test_ret++;
46270 printf(" %d", n_ctxt);
46271 printf("\n");
46272 }
46273 }
46274#endif
46275
46276 function_tests++;
46277 return(test_ret);
46278}
46279
46280
46281static int
46282test_xmlXPathParseName(void) {
46283 int test_ret = 0;
46284
46285#ifdef LIBXML_XPATH_ENABLED
46286 int mem_base;
46287 xmlChar * ret_val;
46288 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46289 int n_ctxt;
46290
46291 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46292 mem_base = xmlMemBlocks();
46293 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46294
46295 ret_val = xmlXPathParseName(ctxt);
46296 desret_xmlChar_ptr(ret_val);
46297 call_tests++;
46298 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46299 xmlResetLastError();
46300 if (mem_base != xmlMemBlocks()) {
46301 printf("Leak of %d blocks found in xmlXPathParseName",
46302 xmlMemBlocks() - mem_base);
46303 test_ret++;
46304 printf(" %d", n_ctxt);
46305 printf("\n");
46306 }
46307 }
46308#endif
46309
46310 function_tests++;
46311 return(test_ret);
46312}
46313
46314
46315static int
46316test_xmlXPathPopBoolean(void) {
46317 int test_ret = 0;
46318
46319#ifdef LIBXML_XPATH_ENABLED
46320 int mem_base;
46321 int ret_val;
46322 xmlXPathParserContextPtr ctxt; /* an XPath parser context */
46323 int n_ctxt;
46324
46325 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46326 mem_base = xmlMemBlocks();
46327 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46328
46329 ret_val = xmlXPathPopBoolean(ctxt);
46330 desret_int(ret_val);
46331 call_tests++;
46332 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46333 xmlResetLastError();
46334 if (mem_base != xmlMemBlocks()) {
46335 printf("Leak of %d blocks found in xmlXPathPopBoolean",
46336 xmlMemBlocks() - mem_base);
46337 test_ret++;
46338 printf(" %d", n_ctxt);
46339 printf("\n");
46340 }
46341 }
46342#endif
46343
46344 function_tests++;
46345 return(test_ret);
46346}
46347
46348
46349static int
46350test_xmlXPathPopExternal(void) {
46351 int test_ret = 0;
46352
46353#ifdef LIBXML_XPATH_ENABLED
46354 int mem_base;
46355 void * ret_val;
46356 xmlXPathParserContextPtr ctxt; /* an XPath parser context */
46357 int n_ctxt;
46358
46359 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46360 mem_base = xmlMemBlocks();
46361 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46362
46363 ret_val = xmlXPathPopExternal(ctxt);
46364 desret_void_ptr(ret_val);
46365 call_tests++;
46366 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46367 xmlResetLastError();
46368 if (mem_base != xmlMemBlocks()) {
46369 printf("Leak of %d blocks found in xmlXPathPopExternal",
46370 xmlMemBlocks() - mem_base);
46371 test_ret++;
46372 printf(" %d", n_ctxt);
46373 printf("\n");
46374 }
46375 }
46376#endif
46377
46378 function_tests++;
46379 return(test_ret);
46380}
46381
46382
46383static int
46384test_xmlXPathPopNodeSet(void) {
46385 int test_ret = 0;
46386
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046387#ifdef LIBXML_XPATH_ENABLED
46388 int mem_base;
46389 xmlNodeSetPtr ret_val;
46390 xmlXPathParserContextPtr ctxt; /* an XPath parser context */
46391 int n_ctxt;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046392
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046393 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46394 mem_base = xmlMemBlocks();
46395 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46396
46397 ret_val = xmlXPathPopNodeSet(ctxt);
46398 desret_xmlNodeSetPtr(ret_val);
46399 call_tests++;
46400 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46401 xmlResetLastError();
46402 if (mem_base != xmlMemBlocks()) {
46403 printf("Leak of %d blocks found in xmlXPathPopNodeSet",
46404 xmlMemBlocks() - mem_base);
46405 test_ret++;
46406 printf(" %d", n_ctxt);
46407 printf("\n");
46408 }
46409 }
46410#endif
46411
46412 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046413 return(test_ret);
46414}
46415
46416
46417static int
46418test_xmlXPathPopNumber(void) {
46419 int test_ret = 0;
46420
46421#ifdef LIBXML_XPATH_ENABLED
46422 int mem_base;
46423 double ret_val;
46424 xmlXPathParserContextPtr ctxt; /* an XPath parser context */
46425 int n_ctxt;
46426
46427 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46428 mem_base = xmlMemBlocks();
46429 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46430
46431 ret_val = xmlXPathPopNumber(ctxt);
46432 desret_double(ret_val);
46433 call_tests++;
46434 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46435 xmlResetLastError();
46436 if (mem_base != xmlMemBlocks()) {
46437 printf("Leak of %d blocks found in xmlXPathPopNumber",
46438 xmlMemBlocks() - mem_base);
46439 test_ret++;
46440 printf(" %d", n_ctxt);
46441 printf("\n");
46442 }
46443 }
46444#endif
46445
46446 function_tests++;
46447 return(test_ret);
46448}
46449
46450
46451static int
46452test_xmlXPathPopString(void) {
46453 int test_ret = 0;
46454
46455#ifdef LIBXML_XPATH_ENABLED
46456 int mem_base;
46457 xmlChar * ret_val;
46458 xmlXPathParserContextPtr ctxt; /* an XPath parser context */
46459 int n_ctxt;
46460
46461 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46462 mem_base = xmlMemBlocks();
46463 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46464
46465 ret_val = xmlXPathPopString(ctxt);
46466 desret_xmlChar_ptr(ret_val);
46467 call_tests++;
46468 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46469 xmlResetLastError();
46470 if (mem_base != xmlMemBlocks()) {
46471 printf("Leak of %d blocks found in xmlXPathPopString",
46472 xmlMemBlocks() - mem_base);
46473 test_ret++;
46474 printf(" %d", n_ctxt);
46475 printf("\n");
46476 }
46477 }
46478#endif
46479
46480 function_tests++;
46481 return(test_ret);
46482}
46483
46484
46485static int
46486test_xmlXPathPositionFunction(void) {
46487 int test_ret = 0;
46488
46489#ifdef LIBXML_XPATH_ENABLED
46490 int mem_base;
46491 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46492 int n_ctxt;
46493 int nargs; /* the number of arguments */
46494 int n_nargs;
46495
46496 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46497 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
46498 mem_base = xmlMemBlocks();
46499 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46500 nargs = gen_int(n_nargs, 1);
46501
46502 xmlXPathPositionFunction(ctxt, nargs);
46503 call_tests++;
46504 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46505 des_int(n_nargs, nargs, 1);
46506 xmlResetLastError();
46507 if (mem_base != xmlMemBlocks()) {
46508 printf("Leak of %d blocks found in xmlXPathPositionFunction",
46509 xmlMemBlocks() - mem_base);
46510 test_ret++;
46511 printf(" %d", n_ctxt);
46512 printf(" %d", n_nargs);
46513 printf("\n");
46514 }
46515 }
46516 }
46517#endif
46518
46519 function_tests++;
46520 return(test_ret);
46521}
46522
46523
46524static int
46525test_xmlXPathRegisterAllFunctions(void) {
46526 int test_ret = 0;
46527
46528#ifdef LIBXML_XPATH_ENABLED
46529 int mem_base;
46530 xmlXPathContextPtr ctxt; /* the XPath context */
46531 int n_ctxt;
46532
46533 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
46534 mem_base = xmlMemBlocks();
46535 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
46536
46537 xmlXPathRegisterAllFunctions(ctxt);
46538 call_tests++;
46539 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
46540 xmlResetLastError();
46541 if (mem_base != xmlMemBlocks()) {
46542 printf("Leak of %d blocks found in xmlXPathRegisterAllFunctions",
46543 xmlMemBlocks() - mem_base);
46544 test_ret++;
46545 printf(" %d", n_ctxt);
46546 printf("\n");
46547 }
46548 }
46549#endif
46550
46551 function_tests++;
46552 return(test_ret);
46553}
46554
46555
46556static int
46557test_xmlXPathRegisterFunc(void) {
46558 int test_ret = 0;
46559
46560
46561 /* missing type support */
46562 return(test_ret);
46563}
46564
46565
46566static int
46567test_xmlXPathRegisterFuncLookup(void) {
46568 int test_ret = 0;
46569
46570
46571 /* missing type support */
46572 return(test_ret);
46573}
46574
46575
46576static int
46577test_xmlXPathRegisterFuncNS(void) {
46578 int test_ret = 0;
46579
46580
46581 /* missing type support */
46582 return(test_ret);
46583}
46584
46585
46586static int
46587test_xmlXPathRegisterNs(void) {
46588 int test_ret = 0;
46589
46590#ifdef LIBXML_XPATH_ENABLED
46591 int mem_base;
46592 int ret_val;
46593 xmlXPathContextPtr ctxt; /* the XPath context */
46594 int n_ctxt;
46595 xmlChar * prefix; /* the namespace prefix */
46596 int n_prefix;
46597 xmlChar * ns_uri; /* the namespace name */
46598 int n_ns_uri;
46599
46600 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
46601 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
46602 for (n_ns_uri = 0;n_ns_uri < gen_nb_const_xmlChar_ptr;n_ns_uri++) {
46603 mem_base = xmlMemBlocks();
46604 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
46605 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
46606 ns_uri = gen_const_xmlChar_ptr(n_ns_uri, 2);
46607
46608 ret_val = xmlXPathRegisterNs(ctxt, prefix, ns_uri);
46609 desret_int(ret_val);
46610 call_tests++;
46611 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
46612 des_const_xmlChar_ptr(n_prefix, prefix, 1);
46613 des_const_xmlChar_ptr(n_ns_uri, ns_uri, 2);
46614 xmlResetLastError();
46615 if (mem_base != xmlMemBlocks()) {
46616 printf("Leak of %d blocks found in xmlXPathRegisterNs",
46617 xmlMemBlocks() - mem_base);
46618 test_ret++;
46619 printf(" %d", n_ctxt);
46620 printf(" %d", n_prefix);
46621 printf(" %d", n_ns_uri);
46622 printf("\n");
46623 }
46624 }
46625 }
46626 }
46627#endif
46628
46629 function_tests++;
46630 return(test_ret);
46631}
46632
46633
46634static int
46635test_xmlXPathRegisterVariable(void) {
46636 int test_ret = 0;
46637
46638#ifdef LIBXML_XPATH_ENABLED
46639 int mem_base;
46640 int ret_val;
46641 xmlXPathContextPtr ctxt; /* the XPath context */
46642 int n_ctxt;
46643 xmlChar * name; /* the variable name */
46644 int n_name;
46645 xmlXPathObjectPtr value; /* the variable value or NULL */
46646 int n_value;
46647
46648 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
46649 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
46650 for (n_value = 0;n_value < gen_nb_xmlXPathObjectPtr;n_value++) {
46651 mem_base = xmlMemBlocks();
46652 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
46653 name = gen_const_xmlChar_ptr(n_name, 1);
46654 value = gen_xmlXPathObjectPtr(n_value, 2);
46655
46656 ret_val = xmlXPathRegisterVariable(ctxt, name, value);
46657 desret_int(ret_val);
46658 call_tests++;
46659 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
46660 des_const_xmlChar_ptr(n_name, name, 1);
46661 des_xmlXPathObjectPtr(n_value, value, 2);
46662 xmlResetLastError();
46663 if (mem_base != xmlMemBlocks()) {
46664 printf("Leak of %d blocks found in xmlXPathRegisterVariable",
46665 xmlMemBlocks() - mem_base);
46666 test_ret++;
46667 printf(" %d", n_ctxt);
46668 printf(" %d", n_name);
46669 printf(" %d", n_value);
46670 printf("\n");
46671 }
46672 }
46673 }
46674 }
46675#endif
46676
46677 function_tests++;
46678 return(test_ret);
46679}
46680
46681
46682static int
46683test_xmlXPathRegisterVariableLookup(void) {
46684 int test_ret = 0;
46685
46686
46687 /* missing type support */
46688 return(test_ret);
46689}
46690
46691
46692static int
46693test_xmlXPathRegisterVariableNS(void) {
46694 int test_ret = 0;
46695
46696#ifdef LIBXML_XPATH_ENABLED
46697 int mem_base;
46698 int ret_val;
46699 xmlXPathContextPtr ctxt; /* the XPath context */
46700 int n_ctxt;
46701 xmlChar * name; /* the variable name */
46702 int n_name;
46703 xmlChar * ns_uri; /* the variable namespace URI */
46704 int n_ns_uri;
46705 xmlXPathObjectPtr value; /* the variable value or NULL */
46706 int n_value;
46707
46708 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
46709 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
46710 for (n_ns_uri = 0;n_ns_uri < gen_nb_const_xmlChar_ptr;n_ns_uri++) {
46711 for (n_value = 0;n_value < gen_nb_xmlXPathObjectPtr;n_value++) {
46712 mem_base = xmlMemBlocks();
46713 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
46714 name = gen_const_xmlChar_ptr(n_name, 1);
46715 ns_uri = gen_const_xmlChar_ptr(n_ns_uri, 2);
46716 value = gen_xmlXPathObjectPtr(n_value, 3);
46717
46718 ret_val = xmlXPathRegisterVariableNS(ctxt, name, ns_uri, value);
46719 desret_int(ret_val);
46720 call_tests++;
46721 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
46722 des_const_xmlChar_ptr(n_name, name, 1);
46723 des_const_xmlChar_ptr(n_ns_uri, ns_uri, 2);
46724 des_xmlXPathObjectPtr(n_value, value, 3);
46725 xmlResetLastError();
46726 if (mem_base != xmlMemBlocks()) {
46727 printf("Leak of %d blocks found in xmlXPathRegisterVariableNS",
46728 xmlMemBlocks() - mem_base);
46729 test_ret++;
46730 printf(" %d", n_ctxt);
46731 printf(" %d", n_name);
46732 printf(" %d", n_ns_uri);
46733 printf(" %d", n_value);
46734 printf("\n");
46735 }
46736 }
46737 }
46738 }
46739 }
46740#endif
46741
46742 function_tests++;
46743 return(test_ret);
46744}
46745
46746
46747static int
46748test_xmlXPathRegisteredFuncsCleanup(void) {
46749 int test_ret = 0;
46750
46751#ifdef LIBXML_XPATH_ENABLED
46752 int mem_base;
46753 xmlXPathContextPtr ctxt; /* the XPath context */
46754 int n_ctxt;
46755
46756 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
46757 mem_base = xmlMemBlocks();
46758 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
46759
46760 xmlXPathRegisteredFuncsCleanup(ctxt);
46761 call_tests++;
46762 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
46763 xmlResetLastError();
46764 if (mem_base != xmlMemBlocks()) {
46765 printf("Leak of %d blocks found in xmlXPathRegisteredFuncsCleanup",
46766 xmlMemBlocks() - mem_base);
46767 test_ret++;
46768 printf(" %d", n_ctxt);
46769 printf("\n");
46770 }
46771 }
46772#endif
46773
46774 function_tests++;
46775 return(test_ret);
46776}
46777
46778
46779static int
46780test_xmlXPathRegisteredNsCleanup(void) {
46781 int test_ret = 0;
46782
46783#ifdef LIBXML_XPATH_ENABLED
46784 int mem_base;
46785 xmlXPathContextPtr ctxt; /* the XPath context */
46786 int n_ctxt;
46787
46788 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
46789 mem_base = xmlMemBlocks();
46790 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
46791
46792 xmlXPathRegisteredNsCleanup(ctxt);
46793 call_tests++;
46794 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
46795 xmlResetLastError();
46796 if (mem_base != xmlMemBlocks()) {
46797 printf("Leak of %d blocks found in xmlXPathRegisteredNsCleanup",
46798 xmlMemBlocks() - mem_base);
46799 test_ret++;
46800 printf(" %d", n_ctxt);
46801 printf("\n");
46802 }
46803 }
46804#endif
46805
46806 function_tests++;
46807 return(test_ret);
46808}
46809
46810
46811static int
46812test_xmlXPathRegisteredVariablesCleanup(void) {
46813 int test_ret = 0;
46814
46815#ifdef LIBXML_XPATH_ENABLED
46816 int mem_base;
46817 xmlXPathContextPtr ctxt; /* the XPath context */
46818 int n_ctxt;
46819
46820 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
46821 mem_base = xmlMemBlocks();
46822 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
46823
46824 xmlXPathRegisteredVariablesCleanup(ctxt);
46825 call_tests++;
46826 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
46827 xmlResetLastError();
46828 if (mem_base != xmlMemBlocks()) {
46829 printf("Leak of %d blocks found in xmlXPathRegisteredVariablesCleanup",
46830 xmlMemBlocks() - mem_base);
46831 test_ret++;
46832 printf(" %d", n_ctxt);
46833 printf("\n");
46834 }
46835 }
46836#endif
46837
46838 function_tests++;
46839 return(test_ret);
46840}
46841
46842
46843static int
46844test_xmlXPathRoot(void) {
46845 int test_ret = 0;
46846
46847#ifdef LIBXML_XPATH_ENABLED
46848 int mem_base;
46849 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46850 int n_ctxt;
46851
46852 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46853 mem_base = xmlMemBlocks();
46854 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46855
46856 xmlXPathRoot(ctxt);
46857 call_tests++;
46858 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46859 xmlResetLastError();
46860 if (mem_base != xmlMemBlocks()) {
46861 printf("Leak of %d blocks found in xmlXPathRoot",
46862 xmlMemBlocks() - mem_base);
46863 test_ret++;
46864 printf(" %d", n_ctxt);
46865 printf("\n");
46866 }
46867 }
46868#endif
46869
46870 function_tests++;
46871 return(test_ret);
46872}
46873
46874
46875static int
46876test_xmlXPathRoundFunction(void) {
46877 int test_ret = 0;
46878
46879#ifdef LIBXML_XPATH_ENABLED
46880 int mem_base;
46881 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46882 int n_ctxt;
46883 int nargs; /* the number of arguments */
46884 int n_nargs;
46885
46886 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46887 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
46888 mem_base = xmlMemBlocks();
46889 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46890 nargs = gen_int(n_nargs, 1);
46891
46892 xmlXPathRoundFunction(ctxt, nargs);
46893 call_tests++;
46894 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46895 des_int(n_nargs, nargs, 1);
46896 xmlResetLastError();
46897 if (mem_base != xmlMemBlocks()) {
46898 printf("Leak of %d blocks found in xmlXPathRoundFunction",
46899 xmlMemBlocks() - mem_base);
46900 test_ret++;
46901 printf(" %d", n_ctxt);
46902 printf(" %d", n_nargs);
46903 printf("\n");
46904 }
46905 }
46906 }
46907#endif
46908
46909 function_tests++;
46910 return(test_ret);
46911}
46912
46913
46914static int
46915test_xmlXPathStartsWithFunction(void) {
46916 int test_ret = 0;
46917
46918#ifdef LIBXML_XPATH_ENABLED
46919 int mem_base;
46920 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46921 int n_ctxt;
46922 int nargs; /* the number of arguments */
46923 int n_nargs;
46924
46925 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46926 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
46927 mem_base = xmlMemBlocks();
46928 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46929 nargs = gen_int(n_nargs, 1);
46930
46931 xmlXPathStartsWithFunction(ctxt, nargs);
46932 call_tests++;
46933 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46934 des_int(n_nargs, nargs, 1);
46935 xmlResetLastError();
46936 if (mem_base != xmlMemBlocks()) {
46937 printf("Leak of %d blocks found in xmlXPathStartsWithFunction",
46938 xmlMemBlocks() - mem_base);
46939 test_ret++;
46940 printf(" %d", n_ctxt);
46941 printf(" %d", n_nargs);
46942 printf("\n");
46943 }
46944 }
46945 }
46946#endif
46947
46948 function_tests++;
46949 return(test_ret);
46950}
46951
46952
46953static int
46954test_xmlXPathStringEvalNumber(void) {
46955 int test_ret = 0;
46956
46957#ifdef LIBXML_XPATH_ENABLED
46958 int mem_base;
46959 double ret_val;
46960 xmlChar * str; /* A string to scan */
46961 int n_str;
46962
46963 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
46964 mem_base = xmlMemBlocks();
46965 str = gen_const_xmlChar_ptr(n_str, 0);
46966
46967 ret_val = xmlXPathStringEvalNumber(str);
46968 desret_double(ret_val);
46969 call_tests++;
46970 des_const_xmlChar_ptr(n_str, str, 0);
46971 xmlResetLastError();
46972 if (mem_base != xmlMemBlocks()) {
46973 printf("Leak of %d blocks found in xmlXPathStringEvalNumber",
46974 xmlMemBlocks() - mem_base);
46975 test_ret++;
46976 printf(" %d", n_str);
46977 printf("\n");
46978 }
46979 }
46980#endif
46981
46982 function_tests++;
46983 return(test_ret);
46984}
46985
46986
46987static int
46988test_xmlXPathStringFunction(void) {
46989 int test_ret = 0;
46990
46991#ifdef LIBXML_XPATH_ENABLED
46992 int mem_base;
46993 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46994 int n_ctxt;
46995 int nargs; /* the number of arguments */
46996 int n_nargs;
46997
46998 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46999 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47000 mem_base = xmlMemBlocks();
47001 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47002 nargs = gen_int(n_nargs, 1);
47003
47004 xmlXPathStringFunction(ctxt, nargs);
47005 call_tests++;
47006 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47007 des_int(n_nargs, nargs, 1);
47008 xmlResetLastError();
47009 if (mem_base != xmlMemBlocks()) {
47010 printf("Leak of %d blocks found in xmlXPathStringFunction",
47011 xmlMemBlocks() - mem_base);
47012 test_ret++;
47013 printf(" %d", n_ctxt);
47014 printf(" %d", n_nargs);
47015 printf("\n");
47016 }
47017 }
47018 }
47019#endif
47020
47021 function_tests++;
47022 return(test_ret);
47023}
47024
47025
47026static int
47027test_xmlXPathStringLengthFunction(void) {
47028 int test_ret = 0;
47029
47030#ifdef LIBXML_XPATH_ENABLED
47031 int mem_base;
47032 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47033 int n_ctxt;
47034 int nargs; /* the number of arguments */
47035 int n_nargs;
47036
47037 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47038 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47039 mem_base = xmlMemBlocks();
47040 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47041 nargs = gen_int(n_nargs, 1);
47042
47043 xmlXPathStringLengthFunction(ctxt, nargs);
47044 call_tests++;
47045 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47046 des_int(n_nargs, nargs, 1);
47047 xmlResetLastError();
47048 if (mem_base != xmlMemBlocks()) {
47049 printf("Leak of %d blocks found in xmlXPathStringLengthFunction",
47050 xmlMemBlocks() - mem_base);
47051 test_ret++;
47052 printf(" %d", n_ctxt);
47053 printf(" %d", n_nargs);
47054 printf("\n");
47055 }
47056 }
47057 }
47058#endif
47059
47060 function_tests++;
47061 return(test_ret);
47062}
47063
47064
47065static int
47066test_xmlXPathSubValues(void) {
47067 int test_ret = 0;
47068
47069#ifdef LIBXML_XPATH_ENABLED
47070 int mem_base;
47071 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47072 int n_ctxt;
47073
47074 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47075 mem_base = xmlMemBlocks();
47076 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47077
47078 xmlXPathSubValues(ctxt);
47079 call_tests++;
47080 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47081 xmlResetLastError();
47082 if (mem_base != xmlMemBlocks()) {
47083 printf("Leak of %d blocks found in xmlXPathSubValues",
47084 xmlMemBlocks() - mem_base);
47085 test_ret++;
47086 printf(" %d", n_ctxt);
47087 printf("\n");
47088 }
47089 }
47090#endif
47091
47092 function_tests++;
47093 return(test_ret);
47094}
47095
47096
47097static int
47098test_xmlXPathSubstringAfterFunction(void) {
47099 int test_ret = 0;
47100
47101#ifdef LIBXML_XPATH_ENABLED
47102 int mem_base;
47103 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47104 int n_ctxt;
47105 int nargs; /* the number of arguments */
47106 int n_nargs;
47107
47108 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47109 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47110 mem_base = xmlMemBlocks();
47111 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47112 nargs = gen_int(n_nargs, 1);
47113
47114 xmlXPathSubstringAfterFunction(ctxt, nargs);
47115 call_tests++;
47116 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47117 des_int(n_nargs, nargs, 1);
47118 xmlResetLastError();
47119 if (mem_base != xmlMemBlocks()) {
47120 printf("Leak of %d blocks found in xmlXPathSubstringAfterFunction",
47121 xmlMemBlocks() - mem_base);
47122 test_ret++;
47123 printf(" %d", n_ctxt);
47124 printf(" %d", n_nargs);
47125 printf("\n");
47126 }
47127 }
47128 }
47129#endif
47130
47131 function_tests++;
47132 return(test_ret);
47133}
47134
47135
47136static int
47137test_xmlXPathSubstringBeforeFunction(void) {
47138 int test_ret = 0;
47139
47140#ifdef LIBXML_XPATH_ENABLED
47141 int mem_base;
47142 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47143 int n_ctxt;
47144 int nargs; /* the number of arguments */
47145 int n_nargs;
47146
47147 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47148 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47149 mem_base = xmlMemBlocks();
47150 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47151 nargs = gen_int(n_nargs, 1);
47152
47153 xmlXPathSubstringBeforeFunction(ctxt, nargs);
47154 call_tests++;
47155 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47156 des_int(n_nargs, nargs, 1);
47157 xmlResetLastError();
47158 if (mem_base != xmlMemBlocks()) {
47159 printf("Leak of %d blocks found in xmlXPathSubstringBeforeFunction",
47160 xmlMemBlocks() - mem_base);
47161 test_ret++;
47162 printf(" %d", n_ctxt);
47163 printf(" %d", n_nargs);
47164 printf("\n");
47165 }
47166 }
47167 }
47168#endif
47169
47170 function_tests++;
47171 return(test_ret);
47172}
47173
47174
47175static int
47176test_xmlXPathSubstringFunction(void) {
47177 int test_ret = 0;
47178
47179#ifdef LIBXML_XPATH_ENABLED
47180 int mem_base;
47181 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47182 int n_ctxt;
47183 int nargs; /* the number of arguments */
47184 int n_nargs;
47185
47186 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47187 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47188 mem_base = xmlMemBlocks();
47189 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47190 nargs = gen_int(n_nargs, 1);
47191
47192 xmlXPathSubstringFunction(ctxt, nargs);
47193 call_tests++;
47194 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47195 des_int(n_nargs, nargs, 1);
47196 xmlResetLastError();
47197 if (mem_base != xmlMemBlocks()) {
47198 printf("Leak of %d blocks found in xmlXPathSubstringFunction",
47199 xmlMemBlocks() - mem_base);
47200 test_ret++;
47201 printf(" %d", n_ctxt);
47202 printf(" %d", n_nargs);
47203 printf("\n");
47204 }
47205 }
47206 }
47207#endif
47208
47209 function_tests++;
47210 return(test_ret);
47211}
47212
47213
47214static int
47215test_xmlXPathSumFunction(void) {
47216 int test_ret = 0;
47217
47218#ifdef LIBXML_XPATH_ENABLED
47219 int mem_base;
47220 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47221 int n_ctxt;
47222 int nargs; /* the number of arguments */
47223 int n_nargs;
47224
47225 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47226 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47227 mem_base = xmlMemBlocks();
47228 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47229 nargs = gen_int(n_nargs, 1);
47230
47231 xmlXPathSumFunction(ctxt, nargs);
47232 call_tests++;
47233 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47234 des_int(n_nargs, nargs, 1);
47235 xmlResetLastError();
47236 if (mem_base != xmlMemBlocks()) {
47237 printf("Leak of %d blocks found in xmlXPathSumFunction",
47238 xmlMemBlocks() - mem_base);
47239 test_ret++;
47240 printf(" %d", n_ctxt);
47241 printf(" %d", n_nargs);
47242 printf("\n");
47243 }
47244 }
47245 }
47246#endif
47247
47248 function_tests++;
47249 return(test_ret);
47250}
47251
47252
47253static int
47254test_xmlXPathTrailing(void) {
47255 int test_ret = 0;
47256
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047257#ifdef LIBXML_XPATH_ENABLED
47258 int mem_base;
47259 xmlNodeSetPtr ret_val;
47260 xmlNodeSetPtr nodes1; /* a node-set */
47261 int n_nodes1;
47262 xmlNodeSetPtr nodes2; /* a node-set */
47263 int n_nodes2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047264
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047265 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
47266 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
47267 mem_base = xmlMemBlocks();
47268 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
47269 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
47270
47271 ret_val = xmlXPathTrailing(nodes1, nodes2);
47272 desret_xmlNodeSetPtr(ret_val);
47273 call_tests++;
47274 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
47275 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
47276 xmlResetLastError();
47277 if (mem_base != xmlMemBlocks()) {
47278 printf("Leak of %d blocks found in xmlXPathTrailing",
47279 xmlMemBlocks() - mem_base);
47280 test_ret++;
47281 printf(" %d", n_nodes1);
47282 printf(" %d", n_nodes2);
47283 printf("\n");
47284 }
47285 }
47286 }
47287#endif
47288
47289 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047290 return(test_ret);
47291}
47292
47293
47294static int
47295test_xmlXPathTrailingSorted(void) {
47296 int test_ret = 0;
47297
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047298#ifdef LIBXML_XPATH_ENABLED
47299 int mem_base;
47300 xmlNodeSetPtr ret_val;
47301 xmlNodeSetPtr nodes1; /* a node-set, sorted by document order */
47302 int n_nodes1;
47303 xmlNodeSetPtr nodes2; /* a node-set, sorted by document order */
47304 int n_nodes2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047305
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047306 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
47307 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
47308 mem_base = xmlMemBlocks();
47309 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
47310 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
47311
47312 ret_val = xmlXPathTrailingSorted(nodes1, nodes2);
47313 desret_xmlNodeSetPtr(ret_val);
47314 call_tests++;
47315 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
47316 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
47317 xmlResetLastError();
47318 if (mem_base != xmlMemBlocks()) {
47319 printf("Leak of %d blocks found in xmlXPathTrailingSorted",
47320 xmlMemBlocks() - mem_base);
47321 test_ret++;
47322 printf(" %d", n_nodes1);
47323 printf(" %d", n_nodes2);
47324 printf("\n");
47325 }
47326 }
47327 }
47328#endif
47329
47330 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047331 return(test_ret);
47332}
47333
47334
47335static int
47336test_xmlXPathTranslateFunction(void) {
47337 int test_ret = 0;
47338
47339#ifdef LIBXML_XPATH_ENABLED
47340 int mem_base;
47341 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47342 int n_ctxt;
47343 int nargs; /* the number of arguments */
47344 int n_nargs;
47345
47346 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47347 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47348 mem_base = xmlMemBlocks();
47349 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47350 nargs = gen_int(n_nargs, 1);
47351
47352 xmlXPathTranslateFunction(ctxt, nargs);
47353 call_tests++;
47354 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47355 des_int(n_nargs, nargs, 1);
47356 xmlResetLastError();
47357 if (mem_base != xmlMemBlocks()) {
47358 printf("Leak of %d blocks found in xmlXPathTranslateFunction",
47359 xmlMemBlocks() - mem_base);
47360 test_ret++;
47361 printf(" %d", n_ctxt);
47362 printf(" %d", n_nargs);
47363 printf("\n");
47364 }
47365 }
47366 }
47367#endif
47368
47369 function_tests++;
47370 return(test_ret);
47371}
47372
47373
47374static int
47375test_xmlXPathTrueFunction(void) {
47376 int test_ret = 0;
47377
47378#ifdef LIBXML_XPATH_ENABLED
47379 int mem_base;
47380 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47381 int n_ctxt;
47382 int nargs; /* the number of arguments */
47383 int n_nargs;
47384
47385 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47386 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47387 mem_base = xmlMemBlocks();
47388 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47389 nargs = gen_int(n_nargs, 1);
47390
47391 xmlXPathTrueFunction(ctxt, nargs);
47392 call_tests++;
47393 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47394 des_int(n_nargs, nargs, 1);
47395 xmlResetLastError();
47396 if (mem_base != xmlMemBlocks()) {
47397 printf("Leak of %d blocks found in xmlXPathTrueFunction",
47398 xmlMemBlocks() - mem_base);
47399 test_ret++;
47400 printf(" %d", n_ctxt);
47401 printf(" %d", n_nargs);
47402 printf("\n");
47403 }
47404 }
47405 }
47406#endif
47407
47408 function_tests++;
47409 return(test_ret);
47410}
47411
47412
47413static int
47414test_xmlXPathValueFlipSign(void) {
47415 int test_ret = 0;
47416
47417#ifdef LIBXML_XPATH_ENABLED
47418 int mem_base;
47419 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47420 int n_ctxt;
47421
47422 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47423 mem_base = xmlMemBlocks();
47424 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47425
47426 xmlXPathValueFlipSign(ctxt);
47427 call_tests++;
47428 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47429 xmlResetLastError();
47430 if (mem_base != xmlMemBlocks()) {
47431 printf("Leak of %d blocks found in xmlXPathValueFlipSign",
47432 xmlMemBlocks() - mem_base);
47433 test_ret++;
47434 printf(" %d", n_ctxt);
47435 printf("\n");
47436 }
47437 }
47438#endif
47439
47440 function_tests++;
47441 return(test_ret);
47442}
47443
47444
47445static int
47446test_xmlXPathVariableLookup(void) {
47447 int test_ret = 0;
47448
47449#ifdef LIBXML_XPATH_ENABLED
47450 int mem_base;
47451 xmlXPathObjectPtr ret_val;
47452 xmlXPathContextPtr ctxt; /* the XPath context */
47453 int n_ctxt;
47454 xmlChar * name; /* the variable name */
47455 int n_name;
47456
47457 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
47458 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
47459 mem_base = xmlMemBlocks();
47460 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
47461 name = gen_const_xmlChar_ptr(n_name, 1);
47462
47463 ret_val = xmlXPathVariableLookup(ctxt, name);
47464 desret_xmlXPathObjectPtr(ret_val);
47465 call_tests++;
47466 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
47467 des_const_xmlChar_ptr(n_name, name, 1);
47468 xmlResetLastError();
47469 if (mem_base != xmlMemBlocks()) {
47470 printf("Leak of %d blocks found in xmlXPathVariableLookup",
47471 xmlMemBlocks() - mem_base);
47472 test_ret++;
47473 printf(" %d", n_ctxt);
47474 printf(" %d", n_name);
47475 printf("\n");
47476 }
47477 }
47478 }
47479#endif
47480
47481 function_tests++;
47482 return(test_ret);
47483}
47484
47485
47486static int
47487test_xmlXPathVariableLookupNS(void) {
47488 int test_ret = 0;
47489
47490#ifdef LIBXML_XPATH_ENABLED
47491 int mem_base;
47492 xmlXPathObjectPtr ret_val;
47493 xmlXPathContextPtr ctxt; /* the XPath context */
47494 int n_ctxt;
47495 xmlChar * name; /* the variable name */
47496 int n_name;
47497 xmlChar * ns_uri; /* the variable namespace URI */
47498 int n_ns_uri;
47499
47500 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
47501 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
47502 for (n_ns_uri = 0;n_ns_uri < gen_nb_const_xmlChar_ptr;n_ns_uri++) {
47503 mem_base = xmlMemBlocks();
47504 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
47505 name = gen_const_xmlChar_ptr(n_name, 1);
47506 ns_uri = gen_const_xmlChar_ptr(n_ns_uri, 2);
47507
47508 ret_val = xmlXPathVariableLookupNS(ctxt, name, ns_uri);
47509 desret_xmlXPathObjectPtr(ret_val);
47510 call_tests++;
47511 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
47512 des_const_xmlChar_ptr(n_name, name, 1);
47513 des_const_xmlChar_ptr(n_ns_uri, ns_uri, 2);
47514 xmlResetLastError();
47515 if (mem_base != xmlMemBlocks()) {
47516 printf("Leak of %d blocks found in xmlXPathVariableLookupNS",
47517 xmlMemBlocks() - mem_base);
47518 test_ret++;
47519 printf(" %d", n_ctxt);
47520 printf(" %d", n_name);
47521 printf(" %d", n_ns_uri);
47522 printf("\n");
47523 }
47524 }
47525 }
47526 }
47527#endif
47528
47529 function_tests++;
47530 return(test_ret);
47531}
47532
47533
47534static int
47535test_xmlXPathWrapCString(void) {
47536 int test_ret = 0;
47537
47538#ifdef LIBXML_XPATH_ENABLED
47539 int mem_base;
47540 xmlXPathObjectPtr ret_val;
47541 char * val; /* the char * value */
47542 int n_val;
47543
47544 for (n_val = 0;n_val < gen_nb_char_ptr;n_val++) {
47545 mem_base = xmlMemBlocks();
47546 val = gen_char_ptr(n_val, 0);
47547
47548 ret_val = xmlXPathWrapCString(val);
47549 desret_xmlXPathObjectPtr(ret_val);
47550 call_tests++;
47551 des_char_ptr(n_val, val, 0);
47552 xmlResetLastError();
47553 if (mem_base != xmlMemBlocks()) {
47554 printf("Leak of %d blocks found in xmlXPathWrapCString",
47555 xmlMemBlocks() - mem_base);
47556 test_ret++;
47557 printf(" %d", n_val);
47558 printf("\n");
47559 }
47560 }
47561#endif
47562
47563 function_tests++;
47564 return(test_ret);
47565}
47566
47567
47568static int
47569test_xmlXPathWrapExternal(void) {
47570 int test_ret = 0;
47571
47572#ifdef LIBXML_XPATH_ENABLED
47573 int mem_base;
47574 xmlXPathObjectPtr ret_val;
47575 void * val; /* the user data */
47576 int n_val;
47577
47578 for (n_val = 0;n_val < gen_nb_void_ptr;n_val++) {
47579 mem_base = xmlMemBlocks();
47580 val = gen_void_ptr(n_val, 0);
47581
47582 ret_val = xmlXPathWrapExternal(val);
47583 desret_xmlXPathObjectPtr(ret_val);
47584 call_tests++;
47585 des_void_ptr(n_val, val, 0);
47586 xmlResetLastError();
47587 if (mem_base != xmlMemBlocks()) {
47588 printf("Leak of %d blocks found in xmlXPathWrapExternal",
47589 xmlMemBlocks() - mem_base);
47590 test_ret++;
47591 printf(" %d", n_val);
47592 printf("\n");
47593 }
47594 }
47595#endif
47596
47597 function_tests++;
47598 return(test_ret);
47599}
47600
47601
47602static int
47603test_xmlXPathWrapNodeSet(void) {
47604 int test_ret = 0;
47605
47606#ifdef LIBXML_XPATH_ENABLED
47607 int mem_base;
47608 xmlXPathObjectPtr ret_val;
47609 xmlNodeSetPtr val; /* the NodePtr value */
47610 int n_val;
47611
47612 for (n_val = 0;n_val < gen_nb_xmlNodeSetPtr;n_val++) {
47613 mem_base = xmlMemBlocks();
47614 val = gen_xmlNodeSetPtr(n_val, 0);
47615
47616 ret_val = xmlXPathWrapNodeSet(val);
47617 desret_xmlXPathObjectPtr(ret_val);
47618 call_tests++;
47619 des_xmlNodeSetPtr(n_val, val, 0);
47620 xmlResetLastError();
47621 if (mem_base != xmlMemBlocks()) {
47622 printf("Leak of %d blocks found in xmlXPathWrapNodeSet",
47623 xmlMemBlocks() - mem_base);
47624 test_ret++;
47625 printf(" %d", n_val);
47626 printf("\n");
47627 }
47628 }
47629#endif
47630
47631 function_tests++;
47632 return(test_ret);
47633}
47634
47635
47636static int
47637test_xmlXPatherror(void) {
47638 int test_ret = 0;
47639
47640#ifdef LIBXML_XPATH_ENABLED
47641 int mem_base;
47642 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47643 int n_ctxt;
47644 const char * file; /* the file name */
47645 int n_file;
47646 int line; /* the line number */
47647 int n_line;
47648 int no; /* the error number */
47649 int n_no;
47650
47651 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47652 for (n_file = 0;n_file < gen_nb_filepath;n_file++) {
47653 for (n_line = 0;n_line < gen_nb_int;n_line++) {
47654 for (n_no = 0;n_no < gen_nb_int;n_no++) {
47655 mem_base = xmlMemBlocks();
47656 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47657 file = gen_filepath(n_file, 1);
47658 line = gen_int(n_line, 2);
47659 no = gen_int(n_no, 3);
47660
47661 xmlXPatherror(ctxt, file, line, no);
47662 call_tests++;
47663 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47664 des_filepath(n_file, file, 1);
47665 des_int(n_line, line, 2);
47666 des_int(n_no, no, 3);
47667 xmlResetLastError();
47668 if (mem_base != xmlMemBlocks()) {
47669 printf("Leak of %d blocks found in xmlXPatherror",
47670 xmlMemBlocks() - mem_base);
47671 test_ret++;
47672 printf(" %d", n_ctxt);
47673 printf(" %d", n_file);
47674 printf(" %d", n_line);
47675 printf(" %d", n_no);
47676 printf("\n");
47677 }
47678 }
47679 }
47680 }
47681 }
47682#endif
47683
47684 function_tests++;
47685 return(test_ret);
47686}
47687
47688static int
47689test_xpathInternals(void) {
47690 int test_ret = 0;
47691
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047692 printf("Testing xpathInternals : 106 of 117 functions ...\n");
Daniel Veillarda82b1822004-11-08 16:24:57 +000047693 test_ret += test_valuePop();
47694 test_ret += test_valuePush();
47695 test_ret += test_xmlXPathAddValues();
47696 test_ret += test_xmlXPathBooleanFunction();
47697 test_ret += test_xmlXPathCeilingFunction();
47698 test_ret += test_xmlXPathCompareValues();
47699 test_ret += test_xmlXPathConcatFunction();
47700 test_ret += test_xmlXPathContainsFunction();
47701 test_ret += test_xmlXPathCountFunction();
47702 test_ret += test_xmlXPathDebugDumpCompExpr();
47703 test_ret += test_xmlXPathDebugDumpObject();
47704 test_ret += test_xmlXPathDifference();
47705 test_ret += test_xmlXPathDistinct();
47706 test_ret += test_xmlXPathDistinctSorted();
47707 test_ret += test_xmlXPathDivValues();
47708 test_ret += test_xmlXPathEqualValues();
47709 test_ret += test_xmlXPathErr();
47710 test_ret += test_xmlXPathEvalExpr();
47711 test_ret += test_xmlXPathEvaluatePredicateResult();
47712 test_ret += test_xmlXPathFalseFunction();
47713 test_ret += test_xmlXPathFloorFunction();
47714 test_ret += test_xmlXPathFunctionLookup();
47715 test_ret += test_xmlXPathFunctionLookupNS();
47716 test_ret += test_xmlXPathHasSameNodes();
47717 test_ret += test_xmlXPathIdFunction();
47718 test_ret += test_xmlXPathIntersection();
47719 test_ret += test_xmlXPathIsNodeType();
47720 test_ret += test_xmlXPathLangFunction();
47721 test_ret += test_xmlXPathLastFunction();
47722 test_ret += test_xmlXPathLeading();
47723 test_ret += test_xmlXPathLeadingSorted();
47724 test_ret += test_xmlXPathLocalNameFunction();
47725 test_ret += test_xmlXPathModValues();
47726 test_ret += test_xmlXPathMultValues();
47727 test_ret += test_xmlXPathNamespaceURIFunction();
47728 test_ret += test_xmlXPathNewBoolean();
47729 test_ret += test_xmlXPathNewCString();
47730 test_ret += test_xmlXPathNewFloat();
47731 test_ret += test_xmlXPathNewNodeSet();
47732 test_ret += test_xmlXPathNewNodeSetList();
47733 test_ret += test_xmlXPathNewParserContext();
47734 test_ret += test_xmlXPathNewString();
47735 test_ret += test_xmlXPathNextAncestor();
47736 test_ret += test_xmlXPathNextAncestorOrSelf();
47737 test_ret += test_xmlXPathNextAttribute();
47738 test_ret += test_xmlXPathNextChild();
47739 test_ret += test_xmlXPathNextDescendant();
47740 test_ret += test_xmlXPathNextDescendantOrSelf();
47741 test_ret += test_xmlXPathNextFollowing();
47742 test_ret += test_xmlXPathNextFollowingSibling();
47743 test_ret += test_xmlXPathNextNamespace();
47744 test_ret += test_xmlXPathNextParent();
47745 test_ret += test_xmlXPathNextPreceding();
47746 test_ret += test_xmlXPathNextPrecedingSibling();
47747 test_ret += test_xmlXPathNextSelf();
47748 test_ret += test_xmlXPathNodeLeading();
47749 test_ret += test_xmlXPathNodeLeadingSorted();
47750 test_ret += test_xmlXPathNodeSetAdd();
47751 test_ret += test_xmlXPathNodeSetAddNs();
47752 test_ret += test_xmlXPathNodeSetAddUnique();
47753 test_ret += test_xmlXPathNodeSetContains();
47754 test_ret += test_xmlXPathNodeSetDel();
47755 test_ret += test_xmlXPathNodeSetMerge();
47756 test_ret += test_xmlXPathNodeSetRemove();
47757 test_ret += test_xmlXPathNodeSetSort();
47758 test_ret += test_xmlXPathNodeTrailing();
47759 test_ret += test_xmlXPathNodeTrailingSorted();
47760 test_ret += test_xmlXPathNormalizeFunction();
47761 test_ret += test_xmlXPathNotEqualValues();
47762 test_ret += test_xmlXPathNotFunction();
47763 test_ret += test_xmlXPathNsLookup();
47764 test_ret += test_xmlXPathNumberFunction();
47765 test_ret += test_xmlXPathParseNCName();
47766 test_ret += test_xmlXPathParseName();
47767 test_ret += test_xmlXPathPopBoolean();
47768 test_ret += test_xmlXPathPopExternal();
47769 test_ret += test_xmlXPathPopNodeSet();
47770 test_ret += test_xmlXPathPopNumber();
47771 test_ret += test_xmlXPathPopString();
47772 test_ret += test_xmlXPathPositionFunction();
47773 test_ret += test_xmlXPathRegisterAllFunctions();
47774 test_ret += test_xmlXPathRegisterFunc();
47775 test_ret += test_xmlXPathRegisterFuncLookup();
47776 test_ret += test_xmlXPathRegisterFuncNS();
47777 test_ret += test_xmlXPathRegisterNs();
47778 test_ret += test_xmlXPathRegisterVariable();
47779 test_ret += test_xmlXPathRegisterVariableLookup();
47780 test_ret += test_xmlXPathRegisterVariableNS();
47781 test_ret += test_xmlXPathRegisteredFuncsCleanup();
47782 test_ret += test_xmlXPathRegisteredNsCleanup();
47783 test_ret += test_xmlXPathRegisteredVariablesCleanup();
47784 test_ret += test_xmlXPathRoot();
47785 test_ret += test_xmlXPathRoundFunction();
47786 test_ret += test_xmlXPathStartsWithFunction();
47787 test_ret += test_xmlXPathStringEvalNumber();
47788 test_ret += test_xmlXPathStringFunction();
47789 test_ret += test_xmlXPathStringLengthFunction();
47790 test_ret += test_xmlXPathSubValues();
47791 test_ret += test_xmlXPathSubstringAfterFunction();
47792 test_ret += test_xmlXPathSubstringBeforeFunction();
47793 test_ret += test_xmlXPathSubstringFunction();
47794 test_ret += test_xmlXPathSumFunction();
47795 test_ret += test_xmlXPathTrailing();
47796 test_ret += test_xmlXPathTrailingSorted();
47797 test_ret += test_xmlXPathTranslateFunction();
47798 test_ret += test_xmlXPathTrueFunction();
47799 test_ret += test_xmlXPathValueFlipSign();
47800 test_ret += test_xmlXPathVariableLookup();
47801 test_ret += test_xmlXPathVariableLookupNS();
47802 test_ret += test_xmlXPathWrapCString();
47803 test_ret += test_xmlXPathWrapExternal();
47804 test_ret += test_xmlXPathWrapNodeSet();
47805 test_ret += test_xmlXPatherror();
47806
47807 if (test_ret != 0)
47808 printf("Module xpathInternals: %d errors\n", test_ret);
47809 return(test_ret);
47810}
47811
Daniel Veillardd93f6252004-11-02 15:53:51 +000047812static int
47813test_xmlXPtrBuildNodeList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000047814 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047815
Daniel Veillardd005b9e2004-11-03 17:07:05 +000047816#ifdef LIBXML_XPTR_ENABLED
47817 int mem_base;
47818 xmlNodePtr ret_val;
47819 xmlXPathObjectPtr obj; /* the XPointer result from the evaluation. */
47820 int n_obj;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047821
Daniel Veillardd005b9e2004-11-03 17:07:05 +000047822 for (n_obj = 0;n_obj < gen_nb_xmlXPathObjectPtr;n_obj++) {
47823 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000047824 obj = gen_xmlXPathObjectPtr(n_obj, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000047825
47826 ret_val = xmlXPtrBuildNodeList(obj);
47827 desret_xmlNodePtr(ret_val);
47828 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000047829 des_xmlXPathObjectPtr(n_obj, obj, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000047830 xmlResetLastError();
47831 if (mem_base != xmlMemBlocks()) {
47832 printf("Leak of %d blocks found in xmlXPtrBuildNodeList",
47833 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000047834 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000047835 printf(" %d", n_obj);
47836 printf("\n");
47837 }
47838 }
47839#endif
47840
Daniel Veillard3d97e662004-11-04 10:49:00 +000047841 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000047842 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000047843}
47844
47845
47846static int
47847test_xmlXPtrEval(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000047848 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047849
Daniel Veillardce682bc2004-11-05 17:22:25 +000047850#ifdef LIBXML_XPTR_ENABLED
47851 int mem_base;
47852 xmlXPathObjectPtr ret_val;
47853 xmlChar * str; /* the XPointer expression */
47854 int n_str;
47855 xmlXPathContextPtr ctx; /* the XPointer context */
47856 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047857
Daniel Veillardce682bc2004-11-05 17:22:25 +000047858 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
47859 for (n_ctx = 0;n_ctx < gen_nb_xmlXPathContextPtr;n_ctx++) {
47860 mem_base = xmlMemBlocks();
47861 str = gen_const_xmlChar_ptr(n_str, 0);
47862 ctx = gen_xmlXPathContextPtr(n_ctx, 1);
47863
47864 ret_val = xmlXPtrEval(str, ctx);
47865 desret_xmlXPathObjectPtr(ret_val);
47866 call_tests++;
47867 des_const_xmlChar_ptr(n_str, str, 0);
47868 des_xmlXPathContextPtr(n_ctx, ctx, 1);
47869 xmlResetLastError();
47870 if (mem_base != xmlMemBlocks()) {
47871 printf("Leak of %d blocks found in xmlXPtrEval",
47872 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000047873 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000047874 printf(" %d", n_str);
47875 printf(" %d", n_ctx);
47876 printf("\n");
47877 }
47878 }
47879 }
47880#endif
47881
47882 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000047883 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000047884}
47885
47886
47887static int
47888test_xmlXPtrEvalRangePredicate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000047889 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047890
Daniel Veillardce682bc2004-11-05 17:22:25 +000047891#ifdef LIBXML_XPTR_ENABLED
47892 int mem_base;
47893 xmlXPathParserContextPtr ctxt; /* the XPointer Parser context */
47894 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047895
Daniel Veillardce682bc2004-11-05 17:22:25 +000047896 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47897 mem_base = xmlMemBlocks();
47898 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47899
47900 xmlXPtrEvalRangePredicate(ctxt);
47901 call_tests++;
47902 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47903 xmlResetLastError();
47904 if (mem_base != xmlMemBlocks()) {
47905 printf("Leak of %d blocks found in xmlXPtrEvalRangePredicate",
47906 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000047907 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000047908 printf(" %d", n_ctxt);
47909 printf("\n");
47910 }
47911 }
47912#endif
47913
47914 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000047915 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000047916}
47917
Daniel Veillarda521d282004-11-09 14:59:59 +000047918#ifdef LIBXML_XPTR_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000047919
Daniel Veillardce682bc2004-11-05 17:22:25 +000047920#define gen_nb_xmlLocationSetPtr 1
47921static xmlLocationSetPtr gen_xmlLocationSetPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
47922 return(NULL);
47923}
47924static void des_xmlLocationSetPtr(int no ATTRIBUTE_UNUSED, xmlLocationSetPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
47925}
Daniel Veillarda521d282004-11-09 14:59:59 +000047926#endif
47927
Daniel Veillardce682bc2004-11-05 17:22:25 +000047928
Daniel Veillardd93f6252004-11-02 15:53:51 +000047929static int
47930test_xmlXPtrLocationSetAdd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000047931 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047932
Daniel Veillardce682bc2004-11-05 17:22:25 +000047933#ifdef LIBXML_XPTR_ENABLED
47934 int mem_base;
47935 xmlLocationSetPtr cur; /* the initial range set */
47936 int n_cur;
47937 xmlXPathObjectPtr val; /* a new xmlXPathObjectPtr */
47938 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047939
Daniel Veillardce682bc2004-11-05 17:22:25 +000047940 for (n_cur = 0;n_cur < gen_nb_xmlLocationSetPtr;n_cur++) {
47941 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
47942 mem_base = xmlMemBlocks();
47943 cur = gen_xmlLocationSetPtr(n_cur, 0);
47944 val = gen_xmlXPathObjectPtr(n_val, 1);
47945
47946 xmlXPtrLocationSetAdd(cur, val);
47947 call_tests++;
47948 des_xmlLocationSetPtr(n_cur, cur, 0);
47949 des_xmlXPathObjectPtr(n_val, val, 1);
47950 xmlResetLastError();
47951 if (mem_base != xmlMemBlocks()) {
47952 printf("Leak of %d blocks found in xmlXPtrLocationSetAdd",
47953 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000047954 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000047955 printf(" %d", n_cur);
47956 printf(" %d", n_val);
47957 printf("\n");
47958 }
47959 }
47960 }
47961#endif
47962
47963 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000047964 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000047965}
47966
47967
47968static int
47969test_xmlXPtrLocationSetCreate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000047970 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047971
47972
47973 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000047974 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000047975}
47976
47977
47978static int
47979test_xmlXPtrLocationSetDel(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000047980 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047981
Daniel Veillardce682bc2004-11-05 17:22:25 +000047982#ifdef LIBXML_XPTR_ENABLED
47983 int mem_base;
47984 xmlLocationSetPtr cur; /* the initial range set */
47985 int n_cur;
47986 xmlXPathObjectPtr val; /* an xmlXPathObjectPtr */
47987 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047988
Daniel Veillardce682bc2004-11-05 17:22:25 +000047989 for (n_cur = 0;n_cur < gen_nb_xmlLocationSetPtr;n_cur++) {
47990 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
47991 mem_base = xmlMemBlocks();
47992 cur = gen_xmlLocationSetPtr(n_cur, 0);
47993 val = gen_xmlXPathObjectPtr(n_val, 1);
47994
47995 xmlXPtrLocationSetDel(cur, val);
47996 call_tests++;
47997 des_xmlLocationSetPtr(n_cur, cur, 0);
47998 des_xmlXPathObjectPtr(n_val, val, 1);
47999 xmlResetLastError();
48000 if (mem_base != xmlMemBlocks()) {
48001 printf("Leak of %d blocks found in xmlXPtrLocationSetDel",
48002 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048003 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048004 printf(" %d", n_cur);
48005 printf(" %d", n_val);
48006 printf("\n");
48007 }
48008 }
48009 }
48010#endif
48011
48012 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000048013 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048014}
48015
48016
48017static int
48018test_xmlXPtrLocationSetMerge(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048019 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048020
48021
48022 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000048023 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048024}
48025
48026
48027static int
48028test_xmlXPtrLocationSetRemove(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048029 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048030
Daniel Veillardce682bc2004-11-05 17:22:25 +000048031#ifdef LIBXML_XPTR_ENABLED
48032 int mem_base;
48033 xmlLocationSetPtr cur; /* the initial range set */
48034 int n_cur;
48035 int val; /* the index to remove */
48036 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048037
Daniel Veillardce682bc2004-11-05 17:22:25 +000048038 for (n_cur = 0;n_cur < gen_nb_xmlLocationSetPtr;n_cur++) {
48039 for (n_val = 0;n_val < gen_nb_int;n_val++) {
48040 mem_base = xmlMemBlocks();
48041 cur = gen_xmlLocationSetPtr(n_cur, 0);
48042 val = gen_int(n_val, 1);
48043
48044 xmlXPtrLocationSetRemove(cur, val);
48045 call_tests++;
48046 des_xmlLocationSetPtr(n_cur, cur, 0);
48047 des_int(n_val, val, 1);
48048 xmlResetLastError();
48049 if (mem_base != xmlMemBlocks()) {
48050 printf("Leak of %d blocks found in xmlXPtrLocationSetRemove",
48051 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048052 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048053 printf(" %d", n_cur);
48054 printf(" %d", n_val);
48055 printf("\n");
48056 }
48057 }
48058 }
48059#endif
48060
48061 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000048062 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048063}
48064
48065
48066static int
48067test_xmlXPtrNewCollapsedRange(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048068 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048069
Daniel Veillard3d97e662004-11-04 10:49:00 +000048070#ifdef LIBXML_XPTR_ENABLED
48071 int mem_base;
48072 xmlXPathObjectPtr ret_val;
48073 xmlNodePtr start; /* the starting and ending node */
48074 int n_start;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048075
Daniel Veillard3d97e662004-11-04 10:49:00 +000048076 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
48077 mem_base = xmlMemBlocks();
48078 start = gen_xmlNodePtr(n_start, 0);
48079
48080 ret_val = xmlXPtrNewCollapsedRange(start);
48081 desret_xmlXPathObjectPtr(ret_val);
48082 call_tests++;
48083 des_xmlNodePtr(n_start, start, 0);
48084 xmlResetLastError();
48085 if (mem_base != xmlMemBlocks()) {
48086 printf("Leak of %d blocks found in xmlXPtrNewCollapsedRange",
48087 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048088 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048089 printf(" %d", n_start);
48090 printf("\n");
48091 }
48092 }
48093#endif
48094
48095 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000048096 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048097}
48098
48099
48100static int
48101test_xmlXPtrNewContext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048102 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048103
48104
48105 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000048106 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048107}
48108
48109
48110static int
48111test_xmlXPtrNewLocationSetNodeSet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048112 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048113
Daniel Veillardce682bc2004-11-05 17:22:25 +000048114#ifdef LIBXML_XPTR_ENABLED
48115 int mem_base;
48116 xmlXPathObjectPtr ret_val;
48117 xmlNodeSetPtr set; /* a node set */
48118 int n_set;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048119
Daniel Veillardce682bc2004-11-05 17:22:25 +000048120 for (n_set = 0;n_set < gen_nb_xmlNodeSetPtr;n_set++) {
48121 mem_base = xmlMemBlocks();
48122 set = gen_xmlNodeSetPtr(n_set, 0);
48123
48124 ret_val = xmlXPtrNewLocationSetNodeSet(set);
48125 desret_xmlXPathObjectPtr(ret_val);
48126 call_tests++;
48127 des_xmlNodeSetPtr(n_set, set, 0);
48128 xmlResetLastError();
48129 if (mem_base != xmlMemBlocks()) {
48130 printf("Leak of %d blocks found in xmlXPtrNewLocationSetNodeSet",
48131 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048132 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048133 printf(" %d", n_set);
48134 printf("\n");
48135 }
48136 }
48137#endif
48138
48139 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000048140 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048141}
48142
48143
48144static int
48145test_xmlXPtrNewLocationSetNodes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048146 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048147
Daniel Veillard3d97e662004-11-04 10:49:00 +000048148#ifdef LIBXML_XPTR_ENABLED
48149 int mem_base;
48150 xmlXPathObjectPtr ret_val;
48151 xmlNodePtr start; /* the start NodePtr value */
48152 int n_start;
48153 xmlNodePtr end; /* the end NodePtr value or NULL */
48154 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048155
Daniel Veillard3d97e662004-11-04 10:49:00 +000048156 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
48157 for (n_end = 0;n_end < gen_nb_xmlNodePtr;n_end++) {
48158 mem_base = xmlMemBlocks();
48159 start = gen_xmlNodePtr(n_start, 0);
48160 end = gen_xmlNodePtr(n_end, 1);
48161
48162 ret_val = xmlXPtrNewLocationSetNodes(start, end);
48163 desret_xmlXPathObjectPtr(ret_val);
48164 call_tests++;
48165 des_xmlNodePtr(n_start, start, 0);
48166 des_xmlNodePtr(n_end, end, 1);
48167 xmlResetLastError();
48168 if (mem_base != xmlMemBlocks()) {
48169 printf("Leak of %d blocks found in xmlXPtrNewLocationSetNodes",
48170 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048171 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048172 printf(" %d", n_start);
48173 printf(" %d", n_end);
48174 printf("\n");
48175 }
48176 }
48177 }
48178#endif
48179
48180 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000048181 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048182}
48183
48184
48185static int
48186test_xmlXPtrNewRange(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048187 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048188
Daniel Veillard3d97e662004-11-04 10:49:00 +000048189#ifdef LIBXML_XPTR_ENABLED
48190 int mem_base;
48191 xmlXPathObjectPtr ret_val;
48192 xmlNodePtr start; /* the starting node */
48193 int n_start;
48194 int startindex; /* the start index */
48195 int n_startindex;
48196 xmlNodePtr end; /* the ending point */
48197 int n_end;
48198 int endindex; /* the ending index */
48199 int n_endindex;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048200
Daniel Veillard3d97e662004-11-04 10:49:00 +000048201 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
48202 for (n_startindex = 0;n_startindex < gen_nb_int;n_startindex++) {
48203 for (n_end = 0;n_end < gen_nb_xmlNodePtr;n_end++) {
48204 for (n_endindex = 0;n_endindex < gen_nb_int;n_endindex++) {
48205 mem_base = xmlMemBlocks();
48206 start = gen_xmlNodePtr(n_start, 0);
48207 startindex = gen_int(n_startindex, 1);
48208 end = gen_xmlNodePtr(n_end, 2);
48209 endindex = gen_int(n_endindex, 3);
48210
48211 ret_val = xmlXPtrNewRange(start, startindex, end, endindex);
48212 desret_xmlXPathObjectPtr(ret_val);
48213 call_tests++;
48214 des_xmlNodePtr(n_start, start, 0);
48215 des_int(n_startindex, startindex, 1);
48216 des_xmlNodePtr(n_end, end, 2);
48217 des_int(n_endindex, endindex, 3);
48218 xmlResetLastError();
48219 if (mem_base != xmlMemBlocks()) {
48220 printf("Leak of %d blocks found in xmlXPtrNewRange",
48221 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048222 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048223 printf(" %d", n_start);
48224 printf(" %d", n_startindex);
48225 printf(" %d", n_end);
48226 printf(" %d", n_endindex);
48227 printf("\n");
48228 }
48229 }
48230 }
48231 }
48232 }
48233#endif
48234
48235 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000048236 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048237}
48238
48239
48240static int
48241test_xmlXPtrNewRangeNodeObject(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048242 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048243
Daniel Veillard3d97e662004-11-04 10:49:00 +000048244#ifdef LIBXML_XPTR_ENABLED
48245 int mem_base;
48246 xmlXPathObjectPtr ret_val;
48247 xmlNodePtr start; /* the starting node */
48248 int n_start;
48249 xmlXPathObjectPtr end; /* the ending object */
48250 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048251
Daniel Veillard3d97e662004-11-04 10:49:00 +000048252 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
48253 for (n_end = 0;n_end < gen_nb_xmlXPathObjectPtr;n_end++) {
48254 mem_base = xmlMemBlocks();
48255 start = gen_xmlNodePtr(n_start, 0);
48256 end = gen_xmlXPathObjectPtr(n_end, 1);
48257
48258 ret_val = xmlXPtrNewRangeNodeObject(start, end);
48259 desret_xmlXPathObjectPtr(ret_val);
48260 call_tests++;
48261 des_xmlNodePtr(n_start, start, 0);
48262 des_xmlXPathObjectPtr(n_end, end, 1);
48263 xmlResetLastError();
48264 if (mem_base != xmlMemBlocks()) {
48265 printf("Leak of %d blocks found in xmlXPtrNewRangeNodeObject",
48266 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048267 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048268 printf(" %d", n_start);
48269 printf(" %d", n_end);
48270 printf("\n");
48271 }
48272 }
48273 }
48274#endif
48275
48276 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000048277 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048278}
48279
48280
48281static int
48282test_xmlXPtrNewRangeNodePoint(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048283 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048284
Daniel Veillard3d97e662004-11-04 10:49:00 +000048285#ifdef LIBXML_XPTR_ENABLED
48286 int mem_base;
48287 xmlXPathObjectPtr ret_val;
48288 xmlNodePtr start; /* the starting node */
48289 int n_start;
48290 xmlXPathObjectPtr end; /* the ending point */
48291 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048292
Daniel Veillard3d97e662004-11-04 10:49:00 +000048293 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
48294 for (n_end = 0;n_end < gen_nb_xmlXPathObjectPtr;n_end++) {
48295 mem_base = xmlMemBlocks();
48296 start = gen_xmlNodePtr(n_start, 0);
48297 end = gen_xmlXPathObjectPtr(n_end, 1);
48298
48299 ret_val = xmlXPtrNewRangeNodePoint(start, end);
48300 desret_xmlXPathObjectPtr(ret_val);
48301 call_tests++;
48302 des_xmlNodePtr(n_start, start, 0);
48303 des_xmlXPathObjectPtr(n_end, end, 1);
48304 xmlResetLastError();
48305 if (mem_base != xmlMemBlocks()) {
48306 printf("Leak of %d blocks found in xmlXPtrNewRangeNodePoint",
48307 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048308 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048309 printf(" %d", n_start);
48310 printf(" %d", n_end);
48311 printf("\n");
48312 }
48313 }
48314 }
48315#endif
48316
48317 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000048318 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048319}
48320
48321
48322static int
48323test_xmlXPtrNewRangeNodes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048324 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048325
Daniel Veillard3d97e662004-11-04 10:49:00 +000048326#ifdef LIBXML_XPTR_ENABLED
48327 int mem_base;
48328 xmlXPathObjectPtr ret_val;
48329 xmlNodePtr start; /* the starting node */
48330 int n_start;
48331 xmlNodePtr end; /* the ending node */
48332 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048333
Daniel Veillard3d97e662004-11-04 10:49:00 +000048334 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
48335 for (n_end = 0;n_end < gen_nb_xmlNodePtr;n_end++) {
48336 mem_base = xmlMemBlocks();
48337 start = gen_xmlNodePtr(n_start, 0);
48338 end = gen_xmlNodePtr(n_end, 1);
48339
48340 ret_val = xmlXPtrNewRangeNodes(start, end);
48341 desret_xmlXPathObjectPtr(ret_val);
48342 call_tests++;
48343 des_xmlNodePtr(n_start, start, 0);
48344 des_xmlNodePtr(n_end, end, 1);
48345 xmlResetLastError();
48346 if (mem_base != xmlMemBlocks()) {
48347 printf("Leak of %d blocks found in xmlXPtrNewRangeNodes",
48348 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048349 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048350 printf(" %d", n_start);
48351 printf(" %d", n_end);
48352 printf("\n");
48353 }
48354 }
48355 }
48356#endif
48357
48358 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000048359 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048360}
48361
48362
48363static int
48364test_xmlXPtrNewRangePointNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048365 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048366
Daniel Veillard3d97e662004-11-04 10:49:00 +000048367#ifdef LIBXML_XPTR_ENABLED
48368 int mem_base;
48369 xmlXPathObjectPtr ret_val;
48370 xmlXPathObjectPtr start; /* the starting point */
48371 int n_start;
48372 xmlNodePtr end; /* the ending node */
48373 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048374
Daniel Veillard3d97e662004-11-04 10:49:00 +000048375 for (n_start = 0;n_start < gen_nb_xmlXPathObjectPtr;n_start++) {
48376 for (n_end = 0;n_end < gen_nb_xmlNodePtr;n_end++) {
48377 mem_base = xmlMemBlocks();
48378 start = gen_xmlXPathObjectPtr(n_start, 0);
48379 end = gen_xmlNodePtr(n_end, 1);
48380
48381 ret_val = xmlXPtrNewRangePointNode(start, end);
48382 desret_xmlXPathObjectPtr(ret_val);
48383 call_tests++;
48384 des_xmlXPathObjectPtr(n_start, start, 0);
48385 des_xmlNodePtr(n_end, end, 1);
48386 xmlResetLastError();
48387 if (mem_base != xmlMemBlocks()) {
48388 printf("Leak of %d blocks found in xmlXPtrNewRangePointNode",
48389 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048390 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048391 printf(" %d", n_start);
48392 printf(" %d", n_end);
48393 printf("\n");
48394 }
48395 }
48396 }
48397#endif
48398
48399 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000048400 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048401}
48402
48403
48404static int
48405test_xmlXPtrNewRangePoints(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048406 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048407
Daniel Veillard3d97e662004-11-04 10:49:00 +000048408#ifdef LIBXML_XPTR_ENABLED
48409 int mem_base;
48410 xmlXPathObjectPtr ret_val;
48411 xmlXPathObjectPtr start; /* the starting point */
48412 int n_start;
48413 xmlXPathObjectPtr end; /* the ending point */
48414 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048415
Daniel Veillard3d97e662004-11-04 10:49:00 +000048416 for (n_start = 0;n_start < gen_nb_xmlXPathObjectPtr;n_start++) {
48417 for (n_end = 0;n_end < gen_nb_xmlXPathObjectPtr;n_end++) {
48418 mem_base = xmlMemBlocks();
48419 start = gen_xmlXPathObjectPtr(n_start, 0);
48420 end = gen_xmlXPathObjectPtr(n_end, 1);
48421
48422 ret_val = xmlXPtrNewRangePoints(start, end);
48423 desret_xmlXPathObjectPtr(ret_val);
48424 call_tests++;
48425 des_xmlXPathObjectPtr(n_start, start, 0);
48426 des_xmlXPathObjectPtr(n_end, end, 1);
48427 xmlResetLastError();
48428 if (mem_base != xmlMemBlocks()) {
48429 printf("Leak of %d blocks found in xmlXPtrNewRangePoints",
48430 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048431 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048432 printf(" %d", n_start);
48433 printf(" %d", n_end);
48434 printf("\n");
48435 }
48436 }
48437 }
48438#endif
48439
48440 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000048441 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048442}
48443
48444
48445static int
48446test_xmlXPtrRangeToFunction(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048447 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048448
Daniel Veillardce682bc2004-11-05 17:22:25 +000048449#ifdef LIBXML_XPTR_ENABLED
48450 int mem_base;
48451 xmlXPathParserContextPtr ctxt; /* the XPointer Parser context */
48452 int n_ctxt;
48453 int nargs; /* the number of args */
48454 int n_nargs;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048455
Daniel Veillardce682bc2004-11-05 17:22:25 +000048456 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
48457 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
48458 mem_base = xmlMemBlocks();
48459 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
48460 nargs = gen_int(n_nargs, 1);
48461
48462 xmlXPtrRangeToFunction(ctxt, nargs);
48463 call_tests++;
48464 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
48465 des_int(n_nargs, nargs, 1);
48466 xmlResetLastError();
48467 if (mem_base != xmlMemBlocks()) {
48468 printf("Leak of %d blocks found in xmlXPtrRangeToFunction",
48469 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048470 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048471 printf(" %d", n_ctxt);
48472 printf(" %d", n_nargs);
48473 printf("\n");
48474 }
48475 }
48476 }
48477#endif
48478
48479 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000048480 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048481}
48482
48483
48484static int
48485test_xmlXPtrWrapLocationSet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048486 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048487
Daniel Veillardce682bc2004-11-05 17:22:25 +000048488#ifdef LIBXML_XPTR_ENABLED
48489 int mem_base;
48490 xmlXPathObjectPtr ret_val;
48491 xmlLocationSetPtr val; /* the LocationSet value */
48492 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048493
Daniel Veillardce682bc2004-11-05 17:22:25 +000048494 for (n_val = 0;n_val < gen_nb_xmlLocationSetPtr;n_val++) {
48495 mem_base = xmlMemBlocks();
48496 val = gen_xmlLocationSetPtr(n_val, 0);
48497
48498 ret_val = xmlXPtrWrapLocationSet(val);
48499 desret_xmlXPathObjectPtr(ret_val);
48500 call_tests++;
48501 des_xmlLocationSetPtr(n_val, val, 0);
48502 xmlResetLastError();
48503 if (mem_base != xmlMemBlocks()) {
48504 printf("Leak of %d blocks found in xmlXPtrWrapLocationSet",
48505 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048506 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048507 printf(" %d", n_val);
48508 printf("\n");
48509 }
48510 }
48511#endif
48512
48513 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000048514 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048515}
48516
48517static int
48518test_xpointer(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048519 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048520
Daniel Veillardce682bc2004-11-05 17:22:25 +000048521 printf("Testing xpointer : 17 of 21 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000048522 test_ret += test_xmlXPtrBuildNodeList();
48523 test_ret += test_xmlXPtrEval();
48524 test_ret += test_xmlXPtrEvalRangePredicate();
48525 test_ret += test_xmlXPtrLocationSetAdd();
48526 test_ret += test_xmlXPtrLocationSetCreate();
48527 test_ret += test_xmlXPtrLocationSetDel();
48528 test_ret += test_xmlXPtrLocationSetMerge();
48529 test_ret += test_xmlXPtrLocationSetRemove();
48530 test_ret += test_xmlXPtrNewCollapsedRange();
48531 test_ret += test_xmlXPtrNewContext();
48532 test_ret += test_xmlXPtrNewLocationSetNodeSet();
48533 test_ret += test_xmlXPtrNewLocationSetNodes();
48534 test_ret += test_xmlXPtrNewRange();
48535 test_ret += test_xmlXPtrNewRangeNodeObject();
48536 test_ret += test_xmlXPtrNewRangeNodePoint();
48537 test_ret += test_xmlXPtrNewRangeNodes();
48538 test_ret += test_xmlXPtrNewRangePointNode();
48539 test_ret += test_xmlXPtrNewRangePoints();
48540 test_ret += test_xmlXPtrRangeToFunction();
48541 test_ret += test_xmlXPtrWrapLocationSet();
Daniel Veillardd93f6252004-11-02 15:53:51 +000048542
Daniel Veillard42595322004-11-08 10:52:06 +000048543 if (test_ret != 0)
48544 printf("Module xpointer: %d errors\n", test_ret);
48545 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048546}
Daniel Veillardce244ad2004-11-05 10:03:46 +000048547static int
48548test_module(const char *module) {
48549 if (!strcmp(module, "HTMLparser")) return(test_HTMLparser());
48550 if (!strcmp(module, "HTMLtree")) return(test_HTMLtree());
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000048551 if (!strcmp(module, "SAX2")) return(test_SAX2());
Daniel Veillarda82b1822004-11-08 16:24:57 +000048552 if (!strcmp(module, "c14n")) return(test_c14n());
Daniel Veillardce244ad2004-11-05 10:03:46 +000048553 if (!strcmp(module, "catalog")) return(test_catalog());
48554 if (!strcmp(module, "chvalid")) return(test_chvalid());
Daniel Veillarda82b1822004-11-08 16:24:57 +000048555 if (!strcmp(module, "debugXML")) return(test_debugXML());
Daniel Veillardce244ad2004-11-05 10:03:46 +000048556 if (!strcmp(module, "dict")) return(test_dict());
48557 if (!strcmp(module, "encoding")) return(test_encoding());
48558 if (!strcmp(module, "entities")) return(test_entities());
48559 if (!strcmp(module, "hash")) return(test_hash());
48560 if (!strcmp(module, "list")) return(test_list());
48561 if (!strcmp(module, "nanoftp")) return(test_nanoftp());
48562 if (!strcmp(module, "nanohttp")) return(test_nanohttp());
48563 if (!strcmp(module, "parser")) return(test_parser());
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000048564 if (!strcmp(module, "parserInternals")) return(test_parserInternals());
Daniel Veillardce244ad2004-11-05 10:03:46 +000048565 if (!strcmp(module, "pattern")) return(test_pattern());
48566 if (!strcmp(module, "relaxng")) return(test_relaxng());
48567 if (!strcmp(module, "schemasInternals")) return(test_schemasInternals());
48568 if (!strcmp(module, "tree")) return(test_tree());
48569 if (!strcmp(module, "uri")) return(test_uri());
48570 if (!strcmp(module, "valid")) return(test_valid());
48571 if (!strcmp(module, "xinclude")) return(test_xinclude());
48572 if (!strcmp(module, "xmlIO")) return(test_xmlIO());
Daniel Veillarda82b1822004-11-08 16:24:57 +000048573 if (!strcmp(module, "xmlautomata")) return(test_xmlautomata());
Daniel Veillardce244ad2004-11-05 10:03:46 +000048574 if (!strcmp(module, "xmlerror")) return(test_xmlerror());
48575 if (!strcmp(module, "xmlreader")) return(test_xmlreader());
Daniel Veillarda82b1822004-11-08 16:24:57 +000048576 if (!strcmp(module, "xmlregexp")) return(test_xmlregexp());
Daniel Veillardce244ad2004-11-05 10:03:46 +000048577 if (!strcmp(module, "xmlsave")) return(test_xmlsave());
48578 if (!strcmp(module, "xmlschemas")) return(test_xmlschemas());
48579 if (!strcmp(module, "xmlschemastypes")) return(test_xmlschemastypes());
48580 if (!strcmp(module, "xmlstring")) return(test_xmlstring());
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000048581 if (!strcmp(module, "xmlunicode")) return(test_xmlunicode());
Daniel Veillardce244ad2004-11-05 10:03:46 +000048582 if (!strcmp(module, "xmlwriter")) return(test_xmlwriter());
48583 if (!strcmp(module, "xpath")) return(test_xpath());
Daniel Veillarda82b1822004-11-08 16:24:57 +000048584 if (!strcmp(module, "xpathInternals")) return(test_xpathInternals());
Daniel Veillardce244ad2004-11-05 10:03:46 +000048585 if (!strcmp(module, "xpointer")) return(test_xpointer());
48586 return(0);
48587}