Commit 5a4a2b1d authored by Dave Hylands's avatar Dave Hylands Committed by Paul Sokolovsky
Browse files

extmod: Add test which demonstrates LITTLE_ENDIAN packing failure

parent e84325bd
...@@ -6,6 +6,7 @@ desc = { ...@@ -6,6 +6,7 @@ desc = {
# arr2 is array at offset 0, size 2, of structures defined recursively # arr2 is array at offset 0, size 2, of structures defined recursively
"arr2": (uctypes.ARRAY | 0, 2, {"b": uctypes.UINT8 | 0}), "arr2": (uctypes.ARRAY | 0, 2, {"b": uctypes.UINT8 | 0}),
"arr3": (uctypes.ARRAY | 2, uctypes.UINT16 | 2), "arr3": (uctypes.ARRAY | 2, uctypes.UINT16 | 2),
"arr4": (uctypes.ARRAY | 0, 2, {"b": uctypes.UINT8 | 0, "w": uctypes.UINT16 | 1})
} }
data = bytearray(b"01234567") data = bytearray(b"01234567")
...@@ -24,3 +25,7 @@ try: ...@@ -24,3 +25,7 @@ try:
print(uctypes.sizeof(S.arr3[0])) print(uctypes.sizeof(S.arr3[0]))
except TypeError: except TypeError:
print("TypeError") print("TypeError")
print(uctypes.sizeof(S.arr4))
assert uctypes.sizeof(S.arr4) == 6
...@@ -2,3 +2,4 @@ ...@@ -2,3 +2,4 @@
2 2
4 4
TypeError TypeError
6
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment