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
Kirill Smelkov
cython
Commits
f21013a5
Commit
f21013a5
authored
Jul 07, 2009
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Expand and fix cpp tests
parent
1ca9c605
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
5 deletions
+29
-5
tests/run/cpp_classes.pyx
tests/run/cpp_classes.pyx
+29
-5
No files found.
tests/run/cpp_classes.pyx
View file @
f21013a5
cdef
extern
from
"shapes.h"
namespace
shapes
:
__doc__
=
u"""
>>> test_new_del()
>>> test_rect_area(3, 4)
12
>>> test_square_area(15)
225
"""
cdef
extern
from
"shapes.cpp"
namespace
shapes
:
cdef
cppclass
Shape
:
area
()
float
area
()
cdef
cppclass
Rectangle
(
Shape
):
int
width
...
...
@@ -12,7 +20,23 @@ cdef extern from "shapes.h" namespace shapes:
int
side
__init__
(
int
)
cdef
Rectangle
*
rect
=
new
Rectangle
(
10
,
20
)
cdef
Square
*
sqr
=
new
Square
(
15
)
def
test_new_del
():
cdef
Rectangle
*
rect
=
new
Rectangle
(
10
,
20
)
cdef
Square
*
sqr
=
new
Square
(
15
)
del
rect
,
sqr
def
test_rect_area
(
w
,
h
):
cdef
Rectangle
*
rect
=
new
Rectangle
(
w
,
h
)
try
:
return
rect
.
area
()
finally
:
del
rect
def
test_square_area
(
w
):
cdef
Square
*
sqr
=
new
Square
(
w
)
cdef
Rectangle
*
rect
=
sqr
try
:
return
rect
.
area
(),
sqr
.
area
()
finally
:
del
sqr
del
rect
,
sqr
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