]> gitweb.factorcode.org Git - factor.git/blob - extra/grouping/extras/extras-tests.factor
more test IN: cleanup.
[factor.git] / extra / grouping / extras / extras-tests.factor
1 USING: arrays kernel math math.functions sequences tools.test ;
2
3 { { } } [ { 1 } [ 2array ] 2clump-map ] unit-test
4 { { { 1 2 } } } [ { 1 2 } [ 2array ] 2clump-map ] unit-test
5 { { { 1 2 } { 2 3 } } } [ { 1 2 3 } [ 2array ] 2clump-map ] unit-test
6 { { { 1 2 } { 2 3 } { 3 4 } } } [ { 1 2 3 4 } [ 2array ] 2clump-map ] unit-test
7
8 { { } } [ { 1 } [ 3array ] 3clump-map ] unit-test
9 { { } } [ { 1 2 } [ 3array ] 3clump-map ] unit-test
10 { { { 1 2 3 } } } [ { 1 2 3 } [ 3array ] 3clump-map ] unit-test
11 { { { 1 2 3 } { 2 3 4 } } } [ { 1 2 3 4 } [ 3array ] 3clump-map ] unit-test
12
13 { { } } [ { 1 } [ 4array ] 4 nclump-map ] unit-test
14 { { } } [ { 1 2 } [ 4array ] 4 nclump-map ] unit-test
15 { { { 1 2 3 4 } } } [ { 1 2 3 4 } [ 4array ] 4 nclump-map ] unit-test
16 { { { 1 2 3 4 } { 2 3 4 5 } } } [ { 1 2 3 4 5 } [ 4array ] 4 nclump-map ] unit-test
17
18 { { "tail" "ail" "il" "l" } } [ "tail" tail-clump ] unit-test
19 { { "h" "he" "hea" "head" } } [ "head" head-clump ] unit-test
20
21 { { B{ 97 115 } B{ 100 102 } } } [ "asdf" 2 B{ } group-as ] unit-test
22 { { { 97 115 } { 115 100 } { 100 102 } } } [ "asdf" 2 { } clump-as ] unit-test
23
24 {
25     V{
26         { 0 V{ 0 1 2 } }
27         { 1 V{ 3 4 5 } }
28         { 2 V{ 6 7 8 } }
29         { 3 V{ 9 } } }
30 } [
31     10 <iota> [ 3 / floor ] group-by
32 ] unit-test
33
34 { V{ { t V{ 0 1 2 3 4 5 6 7 8 9 } } } }
35 [ 10 <iota> [ drop t ] group-by ] unit-test
36
37 { V{ } } [ { } [ drop t ] group-by ] unit-test
38
39 { { { } { } { } } } [ { } 3 n-group ] unit-test
40 { { { 1 } { } { } } } [ { 1 } 3 n-group ] unit-test
41 { { { 1 } { 2 } { } } } [ { 1 2 } 3 n-group ] unit-test
42 { { { 1 } { 2 } { 3 } } } [ { 1 2 3 } 3 n-group ] unit-test
43 { { { 1 2 } { 3 } { 4 } } } [ { 1 2 3 4 } 3 n-group ] unit-test