1 USING: io io.streams.string kernel namespaces make
2 pack 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 } ] [
16 { 1 2 3 4 5 } "cstiq" pack-le
22 "cstiq" [ pack-le ] keep unpack-le
25 [ { -1 -2 -3 -4 -5 } ] [
27 "cstiq" [ pack-le ] keep unpack-le
30 [ { -1 -2 -3 -4 -5 3.14 } ] [
31 { -1 -2 -3 -4 -5 3.14 }
32 "cstiqd" [ pack-be ] keep unpack-be
35 [ { -1 -2 -3 -4 -5 } ] [
37 "cstiq" [ pack-native ] keep unpack-native
41 [ 2 "int" b, ] B{ } make
42 <string-reader> [ "int" read-native ] with-input-stream
45 [ "FRAM" ] [ "FRAM\0" [ read-c-string ] with-string-reader ] unit-test
46 [ f ] [ "" [ read-c-string ] with-string-reader ] unit-test
47 [ 5 ] [ "FRAM\0\u000005\0\0\0\0\0\0\0" [ read-c-string drop read-u64 ] with-string-reader ] unit-test
49 [ 9 ] [ "iic" packed-length ] unit-test
50 [ "iii" read-packed-le ] must-infer
51 [ "iii" read-packed-be ] must-infer
52 [ "iii" read-packed-native ] must-infer
53 [ "iii" unpack-le ] must-infer
54 [ "iii" unpack-be ] must-infer
55 [ "iii" unpack-native ] must-infer