Merge branch 'master' into doxygen

Merge with ~3.0.1 sources from master.
This commit is contained in:
Vadim Zeitlin 2014-04-30 18:37:57 +02:00
commit 1ebd2334b8
1593 changed files with 51732 additions and 28076 deletions

View file

@ -58,7 +58,7 @@ CPP_TEST_CASES += \
li_std_wstream \
li_std_wstring \
primitive_types \
python_abstractbase \
python_abstractbase \
python_append \
python_director \
python_nondynamic \
@ -110,16 +110,19 @@ VALGRIND_OPT += --suppressions=pythonswig.supp
# Rules for the different types of tests
%.cpptest:
+$(convert_testcase)
$(setup)
+$(swig_and_compile_cpp)
$(run_testcase)
%.ctest:
+$(convert_testcase)
$(setup)
+$(swig_and_compile_c)
$(run_testcase)
%.multicpptest:
+$(convert_testcase)
$(setup)
+$(swig_and_compile_multi_cpp)
$(run_testcase)
@ -139,17 +142,17 @@ run_python = env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH PYTHONPATH=.:$(srcdir):$$PY
py2_runme = $(srcdir)/$(SCRIPTPREFIX)$*$(PY2SCRIPTSUFFIX)
py3_runme = $(srcdir)/$(SCRIPTPREFIX)$*$(PY3SCRIPTSUFFIX)
ifeq (,$(PY3))
run_testcase = \
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
$(run_python);\
fi
ifeq (,$(PY3))
convert_testcase =
else
run_testcase = \
convert_testcase = \
if [ -f $(py2_runme) ]; then \
$(MAKE) -f $(srcdir)/Makefile $(py3_runme) && $(run_python); \
elif [ -f $(py3_runme) ]; then \
$(run_python); \
$(MAKE) -f $(srcdir)/Makefile $(py3_runme); \
fi
endif
@ -162,6 +165,9 @@ endif
clean:
$(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile python_clean
rm -f hugemod.h hugemod_a.i hugemod_b.i hugemod_a.py hugemod_b.py hugemod_runme.py
rm -f clientdata_prop_a.py clientdata_prop_b.py import_stl_a.py import_stl_b.py
rm -f imports_a.py imports_b.py mod_a.py mod_b.py multi_import_a.py
rm -f multi_import_b.py packageoption_a.py packageoption_b.py packageoption_c.py
cvsignore:
@echo '*wrap* *.pyc *.so *.dll *.exp *.lib'

View file

@ -1,5 +1,6 @@
from autodoc import *
import commentVerifier
import sys
commentVerifier.check(A.__doc__, "Proxy of C++ A class")
@ -119,22 +120,24 @@ commentVerifier.check(A.func3static.__doc__, "\n"
" "
)
commentVerifier.check(A.variable_a.__doc__, "A_variable_a_get(self) -> int")
commentVerifier.check(A.variable_b.__doc__, "A_variable_b_get(A self) -> int")
commentVerifier.check(A.variable_c.__doc__, "\n"
"A_variable_c_get(self) -> int\n"
"\n"
"Parameters:\n"
" self: A *\n"
"\n"
)
commentVerifier.check(A.variable_d.__doc__, "\n"
"A_variable_d_get(A self) -> int\n"
"\n"
"Parameters:\n"
" self: A *\n"
"\n"
)
if sys.version_info[0:2] > (2, 4):
# Python 2.4 does not seem to work
commentVerifier.check(A.variable_a.__doc__, "A_variable_a_get(self) -> int")
commentVerifier.check(A.variable_b.__doc__, "A_variable_b_get(A self) -> int")
commentVerifier.check(A.variable_c.__doc__, "\n"
"A_variable_c_get(self) -> int\n"
"\n"
"Parameters:\n"
" self: A *\n"
"\n"
)
commentVerifier.check(A.variable_d.__doc__, "\n"
"A_variable_d_get(A self) -> int\n"
"\n"
"Parameters:\n"
" self: A *\n"
"\n"
)
commentVerifier.check(B.__doc__, "Proxy of C++ B class")
commentVerifier.check(C.__init__.__doc__, "__init__(self, a, b, h) -> C")

View file

@ -0,0 +1,13 @@
import cpp11_alternate_function_syntax
a = cpp11_alternate_function_syntax.SomeStruct()
res = a.addNormal(4,5)
if res != 9:
raise RuntimeError, ("SomeStruct::addNormal(4,5) returns ", res, " should be 9.")
res = a.addAlternate(4,5)
if res != 9:
raise RuntimeError, ("SomeStruct::addAlternate(4,5) returns ", res, " should be 9.")

View file

@ -0,0 +1,19 @@
import cpp11_decltype
a = cpp11_decltype.A()
a.i = 5
if a.i != 5:
raise RuntimeError, "Assignment to a.i failed."
a.j = 10
if a.j != 10:
raise RuntimeError, "Assignment to a.j failed."
b = a.foo(5)
if b != 10:
raise RuntimeError, "foo(5) should return 10."
b = a.foo(6)
if b != 0:
raise RuntimeError, "foo(6) should return 0."

View file

@ -0,0 +1,12 @@
import cpp11_function_objects
import sys
t = cpp11_function_objects.Test()
if t.value != 0:
raise RuntimeError("Runtime cpp11_function_objects failed. t.value should be 0, but is " + str(t.value))
t(1,2) # adds numbers and sets value
if t.value != 3:
raise RuntimeError("Runtime cpp11_function_objects failed. t.value not changed - should be 3, but is " + str(t.value))

View file

@ -0,0 +1,4 @@
import cpp11_initializer_list_extend
c = cpp11_initializer_list_extend.Container( [10, 20, 30, 40] )

View file

@ -0,0 +1,5 @@
import cpp11_initializer_list
a = cpp11_initializer_list.A()
a = cpp11_initializer_list.A(11.1)

View file

@ -0,0 +1,15 @@
import cpp11_null_pointer_constant
a = cpp11_null_pointer_constant.A()
if a._myA != None:
raise RuntimeError, ("cpp11_null_pointer_constant: _myA should be None, but is ", a._myA)
b = cpp11_null_pointer_constant.A()
if a._myA != b._myA:
raise RuntimeError, ("cpp11_null_pointer_constant: a._myA should be the same as b._myA, but ", a._myA, "!=", b._myA)
a._myA = cpp11_null_pointer_constant.A()
if a._myA == None:
raise RuntimeError, ("cpp11_null_pointer_constant: _myA should be object, but is None")

View file

@ -0,0 +1,50 @@
from cpp11_raw_string_literals import *
if cvar.L != 100:
raise RuntimeError
if cvar.u8 != 100:
raise RuntimeError
if cvar.u != 100:
raise RuntimeError
if UStruct.U != 100:
raise RuntimeError
if cvar.R != 100:
raise RuntimeError
if cvar.LR != 100:
raise RuntimeError
if cvar.u8R != 100:
raise RuntimeError
if cvar.uR != 100:
raise RuntimeError
if URStruct.UR != 100:
raise RuntimeError
if cvar.aa != "Wide string":
raise RuntimeError
if cvar.bb != "UTF-8 string":
raise RuntimeError, cvar.wide
if cvar.xx != ")I'm an \"ascii\" \\ string.":
raise RuntimeError, cvar.xx
if cvar.ee != ")I'm an \"ascii\" \\ string.":
raise RuntimeError, cvar.ee
if cvar.ff != "I'm a \"raw wide\" \\ string.":
raise RuntimeError, cvar.ff
if cvar.gg != "I'm a \"raw UTF-8\" \\ string.":
raise RuntimeError, cvar.gg

View file

@ -0,0 +1,9 @@
import cpp11_result_of
result = cpp11_result_of.test_result(cpp11_result_of.SQUARE, 3.0)
if result != 9.0:
raise RuntimeError, "test_result(square, 3.0) is not 9.0. Got: " + str(result)
result = cpp11_result_of.test_result_alternative1(cpp11_result_of.SQUARE, 3.0)
if result != 9.0:
raise RuntimeError, "test_result_alternative1(square, 3.0) is not 9.0. Got: " + str(result)

View file

@ -0,0 +1,24 @@
import cpp11_rvalue_reference
a = cpp11_rvalue_reference.A()
a.setAcopy(5)
if a.getAcopy() != 5:
raise RunTimeError, ("int A::getAcopy() value is ", a.getAcopy(), " should be 5")
ptr = a.getAptr()
a.setAptr(ptr)
if a.getAcopy() != 5:
raise RunTimeError, ("after A::setAptr(): int A::getAcopy() value is ", a.getAcopy(), " should be 5")
a.setAref(ptr)
if a.getAcopy() != 5:
raise RunTimeError, ("after A::setAref(): int A::getAcopy() value is ", a.getAcopy(), " should be 5")
rvalueref = a.getAmove()
a.setAmove(rvalueref)
if a.getAcopy() != 5:
raise RunTimeError, ("after A::setAmove(): int A::getAcopy() value is ", a.getAcopy(), " should be 5")

View file

@ -0,0 +1,38 @@
from cpp11_thread_local import *
t = ThreadLocals()
if t.stval != 11:
raise RuntimeError
if t.tsval != 22:
raise RuntimeError
if t.tscval99 != 99:
raise RuntimeError
cvar.etval = -11
if cvar.etval != -11:
raise RuntimeError
cvar.stval = -22
if cvar.stval != -22:
raise RuntimeError
cvar.tsval = -33
if cvar.tsval != -33:
raise RuntimeError
cvar.etval = -44
if cvar.etval != -44:
raise RuntimeError
cvar.teval = -55
if cvar.teval != -55:
raise RuntimeError
cvar.ectval = -66
if cvar.ectval != -66:
raise RuntimeError
cvar.ecpptval = -66
if cvar.ecpptval != -66:
raise RuntimeError

View file

@ -0,0 +1,7 @@
from cpp11_type_traits import *
if Elaborate(0, 0) != 1:
raise RuntimeError("Elaborate should have returned 1")
if Elaborate(0, 0.0) != 2:
raise RuntimeError("Elaborate should have returned 2")

View file

@ -0,0 +1,21 @@
import cpp11_uniform_initialization
var1 = cpp11_uniform_initialization.cvar.var1
if var1.x != 5:
raise RuntimeError
var2 = cpp11_uniform_initialization.cvar.var2
if var2.getX() != 2:
raise RuntimeError
m = cpp11_uniform_initialization.MoreInit()
if m.charptr != None:
raise RuntimeError, m.charptr
m.charptr = "hello sir"
if m.charptr != "hello sir":
raise RuntimeError, m.charptr
if m.more1(m.vi) != 15:
raise RuntimeError, m.vi
if m.more1( [-1,1,2] ) != 2:
raise RuntimeError, m.vi
if m.more1() != 10:
raise RuntimeError

View file

@ -0,0 +1,10 @@
import enum_forward
f1 = enum_forward.get_enum1();
f1 = enum_forward.test_function1(f1);
f2 = enum_forward.get_enum2();
f2 = enum_forward.test_function2(f2);
f3 = enum_forward.get_enum3();
f3 = enum_forward.test_function3(f3);

View file

@ -1,7 +1,7 @@
import sys
import file_test
if sys.version_info < (3,0):
if sys.version_info[0:2] < (3, 0):
file_test.nfile(sys.stdout)
cstdout = file_test.GetStdOut()

View file

@ -0,0 +1,52 @@
from global_functions import *
def check(a, b):
if a != b:
raise RuntimeError("Failed: " + str(a) + " != " + str(b))
global_void()
check(global_one(1), 1)
check(global_two(2, 2), 4)
fail = True
try:
global_void(1)
except TypeError, e:
fail = False
if fail:
raise RuntimeError("argument count check failed")
fail = True
try:
global_one()
except TypeError, e:
fail = False
if fail:
raise RuntimeError("argument count check failed")
fail = True
try:
global_one(2, 2)
except TypeError, e:
fail = False
if fail:
raise RuntimeError("argument count check failed")
fail = True
try:
global_two(1)
except TypeError, e:
fail = False
if fail:
raise RuntimeError("argument count check failed")
fail = True
try:
global_two(3, 3, 3)
except TypeError, e:
fail = False
if fail:
raise RuntimeError("argument count check failed")

View file

@ -0,0 +1,35 @@
import global_vars
global_vars.init()
b = global_vars.cvar.b
if b != "string b":
raise RuntimeError("Unexpected string: " + b)
global_vars.cvar.b = "a string value"
b = global_vars.cvar.b
if b != "a string value":
raise RuntimeError("Unexpected string: " + b)
x = global_vars.cvar.x
if x != 1234:
raise RuntimeError("Unexpected x: " + str(x))
global_vars.cvar.x = 9876
x = global_vars.cvar.x
if x != 9876:
raise RuntimeError("Unexpected string: " + str(x))
fail = True
try:
global_vars.cvar.notexist = "something"
except AttributeError, e:
fail = False
if fail:
raise RuntimeError("AttributeError should have been thrown")
fail = True
try:
g = global_vars.cvar.notexist
except AttributeError, e:
fail = False
if fail:
raise RuntimeError("AttributeError should have been thrown")

View file

@ -0,0 +1,125 @@
from implicittest import *
def check(a, b):
if a != b:
raise RuntimeError(str(a) + " does not equal " + str(b))
#### Class ####
# No implicit conversion
check(1, A(1).get())
check(2, A(1.0).get())
check(3, A(B()).get())
check(4, A("hello").get())
try:
check(3, A(None).get())
raise RuntimeError
except ValueError:
# ValueError: invalid null reference in method 'new_A', argument 1 of type 'B const &'
# Arguably A(char *) should be chosen, but there is a bug to do with None passed to methods overloaded by value,
# references and pointers to different types, where pointers ought to be given a slightly higher precedence.
pass
check(1, get(1))
check(2, get(1.0))
check(3, get(B()))
# Explicit constructor:
try:
check(4, get("hello"))
raise RuntimeError
except TypeError:
pass
#### Template Class ####
# No implicit conversion
check(1, A_int(1).get())
check(2, A_int(1.0).get())
check(3, A_int(B()).get())
check(4, A_int("hello").get())
check(1, A_int.sget(1))
check(2, A_int.sget(1.0))
check(3, A_int.sget(B()))
# explicit constructor:
try:
check(4, A_int.sget("hello"))
raise RuntimeError
except TypeError:
pass
#### Global variable assignment ####
cvar.foo = Foo(1); check(cvar.foo.ii, 1)
cvar.foo = 1; check(cvar.foo.ii, 1)
cvar.foo = 1.0; check(cvar.foo.ii, 2)
cvar.foo = Foo("hello"); check(cvar.foo.ii, 3)
# explicit constructor:
try:
cvar.foo = "hello"
raise RuntimeError
except TypeError:
pass
#### Member variable assignment ####
# Note: also needs naturalvar
b = Bar(); check(b.f.ii, 0)
b.f = Foo("hello"); check(b.f.ii, 3)
b.f = 1; check(b.f.ii, 1)
b.f = 1.0; check(b.f.ii, 2)
# explicit constructor:
try:
b.f = "hello"
raise RuntimeError
except TypeError:
pass
#### Class testing None ####
# No implicit conversion
check(1, AA(1).get())
check(2, AA(1.0).get())
check(3, AA(B()).get())
check(3, AA(None).get())
check(4, AA("hello").get())
check(5, AA(BB()).get())
check(1, get_AA_val(1))
check(2, get_AA_val(1.0))
check(3, get_AA_val(B()))
check(3, get_AA_val(None))
check(5, get_AA_val(BB()))
# Explicit constructor:
try:
check(4, get_AA_val("hello"))
raise RuntimeError
except TypeError:
pass
check(1, get_AA_ref(1))
check(2, get_AA_ref(1.0))
check(3, get_AA_ref(B()))
check(3, get_AA_ref(None))
check(5, get_AA_ref(BB()))
# Explicit constructor:
try:
check(4, get_AA_ref("hello"))
raise RuntimeError
except TypeError:
pass
### overloading priority test ###
ccc = CCC(B())
check(ccc.checkvalue, 10)
check(ccc.xx(123), 11)
check(ccc.yy(123, 123), 111)

View file

@ -0,0 +1,67 @@
# Check usage of template attributes
import li_attribute_template
chell = li_attribute_template.Cintint(1,2,3)
def rassert( what, master ):
if what != master:
print what
raise RuntimeError
## Testing primitive by value attribute
rassert( chell.a, 1 )
chell.a = 3
rassert( chell.a, 3 )
## Testing primitive by ref attribute
rassert( chell.b, 2 )
chell.b = 5
rassert( chell.b,5 )
## Testing string
chell.str = "abc"
rassert( chell.str, "abc" )
# Testing class by value
rassert( chell.d.value, 1 )
chell.d = li_attribute_template.Foo(2)
rassert( chell.d.value, 2 )
# Testing class by reference
rassert( chell.e.value, 2 )
chell.e= li_attribute_template.Foo(3)
rassert( chell.e.value, 3 )
chell.e.value = 4
rassert( chell.e.value, 4 )
# Testing moderately complex template by value
rassert( chell.f.first, 1 )
rassert( chell.f.second, 2 )
pair = li_attribute_template.pair_intint(3,4)
chell.f = pair
rassert( chell.f.first, 3 )
rassert( chell.f.second, 4 )
# Testing moderately complex template by ref
rassert( chell.g.first, 2 )
rassert( chell.g.second, 3 )
pair = li_attribute_template.pair_intint(4,5)
chell.g = pair
rassert( chell.g.first, 4 )
rassert( chell.g.second, 5 )
chell.g.first = 6
chell.g.second = 7
rassert( chell.g.first, 6 )
rassert( chell.g.second, 7 )

View file

@ -0,0 +1,17 @@
from li_std_auto_ptr import *
k1 = makeKlassAutoPtr("first")
k2 = makeKlassAutoPtr("second")
if Klass.getTotal_count() != 2:
raise "number of objects should be 2"
del k1
if Klass.getTotal_count() != 1:
raise "number of objects should be 1"
if k2.getLabel() != "second":
raise "wrong object label"
del k2
if Klass.getTotal_count() != 0:
raise "no objects should be left"

View file

@ -1,6 +1,7 @@
# Check std::vector and std::list behaves the same as Python iterable types (list)
from li_std_containers_int import *
import sys
def failed(a, b, msg):
raise RuntimeError, msg + " " + str(list(a)) + " " + str(list(b))
@ -76,10 +77,13 @@ def container_insert_step(i, j, step, newval):
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)
# Python 2.6 contains bug fixes in extended slicing syntax: http://docs.python.org/2/whatsnew/2.6.html
skip_check = ps_error != None and(iv_error == il_error == None) and step > 0 and (sys.version_info[0:2] < (2, 6))
if not(skip_check):
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)
compare_containers(ps, iv, il)
# Check std::vector and std::list delete behaves same as Python list delete including exceptions

View file

@ -0,0 +1,9 @@
from li_std_except_as_class import *
# std::domain_error hierarchy
try: test_domain_error()
except domain_error: pass
try: test_domain_error()
except logic_error: pass
try: test_domain_error()
except exception: pass

View file

@ -0,0 +1,10 @@
from li_std_pair_using import *
one_tuple = ("one", "numero uno")
one = StringStringPair(one_tuple)
two_tuple = ("two", 2)
two = StringIntPair(two_tuple)
if bounce(one) != one_tuple:
raise RuntimeError

View file

@ -17,10 +17,10 @@ halve_in_place(dv)
bv = BoolVector(4)
bv[0]= 1
bv[1]= 0
bv[2]= 4
bv[3]= 0
bv[0]= bool(1)
bv[1]= bool(0)
bv[2]= bool(4)
bv[3]= bool(0)
if bv[0] != bv[2]:
raise RuntimeError,"bad std::vector<bool> mapping"

View file

@ -13,6 +13,12 @@ if li_std_wstring.test_ccvalue(x) != x:
if li_std_wstring.test_cvalue(x) != x:
raise RuntimeError("bad string mapping")
if li_std_wstring.test_wchar_overload(x) != x:
raise RuntimeError("bad string mapping")
if li_std_wstring.test_wchar_overload("not unicode") != "not unicode":
raise RuntimeError("bad string mapping")
if li_std_wstring.test_value(x) != x:
print x, li_std_wstring.test_value(x)
raise RuntimeError("bad string mapping")

