summaryrefslogtreecommitdiff
path: root/tests/micropython
diff options
context:
space:
mode:
authorDamien George <damien@micropython.org>2022-05-26 12:31:31 +1000
committerDamien George <damien@micropython.org>2022-05-26 12:54:43 +1000
commit065df5568c258a9f20a9f02b10be9b16dc95da6f (patch)
treeefa724ad7407fa483181c504fdbd5faa39dce601 /tests/micropython
parent20d9f3409a9b2fdd4079e05acb4d24b2877fb5c5 (diff)
tests: Move native while test from pybnative to micropython.
And make it so this test can run on any target. LED and time testing has been removed from this test, that can now be tested using: ./run-tests.py --via-mpy --emit native. Signed-off-by: Damien George <damien@micropython.org>
Diffstat (limited to 'tests/micropython')
-rw-r--r--tests/micropython/native_while.py13
-rw-r--r--tests/micropython/native_while.py.exp6
2 files changed, 19 insertions, 0 deletions
diff --git a/tests/micropython/native_while.py b/tests/micropython/native_while.py
new file mode 100644
index 000000000..ccf0ae0e0
--- /dev/null
+++ b/tests/micropython/native_while.py
@@ -0,0 +1,13 @@
+# test native while loop
+
+
+@micropython.native
+def f(n):
+ i = 0
+ while i < n:
+ print(i)
+ i += 1
+
+
+f(2)
+f(4)
diff --git a/tests/micropython/native_while.py.exp b/tests/micropython/native_while.py.exp
new file mode 100644
index 000000000..d95e7f145
--- /dev/null
+++ b/tests/micropython/native_while.py.exp
@@ -0,0 +1,6 @@
+0
+1
+0
+1
+2
+3