[pypy-commit] pypy kill-someobject: make this test almost pass
alex_gaynor
noreply at buildbot.pypy.org
Mon Oct 8 14:52:00 CEST 2012
Author: Alex Gaynor <alex.gaynor at gmail.com>
Branch: kill-someobject
Changeset: r57924:6bb684c9827f
Date: 2012-10-08 14:50 +0200
http://bitbucket.org/pypy/pypy/changeset/6bb684c9827f/
Log: make this test almost pass
diff --git a/pypy/rlib/test/test_rrandom.py b/pypy/rlib/test/test_rrandom.py
--- a/pypy/rlib/test/test_rrandom.py
+++ b/pypy/rlib/test/test_rrandom.py
@@ -1,6 +1,8 @@
+import _random
+
+from pypy.rlib.rarithmetic import intmask
from pypy.rlib.rrandom import Random, N, r_uint
-from pypy.rlib.rarithmetic import intmask
-import _random
+from pypy.translator.c.test.test_genc import compile
# the numbers were created by using CPython's _randommodule.c
@@ -43,13 +45,14 @@
cpyrandom.jumpahead(100)
assert tuple(rnd.state) + (rnd.index, ) == cpyrandom.getstate()
+
def test_translate():
- from pypy.translator.interactive import Translation
def f(x, y):
+ x = r_uint(x)
+ y = r_uint(y)
rnd = Random(x)
rnd.init_by_array([x, y])
rnd.jumpahead(intmask(y))
- return rnd.genrand32(), rnd.random()
- t = Translation(f)
- fc = t.compile_c([r_uint, r_uint])
- assert fc(r_uint(1), r_uint(2)) == f(r_uint(1), r_uint(2))
+ return float(rnd.genrand32()) + rnd.random()
+ fc = compile(f, [int, int])
+ assert fc(1, 2) == f(1, 2)
More information about the pypy-commit
mailing list