]> gitweb.factorcode.org Git - factor.git/blob - extra/binhex/binhex-tests.factor
Support Link Time Optimization (off by default)
[factor.git] / extra / binhex / binhex-tests.factor
1 USING: binhex binhex.private io.encodings.binary
2 io.streams.byte-array kernel sequences strings tools.test ;
3
4 { 0x0000 } [ "" crc16-binhex ] unit-test
5 { 0x58e5 } [ "A" crc16-binhex ] unit-test
6 { 0x31c3 } [ "123456789" crc16-binhex ] unit-test
7 { 0xabe3 } [ 256 CHAR: A <string> crc16-binhex ] unit-test
8
9 { B{ 0x41 0x90 0x64 0x42 0x43 0x90 0xff 0x43 0x90 0x2d } } [
10     100 CHAR: A <string>
11     "B"
12     300 CHAR: C <string> 3append
13     rle90-encode
14 ] unit-test
15
16 { B{ 0x2B 0x90 0x90 0x90 0x90 0x90 } } [
17     B{ 0x2B 0x90 0x00 0x90 0x05 } rle90-decode
18 ] unit-test
19
20 { B{ 0x34 0xe3 0xd0 } } [ "0123" hqx-decode ] unit-test
21
22 { "0123" } [ B{ 0x34 0xe3 0xd0 } hqx-encode >string ] unit-test
23
24 { t } [
25     T{ binhex f "test.txt" 0 0 0 B{ 1 2 3 4 } f }
26     dup
27     binary [ write-binhex ] with-byte-writer
28     binary [ read-binhex ] with-byte-reader
29     =
30 ] unit-test