summaryrefslogtreecommitdiff
path: root/tests/micropython
diff options
context:
space:
mode:
authorGlenn Ruben Bakke <glennbakke@gmail.com>2017-02-07 22:27:32 +0100
committerGlenn Ruben Bakke <glennbakke@gmail.com>2017-02-07 22:27:32 +0100
commit122d0430db4d103dfb8bc9958b7df4d9803038c8 (patch)
tree856ac0d4950b0154cc6aae8cf022fd29b2402073 /tests/micropython
parent723943abde3e9de5e14ee40df5e0d5fe25352c97 (diff)
parent4cf7fd151e98a3d842eb5c9428545cb67ddd57ee (diff)
Merge branch 'nrf52' into nrf5_no_sdk
Diffstat (limited to 'tests/micropython')
-rw-r--r--tests/micropython/heapalloc_bytesio.py13
-rw-r--r--tests/micropython/heapalloc_bytesio.py.exp1
-rw-r--r--tests/micropython/heapalloc_str.py14
-rw-r--r--tests/micropython/heapalloc_str.py.exp0
4 files changed, 28 insertions, 0 deletions
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'
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
--- /dev/null
+++ b/tests/micropython/heapalloc_str.py.exp