mirror of
https://github.com/micropython/micropython.git
synced 2025-09-07 18:30:27 +02:00
This is just to test that the function exists and returns some kind of valid value. Although this file is for testing ms/us functions, put the ticks_cpu() test here so not to add a new test file.
15 lines
411 B
Python
15 lines
411 B
Python
import utime
|
|
try:
|
|
utime.sleep_ms
|
|
except AttributeError:
|
|
print("SKIP")
|
|
raise SystemExit
|
|
|
|
utime.sleep_ms(1)
|
|
utime.sleep_us(1)
|
|
print(utime.ticks_diff(utime.ticks_ms(), utime.ticks_ms()) <= 1)
|
|
print(utime.ticks_diff(utime.ticks_us(), utime.ticks_us()) <= 500)
|
|
|
|
# ticks_cpu may not be implemented, at least make sure it doesn't decrease
|
|
print(utime.ticks_diff(utime.ticks_cpu(), utime.ticks_cpu()) >= 0)
|