[#168] accounting: Implement binary/JSON encoders/decoders on Decimal

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2020-11-13 13:38:49 +03:00 committed by Alex Vanin
parent 52fae76533
commit 9bebc1247d
6 changed files with 139 additions and 25 deletions

View file

@ -0,0 +1,20 @@
package accounting_test
import (
"testing"
"github.com/nspcc-dev/neofs-api-go/v2/accounting"
"github.com/stretchr/testify/require"
)
func TestDecimalJSON(t *testing.T) {
i := generateDecimal(10)
data, err := i.MarshalJSON()
require.NoError(t, err)
i2 := new(accounting.Decimal)
require.NoError(t, i2.UnmarshalJSON(data))
require.Equal(t, i, i2)
}