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
Kirill Smelkov
cython
Commits
e997bb99
Commit
e997bb99
authored
Feb 15, 2020
by
Omer Ozarslan
Committed by
Stefan Behnel
Apr 07, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add tests for std::move wrapper
parent
097e2be1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
0 deletions
+34
-0
tests/run/cpp_move.pyx
tests/run/cpp_move.pyx
+34
-0
No files found.
tests/run/cpp_move.pyx
0 → 100644
View file @
e997bb99
# mode: run
# tag: cpp, werror, cpp11
from
libcpp
cimport
nullptr
from
libcpp.memory
cimport
shared_ptr
,
make_shared
from
libcpp.utility
cimport
move
from
cython.operator
cimport
dereference
cdef
extern
from
*
:
"""
#include <string>
template<typename T> const char* move_helper(T&) { return "lvalue-ref"; }
template<typename T> const char* move_helper(T&&) { return "rvalue-ref"; }
"""
const
char
*
move_helper
[
T
](
T
)
def
test_move_assignment
():
"""
>>> test_move_assignment()
"""
cdef
shared_ptr
[
int
]
p1
,
p2
p1
=
make_shared
[
int
](
1337
)
p2
=
move
(
p1
)
assert
p1
==
nullptr
assert
dereference
(
p2
)
==
1337
def
test_move_func_call
():
"""
>>> test_move_func_call()
"""
cdef
shared_ptr
[
int
]
p
assert
move_helper
(
p
)
==
b'lvalue-ref'
assert
move_helper
(
move
(
p
))
==
b'rvalue-ref'
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