factor/extra/combinators/lib/lib-tests.factor

26 lines
924 B
Factor
Raw Normal View History

USING: combinators.lib kernel math random sequences tools.test continuations
arrays vectors ;
2008-03-01 17:00:45 -05:00
IN: combinators.lib.tests
2007-09-20 18:09:08 -04:00
[ 5 ] [ [ 10 random ] [ 5 = ] generate ] unit-test
[ t ] [ [ 10 random ] [ even? ] generate even? ] unit-test
[ [ 99 ] 1 2 3 4 5 5 nslip ] must-infer
2007-09-20 18:09:08 -04:00
{ 99 1 2 3 4 5 } [ [ 99 ] 1 2 3 4 5 5 nslip ] unit-test
[ 1 2 3 4 5 [ drop drop drop drop drop 2 ] 5 nkeep ] must-infer
2007-09-20 18:09:08 -04:00
{ 2 1 2 3 4 5 } [ 1 2 3 4 5 [ drop drop drop drop drop 2 ] 5 nkeep ] unit-test
[ [ 1 2 3 + ] ] [ 1 2 3 [ + ] 3 ncurry ] unit-test
[ { 1 2 } { 2 4 } { 3 8 } { 4 16 } { 5 32 } ] [ 1 2 3 4 5 [ dup 2^ 2array ] 5 napply ] unit-test
[ [ dup 2^ 2array ] 5 napply ] must-infer
2007-09-20 18:09:08 -04:00
2008-05-15 00:23:12 -04:00
[ { "xyc" "xyd" } ] [ "x" "y" { "c" "d" } [ 3append ] 2 nwith map ] unit-test
[ { "foo" "xbarx" } ]
[
{ "oof" "bar" } { [ reverse ] [ "x" swap "x" 3append ] } parallel-call
] unit-test
2008-03-21 18:48:01 -04:00
{ 1 1 } [
[ even? ] [ drop 1 ] [ drop 2 ] ifte
] must-infer-as