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