From d0fc5b7b5bcf83d6af804d13f209e1c6f33f5ee3 Mon Sep 17 00:00:00 2001 From: Lior Goldberg Date: Fri, 1 Jul 2016 16:15:40 +0300 Subject: Add C++11 alias templates --- .../python/cpp11_template_typedefs_runme.py | 43 ++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 Examples/test-suite/python/cpp11_template_typedefs_runme.py (limited to 'Examples/test-suite/python') 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") -- cgit v1.2.1