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