View file

@ -32,3 +32,7 @@ f.moo(1)
f = FooT_H()
f.foo(Hi)
f_type = str(type(f))
if f_type.find("'namespace_class.FooT_H'") == -1:
raise RuntimeError("Incorrect type: " + f_type)

View file

@ -0,0 +1,55 @@
import overload_bool
# Overloading bool, int, string
if overload_bool.overloaded(True) != "bool":
raise RuntimeError("wrong!")
if overload_bool.overloaded(False) != "bool":
raise RuntimeError("wrong!")
if overload_bool.overloaded(0) != "int":
raise RuntimeError("wrong!")
if overload_bool.overloaded(1) != "int":
raise RuntimeError("wrong!")
if overload_bool.overloaded(2) != "int":
raise RuntimeError("wrong!")
if overload_bool.overloaded("1234") != "string":
raise RuntimeError("wrong!")
# Test bool masquerading as int
if overload_bool.intfunction(True) != "int":
raise RuntimeError("wrong!")
if overload_bool.intfunction(False) != "int":
raise RuntimeError("wrong!")
# Test int masquerading as bool
# Not possible
#############################################
# Overloading bool, int, string
if overload_bool.overloaded_ref(True) != "bool":
raise RuntimeError("wrong!")
if overload_bool.overloaded_ref(False) != "bool":
raise RuntimeError("wrong!")
if overload_bool.overloaded_ref(0) != "int":
raise RuntimeError("wrong!")
if overload_bool.overloaded_ref(1) != "int":
raise RuntimeError("wrong!")
if overload_bool.overloaded_ref(2) != "int":
raise RuntimeError("wrong!")
if overload_bool.overloaded_ref("1234") != "string":
raise RuntimeError("wrong!")
# Test bool masquerading as int
if overload_bool.intfunction_ref(True) != "int":
raise RuntimeError("wrong!")
if overload_bool.intfunction_ref(False) != "int":
raise RuntimeError("wrong!")
# Test int masquerading as bool
# Not possible

