新增select语句

This commit is contained in:
远野千束 2024-10-13 02:06:01 +08:00
parent 4975b19a24
commit efa55473ff

View File

@ -5,22 +5,22 @@ from magicoca import Chan, select
def sp1(chan: Chan[int]): def sp1(chan: Chan[int]):
for i in range(10): for i in range(10):
chan << i chan << i << i * 2
def sp2(chan: Chan[int]): def sp2(chan: Chan[int]):
for i in range(10): for i in range(10):
chan << i chan << i << i * 3
def rp(chans: list[Chan[int]]): def rp(chans: list[Chan[int]]):
rl = [] rl = []
for t in select(*chans): for t in select(*chans):
rl.append(t) rl.append(t)
if len(rl) == 20: if len(rl) == 40:
break break
print(rl) print(rl)
assert len(rl) == 20
class TestSelect: class TestSelect: