]> gitweb.factorcode.org Git - factor.git/blob - basis/msgpack/msgpack-tests.factor
functors: inline the parts of interpolate this needs
[factor.git] / basis / msgpack / msgpack-tests.factor
1 USING: io.streams.string kernel math msgpack sequences
2 tools.test ;
3
4 {
5     {
6         +msgpack-nil+
7         f
8         t
9         -1
10         -31
11         128
12         -1152921504606846976
13         1.5
14         1.23434536
15         "hello"
16         { 1 1234 123456789 }
17         H{ { 1 "hello" } { 2 "goodbye" } }
18     }
19 } [
20
21     {
22         "\xc0"
23         "\xc2"
24         "\xc3"
25         "\xff"
26         "\xe1"
27         "\xcc\x80"
28         "\xd3\xf0\x00\x00\x00\x00\x00\x00\x00"
29         "\xcb?\xf8\x00\x00\x00\x00\x00\x00"
30         "\xcb?\xf3\xbf\xe0\xeb\x92\xb5\xa5"
31         "\xa5hello"
32         "\x93\x01\xcd\x04\xd2\xce\x07[\xcd\x15"
33         "\x82\x01\xa5hello\x02\xa7goodbye"
34     } [ msgpack> ] map
35 ] unit-test
36
37 { t } [
38     {
39         +msgpack-nil+
40         f
41         t
42         -1
43         -31
44         128
45         -1152921504606846976
46         1.5
47         1.23434536
48         "hello"
49         { 1 1234 123456789 }
50         H{ { 1 "hello" } { 2 "goodbye" } }
51     } [ dup >msgpack msgpack> = ] all?
52 ] unit-test
53
54 [ 64 2^ >msgpack ] [ cannot-convert? ] must-fail-with