View file

@ -0,0 +1,43 @@
from overload_numeric import *
import math
nums = Nums()
limits = Limits()
def check(got, expected):
if got != expected:
raise RuntimeError("got: " + got + " expected: " + expected)
check(nums.over(0), "signed char")
check(nums.over(0.0), "float")
check(nums.over(limits.schar_min()), "signed char")
check(nums.over(limits.schar_max()), "signed char")
check(nums.over(limits.schar_min()-1), "short")
check(nums.over(limits.schar_max()+1), "short")
check(nums.over(limits.shrt_min()), "short")
check(nums.over(limits.shrt_max()), "short")
check(nums.over(limits.shrt_min()-1), "int")
check(nums.over(limits.shrt_max()+1), "int")
check(nums.over(limits.int_min()), "int")
check(nums.over(limits.int_max()), "int")
check(nums.over(limits.flt_min()), "float")
check(nums.over(limits.flt_max()), "float")
check(nums.over(limits.flt_max()*10), "double")
check(nums.over(-limits.flt_max()*10), "double")
check(nums.over(limits.dbl_max()), "double")
check(nums.over(-limits.dbl_max()), "double")
check(nums.over(float("inf")), "float")
check(nums.over(float("-inf")), "float")
check(nums.over(float("nan")), "float")
# Just check if the following are accepted without exceptions being thrown
nums.doublebounce(float("inf"))
nums.doublebounce(float("-inf"))
nums.doublebounce(float("nan"))

