]> gitweb.factorcode.org Git - factor.git/blob - basis/channels/channels-tests.factor
Reformat
[factor.git] / basis / channels / channels-tests.factor
1 ! Copyright (C) 2005 Chris Double. All Rights Reserved.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: channels kernel sequences sorting threads tools.test ;
4
5 { V{ 10 } } [
6     V{ } clone <channel>
7     [ from swap push ] in-thread
8     10 swap to
9 ] unit-test
10
11 { 20 } [
12     <channel>
13     [ 20 swap to ] in-thread
14     from
15 ] unit-test
16
17 { { 1 2 3 4 } } [
18     V{ } clone <channel>
19     [ from swap push ] in-thread
20     [ from swap push ] in-thread
21     [ from swap push ] in-thread
22     [ from swap push ] in-thread
23     4 over to
24     2 over to
25     1 over to
26     3 swap to
27     natural-sort
28 ] unit-test
29
30 { { 1 2 4 9 } } [
31     V{ } clone <channel>
32     [ 4 swap to ] in-thread
33     [ 2 swap to ] in-thread
34     [ 1 swap to ] in-thread
35     [ 9 swap to ] in-thread
36     2dup from swap push
37     2dup from swap push
38     2dup from swap push
39     dupd from swap push
40     natural-sort
41 ] unit-test