summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2018-09-27 23:37:33 +1000
committerDamien George <damien.p.george@gmail.com>2018-09-27 23:39:08 +1000
commitac81cee3fc554722d8d7471eee33ad3bd1cf30af (patch)
treef426c054275a285f037db8fcef36d756d43d7db8
parent2e862332630e2838d06b293f35fdd76ab7c9d714 (diff)
tests/micropython: Test loading const objs in native and viper funcs.
-rw-r--r--tests/micropython/native_const.py14
-rw-r--r--tests/micropython/native_const.py.exp2
-rw-r--r--tests/micropython/viper_const.py14
-rw-r--r--tests/micropython/viper_const.py.exp2
-rw-r--r--tests/micropython/viper_const_intbig.py7
-rw-r--r--tests/micropython/viper_const_intbig.py.exp1
6 files changed, 40 insertions, 0 deletions
diff --git a/tests/micropython/native_const.py b/tests/micropython/native_const.py
new file mode 100644
index 000000000..37b491cf4
--- /dev/null
+++ b/tests/micropython/native_const.py
@@ -0,0 +1,14 @@
+# test loading constants in native functions
+
+@micropython.native
+def f():
+ return b'bytes'
+print(f())
+
+@micropython.native
+def f():
+ @micropython.native
+ def g():
+ return 123
+ return g
+print(f()())
diff --git a/tests/micropython/native_const.py.exp b/tests/micropython/native_const.py.exp
new file mode 100644
index 000000000..9002a0c2e
--- /dev/null
+++ b/tests/micropython/native_const.py.exp
@@ -0,0 +1,2 @@
+b'bytes'
+123
diff --git a/tests/micropython/viper_const.py b/tests/micropython/viper_const.py
new file mode 100644
index 000000000..5085ede90
--- /dev/null
+++ b/tests/micropython/viper_const.py
@@ -0,0 +1,14 @@
+# test loading constants in viper functions
+
+@micropython.viper
+def f():
+ return b'bytes'
+print(f())
+
+@micropython.viper
+def f():
+ @micropython.viper
+ def g() -> int:
+ return 123
+ return g
+print(f()())
diff --git a/tests/micropython/viper_const.py.exp b/tests/micropython/viper_const.py.exp
new file mode 100644
index 000000000..9002a0c2e
--- /dev/null
+++ b/tests/micropython/viper_const.py.exp
@@ -0,0 +1,2 @@
+b'bytes'
+123
diff --git a/tests/micropython/viper_const_intbig.py b/tests/micropython/viper_const_intbig.py
new file mode 100644
index 000000000..6b4497388
--- /dev/null
+++ b/tests/micropython/viper_const_intbig.py
@@ -0,0 +1,7 @@
+# check loading constants
+
+@micropython.viper
+def f():
+ return 123456789012345678901234567890
+
+print(f())
diff --git a/tests/micropython/viper_const_intbig.py.exp b/tests/micropython/viper_const_intbig.py.exp
new file mode 100644
index 000000000..1d52d220f
--- /dev/null
+++ b/tests/micropython/viper_const_intbig.py.exp
@@ -0,0 +1 @@
+123456789012345678901234567890