View file

@ -30,7 +30,7 @@ if ref_float(3.5) != 3.5:
if ref_double(3.5) != 3.5:
raise RuntimeError
if ref_bool(1) != 1:
if ref_bool(True) != True:
raise RuntimeError
if ref_char('x') != 'x':

View file

@ -165,7 +165,7 @@ t.var_paramc = sct_paramc
t.v_check()
# this value contains a '0' char!
if def_namet != 'ho\0la':
if def_namet != 'hola':
print "bad namet", def_namet
raise RuntimeError
@ -174,9 +174,9 @@ if t.var_namet != def_namet:
print "bad namet", t.var_namet, def_namet
raise RuntimeError
t.var_namet = 'holac'
t.var_namet = 'hola'
if t.var_namet != 'holac':
if t.var_namet != 'hola':
print "bad namet", t.var_namet
raise RuntimeError
@ -275,10 +275,22 @@ try:
except TypeError:
if a != t.var_char:
error = 1
pass
pass
if error:
raise RuntimeError, "bad char typemap"
try:
error = 0
a = t.var_ushort
t.var_ushort = -1
error = 1
except OverflowError:
if a != t.var_ushort:
error = 1
pass
if error:
raise RuntimeError, "bad ushort typemap"
try:
error = 0
a = t.var_uint
@ -287,10 +299,34 @@ try:
except OverflowError:
if a != t.var_uint:
error = 1
pass
pass
if error:
raise RuntimeError, "bad uint typemap"
try:
error = 0
a = t.var_sizet
t.var_sizet = -1
error = 1
except OverflowError:
if a != t.var_sizet:
error = 1
pass
if error:
raise RuntimeError, "bad sizet typemap"
try:
error = 0
a = t.var_ulong
t.var_ulong = -1
error = 1
except OverflowError:
if a != t.var_ulong:
error = 1
pass
if error:
raise RuntimeError, "bad ulong typemap"
#
#
try:
@ -301,7 +337,7 @@ try:
except TypeError:
if a != t.var_namet:
error = 1
pass
pass
if error:
raise RuntimeError, "bad namet typemap"

View file

@ -10,3 +10,11 @@ assert issubclass(IntSet, MutableSet)
assert issubclass(IntMultiset, MutableSet)
assert issubclass(IntVector, MutableSequence)
assert issubclass(IntList, MutableSequence)
mapii = Mapii()
multimapii = Multimapii()
intset = IntSet()
intmultiset = IntMultiset()
intvector = IntVector()
intlist = IntList()

View file

@ -2,3 +2,10 @@ from python_append import *
t=Test()
t.func()
t.static_func()
if grabpath() != os.path.dirname(mypath):
raise RuntimeError
if grabstaticpath() != os.path.basename(mypath):
raise RuntimeError

View file

@ -2,3 +2,6 @@ import python_varargs_typemap
if (python_varargs_typemap.testfunc(1, 2.0, "three") != "three") :
raise RuntimeError("testfunc failed!")
if (python_varargs_typemap.testfunc(1, 2.0, "three", "four", "five") != "threefourfive") :
raise RuntimeError("testfunc failed! {}")

View file

@ -5,12 +5,12 @@ if getconstTC().num != 33:
raise RuntimeError
# primitive reference variables
cvar.var_bool = createref_bool(0)
if value_bool(cvar.var_bool) != 0:
cvar.var_bool = createref_bool(False)
if value_bool(cvar.var_bool) != False:
raise RuntimeError
cvar.var_bool = createref_bool(1)
if value_bool(cvar.var_bool) != 1:
cvar.var_bool = createref_bool(True)
if value_bool(cvar.var_bool) != True:
raise RuntimeError
cvar.var_char = createref_char('w')

