Commits

Antonio Cuni committed 366141b

this test belongs to test_instance (more or less)

Comments (0)

Files changed (2)

pypy/module/pypyjit/test_pypy_c/test_instance.py

             i12 = int_add_ovf(i5, i7)
             guard_no_overflow(descr=...)
         """)
+
+    def test_id_compare_optimization(self):
+        def main():
+            class A(object):
+                pass
+            #
+            i = 0
+            a = A()
+            while i < 300:
+                new_a = A()
+                if new_a != a:  # ID: compare
+                    pass
+                i += 1
+            return i
+        #
+        log = self.run(main, [])
+        loop, = log.loops_by_filename(self.filepath)
+        assert loop.match_by_id("compare", "") # optimized away
+

pypy/module/pypyjit/test_pypy_c/test_pypy_c_new.py

         assert log.result == 300 * (-10 % -20)
         assert log.jit_summary.tracing_no == 1
 
-    def test_id_compare_optimization(self):
-        def main():
-            class A(object):
-                pass
-            #
-            i = 0
-            a = A()
-            while i < 300:
-                new_a = A()
-                if new_a != a:  # ID: compare
-                    pass
-                i += 1
-            return i
-        #
-        log = self.run(main, [])
-        loop, = log.loops_by_filename(self.filepath)
-        assert loop.match_by_id("compare", "") # optimized away
-
     def test_overflow_checking(self):
         """
         This test only checks that we get the expected result, not that any