Merged from trunk
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2009-sploving@12656 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
commit
954256979c
557 changed files with 27074 additions and 5555 deletions
|
|
@ -49,6 +49,7 @@ CPP_TEST_CASES += \
|
|||
li_implicit \
|
||||
li_std_vectora \
|
||||
li_std_vector_extra \
|
||||
li_std_map_member \
|
||||
li_std_multimap \
|
||||
li_std_pair_extra \
|
||||
li_std_set \
|
||||
|
|
@ -61,6 +62,7 @@ CPP_TEST_CASES += \
|
|||
python_kwargs \
|
||||
python_nondynamic \
|
||||
python_overload_simple_cast \
|
||||
python_richcompare \
|
||||
std_containers \
|
||||
swigobject \
|
||||
template_matrix \
|
||||
|
|
@ -74,7 +76,8 @@ C_TEST_CASES += \
|
|||
file_test \
|
||||
li_cstring \
|
||||
li_cwstring \
|
||||
python_nondynamic
|
||||
python_nondynamic \
|
||||
python_varargs_typemap
|
||||
|
||||
#
|
||||
# This test only works with modern C compilers
|
||||
|
|
@ -84,6 +87,18 @@ C_TEST_CASES += \
|
|||
|
||||
include $(srcdir)/../common.mk
|
||||
|
||||
BUILTIN_BROKEN = \
|
||||
li_std_string_extra.cpptest \
|
||||
li_std_wstring.cpptest \
|
||||
default_constructor.cpptest \
|
||||
director_exception.cpptest \
|
||||
exception_order.cpptest \
|
||||
threads_exception.cpptest
|
||||
|
||||
BUILTIN_NOT_BROKEN = $(filter-out $(BUILTIN_BROKEN),$(NOT_BROKEN_TEST_CASES))
|
||||
|
||||
builtin-check : $(BUILTIN_NOT_BROKEN)
|
||||
|
||||
# Overridden variables here
|
||||
LIBS = -L.
|
||||
VALGRIND_OPT += --suppressions=pythonswig.supp
|
||||
|
|
|
|||
|
|
@ -2,16 +2,16 @@ from argcargvtest import *
|
|||
|
||||
largs=['hi','hola','hello']
|
||||
if mainc(largs) != 3:
|
||||
raise RuntimeError, "bad main typemap"
|
||||
raise RuntimeError("bad main typemap")
|
||||
|
||||
targs=('hi','hola')
|
||||
if mainv(targs,1) != 'hola':
|
||||
print mainv(targs,1)
|
||||
raise RuntimeError, "bad main typemap"
|
||||
print(mainv(targs,1))
|
||||
raise RuntimeError("bad main typemap")
|
||||
|
||||
targs=('hi', 'hola')
|
||||
if mainv(targs,1) != 'hola':
|
||||
raise RuntimeError, "bad main typemap"
|
||||
raise RuntimeError("bad main typemap")
|
||||
|
||||
try:
|
||||
error = 0
|
||||
|
|
@ -20,7 +20,7 @@ try:
|
|||
except TypeError:
|
||||
pass
|
||||
if error:
|
||||
raise RuntimeError, "bad main typemap"
|
||||
raise RuntimeError("bad main typemap")
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
36
Examples/test-suite/python/char_binary_runme.py
Normal file
36
Examples/test-suite/python/char_binary_runme.py
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
from char_binary import *
|
||||
|
||||
t = Test()
|
||||
if t.strlen('hile') != 4:
|
||||
print t.strlen('hile')
|
||||
raise RuntimeError, "bad multi-arg typemap"
|
||||
|
||||
if t.strlen('hil\0') != 4:
|
||||
raise RuntimeError, "bad multi-arg typemap"
|
||||
|
||||
#
|
||||
# creating a raw char*
|
||||
#
|
||||
pc = new_pchar(5)
|
||||
pchar_setitem(pc, 0, 'h')
|
||||
pchar_setitem(pc, 1, 'o')
|
||||
pchar_setitem(pc, 2, 'l')
|
||||
pchar_setitem(pc, 3, 'a')
|
||||
pchar_setitem(pc, 4, 0)
|
||||
|
||||
|
||||
if t.strlen(pc) != 4:
|
||||
raise RuntimeError, "bad multi-arg typemap"
|
||||
|
||||
cvar.var_pchar = pc
|
||||
if cvar.var_pchar != "hola":
|
||||
print cvar.var_pchar
|
||||
raise RuntimeError, "bad pointer case"
|
||||
|
||||
cvar.var_namet = pc
|
||||
#if cvar.var_namet != "hola\0":
|
||||
if cvar.var_namet != "hola":
|
||||
raise RuntimeError, "bad pointer case"
|
||||
|
||||
delete_pchar(pc)
|
||||
|
||||
17
Examples/test-suite/python/default_arg_values_runme.py
Normal file
17
Examples/test-suite/python/default_arg_values_runme.py
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
from default_arg_values import *
|
||||
|
||||
d = Display()
|
||||
|
||||
if d.draw1() != 0:
|
||||
raise RuntimeError
|
||||
|
||||
if d.draw1(12) != 12:
|
||||
raise RuntimeError
|
||||
|
||||
p = createPtr(123);
|
||||
if d.draw2() != 0:
|
||||
raise RuntimeError
|
||||
|
||||
if d.draw2(p) != 123:
|
||||
raise RuntimeError
|
||||
|
||||
|
|
@ -1,3 +1,7 @@
|
|||
# This test is expected to fail with -builtin option.
|
||||
# It uses the old static syntax (e.g., dc.new_A() rather than dc.A()),
|
||||
# which is not provided with the -builtin option.
|
||||
|
||||
import _default_constructor
|
||||
|
||||
dc = _default_constructor
|
||||
|
|
|
|||
5
Examples/test-suite/python/director_alternating_runme.py
Normal file
5
Examples/test-suite/python/director_alternating_runme.py
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
from director_alternating import *
|
||||
|
||||
id = getBar().id()
|
||||
if id != idFromGetBar():
|
||||
raise RuntimeError, "Got wrong id: " + str(id)
|
||||
|
|
@ -66,11 +66,15 @@ except MyException, e:
|
|||
if not ok:
|
||||
raise RuntimeError
|
||||
|
||||
# This is expected to fail with -builtin option
|
||||
# Throwing builtin classes as exceptions not supported
|
||||
try:
|
||||
raise Exception2()
|
||||
except Exception2:
|
||||
pass
|
||||
|
||||
# This is expected to fail with -builtin option
|
||||
# Throwing builtin classes as exceptions not supported
|
||||
try:
|
||||
raise Exception1()
|
||||
except Exception1:
|
||||
|
|
|
|||
|
|
@ -12,11 +12,16 @@ class FooBar2(Bar):
|
|||
def pang(self):
|
||||
return "FooBar2::pang();"
|
||||
|
||||
class FooBar3(Bar):
|
||||
def cheer(self):
|
||||
return "FooBar3::cheer();"
|
||||
|
||||
|
||||
b = Bar()
|
||||
f = b.create()
|
||||
fb = FooBar()
|
||||
fb2 = FooBar2()
|
||||
fb3 = FooBar3()
|
||||
|
||||
|
||||
try:
|
||||
|
|
@ -66,7 +71,7 @@ try:
|
|||
except:
|
||||
pass
|
||||
if not protected:
|
||||
raise RuntimeError,"Boo::ping is protected"
|
||||
raise RuntimeError,"Foo::ping is protected"
|
||||
|
||||
protected=1
|
||||
try:
|
||||
|
|
@ -86,3 +91,39 @@ except:
|
|||
pass
|
||||
if not protected:
|
||||
raise RuntimeError,"FooBar::pang is protected"
|
||||
|
||||
|
||||
protected=1
|
||||
try:
|
||||
b.cheer()
|
||||
protected=0
|
||||
except:
|
||||
pass
|
||||
if not protected:
|
||||
raise RuntimeError,"Bar::cheer is protected"
|
||||
|
||||
protected=1
|
||||
try:
|
||||
f.cheer()
|
||||
protected=0
|
||||
except:
|
||||
pass
|
||||
if not protected:
|
||||
raise RuntimeError,"Foo::cheer is protected"
|
||||
|
||||
if fb3.cheer() != "FooBar3::cheer();":
|
||||
raise RuntimeError, "bad fb3::cheer"
|
||||
|
||||
if fb2.callping() != "FooBar2::ping();":
|
||||
raise RuntimeError, "bad fb2.callping"
|
||||
|
||||
if fb2.callcheer() != "FooBar2::pang();Bar::pong();Foo::pong();FooBar2::ping();":
|
||||
raise RuntimeError, "bad fb2.callcheer"
|
||||
|
||||
if fb3.callping() != "Bar::ping();":
|
||||
raise RuntimeError, "bad fb3.callping"
|
||||
|
||||
if fb3.callcheer() != "FooBar3::cheer();":
|
||||
raise RuntimeError, "bad fb3.callcheer"
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
from exception_order import *
|
||||
|
||||
# This test is expected to fail with -builtin option.
|
||||
# Throwing builtin classes as exceptions not supported
|
||||
|
||||
a = A()
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
from global_ns_arg import *
|
||||
|
||||
a = foo(1)
|
||||
b = bar()
|
||||
b = bar_fn()
|
||||
|
||||
|
|
|
|||
|
|
@ -11,3 +11,4 @@ if x != -37:
|
|||
raise RuntimeError
|
||||
|
||||
grouping.cvar.test3 = 42
|
||||
grouping.test3 = 42
|
||||
|
|
|
|||
7
Examples/test-suite/python/import_stl_runme.py
Normal file
7
Examples/test-suite/python/import_stl_runme.py
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
import import_stl_b
|
||||
import import_stl_a
|
||||
|
||||
v_new = import_stl_b.process_vector([1,2,3])
|
||||
if v_new != (1,2,3,4):
|
||||
raise RuntimeError, v_new
|
||||
|
||||
11
Examples/test-suite/python/li_std_map_member_runme.py
Normal file
11
Examples/test-suite/python/li_std_map_member_runme.py
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
import li_std_map_member
|
||||
|
||||
a = li_std_map_member.mapita()
|
||||
a[1] = li_std_map_member.TestA()
|
||||
|
||||
if (a[1].i != 1) :
|
||||
raise RuntimeError("a[1] != 1")
|
||||
|
||||
a[1].i = 2
|
||||
if (a[1].i != 2) :
|
||||
raise RuntimeError("a[1] != 2")
|
||||
|
|
@ -92,5 +92,5 @@ sum = ()
|
|||
for i in s:
|
||||
sum = sum + (i,)
|
||||
|
||||
if sum != (1, 'hello', (1, 2)):
|
||||
if (len(sum) != 3 or (not 1 in sum) or (not 'hello' in sum) or (not (1, 2) in sum)) :
|
||||
raise RuntimeError
|
||||
|
|
|
|||
|
|
@ -54,9 +54,13 @@ if a + b != "hello world":
|
|||
if a + " world" != "hello world":
|
||||
raise RuntimeError, "bad string mapping"
|
||||
|
||||
# This is expected to fail with -builtin option
|
||||
# Reverse operators not supported in builtin types
|
||||
if "hello" + b != "hello world":
|
||||
raise RuntimeError, "bad string mapping"
|
||||
|
||||
# This is expected to fail with -builtin option
|
||||
# Reverse operators not supported in builtin types
|
||||
c = "hello" + b
|
||||
if c.find_last_of("l") != 9:
|
||||
raise RuntimeError, "bad string mapping"
|
||||
|
|
|
|||
|
|
@ -4,21 +4,21 @@ x=u"h"
|
|||
|
||||
if li_std_wstring.test_wcvalue(x) != x:
|
||||
print li_std_wstring.test_wcvalue(x)
|
||||
raise RuntimeError, "bad string mapping"
|
||||
raise RuntimeError("bad string mapping")
|
||||
|
||||
x=u"hello"
|
||||
if li_std_wstring.test_ccvalue(x) != x:
|
||||
raise RuntimeError, "bad string mapping"
|
||||
raise RuntimeError("bad string mapping")
|
||||
|
||||
if li_std_wstring.test_cvalue(x) != x:
|
||||
raise RuntimeError, "bad string mapping"
|
||||
raise RuntimeError("bad string mapping")
|
||||
|
||||
if li_std_wstring.test_value(x) != x:
|
||||
print x, li_std_wstring.test_value(x)
|
||||
raise RuntimeError, "bad string mapping"
|
||||
raise RuntimeError("bad string mapping")
|
||||
|
||||
if li_std_wstring.test_const_reference(x) != x:
|
||||
raise RuntimeError, "bad string mapping"
|
||||
raise RuntimeError("bad string mapping")
|
||||
|
||||
|
||||
s = li_std_wstring.wstring(u"he")
|
||||
|
|
@ -26,39 +26,41 @@ s = s + u"llo"
|
|||
|
||||
if s != x:
|
||||
print s, x
|
||||
raise RuntimeError, "bad string mapping"
|
||||
raise RuntimeError("bad string mapping")
|
||||
|
||||
if s[1:4] != x[1:4]:
|
||||
raise RuntimeError, "bad string mapping"
|
||||
raise RuntimeError("bad string mapping")
|
||||
|
||||
if li_std_wstring.test_value(s) != x:
|
||||
raise RuntimeError, "bad string mapping"
|
||||
raise RuntimeError("bad string mapping")
|
||||
|
||||
if li_std_wstring.test_const_reference(s) != x:
|
||||
raise RuntimeError, "bad string mapping"
|
||||
raise RuntimeError("bad string mapping")
|
||||
|
||||
a = li_std_wstring.A(s)
|
||||
|
||||
if li_std_wstring.test_value(a) != x:
|
||||
raise RuntimeError, "bad string mapping"
|
||||
raise RuntimeError("bad string mapping")
|
||||
|
||||
if li_std_wstring.test_const_reference(a) != x:
|
||||
raise RuntimeError, "bad string mapping"
|
||||
raise RuntimeError("bad string mapping")
|
||||
|
||||
b = li_std_wstring.wstring(" world")
|
||||
|
||||
if a + b != "hello world":
|
||||
raise RuntimeError, "bad string mapping"
|
||||
raise RuntimeError("bad string mapping")
|
||||
|
||||
if a + " world" != "hello world":
|
||||
raise RuntimeError, "bad string mapping"
|
||||
raise RuntimeError("bad string mapping")
|
||||
|
||||
# This is expected to fail if -builtin is used
|
||||
if "hello" + b != "hello world":
|
||||
raise RuntimeError, "bad string mapping"
|
||||
raise RuntimeError("bad string mapping")
|
||||
|
||||
# This is expected to fail if -builtin is used
|
||||
c = "hello" + b
|
||||
if c.find_last_of("l") != 9:
|
||||
raise RuntimeError, "bad string mapping"
|
||||
raise RuntimeError("bad string mapping")
|
||||
|
||||
s = "hello world"
|
||||
|
||||
|
|
@ -66,11 +68,11 @@ b = li_std_wstring.B("hi")
|
|||
|
||||
b.name = li_std_wstring.wstring(u"hello")
|
||||
if b.name != "hello":
|
||||
raise RuntimeError, "bad string mapping"
|
||||
raise RuntimeError("bad string mapping")
|
||||
|
||||
|
||||
b.a = li_std_wstring.A("hello")
|
||||
if b.a != u"hello":
|
||||
raise RuntimeError, "bad string mapping"
|
||||
raise RuntimeError("bad string mapping")
|
||||
|
||||
|
||||
|
|
|
|||
16
Examples/test-suite/python/pointer_reference_runme.py
Normal file
16
Examples/test-suite/python/pointer_reference_runme.py
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
import pointer_reference
|
||||
|
||||
s = pointer_reference.get()
|
||||
if s.value != 10:
|
||||
raise RuntimeError, "get test failed"
|
||||
|
||||
ss = pointer_reference.Struct(20)
|
||||
pointer_reference.set(ss)
|
||||
if pointer_reference.cvar.Struct_instance.value != 20:
|
||||
raise RuntimeError, "set test failed"
|
||||
|
||||
if pointer_reference.overloading(1) != 111:
|
||||
raise RuntimeError, "overload test 1 failed"
|
||||
|
||||
if pointer_reference.overloading(ss) != 222:
|
||||
raise RuntimeError, "overload test 2 failed"
|
||||
11
Examples/test-suite/python/preproc_defined_runme.py
Normal file
11
Examples/test-suite/python/preproc_defined_runme.py
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
import preproc_defined
|
||||
|
||||
if preproc_defined.call_checking() != 1:
|
||||
raise RuntimeError
|
||||
|
||||
d = preproc_defined.Defined()
|
||||
d.defined = 10
|
||||
|
||||
preproc_defined.thing(10)
|
||||
preproc_defined.stuff(10)
|
||||
preproc_defined.bumpf(10)
|
||||
23
Examples/test-suite/python/preproc_include_runme.py
Normal file
23
Examples/test-suite/python/preproc_include_runme.py
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
import preproc_include
|
||||
|
||||
if preproc_include.multiply10(10) != 100:
|
||||
raise RuntimeError
|
||||
|
||||
if preproc_include.multiply20(10) != 200:
|
||||
raise RuntimeError
|
||||
|
||||
if preproc_include.multiply30(10) != 300:
|
||||
raise RuntimeError
|
||||
|
||||
if preproc_include.multiply40(10) != 400:
|
||||
raise RuntimeError
|
||||
|
||||
if preproc_include.multiply50(10) != 500:
|
||||
raise RuntimeError
|
||||
|
||||
if preproc_include.multiply60(10) != 600:
|
||||
raise RuntimeError
|
||||
|
||||
if preproc_include.multiply70(10) != 700:
|
||||
raise RuntimeError
|
||||
|
||||
|
|
@ -188,14 +188,6 @@ if t.var_namet != 'hol':
|
|||
raise RuntimeError
|
||||
|
||||
|
||||
if t.strlen('hile') != 4:
|
||||
print t.strlen('hile')
|
||||
raise RuntimeError, "bad string typemap"
|
||||
|
||||
if t.strlen('hil\0') != 4:
|
||||
raise RuntimeError, "bad string typemap"
|
||||
|
||||
|
||||
cvar.var_char = '\0'
|
||||
if cvar.var_char != '\0':
|
||||
raise RuntimeError, "bad char '0' case"
|
||||
|
|
@ -244,9 +236,6 @@ pchar_setitem(pc, 3, 'a')
|
|||
pchar_setitem(pc, 4, 0)
|
||||
|
||||
|
||||
if t.strlen(pc) != 4:
|
||||
raise RuntimeError, "bad string typemap"
|
||||
|
||||
cvar.var_pchar = pc
|
||||
if cvar.var_pchar != "hola":
|
||||
print cvar.var_pchar
|
||||
|
|
|
|||
|
|
@ -1,5 +1,9 @@
|
|||
from python_abstractbase import *
|
||||
from collections import *
|
||||
|
||||
# This is expected to fail with -builtin option
|
||||
# Builtin types can't inherit from pure-python abstract bases
|
||||
|
||||
assert issubclass(Mapii, MutableMapping)
|
||||
assert issubclass(Multimapii, MutableMapping)
|
||||
assert issubclass(IntSet, MutableSet)
|
||||
|
|
|
|||
|
|
@ -13,7 +13,6 @@ except:
|
|||
if not err:
|
||||
raise RuntimeError, "A is not static"
|
||||
|
||||
|
||||
class B(python_nondynamic.A):
|
||||
c = 4
|
||||
def __init__(self):
|
||||
|
|
@ -21,10 +20,19 @@ class B(python_nondynamic.A):
|
|||
pass
|
||||
pass
|
||||
|
||||
|
||||
|
||||
bb = B()
|
||||
bb.c = 3
|
||||
|
||||
try:
|
||||
bb.c = 3
|
||||
err = 0
|
||||
except:
|
||||
err = 1
|
||||
|
||||
if not err:
|
||||
print "bb.c = %d" % bb.c
|
||||
print "B.c = %d" % B.c
|
||||
raise RuntimeError, "B.c class variable messes up nondynamic-ness of B"
|
||||
|
||||
try:
|
||||
bb.d = 2
|
||||
err = 0
|
||||
|
|
@ -33,7 +41,6 @@ except:
|
|||
|
||||
if not err:
|
||||
raise RuntimeError, "B is not static"
|
||||
|
||||
|
||||
cc = python_nondynamic.C()
|
||||
cc.d = 3
|
||||
|
|
|
|||
100
Examples/test-suite/python/python_richcompare_runme.py
Normal file
100
Examples/test-suite/python/python_richcompare_runme.py
Normal file
|
|
@ -0,0 +1,100 @@
|
|||
import python_richcompare
|
||||
|
||||
base1 = python_richcompare.BaseClass(1)
|
||||
base2 = python_richcompare.BaseClass(2)
|
||||
base3 = python_richcompare.BaseClass(3)
|
||||
a1 = python_richcompare.SubClassA(1)
|
||||
a2 = python_richcompare.SubClassA(2)
|
||||
a3 = python_richcompare.SubClassA(3)
|
||||
b1 = python_richcompare.SubClassB(1)
|
||||
b2 = python_richcompare.SubClassB(2)
|
||||
b3 = python_richcompare.SubClassB(3)
|
||||
|
||||
# Check == and != within a single type
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
if not (base1 == base1) :
|
||||
raise RuntimeError("Object not == to itself")
|
||||
|
||||
if not (base1 == python_richcompare.BaseClass(1)) :
|
||||
raise RuntimeError("Object not == to an equivalent object")
|
||||
|
||||
if (base1 == base2) :
|
||||
raise RuntimeError("Comparing non-equivalent objects of the same type, == returned True")
|
||||
|
||||
if (base1 != base1) :
|
||||
raise RuntimeError("Object is != itself")
|
||||
|
||||
if (base1 != python_richcompare.BaseClass(1)) :
|
||||
raise RuntimeError("Object is != an equivalent object")
|
||||
|
||||
if not (base1 != base2) :
|
||||
raise RuntimeError("Comparing non-equivalent objects of the same type, != returned False")
|
||||
|
||||
|
||||
# Check redefined operator== in SubClassA
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
if (a2 == base2) :
|
||||
raise RuntimeError("Redefined operator== in SubClassA failed")
|
||||
|
||||
if (a2 == b2) :
|
||||
raise RuntimeError("Redefined operator== in SubClassA failed")
|
||||
|
||||
if not (a1 == a2) :
|
||||
raise RuntimeError("Redefined operator== in SubClassA failed")
|
||||
|
||||
# Check up-casting of subclasses
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
if (base2 != a2) :
|
||||
raise RuntimeError("Comparing equivalent base and subclass instances, != returned True")
|
||||
|
||||
if (a2 == base2) :
|
||||
raise RuntimeError("Comparing non-equivalent base and subclass instances, == returned True")
|
||||
|
||||
if (a1 == b1) :
|
||||
raise RuntimeError("Comparing equivalent instances of different subclasses, == returned True")
|
||||
|
||||
if (b1 == a1) :
|
||||
raise RuntimeError("Comparing equivalent instances of different subclasses, == returned True")
|
||||
|
||||
# Check inequalities
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
if (a2 > b2) :
|
||||
raise RuntimeError("operator> failed")
|
||||
|
||||
if (a2 < b2) :
|
||||
raise RuntimeError("operator< failed")
|
||||
|
||||
if not (a2 >= b2) :
|
||||
raise RuntimeError("operator>= failed")
|
||||
|
||||
if not (a2 <= b2) :
|
||||
raise RuntimeError("operator<= failed")
|
||||
|
||||
# Check inequalities used for ordering
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
x = sorted([a2, a3, a1])
|
||||
|
||||
if not (x[0] is a1) :
|
||||
raise RuntimeError("Ordering failed")
|
||||
|
||||
if not (x[1] is a2) :
|
||||
raise RuntimeError("Ordering failed")
|
||||
|
||||
if not (x[2] is a3) :
|
||||
raise RuntimeError("Ordering failed")
|
||||
|
||||
x = sorted([base2, a3, b1])
|
||||
|
||||
if not (x[0] is b1) :
|
||||
raise RuntimeError("Ordering failed")
|
||||
|
||||
if not (x[1] is base2) :
|
||||
raise RuntimeError("Ordering failed")
|
||||
|
||||
if not (x[2] is a3) :
|
||||
raise RuntimeError("Ordering failed")
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
import python_varargs_typemap
|
||||
|
||||
if (python_varargs_typemap.testfunc(1, 2.0, "three") != "three") :
|
||||
raise RuntimeError("testfunc failed!")
|
||||
|
|
@ -2,6 +2,9 @@ from rename_pcre_encoder import *
|
|||
|
||||
s = SomeWidget()
|
||||
s.putBorderWidth(3)
|
||||
if s.getBorderWidth() != 3:
|
||||
raise RuntimeError("Border should be 3, not %d" % (s.getBorderWidth(),))
|
||||
|
||||
s.putSize(4, 5)
|
||||
a = AnotherWidget()
|
||||
a.DoSomething()
|
||||
|
|
|
|||
|
|
@ -18,6 +18,8 @@ except RuntimeError,e:
|
|||
if e.args[0] != "I died.":
|
||||
raise RuntimeError
|
||||
|
||||
# This is expected fail with -builtin option
|
||||
# Throwing builtin classes as exceptions not supported
|
||||
try:
|
||||
t.hosed()
|
||||
except threads_exception.Exc,e:
|
||||
|
|
|
|||
5
Examples/test-suite/python/typemap_arrays_runme.py
Normal file
5
Examples/test-suite/python/typemap_arrays_runme.py
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
from typemap_arrays import *
|
||||
|
||||
if sumA(None) != 60:
|
||||
raise RuntimeError, "Sum is wrong"
|
||||
|
||||
31
Examples/test-suite/python/varargs_overload_runme.py
Normal file
31
Examples/test-suite/python/varargs_overload_runme.py
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
import varargs_overload
|
||||
|
||||
if varargs_overload.vararg_over1("Hello") != "Hello":
|
||||
raise RuntimeError, "Failed"
|
||||
|
||||
if varargs_overload.vararg_over1(2) != "2":
|
||||
raise RuntimeError, "Failed"
|
||||
|
||||
|
||||
if varargs_overload.vararg_over2("Hello") != "Hello":
|
||||
raise RuntimeError, "Failed"
|
||||
|
||||
if varargs_overload.vararg_over2(2, 2.2) != "2 2.2":
|
||||
raise RuntimeError, "Failed"
|
||||
|
||||
|
||||
if varargs_overload.vararg_over3("Hello") != "Hello":
|
||||
raise RuntimeError, "Failed"
|
||||
|
||||
if varargs_overload.vararg_over3(2, 2.2, "hey") != "2 2.2 hey":
|
||||
raise RuntimeError, "Failed"
|
||||
|
||||
if varargs_overload.vararg_over4("Hello") != "Hello":
|
||||
raise RuntimeError, "Failed"
|
||||
|
||||
if varargs_overload.vararg_over4(123) != "123":
|
||||
raise RuntimeError, "Failed"
|
||||
|
||||
if varargs_overload.vararg_over4("Hello", 123) != "Hello":
|
||||
raise RuntimeError, "Failed"
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue