Commit ae11b63c authored by Robert Bradshaw's avatar Robert Bradshaw

Nested struct test.

parent 3ab487f1
...@@ -13,6 +13,9 @@ cdef extern from "cpp_nested_classes_support.h": ...@@ -13,6 +13,9 @@ cdef extern from "cpp_nested_classes_support.h":
cdef cppclass TypedClass[T]: cdef cppclass TypedClass[T]:
ctypedef T MyType ctypedef T MyType
struct MyStruct:
T typed_value
int int_value
union MyUnion: union MyUnion:
T typed_value T typed_value
int int_value int int_value
...@@ -66,3 +69,14 @@ def test_nested_union(x): ...@@ -66,3 +69,14 @@ def test_nested_union(x):
assert u.int_value == x assert u.int_value == x
u.typed_value = x u.typed_value = x
return u.typed_value return u.typed_value
def test_nested_struct(x):
"""
>>> test_nested_struct(2)
2.0
"""
cdef TypedClass[double].MyStruct s
s.int_value = x
assert s.int_value == x
s.typed_value = x
return s.typed_value
...@@ -27,5 +27,9 @@ public: ...@@ -27,5 +27,9 @@ public:
T typed_value; T typed_value;
int int_value; int int_value;
}; };
struct MyStruct {
T typed_value;
int int_value;
};
typedef T MyType; typedef T MyType;
}; };
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment