summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_long.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_long.py')
-rw-r--r--Lib/test/test_long.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/test/test_long.py b/Lib/test/test_long.py
index 2de4526..d092e01 100644
--- a/Lib/test/test_long.py
+++ b/Lib/test/test_long.py
@@ -985,6 +985,10 @@ class LongTest(unittest.TestCase):
self.assertEqual((-1122) >> 9, -3)
self.assertEqual(2**128 >> 9, 2**119)
self.assertEqual(-2**128 >> 9, -2**119)
+ # Exercise corner case of the current algorithm, where the result of
+ # shifting a two-limb int by the limb size still has two limbs.
+ self.assertEqual((1 - BASE*BASE) >> SHIFT, -BASE)
+ self.assertEqual((BASE - 1 - BASE*BASE) >> SHIFT, -BASE)
def test_big_rshift(self):
self.assertEqual(42 >> 32, 0)