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
28 changed files with 27055 additions and 5536 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
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue