[pypy-commit] cffi default: A test, passing on Linux, checking that all nonstandard

arigo noreply at buildbot.pypy.org
Sat Aug 11 21:00:21 CEST 2012


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r798:ae26d1c131b7
Date: 2012-08-11 20:59 +0200
http://bitbucket.org/cffi/cffi/changeset/ae26d1c131b7/

Log:	A test, passing on Linux, checking that all nonstandard integer
	types are indeed defined.

diff --git a/testing/test_verify.py b/testing/test_verify.py
--- a/testing/test_verify.py
+++ b/testing/test_verify.py
@@ -114,6 +114,20 @@
             else:
                 assert lib.foo(value) == value + 1
 
+def test_nonstandard_integer_types():
+    ffi = FFI()
+    lst = ffi._backend.nonstandard_integer_types().items()
+    lst.sort()
+    verify_lines = []
+    for key, value in lst:
+        ffi.cdef("static const int expected_%s;" % key)
+        verify_lines.append("static const int expected_%s =" % key)
+        verify_lines.append("    sizeof(%s) | (((%s)-1) <= 0 ? 0 : 0x1000);"
+                            % (key, key))
+    lib = ffi.verify('\n'.join(verify_lines))
+    for key, value in lst:
+        assert getattr(lib, 'expected_%s' % key) == value
+
 def test_char_type():
     ffi = FFI()
     ffi.cdef("char foo(char);")


More information about the pypy-commit mailing list