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
Boxiang Sun
cython
Commits
2c8c65d1
Commit
2c8c65d1
authored
Jun 23, 2015
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slightly extend test
parent
193dc29a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
1 deletion
+11
-1
tests/run/cpp_assignment_overload.srctree
tests/run/cpp_assignment_overload.srctree
+11
-1
No files found.
tests/run/cpp_assignment_overload.srctree
View file @
2c8c65d1
# mode: run
# tag: cpp
# tag: cpp
"""
"""
...
@@ -11,6 +12,7 @@ from distutils.core import setup
...
@@ -11,6 +12,7 @@ from distutils.core import setup
from Cython.Build import cythonize
from Cython.Build import cythonize
setup(ext_modules=cythonize("*.pyx", language='c++'))
setup(ext_modules=cythonize("*.pyx", language='c++'))
######## assign.cpp ########
######## assign.cpp ########
class wrapped_int {
class wrapped_int {
...
@@ -24,6 +26,7 @@ public:
...
@@ -24,6 +26,7 @@ public:
}
}
};
};
######## assign.pxd ########
######## assign.pxd ########
cdef extern from "assign.cpp" nogil:
cdef extern from "assign.cpp" nogil:
...
@@ -33,11 +36,18 @@ cdef extern from "assign.cpp" nogil:
...
@@ -33,11 +36,18 @@ cdef extern from "assign.cpp" nogil:
wrapped_int(long long val)
wrapped_int(long long val)
wrapped_int& operator=(const wrapped_int &other)
wrapped_int& operator=(const wrapped_int &other)
######## assignment_overload.pyx ########
######## assignment_overload.pyx ########
from assign cimport wrapped_int
from assign cimport wrapped_int
def test():
def test():
cdef wrapped_int a=wrapped_int(2), b=wrapped_int(3)
cdef wrapped_int a = wrapped_int(2)
cdef wrapped_int b = wrapped_int(3)
assert &a != &b
assert a.val != b.val
a = b
a = b
assert &a != &b
assert &a != &b
assert a.val == b.val
assert a.val == b.val
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