1 USING: alien.c-types io io.streams.string kernel make namespaces
2 pack pack.private strings tools.test ;
4 { B{ 1 0 2 0 0 3 0 0 0 4 0 0 0 0 0 0 0 5 } } [
11 "cstiq" [ pack-be ] keep unpack-be
14 { B{ 1 2 0 3 0 0 4 0 0 0 5 0 0 0 0 0 0 0 } } [
15 { 1 2 3 4 5 } "cstiq" pack-le
20 "cstiq" [ pack-le ] keep unpack-le
23 { { -1 -2 -3 -4 -5 } } [
25 "cstiq" [ pack-le ] keep unpack-le
28 { { -1 -2 -3 -4 -5 3.14 } } [
29 { -1 -2 -3 -4 -5 3.14 }
30 "cstiqd" [ pack-be ] keep unpack-be
33 { { -1 -2 -3 -4 -5 } } [
35 "cstiq" [ pack-native ] keep unpack-native
38 { B{ 1 2 3 4 5 0 0 0 } } [ { 1 2 3 4 5 } "4ci" pack-le ] unit-test
39 { { 1 2 3 4 5 } } [ B{ 1 2 3 4 5 0 0 0 } "4ci" unpack-le ] unit-test
41 { 9 } [ "iic" packed-length ] unit-test
42 [ "iii" read-packed-le ] must-infer
43 [ "iii" read-packed-be ] must-infer
44 [ "iii" read-packed-native ] must-infer
45 [ "iii" unpack-le ] must-infer
46 [ "iii" unpack-be ] must-infer
47 [ "iii" unpack-native ] must-infer
48 [ "iii" pack ] must-infer
49 [ "iii" unpack ] must-infer
51 [ "iii" pack ] must-infer
53 { "c" } [ "1c" expand-pack-format ] unit-test
54 { "cccc" } [ "4c" expand-pack-format ] unit-test
55 { "cccccccccccc" } [ "12c" expand-pack-format ] unit-test
56 { "iccqqq" } [ "1i2c3q" expand-pack-format ] unit-test
58 { B{ 1 0 0 0 } } [ 1 int32_t >n-byte-array ] unit-test