[pypy-commit] cffi cpy-extension: The next thing to do.

arigo noreply at buildbot.pypy.org
Wed Jun 13 18:07:14 CEST 2012


Author: Armin Rigo <arigo at tunes.org>
Branch: cpy-extension
Changeset: r309:bf6a0595ecc3
Date: 2012-06-13 18:07 +0200
http://bitbucket.org/cffi/cffi/changeset/bf6a0595ecc3/

Log:	The next thing to do.

diff --git a/testing/test_verify.py b/testing/test_verify.py
--- a/testing/test_verify.py
+++ b/testing/test_verify.py
@@ -210,3 +210,21 @@
     for typename in all_float_types:
         for real in all_signed_integer_types:
             _check_field_match(typename, real, expect_mismatch=True)
+
+def test_struct_array_field():
+    py.test.skip("in-progress")
+    ffi = FFI()
+    ffi.cdef("struct foo_s { int a[17]; ...; };")
+    ffi.verify("struct foo_s { int x; int a[17]; int y; };")
+    assert ffi.sizeof('struct foo_s') == 19 * ffi.sizeof('int')
+    s = ffi.new("struct foo_s")
+    assert ffi.sizeof(s.a) == 17 * ffi.sizeof('int')
+
+def test_struct_array_guess_length():
+    py.test.skip("in-progress")
+    ffi = FFI()
+    ffi.cdef("struct foo_s { int a[]; ...; };")
+    ffi.verify("struct foo_s { int x; int a[17]; int y; };")
+    assert ffi.sizeof('struct foo_s') == 19 * ffi.sizeof('int')
+    s = ffi.new("struct foo_s")
+    assert ffi.sizeof(s.a) == 17 * ffi.sizeof('int')


More information about the pypy-commit mailing list