[pypy-svn] r40575 - in pypy/dist/pypy: rpython/test translator/cli/test
mwh at codespeak.net
mwh at codespeak.net
Fri Mar 16 11:33:05 CET 2007
Author: mwh
Date: Fri Mar 16 11:33:01 2007
New Revision: 40575
Modified:
pypy/dist/pypy/rpython/test/test_rint.py
pypy/dist/pypy/translator/cli/test/test_int.py
Log:
rewrites so that translator/cli/test/test_int.py doesn't take forever and a
day.
Modified: pypy/dist/pypy/rpython/test/test_rint.py
==============================================================================
--- pypy/dist/pypy/rpython/test/test_rint.py (original)
+++ pypy/dist/pypy/rpython/test/test_rint.py Fri Mar 16 11:33:01 2007
@@ -219,32 +219,31 @@
res = self.interpret(f, [r_longlong(-1)<<(r_longlong.BITS-1)])
assert res == 0
+ div_mod_iteration_count = 1000
def test_div_mod(self):
import random
- def d(x, y):
- return x/y
+ for inttype in (int, r_longlong):
- for i in range(1000):
- x = random.randint(-100000, 100000)
- y = random.randint(-100000, 100000)
- if not y: continue
- res = self.interpret(d, [x, y])
- assert res == d(x, y)
- res = self.interpret(d, [r_longlong(x), r_longlong(y)])
- assert res == d(x, y)
-
- def m(x, y):
- return x%y
-
- for i in range(1000):
- x = random.randint(-100000, 100000)
- y = random.randint(-100000, 100000)
- if not y: continue
- res = self.interpret(m, [x, y])
- assert res == m(x, y)
- res = self.interpret(m, [r_longlong(x), r_longlong(y)])
- assert res == m(x, y)
+ def d(x, y):
+ return x/y
+
+ for i in range(self.div_mod_iteration_count):
+ x = inttype(random.randint(-100000, 100000))
+ y = inttype(random.randint(-100000, 100000))
+ if not y: continue
+ res = self.interpret(d, [x, y])
+ assert res == d(x, y)
+
+ def m(x, y):
+ return x%y
+
+ for i in range(self.div_mod_iteration_count):
+ x = inttype(random.randint(-100000, 100000))
+ y = inttype(random.randint(-100000, 100000))
+ if not y: continue
+ res = self.interpret(m, [x, y])
+ assert res == m(x, y)
class TestLLtype(BaseTestRint, LLRtypeMixin):
Modified: pypy/dist/pypy/translator/cli/test/test_int.py
==============================================================================
--- pypy/dist/pypy/translator/cli/test/test_int.py (original)
+++ pypy/dist/pypy/translator/cli/test/test_int.py Fri Mar 16 11:33:01 2007
@@ -16,3 +16,5 @@
def test_rarithmetic(self):
pass # it doesn't make sense here
+
+ div_mod_iteration_count = 20
More information about the Pypy-commit
mailing list