View file

@ -1,13 +1,16 @@
from rename_pcre_encoder import *
s = SomeWidget()
s.putBorderWidth(3)
if s.getBorderWidth() != 3:
raise RuntimeError("Border should be 3, not %d" % (s.getBorderWidth(),))
s.put_borderWidth(3)
if s.get_borderWidth() != 3:
raise RuntimeError("Border should be 3, not %d" % (s.get_borderWidth(),))
s.putSize(4, 5)
s.put_size(4, 5)
a = AnotherWidget()
a.DoSomething()
evt = wxEVTSomeEvent()
t = xUnchangedName()
if StartINSAneAndUNSAvoryTraNSAtlanticRaNSAck() != 42:
raise RuntimeError("Unexpected result of renamed function call")

View file

@ -0,0 +1,42 @@
from rename_predicates import *
r = RenamePredicates(123)
r.MF_member_function()
r.MF_static_member_function()
r.MF_extend_function_before()
r.MF_extend_function_after()
GF_global_function()
if r.MV_member_variable != 123:
raise RuntimeError("variable wrong")
r.MV_member_variable = 1234;
if r.MV_member_variable != 1234:
raise RuntimeError("variable wrong")
if cvar.RenamePredicates_MV_static_member_variable != 456:
raise RuntimeError("variable wrong")
cvar.RenamePredicates_MV_static_member_variable = 4567;
if cvar.RenamePredicates_MV_static_member_variable != 4567:
raise RuntimeError("variable wrong")
if cvar.GV_global_variable != 789:
raise RuntimeError("variable wrong")
cvar.GV_global_variable = 7890;
if cvar.GV_global_variable != 7890:
raise RuntimeError("variable wrong")
UC_UPPERCASE()
LC_lowercase()
TI_Title()
FU_FirstUpperCase()
FL_firstLowerCase()
CA_CamelCase()
LC_lowerCamelCase()
UC_under_case_it()
ex = ExtendCheck()
ex.MF_real_member1()
ex.MF_real_member2()
ex.EX_EXTENDMETHOD1()
ex.EX_EXTENDMETHOD2()
ex.EX_EXTENDMETHOD3()

