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>
pull/6350/head
Damien George 2020-08-20 23:11:44 +10:00
rodzic 5f9b105244
commit 20948a3d54
2 zmienionych plików z 11 dodań i 2 usunięć

Wyświetl plik

@ -36,8 +36,16 @@ async def main():
t1 = ticks()
await delay_print(0.04, "long")
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())

Wyświetl plik

@ -2,4 +2,5 @@ start
after sleep
short
long
took 20 40
negative
took 20 40 0