Merge branch 'master' of git://factorcode.org/git/factor
[factor/jcg.git] / basis / concurrency / distributed / distributed-tests.factor
blob996e3db4c0dfb6c3ccdfe33f8bd3d3568ee84635
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 ;
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 ;
13 [ ] [ [ "distributed-concurrency-test" temp-file delete-file ] ignore-errors ] unit-test
15 [ ] [ test-node dup (start-node) ] unit-test
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
25 [ 8 ] [
26     5 self 2array
27     "thread-a" test-node <remote-process> send
29     receive
30 ] unit-test
32 [ ] [ test-node stop-node ] unit-test