|
|
@@ -50,6 +50,9 @@ func testVersionDecodable(t *testing.T, name string, out versionedDecoder, in []
|
|
|
}
|
|
|
|
|
|
func testRequest(t *testing.T, name string, rb protocolBody, expected []byte) {
|
|
|
+ if !rb.requiredVersion().IsAtLeast(MinVersion) {
|
|
|
+ t.Errorf("Request %s has invalid required version", name)
|
|
|
+ }
|
|
|
packet := testRequestEncode(t, name, rb, expected)
|
|
|
testRequestDecode(t, name, rb, packet)
|
|
|
}
|
|
|
@@ -76,6 +79,8 @@ func testRequestDecode(t *testing.T, name string, rb protocolBody, packet []byte
|
|
|
t.Error(spew.Sprintf("Decoded request %q does not match the encoded one\nencoded: %+v\ndecoded: %+v", name, rb, decoded.body))
|
|
|
} else if n != len(packet) {
|
|
|
t.Errorf("Decoded request %q bytes: %d does not match the encoded one: %d\n", name, n, len(packet))
|
|
|
+ } else if rb.version() != decoded.body.version() {
|
|
|
+ t.Errorf("Decoded request %q version: %d does not match the encoded one: %d\n", name, decoded.body.version(), rb.version())
|
|
|
}
|
|
|
}
|
|
|
|