From 9ffc3ae0e7355c69af212ba918c90ef9cb57be7b Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Fri, 27 Jan 2017 00:45:30 +0300 Subject: tests/heapalloc_str: Test for alloc-free string operations. Starts with concatenation with an empty string. --- tests/micropython/heapalloc_str.py | 14 ++++++++++++++ tests/micropython/heapalloc_str.py.exp | 0 2 files changed, 14 insertions(+) create mode 100644 tests/micropython/heapalloc_str.py create mode 100644 tests/micropython/heapalloc_str.py.exp (limited to 'tests/micropython') diff --git a/tests/micropython/heapalloc_str.py b/tests/micropython/heapalloc_str.py new file mode 100644 index 000000000..0df39d3c0 --- /dev/null +++ b/tests/micropython/heapalloc_str.py @@ -0,0 +1,14 @@ +# String operations which don't require allocation +import micropython + +micropython.heap_lock() + +b"" + b"" +b"" + b"1" +b"2" + b"" + +"" + "" +"" + "1" +"2" + "" + +micropython.heap_unlock() diff --git a/tests/micropython/heapalloc_str.py.exp b/tests/micropython/heapalloc_str.py.exp new file mode 100644 index 000000000..e69de29bb -- cgit v1.2.3 From b32880bd513b868465ad2ffd9b698c13ce7f964a Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Thu, 2 Feb 2017 00:38:38 +0300 Subject: tests/heapalloc_bytesio: Test for BytesIO with preallocates space. --- tests/micropython/heapalloc_bytesio.py | 13 +++++++++++++ tests/micropython/heapalloc_bytesio.py.exp | 1 + 2 files changed, 14 insertions(+) create mode 100644 tests/micropython/heapalloc_bytesio.py create mode 100644 tests/micropython/heapalloc_bytesio.py.exp (limited to 'tests/micropython') diff --git a/tests/micropython/heapalloc_bytesio.py b/tests/micropython/heapalloc_bytesio.py new file mode 100644 index 000000000..311632851 --- /dev/null +++ b/tests/micropython/heapalloc_bytesio.py @@ -0,0 +1,13 @@ +import uio +import micropython + +data = b"1234" * 16 +buf = uio.BytesIO(64) + +micropython.heap_lock() + +buf.write(data) + +micropython.heap_unlock() + +print(buf.getvalue()) diff --git a/tests/micropython/heapalloc_bytesio.py.exp b/tests/micropython/heapalloc_bytesio.py.exp new file mode 100644 index 000000000..675761c2b --- /dev/null +++ b/tests/micropython/heapalloc_bytesio.py.exp @@ -0,0 +1 @@ +b'1234123412341234123412341234123412341234123412341234123412341234' -- cgit v1.2.3