]> gitweb.factorcode.org Git - factor.git/blob - basis/combinators/smart/smart-tests.factor
Delete empty unit tests files, remove 1- and 1+, reorder IN: lines in a lot of places...
[factor.git] / basis / combinators / smart / smart-tests.factor
1 ! Copyright (C) 2009 Doug Coleman.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: tools.test combinators.smart math kernel accessors ;
4 IN: combinators.smart.tests
5
6 : test-bi ( -- 9 11 )
7     10 [ 1 - ] [ 1 + ] bi ;
8
9 [ [ test-bi ] output>array ] must-infer
10 [ { 9 11 } ] [ [ test-bi ] output>array ] unit-test
11
12 [ { 9 11 } [ + ] input<sequence ] must-infer
13 [ 20 ] [ { 9 11 } [ + ] input<sequence ] unit-test
14
15 [ 6 ] [ [ 1 2 3 ] [ + ] reduce-outputs ] unit-test
16
17 [ [ 1 2 3 ] [ + ] reduce-outputs ] must-infer
18
19 [ 6 ] [ [ 1 2 3 ] sum-outputs ] unit-test
20
21 [ "ab" ]
22 [
23     [ "a" "b" ] "" append-outputs-as
24 ] unit-test
25
26 [ "" ]
27 [
28     [ ] "" append-outputs-as
29 ] unit-test
30
31 [ { } ]
32 [
33     [ ] append-outputs
34 ] unit-test
35
36 [ B{ 1 2 3 } ]
37 [
38     [ { 1 } { 2 } { 3 } ] B{ } append-outputs-as
39 ] unit-test
40
41 ! Test nesting
42 : nested-smart-combo-test ( -- array )
43     [ [ 1 2 ] output>array [ 3 4 ] output>array ] output>array ;
44
45 \ nested-smart-combo-test def>> must-infer
46
47 [ { { 1 2 } { 3 4 } } ] [ nested-smart-combo-test ] unit-test
48
49 [ 14 ] [ [ 1 2 3 ] [ sq ] [ + ] map-reduce-outputs ] unit-test