Skip to content

Commit bd3dd92

Browse files
committed
tests/heapalloc_int_from_bytes: Test that int.from_bytes() can work w/o alloc.
For a small number of bytes, it's expected to return a small int without allocation.
1 parent 3b09dca commit bd3dd92

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Test that int.from_bytes() for small number of bytes generates
2+
# small int.
3+
import micropython
4+
5+
micropython.heap_lock()
6+
print(int.from_bytes(b"1", "little"))
7+
print(int.from_bytes(b"12", "little"))
8+
micropython.heap_unlock()
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
49
2+
12849

0 commit comments

Comments
 (0)