forked from TrueCloudLab/frostfs-api-go
[#168] accounting: Implement binary/JSON encoders/decoders on Decimal
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
52fae76533
commit
9bebc1247d
6 changed files with 139 additions and 25 deletions
20
v2/accounting/json_test.go
Normal file
20
v2/accounting/json_test.go
Normal 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)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue