diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/micropython/viper_subscr_multi.py | 17 | ||||
| -rw-r--r-- | tests/micropython/viper_subscr_multi.py.exp | 1 |
2 files changed, 14 insertions, 4 deletions
diff --git a/tests/micropython/viper_subscr_multi.py b/tests/micropython/viper_subscr_multi.py index 1561e5534..a2baba241 100644 --- a/tests/micropython/viper_subscr_multi.py +++ b/tests/micropython/viper_subscr_multi.py @@ -6,15 +6,24 @@ def f1(b: ptr8): b[0] += b[1] +b = bytearray(b"\x01\x02") +f1(b) +print(b) + + @micropython.viper def f2(b: ptr8, i: int): b[0] += b[i] b = bytearray(b"\x01\x02") -f1(b) -print(b) - -b = bytearray(b"\x01\x02") f2(b, 1) print(b) + + +@micropython.viper +def f3(b: ptr8) -> int: + return b[0] << 24 | b[1] << 16 | b[2] << 8 | b[3] + + +print(hex(f3(b"\x01\x02\x03\x04"))) diff --git a/tests/micropython/viper_subscr_multi.py.exp b/tests/micropython/viper_subscr_multi.py.exp index a2c298bb1..ea644c046 100644 --- a/tests/micropython/viper_subscr_multi.py.exp +++ b/tests/micropython/viper_subscr_multi.py.exp @@ -1,2 +1,3 @@ bytearray(b'\x03\x02') bytearray(b'\x03\x02') +0x1020304 |
