aboutsummaryrefslogtreecommitdiff
path: root/tests/micropython
diff options
context:
space:
mode:
Diffstat (limited to 'tests/micropython')
-rw-r--r--tests/micropython/viper_ptr16_store.py19
-rw-r--r--tests/micropython/viper_ptr16_store.py.exp3
2 files changed, 22 insertions, 0 deletions
diff --git a/tests/micropython/viper_ptr16_store.py b/tests/micropython/viper_ptr16_store.py
new file mode 100644
index 000000000..94cde2bc6
--- /dev/null
+++ b/tests/micropython/viper_ptr16_store.py
@@ -0,0 +1,19 @@
+# test ptr16 type
+
+@micropython.viper
+def set(dest:ptr16, val:int):
+ dest[0] = val
+
+@micropython.viper
+def memset(dest:ptr16, val:int, n:int):
+ for i in range(n):
+ dest[i] = val
+
+b = bytearray(4)
+print(b)
+
+set(b, 0x4242)
+print(b)
+
+memset(b, 0x4343, len(b) // 2)
+print(b)
diff --git a/tests/micropython/viper_ptr16_store.py.exp b/tests/micropython/viper_ptr16_store.py.exp
new file mode 100644
index 000000000..639a43f8f
--- /dev/null
+++ b/tests/micropython/viper_ptr16_store.py.exp
@@ -0,0 +1,3 @@
+bytearray(b'\x00\x00\x00\x00')
+bytearray(b'BB\x00\x00')
+bytearray(b'CCCC')