1 USING: accessors arrays kernel kernel.private math namespaces
2 sequences sequences.private strings tools.test vectors
3 continuations random growable classes ;
6 [ ] [ 10 [ [ -1000000 <vector> ] ignore-errors ] times ] unit-test
8 [ 3 ] [ [ t f t ] length ] unit-test
9 [ 3 ] [ V{ t f t } length ] unit-test
11 [ -3 V{ } nth ] must-fail
12 [ 3 V{ } nth ] must-fail
13 [ 3 54.3 nth ] must-fail
15 [ "hey" [ 1 2 ] set-length ] must-fail
16 [ "hey" V{ 1 2 } set-length ] must-fail
18 [ 3 ] [ 3 0 <vector> [ set-length ] keep length ] unit-test
20 "yo" 4 1 <vector> [ set-nth ] keep 4 swap nth
23 [ 1 V{ } nth ] must-fail
24 [ -1 V{ } set-length ] must-fail
25 [ V{ } ] [ [ ] >vector ] unit-test
26 [ V{ 1 2 } ] [ [ 1 2 ] >vector ] unit-test
29 100 [ 100 random ] V{ } replicate-as
33 [ f ] [ V{ } V{ 1 2 3 } = ] unit-test
34 [ f ] [ V{ 1 2 } V{ 1 2 3 } = ] unit-test
35 [ f ] [ [ 1 2 ] V{ 1 2 3 } = ] unit-test
36 [ f ] [ V{ 1 2 } [ 1 2 3 ] = ] unit-test
41 >vector [ dup * ] map >array
44 [ t ] [ V{ } hashcode V{ } hashcode = ] unit-test
45 [ t ] [ V{ 1 2 3 } hashcode V{ 1 2 3 } hashcode = ] unit-test
46 [ t ] [ V{ 1 V{ 2 } 3 } hashcode V{ 1 V{ 2 } 3 } hashcode = ] unit-test
47 [ t ] [ V{ } hashcode V{ } hashcode = ] unit-test
49 [ V{ 1 2 3 } V{ 1 2 3 4 5 6 } ]
50 [ V{ 1 2 3 } dup V{ 4 5 6 } append ] unit-test
52 [ V{ 1 2 3 4 } ] [ [ V{ 1 } [ 2 ] V{ 3 4 } ] concat ] unit-test
54 [ V{ } ] [ V{ } 0 tail ] unit-test
55 [ V{ } ] [ V{ 1 2 } 2 tail ] unit-test
56 [ V{ 3 4 } ] [ V{ 1 2 3 4 } 2 tail ] unit-test
58 [ V{ 3 } ] [ V{ 1 2 3 } 1 tail* ] unit-test
60 0 <vector> "funny-stack" set
62 [ ] [ V{ 1 5 } "funny-stack" get push ] unit-test
63 [ ] [ V{ 2 3 } "funny-stack" get push ] unit-test
64 [ V{ 2 3 } ] [ "funny-stack" get pop ] unit-test
65 [ V{ 1 5 } ] [ "funny-stack" get peek ] unit-test
66 [ V{ 1 5 } ] [ "funny-stack" get pop ] unit-test
67 [ "funny-stack" get pop ] must-fail
68 [ "funny-stack" get pop ] must-fail
69 [ ] [ "funky" "funny-stack" get push ] unit-test
70 [ "funky" ] [ "funny-stack" get pop ] unit-test
73 V{ 1 2 3 4 } dup underlying>> length
74 [ clone underlying>> length ] dip
79 V{ 1 2 3 4 } dup clone
80 [ underlying>> ] bi@ eq?
90 [ f ] [ 5 V{ } index ] unit-test
91 [ 4 ] [ 5 V{ 1 2 3 4 5 } index ] unit-test
94 100 >array dup >vector <reversed> >array [ reverse ] dip =
97 [ fixnum ] [ 1 >bignum V{ } new-sequence length class ] unit-test
99 [ fixnum ] [ 1 >bignum [ ] V{ } map-as length class ] unit-test