summaryrefslogtreecommitdiff
path: root/testing/backend_tests.py
diff options
context:
space:
mode:
authorArmin Rigo <arigo@tunes.org>2015-05-17 10:00:14 +0200
committerArmin Rigo <arigo@tunes.org>2015-05-17 10:00:14 +0200
commit48d677b2578080c605794afd08736176b3c8f928 (patch)
tree086c5f2367dfb1989cdd41aacd675afb26bfc1e2 /testing/backend_tests.py
parentacf8dc3c0a4a389d3e89732a9fa96cff3abace83 (diff)
parentcb8e0566f3bf8f905324c6e77a00201fc6a9ab52 (diff)
downloadcffi-release-0.9.tar.gz
hg merge defaultrelease-0.9
Diffstat (limited to 'testing/backend_tests.py')
-rw-r--r--testing/backend_tests.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/testing/backend_tests.py b/testing/backend_tests.py
index d4e8cf6..d3b5ca1 100644
--- a/testing/backend_tests.py
+++ b/testing/backend_tests.py
@@ -1388,6 +1388,17 @@ class BackendTests:
assert p.c == 14
assert p.d == 14
+ def test_nested_field_offset_align(self):
+ ffi = FFI(backend=self.Backend())
+ ffi.cdef("""
+ struct foo_s {
+ struct { int a; char b; };
+ union { char c; };
+ };
+ """)
+ assert ffi.offsetof("struct foo_s", "c") == 2 * SIZE_OF_INT
+ assert ffi.sizeof("struct foo_s") == 3 * SIZE_OF_INT
+
def test_nested_anonymous_union(self):
ffi = FFI(backend=self.Backend())
ffi.cdef("""
@@ -1692,5 +1703,3 @@ class BackendTests:
assert lib.DOT_HEX == 0x100
assert lib.DOT_HEX2 == 0x10
assert lib.DOT_UL == 1000
-
-