]> gitweb.factorcode.org Git - factor.git/blob - basis/channels/channels-tests.factor
41d5063d785fad90db74bba0576047c5052642a3
[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 !
4 USING: kernel tools.test math channels channels.private 
5 sequences threads sorting ;
6 IN: channels.tests
7
8 { V{ 10 } } [
9     V{ } clone <channel>
10     [ from swap push ] in-thread
11     10 swap to
12 ] unit-test
13
14 { 20 } [
15     <channel>
16     [ 20 swap to ] in-thread
17     from
18 ] unit-test
19
20 { { 1 2 3 4 } } [
21     V{ } clone <channel>
22     [ from swap push ] in-thread
23     [ from swap push ] in-thread
24     [ from swap push ] in-thread
25     [ from swap push ] in-thread
26     4 over to
27     2 over to
28     1 over to
29     3 swap to
30     natural-sort
31 ] unit-test
32
33 { { 1 2 4 9 } } [
34     V{ } clone <channel>
35     [ 4 swap to ] in-thread
36     [ 2 swap to ] in-thread
37     [ 1 swap to ] in-thread
38     [ 9 swap to ] in-thread
39     2dup from swap push
40     2dup from swap push
41     2dup from swap push
42     dupd from swap push
43     natural-sort
44 ] unit-test