Update documentation for using SWIG_ConvertPtr example usage
Add a test case to test the example documentation typemaps
This commit is contained in:
parent
268b942865
commit
96015de0dd
8 changed files with 125 additions and 54 deletions
20
Examples/test-suite/python/typemap_documentation_runme.py
Normal file
20
Examples/test-suite/python/typemap_documentation_runme.py
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
import typemap_documentation
|
||||
|
||||
f = typemap_documentation.Foo()
|
||||
f.x = 55
|
||||
b = typemap_documentation.Bar()
|
||||
b.y = 44
|
||||
|
||||
if 55 != typemap_documentation.GrabVal(f):
|
||||
raise RuntimeError("bad value")
|
||||
|
||||
try:
|
||||
typemap_documentation.GrabVal(b)
|
||||
raise RuntimeError("unexpected exception")
|
||||
except TypeError:
|
||||
pass
|
||||
|
||||
if 55 != typemap_documentation.GrabValFooBar(f):
|
||||
raise RuntimeError("bad f value")
|
||||
if 44 != typemap_documentation.GrabValFooBar(b):
|
||||
raise RuntimeError("bad b value")
|
||||
Loading…
Add table
Add a link
Reference in a new issue