Commit d7da7092 authored by Stefan Behnel's avatar Stefan Behnel

add constant folding tests for bool values

parent cedb82a7
......@@ -11,14 +11,16 @@ import cython
def unop_floats():
"""
>>> unop_floats()
(1.0, -1.0, 1.0, -1.0, -1.0)
(False, 2.0, -2.0, False, 2.0, -2.0, -2.0)
"""
plus1 = + 1.0
minus1 = - 1.0
plus3 = +++ 1.0
minus3 = --- 1.0
mix = +-++-- 1.0
return plus1, minus1, plus3, minus3, mix
not1 = not 2.0
plus1 = + 2.0
minus1 = - 2.0
not3 = not not not 2.0
plus3 = +++ 2.0
minus3 = --- 2.0
mix = +-++-- 2.0
return not1, plus1, minus1, not3, plus3, minus3, mix
@cython.test_fail_if_path_exists(
......@@ -28,11 +30,33 @@ def unop_floats():
def unop_ints():
"""
>>> unop_ints()
(1, -1, 1, -1, -1)
(False, 2, -2, False, 2, -2, -2)
"""
plus1 = + 1
minus1 = - 1
plus3 = +++ 1
minus3 = --- 1
mix = +-++-- 1
return plus1, minus1, plus3, minus3, mix
not1 = not 2
plus1 = + 2
minus1 = - 2
not3 = not not not 2
plus3 = +++ 2
minus3 = --- 2
mix = +-++-- 2
return not1, plus1, minus1, not3, plus3, minus3, mix
@cython.test_fail_if_path_exists(
"//UnaryMinusNode",
"//UnaryPlusNode",
"//NotNode",
)
def unop_bool():
"""
>>> unop_bool()
(False, 1, -1, False, 1, -1, -1)
"""
not1 = not True
plus1 = + True
minus1 = - True
not3 = not not not True
plus3 = +++ True
minus3 = --- True
mix = +-++-- True
return not1, plus1, minus1, not3, plus3, minus3, mix
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