Commit 2c8c65d1 authored by Stefan Behnel's avatar Stefan Behnel

slightly extend test

parent 193dc29a
# mode: run
# tag: cpp
"""
......@@ -11,6 +12,7 @@ from distutils.core import setup
from Cython.Build import cythonize
setup(ext_modules=cythonize("*.pyx", language='c++'))
######## assign.cpp ########
class wrapped_int {
......@@ -24,6 +26,7 @@ public:
}
};
######## assign.pxd ########
cdef extern from "assign.cpp" nogil:
......@@ -33,11 +36,18 @@ cdef extern from "assign.cpp" nogil:
wrapped_int(long long val)
wrapped_int& operator=(const wrapped_int &other)
######## assignment_overload.pyx ########
from assign cimport wrapped_int
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
assert &a != &b
assert a.val == b.val
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment