[pypy-svn] pypy default: Fix the test that broke when changing how "x/y" is implemented.

arigo commits-noreply at bitbucket.org
Sat Mar 26 12:42:08 CET 2011


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r42966:2c490f3f66e3
Date: 2011-03-26 12:41 +0100
http://bitbucket.org/pypy/pypy/changeset/2c490f3f66e3/

Log:	Fix the test that broke when changing how "x/y" is implemented.
	Rewrite it in a way that doesn't use "/" at all.

diff --git a/pypy/module/pypyjit/test_pypy_c/model.py b/pypy/module/pypyjit/test_pypy_c/model.py
--- a/pypy/module/pypyjit/test_pypy_c/model.py
+++ b/pypy/module/pypyjit/test_pypy_c/model.py
@@ -285,7 +285,7 @@
         self.match_var(op.res, exp_res)
         self._assert(len(op.args) == len(exp_args), "wrong number of arguments")
         for arg, exp_arg in zip(op.args, exp_args):
-            self._assert(self.match_var(arg, exp_arg), "variable mismatch")
+            self._assert(self.match_var(arg, exp_arg), "variable mismatch: %r instead of %r" % (arg, exp_arg))
         self.match_descr(op.descr, exp_descr)
         
 

diff --git a/pypy/module/pypyjit/test_pypy_c/test_pypy_c_new.py b/pypy/module/pypyjit/test_pypy_c/test_pypy_c_new.py
--- a/pypy/module/pypyjit/test_pypy_c/test_pypy_c_new.py
+++ b/pypy/module/pypyjit/test_pypy_c/test_pypy_c_new.py
@@ -1012,7 +1012,7 @@
         def main(n):
             i = 1
             while i < n:
-                i += len(xrange(i)) / i
+                i += len(xrange(i+1)) - i
             return i
 
         log = self.run(main, [10000])
@@ -1023,17 +1023,16 @@
             guard_true(i10, descr=<Guard3>)
             # This can be improved if the JIT realized the lookup of i5 produces
             # a constant and thus can be removed entirely
-            i12 = int_sub(i5, 1)
-            i13 = uint_floordiv(i12, i7)
+            i120 = int_add(i5, 1)
+            i140 = int_lt(0, i120)
+            guard_true(i140, descr=<Guard4>)
+            i13 = uint_floordiv(i5, i7)
             i15 = int_add(i13, 1)
             i17 = int_lt(i15, 0)
-            guard_false(i17, descr=<Guard4>)
-            i18 = int_floordiv(i15, i5)
-            i19 = int_xor(i15, i5)
-            i20 = int_mod(i15, i5)
-            i21 = int_is_true(i20)
-            i22 = int_add_ovf(i5, i18)
-            guard_no_overflow(descr=<Guard5>)
+            guard_false(i17, descr=<Guard5>)
+            i20 = int_sub(i15, i5)
+            i21 = int_add_ovf(i5, i20)
+            guard_no_overflow(descr=<Guard6>)
             --TICK--
-            jump(p0, p1, p2, p3, p4, i22, i6, i7, p8, p9, descr=<Loop0>)
+            jump(p0, p1, p2, p3, p4, i21, i6, i7, p8, p9, descr=<Loop0>)
         """)


More information about the Pypy-commit mailing list