micropython: add micropython component
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
This directory doesn't contain real tests, but code snippets to detect
|
||||
various interpreter features, which can't be/inconvenient to detecte by
|
||||
other means. Scripts here are executed by run-tests.py at the beginning of
|
||||
testsuite to decide what other test groups to run/exclude.
|
@@ -0,0 +1,6 @@
|
||||
# check if async/await keywords are supported
|
||||
async def foo():
|
||||
await 1
|
||||
|
||||
|
||||
print("async")
|
@@ -0,0 +1,5 @@
|
||||
try:
|
||||
bytearray
|
||||
print("bytearray")
|
||||
except NameError:
|
||||
print("no")
|
@@ -0,0 +1,6 @@
|
||||
try:
|
||||
import usys as sys
|
||||
except ImportError:
|
||||
import sys
|
||||
|
||||
print(sys.byteorder)
|
@@ -0,0 +1,5 @@
|
||||
try:
|
||||
complex
|
||||
print("complex")
|
||||
except NameError:
|
||||
print("no")
|
@@ -0,0 +1,2 @@
|
||||
x = const(1)
|
||||
print(x)
|
@@ -0,0 +1,5 @@
|
||||
try:
|
||||
extra_coverage
|
||||
print("coverage")
|
||||
except NameError:
|
||||
print("no")
|
13
components/language/micropython/tests/feature_check/float.py
Normal file
13
components/language/micropython/tests/feature_check/float.py
Normal file
@@ -0,0 +1,13 @@
|
||||
# detect how many bits of precision the floating point implementation has
|
||||
|
||||
try:
|
||||
float
|
||||
except NameError:
|
||||
print(0)
|
||||
else:
|
||||
if float("1.0000001") == float("1.0"):
|
||||
print(30)
|
||||
elif float("1e300") == float("inf"):
|
||||
print(32)
|
||||
else:
|
||||
print(64)
|
@@ -0,0 +1 @@
|
||||
64
|
@@ -0,0 +1,3 @@
|
||||
# check whether f-strings (PEP-498) are supported
|
||||
a = 1
|
||||
print(f"a={a}")
|
@@ -0,0 +1 @@
|
||||
a=1
|
@@ -0,0 +1,2 @@
|
||||
# Check whether arbitrary-precision integers (MPZ) are supported
|
||||
print(1000000000000000000000000000000000000000000000)
|
@@ -0,0 +1 @@
|
||||
1000000000000000000000000000000000000000000000
|
@@ -0,0 +1,8 @@
|
||||
# this test for the availability of native emitter
|
||||
@micropython.native
|
||||
def f():
|
||||
pass
|
||||
|
||||
|
||||
f()
|
||||
print("native")
|
@@ -0,0 +1,3 @@
|
||||
# Check for emacs keys in REPL
|
||||
t = +11
|
||||
t == 2
|
@@ -0,0 +1,7 @@
|
||||
MicroPython \.\+ version
|
||||
Use \.\+
|
||||
>>> # Check for emacs keys in REPL
|
||||
>>> t = \.\+
|
||||
>>> t == 2
|
||||
True
|
||||
>>>
|
@@ -0,0 +1,4 @@
|
||||
# just check if ctrl+w is supported, because it makes sure that
|
||||
# both MICROPY_REPL_EMACS_WORDS_MOVE and MICROPY_REPL_EXTRA_WORDS_MOVE are enabled.
|
||||
t = 1231
|
||||
t == 1
|
@@ -0,0 +1,7 @@
|
||||
MicroPython \.\+ version
|
||||
Use \.\+
|
||||
>>> # Check for emacs keys in REPL
|
||||
>>> t = \.\+
|
||||
>>> t == 2
|
||||
True
|
||||
>>>
|
@@ -0,0 +1,9 @@
|
||||
class Foo:
|
||||
def __radd__(self, other):
|
||||
pass
|
||||
|
||||
|
||||
try:
|
||||
5 + Foo()
|
||||
except TypeError:
|
||||
print("TypeError")
|
@@ -0,0 +1,2 @@
|
||||
# check if set literal syntax is supported
|
||||
print({1})
|
@@ -0,0 +1,5 @@
|
||||
try:
|
||||
slice
|
||||
print("slice")
|
||||
except NameError:
|
||||
print("no")
|
@@ -0,0 +1,6 @@
|
||||
try:
|
||||
import uio
|
||||
|
||||
print("uio")
|
||||
except ImportError:
|
||||
print("no")
|
Reference in New Issue
Block a user