Author: Armin Rigo <[email protected]>
Branch: cpy-extension
Changeset: r312:5614459396f6
Date: 2012-06-13 21:34 +0200
http://bitbucket.org/cffi/cffi/changeset/5614459396f6/
Log: Add a passing test
diff --git a/c/test_c.py b/c/test_c.py
--- a/c/test_c.py
+++ b/c/test_c.py
@@ -460,6 +460,15 @@
assert s.a2 == 456
assert s.a3 == 0
+def test_array_in_struct():
+ BInt = new_primitive_type("int")
+ BStruct = new_struct_type("foo")
+ BArrayInt5 = new_array_type(new_pointer_type(BInt), 5)
+ complete_struct_or_union(BStruct, [('a1', BArrayInt5, -1)])
+ s = newp(new_pointer_type(BStruct), [[20, 24, 27, 29, 30]])
+ assert s.a1[2] == 27
+ assert repr(s.a1) == "<cdata 'int[5]'>"
+
def test_offsetof():
BInt = new_primitive_type("int")
BStruct = new_struct_type("foo")
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit