summaryrefslogtreecommitdiff
path: root/tests/micropython/viper_ptr16_store.py
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2014-09-29 21:41:41 +0000
committerDamien George <damien.p.george@gmail.com>2014-09-29 21:41:41 +0000
commitdfef4249eb289ae53307d61e3bf2d5cc7339748a (patch)
treefcb88c82ca754274f1141b0c8d82449bbc9e2e1b /tests/micropython/viper_ptr16_store.py
parente9dac3b4d039997f446b6a615d580d284497d59b (diff)
py: Fix viper store on x86; add tests for viper ptr16.
Diffstat (limited to 'tests/micropython/viper_ptr16_store.py')
-rw-r--r--tests/micropython/viper_ptr16_store.py19
1 files changed, 19 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)