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
58955c26
Commit
58955c26
authored
Jan 14, 2010
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
stl vector test
parent
9b973f30
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
0 deletions
+39
-0
tests/run/cpp_stl_vector.pyx
tests/run/cpp_stl_vector.pyx
+39
-0
No files found.
tests/run/cpp_stl_vector.pyx
0 → 100644
View file @
58955c26
cdef
extern
from
"<vector>"
namespace
std
:
cdef
cppclass
vector
[
T
]:
void
push_back
(
T
)
size_t
size
()
def
simple_test
(
double
x
):
"""
>>> simple_test(55)
3
"""
cdef
vector
[
double
]
*
v
try
:
v
=
new
vector
[
double
]()
v
.
push_back
(
1.0
)
v
.
push_back
(
x
)
from
math
import
pi
v
.
push_back
(
pi
)
return
v
.
size
()
finally
:
del
v
def
list_test
(
L
):
"""
>>> list_test([1,2,4,8])
(4, 4)
>>> list_test([])
(0, 0)
>>> list_test([-1] * 1000)
(1000, 1000)
"""
cdef
vector
[
int
]
*
v
try
:
v
=
new
vector
[
int
]()
for
a
in
L
:
v
.
push_back
(
a
)
return
len
(
L
),
v
.
size
()
finally
:
del
v
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