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