]> gitweb.factorcode.org Git - factor.git/blob - basis/tuple-arrays/tuple-arrays-tests.factor
7aa49b880fe4239059b0f515b502c2fe4e4a6135
[factor.git] / basis / tuple-arrays / tuple-arrays-tests.factor
1 USING: tuple-arrays sequences tools.test namespaces kernel
2 math accessors ;
3 IN: tuple-arrays.tests
4
5 SYMBOL: mat
6 TUPLE: foo bar ;
7 C: <foo> foo
8 [ 2 ] [ 2 foo <tuple-array> dup mat set length ] unit-test
9 [ T{ foo } ] [ mat get first ] unit-test
10 [ T{ foo f 2 } ] [ T{ foo f 2 } 0 mat get [ set-nth ] keep first ] unit-test
11 [ t ] [ { T{ foo f 1 } T{ foo f 2 } } >tuple-array dup mat set tuple-array? ] unit-test
12 [ T{ foo f 3 } t ] 
13 [ mat get [ bar>> 2 + <foo> ] map [ first ] keep tuple-array? ] unit-test
14
15 [ 2 ] [ 2 foo <tuple-array> dup mat set length ] unit-test
16 [ T{ foo } ] [ mat get first ] unit-test
17 [ T{ foo f 1 } ] [ T{ foo f 1 } 0 mat get [ set-nth ] keep first ] unit-test
18
19 TUPLE: baz { bing integer } bong ;
20 [ 0 ] [ 1 baz <tuple-array> first bing>> ] unit-test
21 [ f ] [ 1 baz <tuple-array> first bong>> ] unit-test