github.com/sixexorg/magnetic-ring@v0.0.0-20191119090307-31705a21e419/store/mainchain/extstates/league_account_test.go (about)

     1  package extstates
     2  
     3  import (
     4  	"math/big"
     5  	"testing"
     6  
     7  	"github.com/magiconair/properties/assert"
     8  	"github.com/sixexorg/magnetic-ring/common"
     9  	"github.com/sixexorg/magnetic-ring/store/orgchain/states"
    10  )
    11  
    12  func TestAccountState_Hash(t *testing.T) {
    13  	add := common.Address{1, 2, 3}
    14  	h := uint64(20)
    15  	nonce := uint64(1)
    16  	bal := big.NewInt(20)
    17  	energy := big.NewInt(2000)
    18  	bonus := uint64(20)
    19  	as := &states.AccountState{
    20  		Address: add,
    21  		Height:  h,
    22  		Data: &states.Account{
    23  			Nonce:       nonce,
    24  			Balance:     bal,
    25  			EnergyBalance: energy,
    26  			BonusHeight: bonus,
    27  		},
    28  	}
    29  	las := LeagueAccountState{
    30  		Address: add,
    31  		Height:  h,
    32  		Data: &Account{
    33  			Nonce:       nonce,
    34  			Balance:     bal,
    35  			EnergyBalance: energy,
    36  			BonusHeight: bonus,
    37  		},
    38  	}
    39  	assert.Equal(t, as.Hash(), las.Hash())
    40  
    41  }