github.com/dim4egster/coreth@v0.10.2/core/state/state_object_test.go (about)

     1  // (c) 2020-2021, Ava Labs, Inc. All rights reserved.
     2  // See the file LICENSE for licensing terms.
     3  
     4  package state
     5  
     6  import (
     7  	"bytes"
     8  	"testing"
     9  
    10  	"github.com/ethereum/go-ethereum/common"
    11  )
    12  
    13  func TestStateObjectPartition(t *testing.T) {
    14  	h1 := common.Hash{}
    15  	NormalizeCoinID(&h1)
    16  
    17  	h2 := common.Hash{}
    18  	NormalizeStateKey(&h2)
    19  
    20  	if bytes.Equal(h1.Bytes(), h2.Bytes()) {
    21  		t.Fatalf("Expected normalized hashes to be unique")
    22  	}
    23  
    24  	h3 := common.Hash([32]byte{0xff})
    25  	NormalizeCoinID(&h3)
    26  
    27  	h4 := common.Hash([32]byte{0xff})
    28  	NormalizeStateKey(&h4)
    29  
    30  	if bytes.Equal(h3.Bytes(), h4.Bytes()) {
    31  		t.Fatal("Expected normalized hashes to be unqiue")
    32  	}
    33  }