]> gitweb.factorcode.org Git - factor.git/blob - core/arrays/arrays-tests.factor
git: fix tests
[factor.git] / core / arrays / arrays-tests.factor
1 USING: accessors arrays kernel kernel.private layouts literals
2 math sequences tools.test vectors ;
3
4 [ -2 { "a" "b" "c" } nth ] must-fail
5 [ 10 { "a" "b" "c" } nth ] must-fail
6 [ "hi" -2 { "a" "b" "c" } set-nth ] must-fail
7 [ "hi" 10 { "a" "b" "c" } set-nth ] must-fail
8 { f } [ { "a" "b" "c" } dup clone eq? ] unit-test
9 { "hi" } [ "hi" 1 { "a" "b" "c" } clone [ set-nth ] keep second ] unit-test
10 { V{ "a" "b" "c" } } [ { "a" "b" "c" } >vector ] unit-test
11 { f } [ { "a" "b" "c" } dup >array eq? ] unit-test
12 { t } [ { "a" "b" "c" } dup { } like eq? ] unit-test
13 { t } [ { "a" "b" "c" } dup dup length vector boa underlying>> eq? ] unit-test
14 { V{ "a" "b" "c" } } [ { "a" "b" "c" } V{ } like ] unit-test
15 { { "a" "b" "c" } } [ { "a" } { "b" "c" } append ] unit-test
16 { { "a" "b" "c" "d" "e" } }
17 [ { "a" } { "b" "c" } { "d" "e" } 3append ] unit-test
18
19 [ -1 f <array> ] must-fail
20 [ cell-bits cell log2 - 2^ f <array> ] must-fail
21 ! To big for a fixnum #1045
22 [ 67 2^ 3 <array> ] [
23     ${ KERNEL-ERROR ERROR-OUT-OF-FIXNUM-RANGE 147573952589676412928 f }
24     =
25 ] must-fail-with
26
27 { t } [
28     1 2 2array pair?
29 ] unit-test