[pypy-commit] pypy kill-someobject: merge heads
arigo
noreply at buildbot.pypy.org
Mon Oct 8 15:04:50 CEST 2012
Author: Armin Rigo <arigo at tunes.org>
Branch: kill-someobject
Changeset: r57929:b0e233a6139e
Date: 2012-10-08 15:04 +0200
http://bitbucket.org/pypy/pypy/changeset/b0e233a6139e/
Log: merge heads
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