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
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
b3ebcbb8
Commit
b3ebcbb8
authored
Feb 19, 2010
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More complicated template tests.
parent
15577be1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
0 deletions
+29
-0
tests/run/cpp_templates.pyx
tests/run/cpp_templates.pyx
+29
-0
No files found.
tests/run/cpp_templates.pyx
View file @
b3ebcbb8
...
@@ -61,4 +61,33 @@ def test_pair(int i, double x):
...
@@ -61,4 +61,33 @@ def test_pair(int i, double x):
finally
:
finally
:
del
pair
del
pair
def
test_ptr
(
int
i
):
"""
>>> test_ptr(3)
3
>>> test_ptr(5)
5
"""
cdef
Wrap
[
int
*
]
*
w
try
:
w
=
new
Wrap
[
int
*
](
&
i
)
return
deref
(
w
.
get
())
finally
:
del
w
cdef
double
f
(
double
x
):
return
x
*
x
def
test_func_ptr
(
double
x
):
"""
>>> test_func_ptr(3)
9.0
>>> test_func_ptr(-1.5)
2.25
"""
cdef
Wrap
[
double
(
*
)(
double
)]
*
w
try
:
w
=
new
Wrap
[
double
(
*
)(
double
)](
&
f
)
return
w
.
get
()(
x
)
finally
:
del
w
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