add more cases
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@7686 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
e5f50bd942
commit
ab790f802a
6 changed files with 136 additions and 56 deletions
|
|
@ -452,3 +452,7 @@ template_typedef_import.py
|
|||
li_cwstring.py
|
||||
compactdefaultargs.py
|
||||
refcount.py
|
||||
li_implicit.py
|
||||
director_wstring.py
|
||||
immutable.py
|
||||
inherit.py
|
||||
|
|
|
|||
|
|
@ -1,16 +1,16 @@
|
|||
import director_basic
|
||||
|
||||
class MyFoo(director_basic.Foo):
|
||||
class PyFoo(director_basic.Foo):
|
||||
def ping(self):
|
||||
return "MyFoo::ping()"
|
||||
return "PyFoo::ping()"
|
||||
|
||||
|
||||
a = MyFoo()
|
||||
a = PyFoo()
|
||||
|
||||
if a.ping() != "MyFoo::ping()":
|
||||
if a.ping() != "PyFoo::ping()":
|
||||
raise RuntimeError, a.ping()
|
||||
|
||||
if a.pong() != "Foo::pong();MyFoo::ping()":
|
||||
if a.pong() != "Foo::pong();PyFoo::ping()":
|
||||
raise RuntimeError, a.pong()
|
||||
|
||||
b = director_basic.Foo()
|
||||
|
|
@ -26,3 +26,28 @@ a = director_basic.A1(1)
|
|||
if a.rg(2) != 2:
|
||||
raise RuntimeError
|
||||
|
||||
|
||||
|
||||
class PyClass(director_basic.MyClass):
|
||||
def vmethod(self, b):
|
||||
b.x += 31
|
||||
return b
|
||||
|
||||
|
||||
b = director_basic.Bar(3)
|
||||
d = director_basic.MyClass()
|
||||
c = PyClass()
|
||||
|
||||
cc = PyClass.get_self(c)
|
||||
dd = PyClass.get_self(d)
|
||||
|
||||
bc = cc.cmethod(b)
|
||||
bd = dd.cmethod(b)
|
||||
|
||||
if bc.x != 34:
|
||||
raise RuntimeError
|
||||
|
||||
|
||||
if bd.x != 16:
|
||||
raise RuntimeError
|
||||
|
||||
|
|
|
|||
14
Examples/test-suite/python/li_cmalloc_runme.py
Normal file
14
Examples/test-suite/python/li_cmalloc_runme.py
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
from li_cmalloc import *
|
||||
|
||||
p = malloc_int()
|
||||
free_int(p)
|
||||
|
||||
ok = 0
|
||||
try:
|
||||
p = calloc_int(-1)
|
||||
free_int(p)
|
||||
except:
|
||||
ok = 1
|
||||
|
||||
if ok != 1:
|
||||
raise RuntimeError
|
||||
10
Examples/test-suite/python/li_cpointer_runme.py
Normal file
10
Examples/test-suite/python/li_cpointer_runme.py
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
from li_cpointer import *
|
||||
|
||||
|
||||
p = new_intp()
|
||||
intp_assign(p,3)
|
||||
|
||||
if intp_value(p) != 3:
|
||||
raise RuntimeError
|
||||
|
||||
delete_intp(p)
|
||||
|
|
@ -265,6 +265,7 @@ cvar.var_namet = pc
|
|||
if cvar.var_namet != "hola":
|
||||
raise RuntimeError, "bad pointer case"
|
||||
|
||||
delete_pchar(pc)
|
||||
|
||||
#
|
||||
# Now when things should fail
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue