Actually fix out of order decoding
This commit is contained in:
parent
ccb729d219
commit
e1905e13ce
2 changed files with 36 additions and 9 deletions
|
|
@ -101,6 +101,19 @@ suite "Test Varint Encoding":
|
|||
let obj = Test3(g: 300, h: 200, i: Test1(a: 100, b: "this is a test"), j: "testing")
|
||||
|
||||
proto.encode(obj)
|
||||
var output = proto.output
|
||||
let decoded = output.decode(Test3)
|
||||
assert decoded == obj
|
||||
|
||||
test "Can encode/decode out of order object":
|
||||
var proto = newProtoBuffer()
|
||||
|
||||
let obj = Test3(g: 400, h: 100, i: Test1(a: 100, b: "this is a test"), j: "testing")
|
||||
proto.encodeField(2, 100)
|
||||
proto.encodeField(4, "testing")
|
||||
proto.encodeField(1, 400)
|
||||
proto.encodeField(3, Test1(a: 100, b: "this is a test"))
|
||||
|
||||
var output = proto.output
|
||||
let decoded = output.decode(Test3)
|
||||
assert decoded == obj
|
||||
Loading…
Add table
Add a link
Reference in a new issue