diff options
author | Dave Hylands <dhylands@gmail.com> | 2015-12-09 11:47:31 -0500 |
---|---|---|
committer | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2015-12-09 21:43:28 +0200 |
commit | 5a4a2b1db38199151ccdf30ade5be6020b8c0a3b (patch) | |
tree | 1bb31c594efe45717e3f75e23deaa83b222ad4ee | |
parent | e84325bd1da3d0f96b48c63b3eec789699dbeea7 (diff) | |
download | micropython-5a4a2b1db38199151ccdf30ade5be6020b8c0a3b.tar.gz micropython-5a4a2b1db38199151ccdf30ade5be6020b8c0a3b.zip |
extmod: Add test which demonstrates LITTLE_ENDIAN packing failure
-rw-r--r-- | tests/extmod/uctypes_sizeof.py | 5 | ||||
-rw-r--r-- | tests/extmod/uctypes_sizeof.py.exp | 1 |
2 files changed, 6 insertions, 0 deletions
diff --git a/tests/extmod/uctypes_sizeof.py b/tests/extmod/uctypes_sizeof.py index 2f2a0c0d00..93de2abb08 100644 --- a/tests/extmod/uctypes_sizeof.py +++ b/tests/extmod/uctypes_sizeof.py @@ -6,6 +6,7 @@ desc = { # arr2 is array at offset 0, size 2, of structures defined recursively "arr2": (uctypes.ARRAY | 0, 2, {"b": uctypes.UINT8 | 0}), "arr3": (uctypes.ARRAY | 2, uctypes.UINT16 | 2), + "arr4": (uctypes.ARRAY | 0, 2, {"b": uctypes.UINT8 | 0, "w": uctypes.UINT16 | 1}) } data = bytearray(b"01234567") @@ -24,3 +25,7 @@ try: print(uctypes.sizeof(S.arr3[0])) except TypeError: print("TypeError") + +print(uctypes.sizeof(S.arr4)) +assert uctypes.sizeof(S.arr4) == 6 + diff --git a/tests/extmod/uctypes_sizeof.py.exp b/tests/extmod/uctypes_sizeof.py.exp index d1e81238b4..b0e3a0ac6b 100644 --- a/tests/extmod/uctypes_sizeof.py.exp +++ b/tests/extmod/uctypes_sizeof.py.exp @@ -2,3 +2,4 @@ 2 4 TypeError +6 |