]> gitweb.factorcode.org Git - factor.git/blob - core/byte-arrays/byte-arrays-tests.factor
985df28460990d5bff6cc3033170f65fd48007e2
[factor.git] / core / byte-arrays / byte-arrays-tests.factor
1 USING: byte-arrays kernel math sequences sequences.private\r
2 tools.test ;\r
3 IN: byte-arrays.tests\r
4 \r
5 [ 6 B{ 1 2 3 } ] [\r
6     6 B{ 1 2 3 } resize-byte-array\r
7     [ length ] [ 3 head ] bi\r
8 ] unit-test\r
9 \r
10 [ B{ 1 2 } ] [ 2 B{ 1 2 3 4 5 6 7 8 9 } resize-byte-array ] unit-test\r
11 \r
12 [ -10 B{ } resize-byte-array ] must-fail\r
13 \r
14 [ B{ 123 } ] [ 123 1byte-array ] unit-test\r
15 \r
16 [ B{ 123 } ] [ 123 0 B{ 0 } [ set-nth ] keep ] unit-test\r
17 \r
18 [ B{ 123 } ] [ 123 >bignum 0 B{ 0 } [ set-nth ] keep ] unit-test\r
19 \r
20 [ 1.5 B{ 1 2 3 } nth-unsafe ] must-fail\r
21 [ 0 1.5 B{ 1 2 3 } set-nth-unsafe ] must-fail\r