[pypy-commit] pypy default: Fix for the CLI and JVM tests.
arigo
noreply at buildbot.pypy.org
Thu Mar 15 01:14:10 CET 2012
Author: Armin Rigo <arigo at tunes.org>
Branch:
Changeset: r53627:05a6376ee87d
Date: 2012-03-14 17:13 -0700
http://bitbucket.org/pypy/pypy/changeset/05a6376ee87d/
Log: Fix for the CLI and JVM tests.
diff --git a/pypy/translator/oosupport/test_template/overflow.py b/pypy/translator/oosupport/test_template/overflow.py
--- a/pypy/translator/oosupport/test_template/overflow.py
+++ b/pypy/translator/oosupport/test_template/overflow.py
@@ -3,9 +3,12 @@
class BaseTestOverflow:
- def check(self, fn, args):
+ def check(self, fn, args, expected=None):
res1 = self.interpret(fn, args)
- res2 = fn(*args)
+ if expected is not None:
+ res2 = expected
+ else:
+ res2 = fn(*args)
assert res1 == res2
def test_add(self):
@@ -63,7 +66,9 @@
return ovfcheck(x % y)
except OverflowError:
return 42
- self.check(fn, [-sys.maxint-1, -1])
+ # force the expected result to be 42, because direct run of ovfcheck()
+ # cannot detect this particular overflow case
+ self.check(fn, [-sys.maxint-1, -1], expected=42)
def test_div(self):
def fn(x, y):
More information about the pypy-commit
mailing list