summaryrefslogtreecommitdiff
path: root/tests/micropython/viper.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/micropython/viper.py')
-rw-r--r--tests/micropython/viper.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/micropython/viper.py b/tests/micropython/viper.py
new file mode 100644
index 000000000..e1c04784d
--- /dev/null
+++ b/tests/micropython/viper.py
@@ -0,0 +1,20 @@
+import micropython
+
+# viper function taking and returning ints
+@micropython.viper
+def f(x:int, y:int) -> int:
+ return x + y + 3
+
+# viper function taking and returning objects
+@micropython.viper
+def g(x:object, y:object) -> object:
+ return x + y
+
+# this doesn't work at the moment
+#@micropython.viper
+#def g() -> uint:
+# return -1
+
+print(f(1, 2))
+print(g(1, 2))
+#print(h())