Author: Armin Rigo <[email protected]>
Branch: cpy-extension
Changeset: r298:9b061f09da62
Date: 2012-06-12 17:58 +0200
http://bitbucket.org/cffi/cffi/changeset/9b061f09da62/

Log:    An extra passing test.

diff --git a/testing/test_verify.py b/testing/test_verify.py
--- a/testing/test_verify.py
+++ b/testing/test_verify.py
@@ -58,6 +58,17 @@
         assert lib.foo(44L) == 45
         assert lib.foo(ffi.cast(typename, 46)) == 47
         py.test.raises(TypeError, lib.foo, None)
+        #
+        # check for overflow cases
+        if typename in all_float_types:
+            continue
+        for value in [-2**80, -2**40, -2**20, -2**10, -2**5, -1,
+                      2**5, 2**10, 2**20, 2**40, 2**80]:
+            overflows = int(ffi.cast(typename, value)) != value
+            if overflows:
+                py.test.raises(OverflowError, lib.foo, value)
+            else:
+                assert lib.foo(value) == value + 1
 
 def test_char_type():
     ffi = FFI()
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to