forked from TrueCloudLab/frostfs-sdk-go
[#277] netmap: Allow more uint64 config values
NEO VM uses little-endian format for integers, however the resulting byte slice can contain less than 8 bytes. Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
parent
596f43a540
commit
af7e20073b
2 changed files with 37 additions and 2 deletions
28
netmap/network_info_decode_test.go
Normal file
28
netmap/network_info_decode_test.go
Normal file
|
@ -0,0 +1,28 @@
|
|||
package netmap
|
||||
|
||||
import (
|
||||
"math/big"
|
||||
"testing"
|
||||
|
||||
"github.com/nspcc-dev/neo-go/pkg/encoding/bigint"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestDecodeUint64(t *testing.T) {
|
||||
testCases := []uint64{
|
||||
0,
|
||||
12,
|
||||
129,
|
||||
0x1234,
|
||||
0x12345678,
|
||||
0x1234567891011,
|
||||
}
|
||||
|
||||
for _, expected := range testCases {
|
||||
val := bigint.ToBytes(big.NewInt(int64(expected)))
|
||||
|
||||
actual, err := decodeConfigValueUint64(val)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, expected, actual)
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue