diff options
author | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2017-01-21 20:15:56 +0300 |
---|---|---|
committer | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2017-01-21 20:15:56 +0300 |
commit | bd3dd9296b256d91e6021e481b7f4f5c6ae35a92 (patch) | |
tree | a35f5c7fe9351dfd3a2dcefe641ce7b66b67eaab /tests | |
parent | 3b09dca046634e5ff6cdf97a77bbeab922f7ba2d (diff) | |
download | micropython-bd3dd9296b256d91e6021e481b7f4f5c6ae35a92.tar.gz micropython-bd3dd9296b256d91e6021e481b7f4f5c6ae35a92.zip |
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.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/micropython/heapalloc_int_from_bytes.py | 8 | ||||
-rw-r--r-- | tests/micropython/heapalloc_int_from_bytes.py.exp | 2 |
2 files changed, 10 insertions, 0 deletions
diff --git a/tests/micropython/heapalloc_int_from_bytes.py b/tests/micropython/heapalloc_int_from_bytes.py new file mode 100644 index 0000000000..f8afd2280a --- /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() diff --git a/tests/micropython/heapalloc_int_from_bytes.py.exp b/tests/micropython/heapalloc_int_from_bytes.py.exp new file mode 100644 index 0000000000..7ceb19a384 --- /dev/null +++ b/tests/micropython/heapalloc_int_from_bytes.py.exp @@ -0,0 +1,2 @@ +49 +12849 |