1 IN: concurrency.exchangers.tests
\r
2 USING: tools.test concurrency.exchangers
\r
3 concurrency.count-downs concurrency.promises locals kernel
\r
5 FROM: sequences => 3append ;
\r
7 :: exchanger-test ( -- string )
\r
10 c [ 2 <count-down> ]
\r
17 v1 ", " v2 3append pr fulfill
\r
18 ] "Awaiter" spawn drop
\r
21 "Goodbye world" ex exchange v1! c count-down
\r
22 ] "Exchanger 1" spawn drop
\r
25 "Hello world" ex exchange v2! c count-down
\r
26 ] "Exchanger 2" spawn drop
\r
31 [ "Hello world, Goodbye world" ] [ exchanger-test ] unit-test
\r