Update documentation for using SWIG_ConvertPtr example usage

Add a test case to test the example documentation typemaps
This commit is contained in:
William S Fulton 2016-10-22 20:55:37 +01:00
commit 96015de0dd
8 changed files with 125 additions and 54 deletions

View 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")