[pypy-svn] pypy default: port test_load_attr

antocuni commits-noreply at bitbucket.org
Tue Mar 15 18:23:31 CET 2011


Author: Antonio Cuni <anto.cuni at gmail.com>
Branch: 
Changeset: r42667:879737899263
Date: 2011-03-15 15:59 +0100
http://bitbucket.org/pypy/pypy/changeset/879737899263/

Log:	port test_load_attr

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
@@ -423,6 +423,30 @@
             jump(p0, p1, p2, p3, p4, i9, i6, descr=<Loop0>)
         """)
 
+    def test_load_attr(self):
+        src = '''
+            class A(object):
+                pass
+            a = A()
+            a.x = 2
+            def main(n):
+                i = 0
+                while i < n:
+                    i = i + a.x
+                return i
+        '''
+        log = self.run(src, [1000], threshold=400)
+        assert log.result == 1000
+        loop, = log.loops_by_filename(self.filepath)
+        assert loop.match("""
+            i9 = int_lt(i5, i6)
+            guard_true(i9, descr=<Guard3>)
+            i10 = int_add_ovf(i5, i7)
+            guard_no_overflow(descr=<Guard4>)
+            --TICK--
+            jump(p0, p1, p2, p3, p4, i10, i6, i7, p8, descr=<Loop0>)
+        """)
+
 
     def test_reraise(self):
         def f(n):


More information about the Pypy-commit mailing list