View file

@ -9,6 +9,8 @@ if special_variable_macros.testJill(name) != "jilly":
raise "test failed"
if special_variable_macros.testMary(name) != "SWIGTYPE_p_NameWrap":
raise "test failed"
if special_variable_macros.testJames(name) != "SWIGTYPE_Name":
raise "test failed"
if special_variable_macros.testJim(name) != "multiname num":
raise "test failed"
if special_variable_macros.testJohn(special_variable_macros.PairIntBool(10, False)) != 123:

View file

@ -46,7 +46,7 @@ for i in range(0,len(m)):
if m[i][j] != im[i][j]:
raise RuntimeError, "bad getslice"
m = ((1,0,1),(1,1),(1,1))
m = ((True,False,True),(True,True),(True,True))
im = std_containers.midentb(m)
for i in range(0,len(m)):
for j in range(0,len(m[i])):

View file

@ -23,10 +23,12 @@ except RuntimeError,e:
try:
t.hosed()
except threads_exception.Exc,e:
if e.code != 42:
raise RuntimeError
if e.msg != "Hosed":
raise RuntimeError, "bad... msg: %s" % e.msg
code = e.code
if code != 42:
raise RuntimeError, "bad... code: %d" % code
msg = e.msg
if msg != "Hosed":
raise RuntimeError, "bad... msg: '%s' len: %d" % (msg, len(msg))
for i in range(1,4):
try:

View file

@ -0,0 +1,5 @@
import typedef_typedef
b = typedef_typedef.B()
if b.getValue(123) != 1234:
raise Exception("Failed")