github.com/onflow/flow-go@v0.33.17/fvm/evm/emulator/state/account_test.go (about)

     1  package state_test
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/ethereum/go-ethereum/common"
     7  	"github.com/stretchr/testify/require"
     8  
     9  	"github.com/onflow/flow-go/fvm/evm/emulator/state"
    10  	"github.com/onflow/flow-go/fvm/evm/testutils"
    11  )
    12  
    13  func TestAccountEncoding(t *testing.T) {
    14  	acc := state.NewAccount(
    15  		testutils.RandomCommonAddress(t),
    16  		testutils.RandomBigInt(1000),
    17  		uint64(2),
    18  		common.BytesToHash([]byte{1}),
    19  		[]byte{2},
    20  	)
    21  
    22  	encoded, err := acc.Encode()
    23  	require.NoError(t, err)
    24  
    25  	ret, err := state.DecodeAccount(encoded)
    26  	require.NoError(t, err)
    27  	require.Equal(t, acc, ret)
    28  }