1 IN: concurrency.mailboxes.tests
\r
2 USING: concurrency.mailboxes concurrency.count-downs vectors
\r
3 sequences threads tools.test math kernel strings namespaces
\r
4 continuations calendar destructors ;
\r
6 { 1 1 } [ [ integer? ] mailbox-get? ] must-infer-as
\r
11 [ mailbox-get swap push ] in-thread
\r
12 [ mailbox-get swap push ] in-thread
\r
13 [ mailbox-get swap push ] in-thread
\r
22 [ [ integer? ] mailbox-get? swap push ] in-thread
\r
23 [ [ integer? ] mailbox-get? swap push ] in-thread
\r
24 [ [ integer? ] mailbox-get? swap push ] in-thread
\r
30 [ V{ 1 "junk" 3 "junk2" } [ 456 ] ] [
\r
33 [ [ integer? ] mailbox-get? swap push ] in-thread
\r
34 [ [ integer? ] mailbox-get? swap push ] in-thread
\r
35 [ [ string? ] mailbox-get? swap push ] in-thread
\r
36 [ [ string? ] mailbox-get? swap push ] in-thread
\r
38 "junk" over mailbox-put
\r
39 [ 456 ] over mailbox-put
\r
41 "junk2" over mailbox-put
\r
47 1 <count-down> "c" set
\r
48 1 <count-down> "d" set
\r
52 [ "m" get mailbox-get drop ]
\r
53 [ drop "d" get count-down ] recover
\r
54 ] "Mailbox close test" spawn drop
\r
56 [ ] [ "c" get count-down ] unit-test
\r
57 [ ] [ "m" get dispose ] unit-test
\r
58 [ ] [ "d" get 5 seconds await-timeout ] unit-test
\r
60 [ ] [ "m" get dispose ] unit-test
\r
64 1 <count-down> "c" set
\r
65 1 <count-down> "d" set
\r
69 "m" get wait-for-close
\r
71 ] "Mailbox close test" spawn drop
\r
73 [ ] [ "c" get count-down ] unit-test
\r
74 [ ] [ "m" get dispose ] unit-test
\r
75 [ ] [ "d" get 5 seconds await-timeout ] unit-test
\r
77 [ ] [ "m" get dispose ] unit-test
\r