mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-25 12:57:18 +00:00
ae31eed013
* Add store with tests * Rm genesis time * Previous finalized * Go fmt * Update beacon-chain/blockchain/store/type.go Co-authored-by: Raul Jordan <raul@prysmaticlabs.com>
54 lines
1.5 KiB
Go
54 lines
1.5 KiB
Go
package store
|
|
|
|
import (
|
|
"testing"
|
|
|
|
ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1"
|
|
"github.com/prysmaticlabs/prysm/testing/require"
|
|
)
|
|
|
|
func Test_store_PrevJustifiedCheckpt(t *testing.T) {
|
|
s := &store{}
|
|
var cp *ethpb.Checkpoint
|
|
require.Equal(t, cp, s.PrevJustifiedCheckpt())
|
|
cp = ðpb.Checkpoint{Epoch: 1, Root: []byte{'a'}}
|
|
s.SetPrevJustifiedCheckpt(cp)
|
|
require.Equal(t, cp, s.PrevJustifiedCheckpt())
|
|
}
|
|
|
|
func Test_store_BestJustifiedCheckpt(t *testing.T) {
|
|
s := &store{}
|
|
var cp *ethpb.Checkpoint
|
|
require.Equal(t, cp, s.BestJustifiedCheckpt())
|
|
cp = ðpb.Checkpoint{Epoch: 1, Root: []byte{'a'}}
|
|
s.SetBestJustifiedCheckpt(cp)
|
|
require.Equal(t, cp, s.BestJustifiedCheckpt())
|
|
}
|
|
|
|
func Test_store_JustifiedCheckpt(t *testing.T) {
|
|
s := &store{}
|
|
var cp *ethpb.Checkpoint
|
|
require.Equal(t, cp, s.JustifiedCheckpt())
|
|
cp = ðpb.Checkpoint{Epoch: 1, Root: []byte{'a'}}
|
|
s.SetJustifiedCheckpt(cp)
|
|
require.Equal(t, cp, s.JustifiedCheckpt())
|
|
}
|
|
|
|
func Test_store_FinalizedCheckpt(t *testing.T) {
|
|
s := &store{}
|
|
var cp *ethpb.Checkpoint
|
|
require.Equal(t, cp, s.FinalizedCheckpt())
|
|
cp = ðpb.Checkpoint{Epoch: 1, Root: []byte{'a'}}
|
|
s.SetFinalizedCheckpt(cp)
|
|
require.Equal(t, cp, s.FinalizedCheckpt())
|
|
}
|
|
|
|
func Test_store_PrevFinalizedCheckpt(t *testing.T) {
|
|
s := &store{}
|
|
var cp *ethpb.Checkpoint
|
|
require.Equal(t, cp, s.PrevFinalizedCheckpt())
|
|
cp = ðpb.Checkpoint{Epoch: 1, Root: []byte{'a'}}
|
|
s.SetPrevFinalizedCheckpt(cp)
|
|
require.Equal(t, cp, s.PrevFinalizedCheckpt())
|
|
}
|