Merge from trunk
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2009-sploving@12905 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
commit
dd3db36b1a
321 changed files with 12114 additions and 8559 deletions
|
|
@ -41,6 +41,7 @@ CPP_TEST_CASES += \
|
|||
inout \
|
||||
inplaceadd \
|
||||
input \
|
||||
kwargs_feature \
|
||||
li_cstring \
|
||||
li_cwstring \
|
||||
li_factory \
|
||||
|
|
@ -58,7 +59,7 @@ CPP_TEST_CASES += \
|
|||
primitive_types \
|
||||
python_abstractbase \
|
||||
python_append \
|
||||
python_kwargs \
|
||||
python_director \
|
||||
python_nondynamic \
|
||||
python_overload_simple_cast \
|
||||
python_richcompare \
|
||||
|
|
|
|||
176
Examples/test-suite/python/autodoc_runme.py
Normal file
176
Examples/test-suite/python/autodoc_runme.py
Normal file
|
|
@ -0,0 +1,176 @@
|
|||
from autodoc import *
|
||||
|
||||
def check(got, expected):
|
||||
if expected != got:
|
||||
raise RuntimeError("\n" + "Expected: [" + expected + "]\n" + "Got : [" + got + "]")
|
||||
|
||||
check(A.__doc__, "Proxy of C++ A class")
|
||||
check(A.funk.__doc__, "just a string")
|
||||
check(A.func0.__doc__, "func0(self, arg2, hello) -> int")
|
||||
check(A.func1.__doc__, "func1(A self, short arg2, Tuple hello) -> int")
|
||||
check(A.func2.__doc__, "\n"
|
||||
" func2(self, arg2, hello) -> int\n"
|
||||
"\n"
|
||||
" Parameters:\n"
|
||||
" arg2: short\n"
|
||||
" hello: int tuple[2]\n"
|
||||
"\n"
|
||||
" "
|
||||
)
|
||||
check(A.func3.__doc__, "\n"
|
||||
" func3(A self, short arg2, Tuple hello) -> int\n"
|
||||
"\n"
|
||||
" Parameters:\n"
|
||||
" arg2: short\n"
|
||||
" hello: int tuple[2]\n"
|
||||
"\n"
|
||||
" "
|
||||
)
|
||||
|
||||
check(A.func0default.__doc__, "\n"
|
||||
" func0default(self, e, arg3, hello, f=2) -> int\n"
|
||||
" func0default(self, e, arg3, hello) -> int\n"
|
||||
" "
|
||||
)
|
||||
check(A.func1default.__doc__, "\n"
|
||||
" func1default(A self, A e, short arg3, Tuple hello, double f=2) -> int\n"
|
||||
" func1default(A self, A e, short arg3, Tuple hello) -> int\n"
|
||||
" "
|
||||
)
|
||||
check(A.func2default.__doc__, "\n"
|
||||
" func2default(self, e, arg3, hello, f=2) -> int\n"
|
||||
"\n"
|
||||
" Parameters:\n"
|
||||
" e: A *\n"
|
||||
" arg3: short\n"
|
||||
" hello: int tuple[2]\n"
|
||||
" f: double\n"
|
||||
"\n"
|
||||
" func2default(self, e, arg3, hello) -> int\n"
|
||||
"\n"
|
||||
" Parameters:\n"
|
||||
" e: A *\n"
|
||||
" arg3: short\n"
|
||||
" hello: int tuple[2]\n"
|
||||
"\n"
|
||||
" "
|
||||
)
|
||||
check(A.func3default.__doc__, "\n"
|
||||
" func3default(A self, A e, short arg3, Tuple hello, double f=2) -> int\n"
|
||||
"\n"
|
||||
" Parameters:\n"
|
||||
" e: A *\n"
|
||||
" arg3: short\n"
|
||||
" hello: int tuple[2]\n"
|
||||
" f: double\n"
|
||||
"\n"
|
||||
" func3default(A self, A e, short arg3, Tuple hello) -> int\n"
|
||||
"\n"
|
||||
" Parameters:\n"
|
||||
" e: A *\n"
|
||||
" arg3: short\n"
|
||||
" hello: int tuple[2]\n"
|
||||
"\n"
|
||||
" "
|
||||
)
|
||||
|
||||
check(A.func0static.__doc__, "\n"
|
||||
" func0static(e, arg2, hello, f=2) -> int\n"
|
||||
" func0static(e, arg2, hello) -> int\n"
|
||||
" "
|
||||
)
|
||||
check(A.func1static.__doc__, "\n"
|
||||
" func1static(A e, short arg2, Tuple hello, double f=2) -> int\n"
|
||||
" func1static(A e, short arg2, Tuple hello) -> int\n"
|
||||
" "
|
||||
)
|
||||
check(A.func2static.__doc__, "\n"
|
||||
" func2static(e, arg2, hello, f=2) -> int\n"
|
||||
"\n"
|
||||
" Parameters:\n"
|
||||
" e: A *\n"
|
||||
" arg2: short\n"
|
||||
" hello: int tuple[2]\n"
|
||||
" f: double\n"
|
||||
"\n"
|
||||
" func2static(e, arg2, hello) -> int\n"
|
||||
"\n"
|
||||
" Parameters:\n"
|
||||
" e: A *\n"
|
||||
" arg2: short\n"
|
||||
" hello: int tuple[2]\n"
|
||||
"\n"
|
||||
" "
|
||||
)
|
||||
check(A.func3static.__doc__, "\n"
|
||||
" func3static(A e, short arg2, Tuple hello, double f=2) -> int\n"
|
||||
"\n"
|
||||
" Parameters:\n"
|
||||
" e: A *\n"
|
||||
" arg2: short\n"
|
||||
" hello: int tuple[2]\n"
|
||||
" f: double\n"
|
||||
"\n"
|
||||
" func3static(A e, short arg2, Tuple hello) -> int\n"
|
||||
"\n"
|
||||
" Parameters:\n"
|
||||
" e: A *\n"
|
||||
" arg2: short\n"
|
||||
" hello: int tuple[2]\n"
|
||||
"\n"
|
||||
" "
|
||||
)
|
||||
|
||||
check(A.variable_a.__doc__, "A_variable_a_get(self) -> int")
|
||||
check(A.variable_b.__doc__, "A_variable_b_get(A self) -> int")
|
||||
check(A.variable_c.__doc__, "\n"
|
||||
"A_variable_c_get(self) -> int\n"
|
||||
"\n"
|
||||
"Parameters:\n"
|
||||
" self: A *\n"
|
||||
"\n"
|
||||
)
|
||||
check(A.variable_d.__doc__, "\n"
|
||||
"A_variable_d_get(A self) -> int\n"
|
||||
"\n"
|
||||
"Parameters:\n"
|
||||
" self: A *\n"
|
||||
"\n"
|
||||
)
|
||||
|
||||
check(B.__doc__, "Proxy of C++ B class")
|
||||
check(C.__init__.__doc__, "__init__(self, a, b, h) -> C")
|
||||
check(D.__init__.__doc__, "__init__(D self, int a, int b, Hola h) -> D")
|
||||
check(E.__init__.__doc__, "\n"
|
||||
" __init__(self, a, b, h) -> E\n"
|
||||
"\n"
|
||||
" Parameters:\n"
|
||||
" a: special comment for parameter a\n"
|
||||
" b: another special comment for parameter b\n"
|
||||
" h: enum Hola\n"
|
||||
"\n"
|
||||
" "
|
||||
)
|
||||
check(F.__init__.__doc__, "\n"
|
||||
" __init__(F self, int a, int b, Hola h) -> F\n"
|
||||
"\n"
|
||||
" Parameters:\n"
|
||||
" a: special comment for parameter a\n"
|
||||
" b: another special comment for parameter b\n"
|
||||
" h: enum Hola\n"
|
||||
"\n"
|
||||
" "
|
||||
)
|
||||
|
||||
check(B.funk.__doc__, "funk(B self, int c, int d) -> int")
|
||||
check(funk.__doc__, "funk(A e, short arg2, int c, int d) -> int")
|
||||
check(funkdefaults.__doc__, "\n"
|
||||
" funkdefaults(A e, short arg2, int c, int d, double f=2) -> int\n"
|
||||
" funkdefaults(A e, short arg2, int c, int d) -> int\n"
|
||||
" "
|
||||
)
|
||||
|
||||
check(func_input.__doc__, "func_input(int * INPUT) -> int")
|
||||
check(func_output.__doc__, "func_output() -> int")
|
||||
check(func_inout.__doc__, "func_inout(int * INOUT) -> int")
|
||||
check(banana.__doc__, "banana(S a, S b, int c, Integer d)")
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
from python_kwargs import *
|
||||
from kwargs_feature import *
|
||||
|
||||
class MyFoo(Foo):
|
||||
def __init__(self, a , b = 0):
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
from li_boost_shared_ptr_template import *
|
||||
|
||||
b = BaseINTEGER()
|
||||
d = DerivedINTEGER()
|
||||
if b.bar() != 1:
|
||||
raise RuntimeError
|
||||
if d.bar() != 2:
|
||||
raise RuntimeError
|
||||
if bar_getter(b) != 1:
|
||||
raise RuntimeError
|
||||
if bar_getter(d) != 2:
|
||||
raise RuntimeError
|
||||
|
||||
b = BaseDefaultInt()
|
||||
d = DerivedDefaultInt()
|
||||
d2 = DerivedDefaultInt2()
|
||||
if b.bar2() != 3:
|
||||
raise RuntimeError
|
||||
if d.bar2() != 4:
|
||||
raise RuntimeError
|
||||
if d2.bar2() != 4:
|
||||
raise RuntimeError
|
||||
if bar2_getter(b) != 3:
|
||||
raise RuntimeError
|
||||
if bar2_getter(d) != 4:
|
||||
raise RuntimeError
|
||||
if bar2_getter(d2) != 4:
|
||||
raise RuntimeError
|
||||
265
Examples/test-suite/python/li_std_containers_int_runme.py
Normal file
265
Examples/test-suite/python/li_std_containers_int_runme.py
Normal file
|
|
@ -0,0 +1,265 @@
|
|||
# Check std::vector and std::list behaves the same as Python iterable types (list)
|
||||
|
||||
from li_std_containers_int import *
|
||||
|
||||
def failed(a, b, msg):
|
||||
raise RuntimeError, msg + " " + str(list(a)) + " " + str(list(b))
|
||||
|
||||
def compare_sequences(a, b):
|
||||
if len(a) != len(b):
|
||||
failed(a, b, "different sizes")
|
||||
for i in range(len(a)):
|
||||
if a[i] != b[i]:
|
||||
failed(a, b, "elements are different")
|
||||
|
||||
def compare_containers(pythonlist, swigvector, swiglist):
|
||||
compare_sequences(pythonlist, swigvector)
|
||||
compare_sequences(pythonlist, swiglist)
|
||||
|
||||
# Check std::vector and std::list assignment behaves same as Python list assignment including exceptions
|
||||
def container_insert_step(i, j, step, newval):
|
||||
ps = range(6)
|
||||
iv = vector_int(ps)
|
||||
il = list_int(ps)
|
||||
|
||||
# Python slice
|
||||
try:
|
||||
if step == None:
|
||||
if j == None:
|
||||
ps[i] = newval
|
||||
else:
|
||||
ps[i:j] = newval
|
||||
else:
|
||||
if j == None:
|
||||
ps[i::step] = newval
|
||||
else:
|
||||
ps[i:j:step] = newval
|
||||
ps_error = None
|
||||
except ValueError, e:
|
||||
ps_error = e
|
||||
except IndexError, e:
|
||||
ps_error = e
|
||||
|
||||
# std::vector<int>
|
||||
try:
|
||||
if step == None:
|
||||
if j == None:
|
||||
iv[i] = newval
|
||||
else:
|
||||
iv[i:j] = newval
|
||||
else:
|
||||
if j == None:
|
||||
iv[i::step] = newval
|
||||
else:
|
||||
iv[i:j:step] = newval
|
||||
iv_error = None
|
||||
except ValueError, e:
|
||||
iv_error = e
|
||||
except IndexError, e:
|
||||
iv_error = e
|
||||
|
||||
# std::list<int>
|
||||
try:
|
||||
if step == None:
|
||||
if j == None:
|
||||
il[i] = newval
|
||||
else:
|
||||
il[i:j] = newval
|
||||
else:
|
||||
if j == None:
|
||||
il[i::step] = newval
|
||||
else:
|
||||
il[i:j:step] = newval
|
||||
il_error = None
|
||||
except ValueError, e:
|
||||
il_error = e
|
||||
except IndexError, e:
|
||||
il_error = e
|
||||
|
||||
if not((type(ps_error) == type(iv_error)) and (type(ps_error) == type(il_error))):
|
||||
raise RuntimeError, "ValueError exception not consistently thrown: " + str(ps_error) + " " + str(iv_error) + " " + str(il_error)
|
||||
|
||||
compare_containers(ps, iv, il)
|
||||
|
||||
|
||||
# Check std::vector and std::list delete behaves same as Python list delete including exceptions
|
||||
def container_delete_step(i, j, step):
|
||||
ps = range(6)
|
||||
iv = vector_int(ps)
|
||||
il = list_int(ps)
|
||||
|
||||
# Python slice
|
||||
try:
|
||||
if step == None:
|
||||
if j == None:
|
||||
del ps[i]
|
||||
else:
|
||||
del ps[i:j]
|
||||
else:
|
||||
if j == None:
|
||||
del ps[i::step]
|
||||
else:
|
||||
del ps[i:j:step]
|
||||
ps_error = None
|
||||
except ValueError, e:
|
||||
ps_error = e
|
||||
except IndexError, e:
|
||||
ps_error = e
|
||||
|
||||
# std::vector<int>
|
||||
try:
|
||||
if step == None:
|
||||
if j == None:
|
||||
del iv[i]
|
||||
else:
|
||||
del iv[i:j]
|
||||
else:
|
||||
if j == None:
|
||||
del iv[i::step]
|
||||
else:
|
||||
del iv[i:j:step]
|
||||
iv_error = None
|
||||
except ValueError, e:
|
||||
iv_error = e
|
||||
except IndexError, e:
|
||||
iv_error = e
|
||||
|
||||
# std::list<int>
|
||||
try:
|
||||
if step == None:
|
||||
if j == None:
|
||||
del il[i]
|
||||
else:
|
||||
del il[i:j]
|
||||
else:
|
||||
if j == None:
|
||||
del il[i::step]
|
||||
else:
|
||||
del il[i:j:step]
|
||||
il_error = None
|
||||
except ValueError, e:
|
||||
il_error = e
|
||||
except IndexError, e:
|
||||
il_error = e
|
||||
|
||||
if not((type(ps_error) == type(iv_error)) and (type(ps_error) == type(il_error))):
|
||||
raise RuntimeError, "ValueError exception not consistently thrown: " + str(ps_error) + " " + str(iv_error) + " " + str(il_error)
|
||||
|
||||
compare_containers(ps, iv, il)
|
||||
|
||||
|
||||
ps = [0,1,2,3,4,5]
|
||||
|
||||
iv = vector_int(ps)
|
||||
il = list_int(ps)
|
||||
|
||||
# slices
|
||||
compare_containers(ps[0:0], iv[0:0], il[0:0])
|
||||
compare_containers(ps[1:1], iv[1:1], il[1:1])
|
||||
compare_containers(ps[1:3], iv[1:3], il[1:3])
|
||||
compare_containers(ps[2:4], iv[2:4], il[2:4])
|
||||
compare_containers(ps[0:3], iv[0:3], il[0:3])
|
||||
compare_containers(ps[3:6], iv[3:6], il[3:6])
|
||||
compare_containers(ps[3:10], iv[3:10], il[3:10]) # beyond end of range
|
||||
|
||||
# before beginning of range (negative indexing)
|
||||
compare_containers(ps[-1:7], iv[-1:7], il[-1:7])
|
||||
compare_containers(ps[-2:7], iv[-2:7], il[-2:7])
|
||||
compare_containers(ps[-5:7], iv[-5:7], il[-5:7])
|
||||
compare_containers(ps[-6:7], iv[-6:7], il[-6:7])
|
||||
|
||||
# before beginning of range (negative indexing, negative index is > container size)
|
||||
compare_containers(ps[-7:7], iv[-7:7], il[-7:7])
|
||||
compare_containers(ps[-100:7], iv[-100:7], il[-100:7])
|
||||
|
||||
compare_containers(ps[3:], iv[3:], il[3:])
|
||||
compare_containers(ps[:3], iv[:3], il[:3])
|
||||
compare_containers(ps[:], iv[:], il[:])
|
||||
compare_containers(ps[-3:], iv[-3:], il[-3:])
|
||||
compare_containers(ps[-7:], iv[-7:], il[-7:])
|
||||
compare_containers(ps[:-1], iv[:-1], il[:-1])
|
||||
compare_containers(ps[:-7], iv[:-7], il[:-7])
|
||||
|
||||
# step slicing
|
||||
compare_containers(ps[1:5:1], iv[1:5:1], il[1:5:1])
|
||||
compare_containers(ps[1:5:2], iv[1:5:2], il[1:5:2])
|
||||
compare_containers(ps[1:5:3], iv[1:5:3], il[1:5:3])
|
||||
compare_containers(ps[1:5:4], iv[1:5:4], il[1:5:4])
|
||||
compare_containers(ps[1:6:5], iv[1:6:5], il[1:6:5])
|
||||
compare_containers(ps[1:7:5], iv[1:7:5], il[1:7:5])
|
||||
compare_containers(ps[-1:7:1], iv[-1:7:1], il[-1:7:1])
|
||||
compare_containers(ps[-1:7:2], iv[-1:7:2], il[-1:7:2])
|
||||
compare_containers(ps[-6:7:2], iv[-6:7:2], il[-6:7:2])
|
||||
compare_containers(ps[-100:7:2], iv[-100:7:2], il[-100:7:2])
|
||||
compare_containers(ps[::1], iv[::1], il[::1])
|
||||
compare_containers(ps[::2], iv[::2], il[::2])
|
||||
|
||||
compare_containers(ps[::-1], iv[::-1], il[::-1])
|
||||
compare_containers(ps[6::-1], iv[6::-1], il[6::-1])
|
||||
compare_containers(ps[:-3:-1], iv[:-3:-1], il[:-3:-1])
|
||||
compare_containers(ps[:-6:-1], iv[:-6:-1], il[:-6:-1])
|
||||
compare_containers(ps[:-7:-1], iv[:-7:-1], il[:-7:-1])
|
||||
compare_containers(ps[:-8:-1], iv[:-8:-1], il[:-8:-1])
|
||||
compare_containers(ps[:-100:-1], iv[:-100:-1], il[:-100:-1])
|
||||
compare_containers(ps[4:6:-1], iv[4:6:-1], il[4:6:-1])
|
||||
compare_containers(ps[4:5:-1], iv[4:5:-1], il[4:5:-1])
|
||||
compare_containers(ps[4:4:-1], iv[4:4:-1], il[4:4:-1])
|
||||
compare_containers(ps[4:3:-1], iv[4:3:-1], il[4:3:-1])
|
||||
compare_containers(ps[4:2:-1], iv[4:2:-1], il[4:2:-1])
|
||||
compare_containers(ps[100:104:-1], iv[100:104:-1], il[100:104:-1])
|
||||
compare_containers(ps[104:100:-1], iv[104:100:-1], il[104:100:-1])
|
||||
compare_containers(ps[-100:-104:-1], iv[-100:-104:-1], il[-100:-104:-1])
|
||||
compare_containers(ps[-104:-100:-1], iv[-104:-100:-1], il[-104:-100:-1])
|
||||
compare_containers(ps[::-2], iv[::-2], il[::-2])
|
||||
compare_containers(ps[::-3], iv[::-3], il[::-3])
|
||||
compare_containers(ps[::-4], iv[::-4], il[::-4])
|
||||
compare_containers(ps[::-5], iv[::-5], il[::-5])
|
||||
|
||||
|
||||
# insert sequences (growing, shrinking and staying same size)
|
||||
for start in [-102, -100, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 100, 102]:
|
||||
# single element set/replace
|
||||
container_insert_step(start, None, None, 111)
|
||||
for end in [-102, -100, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 100, 102]:
|
||||
container_insert_step(start, end, None, [111, 222, 333, 444, 555, 666, 777])
|
||||
container_insert_step(start, end, None, [111, 222, 333, 444, 555, 666])
|
||||
container_insert_step(start, end, None, [111, 222, 333, 444, 555])
|
||||
container_insert_step(start, end, None, [111, 222, 333, 444])
|
||||
container_insert_step(start, end, None, [111, 222, 333])
|
||||
container_insert_step(start, end, None, [111, 222])
|
||||
container_insert_step(start, end, None, [111])
|
||||
container_insert_step(start, end, None, [])
|
||||
|
||||
# delete sequences (growing, shrinking and staying same size)
|
||||
for start in [-102, -100, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 100, 102]:
|
||||
# single element delete
|
||||
container_delete_step(start, None, None)
|
||||
for end in [-102, -100, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 100, 102]:
|
||||
container_delete_step(start, end, None)
|
||||
for step in range(-7,7):
|
||||
container_delete_step(start, end, step)
|
||||
|
||||
ps = range(6)
|
||||
iv = vector_int(ps)
|
||||
il = list_int(ps)
|
||||
del ps[:]; del iv[:]; del il[:]
|
||||
compare_containers(ps, iv, il)
|
||||
|
||||
for end in range(7):
|
||||
for step in range(-7,7):
|
||||
for start in range(7):
|
||||
container_insert_step(start, end, step, [111, 222, 333, 444, 555, 666, 777])
|
||||
container_insert_step(start, end, step, [111, 222, 333, 444, 555, 666])
|
||||
container_insert_step(start, end, step, [111, 222, 333, 444, 555])
|
||||
container_insert_step(start, end, step, [111, 222, 333, 444])
|
||||
container_insert_step(start, end, step, [111, 222, 333])
|
||||
container_insert_step(start, end, step, [111, 222])
|
||||
container_insert_step(start, end, step, [111])
|
||||
container_insert_step(start, end, step, [])
|
||||
|
||||
try:
|
||||
x = iv[::0]
|
||||
raise RuntimeError("Zero step not caught")
|
||||
except ValueError:
|
||||
pass
|
||||
|
||||
4
Examples/test-suite/python/li_std_vector_runme.py
Normal file
4
Examples/test-suite/python/li_std_vector_runme.py
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
from li_std_vector import *
|
||||
|
||||
if typedef_test(101) != 101:
|
||||
raise RuntimeError
|
||||
|
|
@ -10,14 +10,14 @@ b2 = B.create(a)
|
|||
|
||||
|
||||
if a.ref_count() != 3:
|
||||
print "This program will crash... now"
|
||||
raise RuntimeError("Count = %d" % a.ref_count())
|
||||
|
||||
|
||||
rca = b2.get_rca()
|
||||
b3 = B.create(rca)
|
||||
|
||||
if a.ref_count() != 5:
|
||||
print "This program will crash... now"
|
||||
raise RuntimeError("Count = %d" % a.ref_count())
|
||||
|
||||
|
||||
v = vector_A(2)
|
||||
|
|
@ -27,6 +27,35 @@ v[1] = a
|
|||
x = v[0]
|
||||
del v
|
||||
|
||||
if a.ref_count() != 6:
|
||||
raise RuntimeError("Count = %d" % a.ref_count())
|
||||
|
||||
# Check %newobject
|
||||
b4 = b2.cloner()
|
||||
if b4.ref_count() != 1:
|
||||
raise RuntimeError
|
||||
|
||||
b5 = global_create(a)
|
||||
if b5.ref_count() != 1:
|
||||
raise RuntimeError
|
||||
|
||||
b6 = Factory.create(a)
|
||||
if b6.ref_count() != 1:
|
||||
raise RuntimeError
|
||||
|
||||
b7 = Factory().create2(a)
|
||||
if b7.ref_count() != 1:
|
||||
raise RuntimeError
|
||||
|
||||
|
||||
if a.ref_count() != 10:
|
||||
raise RuntimeError("Count = %d" % a.ref_count())
|
||||
|
||||
del b4
|
||||
del b5
|
||||
del b6
|
||||
del b7
|
||||
|
||||
if a.ref_count() != 6:
|
||||
raise RuntimeError("Count = %d" % a.ref_count())
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,37 @@
|
|||
from template_typemaps_typedef2 import *
|
||||
|
||||
m1 = MultimapIntA()
|
||||
|
||||
dummy_pair = m1.make_dummy_pair()
|
||||
val = m1.typemap_test(dummy_pair).val
|
||||
if val != 1234:
|
||||
raise RuntimeError, "typemaps not working"
|
||||
|
||||
m2 = MultimapAInt()
|
||||
|
||||
# TODO: typemaps and specializations not quite working as expected. T needs expanding, but at least the right typemap is being picked up.
|
||||
#dummy_pair = m2.make_dummy_pair()
|
||||
#val = m2.typemap_test(dummy_pair)
|
||||
|
||||
#print val
|
||||
#if val != 4321:
|
||||
# raise RuntimeError, "typemaps not working"
|
||||
|
||||
if typedef_test1(dummy_pair).val != 1234:
|
||||
raise RuntimeError, "typedef_test1 not working"
|
||||
|
||||
if typedef_test2(dummy_pair).val != 1234:
|
||||
raise RuntimeError, "typedef_test2 not working"
|
||||
|
||||
if typedef_test3(dummy_pair).val != 1234:
|
||||
raise RuntimeError, "typedef_test3 not working"
|
||||
|
||||
if typedef_test4(dummy_pair).val != 1234:
|
||||
raise RuntimeError, "typedef_test4 not working"
|
||||
|
||||
if typedef_test5(dummy_pair).val != 1234:
|
||||
raise RuntimeError, "typedef_test5 not working"
|
||||
|
||||
if typedef_test6(dummy_pair).val != 1234:
|
||||
raise RuntimeError, "typedef_test6 not working"
|
||||
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
from template_typemaps_typedef import *
|
||||
|
||||
m1 = MultimapIntA()
|
||||
|
||||
dummy_pair = m1.make_dummy_pair()
|
||||
val = m1.typemap_test(dummy_pair).val
|
||||
if val != 1234:
|
||||
raise RuntimeError, "typemaps not working"
|
||||
|
||||
m2 = MultimapAInt()
|
||||
|
||||
# TODO: typemaps and specializations not quite working as expected. T needs expanding, but at least the right typemap is being picked up.
|
||||
#dummy_pair = m2.make_dummy_pair()
|
||||
#val = m2.typemap_test(dummy_pair)
|
||||
|
||||
#print val
|
||||
#if val != 4321:
|
||||
# raise RuntimeError, "typemaps not working"
|
||||
|
||||
if typedef_test1(dummy_pair).val != 1234:
|
||||
raise RuntimeError, "typedef_test1 not working"
|
||||
|
||||
if typedef_test2(dummy_pair).val != 1234:
|
||||
raise RuntimeError, "typedef_test2 not working"
|
||||
|
||||
if typedef_test3(dummy_pair).val != 1234:
|
||||
raise RuntimeError, "typedef_test3 not working"
|
||||
|
||||
if typedef_test4(dummy_pair).val != 1234:
|
||||
raise RuntimeError, "typedef_test4 not working"
|
||||
|
||||
if typedef_test5(dummy_pair).val != 1234:
|
||||
raise RuntimeError, "typedef_test5 not working"
|
||||
|
||||
if typedef_test6(dummy_pair).val != 1234:
|
||||
raise RuntimeError, "typedef_test6 not working"
|
||||
|
||||
|
|
@ -5,8 +5,8 @@ b = typename.Bar()
|
|||
|
||||
x = typename.twoFoo(f)
|
||||
if not isinstance(x,types.FloatType):
|
||||
print "Wrong return type!"
|
||||
raise RuntimeError,"Wrong return type (FloatType) !"
|
||||
y = typename.twoBar(b)
|
||||
if not isinstance(y,types.IntType):
|
||||
print "Wrong return type!"
|
||||
raise RuntimeError,"Wrong return type (IntType)!"
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue