Commit f889923b authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 71c356e4
...@@ -31,6 +31,13 @@ func hex(s string) string { ...@@ -31,6 +31,13 @@ func hex(s string) string {
return string(b) return string(b)
} }
// uint16 -> string as encoded on the wire
func u16(v uint16) string {
var b [2]byte
binary.BigEndian.PutUint16(b[:], v)
return string(b[:])
}
// uint32 -> string as encoded on the wire // uint32 -> string as encoded on the wire
func u32(v uint32) string { func u32(v uint32) string {
var b [4]byte var b [4]byte
...@@ -158,14 +165,24 @@ func TestPktMarshal(t *testing.T) { ...@@ -158,14 +165,24 @@ func TestPktMarshal(t *testing.T) {
u64(5) + u64(4) + u64(3) + hex("01"), u64(5) + u64(4) + u64(3) + hex("01"),
}, },
/* // uint32, []uint32
{&PartitionCorrupted{7, []UUID{1,3,9,4}},
u32(7) + u32(4) + u32(1) + u32(3) + u32(9) + u32(4),
},
// uint32, Address, string, float64 // uint32, Address, string, float64
{&RequestIdentification{...}}, // TODO {&RequestIdentification{8, CLIENT, 17, Address{"localhost", 7777}, "myname", 0.12345678},
*/
u32(8) + u32(2) + u32(17) + u32(9) +
"localhost" + u16(7777) +
u32(6) + "myname" +
hex("3fbf9add1091c895"),
},
// TODO float64 (+ nan !nan ...) // TODO special for:
// TODO map <- AnswerLockedTransactions, AnswerObjectUndoSerial, CheckReplicas // - float64 (+ nan !nan ...)
// TODO Address, // - Address,
} }
for _, tt := range testv { for _, tt := range testv {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment