From ac81cee3fc554722d8d7471eee33ad3bd1cf30af Mon Sep 17 00:00:00 2001 From: Damien George Date: Thu, 27 Sep 2018 23:37:33 +1000 Subject: [PATCH] tests/micropython: Test loading const objs in native and viper funcs. --- tests/micropython/native_const.py | 14 ++++++++++++++ tests/micropython/native_const.py.exp | 2 ++ tests/micropython/viper_const.py | 14 ++++++++++++++ tests/micropython/viper_const.py.exp | 2 ++ tests/micropython/viper_const_intbig.py | 7 +++++++ tests/micropython/viper_const_intbig.py.exp | 1 + 6 files changed, 40 insertions(+) create mode 100644 tests/micropython/native_const.py create mode 100644 tests/micropython/native_const.py.exp create mode 100644 tests/micropython/viper_const.py create mode 100644 tests/micropython/viper_const.py.exp create mode 100644 tests/micropython/viper_const_intbig.py create mode 100644 tests/micropython/viper_const_intbig.py.exp diff --git a/tests/micropython/native_const.py b/tests/micropython/native_const.py new file mode 100644 index 0000000000..37b491cf4a --- /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 0000000000..9002a0c2e5 --- /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 0000000000..5085ede90f --- /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 0000000000..9002a0c2e5 --- /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 0000000000..6b44973880 --- /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 0000000000..1d52d220f8 --- /dev/null +++ b/tests/micropython/viper_const_intbig.py.exp @@ -0,0 +1 @@ +123456789012345678901234567890