1 USING: io io.streams.string kernel namespaces make
2 pack strings tools.test pack.private ;
5 [ B{ 1 0 2 0 0 3 0 0 0 4 0 0 0 0 0 0 0 5 } ] [
12 "cstiq" [ pack-be ] keep unpack-be
15 [ B{ 1 2 0 3 0 0 4 0 0 0 5 0 0 0 0 0 0 0 } ] [
17 { 1 2 3 4 5 } "cstiq" pack-le
23 "cstiq" [ pack-le ] keep unpack-le
26 [ { -1 -2 -3 -4 -5 } ] [
28 "cstiq" [ pack-le ] keep unpack-le
31 [ { -1 -2 -3 -4 -5 3.14 } ] [
32 { -1 -2 -3 -4 -5 3.14 }
33 "cstiqd" [ pack-be ] keep unpack-be
36 [ { -1 -2 -3 -4 -5 } ] [
38 "cstiq" [ pack-native ] keep unpack-native
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 : test-pack ( str -- ba )
54 [ test-pack ] must-infer