Commit c09d2c10 authored by Stefan Behnel's avatar Stefan Behnel

extended test case

parent f7785cd4
...@@ -2,6 +2,12 @@ ...@@ -2,6 +2,12 @@
cdef char* c_string = b'abcdefg' cdef char* c_string = b'abcdefg'
cdef void* void_ptr = c_string cdef void* void_ptr = c_string
cdef int i = 42
cdef int* int_ptr = &i
cdef float x = 42.2
cdef float* float_ptr = &x
def compare(): def compare():
""" """
>>> compare() >>> compare()
...@@ -10,29 +16,36 @@ def compare(): ...@@ -10,29 +16,36 @@ def compare():
True True
False False
False False
True
True
""" """
print c_string == c_string print c_string == c_string
print c_string == void_ptr print c_string == void_ptr
print c_string is void_ptr print c_string is void_ptr
print c_string != void_ptr print c_string != void_ptr
print c_string is not void_ptr print c_string is not void_ptr
print void_ptr != int_ptr
print void_ptr != float_ptr
def if_tests(): def if_tests():
""" """
>>> if_tests() >>> if_tests()
True True
True
""" """
if c_string == void_ptr: if c_string == void_ptr:
print True print True
if c_string != void_ptr: if c_string != void_ptr:
print False print False
if int_ptr != void_ptr:
print True
def bool_binop(): def bool_binop():
""" """
>>> bool_binop() >>> bool_binop()
True True
""" """
if c_string == void_ptr and c_string == c_string: if c_string == void_ptr and c_string == c_string and int_ptr != void_ptr and void_ptr != float_ptr:
print True print True
def bool_binop_truth(int x): def bool_binop_truth(int x):
...@@ -43,7 +56,7 @@ def bool_binop_truth(int x): ...@@ -43,7 +56,7 @@ def bool_binop_truth(int x):
>>> bool_binop_truth(0) >>> bool_binop_truth(0)
True True
""" """
if c_string and void_ptr and c_string == c_string: if c_string and void_ptr and int_ptr and (c_string == c_string or int_ptr != void_ptr):
print True print True
if c_string and x or not void_ptr or x: if c_string and x or not (void_ptr or int_ptr and float_ptr) or x:
print True print True
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