summaryrefslogtreecommitdiff
path: root/testing/backend_tests.py
diff options
context:
space:
mode:
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
-
-