neoneo-go/pkg/core/mpt/helpers_test.go
2020-06-01 18:15:13 +03:00

30 lines
825 B
Go

package mpt
import (
"encoding/hex"
"testing"
"github.com/stretchr/testify/require"
)
func TestToNeoStorageKey(t *testing.T) {
testCases := []struct{ key, res string }{
{
"0102030405060708091011121314151617181920",
"20191817161514131211100908070605040302010000000000000000000000000000000010",
},
{
"010203040506070809101112131415161718192021222324",
"2019181716151413121110090807060504030201212223240000000000000000000000000c",
},
{
"0102030405060708091011121314151617181920212223242526272829303132333435363738",
"20191817161514131211100908070605040302012122232425262728293031323334353600373800000000000000000000000000000e",
},
}
for _, tc := range testCases {
key, _ := hex.DecodeString(tc.key)
res, _ := hex.DecodeString(tc.res)
require.Equal(t, res, ToNeoStorageKey(key))
}
}