summaryrefslogtreecommitdiff
path: root/Examples/test-suite/python
diff options
context:
space:
mode:
authorLior Goldberg <liorgol.dev@gmail.com>2016-07-01 16:15:40 +0300
committerLior Goldberg <liorgol.dev@gmail.com>2016-07-06 00:31:04 +0300
commitd0fc5b7b5bcf83d6af804d13f209e1c6f33f5ee3 (patch)
tree97aba7f21edc5109ed74c934a8764c5e24bdf226 /Examples/test-suite/python
parent36bbeb478dfcecc7739284cd454ada8b4cb96333 (diff)
downloadswig-d0fc5b7b5bcf83d6af804d13f209e1c6f33f5ee3.tar.gz
Add C++11 alias templates
Diffstat (limited to 'Examples/test-suite/python')
-rw-r--r--Examples/test-suite/python/cpp11_template_typedefs_runme.py43
1 files changed, 43 insertions, 0 deletions
diff --git a/Examples/test-suite/python/cpp11_template_typedefs_runme.py b/Examples/test-suite/python/cpp11_template_typedefs_runme.py
new file mode 100644
index 000000000..4d6fc2629
--- /dev/null
+++ b/Examples/test-suite/python/cpp11_template_typedefs_runme.py
@@ -0,0 +1,43 @@
+from cpp11_template_typedefs import *
+
+t = create_TypedefName()
+if type(t).__name__ != "SomeTypeInt5":
+ raise RuntimeError("type(t) is '%s' and should be 'SomeTypeInt5'" % type(t).__name__)
+
+if t.a != "hello":
+ raise RuntimeError("t.a should be 'hello'")
+if t.b != 10:
+ raise RuntimeError("t.b should be 10")
+if t.get_n() != 5:
+ raise RuntimeError("t.get_n() should be 5")
+
+t_bool = create_TypedefNameBool()
+if type(t_bool).__name__ != "SomeTypeBool5":
+ raise RuntimeError("type(t_bool) is '%s' and should be 'SomeTypeBool5'" % type(t_bool).__name__)
+
+if t_bool.a != "hello":
+ raise RuntimeError("t_bool.a should be 'hello'")
+if t_bool.b != True:
+ raise RuntimeError("t_bool.b should be True")
+if t_bool.get_n() != 15:
+ raise RuntimeError("t_bool.get_n() should be 15")
+
+if get_SomeType_b(t) != 10:
+ raise RuntimeError("get_SomeType_b(t) should be 10")
+
+if get_SomeType_b2(t) != 10:
+ raise RuntimeError("get_SomeType_b2(t) should be 10")
+
+t2 = SomeTypeInt4()
+t2.b = 0
+t3 = identity(t2)
+t3.b = 5
+if t2.b != 5:
+ raise RuntimeError("t2.b should be 5")
+
+if get_bucket_allocator1() != 1:
+ raise RuntimeError("bucket_allocator1 should be 1")
+
+# SWIG doesn't handle ::MyClass as a template argument. Skip this test.
+#if get_bucket_allocator2() != 2:
+# raise RuntimeError("bucket_allocator2 should be 2")