tests/extmod: Add test for uasyncio.sleep of a negative time.
It should take 0 time to await on a negative sleep. Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
parent
5f9b105244
commit
20948a3d54
@ -36,8 +36,16 @@ async def main():
|
|||||||
t1 = ticks()
|
t1 = ticks()
|
||||||
await delay_print(0.04, "long")
|
await delay_print(0.04, "long")
|
||||||
t2 = ticks()
|
t2 = ticks()
|
||||||
|
await delay_print(-1, "negative")
|
||||||
|
t3 = ticks()
|
||||||
|
|
||||||
print("took {} {}".format(round(ticks_diff(t1, t0), -1), round(ticks_diff(t2, t1), -1)))
|
print(
|
||||||
|
"took {} {} {}".format(
|
||||||
|
round(ticks_diff(t1, t0), -1),
|
||||||
|
round(ticks_diff(t2, t1), -1),
|
||||||
|
round(ticks_diff(t3, t2), -1),
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
asyncio.run(main())
|
asyncio.run(main())
|
||||||
|
@ -2,4 +2,5 @@ start
|
|||||||
after sleep
|
after sleep
|
||||||
short
|
short
|
||||||
long
|
long
|
||||||
took 20 40
|
negative
|
||||||
|
took 20 40 0
|
||||||
|
Loading…
Reference in New Issue
Block a user