]> gitweb.factorcode.org Git - factor.git/blob - core/io/binary/binary-tests.factor
build.sh: Don't copy the factor.image to factor.image.fresh if bootstrap fails
[factor.git] / core / io / binary / binary-tests.factor
1 USING: io.binary tools.test classes math ;
2 IN: io.binary.tests
3
4 { 0x03020100 } [ B{ 0 1 2 3 } le> ] unit-test
5 { 0x00010203 } [ B{ 0 1 2 3 } be> ] unit-test
6
7 { 0x332211 } [
8     B{ 0x11 0x22 0x33 } le>
9 ] unit-test
10
11 { 0x04030201 } [ B{ 1 2 3 4 } signed-le> ] unit-test
12 { 0x01020304 } [ B{ 1 2 3 4 } signed-be> ] unit-test
13
14 { -12 } [ B{ 0xf4 0xff 0xff 0xff } signed-le> ] unit-test
15 { -12 } [ B{ 0xff 0xff 0xff 0xf4 } signed-be> ] unit-test
16
17 { 0x7a2c793b2ff08554 } [
18     B{ 0x54 0x85 0xf0 0x2f 0x3b 0x79 0x2c 0x7a } le>
19 ] unit-test
20
21 { 0x988a259c3433f237 } [
22     B{ 0x37 0xf2 0x33 0x34 0x9c 0x25 0x8a 0x98 } le>
23 ] unit-test
24
25 { B{ 0 0 4 0xd2 } } [ 1234 4 >be ] unit-test
26 { B{ 0 0 0 0 0 0 4 0xd2 } } [ 1234 8 >be ] unit-test
27 { B{ 0xd2 4 0 0 } } [ 1234 4 >le ] unit-test
28 { B{ 0xd2 4 0 0 0 0 0 0 } } [ 1234 8 >le ] unit-test
29
30 { 1234 } [ 1234 4 >be be> ] unit-test
31 { 1234 } [ 1234 4 >le le> ] unit-test
32
33 { fixnum } [ B{ 0 0 0 0 0 0 0 0 0 0 } be> class-of ] unit-test
34
35 { 0x56780000 0x12340000 } [ 0x1234000056780000 d>w/w ] unit-test
36 { 0x5678 0x1234 } [ 0x12345678 w>h/h ] unit-test
37 { 0x34 0x12 } [ 0x1234 h>b/b ] unit-test