-__doc__ = u"""
->>> c_longs()
-(1, 1L, -1, 18446744073709551615L)
->>> negative_c_longs()
-(-1, -9223285636854775809L)
->>> py_longs()
-(1, 1L, 100000000000000000000000000000000L, -100000000000000000000000000000000L)
-
->>> py_huge_calculated_long()
-1606938044258990275541962092341162602522202993782792835301376L
->>> py_huge_computation_small_result_neg()
-(-2535301200456458802993406410752L, -2535301200456458802993406410752L)
-"""
-
cimport cython
from cython cimport typeof
import sys
-if sys.version_info[0] >= 3:
- __doc__ = __doc__.replace(u'L', u'')
-elif sys.maxint > 2**31:
- # sizeof(long) == sizeof(long long)
- __doc__ = __doc__.replace("9223285636854775809L", "9223285636854775809")
@cython.test_assert_path_exists(
'//IntNode[@longness = "LL"]',
)
@cython.test_fail_if_path_exists('//IntNode[@longness = ""]')
def c_longs():
+ """
+ >>> c_longs() == (1, 1L, -1, 18446744073709551615L) or c_longs()
+ True
+ """
cdef long a = 1L
cdef unsigned long ua = 1UL
cdef long long aa = 0xFFFFFFFFFFFFFFFFLL
)
@cython.test_fail_if_path_exists('//IntNode[@longness = ""]')
def negative_c_longs():
+ """
+ >>> negative_c_longs() == (-1, -9223285636854775809) or negative_c_longs()
+ True
+ """
cdef long a = -1L
cdef long long aa = -9223285636854775809LL
return a, aa
def py_longs():
+ """
+ >>> py_longs() == (
+ ... 1, 1, 100000000000000000000000000000000, -100000000000000000000000000000000
+ ... ) or py_longs()
+ True
+ """
return 1, 1L, 100000000000000000000000000000000, -100000000000000000000000000000000
@cython.test_fail_if_path_exists("//NumBinopNode", "//IntBinopNode")
@cython.test_assert_path_exists("//ReturnStatNode/IntNode")
def py_huge_calculated_long():
+ """
+ >>> py_huge_calculated_long() == (
+ ... 1606938044258990275541962092341162602522202993782792835301376
+ ... ) or py_huge_calculated_long()
+ True
+ """
return 1 << 200
@cython.test_fail_if_path_exists("//NumBinopNode", "//IntBinopNode")
@cython.test_fail_if_path_exists("//NumBinopNode", "//IntBinopNode")
#@cython.test_assert_path_exists("//ReturnStatNode/IntNode")
def py_huge_computation_small_result_neg():
+ """
+ >>> py_huge_computation_small_result_neg() == (
+ ... -2535301200456458802993406410752L, -2535301200456458802993406410752L
+ ... ) or py_huge_computation_small_result_neg()
+ True
+ """
return -(2 ** 101), (-2) ** 101
def large_literal():