Merge branch 'yazug-python_test_suite_pep8_whitespace_cleanup'
* yazug-python_test_suite_pep8_whitespace_cleanup: autopep8 cleanup of Examples/test-suite/python
This commit is contained in:
commit
2348d8377f
202 changed files with 3477 additions and 3382 deletions
|
|
@ -3,4 +3,3 @@ import abstract_access
|
||||||
d = abstract_access.D()
|
d = abstract_access.D()
|
||||||
if d.do_x() != 1:
|
if d.do_x() != 1:
|
||||||
raise RuntimeError
|
raise RuntimeError
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,3 @@
|
||||||
from abstract_typedef2 import *
|
from abstract_typedef2 import *
|
||||||
|
|
||||||
a = A_UF()
|
a = A_UF()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,3 @@ a = A()
|
||||||
|
|
||||||
if a.write(e) != 1:
|
if a.write(e) != 1:
|
||||||
raise RuntimeError
|
raise RuntimeError
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,5 +23,4 @@ if error:
|
||||||
raise RuntimeError("bad main typemap")
|
raise RuntimeError("bad main typemap")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
initializeApp(largs)
|
initializeApp(largs)
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,3 @@ cvar.global_data = f.data
|
||||||
for i in range(0, 8):
|
for i in range(0, 8):
|
||||||
if get_value(f.data, i) != get_value(cvar.global_data, i):
|
if get_value(f.data, i) != get_value(cvar.global_data, i):
|
||||||
raise RuntimeError, "Bad array assignment"
|
raise RuntimeError, "Bad array assignment"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,22 +1,27 @@
|
||||||
from autodoc import *
|
from autodoc import *
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
|
||||||
def check(got, expected, expected_builtin=None, skip=False):
|
def check(got, expected, expected_builtin=None, skip=False):
|
||||||
if not skip:
|
if not skip:
|
||||||
expect = expected
|
expect = expected
|
||||||
if is_python_builtin() and expected_builtin != None:
|
if is_python_builtin() and expected_builtin != None:
|
||||||
expect = expected_builtin
|
expect = expected_builtin
|
||||||
if expect != got:
|
if expect != got:
|
||||||
raise RuntimeError("\n" + "Expected: [" + str(expect) + "]\n" + "Got : [" + str(got) + "]")
|
raise RuntimeError(
|
||||||
|
"\n" + "Expected: [" + str(expect) + "]\n" + "Got : [" + str(got) + "]")
|
||||||
|
|
||||||
|
|
||||||
def is_new_style_class(cls):
|
def is_new_style_class(cls):
|
||||||
return hasattr(cls, "__class__")
|
return hasattr(cls, "__class__")
|
||||||
|
|
||||||
if not is_new_style_class(A):
|
if not is_new_style_class(A):
|
||||||
# Missing static methods make this hard to test... skip if -classic is used!
|
# Missing static methods make this hard to test... skip if -classic is
|
||||||
|
# used!
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
skip = True # skip builtin check - the autodoc is missing, but it probably should not be
|
# skip builtin check - the autodoc is missing, but it probably should not be
|
||||||
|
skip = True
|
||||||
|
|
||||||
check(A.__doc__, "Proxy of C++ A class", "::A")
|
check(A.__doc__, "Proxy of C++ A class", "::A")
|
||||||
check(A.funk.__doc__, "just a string")
|
check(A.funk.__doc__, "just a string")
|
||||||
|
|
@ -34,8 +39,7 @@ check(A.func2.__doc__,
|
||||||
" arg2: short\n"
|
" arg2: short\n"
|
||||||
" hello: int tuple[2]\n"
|
" hello: int tuple[2]\n"
|
||||||
"\n"
|
"\n"
|
||||||
" "
|
" ",
|
||||||
,
|
|
||||||
"\n"
|
"\n"
|
||||||
"func2(arg2, hello) -> int\n"
|
"func2(arg2, hello) -> int\n"
|
||||||
"\n"
|
"\n"
|
||||||
|
|
@ -53,8 +57,7 @@ check(A.func3.__doc__,
|
||||||
" arg2: short\n"
|
" arg2: short\n"
|
||||||
" hello: int tuple[2]\n"
|
" hello: int tuple[2]\n"
|
||||||
"\n"
|
"\n"
|
||||||
" "
|
" ",
|
||||||
,
|
|
||||||
"\n"
|
"\n"
|
||||||
"func3(short arg2, Tuple hello) -> int\n"
|
"func3(short arg2, Tuple hello) -> int\n"
|
||||||
"\n"
|
"\n"
|
||||||
|
|
@ -69,8 +72,7 @@ check(A.func0default.__doc__,
|
||||||
"\n"
|
"\n"
|
||||||
" func0default(self, e, arg3, hello, f=2) -> int\n"
|
" func0default(self, e, arg3, hello, f=2) -> int\n"
|
||||||
" func0default(self, e, arg3, hello) -> int\n"
|
" func0default(self, e, arg3, hello) -> int\n"
|
||||||
" "
|
" ",
|
||||||
,
|
|
||||||
"\n"
|
"\n"
|
||||||
"func0default(e, arg3, hello, f=2) -> int\n"
|
"func0default(e, arg3, hello, f=2) -> int\n"
|
||||||
"func0default(e, arg3, hello) -> int\n"
|
"func0default(e, arg3, hello) -> int\n"
|
||||||
|
|
@ -80,8 +82,7 @@ check(A.func1default.__doc__,
|
||||||
"\n"
|
"\n"
|
||||||
" func1default(A self, A e, short arg3, Tuple hello, double f=2) -> int\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"
|
" func1default(A self, A e, short arg3, Tuple hello) -> int\n"
|
||||||
" "
|
" ",
|
||||||
,
|
|
||||||
"\n"
|
"\n"
|
||||||
"func1default(A e, short arg3, Tuple hello, double f=2) -> int\n"
|
"func1default(A e, short arg3, Tuple hello, double f=2) -> int\n"
|
||||||
"func1default(A e, short arg3, Tuple hello) -> int\n"
|
"func1default(A e, short arg3, Tuple hello) -> int\n"
|
||||||
|
|
@ -104,8 +105,7 @@ check(A.func2default.__doc__,
|
||||||
" arg3: short\n"
|
" arg3: short\n"
|
||||||
" hello: int tuple[2]\n"
|
" hello: int tuple[2]\n"
|
||||||
"\n"
|
"\n"
|
||||||
" "
|
" ",
|
||||||
,
|
|
||||||
"\n"
|
"\n"
|
||||||
"func2default(e, arg3, hello, f=2) -> int\n"
|
"func2default(e, arg3, hello, f=2) -> int\n"
|
||||||
"\n"
|
"\n"
|
||||||
|
|
@ -141,8 +141,7 @@ check(A.func3default.__doc__,
|
||||||
" arg3: short\n"
|
" arg3: short\n"
|
||||||
" hello: int tuple[2]\n"
|
" hello: int tuple[2]\n"
|
||||||
"\n"
|
"\n"
|
||||||
" "
|
" ",
|
||||||
,
|
|
||||||
"\n"
|
"\n"
|
||||||
"func3default(A e, short arg3, Tuple hello, double f=2) -> int\n"
|
"func3default(A e, short arg3, Tuple hello, double f=2) -> int\n"
|
||||||
"\n"
|
"\n"
|
||||||
|
|
@ -166,8 +165,7 @@ check(A.func0static.__doc__,
|
||||||
"\n"
|
"\n"
|
||||||
" func0static(e, arg2, hello, f=2) -> int\n"
|
" func0static(e, arg2, hello, f=2) -> int\n"
|
||||||
" func0static(e, arg2, hello) -> int\n"
|
" func0static(e, arg2, hello) -> int\n"
|
||||||
" "
|
" ",
|
||||||
,
|
|
||||||
"\n"
|
"\n"
|
||||||
"func0static(e, arg2, hello, f=2) -> int\n"
|
"func0static(e, arg2, hello, f=2) -> int\n"
|
||||||
"func0static(e, arg2, hello) -> int\n"
|
"func0static(e, arg2, hello) -> int\n"
|
||||||
|
|
@ -177,8 +175,7 @@ check(A.func1static.__doc__,
|
||||||
"\n"
|
"\n"
|
||||||
" func1static(A e, short arg2, Tuple hello, double f=2) -> int\n"
|
" func1static(A e, short arg2, Tuple hello, double f=2) -> int\n"
|
||||||
" func1static(A e, short arg2, Tuple hello) -> int\n"
|
" func1static(A e, short arg2, Tuple hello) -> int\n"
|
||||||
" "
|
" ",
|
||||||
,
|
|
||||||
"\n"
|
"\n"
|
||||||
"func1static(A e, short arg2, Tuple hello, double f=2) -> int\n"
|
"func1static(A e, short arg2, Tuple hello, double f=2) -> int\n"
|
||||||
"func1static(A e, short arg2, Tuple hello) -> int\n"
|
"func1static(A e, short arg2, Tuple hello) -> int\n"
|
||||||
|
|
@ -201,8 +198,7 @@ check(A.func2static.__doc__,
|
||||||
" arg2: short\n"
|
" arg2: short\n"
|
||||||
" hello: int tuple[2]\n"
|
" hello: int tuple[2]\n"
|
||||||
"\n"
|
"\n"
|
||||||
" "
|
" ",
|
||||||
,
|
|
||||||
"\n"
|
"\n"
|
||||||
"func2static(e, arg2, hello, f=2) -> int\n"
|
"func2static(e, arg2, hello, f=2) -> int\n"
|
||||||
"\n"
|
"\n"
|
||||||
|
|
@ -238,8 +234,7 @@ check(A.func3static.__doc__,
|
||||||
" arg2: short\n"
|
" arg2: short\n"
|
||||||
" hello: int tuple[2]\n"
|
" hello: int tuple[2]\n"
|
||||||
"\n"
|
"\n"
|
||||||
" "
|
" ",
|
||||||
,
|
|
||||||
"\n"
|
"\n"
|
||||||
"func3static(A e, short arg2, Tuple hello, double f=2) -> int\n"
|
"func3static(A e, short arg2, Tuple hello, double f=2) -> int\n"
|
||||||
"\n"
|
"\n"
|
||||||
|
|
@ -275,8 +270,7 @@ if sys.version_info[0:2] > (2, 4):
|
||||||
"\n"
|
"\n"
|
||||||
"Parameters:\n"
|
"Parameters:\n"
|
||||||
" self: A *\n"
|
" self: A *\n"
|
||||||
"\n"
|
"\n",
|
||||||
,
|
|
||||||
"A.variable_c"
|
"A.variable_c"
|
||||||
)
|
)
|
||||||
check(A.variable_d.__doc__,
|
check(A.variable_d.__doc__,
|
||||||
|
|
@ -285,8 +279,7 @@ if sys.version_info[0:2] > (2, 4):
|
||||||
"\n"
|
"\n"
|
||||||
"Parameters:\n"
|
"Parameters:\n"
|
||||||
" self: A *\n"
|
" self: A *\n"
|
||||||
"\n"
|
"\n",
|
||||||
,
|
|
||||||
"A.variable_d"
|
"A.variable_d"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -295,7 +288,8 @@ check(B.__doc__,
|
||||||
"::B"
|
"::B"
|
||||||
)
|
)
|
||||||
check(C.__init__.__doc__, "__init__(self, a, b, h) -> C", None, skip)
|
check(C.__init__.__doc__, "__init__(self, a, b, h) -> C", None, skip)
|
||||||
check(D.__init__.__doc__, "__init__(D self, int a, int b, Hola h) -> D", None, skip)
|
check(D.__init__.__doc__,
|
||||||
|
"__init__(D self, int a, int b, Hola h) -> D", None, skip)
|
||||||
check(E.__init__.__doc__,
|
check(E.__init__.__doc__,
|
||||||
"\n"
|
"\n"
|
||||||
" __init__(self, a, b, h) -> E\n"
|
" __init__(self, a, b, h) -> E\n"
|
||||||
|
|
@ -305,8 +299,7 @@ check(E.__init__.__doc__,
|
||||||
" b: another special comment for parameter b\n"
|
" b: another special comment for parameter b\n"
|
||||||
" h: enum Hola\n"
|
" h: enum Hola\n"
|
||||||
"\n"
|
"\n"
|
||||||
" "
|
" ", None, skip
|
||||||
, None, skip
|
|
||||||
)
|
)
|
||||||
check(F.__init__.__doc__,
|
check(F.__init__.__doc__,
|
||||||
"\n"
|
"\n"
|
||||||
|
|
@ -317,8 +310,7 @@ check(F.__init__.__doc__,
|
||||||
" b: another special comment for parameter b\n"
|
" b: another special comment for parameter b\n"
|
||||||
" h: enum Hola\n"
|
" h: enum Hola\n"
|
||||||
"\n"
|
"\n"
|
||||||
" "
|
" ", None, skip
|
||||||
, None, skip
|
|
||||||
)
|
)
|
||||||
|
|
||||||
check(B.funk.__doc__,
|
check(B.funk.__doc__,
|
||||||
|
|
@ -329,8 +321,7 @@ check(funkdefaults.__doc__,
|
||||||
"\n"
|
"\n"
|
||||||
" funkdefaults(A e, short arg2, int c, int d, double f=2) -> int\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"
|
" funkdefaults(A e, short arg2, int c, int d) -> int\n"
|
||||||
" "
|
" ",
|
||||||
,
|
|
||||||
"\n"
|
"\n"
|
||||||
"funkdefaults(A e, short arg2, int c, int d, double f=2) -> int\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"
|
"funkdefaults(A e, short arg2, int c, int d) -> int\n"
|
||||||
|
|
|
||||||
|
|
@ -33,4 +33,3 @@ if cvar.var_namet != "hola":
|
||||||
raise RuntimeError, "bad pointer case"
|
raise RuntimeError, "bad pointer case"
|
||||||
|
|
||||||
delete_pchar(pc)
|
delete_pchar(pc)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,4 +17,3 @@ if defaults2.ret(10.0) != 10.0:
|
||||||
|
|
||||||
if defaults2.ret() != -1.0:
|
if defaults2.ret() != -1.0:
|
||||||
raise RuntimeError
|
raise RuntimeError
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,20 @@
|
||||||
import constant_directive
|
import constant_directive
|
||||||
|
|
||||||
if not isinstance(constant_directive.TYPE1_CONSTANT1, constant_directive.Type1):
|
if not isinstance(constant_directive.TYPE1_CONSTANT1, constant_directive.Type1):
|
||||||
raise RuntimeError("Failure: TYPE1_CONSTANT1 type: {}".format(type(constant_directive.TYPE1_CONSTANT1)))
|
raise RuntimeError("Failure: TYPE1_CONSTANT1 type: {}".format(
|
||||||
|
type(constant_directive.TYPE1_CONSTANT1)))
|
||||||
if not isinstance(constant_directive.getType1Instance(), constant_directive.Type1):
|
if not isinstance(constant_directive.getType1Instance(), constant_directive.Type1):
|
||||||
raise RuntimeError("Failure: getType1Instance() type: {}".format(type(constant_directive.getType1Instance())))
|
raise RuntimeError("Failure: getType1Instance() type: {}".format(
|
||||||
|
type(constant_directive.getType1Instance())))
|
||||||
|
|
||||||
if constant_directive.TYPE1_CONSTANT1.val != 1:
|
if constant_directive.TYPE1_CONSTANT1.val != 1:
|
||||||
raise RuntimeError("constant_directive.TYPE1_CONSTANT1.val is %r (should be 1)" % constant_directive.TYPE1_CONSTANT1.val)
|
raise RuntimeError("constant_directive.TYPE1_CONSTANT1.val is %r (should be 1)" %
|
||||||
|
constant_directive.TYPE1_CONSTANT1.val)
|
||||||
|
|
||||||
if constant_directive.TYPE1_CONSTANT2.val != 2:
|
if constant_directive.TYPE1_CONSTANT2.val != 2:
|
||||||
raise RuntimeError("constant_directive.TYPE1_CONSTANT2.val is %r (should be 2)" % constant_directive.TYPE1_CONSTANT2.val)
|
raise RuntimeError("constant_directive.TYPE1_CONSTANT2.val is %r (should be 2)" %
|
||||||
|
constant_directive.TYPE1_CONSTANT2.val)
|
||||||
|
|
||||||
if constant_directive.TYPE1_CONSTANT3.val != 3:
|
if constant_directive.TYPE1_CONSTANT3.val != 3:
|
||||||
raise RuntimeError("constant_directive.TYPE1_CONSTANT3.val is %r (should be 3)" % constant_directive.TYPE1_CONSTANT3.val)
|
raise RuntimeError("constant_directive.TYPE1_CONSTANT3.val is %r (should be 3)" %
|
||||||
|
constant_directive.TYPE1_CONSTANT3.val)
|
||||||
|
|
|
||||||
|
|
@ -34,5 +34,3 @@ if p != "test_pconstmethod":
|
||||||
error = 1
|
error = 1
|
||||||
|
|
||||||
sys.exit(error)
|
sys.exit(error)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
from constructor_copy import *
|
from constructor_copy import *
|
||||||
|
|
||||||
f1 = Foo1(3);
|
f1 = Foo1(3)
|
||||||
f11 = Foo1(f1);
|
f11 = Foo1(f1)
|
||||||
|
|
||||||
|
|
||||||
if f1.x != f11.x:
|
if f1.x != f11.x:
|
||||||
|
|
@ -35,4 +35,3 @@ except:
|
||||||
|
|
||||||
if not good:
|
if not good:
|
||||||
raise RuntimeError
|
raise RuntimeError
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -140,4 +140,3 @@ try:
|
||||||
print "Failed! constructor preassertion"
|
print "Failed! constructor preassertion"
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,10 +4,11 @@ a = cpp11_alternate_function_syntax.SomeStruct()
|
||||||
|
|
||||||
res = a.addNormal(4, 5)
|
res = a.addNormal(4, 5)
|
||||||
if res != 9:
|
if res != 9:
|
||||||
raise RuntimeError, ("SomeStruct::addNormal(4,5) returns ", res, " should be 9.")
|
raise RuntimeError, ("SomeStruct::addNormal(4,5) returns ",
|
||||||
|
res, " should be 9.")
|
||||||
|
|
||||||
|
|
||||||
res = a.addAlternate(4, 5)
|
res = a.addAlternate(4, 5)
|
||||||
if res != 9:
|
if res != 9:
|
||||||
raise RuntimeError, ("SomeStruct::addAlternate(4,5) returns ", res, " should be 9.")
|
raise RuntimeError, ("SomeStruct::addAlternate(4,5) returns ",
|
||||||
|
res, " should be 9.")
|
||||||
|
|
|
||||||
|
|
@ -16,4 +16,3 @@ if b != 10:
|
||||||
b = a.foo(6)
|
b = a.foo(6)
|
||||||
if b != 0:
|
if b != 0:
|
||||||
raise RuntimeError, "foo(6) should return 0."
|
raise RuntimeError, "foo(6) should return 0."
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,9 @@
|
||||||
import cpp11_function_objects
|
import cpp11_function_objects
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
|
||||||
class Test1(cpp11_function_objects.Test):
|
class Test1(cpp11_function_objects.Test):
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
cpp11_function_objects.Test.__init__(self)
|
cpp11_function_objects.Test.__init__(self)
|
||||||
|
|
||||||
|
|
@ -10,14 +12,17 @@ class Test1(cpp11_function_objects.Test):
|
||||||
|
|
||||||
t = cpp11_function_objects.Test()
|
t = cpp11_function_objects.Test()
|
||||||
if t.value != 0:
|
if t.value != 0:
|
||||||
raise RuntimeError("Runtime cpp11_function_objects failed. t.value should be 0, but is " + str(t.value))
|
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
|
t(1, 2) # adds numbers and sets value
|
||||||
|
|
||||||
if t.value != 3:
|
if t.value != 3:
|
||||||
raise RuntimeError("Runtime cpp11_function_objects failed. t.value not changed - should be 3, but is " + str(t.value))
|
raise RuntimeError(
|
||||||
|
"Runtime cpp11_function_objects failed. t.value not changed - should be 3, but is " + str(t.value))
|
||||||
|
|
||||||
t2 = Test1()
|
t2 = Test1()
|
||||||
a = cpp11_function_objects.testit1(t2, 4, 3)
|
a = cpp11_function_objects.testit1(t2, 4, 3)
|
||||||
if a != 12:
|
if a != 12:
|
||||||
raise RuntimeError("Runtime cpp11_function_objects failed. t.value not changed - should be 12, but is " + str(a))
|
raise RuntimeError(
|
||||||
|
"Runtime cpp11_function_objects failed. t.value not changed - should be 12, but is " + str(a))
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
import cpp11_initializer_list_extend
|
import cpp11_initializer_list_extend
|
||||||
|
|
||||||
c = cpp11_initializer_list_extend.Container([10, 20, 30, 40])
|
c = cpp11_initializer_list_extend.Container([10, 20, 30, 40])
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,4 +2,3 @@ import cpp11_initializer_list
|
||||||
|
|
||||||
a = cpp11_initializer_list.A()
|
a = cpp11_initializer_list.A()
|
||||||
a = cpp11_initializer_list.A(11.1)
|
a = cpp11_initializer_list.A(11.1)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,13 +3,15 @@ import cpp11_null_pointer_constant
|
||||||
a = cpp11_null_pointer_constant.A()
|
a = cpp11_null_pointer_constant.A()
|
||||||
|
|
||||||
if a._myA != None:
|
if a._myA != None:
|
||||||
raise RuntimeError, ("cpp11_null_pointer_constant: _myA should be None, but is ", a._myA)
|
raise RuntimeError, (
|
||||||
|
"cpp11_null_pointer_constant: _myA should be None, but is ", a._myA)
|
||||||
|
|
||||||
b = cpp11_null_pointer_constant.A()
|
b = cpp11_null_pointer_constant.A()
|
||||||
if a._myA != b._myA:
|
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)
|
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()
|
a._myA = cpp11_null_pointer_constant.A()
|
||||||
if a._myA == None:
|
if a._myA == None:
|
||||||
raise RuntimeError, ("cpp11_null_pointer_constant: _myA should be object, but is None")
|
raise RuntimeError, (
|
||||||
|
"cpp11_null_pointer_constant: _myA should be object, but is None")
|
||||||
|
|
|
||||||
|
|
@ -46,5 +46,3 @@ if cvar.ff != "I'm a \"raw wide\" \\ string.":
|
||||||
|
|
||||||
if cvar.gg != "I'm a \"raw UTF-8\" \\ string.":
|
if cvar.gg != "I'm a \"raw UTF-8\" \\ string.":
|
||||||
raise RuntimeError, cvar.gg
|
raise RuntimeError, cvar.gg
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,10 @@ import cpp11_result_of
|
||||||
|
|
||||||
result = cpp11_result_of.test_result(cpp11_result_of.SQUARE, 3.0)
|
result = cpp11_result_of.test_result(cpp11_result_of.SQUARE, 3.0)
|
||||||
if result != 9.0:
|
if result != 9.0:
|
||||||
raise RuntimeError, "test_result(square, 3.0) is not 9.0. Got: " + str(result)
|
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)
|
result = cpp11_result_of.test_result_alternative1(cpp11_result_of.SQUARE, 3.0)
|
||||||
if result != 9.0:
|
if result != 9.0:
|
||||||
raise RuntimeError, "test_result_alternative1(square, 3.0) is not 9.0. Got: " + str(result)
|
raise RuntimeError, "test_result_alternative1(square, 3.0) is not 9.0. Got: " + str(
|
||||||
|
result)
|
||||||
|
|
|
||||||
|
|
@ -4,21 +4,24 @@ a = cpp11_rvalue_reference.A()
|
||||||
|
|
||||||
a.setAcopy(5)
|
a.setAcopy(5)
|
||||||
if a.getAcopy() != 5:
|
if a.getAcopy() != 5:
|
||||||
raise RunTimeError, ("int A::getAcopy() value is ", a.getAcopy(), " should be 5")
|
raise RunTimeError, ("int A::getAcopy() value is ",
|
||||||
|
a.getAcopy(), " should be 5")
|
||||||
|
|
||||||
ptr = a.getAptr()
|
ptr = a.getAptr()
|
||||||
|
|
||||||
a.setAptr(ptr)
|
a.setAptr(ptr)
|
||||||
if a.getAcopy() != 5:
|
if a.getAcopy() != 5:
|
||||||
raise RunTimeError, ("after A::setAptr(): int A::getAcopy() value is ", a.getAcopy(), " should be 5")
|
raise RunTimeError, ("after A::setAptr(): int A::getAcopy() value is ", a.getAcopy(
|
||||||
|
), " should be 5")
|
||||||
|
|
||||||
a.setAref(ptr)
|
a.setAref(ptr)
|
||||||
if a.getAcopy() != 5:
|
if a.getAcopy() != 5:
|
||||||
raise RunTimeError, ("after A::setAref(): int A::getAcopy() value is ", a.getAcopy(), " should be 5")
|
raise RunTimeError, ("after A::setAref(): int A::getAcopy() value is ", a.getAcopy(
|
||||||
|
), " should be 5")
|
||||||
|
|
||||||
rvalueref = a.getAmove()
|
rvalueref = a.getAmove()
|
||||||
|
|
||||||
a.setAmove(rvalueref)
|
a.setAmove(rvalueref)
|
||||||
if a.getAcopy() != 5:
|
if a.getAcopy() != 5:
|
||||||
raise RunTimeError, ("after A::setAmove(): int A::getAcopy() value is ", a.getAcopy(), " should be 5")
|
raise RunTimeError, ("after A::setAmove(): int A::getAcopy() value is ", a.getAcopy(
|
||||||
|
), " should be 5")
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,10 @@
|
||||||
from cpp11_strongly_typed_enumerations import *
|
from cpp11_strongly_typed_enumerations import *
|
||||||
|
|
||||||
|
|
||||||
def enumCheck(actual, expected):
|
def enumCheck(actual, expected):
|
||||||
if actual != expected:
|
if actual != expected:
|
||||||
raise RuntimeError("Enum value mismatch. Expected " + str(expected) + " Actual: " + str(actual))
|
raise RuntimeError(
|
||||||
|
"Enum value mismatch. Expected " + str(expected) + " Actual: " + str(actual))
|
||||||
return expected + 1
|
return expected + 1
|
||||||
|
|
||||||
val = 0
|
val = 0
|
||||||
|
|
@ -161,4 +163,3 @@ enumCheck(class1.class1Test2(Class1.Enum12_Val5c), 1121)
|
||||||
enumCheck(globalTest1(Enum1_Val5a), 13)
|
enumCheck(globalTest1(Enum1_Val5a), 13)
|
||||||
enumCheck(globalTest2(Class1.Enum12_Val5c), 1121)
|
enumCheck(globalTest2(Class1.Enum12_Val5c), 1121)
|
||||||
#enumCheck(globalTest3(Class1.Struct1.Enum12_Val5f), 3121)
|
#enumCheck(globalTest3(Class1.Struct1.Enum12_Val5f), 3121)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -35,4 +35,3 @@ if cvar.ectval != -66:
|
||||||
cvar.ecpptval = -66
|
cvar.ecpptval = -66
|
||||||
if cvar.ecpptval != -66:
|
if cvar.ecpptval != -66:
|
||||||
raise RuntimeError
|
raise RuntimeError
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -41,5 +41,3 @@ if cpp_namespace.do_method3(t4,40) != "Test4::method":
|
||||||
|
|
||||||
if cpp_namespace.do_method3(t5, 40) != "Test5::method":
|
if cpp_namespace.do_method3(t5, 40) != "Test5::method":
|
||||||
raise RuntimeError("Bad return value!")
|
raise RuntimeError("Bad return value!")
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
#!/usr/bin/evn python
|
#!/usr/bin/evn python
|
||||||
from cpp_static import *
|
from cpp_static import *
|
||||||
|
|
||||||
|
|
||||||
def is_new_style_class(cls):
|
def is_new_style_class(cls):
|
||||||
return hasattr(cls, "__class__")
|
return hasattr(cls, "__class__")
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ if d.draw1() != 0:
|
||||||
if d.draw1(12) != 12:
|
if d.draw1(12) != 12:
|
||||||
raise RuntimeError
|
raise RuntimeError
|
||||||
|
|
||||||
p = createPtr(123);
|
p = createPtr(123)
|
||||||
if d.draw2() != 0:
|
if d.draw2() != 0:
|
||||||
raise RuntimeError
|
raise RuntimeError
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,11 @@
|
||||||
# Note that this test is also used by python_default_args_runme.py hence the use of __main__ and the run function
|
# Note that this test is also used by python_default_args_runme.py hence
|
||||||
|
# the use of __main__ and the run function
|
||||||
|
|
||||||
|
|
||||||
def is_new_style_class(cls):
|
def is_new_style_class(cls):
|
||||||
return hasattr(cls, "__class__")
|
return hasattr(cls, "__class__")
|
||||||
|
|
||||||
|
|
||||||
def run(module_name):
|
def run(module_name):
|
||||||
default_args = __import__(module_name)
|
default_args = __import__(module_name)
|
||||||
ec = default_args.EnumClass()
|
ec = default_args.EnumClass()
|
||||||
|
|
@ -25,7 +28,6 @@ def run(module_name):
|
||||||
if default_args.cfunc3(1) != 4:
|
if default_args.cfunc3(1) != 4:
|
||||||
raise RuntimeError
|
raise RuntimeError
|
||||||
|
|
||||||
|
|
||||||
f = default_args.Foo()
|
f = default_args.Foo()
|
||||||
|
|
||||||
f.newname()
|
f.newname()
|
||||||
|
|
@ -54,42 +56,48 @@ def run(module_name):
|
||||||
error = 1
|
error = 1
|
||||||
except:
|
except:
|
||||||
error = 0
|
error = 0
|
||||||
if error: raise RuntimeError("Foo::Foo ignore is not working")
|
if error:
|
||||||
|
raise RuntimeError("Foo::Foo ignore is not working")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
f = default_args.Foo(1, 2)
|
f = default_args.Foo(1, 2)
|
||||||
error = 1
|
error = 1
|
||||||
except:
|
except:
|
||||||
error = 0
|
error = 0
|
||||||
if error: raise RuntimeError("Foo::Foo ignore is not working")
|
if error:
|
||||||
|
raise RuntimeError("Foo::Foo ignore is not working")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
f = default_args.Foo(1, 2, 3)
|
f = default_args.Foo(1, 2, 3)
|
||||||
error = 1
|
error = 1
|
||||||
except:
|
except:
|
||||||
error = 0
|
error = 0
|
||||||
if error: raise RuntimeError("Foo::Foo ignore is not working")
|
if error:
|
||||||
|
raise RuntimeError("Foo::Foo ignore is not working")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
m = f.meth(1)
|
m = f.meth(1)
|
||||||
error = 1
|
error = 1
|
||||||
except:
|
except:
|
||||||
error = 0
|
error = 0
|
||||||
if error: raise RuntimeError("Foo::meth ignore is not working")
|
if error:
|
||||||
|
raise RuntimeError("Foo::meth ignore is not working")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
m = f.meth(1, 2)
|
m = f.meth(1, 2)
|
||||||
error = 1
|
error = 1
|
||||||
except:
|
except:
|
||||||
error = 0
|
error = 0
|
||||||
if error: raise RuntimeError("Foo::meth ignore is not working")
|
if error:
|
||||||
|
raise RuntimeError("Foo::meth ignore is not working")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
m = f.meth(1, 2, 3)
|
m = f.meth(1, 2, 3)
|
||||||
error = 1
|
error = 1
|
||||||
except:
|
except:
|
||||||
error = 0
|
error = 0
|
||||||
if error: raise RuntimeError("Foo::meth ignore is not working")
|
if error:
|
||||||
|
raise RuntimeError("Foo::meth ignore is not working")
|
||||||
|
|
||||||
if is_new_style_class(default_args.Klass):
|
if is_new_style_class(default_args.Klass):
|
||||||
Klass_inc = default_args.Klass.inc
|
Klass_inc = default_args.Klass.inc
|
||||||
|
|
@ -105,10 +113,14 @@ def run(module_name):
|
||||||
if Klass_inc().val != 0:
|
if Klass_inc().val != 0:
|
||||||
raise RuntimeError("Klass::inc failed")
|
raise RuntimeError("Klass::inc failed")
|
||||||
|
|
||||||
default_args.trickyvalue1(10); default_args.trickyvalue1(10, 10)
|
default_args.trickyvalue1(10)
|
||||||
default_args.trickyvalue2(10); default_args.trickyvalue2(10, 10)
|
default_args.trickyvalue1(10, 10)
|
||||||
default_args.trickyvalue3(10); default_args.trickyvalue3(10, 10)
|
default_args.trickyvalue2(10)
|
||||||
default_args.seek(); default_args.seek(10)
|
default_args.trickyvalue2(10, 10)
|
||||||
|
default_args.trickyvalue3(10)
|
||||||
|
default_args.trickyvalue3(10, 10)
|
||||||
|
default_args.seek()
|
||||||
|
default_args.seek(10)
|
||||||
|
|
||||||
if default_args.slightly_off_square(10) != 102:
|
if default_args.slightly_off_square(10) != 102:
|
||||||
raise RuntimeError
|
raise RuntimeError
|
||||||
|
|
@ -119,4 +131,3 @@ def run(module_name):
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
run('default_args')
|
run('default_args')
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ except:
|
||||||
del_b = dc.delete_B
|
del_b = dc.delete_B
|
||||||
|
|
||||||
try:
|
try:
|
||||||
bb = dc.new_BB();
|
bb = dc.new_BB()
|
||||||
print "Whoa. new_BB created."
|
print "Whoa. new_BB created."
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
@ -42,7 +42,7 @@ cc = dc.new_CC()
|
||||||
dc.delete_CC(cc)
|
dc.delete_CC(cc)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
d = dc.new_D();
|
d = dc.new_D()
|
||||||
print "Whoa. new_D created"
|
print "Whoa. new_D created"
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
@ -114,4 +114,3 @@ dc.delete_GG(gg)
|
||||||
|
|
||||||
import default_constructor
|
import default_constructor
|
||||||
hh = default_constructor.HH(1, 1)
|
hh = default_constructor.HH(1, 1)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,15 @@
|
||||||
import director_abstract
|
import director_abstract
|
||||||
|
|
||||||
|
|
||||||
def is_new_style_class(cls):
|
def is_new_style_class(cls):
|
||||||
return hasattr(cls, "__class__")
|
return hasattr(cls, "__class__")
|
||||||
|
|
||||||
|
|
||||||
class MyFoo(director_abstract.Foo):
|
class MyFoo(director_abstract.Foo):
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
director_abstract.Foo.__init__(self)
|
director_abstract.Foo.__init__(self)
|
||||||
|
|
||||||
def ping(self):
|
def ping(self):
|
||||||
return "MyFoo::ping()"
|
return "MyFoo::ping()"
|
||||||
|
|
||||||
|
|
@ -20,14 +24,19 @@ if a.pong() != "Foo::pong();MyFoo::ping()":
|
||||||
|
|
||||||
|
|
||||||
class MyExample1(director_abstract.Example1):
|
class MyExample1(director_abstract.Example1):
|
||||||
|
|
||||||
def Color(self, r, g, b):
|
def Color(self, r, g, b):
|
||||||
return r
|
return r
|
||||||
|
|
||||||
|
|
||||||
class MyExample2(director_abstract.Example2):
|
class MyExample2(director_abstract.Example2):
|
||||||
|
|
||||||
def Color(self, r, g, b):
|
def Color(self, r, g, b):
|
||||||
return g
|
return g
|
||||||
|
|
||||||
|
|
||||||
class MyExample3(director_abstract.Example3_i):
|
class MyExample3(director_abstract.Example3_i):
|
||||||
|
|
||||||
def Color(self, r, g, b):
|
def Color(self, r, g, b):
|
||||||
return b
|
return b
|
||||||
|
|
||||||
|
|
@ -56,21 +65,24 @@ try:
|
||||||
me1 = director_abstract.Example1()
|
me1 = director_abstract.Example1()
|
||||||
except:
|
except:
|
||||||
error = 0
|
error = 0
|
||||||
if (error): raise RuntimeError
|
if (error):
|
||||||
|
raise RuntimeError
|
||||||
|
|
||||||
error = 1
|
error = 1
|
||||||
try:
|
try:
|
||||||
me2 = director_abstract.Example2()
|
me2 = director_abstract.Example2()
|
||||||
except:
|
except:
|
||||||
error = 0
|
error = 0
|
||||||
if (error): raise RuntimeError
|
if (error):
|
||||||
|
raise RuntimeError
|
||||||
|
|
||||||
error = 1
|
error = 1
|
||||||
try:
|
try:
|
||||||
me3 = director_abstract.Example3_i()
|
me3 = director_abstract.Example3_i()
|
||||||
except:
|
except:
|
||||||
error = 0
|
error = 0
|
||||||
if (error): raise RuntimeError
|
if (error):
|
||||||
|
raise RuntimeError
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
import director_basic
|
import director_basic
|
||||||
|
|
||||||
|
|
||||||
class PyFoo(director_basic.Foo):
|
class PyFoo(director_basic.Foo):
|
||||||
|
|
||||||
def ping(self):
|
def ping(self):
|
||||||
return "PyFoo::ping()"
|
return "PyFoo::ping()"
|
||||||
|
|
||||||
|
|
@ -27,8 +29,8 @@ if a.rg(2) != 2:
|
||||||
raise RuntimeError
|
raise RuntimeError
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class PyClass(director_basic.MyClass):
|
class PyClass(director_basic.MyClass):
|
||||||
|
|
||||||
def method(self, vptr):
|
def method(self, vptr):
|
||||||
self.cmethod = 7
|
self.cmethod = 7
|
||||||
pass
|
pass
|
||||||
|
|
@ -60,19 +62,17 @@ if bd.x != 16:
|
||||||
raise RuntimeError
|
raise RuntimeError
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class PyMulti(director_basic.Foo, director_basic.MyClass):
|
class PyMulti(director_basic.Foo, director_basic.MyClass):
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
director_basic.Foo.__init__(self)
|
director_basic.Foo.__init__(self)
|
||||||
director_basic.MyClass.__init__(self)
|
director_basic.MyClass.__init__(self)
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
def vmethod(self, b):
|
def vmethod(self, b):
|
||||||
b.x = b.x + 31
|
b.x = b.x + 31
|
||||||
return b
|
return b
|
||||||
|
|
||||||
|
|
||||||
def ping(self):
|
def ping(self):
|
||||||
return "PyFoo::ping()"
|
return "PyFoo::ping()"
|
||||||
|
|
||||||
|
|
@ -83,16 +83,11 @@ for i in range(0,100):
|
||||||
del pymult
|
del pymult
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
pymult = PyMulti()
|
pymult = PyMulti()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
p1 = director_basic.Foo_get_self(pymult)
|
p1 = director_basic.Foo_get_self(pymult)
|
||||||
p2 = director_basic.MyClass_get_self(pymult)
|
p2 = director_basic.MyClass_get_self(pymult)
|
||||||
|
|
||||||
p1.ping()
|
p1.ping()
|
||||||
p2.vmethod(bc)
|
p2.vmethod(bc)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,53 +1,76 @@
|
||||||
from director_classic import *
|
from director_classic import *
|
||||||
|
|
||||||
|
|
||||||
class TargetLangPerson(Person):
|
class TargetLangPerson(Person):
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
Person.__init__(self)
|
Person.__init__(self)
|
||||||
|
|
||||||
def id(self):
|
def id(self):
|
||||||
identifier = "TargetLangPerson"
|
identifier = "TargetLangPerson"
|
||||||
return identifier
|
return identifier
|
||||||
|
|
||||||
|
|
||||||
class TargetLangChild(Child):
|
class TargetLangChild(Child):
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
Child.__init__(self)
|
Child.__init__(self)
|
||||||
|
|
||||||
def id(self):
|
def id(self):
|
||||||
identifier = "TargetLangChild"
|
identifier = "TargetLangChild"
|
||||||
return identifier
|
return identifier
|
||||||
|
|
||||||
|
|
||||||
class TargetLangGrandChild(GrandChild):
|
class TargetLangGrandChild(GrandChild):
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
GrandChild.__init__(self)
|
GrandChild.__init__(self)
|
||||||
|
|
||||||
def id(self):
|
def id(self):
|
||||||
identifier = "TargetLangGrandChild"
|
identifier = "TargetLangGrandChild"
|
||||||
return identifier
|
return identifier
|
||||||
|
|
||||||
# Semis - don't override id() in target language
|
# Semis - don't override id() in target language
|
||||||
|
|
||||||
|
|
||||||
class TargetLangSemiPerson(Person):
|
class TargetLangSemiPerson(Person):
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
Person.__init__(self)
|
Person.__init__(self)
|
||||||
# No id() override
|
# No id() override
|
||||||
|
|
||||||
|
|
||||||
class TargetLangSemiChild(Child):
|
class TargetLangSemiChild(Child):
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
Child.__init__(self)
|
Child.__init__(self)
|
||||||
# No id() override
|
# No id() override
|
||||||
|
|
||||||
|
|
||||||
class TargetLangSemiGrandChild(GrandChild):
|
class TargetLangSemiGrandChild(GrandChild):
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
GrandChild.__init__(self)
|
GrandChild.__init__(self)
|
||||||
# No id() override
|
# No id() override
|
||||||
|
|
||||||
# Orphans - don't override id() in C++
|
# Orphans - don't override id() in C++
|
||||||
|
|
||||||
|
|
||||||
class TargetLangOrphanPerson(OrphanPerson):
|
class TargetLangOrphanPerson(OrphanPerson):
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
OrphanPerson.__init__(self)
|
OrphanPerson.__init__(self)
|
||||||
|
|
||||||
def id(self):
|
def id(self):
|
||||||
identifier = "TargetLangOrphanPerson"
|
identifier = "TargetLangOrphanPerson"
|
||||||
return identifier
|
return identifier
|
||||||
|
|
||||||
|
|
||||||
class TargetLangOrphanChild(OrphanChild):
|
class TargetLangOrphanChild(OrphanChild):
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
Child.__init__(self)
|
Child.__init__(self)
|
||||||
|
|
||||||
def id(self):
|
def id(self):
|
||||||
identifier = "TargetLangOrphanChild"
|
identifier = "TargetLangOrphanChild"
|
||||||
return identifier
|
return identifier
|
||||||
|
|
@ -61,7 +84,8 @@ def check(person, expected):
|
||||||
if (debug):
|
if (debug):
|
||||||
print(ret)
|
print(ret)
|
||||||
if (ret != expected):
|
if (ret != expected):
|
||||||
raise RuntimeError("Failed. Received: " + str(ret) + " Expected: " + expected)
|
raise RuntimeError(
|
||||||
|
"Failed. Received: " + str(ret) + " Expected: " + expected)
|
||||||
|
|
||||||
# Polymorphic call from C++
|
# Polymorphic call from C++
|
||||||
caller = Caller()
|
caller = Caller()
|
||||||
|
|
@ -70,73 +94,74 @@ def check(person, expected):
|
||||||
if (debug):
|
if (debug):
|
||||||
print(ret)
|
print(ret)
|
||||||
if (ret != expected):
|
if (ret != expected):
|
||||||
raise RuntimeError("Failed. Received: " + str(ret) + " Expected: " + expected)
|
raise RuntimeError(
|
||||||
|
"Failed. Received: " + str(ret) + " Expected: " + expected)
|
||||||
|
|
||||||
# Polymorphic call of object created in target language and passed to C++ and back again
|
# Polymorphic call of object created in target language and passed to C++
|
||||||
|
# and back again
|
||||||
baseclass = caller.baseClass()
|
baseclass = caller.baseClass()
|
||||||
ret = baseclass.id()
|
ret = baseclass.id()
|
||||||
if (debug):
|
if (debug):
|
||||||
print(ret)
|
print(ret)
|
||||||
if (ret != expected):
|
if (ret != expected):
|
||||||
raise RuntimeError("Failed. Received: " + str(ret)+ " Expected: " + expected)
|
raise RuntimeError(
|
||||||
|
"Failed. Received: " + str(ret) + " Expected: " + expected)
|
||||||
|
|
||||||
caller.resetCallback()
|
caller.resetCallback()
|
||||||
if (debug):
|
if (debug):
|
||||||
print("----------------------------------------")
|
print("----------------------------------------")
|
||||||
|
|
||||||
|
|
||||||
|
person = Person()
|
||||||
person = Person();
|
check(person, "Person")
|
||||||
check(person, "Person");
|
|
||||||
del person
|
del person
|
||||||
|
|
||||||
person = Child();
|
person = Child()
|
||||||
check(person, "Child");
|
check(person, "Child")
|
||||||
del person
|
del person
|
||||||
|
|
||||||
person = GrandChild();
|
person = GrandChild()
|
||||||
check(person, "GrandChild");
|
check(person, "GrandChild")
|
||||||
del person
|
del person
|
||||||
|
|
||||||
person = TargetLangPerson();
|
person = TargetLangPerson()
|
||||||
check(person, "TargetLangPerson");
|
check(person, "TargetLangPerson")
|
||||||
del person
|
del person
|
||||||
|
|
||||||
person = TargetLangChild();
|
person = TargetLangChild()
|
||||||
check(person, "TargetLangChild");
|
check(person, "TargetLangChild")
|
||||||
del person
|
del person
|
||||||
|
|
||||||
person = TargetLangGrandChild();
|
person = TargetLangGrandChild()
|
||||||
check(person, "TargetLangGrandChild");
|
check(person, "TargetLangGrandChild")
|
||||||
del person
|
del person
|
||||||
|
|
||||||
# Semis - don't override id() in target language
|
# Semis - don't override id() in target language
|
||||||
person = TargetLangSemiPerson();
|
person = TargetLangSemiPerson()
|
||||||
check(person, "Person");
|
check(person, "Person")
|
||||||
del person
|
del person
|
||||||
|
|
||||||
person = TargetLangSemiChild();
|
person = TargetLangSemiChild()
|
||||||
check(person, "Child");
|
check(person, "Child")
|
||||||
del person
|
del person
|
||||||
|
|
||||||
person = TargetLangSemiGrandChild();
|
person = TargetLangSemiGrandChild()
|
||||||
check(person, "GrandChild");
|
check(person, "GrandChild")
|
||||||
del person
|
del person
|
||||||
|
|
||||||
# Orphans - don't override id() in C++
|
# Orphans - don't override id() in C++
|
||||||
person = OrphanPerson();
|
person = OrphanPerson()
|
||||||
check(person, "Person");
|
check(person, "Person")
|
||||||
del person
|
del person
|
||||||
|
|
||||||
person = OrphanChild();
|
person = OrphanChild()
|
||||||
check(person, "Child");
|
check(person, "Child")
|
||||||
del person
|
del person
|
||||||
|
|
||||||
person = TargetLangOrphanPerson();
|
person = TargetLangOrphanPerson()
|
||||||
check(person, "TargetLangOrphanPerson");
|
check(person, "TargetLangOrphanPerson")
|
||||||
del person
|
del person
|
||||||
|
|
||||||
person = TargetLangOrphanChild();
|
person = TargetLangOrphanChild()
|
||||||
check(person, "TargetLangOrphanChild");
|
check(person, "TargetLangOrphanChild")
|
||||||
del person
|
del person
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
import director_detect
|
import director_detect
|
||||||
|
|
||||||
|
|
||||||
class MyBar(director_detect.Bar):
|
class MyBar(director_detect.Bar):
|
||||||
|
|
||||||
def __init__(self, val=2):
|
def __init__(self, val=2):
|
||||||
director_detect.Bar.__init__(self)
|
director_detect.Bar.__init__(self)
|
||||||
self.val = val
|
self.val = val
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
import director_enum
|
import director_enum
|
||||||
|
|
||||||
|
|
||||||
class MyFoo(director_enum.Foo):
|
class MyFoo(director_enum.Foo):
|
||||||
|
|
||||||
def say_hi(self, val):
|
def say_hi(self, val):
|
||||||
return val
|
return val
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,19 +1,27 @@
|
||||||
from director_exception import *
|
from director_exception import *
|
||||||
|
|
||||||
|
|
||||||
class MyException(Exception):
|
class MyException(Exception):
|
||||||
|
|
||||||
def __init__(self, a, b):
|
def __init__(self, a, b):
|
||||||
self.msg = a + b
|
self.msg = a + b
|
||||||
|
|
||||||
|
|
||||||
class MyFoo(Foo):
|
class MyFoo(Foo):
|
||||||
|
|
||||||
def ping(self):
|
def ping(self):
|
||||||
raise NotImplementedError, "MyFoo::ping() EXCEPTION"
|
raise NotImplementedError, "MyFoo::ping() EXCEPTION"
|
||||||
|
|
||||||
|
|
||||||
class MyFoo2(Foo):
|
class MyFoo2(Foo):
|
||||||
|
|
||||||
def ping(self):
|
def ping(self):
|
||||||
return True
|
return True
|
||||||
pass # error: should return a string
|
pass # error: should return a string
|
||||||
|
|
||||||
|
|
||||||
class MyFoo3(Foo):
|
class MyFoo3(Foo):
|
||||||
|
|
||||||
def ping(self):
|
def ping(self):
|
||||||
raise MyException("foo", "bar")
|
raise MyException("foo", "bar")
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,9 @@
|
||||||
|
|
||||||
from director_extend import *
|
from director_extend import *
|
||||||
|
|
||||||
|
|
||||||
class MyObject(SpObject):
|
class MyObject(SpObject):
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
SpObject.__init__(self)
|
SpObject.__init__(self)
|
||||||
return
|
return
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,14 @@
|
||||||
from director_finalizer import *
|
from director_finalizer import *
|
||||||
|
|
||||||
|
|
||||||
class MyFoo(Foo):
|
class MyFoo(Foo):
|
||||||
|
|
||||||
def __del__(self):
|
def __del__(self):
|
||||||
self.orStatus(2)
|
self.orStatus(2)
|
||||||
try: Foo.__del__(self)
|
try:
|
||||||
except: pass
|
Foo.__del__(self)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
resetStatus()
|
resetStatus()
|
||||||
|
|
@ -45,4 +49,3 @@ if getStatus() != 3:
|
||||||
raise RuntimeError
|
raise RuntimeError
|
||||||
|
|
||||||
resetStatus()
|
resetStatus()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
from director_frob import *
|
from director_frob import *
|
||||||
|
|
||||||
foo = Bravo();
|
foo = Bravo()
|
||||||
s = foo.abs_method();
|
s = foo.abs_method()
|
||||||
|
|
||||||
if s != "Bravo::abs_method()":
|
if s != "Bravo::abs_method()":
|
||||||
raise RuntimeError, s
|
raise RuntimeError, s
|
||||||
|
|
|
||||||
|
|
@ -2,4 +2,3 @@ from director_keywords import *
|
||||||
|
|
||||||
f = Foo()
|
f = Foo()
|
||||||
f.check_self(20)
|
f.check_self(20)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ from director_nested import *
|
||||||
|
|
||||||
|
|
||||||
class A(FooBar_int):
|
class A(FooBar_int):
|
||||||
|
|
||||||
def do_step(self):
|
def do_step(self):
|
||||||
return "A::do_step;"
|
return "A::do_step;"
|
||||||
|
|
||||||
|
|
@ -17,6 +18,7 @@ if a.step() != "Bar::step;Foo::advance;Bar::do_advance;A::do_step;":
|
||||||
|
|
||||||
|
|
||||||
class B(FooBar_int):
|
class B(FooBar_int):
|
||||||
|
|
||||||
def do_advance(self):
|
def do_advance(self):
|
||||||
return "B::do_advance;" + self.do_step()
|
return "B::do_advance;" + self.do_step()
|
||||||
|
|
||||||
|
|
@ -35,8 +37,8 @@ if b.step() != "Bar::step;Foo::advance;B::do_advance;B::do_step;":
|
||||||
raise RuntimeError, "Bad B virtual resolution"
|
raise RuntimeError, "Bad B virtual resolution"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class C(FooBar_int):
|
class C(FooBar_int):
|
||||||
|
|
||||||
def do_advance(self):
|
def do_advance(self):
|
||||||
return "C::do_advance;" + FooBar_int.do_advance(self)
|
return "C::do_advance;" + FooBar_int.do_advance(self)
|
||||||
|
|
||||||
|
|
@ -49,7 +51,6 @@ class C(FooBar_int):
|
||||||
def get_name(self):
|
def get_name(self):
|
||||||
return FooBar_int.get_name(self) + " hello"
|
return FooBar_int.get_name(self) + " hello"
|
||||||
|
|
||||||
|
|
||||||
pass
|
pass
|
||||||
|
|
||||||
cc = C()
|
cc = C()
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,12 @@
|
||||||
import director_profile
|
import director_profile
|
||||||
|
|
||||||
|
|
||||||
class MyB(director_profile.B):
|
class MyB(director_profile.B):
|
||||||
|
|
||||||
def vfi(self, a):
|
def vfi(self, a):
|
||||||
return a + 3
|
return a + 3
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
a = director_profile.A()
|
a = director_profile.A()
|
||||||
myb = MyB()
|
myb = MyB()
|
||||||
b = director_profile.B.get_self(myb)
|
b = director_profile.B.get_self(myb)
|
||||||
|
|
@ -38,4 +39,3 @@ while i:
|
||||||
i -= 1
|
i -= 1
|
||||||
|
|
||||||
print a
|
print a
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
import director_property
|
import director_property
|
||||||
|
|
||||||
|
|
||||||
class PyFoo(director_property.Foo):
|
class PyFoo(director_property.Foo):
|
||||||
a = property(director_property.Foo.getA, director_property.Foo.setA)
|
a = property(director_property.Foo.getA, director_property.Foo.setA)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,23 @@
|
||||||
from director_protected import *
|
from director_protected import *
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class FooBar(Bar):
|
class FooBar(Bar):
|
||||||
|
|
||||||
def ping(self):
|
def ping(self):
|
||||||
return "FooBar::ping();"
|
return "FooBar::ping();"
|
||||||
|
|
||||||
|
|
||||||
class FooBar2(Bar):
|
class FooBar2(Bar):
|
||||||
|
|
||||||
def ping(self):
|
def ping(self):
|
||||||
return "FooBar2::ping();"
|
return "FooBar2::ping();"
|
||||||
|
|
||||||
def pang(self):
|
def pang(self):
|
||||||
return "FooBar2::pang();"
|
return "FooBar2::pang();"
|
||||||
|
|
||||||
|
|
||||||
class FooBar3(Bar):
|
class FooBar3(Bar):
|
||||||
|
|
||||||
def cheer(self):
|
def cheer(self):
|
||||||
return "FooBar3::cheer();"
|
return "FooBar3::cheer();"
|
||||||
|
|
||||||
|
|
@ -125,5 +130,3 @@ if fb3.callping() != "Bar::ping();":
|
||||||
|
|
||||||
if fb3.callcheer() != "FooBar3::cheer();":
|
if fb3.callcheer() != "FooBar3::cheer();":
|
||||||
raise RuntimeError, "bad fb3.callcheer"
|
raise RuntimeError, "bad fb3.callcheer"
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
import director_stl
|
import director_stl
|
||||||
|
|
||||||
|
|
||||||
class MyFoo(director_stl.Foo):
|
class MyFoo(director_stl.Foo):
|
||||||
|
|
||||||
def ping(self, s):
|
def ping(self, s):
|
||||||
return "MyFoo::ping():" + s
|
return "MyFoo::ping():" + s
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
from director_string import *
|
from director_string import *
|
||||||
|
|
||||||
|
|
||||||
class B(A):
|
class B(A):
|
||||||
|
|
||||||
def __init__(self, string):
|
def __init__(self, string):
|
||||||
A.__init__(self, string)
|
A.__init__(self, string)
|
||||||
|
|
||||||
|
|
@ -12,7 +14,6 @@ class B(A):
|
||||||
self.smem = "hello"
|
self.smem = "hello"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
b = B("hello")
|
b = B("hello")
|
||||||
|
|
||||||
b.get(0)
|
b.get(0)
|
||||||
|
|
@ -26,4 +27,3 @@ b.call_process_func()
|
||||||
if b.smem != "hello":
|
if b.smem != "hello":
|
||||||
print smem
|
print smem
|
||||||
raise RuntimeError
|
raise RuntimeError
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
from director_thread import Foo
|
from director_thread import Foo
|
||||||
|
|
||||||
|
|
||||||
class Derived(Foo):
|
class Derived(Foo):
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
Foo.__init__(self)
|
Foo.__init__(self)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
import director_unroll
|
import director_unroll
|
||||||
|
|
||||||
|
|
||||||
class MyFoo(director_unroll.Foo):
|
class MyFoo(director_unroll.Foo):
|
||||||
|
|
||||||
def ping(self):
|
def ping(self):
|
||||||
return "MyFoo::ping()"
|
return "MyFoo::ping()"
|
||||||
|
|
||||||
|
|
@ -16,4 +18,3 @@ c = b.get()
|
||||||
if not (a.this == c.this):
|
if not (a.this == c.this):
|
||||||
print a, c
|
print a, c
|
||||||
raise RuntimeError
|
raise RuntimeError
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
from director_wstring import *
|
from director_wstring import *
|
||||||
|
|
||||||
|
|
||||||
class B(A):
|
class B(A):
|
||||||
|
|
||||||
def __init__(self, string):
|
def __init__(self, string):
|
||||||
A.__init__(self, string)
|
A.__init__(self, string)
|
||||||
|
|
||||||
|
|
@ -11,7 +13,6 @@ class B(A):
|
||||||
self.smem = u"hello"
|
self.smem = u"hello"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
b = B(u"hello")
|
b = B(u"hello")
|
||||||
|
|
||||||
b.get(0)
|
b.get(0)
|
||||||
|
|
@ -25,4 +26,3 @@ b.call_process_func()
|
||||||
if b.smem != u"hello":
|
if b.smem != u"hello":
|
||||||
print smem
|
print smem
|
||||||
raise RuntimeError
|
raise RuntimeError
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,4 +9,3 @@ y = b.blah()
|
||||||
a = dynamic_cast.do_test(y)
|
a = dynamic_cast.do_test(y)
|
||||||
if a != "Bar::test":
|
if a != "Bar::test":
|
||||||
print "Failed!!"
|
print "Failed!!"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
import enum_forward
|
import enum_forward
|
||||||
|
|
||||||
f1 = enum_forward.get_enum1();
|
f1 = enum_forward.get_enum1()
|
||||||
f1 = enum_forward.test_function1(f1);
|
f1 = enum_forward.test_function1(f1)
|
||||||
|
|
||||||
f2 = enum_forward.get_enum2();
|
f2 = enum_forward.get_enum2()
|
||||||
f2 = enum_forward.test_function2(f2);
|
f2 = enum_forward.test_function2(f2)
|
||||||
|
|
||||||
f3 = enum_forward.get_enum3();
|
f3 = enum_forward.get_enum3()
|
||||||
f3 = enum_forward.test_function3(f3);
|
f3 = enum_forward.test_function3(f3)
|
||||||
|
|
|
||||||
|
|
@ -4,4 +4,3 @@ if enum_template.MakeETest() != 1:
|
||||||
|
|
||||||
if enum_template.TakeETest(0) != None:
|
if enum_template.TakeETest(0) != None:
|
||||||
raise RuntimeError
|
raise RuntimeError
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,4 +16,3 @@ if _enums.cvar.Mine != 11:
|
||||||
|
|
||||||
if _enums.cvar.Thigh != 12:
|
if _enums.cvar.Thigh != 12:
|
||||||
raise RuntimeError
|
raise RuntimeError
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,6 @@ except RuntimeError,e:
|
||||||
raise RuntimeError, e.args
|
raise RuntimeError, e.args
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
a.barfoo(1)
|
a.barfoo(1)
|
||||||
except E1, e:
|
except E1, e:
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
import extern_c
|
import extern_c
|
||||||
|
|
||||||
extern_c.RealFunction(2)
|
extern_c.RealFunction(2)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,27 +2,36 @@ import friends
|
||||||
|
|
||||||
a = friends.A(2)
|
a = friends.A(2)
|
||||||
|
|
||||||
if friends.get_val1(a) != 2: raise RuntimeError
|
if friends.get_val1(a) != 2:
|
||||||
if friends.get_val2(a) != 4: raise RuntimeError
|
raise RuntimeError
|
||||||
if friends.get_val3(a) != 6: raise RuntimeError
|
if friends.get_val2(a) != 4:
|
||||||
|
raise RuntimeError
|
||||||
|
if friends.get_val3(a) != 6:
|
||||||
|
raise RuntimeError
|
||||||
|
|
||||||
# nice overload working fine
|
# nice overload working fine
|
||||||
if friends.get_val1(1,2,3) != 1: raise RuntimeError
|
if friends.get_val1(1, 2, 3) != 1:
|
||||||
|
raise RuntimeError
|
||||||
|
|
||||||
b = friends.B(3)
|
b = friends.B(3)
|
||||||
|
|
||||||
# David's case
|
# David's case
|
||||||
if friends.mix(a,b) != 5: raise RuntimeError
|
if friends.mix(a, b) != 5:
|
||||||
|
raise RuntimeError
|
||||||
|
|
||||||
di = friends.D_d(2)
|
di = friends.D_d(2)
|
||||||
dd = friends.D_d(3.3)
|
dd = friends.D_d(3.3)
|
||||||
|
|
||||||
# incredible template overloading working just fine
|
# incredible template overloading working just fine
|
||||||
if friends.get_val1(di) != 2: raise RuntimeError
|
if friends.get_val1(di) != 2:
|
||||||
if friends.get_val1(dd) != 3.3: raise RuntimeError
|
raise RuntimeError
|
||||||
|
if friends.get_val1(dd) != 3.3:
|
||||||
|
raise RuntimeError
|
||||||
|
|
||||||
friends.set(di, 4)
|
friends.set(di, 4)
|
||||||
friends.set(dd, 1.3)
|
friends.set(dd, 1.3)
|
||||||
|
|
||||||
if friends.get_val1(di) != 4: raise RuntimeError
|
if friends.get_val1(di) != 4:
|
||||||
if friends.get_val1(dd) != 1.3: raise RuntimeError
|
raise RuntimeError
|
||||||
|
if friends.get_val1(dd) != 1.3:
|
||||||
|
raise RuntimeError
|
||||||
|
|
|
||||||
|
|
@ -6,4 +6,3 @@ if call2(ADD_BY_POINTER, 12, 13) != 25:
|
||||||
raise RuntimeError
|
raise RuntimeError
|
||||||
if call3(ADD_BY_REFERENCE, 14, 15) != 29:
|
if call3(ADD_BY_REFERENCE, 14, 15) != 29:
|
||||||
raise RuntimeError
|
raise RuntimeError
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,7 @@ from fvirtual import *
|
||||||
|
|
||||||
sw = NodeSwitch()
|
sw = NodeSwitch()
|
||||||
n = Node()
|
n = Node()
|
||||||
i = sw.addChild(n);
|
i = sw.addChild(n)
|
||||||
|
|
||||||
if i != 2:
|
if i != 2:
|
||||||
raise RuntimeError, "addChild"
|
raise RuntimeError, "addChild"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
from global_functions import *
|
from global_functions import *
|
||||||
|
|
||||||
|
|
||||||
def check(a, b):
|
def check(a, b):
|
||||||
if a != b:
|
if a != b:
|
||||||
raise RuntimeError("Failed: " + str(a) + " != " + str(b))
|
raise RuntimeError("Failed: " + str(a) + " != " + str(b))
|
||||||
|
|
@ -49,4 +50,3 @@ except TypeError, e:
|
||||||
|
|
||||||
if fail:
|
if fail:
|
||||||
raise RuntimeError("argument count check failed")
|
raise RuntimeError("argument count check failed")
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
from global_namespace import *
|
from global_namespace import *
|
||||||
|
|
||||||
|
|
||||||
def is_new_style_class(cls):
|
def is_new_style_class(cls):
|
||||||
return hasattr(cls, "__class__")
|
return hasattr(cls, "__class__")
|
||||||
|
|
||||||
|
|
@ -44,8 +45,10 @@ if is_new_style_class(XYZMethods):
|
||||||
XYZMethods_static = XYZMethods
|
XYZMethods_static = XYZMethods
|
||||||
else:
|
else:
|
||||||
XYZMethods_static = XYZMethods()
|
XYZMethods_static = XYZMethods()
|
||||||
XYZMethods_static.methodA(XYZ1(), XYZ2(), XYZ3(), XYZ4(), XYZ5(), XYZ6(), XYZ7())
|
XYZMethods_static.methodA(
|
||||||
XYZMethods_static.methodB(XYZ1(), XYZ2(), XYZ3(), XYZ4(), XYZ5(), XYZ6(), XYZ7())
|
XYZ1(), XYZ2(), XYZ3(), XYZ4(), XYZ5(), XYZ6(), XYZ7())
|
||||||
|
XYZMethods_static.methodB(
|
||||||
|
XYZ1(), XYZ2(), XYZ3(), XYZ4(), XYZ5(), XYZ6(), XYZ7())
|
||||||
|
|
||||||
if is_new_style_class(TheEnumMethods):
|
if is_new_style_class(TheEnumMethods):
|
||||||
TheEnumMethods_static = TheEnumMethods
|
TheEnumMethods_static = TheEnumMethods
|
||||||
|
|
|
||||||
|
|
@ -2,4 +2,3 @@ from global_ns_arg import *
|
||||||
|
|
||||||
a = foo(1)
|
a = foo(1)
|
||||||
b = bar_fn()
|
b = bar_fn()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -32,4 +32,3 @@ except AttributeError, e:
|
||||||
fail = False
|
fail = False
|
||||||
if fail:
|
if fail:
|
||||||
raise RuntimeError("AttributeError should have been thrown")
|
raise RuntimeError("AttributeError should have been thrown")
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,11 @@
|
||||||
from implicittest import *
|
from implicittest import *
|
||||||
|
|
||||||
|
|
||||||
def check(a, b):
|
def check(a, b):
|
||||||
if a != b:
|
if a != b:
|
||||||
raise RuntimeError(str(a) + " does not equal " + str(b))
|
raise RuntimeError(str(a) + " does not equal " + str(b))
|
||||||
|
|
||||||
|
|
||||||
def is_new_style_class(cls):
|
def is_new_style_class(cls):
|
||||||
return hasattr(cls, "__class__")
|
return hasattr(cls, "__class__")
|
||||||
|
|
||||||
|
|
@ -20,7 +22,8 @@ try:
|
||||||
except ValueError:
|
except ValueError:
|
||||||
# ValueError: invalid null reference in method 'new_A', argument 1 of type 'B const &'
|
# 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,
|
# 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.
|
# references and pointers to different types, where pointers ought to be
|
||||||
|
# given a slightly higher precedence.
|
||||||
pass
|
pass
|
||||||
|
|
||||||
check(1, get(1))
|
check(1, get(1))
|
||||||
|
|
@ -59,10 +62,14 @@ except TypeError:
|
||||||
|
|
||||||
#### Global variable assignment ####
|
#### Global variable assignment ####
|
||||||
|
|
||||||
cvar.foo = Foo(1); check(cvar.foo.ii, 1)
|
cvar.foo = Foo(1)
|
||||||
cvar.foo = 1; check(cvar.foo.ii, 1)
|
check(cvar.foo.ii, 1)
|
||||||
cvar.foo = 1.0; check(cvar.foo.ii, 2)
|
cvar.foo = 1
|
||||||
cvar.foo = Foo("hello"); check(cvar.foo.ii, 3)
|
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:
|
# explicit constructor:
|
||||||
try:
|
try:
|
||||||
|
|
@ -74,10 +81,14 @@ except TypeError:
|
||||||
#### Member variable assignment ####
|
#### Member variable assignment ####
|
||||||
# Note: also needs naturalvar
|
# Note: also needs naturalvar
|
||||||
|
|
||||||
b = Bar(); check(b.f.ii, 0)
|
b = Bar()
|
||||||
b.f = Foo("hello"); check(b.f.ii, 3)
|
check(b.f.ii, 0)
|
||||||
b.f = 1; check(b.f.ii, 1)
|
b.f = Foo("hello")
|
||||||
b.f = 1.0; check(b.f.ii, 2)
|
check(b.f.ii, 3)
|
||||||
|
b.f = 1
|
||||||
|
check(b.f.ii, 1)
|
||||||
|
b.f = 1.0
|
||||||
|
check(b.f.ii, 2)
|
||||||
|
|
||||||
# explicit constructor:
|
# explicit constructor:
|
||||||
try:
|
try:
|
||||||
|
|
@ -129,4 +140,3 @@ ccc = CCC(B())
|
||||||
check(ccc.checkvalue, 10)
|
check(ccc.checkvalue, 10)
|
||||||
check(ccc.xx(123), 11)
|
check(ccc.xx(123), 11)
|
||||||
check(ccc.yy(123, 123), 111)
|
check(ccc.yy(123, 123), 111)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,4 +4,3 @@ import import_stl_a
|
||||||
v_new = import_stl_b.process_vector([1, 2, 3])
|
v_new = import_stl_b.process_vector([1, 2, 3])
|
||||||
if v_new != (1, 2, 3, 4):
|
if v_new != (1, 2, 3, 4):
|
||||||
raise RuntimeError, v_new
|
raise RuntimeError, v_new
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,4 +29,3 @@ if inctest.importtest1(5) != 15:
|
||||||
if inctest.importtest2("black") != "white":
|
if inctest.importtest2("black") != "white":
|
||||||
print "import test 2 failed"
|
print "import test 2 failed"
|
||||||
raise RuntimeError
|
raise RuntimeError
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,4 +19,3 @@ if a != [(2,2),2]:
|
||||||
a = inout.AddOne3p(1, (1, 1), 1)
|
a = inout.AddOne3p(1, (1, 1), 1)
|
||||||
if a != [2, (2, 2), 2]:
|
if a != [2, (2, 2), 2]:
|
||||||
raise RuntimeError
|
raise RuntimeError
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,12 @@
|
||||||
from kwargs_feature import *
|
from kwargs_feature import *
|
||||||
|
|
||||||
|
|
||||||
class MyFoo(Foo):
|
class MyFoo(Foo):
|
||||||
|
|
||||||
def __init__(self, a, b=0):
|
def __init__(self, a, b=0):
|
||||||
Foo.__init__(self, a, b)
|
Foo.__init__(self, a, b)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Simple class
|
# Simple class
|
||||||
f1 = MyFoo(2)
|
f1 = MyFoo(2)
|
||||||
|
|
||||||
|
|
@ -78,4 +79,3 @@ if rfoo(n=11, x=22) != -11:
|
||||||
|
|
||||||
if rfoo(x=11, n=22) != 11:
|
if rfoo(x=11, n=22) != 11:
|
||||||
raise RuntimeError
|
raise RuntimeError
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -71,4 +71,3 @@ if myStringyClass.ReadWriteString != "changed string":
|
||||||
raise RuntimeError
|
raise RuntimeError
|
||||||
if myStringyClass.ReadOnlyString != "changed string":
|
if myStringyClass.ReadOnlyString != "changed string":
|
||||||
raise RuntimeError
|
raise RuntimeError
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,25 +4,26 @@ import li_attribute_template
|
||||||
|
|
||||||
chell = li_attribute_template.Cintint(1, 2, 3)
|
chell = li_attribute_template.Cintint(1, 2, 3)
|
||||||
|
|
||||||
|
|
||||||
def rassert(what, master):
|
def rassert(what, master):
|
||||||
if what != master:
|
if what != master:
|
||||||
print what
|
print what
|
||||||
raise RuntimeError
|
raise RuntimeError
|
||||||
|
|
||||||
## Testing primitive by value attribute
|
# Testing primitive by value attribute
|
||||||
rassert(chell.a, 1)
|
rassert(chell.a, 1)
|
||||||
|
|
||||||
chell.a = 3
|
chell.a = 3
|
||||||
rassert(chell.a, 3)
|
rassert(chell.a, 3)
|
||||||
|
|
||||||
## Testing primitive by ref attribute
|
# Testing primitive by ref attribute
|
||||||
|
|
||||||
rassert(chell.b, 2)
|
rassert(chell.b, 2)
|
||||||
|
|
||||||
chell.b = 5
|
chell.b = 5
|
||||||
rassert(chell.b, 5)
|
rassert(chell.b, 5)
|
||||||
|
|
||||||
## Testing string
|
# Testing string
|
||||||
chell.str = "abc"
|
chell.str = "abc"
|
||||||
rassert(chell.str, "abc")
|
rassert(chell.str, "abc")
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,10 @@
|
||||||
from li_boost_shared_ptr_bits import *
|
from li_boost_shared_ptr_bits import *
|
||||||
|
|
||||||
|
|
||||||
def is_new_style_class(cls):
|
def is_new_style_class(cls):
|
||||||
return hasattr(cls, "__class__")
|
return hasattr(cls, "__class__")
|
||||||
|
|
||||||
|
|
||||||
def check(nd):
|
def check(nd):
|
||||||
nd.i = 200
|
nd.i = 200
|
||||||
i = nd.i
|
i = nd.i
|
||||||
|
|
@ -37,4 +39,3 @@ if is_new_style_class(HiddenDestructor):
|
||||||
p = HiddenDestructor.create()
|
p = HiddenDestructor.create()
|
||||||
else:
|
else:
|
||||||
p = HiddenDestructor_create()
|
p = HiddenDestructor_create()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,10 @@ import gc
|
||||||
debug = False
|
debug = False
|
||||||
|
|
||||||
# simple shared_ptr usage - created in C++
|
# simple shared_ptr usage - created in C++
|
||||||
|
|
||||||
|
|
||||||
class li_boost_shared_ptr_runme:
|
class li_boost_shared_ptr_runme:
|
||||||
|
|
||||||
def main(self):
|
def main(self):
|
||||||
if (debug):
|
if (debug):
|
||||||
print "Started"
|
print "Started"
|
||||||
|
|
@ -18,13 +21,15 @@ class li_boost_shared_ptr_runme:
|
||||||
|
|
||||||
# Expect 1 instance - the one global variable (GlobalValue)
|
# Expect 1 instance - the one global variable (GlobalValue)
|
||||||
if (li_boost_shared_ptr.Klass_getTotal_count() != 1):
|
if (li_boost_shared_ptr.Klass_getTotal_count() != 1):
|
||||||
raise RuntimeError("Klass.total_count=%s" % li_boost_shared_ptr.Klass.getTotal_count())
|
raise RuntimeError("Klass.total_count=%s" %
|
||||||
|
li_boost_shared_ptr.Klass.getTotal_count())
|
||||||
|
|
||||||
wrapper_count = li_boost_shared_ptr.shared_ptr_wrapper_count()
|
wrapper_count = li_boost_shared_ptr.shared_ptr_wrapper_count()
|
||||||
if (wrapper_count != li_boost_shared_ptr.NOT_COUNTING):
|
if (wrapper_count != li_boost_shared_ptr.NOT_COUNTING):
|
||||||
# Expect 1 instance - the one global variable (GlobalSmartValue)
|
# Expect 1 instance - the one global variable (GlobalSmartValue)
|
||||||
if (wrapper_count != 1):
|
if (wrapper_count != 1):
|
||||||
raise RuntimeError("shared_ptr wrapper count=%s" % wrapper_count)
|
raise RuntimeError(
|
||||||
|
"shared_ptr wrapper count=%s" % wrapper_count)
|
||||||
|
|
||||||
if (debug):
|
if (debug):
|
||||||
print "Finished"
|
print "Finished"
|
||||||
|
|
@ -173,7 +178,7 @@ class li_boost_shared_ptr_runme:
|
||||||
self.verifyValue("smartpointerpointerownertest", val)
|
self.verifyValue("smartpointerpointerownertest", val)
|
||||||
self.verifyCount(1, k)
|
self.verifyCount(1, k)
|
||||||
|
|
||||||
# //////////////////////////////// Derived class ////////////////////////////////////////
|
# //////////////////////////////// Derived class //////////////////////
|
||||||
# derived pass by shared_ptr
|
# derived pass by shared_ptr
|
||||||
k = li_boost_shared_ptr.KlassDerived("me oh my")
|
k = li_boost_shared_ptr.KlassDerived("me oh my")
|
||||||
kret = li_boost_shared_ptr.derivedsmartptrtest(k)
|
kret = li_boost_shared_ptr.derivedsmartptrtest(k)
|
||||||
|
|
@ -222,7 +227,7 @@ class li_boost_shared_ptr_runme:
|
||||||
self.verifyCount(1, k)
|
self.verifyCount(1, k)
|
||||||
self.verifyCount(1, kret)
|
self.verifyCount(1, kret)
|
||||||
|
|
||||||
# //////////////////////////////// Derived and base class mixed ////////////////////////////////////////
|
# //////////////////////////////// Derived and base class mixed ///////
|
||||||
# pass by shared_ptr (mixed)
|
# pass by shared_ptr (mixed)
|
||||||
k = li_boost_shared_ptr.KlassDerived("me oh my")
|
k = li_boost_shared_ptr.KlassDerived("me oh my")
|
||||||
kret = li_boost_shared_ptr.smartpointertest(k)
|
kret = li_boost_shared_ptr.smartpointertest(k)
|
||||||
|
|
@ -279,30 +284,40 @@ class li_boost_shared_ptr_runme:
|
||||||
self.verifyCount(1, k)
|
self.verifyCount(1, k)
|
||||||
self.verifyCount(1, kret)
|
self.verifyCount(1, kret)
|
||||||
|
|
||||||
# //////////////////////////////// Overloading tests ////////////////////////////////////////
|
# //////////////////////////////// Overloading tests //////////////////
|
||||||
# Base class
|
# Base class
|
||||||
k = li_boost_shared_ptr.Klass("me oh my")
|
k = li_boost_shared_ptr.Klass("me oh my")
|
||||||
self.verifyValue(li_boost_shared_ptr.overload_rawbyval(k), "rawbyval")
|
self.verifyValue(li_boost_shared_ptr.overload_rawbyval(k), "rawbyval")
|
||||||
self.verifyValue(li_boost_shared_ptr.overload_rawbyref(k), "rawbyref")
|
self.verifyValue(li_boost_shared_ptr.overload_rawbyref(k), "rawbyref")
|
||||||
self.verifyValue(li_boost_shared_ptr.overload_rawbyptr(k), "rawbyptr")
|
self.verifyValue(li_boost_shared_ptr.overload_rawbyptr(k), "rawbyptr")
|
||||||
self.verifyValue(li_boost_shared_ptr.overload_rawbyptrref(k), "rawbyptrref")
|
self.verifyValue(
|
||||||
|
li_boost_shared_ptr.overload_rawbyptrref(k), "rawbyptrref")
|
||||||
|
|
||||||
self.verifyValue(li_boost_shared_ptr.overload_smartbyval(k), "smartbyval")
|
self.verifyValue(
|
||||||
self.verifyValue(li_boost_shared_ptr.overload_smartbyref(k), "smartbyref")
|
li_boost_shared_ptr.overload_smartbyval(k), "smartbyval")
|
||||||
self.verifyValue(li_boost_shared_ptr.overload_smartbyptr(k), "smartbyptr")
|
self.verifyValue(
|
||||||
self.verifyValue(li_boost_shared_ptr.overload_smartbyptrref(k), "smartbyptrref")
|
li_boost_shared_ptr.overload_smartbyref(k), "smartbyref")
|
||||||
|
self.verifyValue(
|
||||||
|
li_boost_shared_ptr.overload_smartbyptr(k), "smartbyptr")
|
||||||
|
self.verifyValue(
|
||||||
|
li_boost_shared_ptr.overload_smartbyptrref(k), "smartbyptrref")
|
||||||
|
|
||||||
# Derived class
|
# Derived class
|
||||||
k = li_boost_shared_ptr.KlassDerived("me oh my")
|
k = li_boost_shared_ptr.KlassDerived("me oh my")
|
||||||
self.verifyValue(li_boost_shared_ptr.overload_rawbyval(k), "rawbyval")
|
self.verifyValue(li_boost_shared_ptr.overload_rawbyval(k), "rawbyval")
|
||||||
self.verifyValue(li_boost_shared_ptr.overload_rawbyref(k), "rawbyref")
|
self.verifyValue(li_boost_shared_ptr.overload_rawbyref(k), "rawbyref")
|
||||||
self.verifyValue(li_boost_shared_ptr.overload_rawbyptr(k), "rawbyptr")
|
self.verifyValue(li_boost_shared_ptr.overload_rawbyptr(k), "rawbyptr")
|
||||||
self.verifyValue(li_boost_shared_ptr.overload_rawbyptrref(k), "rawbyptrref")
|
self.verifyValue(
|
||||||
|
li_boost_shared_ptr.overload_rawbyptrref(k), "rawbyptrref")
|
||||||
|
|
||||||
self.verifyValue(li_boost_shared_ptr.overload_smartbyval(k), "smartbyval")
|
self.verifyValue(
|
||||||
self.verifyValue(li_boost_shared_ptr.overload_smartbyref(k), "smartbyref")
|
li_boost_shared_ptr.overload_smartbyval(k), "smartbyval")
|
||||||
self.verifyValue(li_boost_shared_ptr.overload_smartbyptr(k), "smartbyptr")
|
self.verifyValue(
|
||||||
self.verifyValue(li_boost_shared_ptr.overload_smartbyptrref(k), "smartbyptrref")
|
li_boost_shared_ptr.overload_smartbyref(k), "smartbyref")
|
||||||
|
self.verifyValue(
|
||||||
|
li_boost_shared_ptr.overload_smartbyptr(k), "smartbyptr")
|
||||||
|
self.verifyValue(
|
||||||
|
li_boost_shared_ptr.overload_smartbyptrref(k), "smartbyptrref")
|
||||||
|
|
||||||
# 3rd derived class
|
# 3rd derived class
|
||||||
k = li_boost_shared_ptr.Klass3rdDerived("me oh my")
|
k = li_boost_shared_ptr.Klass3rdDerived("me oh my")
|
||||||
|
|
@ -313,7 +328,7 @@ class li_boost_shared_ptr_runme:
|
||||||
self.verifyValue("me oh my-3rdDerived", val)
|
self.verifyValue("me oh my-3rdDerived", val)
|
||||||
self.verifyCount(1, k)
|
self.verifyCount(1, k)
|
||||||
|
|
||||||
# //////////////////////////////// Member variables ////////////////////////////////////////
|
# //////////////////////////////// Member variables ///////////////////
|
||||||
# smart pointer by value
|
# smart pointer by value
|
||||||
m = li_boost_shared_ptr.MemberVariables()
|
m = li_boost_shared_ptr.MemberVariables()
|
||||||
k = li_boost_shared_ptr.Klass("smart member value")
|
k = li_boost_shared_ptr.Klass("smart member value")
|
||||||
|
|
@ -451,7 +466,7 @@ class li_boost_shared_ptr_runme:
|
||||||
except ValueError:
|
except ValueError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
# ////////////////////////////////// Global variables ////////////////////////////////////////
|
# ////////////////////////////////// Global variables /////////////////
|
||||||
# smart pointer
|
# smart pointer
|
||||||
kglobal = li_boost_shared_ptr.cvar.GlobalSmartValue
|
kglobal = li_boost_shared_ptr.cvar.GlobalSmartValue
|
||||||
if (kglobal != None):
|
if (kglobal != None):
|
||||||
|
|
@ -466,7 +481,8 @@ class li_boost_shared_ptr_runme:
|
||||||
self.verifyValue("smart global value", val)
|
self.verifyValue("smart global value", val)
|
||||||
self.verifyCount(3, kglobal)
|
self.verifyCount(3, kglobal)
|
||||||
self.verifyCount(3, k)
|
self.verifyCount(3, k)
|
||||||
self.verifyValue("smart global value", li_boost_shared_ptr.cvar.GlobalSmartValue.getValue())
|
self.verifyValue(
|
||||||
|
"smart global value", li_boost_shared_ptr.cvar.GlobalSmartValue.getValue())
|
||||||
li_boost_shared_ptr.cvar.GlobalSmartValue = None
|
li_boost_shared_ptr.cvar.GlobalSmartValue = None
|
||||||
|
|
||||||
# plain value
|
# plain value
|
||||||
|
|
@ -479,7 +495,8 @@ class li_boost_shared_ptr_runme:
|
||||||
self.verifyValue("global value", val)
|
self.verifyValue("global value", val)
|
||||||
self.verifyCount(1, kglobal)
|
self.verifyCount(1, kglobal)
|
||||||
self.verifyCount(1, k)
|
self.verifyCount(1, k)
|
||||||
self.verifyValue("global value", li_boost_shared_ptr.cvar.GlobalValue.getValue())
|
self.verifyValue(
|
||||||
|
"global value", li_boost_shared_ptr.cvar.GlobalValue.getValue())
|
||||||
|
|
||||||
try:
|
try:
|
||||||
li_boost_shared_ptr.cvar.GlobalValue = None
|
li_boost_shared_ptr.cvar.GlobalValue = None
|
||||||
|
|
@ -522,7 +539,7 @@ class li_boost_shared_ptr_runme:
|
||||||
except ValueError:
|
except ValueError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
# ////////////////////////////////// Templates ////////////////////////////////////////
|
# ////////////////////////////////// Templates ////////////////////////
|
||||||
pid = li_boost_shared_ptr.PairIntDouble(10, 20.2)
|
pid = li_boost_shared_ptr.PairIntDouble(10, 20.2)
|
||||||
if (pid.baseVal1 != 20 or pid.baseVal2 != 40.4):
|
if (pid.baseVal1 != 20 or pid.baseVal2 != 40.4):
|
||||||
raise RuntimeError("Base values wrong")
|
raise RuntimeError("Base values wrong")
|
||||||
|
|
@ -531,14 +548,15 @@ class li_boost_shared_ptr_runme:
|
||||||
|
|
||||||
def verifyValue(self, expected, got):
|
def verifyValue(self, expected, got):
|
||||||
if (expected != got):
|
if (expected != got):
|
||||||
raise RuntimeError("verify value failed. Expected: ", expected, " Got: ", got)
|
raise RuntimeError(
|
||||||
|
"verify value failed. Expected: ", expected, " Got: ", got)
|
||||||
|
|
||||||
def verifyCount(self, expected, k):
|
def verifyCount(self, expected, k):
|
||||||
got = li_boost_shared_ptr.use_count(k)
|
got = li_boost_shared_ptr.use_count(k)
|
||||||
if (expected != got):
|
if (expected != got):
|
||||||
raise RuntimeError("verify use_count failed. Expected: ", expected, " Got: ", got)
|
raise RuntimeError(
|
||||||
|
"verify use_count failed. Expected: ", expected, " Got: ", got)
|
||||||
|
|
||||||
|
|
||||||
runme = li_boost_shared_ptr_runme()
|
runme = li_boost_shared_ptr_runme()
|
||||||
runme.main()
|
runme.main()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,4 +7,3 @@ memmove(m, s)
|
||||||
ss = cdata(m, 7)
|
ss = cdata(m, 7)
|
||||||
if ss != "ABC abc":
|
if ss != "ABC abc":
|
||||||
raise "failed"
|
raise "failed"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,4 +29,3 @@ if test7() !="Hello world!":
|
||||||
|
|
||||||
if test8() != " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_":
|
if test8() != " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_":
|
||||||
raise RuntimeError
|
raise RuntimeError
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,4 +26,3 @@ if test7() != u"Hello world!":
|
||||||
|
|
||||||
if test8() != u" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_":
|
if test8() != u" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_":
|
||||||
raise RuntimeError
|
raise RuntimeError
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,4 +14,3 @@ if get(ad) != get(2.0):
|
||||||
raise RuntimeError, "bad implicit type"
|
raise RuntimeError, "bad implicit type"
|
||||||
if get(ab) != get(b):
|
if get(ab) != get(b):
|
||||||
raise RuntimeError, "bad implicit type"
|
raise RuntimeError, "bad implicit type"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -37,5 +37,3 @@ for i in range(0,len(m3)):
|
||||||
|
|
||||||
da = Vector3((1, 2, 3))
|
da = Vector3((1, 2, 3))
|
||||||
ma = Matrix3(((1, 2, 3), (4, 5, 6), (7, 8, 9)))
|
ma = Matrix3(((1, 2, 3), (4, 5, 6), (7, 8, 9)))
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,14 @@
|
||||||
# Check std::vector and std::list behaves the same as Python iterable types (list)
|
# Check std::vector and std::list behaves the same as Python iterable
|
||||||
|
# types (list)
|
||||||
|
|
||||||
from li_std_containers_int import *
|
from li_std_containers_int import *
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
|
||||||
def failed(a, b, msg):
|
def failed(a, b, msg):
|
||||||
raise RuntimeError, msg + " " + str(list(a)) + " " + str(list(b))
|
raise RuntimeError, msg + " " + str(list(a)) + " " + str(list(b))
|
||||||
|
|
||||||
|
|
||||||
def compare_sequences(a, b):
|
def compare_sequences(a, b):
|
||||||
if len(a) != len(b):
|
if len(a) != len(b):
|
||||||
failed(a, b, "different sizes")
|
failed(a, b, "different sizes")
|
||||||
|
|
@ -13,11 +16,15 @@ def compare_sequences(a, b):
|
||||||
if a[i] != b[i]:
|
if a[i] != b[i]:
|
||||||
failed(a, b, "elements are different")
|
failed(a, b, "elements are different")
|
||||||
|
|
||||||
|
|
||||||
def compare_containers(pythonlist, swigvector, swiglist):
|
def compare_containers(pythonlist, swigvector, swiglist):
|
||||||
compare_sequences(pythonlist, swigvector)
|
compare_sequences(pythonlist, swigvector)
|
||||||
compare_sequences(pythonlist, swiglist)
|
compare_sequences(pythonlist, swiglist)
|
||||||
|
|
||||||
# Check std::vector and std::list assignment behaves same as Python list assignment including exceptions
|
# Check std::vector and std::list assignment behaves same as Python list
|
||||||
|
# assignment including exceptions
|
||||||
|
|
||||||
|
|
||||||
def container_insert_step(i, j, step, newval):
|
def container_insert_step(i, j, step, newval):
|
||||||
ps = range(6)
|
ps = range(6)
|
||||||
iv = vector_int(ps)
|
iv = vector_int(ps)
|
||||||
|
|
@ -77,16 +84,20 @@ def container_insert_step(i, j, step, newval):
|
||||||
except IndexError, e:
|
except IndexError, e:
|
||||||
il_error = e
|
il_error = e
|
||||||
|
|
||||||
# Python 2.6 contains bug fixes in extended slicing syntax: http://docs.python.org/2/whatsnew/2.6.html
|
# Python 2.6 contains bug fixes in extended slicing syntax:
|
||||||
skip_check = ps_error != None and(iv_error == il_error == None) and step > 0 and (sys.version_info[0:2] < (2, 6))
|
# 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(skip_check):
|
||||||
if not((type(ps_error) == type(iv_error)) and (type(ps_error) == type(il_error))):
|
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)
|
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
|
# Check std::vector and std::list delete behaves same as Python list
|
||||||
|
# delete including exceptions
|
||||||
def container_delete_step(i, j, step):
|
def container_delete_step(i, j, step):
|
||||||
ps = range(6)
|
ps = range(6)
|
||||||
iv = vector_int(ps)
|
iv = vector_int(ps)
|
||||||
|
|
@ -147,7 +158,8 @@ def container_delete_step(i, j, step):
|
||||||
il_error = e
|
il_error = e
|
||||||
|
|
||||||
if not((type(ps_error) == type(iv_error)) and (type(ps_error) == type(il_error))):
|
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)
|
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)
|
||||||
|
|
||||||
|
|
@ -172,7 +184,8 @@ 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[-5:7], iv[-5:7], il[-5:7])
|
||||||
compare_containers(ps[-6:7], iv[-6:7], il[-6:7])
|
compare_containers(ps[-6:7], iv[-6:7], il[-6:7])
|
||||||
|
|
||||||
# before beginning of range (negative indexing, negative index is > container size)
|
# 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[-7:7], iv[-7:7], il[-7:7])
|
||||||
compare_containers(ps[-100:7], iv[-100:7], il[-100:7])
|
compare_containers(ps[-100:7], iv[-100:7], il[-100:7])
|
||||||
|
|
||||||
|
|
@ -225,7 +238,8 @@ for start in [-102, -100, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 10
|
||||||
# single element set/replace
|
# single element set/replace
|
||||||
container_insert_step(start, None, None, 111)
|
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]:
|
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, 777])
|
||||||
container_insert_step(start, end, None, [111, 222, 333, 444, 555, 666])
|
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, 555])
|
||||||
container_insert_step(start, end, None, [111, 222, 333, 444])
|
container_insert_step(start, end, None, [111, 222, 333, 444])
|
||||||
|
|
@ -246,14 +260,18 @@ for start in [-102, -100, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 10
|
||||||
ps = range(6)
|
ps = range(6)
|
||||||
iv = vector_int(ps)
|
iv = vector_int(ps)
|
||||||
il = list_int(ps)
|
il = list_int(ps)
|
||||||
del ps[:]; del iv[:]; del il[:]
|
del ps[:]
|
||||||
|
del iv[:]
|
||||||
|
del il[:]
|
||||||
compare_containers(ps, iv, il)
|
compare_containers(ps, iv, il)
|
||||||
|
|
||||||
for end in range(7):
|
for end in range(7):
|
||||||
for step in range(-7, 7):
|
for step in range(-7, 7):
|
||||||
for start in range(7):
|
for start in range(7):
|
||||||
container_insert_step(start, end, step, [111, 222, 333, 444, 555, 666, 777])
|
container_insert_step(
|
||||||
container_insert_step(start, end, step, [111, 222, 333, 444, 555, 666])
|
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, 555])
|
||||||
container_insert_step(start, end, step, [111, 222, 333, 444])
|
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, 333])
|
||||||
|
|
@ -266,4 +284,3 @@ try:
|
||||||
raise RuntimeError("Zero step not caught")
|
raise RuntimeError("Zero step not caught")
|
||||||
except ValueError:
|
except ValueError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,17 +3,29 @@ from li_std_except_as_class import *
|
||||||
# This test is expected to fail with -builtin option.
|
# This test is expected to fail with -builtin option.
|
||||||
# Throwing builtin classes as exceptions not supported
|
# Throwing builtin classes as exceptions not supported
|
||||||
if is_python_builtin():
|
if is_python_builtin():
|
||||||
try: test_domain_error()
|
try:
|
||||||
except RuntimeError: pass
|
test_domain_error()
|
||||||
try: test_domain_error()
|
except RuntimeError:
|
||||||
except RuntimeError: pass
|
pass
|
||||||
try: test_domain_error()
|
try:
|
||||||
except RuntimeError: pass
|
test_domain_error()
|
||||||
|
except RuntimeError:
|
||||||
|
pass
|
||||||
|
try:
|
||||||
|
test_domain_error()
|
||||||
|
except RuntimeError:
|
||||||
|
pass
|
||||||
else:
|
else:
|
||||||
# std::domain_error hierarchy
|
# std::domain_error hierarchy
|
||||||
try: test_domain_error()
|
try:
|
||||||
except domain_error: pass
|
test_domain_error()
|
||||||
try: test_domain_error()
|
except domain_error:
|
||||||
except logic_error: pass
|
pass
|
||||||
try: test_domain_error()
|
try:
|
||||||
except exception: pass
|
test_domain_error()
|
||||||
|
except logic_error:
|
||||||
|
pass
|
||||||
|
try:
|
||||||
|
test_domain_error()
|
||||||
|
except exception:
|
||||||
|
pass
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,6 @@ pp1 = li_std_map.p_identa(p1)
|
||||||
mm = li_std_map.m_identa(m)
|
mm = li_std_map.m_identa(m)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
m = li_std_map.mapA()
|
m = li_std_map.mapA()
|
||||||
m[1] = a1
|
m[1] = a1
|
||||||
m[2] = a2
|
m[2] = a2
|
||||||
|
|
@ -30,9 +29,6 @@ for k in m:
|
||||||
raise RuntimeError
|
raise RuntimeError
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
m = {}
|
m = {}
|
||||||
m[1] = (1, 2)
|
m[1] = (1, 2)
|
||||||
m["foo"] = "hello"
|
m["foo"] = "hello"
|
||||||
|
|
@ -47,7 +43,6 @@ for k in pm:
|
||||||
raise RuntimeError
|
raise RuntimeError
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
mii = li_std_map.IntIntMap()
|
mii = li_std_map.IntIntMap()
|
||||||
|
|
||||||
mii[1] = 1
|
mii[1] = 1
|
||||||
|
|
@ -55,4 +50,3 @@ mii[1] = 2
|
||||||
|
|
||||||
if mii[1] != 2:
|
if mii[1] != 2:
|
||||||
raise RuntimeError
|
raise RuntimeError
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ psii = li_std_pair_extra.SIIPair(psi,1)
|
||||||
a = li_std_pair_extra.A()
|
a = li_std_pair_extra.A()
|
||||||
b = li_std_pair_extra.B()
|
b = li_std_pair_extra.B()
|
||||||
|
|
||||||
pab = li_std_pair_extra.ABPair(a,b);
|
pab = li_std_pair_extra.ABPair(a, b)
|
||||||
|
|
||||||
pab.first = a
|
pab.first = a
|
||||||
pab.first.val = 2
|
pab.first.val = 2
|
||||||
|
|
@ -56,4 +56,3 @@ p.second
|
||||||
|
|
||||||
p = li_std_pair_extra.paircA2(1, a)
|
p = li_std_pair_extra.paircA2(1, a)
|
||||||
pp = li_std_pair_extra.pairiiA(1, p)
|
pp = li_std_pair_extra.pairiiA(1, p)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,4 +7,3 @@ two = StringIntPair(two_tuple)
|
||||||
|
|
||||||
if bounce(one) != one_tuple:
|
if bounce(one) != one_tuple:
|
||||||
raise RuntimeError
|
raise RuntimeError
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,6 @@ if sum != "cba":
|
||||||
raise RuntimeError
|
raise RuntimeError
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
si = set_int()
|
si = set_int()
|
||||||
|
|
||||||
si.append(1)
|
si.append(1)
|
||||||
|
|
@ -56,8 +55,6 @@ if i.next() != 3:
|
||||||
raise RuntimeError
|
raise RuntimeError
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
i = s.begin()
|
i = s.begin()
|
||||||
i.next()
|
i.next()
|
||||||
s.erase(i)
|
s.erase(i)
|
||||||
|
|
@ -81,7 +78,6 @@ if m.value() != "c":
|
||||||
raise RuntimeError
|
raise RuntimeError
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
s = pyset()
|
s = pyset()
|
||||||
s.insert((1, 2))
|
s.insert((1, 2))
|
||||||
s.insert(1)
|
s.insert(1)
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
from li_std_stream import *
|
from li_std_stream import *
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
a = A()
|
a = A()
|
||||||
|
|
||||||
o = ostringstream()
|
o = ostringstream()
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@ import li_std_string_extra
|
||||||
x = "hello"
|
x = "hello"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if li_std_string_extra.test_ccvalue(x) != x:
|
if li_std_string_extra.test_ccvalue(x) != x:
|
||||||
raise RuntimeError, "bad string mapping"
|
raise RuntimeError, "bad string mapping"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
import li_std_vector_enum
|
import li_std_vector_enum
|
||||||
|
|
||||||
|
|
||||||
def check(a, b):
|
def check(a, b):
|
||||||
if (a != b):
|
if (a != b):
|
||||||
raise RuntimeError("Not equal: ", a, b)
|
raise RuntimeError("Not equal: ", a, b)
|
||||||
|
|
@ -21,4 +22,3 @@ expected = 10
|
||||||
for val in ev.nums:
|
for val in ev.nums:
|
||||||
check(val, expected)
|
check(val, expected)
|
||||||
expected += 10
|
expected += 10
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -90,13 +90,11 @@ if v.size() != 0:
|
||||||
raise RuntimeError, "bad getslice"
|
raise RuntimeError, "bad getslice"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
v = vecStr(["hello ", "world"])
|
v = vecStr(["hello ", "world"])
|
||||||
if v[0] != 'hello world':
|
if v[0] != 'hello world':
|
||||||
raise RuntimeError, "bad std::string+std::vector"
|
raise RuntimeError, "bad std::string+std::vector"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
pv = pyvector([1, "hello", (1, 2)])
|
pv = pyvector([1, "hello", (1, 2)])
|
||||||
|
|
||||||
if pv[1] != "hello":
|
if pv[1] != "hello":
|
||||||
|
|
@ -139,7 +137,8 @@ ip = makeIntPtr(11)
|
||||||
dp = makeDoublePtr(33.3)
|
dp = makeDoublePtr(33.3)
|
||||||
error = 0
|
error = 0
|
||||||
try:
|
try:
|
||||||
vi = IntPtrVector((ip, dp)) # check vector<int *> does not accept double * element
|
# check vector<int *> does not accept double * element
|
||||||
|
vi = IntPtrVector((ip, dp))
|
||||||
error = 1
|
error = 1
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
@ -159,7 +158,8 @@ csp = makeConstShortPtr(111)
|
||||||
|
|
||||||
error = 0
|
error = 0
|
||||||
try:
|
try:
|
||||||
vcs = ConstShortPtrVector((csp, dp)) # check vector<const unsigned short *> does not accept double * element
|
# check vector<const unsigned short *> does not accept double * element
|
||||||
|
vcs = ConstShortPtrVector((csp, dp))
|
||||||
error = 1
|
error = 1
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
@ -173,4 +173,3 @@ if extractConstShort(vcs[0]) != 111:
|
||||||
|
|
||||||
if extractConstShort(vcs[1]) != 222:
|
if extractConstShort(vcs[1]) != 222:
|
||||||
raise RuntimeError
|
raise RuntimeError
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,4 +5,3 @@ ip2 = makeIntPtr(22)
|
||||||
|
|
||||||
vi = IntPtrVector((ip1, ip2))
|
vi = IntPtrVector((ip1, ip2))
|
||||||
displayVector(vi)
|
displayVector(vi)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
from li_std_wstream import *
|
from li_std_wstream import *
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
a = A()
|
a = A()
|
||||||
|
|
||||||
o = wostringstream()
|
o = wostringstream()
|
||||||
|
|
|
||||||
|
|
@ -81,5 +81,3 @@ if b.name != "hello":
|
||||||
b.a = li_std_wstring.A("hello")
|
b.a = li_std_wstring.A("hello")
|
||||||
if b.a != u"hello":
|
if b.a != u"hello":
|
||||||
raise RuntimeError("bad string mapping")
|
raise RuntimeError("bad string mapping")
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,11 @@
|
||||||
|
|
||||||
from member_pointer import *
|
from member_pointer import *
|
||||||
|
|
||||||
|
|
||||||
def check(what, expected, actual):
|
def check(what, expected, actual):
|
||||||
if expected != actual:
|
if expected != actual:
|
||||||
raise RuntimeError ("Failed: " , what , " Expected: " , expected , " Actual: " , actual)
|
raise RuntimeError(
|
||||||
|
"Failed: ", what, " Expected: ", expected, " Actual: ", actual)
|
||||||
|
|
||||||
# Get the pointers
|
# Get the pointers
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,10 +26,12 @@ if minherit.yget(b) != 2:
|
||||||
raise RuntimeError, "Bad attribute value %d" % (minherit.yget(b))
|
raise RuntimeError, "Bad attribute value %d" % (minherit.yget(b))
|
||||||
|
|
||||||
if minherit.xget(c) != 1 or minherit.yget(c) != 2 or minherit.zget(c) != 3:
|
if minherit.xget(c) != 1 or minherit.yget(c) != 2 or minherit.zget(c) != 3:
|
||||||
raise RuntimeError, "Bad attribute value %d %d %d" % (minherit.xget(c), minherit.yget(c), minherit.zget(c))
|
raise RuntimeError, "Bad attribute value %d %d %d" % (
|
||||||
|
minherit.xget(c), minherit.yget(c), minherit.zget(c))
|
||||||
|
|
||||||
if minherit.xget(d) != 1 or minherit.yget(d) != 2 or minherit.zget(d) != 3 or minherit.wget(d) != 4:
|
if minherit.xget(d) != 1 or minherit.yget(d) != 2 or minherit.zget(d) != 3 or minherit.wget(d) != 4:
|
||||||
raise RuntimeError, "Bad attribute value %d %d %d %d" % (minherit.xget(d), minherit.yget(d), minherit.zget(d), minherit.wget(d))
|
raise RuntimeError, "Bad attribute value %d %d %d %d" % (
|
||||||
|
minherit.xget(d), minherit.yget(d), minherit.zget(d), minherit.wget(d))
|
||||||
|
|
||||||
# Cleanse all of the pointers and see what happens
|
# Cleanse all of the pointers and see what happens
|
||||||
|
|
||||||
|
|
@ -57,15 +59,9 @@ if minherit.yget(bb) != 2:
|
||||||
raise RuntimeError, "Bad attribute value %d" % (minherit.yget(bb))
|
raise RuntimeError, "Bad attribute value %d" % (minherit.yget(bb))
|
||||||
|
|
||||||
if minherit.xget(cc) != 1 or minherit.yget(cc) != 2 or minherit.zget(cc) != 3:
|
if minherit.xget(cc) != 1 or minherit.yget(cc) != 2 or minherit.zget(cc) != 3:
|
||||||
raise RuntimeError, "Bad attribute value %d %d %d" % (minherit.xget(cc), minherit.yget(cc), minherit.zget(cc))
|
raise RuntimeError, "Bad attribute value %d %d %d" % (
|
||||||
|
minherit.xget(cc), minherit.yget(cc), minherit.zget(cc))
|
||||||
|
|
||||||
if minherit.xget(dd) != 1 or minherit.yget(dd) != 2 or minherit.zget(dd) != 3 or minherit.wget(dd) != 4:
|
if minherit.xget(dd) != 1 or minherit.yget(dd) != 2 or minherit.zget(dd) != 3 or minherit.wget(dd) != 4:
|
||||||
raise RuntimeError, "Bad attribute value %d %d %d %d" % (minherit.xget(dd), minherit.yget(dd), minherit.zget(dd), minherit.wget(dd))
|
raise RuntimeError, "Bad attribute value %d %d %d %d" % (
|
||||||
|
minherit.xget(dd), minherit.yget(dd), minherit.zget(dd), minherit.wget(dd))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
from namespace_class import *
|
from namespace_class import *
|
||||||
|
|
||||||
|
|
||||||
def is_new_style_class(cls):
|
def is_new_style_class(cls):
|
||||||
return hasattr(cls, "__class__")
|
return hasattr(cls, "__class__")
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,13 @@
|
||||||
from nested_template_base import *
|
from nested_template_base import *
|
||||||
|
|
||||||
|
|
||||||
ois = InnerS(123);
|
ois = InnerS(123)
|
||||||
oic = InnerC();
|
oic = InnerC()
|
||||||
|
|
||||||
# Check base method is available
|
# Check base method is available
|
||||||
if (oic.outer(ois).val != 123):
|
if (oic.outer(ois).val != 123):
|
||||||
raise RuntimeError("Wrong value calling outer");
|
raise RuntimeError("Wrong value calling outer")
|
||||||
|
|
||||||
# Check non-derived class using base class
|
# Check non-derived class using base class
|
||||||
if (oic.innerc().outer(ois).val != 123):
|
if (oic.innerc().outer(ois).val != 123):
|
||||||
raise RuntimeError("Wrong value calling innerc");
|
raise RuntimeError("Wrong value calling innerc")
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
import operbool
|
import operbool
|
||||||
assert not operbool.Test()
|
assert not operbool.Test()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -52,4 +52,3 @@ if overload_bool.intfunction_ref(False) != "int":
|
||||||
|
|
||||||
# Test int masquerading as bool
|
# Test int masquerading as bool
|
||||||
# Not possible
|
# Not possible
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,8 @@ p = Pop(pInt)
|
||||||
|
|
||||||
p = Pop(pInt, 0)
|
p = Pop(pInt, 0)
|
||||||
|
|
||||||
# Check overloaded in const only and pointers/references which target languages cannot disambiguate
|
# Check overloaded in const only and pointers/references which target
|
||||||
|
# languages cannot disambiguate
|
||||||
if p.hip(0) != 701:
|
if p.hip(0) != 701:
|
||||||
raise RuntimeError, "Test 1 failed"
|
raise RuntimeError, "Test 1 failed"
|
||||||
|
|
||||||
|
|
@ -44,4 +45,3 @@ if muzak(0) != 3001:
|
||||||
|
|
||||||
if muzak(pInt) != 3002:
|
if muzak(pInt) != 3002:
|
||||||
raise RuntimeError, "Test 11 failed"
|
raise RuntimeError, "Test 11 failed"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,4 +11,3 @@ if f.test(3,2) != 5:
|
||||||
raise RuntimeError
|
raise RuntimeError
|
||||||
if f.test(3.0) != 1003:
|
if f.test(3.0) != 1003:
|
||||||
raise RuntimeError
|
raise RuntimeError
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,4 +19,3 @@ if f.test(f,100) != 120:
|
||||||
raise RuntimeError
|
raise RuntimeError
|
||||||
if f.test(f, 100, 200) != 300:
|
if f.test(f, 100, 200) != 300:
|
||||||
raise RuntimeError
|
raise RuntimeError
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import math
|
||||||
nums = Nums()
|
nums = Nums()
|
||||||
limits = Limits()
|
limits = Limits()
|
||||||
|
|
||||||
|
|
||||||
def check(got, expected):
|
def check(got, expected):
|
||||||
if got != expected:
|
if got != expected:
|
||||||
raise RuntimeError("got: " + got + " expected: " + expected)
|
raise RuntimeError("got: " + got + " expected: " + expected)
|
||||||
|
|
|
||||||
|
|
@ -5,4 +5,3 @@ f = overload_rename.Foo(1)
|
||||||
f = overload_rename.Foo(1, 1)
|
f = overload_rename.Foo(1, 1)
|
||||||
f = overload_rename.Foo_int(1, 1)
|
f = overload_rename.Foo_int(1, 1)
|
||||||
f = overload_rename.Foo_int(1, 1, 1)
|
f = overload_rename.Foo_int(1, 1, 1)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -92,9 +92,6 @@ if s.type != "void *":
|
||||||
raise RuntimeError, "Spam(void *)"
|
raise RuntimeError, "Spam(void *)"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
free_void(v)
|
free_void(v)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,4 +8,3 @@ if spam(f) != 1:
|
||||||
|
|
||||||
if spam(b) != 2:
|
if spam(b) != 2:
|
||||||
raise RuntimeError, "bar"
|
raise RuntimeError, "bar"
|
||||||
|
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue