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