Idris2/tests/allschemes/channels002/Main.idr
2022-10-04 10:24:27 +02:00

16 lines
407 B
Idris

import System.Concurrency
-- Test that put/get works for multiple values.
main : IO ()
main =
do c <- makeChannel
t <- fork $ ignore (for [0..2] $ \n => channelPut c n)
v0 <- channelGet c
v1 <- channelGet c
v2 <- channelGet c
threadWait t
if v0 == 0 && v1 == 1 && v2 == 2
then putStrLn "Success!"
else putStrLn "At least one value changed in transmission."