tests: Add a test for native code on pyboard.
This commit is contained in:
parent
c4ccb078a5
commit
9102af6afb
|
@ -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)
|
|
@ -0,0 +1,6 @@
|
||||||
|
1
|
||||||
|
2
|
||||||
|
1
|
||||||
|
2
|
||||||
|
3
|
||||||
|
4
|
|
@ -115,7 +115,7 @@ def main():
|
||||||
test_dirs = ('basics', 'float', 'import', 'io', 'misc')
|
test_dirs = ('basics', 'float', 'import', 'io', 'misc')
|
||||||
else:
|
else:
|
||||||
# run pyboard tests
|
# 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)
|
tests = sorted(test_file for test_files in (glob('{}/*.py'.format(dir)) for dir in test_dirs) for test_file in test_files)
|
||||||
else:
|
else:
|
||||||
# tests explicitly given
|
# tests explicitly given
|
||||||
|
|
Loading…
Reference in New Issue