summaryrefslogtreecommitdiff
path: root/gentest.py
diff options
context:
space:
mode:
authorWilliam M. Brack <wbrack@src.gnome.org>2004-11-12 16:03:48 +0000
committerWilliam M. Brack <wbrack@src.gnome.org>2004-11-12 16:03:48 +0000
commitf13f77f0e6a7876063d5fba15c096befb0827ced (patch)
treec3cc118258d03a6217e7444213415a31cb570e36 /gentest.py
parent48307f432abe2a3b1c117b67eafc1257eb3b0308 (diff)
downloadlibxml2-f13f77f0e6a7876063d5fba15c096befb0827ced.tar.gz
trivial change (changed CHECK_CONTEXT to CHECK_CTXT on a couple of lines)
* xpath.c: trivial change (changed CHECK_CONTEXT to CHECK_CTXT on a couple of lines) * gentest.py, testapi.c: enhanced to reduce compilation warnings
Diffstat (limited to 'gentest.py')
-rwxr-xr-xgentest.py35
1 files changed, 21 insertions, 14 deletions
diff --git a/gentest.py b/gentest.py
index 8975cd9c..5473a8d2 100755
--- a/gentest.py
+++ b/gentest.py
@@ -628,7 +628,12 @@ def generate_test(module, node):
if is_known_param_type(type, rtype) == 0:
add_missing_type(type, name);
no_gen = 1
- t_args.append((nam, type, rtype, info))
+ if (type[-3:] == 'Ptr' or type[-4:] == '_ptr') and \
+ rtype[0:6] == 'const ':
+ crtype = rtype[6:]
+ else:
+ crtype = rtype
+ t_args.append((nam, type, rtype, crtype, info))
try:
rets = node.xpathEval("return")
@@ -688,12 +693,7 @@ test_%s(void) {
# Declare the arguments
for arg in t_args:
- (nam, type, rtype, info) = arg;
- if (type[-3:] == 'Ptr' or type[-4:] == '_ptr') and \
- rtype[0:6] == 'const ':
- crtype = rtype[6:]
- else:
- crtype = rtype
+ (nam, type, rtype, crtype, info) = arg;
# add declaration
test.write(" %s %s; /* %s */\n" % (crtype, nam, info))
test.write(" int n_%s;\n" % (nam))
@@ -701,7 +701,7 @@ test_%s(void) {
# Cascade loop on of each argument list of values
for arg in t_args:
- (nam, type, rtype, info) = arg;
+ (nam, type, rtype, crtype, info) = arg;
#
test.write(" for (n_%s = 0;n_%s < gen_nb_%s;n_%s++) {\n" % (
nam, nam, type, nam))
@@ -713,7 +713,7 @@ test_%s(void) {
# prepare the call
i = 0;
for arg in t_args:
- (nam, type, rtype, info) = arg;
+ (nam, type, rtype, crtype, info) = arg;
#
test.write(" %s = gen_%s(n_%s, %d);\n" % (nam, type, nam, i))
i = i + 1;
@@ -725,11 +725,13 @@ test_%s(void) {
test.write("\n ret_val = %s(" % (name))
need = 0
for arg in t_args:
- (nam, type, rtype, info) = arg
+ (nam, type, rtype, crtype, info) = arg
if need:
test.write(", ")
else:
need = 1
+ if rtype != crtype:
+ test.write("(%s)" % rtype)
test.write("%s" % nam);
test.write(");\n")
if extra_post_call.has_key(name):
@@ -739,11 +741,13 @@ test_%s(void) {
test.write("\n %s(" % (name));
need = 0;
for arg in t_args:
- (nam, type, rtype, info) = arg;
+ (nam, type, rtype, crtype, info) = arg;
if need:
test.write(", ")
else:
need = 1
+ if rtype != crtype:
+ test.write("(%s)" % rtype)
test.write("%s" % nam)
test.write(");\n")
if extra_post_call.has_key(name):
@@ -754,9 +758,12 @@ test_%s(void) {
# Free the arguments
i = 0;
for arg in t_args:
- (nam, type, rtype, info) = arg;
+ (nam, type, rtype, crtype, info) = arg;
#
- test.write(" des_%s(n_%s, %s, %d);\n" % (type, nam, nam, i))
+ test.write(" des_%s(n_%s, " % (type, nam))
+ if rtype != crtype:
+ test.write("(%s)" % rtype)
+ test.write("%s, %d);\n" % (nam, i))
i = i + 1;
test.write(" xmlResetLastError();\n");
@@ -768,7 +775,7 @@ test_%s(void) {
test_ret++;
""" % (name));
for arg in t_args:
- (nam, type, rtype, info) = arg;
+ (nam, type, rtype, crtype, info) = arg;
test.write(""" printf(" %%d", n_%s);\n""" % (nam))
test.write(""" printf("\\n");\n""")
test.write(" }\n")