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

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2020-11-13 15:58:53 +03:00 committed by Alex Vanin
parent 9325e22871
commit 4ce751f13c
7 changed files with 114 additions and 33 deletions

20
v2/refs/json_test.go Normal file
View file

@ -0,0 +1,20 @@
package refs_test
import (
"testing"
"github.com/nspcc-dev/neofs-api-go/v2/refs"
"github.com/stretchr/testify/require"
)
func TestAddressJSON(t *testing.T) {
a := generateAddress([]byte{1}, []byte{2})
data, err := a.MarshalJSON()
require.NoError(t, err)
a2 := new(refs.Address)
require.NoError(t, a2.UnmarshalJSON(data))
require.Equal(t, a, a2)
}