Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

41 lines
485 B
Python
Raw Normal View History

# tests for natively compiled functions
# basic test
@micropython.native
def native_test(x):
print(1, [], x)
2021-03-15 19:27:36 +05:30
native_test(2)
# check that GC doesn't collect the native function
import gc
2021-03-15 19:27:36 +05:30
gc.collect()
native_test(3)
# native with 2 args
@micropython.native
def f(a, b):
print(a + b)
2021-03-15 19:27:36 +05:30
f(1, 2)
# native with 3 args
@micropython.native
def f(a, b, c):
print(a + b + c)
2021-03-15 19:27:36 +05:30
f(1, 2, 3)
# check not operator
@micropython.native
def f(a):
print(not a)
2021-03-15 19:27:36 +05:30
f(False)
f(True)