xjdrew / gosproto

sproto in golang

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

pack有问题

spin6lock opened this issue · comments

diff --git a/pack_test.go b/pack_test.go
index bce8824..c9b01aa 100644
--- a/pack_test.go
+++ b/pack_test.go

@@ -31,6 +31,11 @@ var packTestCases []*PackTestCase = []*PackTestCase{
                        []byte{0x00, 0x00},
                }, nil),
        },
+       &PackTestCase{
+               Name:     "FFPack2",
+               Unpacked: []byte{0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E,},
+               Packed:   []byte{0xFF, 0x01, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x00, 0x00},
+       },
 }

这个testcase过不了,参见 issue#44

testcase过不了,是因为 pack是不止依赖一个8bytes的,还可能依赖之后的8bytes。 所以拼接后打包和打包后拼接 出来的结果本来就可能是不一致的。