From: Stefan Behnel Date: Mon, 23 Mar 2009 13:28:38 +0000 (+0100) Subject: test for constant folding on character literals X-Git-Tag: 0.12.alpha0~369 X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=253ed80320b0b385b280c0ca492f32b09b4fdf45;p=cython.git test for constant folding on character literals --- diff --git a/tests/run/consts.pyx b/tests/run/consts.pyx index 873fc000..5b40e908 100644 --- a/tests/run/consts.pyx +++ b/tests/run/consts.pyx @@ -5,10 +5,12 @@ True True >>> neg() == -1 -2 - (-3+4) True ->>> int_mix() == 1 + (2 * 3) // 2 +>>> long_int_mix() == 1 + (2 * 3) // 2 True ->>> if IS_PY3: type(int_mix()) is int -... else: type(int_mix()) is long +>>> if IS_PY3: type(long_int_mix()) is int +... else: type(long_int_mix()) is long +True +>>> char_int_mix() == 1 + (ord(' ') * 3) // 2 + ord('A') True >>> int_cast() == 1 + 2 * 6000 True @@ -37,9 +39,12 @@ def add_var(a): def neg(): return -1 -2 - (-3+4) -def int_mix(): +def long_int_mix(): return 1L + (2 * 3L) // 2 +def char_int_mix(): + return 1L + (c' ' * 3L) // 2 + c'A' + def int_cast(): return (1 + 2 * 6000)