mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-24 12:27:18 +00:00
5507558678
* Refactor to unify state getters block tests * Add reference tests to Altair and Bellatrix versions ofthe state * Fix function naming convetion * Add state-native/v2/references_test.go and state-native/v3/references_test.go * Gazelle run Co-authored-by: Radosław Kapka <rkapka@wp.pl>
46 lines
1.2 KiB
Go
46 lines
1.2 KiB
Go
package v1
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/prysmaticlabs/prysm/beacon-chain/state"
|
|
testtmpl "github.com/prysmaticlabs/prysm/beacon-chain/state/testing"
|
|
ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1"
|
|
)
|
|
|
|
func TestBeaconState_LatestBlockHeader(t *testing.T) {
|
|
testtmpl.VerifyBeaconStateLatestBlockHeader(
|
|
t,
|
|
func() (state.BeaconState, error) {
|
|
return InitializeFromProto(ðpb.BeaconState{})
|
|
},
|
|
func(BH *ethpb.BeaconBlockHeader) (state.BeaconState, error) {
|
|
return InitializeFromProto(ðpb.BeaconState{LatestBlockHeader: BH})
|
|
},
|
|
)
|
|
}
|
|
|
|
func TestBeaconState_BlockRoots(t *testing.T) {
|
|
testtmpl.VerifyBeaconStateBlockRoots(
|
|
t,
|
|
func() (state.BeaconState, error) {
|
|
return InitializeFromProto(ðpb.BeaconState{})
|
|
},
|
|
func(BR [][]byte) (state.BeaconState, error) {
|
|
return InitializeFromProto(ðpb.BeaconState{BlockRoots: BR})
|
|
},
|
|
)
|
|
}
|
|
|
|
func TestBeaconState_BlockRootAtIndex(t *testing.T) {
|
|
testtmpl.VerifyBeaconStateBlockRootAtIndex(
|
|
t,
|
|
func() (state.BeaconState, error) {
|
|
return InitializeFromProto(ðpb.BeaconState{})
|
|
},
|
|
func(BR [][]byte) (state.BeaconState, error) {
|
|
return InitializeFromProto(ðpb.BeaconState{BlockRoots: BR})
|
|
},
|
|
)
|
|
}
|