[#168] refs: Implement binary/JSON encoders/decoders on Version

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2020-11-13 16:19:16 +03:00 committed by Alex Vanin
parent 9ec57ee9f8
commit 1519a02d63
6 changed files with 103 additions and 4 deletions

View file

@ -111,16 +111,14 @@ func TestSignature_StableMarshal(t *testing.T) {
func TestVersion_StableMarshal(t *testing.T) {
versionFrom := generateVersion(2, 0)
transport := new(grpc.Version)
t.Run("non empty", func(t *testing.T) {
wire, err := versionFrom.StableMarshal(nil)
require.NoError(t, err)
err = goproto.Unmarshal(wire, transport)
require.NoError(t, err)
versionTo := new(refs.Version)
require.NoError(t, versionTo.Unmarshal(wire))
versionTo := refs.VersionFromGRPCMessage(transport)
require.Equal(t, versionFrom, versionTo)
})
}