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
338d5c44
Commit
338d5c44
authored
Oct 06, 2016
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tests for vector[libcpp.bool].
parent
b1d7b0de
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
0 deletions
+22
-0
tests/run/cpp_stl_vector.pyx
tests/run/cpp_stl_vector.pyx
+22
-0
No files found.
tests/run/cpp_stl_vector.pyx
View file @
338d5c44
...
@@ -5,6 +5,7 @@ from cython.operator cimport dereference as d
...
@@ -5,6 +5,7 @@ from cython.operator cimport dereference as d
from
cython.operator
cimport
preincrement
as
incr
from
cython.operator
cimport
preincrement
as
incr
from
libcpp.vector
cimport
vector
from
libcpp.vector
cimport
vector
from
libcpp
cimport
bool
as
cbool
def
simple_test
(
double
x
):
def
simple_test
(
double
x
):
"""
"""
...
@@ -154,3 +155,24 @@ def test_value_type_complex(x):
...
@@ -154,3 +155,24 @@ def test_value_type_complex(x):
"""
"""
cdef
vector
[
double
complex
].
value_type
val
=
x
cdef
vector
[
double
complex
].
value_type
val
=
x
return
val
return
val
def
test_bool_vector_convert
(
o
):
"""
>>> test_bool_vector_convert([True, False, None, 3])
[True, False, False, True]
"""
cdef
vector
[
cbool
]
v
=
o
return
v
def
test_bool_vector_get_set
():
"""
>>> test_bool_vector_get_set()
"""
cdef
vector
[
cbool
]
v
=
range
(
5
)
# Test access.
assert
not
v
[
0
],
v
assert
v
[
1
],
v
# assert v.at(0)
v
[
0
]
=
True
v
[
1
]
=
False
assert
<
object
>
v
==
[
True
,
False
,
True
,
True
,
True
]
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