]> gitweb.factorcode.org Git - factor.git/blob - basis/concurrency/distributed/distributed-tests.factor
Merge branch 'master' into experimental
[factor.git] / basis / concurrency / distributed / distributed-tests.factor
1 IN: concurrency.distributed.tests
2 USING: tools.test concurrency.distributed kernel io.files
3 io.files.temp io.directories arrays io.sockets system
4 combinators threads math sequences concurrency.messaging
5 continuations accessors prettyprint ;
6
7 : test-node ( -- addrspec )
8     {
9         { [ os unix? ] [ "distributed-concurrency-test" temp-file <local> ] }
10         { [ os windows? ] [ "127.0.0.1" 1238 <inet4> ] }
11     } cond ;
12
13 [ ] [ [ "distributed-concurrency-test" temp-file delete-file ] ignore-errors ] unit-test
14
15 [ ] [ test-node dup (start-node) ] unit-test
16
17 [ ] [
18     [
19         receive first2 [ 3 + ] dip send
20         "thread-a" unregister-process
21     ] "Thread A" spawn
22     "thread-a" swap register-process
23 ] unit-test
24
25 [ 8 ] [
26     5 self 2array
27     "thread-a" test-node <remote-process> send
28
29     receive
30 ] unit-test
31
32 [ ] [ test-node stop-node ] unit-test