kopia lustrzana https://github.com/micropython/micropython-lib
uasyncio.core: test_fair_schedule.py: More checks and iterations.
rodzic
5925aa60e2
commit
bc14f2f6eb
|
@ -4,11 +4,12 @@
|
||||||
import uasyncio.core as asyncio
|
import uasyncio.core as asyncio
|
||||||
|
|
||||||
|
|
||||||
COROS = 5
|
COROS = 10
|
||||||
ITERS = 5
|
ITERS = 20
|
||||||
|
|
||||||
|
|
||||||
result = []
|
result = []
|
||||||
|
test_finished = False
|
||||||
|
|
||||||
|
|
||||||
async def coro(n):
|
async def coro(n):
|
||||||
|
@ -18,10 +19,12 @@ async def coro(n):
|
||||||
|
|
||||||
|
|
||||||
async def done():
|
async def done():
|
||||||
|
global test_finished
|
||||||
while True:
|
while True:
|
||||||
if len(result) == COROS * ITERS:
|
if len(result) == COROS * ITERS:
|
||||||
#print(result)
|
#print(result)
|
||||||
assert result == list(range(COROS)) * ITERS
|
assert result == list(range(COROS)) * ITERS
|
||||||
|
test_finished = True
|
||||||
return
|
return
|
||||||
yield
|
yield
|
||||||
|
|
||||||
|
@ -32,3 +35,5 @@ for n in range(COROS):
|
||||||
loop.create_task(coro(n))
|
loop.create_task(coro(n))
|
||||||
|
|
||||||
loop.run_until_complete(done())
|
loop.run_until_complete(done())
|
||||||
|
|
||||||
|
assert test_finished
|
||||||
|
|
Ładowanie…
Reference in New Issue