summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_long.py
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2002-08-13 02:17:11 (GMT)
committerTim Peters <tim.peters@gmail.com>2002-08-13 02:17:11 (GMT)
commit28b0e2a7f826abfdcf92feb045bf5ddd3de632a1 (patch)
tree21141e7a9208f256ab55e54ae29695d57f20171d /Lib/test/test_long.py
parentd8c8048f5e9660a877e6894393198a63cb99c89c (diff)
downloadcpython-28b0e2a7f826abfdcf92feb045bf5ddd3de632a1.zip
cpython-28b0e2a7f826abfdcf92feb045bf5ddd3de632a1.tar.gz
cpython-28b0e2a7f826abfdcf92feb045bf5ddd3de632a1.tar.bz2
Machines-- and Python --are a lot faster in relevant ways since this
test was written. So boosted the number of "digits" this generates, and also beefed up the "* / divmod" test to tickle numbers big enough to trigger the Karatsuba algorithm. It takes about 2 seconds now on my box.
Diffstat (limited to 'Lib/test/test_long.py')
-rw-r--r--Lib/test/test_long.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/Lib/test/test_long.py b/Lib/test/test_long.py
index 7822412..4602bfb 100644
--- a/Lib/test/test_long.py
+++ b/Lib/test/test_long.py
@@ -6,10 +6,11 @@ from random import random, randint
SHIFT = 15
BASE = 2 ** SHIFT
MASK = BASE - 1
+KARATSUBA_CUTOFF = 35 # from longobject.c
# Max number of base BASE digits to use in test cases. Doubling
-# this will at least quadruple the runtime.
-MAXDIGITS = 10
+# this will more than double the runtime.
+MAXDIGITS = 15
# build some special values
special = map(long, [0, 1, 2, BASE, BASE >> 1])
@@ -90,7 +91,8 @@ def test_division_2(x, y):
def test_division(maxdigits=MAXDIGITS):
if verbose:
print "long / * % divmod"
- digits = range(1, maxdigits+1)
+ digits = range(1, maxdigits+1) + range(KARATSUBA_CUTOFF,
+ KARATSUBA_CUTOFF + 15)
for lenx in digits:
x = getran(lenx)
for leny in digits: