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
4112d9e4
Commit
4112d9e4
authored
Apr 26, 2019
by
gsamain
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Amend cpp nested test case for cython-defined cppclass
parent
c1be0eac
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
0 deletions
+35
-0
tests/run/cpp_nested_classes.pyx
tests/run/cpp_nested_classes.pyx
+35
-0
No files found.
tests/run/cpp_nested_classes.pyx
View file @
4112d9e4
...
...
@@ -25,6 +25,20 @@ cdef extern from "cpp_nested_classes_support.h":
cdef
cppclass
SpecializedTypedClass
(
TypedClass
[
double
]):
pass
cdef
cppclass
AA
:
cppclass
BB
:
int
square
(
int
x
):
return
x
*
x
cppclass
CC
:
int
cube
(
int
x
):
return
x
*
x
*
x
BB
*
createB
():
return
new
BB
()
ctypedef
int
my_int
@
staticmethod
my_int
negate
(
my_int
x
):
return
-
x
def
test_nested_classes
():
"""
...
...
@@ -40,6 +54,20 @@ def test_nested_classes():
assert
b_ptr
.
square
(
4
)
==
16
del
b_ptr
def
test_nested_defined_classes
():
"""
>>> test_nested_defined_classes()
"""
cdef
AA
a
cdef
AA
.
BB
b
assert
b
.
square
(
3
)
==
9
cdef
AA
.
BB
.
CC
c
assert
c
.
cube
(
3
)
==
27
cdef
AA
.
BB
*
b_ptr
=
a
.
createB
()
assert
b_ptr
.
square
(
4
)
==
16
del
b_ptr
def
test_nested_typedef
(
py_x
):
"""
>>> test_nested_typedef(5)
...
...
@@ -47,6 +75,13 @@ def test_nested_typedef(py_x):
cdef
A
.
my_int
x
=
py_x
assert
A
.
negate
(
x
)
==
-
py_x
def
test_nested_defined_typedef
(
py_x
):
"""
>>> test_nested_typedef(5)
"""
cdef
A
.
my_int
x
=
py_x
assert
A
.
negate
(
x
)
==
-
py_x
def
test_typed_nested_typedef
(
x
):
"""
>>> test_typed_nested_typedef(4)
...
...
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