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
9444212e
Commit
9444212e
authored
Feb 21, 2010
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simple reference tests.
parent
64ad2013
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
0 deletions
+49
-0
tests/wrappers/cpp_references.pyx
tests/wrappers/cpp_references.pyx
+44
-0
tests/wrappers/cpp_references_helper.h
tests/wrappers/cpp_references_helper.h
+5
-0
No files found.
tests/wrappers/cpp_references.pyx
0 → 100644
View file @
9444212e
cdef
extern
from
"cpp_references_helper.h"
:
cdef
int
&
ref_func
(
int
&
)
cdef
int
ref_var_value
cdef
int
&
ref_var
def
test_ref_func
(
int
x
):
"""
>>> test_ref_func(2)
2
>>> test_ref_func(3)
3
"""
return
ref_func
(
x
)
def
test_ref_func_address
(
int
x
):
"""
>>> test_ref_func_address(5)
5
>>> test_ref_func_address(7)
7
"""
cdef
int
*
i_ptr
=
&
ref_func
(
x
)
return
i_ptr
[
0
]
def
test_ref_var
(
int
x
):
"""
>>> test_ref_func(11)
11
>>> test_ref_func(13)
13
"""
ref_var
=
x
return
ref_var_value
def
test_ref_assign
(
int
x
):
"""
>>> test_ref_assign(17)
17.0
>>> test_ref_assign(19)
19.0
"""
cdef
double
d
=
ref_func
(
x
)
return
d
tests/wrappers/cpp_references_helper.h
0 → 100644
View file @
9444212e
int
ref_var_value
=
10
;
int
&
ref_var
=
ref_var_value
;
int
&
ref_func
(
int
&
x
)
{
return
x
;
}
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