[pypy-svn] r66896 - pypy/branch/pyjitpl5/pypy/jit/metainterp/test
fijal at codespeak.net
fijal at codespeak.net
Tue Aug 18 14:46:25 CEST 2009
Author: fijal
Date: Tue Aug 18 14:46:24 2009
New Revision: 66896
Modified:
pypy/branch/pyjitpl5/pypy/jit/metainterp/test/test_exception.py
Log:
(pedronis, fijal) a test for int_div overflow
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:46:24 2009
@@ -1,4 +1,4 @@
-import py
+import py, sys
from pypy.jit.metainterp.test.test_basic import LLJitMixin, OOJitMixin
from pypy.rlib.jit import JitDriver
from pypy.rlib.rarithmetic import ovfcheck, LONG_BIT, intmask
@@ -385,6 +385,17 @@
res = self.meta_interp(f, [1])
assert res == expected
+
+ def test_div_ovf(self):
+ def f(x, y):
+ try:
+ return ovfcheck(x/y)
+ except OverflowError:
+ return 42
+
+ res = self.interp_operations(f, [-sys.maxint-1, -1])
+ assert res == 42
+
def test_int_ovf_common(self):
import sys
myjitdriver = JitDriver(greens = [], reds = ['n'])
More information about the Pypy-commit
mailing list