Commit a9119337 authored by Xavier Thompson's avatar Xavier Thompson

Add unit test of cypclass' isinstanceof

parent 1644bfa2
# mode: run
# tag: cpp, cpp11
# cython: experimental_cpp_class_def=True, language_level=2
cdef cypclass Base:
pass
cdef cypclass Derived(Base):
pass
def test_insinstanceof():
"""
>>> test_insinstanceof()
(1, 1, 1, 0, 1, 1)
"""
cdef Base base = Base()
cdef Base derived_as_base = Derived()
cdef Derived derived = Derived()
cdef int r1 = isinstanceof[Base](base)
cdef int r2 = isinstanceof[Base](derived_as_base)
cdef int r3 = isinstanceof[Base](derived)
cdef int r4 = isinstanceof[Derived](base)
cdef int r5 = isinstanceof[Derived](derived_as_base)
cdef int r6 = isinstanceof[Derived](derived)
print(r1, r2, r3, r4, r5, r6)
\ No newline at end of file
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