Merged changes from trunk up to revision 12416.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/szager-python-builtin@12417 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
commit
9c796f0333
127 changed files with 2571 additions and 1771 deletions
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)
|
||||
|
||||
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)
|
||||
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"
|
||||
|
|
@ -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
|
||||
|
|
|
|||
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"
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue