diff options
author | William S Fulton <wsf@fultondesigns.co.uk> | 2010-06-02 20:53:17 +0000 |
---|---|---|
committer | William S Fulton <wsf@fultondesigns.co.uk> | 2010-06-02 20:53:17 +0000 |
commit | 2824b0cbb66e715490e1ef13250bd675d87b32d9 (patch) | |
tree | c3bc8d54c6d73f2b7ce08cac34172dbc9f5e5b95 /trunk/Examples/test-suite/python/cpp_namespace_runme.py | |
parent | 289cfef4b4766ff266f3b1bdda8ca3a952e5a047 (diff) | |
download | swig-2.0.0.tar.gz |
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/tags/rel-2.0.0@12089 626c5289-ae23-0410-ae9c-e8d60b6d4f22
Diffstat (limited to 'trunk/Examples/test-suite/python/cpp_namespace_runme.py')
-rw-r--r-- | trunk/Examples/test-suite/python/cpp_namespace_runme.py | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/trunk/Examples/test-suite/python/cpp_namespace_runme.py b/trunk/Examples/test-suite/python/cpp_namespace_runme.py new file mode 100644 index 000000000..a454774f5 --- /dev/null +++ b/trunk/Examples/test-suite/python/cpp_namespace_runme.py @@ -0,0 +1,45 @@ +# Note: This example assumes that namespaces are flattened +import cpp_namespace + +n = cpp_namespace.fact(4) +if n != 24: + raise RuntimeError("Bad return value!") + +if cpp_namespace.cvar.Foo != 42: + raise RuntimeError("Bad variable value!") + +t = cpp_namespace.Test() +if t.method() != "Test::method": + raise RuntimeError("Bad method return value!") + +if cpp_namespace.do_method(t) != "Test::method": + raise RuntimeError("Bad return value!") + +if cpp_namespace.do_method2(t) != "Test::method": + raise RuntimeError("Bad return value!") + +cpp_namespace.weird("hello", 4) + +del t + +t2 = cpp_namespace.Test2() +t3 = cpp_namespace.Test3() +t4 = cpp_namespace.Test4() +t5 = cpp_namespace.Test5() + +if cpp_namespace.foo3(42) != 42: + raise RuntimeError("Bad return value!") + +if cpp_namespace.do_method3(t2,40) != "Test2::method": + raise RuntimeError("Bad return value!") + +if cpp_namespace.do_method3(t3,40) != "Test3::method": + raise RuntimeError("Bad return value!") + +if cpp_namespace.do_method3(t4,40) != "Test4::method": + raise RuntimeError("Bad return value!") + +if cpp_namespace.do_method3(t5,40) != "Test5::method": + raise RuntimeError("Bad return value!") + + |