Commit 259b3635 authored by Stefan Behnel's avatar Stefan Behnel

extend PyLong optimisation tests for '%' operator

parent 0897f269
......@@ -54,6 +54,10 @@ def mod_obj_10(int2):
8
>>> int(mod_obj_10(-2**25))
8
>>> int((-2**31-1) % 10)
1
>>> int(mod_obj_10(int(-2**31-1)))
1
>>> int((2**50) % 10)
4
>>> int(mod_obj_10(2**50))
......@@ -62,6 +66,10 @@ def mod_obj_10(int2):
6
>>> int(mod_obj_10(-2**50))
6
>>> int((-2**63-1) % 10)
1
>>> int(mod_obj_10(-2**63-1))
1
>>> int((2**200) % 10)
6
>>> int(mod_obj_10(2**200))
......@@ -75,6 +83,77 @@ def mod_obj_10(int2):
return int1
def mod_obj_17(int2):
"""
>>> 0 % 17
0
>>> mod_obj_17(0)
0
>>> 1 % 17
1
>>> mod_obj_17(1)
1
>>> (-1) % 17
16
>>> mod_obj_17(-1)
16
>>> 9 % 17
9
>>> mod_obj_17(16)
16
>>> 17 % 17
0
>>> mod_obj_17(17)
0
>>> (-17) % 17
0
>>> mod_obj_17(-17)
0
>>> (-18) % 17
16
>>> mod_obj_17(-18)
16
>>> 10002 % 17
6
>>> mod_obj_17(10002)
6
>>> int((2**25) % 17)
2
>>> int(mod_obj_17(2**25))
2
>>> int((-2**25) % 17)
15
>>> int(mod_obj_17(-2**25))
15
>>> int((-2**31-1) % 17)
7
>>> int(mod_obj_17(int(-2**31-1)))
7
>>> int((2**50) % 17)
4
>>> int(mod_obj_17(2**50))
4
>>> int((-2**50) % 17)
13
>>> int(mod_obj_17(-2**50))
13
>>> int((-2**63-1) % 17)
7
>>> int(mod_obj_17(-2**63-1))
7
>>> int((2**200) % 17)
1
>>> int(mod_obj_17(2**200))
1
>>> int((-2**200) % 17)
16
>>> int(mod_obj_17(-2**200))
16
"""
int1 = int2 % 17
return int1
def mod_obj_m2(int2):
"""
>>> 0 % -2
......
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