Author: Armin Rigo <[email protected]>
Branch:
Changeset: r881:4d29f1ef14c6
Date: 2012-08-23 17:31 +0200
http://bitbucket.org/cffi/cffi/changeset/4d29f1ef14c6/
Log: Missing structs with bitfields support in verify()
diff --git a/testing/test_verify.py b/testing/test_verify.py
--- a/testing/test_verify.py
+++ b/testing/test_verify.py
@@ -387,6 +387,15 @@
s = ffi.new("struct foo_s *")
assert ffi.sizeof(s.a) == 17 * ffi.sizeof('int')
+def test_struct_with_bitfield_exact():
+ ffi = FFI()
+ ffi.cdef("struct foo_s { int a:2, b:3; };")
+ ffi.verify("struct foo_s { int a:2, b:3; };")
+ s = ffi.new("struct foo_s *")
+ s.b = 3
+ py.test.raises(OverflowError, "s.b = 4")
+ assert s.b == 3
+
def test_global_constants():
ffi = FFI()
# use 'static const int', as generally documented, although in this
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit