From bd3dd9296b256d91e6021e481b7f4f5c6ae35a92 Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Sat, 21 Jan 2017 20:15:56 +0300 Subject: 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. --- tests/micropython/heapalloc_int_from_bytes.py | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 tests/micropython/heapalloc_int_from_bytes.py (limited to 'tests/micropython/heapalloc_int_from_bytes.py') diff --git a/tests/micropython/heapalloc_int_from_bytes.py b/tests/micropython/heapalloc_int_from_bytes.py new file mode 100644 index 000000000..f8afd2280 --- /dev/null +++ b/tests/micropython/heapalloc_int_from_bytes.py @@ -0,0 +1,8 @@ +# Test that int.from_bytes() for small number of bytes generates +# small int. +import micropython + +micropython.heap_lock() +print(int.from_bytes(b"1", "little")) +print(int.from_bytes(b"12", "little")) +micropython.heap_unlock() -- cgit v1.2.3