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
86c65515
Commit
86c65515
authored
Feb 21, 2010
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
doctests for cpp wrapper
parent
cbbbdbf0
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
0 deletions
+24
-0
tests/wrappers/cppwrap.pyx
tests/wrappers/cppwrap.pyx
+24
-0
No files found.
tests/wrappers/cppwrap.pyx
View file @
86c65515
...
@@ -2,6 +2,18 @@
...
@@ -2,6 +2,18 @@
cimport
cppwrap_lib
cimport
cppwrap_lib
cdef
class
DoubleKeeper
:
cdef
class
DoubleKeeper
:
"""
>>> d = DoubleKeeper(1.0)
>>> d.get_number() == 1.0
True
>>> d.get_number() == 2.0
False
>>> d.set_number(2.0)
>>> d.get_number() == 2.0
True
>>> d.transmogrify(3.0) == 6.0
True
"""
cdef
cppwrap_lib
.
DoubleKeeper
*
keeper
cdef
cppwrap_lib
.
DoubleKeeper
*
keeper
def
__cinit__
(
self
,
double
number
):
def
__cinit__
(
self
,
double
number
):
...
@@ -21,10 +33,22 @@ cdef class DoubleKeeper:
...
@@ -21,10 +33,22 @@ cdef class DoubleKeeper:
def
voidfunc
():
def
voidfunc
():
"""
>>> voidfunc()
"""
cppwrap_lib
.
voidfunc
()
cppwrap_lib
.
voidfunc
()
def
doublefunc
(
double
x
,
double
y
,
double
z
):
def
doublefunc
(
double
x
,
double
y
,
double
z
):
"""
>>> doublefunc(1.0, 2.0, 3.0) == 1.0 + 2.0 + 3.0
True
"""
return
cppwrap_lib
.
doublefunc
(
x
,
y
,
z
)
return
cppwrap_lib
.
doublefunc
(
x
,
y
,
z
)
def
transmogrify_from_cpp
(
DoubleKeeper
obj
not
None
,
double
value
):
def
transmogrify_from_cpp
(
DoubleKeeper
obj
not
None
,
double
value
):
"""
>>> d = DoubleKeeper(2.0)
>>> d.transmogrify(3.0) == 6.0
True
"""
return
cppwrap_lib
.
transmogrify_from_cpp
(
obj
.
keeper
,
value
)
return
cppwrap_lib
.
transmogrify_from_cpp
(
obj
.
keeper
,
value
)
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