neo-go/pkg/core/mpt/helpers_test.go
Anna Shaleva a22b1caa3e core: implement MPT Billet structure for MPT restore
MPT restore process is much simpler then regular MPT maintaining: trie
has a fixed structure, we don't need to remove or rebuild MPT nodes. The
only thing we should do is to replace Hash nodes to their unhashed
counterparts and increment refcount. It's better not to touch the
regular MPT code and create a separate structure for this.
2021-09-07 19:43:27 +03:00

20 lines
423 B
Go

package mpt
import (
"testing"
"github.com/stretchr/testify/require"
)
func TestToNibblesFromNibbles(t *testing.T) {
check := func(t *testing.T, expected []byte) {
actual := fromNibbles(toNibbles(expected))
require.Equal(t, expected, actual)
}
t.Run("empty path", func(t *testing.T) {
check(t, []byte{})
})
t.Run("non-empty path", func(t *testing.T) {
check(t, []byte{0x01, 0xAC, 0x8d, 0x04, 0xFF})
})
}