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