Skip to content

Commit 5a4a2b1

Browse files
dhylandspfalcon
authored andcommitted
extmod: Add test which demonstrates LITTLE_ENDIAN packing failure
1 parent e84325b commit 5a4a2b1

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

tests/extmod/uctypes_sizeof.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
# arr2 is array at offset 0, size 2, of structures defined recursively
77
"arr2": (uctypes.ARRAY | 0, 2, {"b": uctypes.UINT8 | 0}),
88
"arr3": (uctypes.ARRAY | 2, uctypes.UINT16 | 2),
9+
"arr4": (uctypes.ARRAY | 0, 2, {"b": uctypes.UINT8 | 0, "w": uctypes.UINT16 | 1})
910
}
1011

1112
data = bytearray(b"01234567")
@@ -24,3 +25,7 @@
2425
print(uctypes.sizeof(S.arr3[0]))
2526
except TypeError:
2627
print("TypeError")
28+
29+
print(uctypes.sizeof(S.arr4))
30+
assert uctypes.sizeof(S.arr4) == 6
31+

tests/extmod/uctypes_sizeof.py.exp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
2
33
4
44
TypeError
5+
6

0 commit comments

Comments
 (0)