[pypy-svn] pypy default: port test_intbound_sub_lt to test_pypy_c_new

antocuni commits-noreply at bitbucket.org
Thu Apr 14 14:44:00 CEST 2011


Author: Antonio Cuni <anto.cuni at gmail.com>
Branch: 
Changeset: r43344:1149f8f0ad09
Date: 2011-04-14 14:35 +0200
http://bitbucket.org/pypy/pypy/changeset/1149f8f0ad09/

Log:	port test_intbound_sub_lt to test_pypy_c_new

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
@@ -1170,3 +1170,27 @@
             --TICK--
             jump(p0, p1, p2, p3, p4, p5, i14, i12, i17, i9, descr=<Loop0>)
         """)
+
+    def test_intbound_sub_lt(self):
+        def main():
+            i, a = 0, 0
+            while i < 300:
+                if i - 10 < 295:
+                    a += 1
+                i += 1
+            return a
+        #
+        log = self.run(main, [], threshold=200)
+        assert log.result == 300
+        loop, = log.loops_by_filename(self.filepath)
+        assert loop.match("""
+            i7 = int_lt(i5, 300)
+            guard_true(i7, descr=...)
+            i9 = int_sub_ovf(i5, 10)
+            guard_no_overflow(descr=...)
+            i11 = int_add_ovf(i4, 1)
+            guard_no_overflow(descr=...)
+            i13 = int_add(i5, 1)
+            --TICK--
+            jump(p0, p1, p2, p3, i11, i13, descr=<Loop0>)
+        """)


More information about the Pypy-commit mailing list