Commit 5a8d5aaf authored by Callie LeFave's avatar Callie LeFave Committed by Stefan Behnel

Fix `fused_pointer_except_null` test undefined behavior

Signed-off-by: default avatarStefan Behnel <stefan_ml@behnel.de>
parent d80aaed5
......@@ -119,12 +119,12 @@ def test_fused_with_pointer():
print
print fused_with_pointer(string_array).decode('ascii')
cdef fused_type1* fused_pointer_except_null(fused_type1 x) except NULL:
cdef fused_type1* fused_pointer_except_null(fused_type1* x) except NULL:
if fused_type1 is string_t:
assert(bool(x))
assert(bool(x[0]))
else:
assert(x < 10)
return &x
assert(x[0] < 10)
return x
def test_fused_pointer_except_null(value):
"""
......@@ -145,11 +145,14 @@ def test_fused_pointer_except_null(value):
AssertionError
"""
if isinstance(value, int):
print fused_pointer_except_null(<cython.int>value)[0]
test_int = cython.declare(cython.int, value)
print fused_pointer_except_null(&test_int)[0]
elif isinstance(value, float):
print fused_pointer_except_null(<cython.float>value)[0]
test_float = cython.declare(cython.float, value)
print fused_pointer_except_null(&test_float)[0]
elif isinstance(value, bytes):
print fused_pointer_except_null(<string_t>value)[0].decode('ascii')
test_str = cython.declare(string_t, value)
print fused_pointer_except_null(&test_str)[0].decode('ascii')
include "cythonarrayutil.pxi"
......
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