Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Gwenaël Samain
cython
Commits
ae11b63c
Commit
ae11b63c
authored
Jul 08, 2017
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Nested struct test.
parent
3ab487f1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
0 deletions
+18
-0
tests/run/cpp_nested_classes.pyx
tests/run/cpp_nested_classes.pyx
+14
-0
tests/run/cpp_nested_classes_support.h
tests/run/cpp_nested_classes_support.h
+4
-0
No files found.
tests/run/cpp_nested_classes.pyx
View file @
ae11b63c
...
@@ -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
tests/run/cpp_nested_classes_support.h
View file @
ae11b63c
...
@@ -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
;
};
};
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment