diff options
author | Damien George <damien.p.george@gmail.com> | 2014-05-07 18:55:31 +0100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2014-05-07 18:55:31 +0100 |
commit | 9102af6afbc65bb7c4597e3f8371f6e72a6aebd9 (patch) | |
tree | d056d9064584524f28bd66f33d2c6ae89003b358 | |
parent | c4ccb078a52276fc95e407602676f14d34a3f3c1 (diff) | |
download | micropython-9102af6afbc65bb7c4597e3f8371f6e72a6aebd9.tar.gz micropython-9102af6afbc65bb7c4597e3f8371f6e72a6aebd9.zip |
tests: Add a test for native code on pyboard.
-rw-r--r-- | tests/pybnative/while.py | 14 | ||||
-rw-r--r-- | tests/pybnative/while.py.exp | 6 | ||||
-rwxr-xr-x | tests/run-tests | 2 |
3 files changed, 21 insertions, 1 deletions
diff --git a/tests/pybnative/while.py b/tests/pybnative/while.py new file mode 100644 index 0000000000..a3f64a800c --- /dev/null +++ b/tests/pybnative/while.py @@ -0,0 +1,14 @@ +@micropython.native +def f(led, n): + led.off() + i = 0 + while i < n: + led.toggle() + d = pyb.delay + d(50) # pyb.delay(50) doesn't work! + i += 1 + print(i) + led.off() + +f(pyb.LED(1), 2) +f(pyb.LED(2), 4) diff --git a/tests/pybnative/while.py.exp b/tests/pybnative/while.py.exp new file mode 100644 index 0000000000..5cd83db0ff --- /dev/null +++ b/tests/pybnative/while.py.exp @@ -0,0 +1,6 @@ +1 +2 +1 +2 +3 +4 diff --git a/tests/run-tests b/tests/run-tests index 3237edf98e..618d11831a 100755 --- a/tests/run-tests +++ b/tests/run-tests @@ -115,7 +115,7 @@ def main(): test_dirs = ('basics', 'float', 'import', 'io', 'misc') else: # run pyboard tests - test_dirs = ('basics', 'float', 'pyb', 'inlineasm') + test_dirs = ('basics', 'float', 'pyb', 'pybnative', 'inlineasm') tests = sorted(test_file for test_files in (glob('{}/*.py'.format(dir)) for dir in test_dirs) for test_file in test_files) else: # tests explicitly given |