[pypy-svn] r66895 - pypy/branch/pyjitpl5/pypy/jit/metainterp/test

fijal at codespeak.net fijal at codespeak.net
Tue Aug 18 14:42:12 CEST 2009


Author: fijal
Date: Tue Aug 18 14:42:12 2009
New Revision: 66895

Modified:
   pypy/branch/pyjitpl5/pypy/jit/metainterp/test/test_exception.py
Log:
(pedronis, fijal)
Change a test to execute all paths in opimpl_check_zerodivisionerror


Modified: pypy/branch/pyjitpl5/pypy/jit/metainterp/test/test_exception.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/metainterp/test/test_exception.py	(original)
+++ pypy/branch/pyjitpl5/pypy/jit/metainterp/test/test_exception.py	Tue Aug 18 14:42:12 2009
@@ -402,16 +402,22 @@
         assert res == sys.maxint - 2000
 
     def test_int_mod_ovf_zer(self):
+        myjitdriver = JitDriver(greens = [], reds = ['i', 'x', 'y'])
         def f(x, y):
-            try:
-                return ovfcheck(x%y)
-            except ZeroDivisionError:
-                return 1
-            except OverflowError:
-                return 2
+            i = 0
+            while i < 10:
+                myjitdriver.can_enter_jit(x=x, y=y, i=i)
+                myjitdriver.jit_merge_point(x=x, y=y, i=i)
+                try:
+                    ovfcheck(i%x)
+                    i += 1
+                except ZeroDivisionError:
+                    i += 1
+                except OverflowError:
+                    i += 2
 
-        res = self.interp_operations(f, [1, 2])
-        assert res == 1
+        self.meta_interp(f, [0, 0])
+        self.meta_interp(f, [1, 0])
 
     def test_int_lshift_ovf(self):
         myjitdriver = JitDriver(greens = [], reds = ['n', 'x', 'y', 'm'])



More information about the Pypy-commit mailing list