github.com/prysmaticlabs/prysm@v1.4.4/beacon-chain/forkchoice/protoarray/node_test.go (about) 1 package protoarray 2 3 import ( 4 "testing" 5 6 types "github.com/prysmaticlabs/eth2-types" 7 "github.com/prysmaticlabs/prysm/shared/testutil/require" 8 ) 9 10 func TestNode_Getters(t *testing.T) { 11 slot := types.Slot(100) 12 root := [32]byte{'a'} 13 parent := uint64(10) 14 jEpoch := types.Epoch(20) 15 fEpoch := types.Epoch(30) 16 weight := uint64(10000) 17 bestChild := uint64(5) 18 bestDescendant := uint64(4) 19 graffiti := [32]byte{'b'} 20 n := &Node{ 21 slot: slot, 22 root: root, 23 parent: parent, 24 justifiedEpoch: jEpoch, 25 finalizedEpoch: fEpoch, 26 weight: weight, 27 bestChild: bestChild, 28 bestDescendant: bestDescendant, 29 graffiti: graffiti, 30 } 31 32 require.Equal(t, slot, n.Slot()) 33 require.Equal(t, root, n.Root()) 34 require.Equal(t, parent, n.Parent()) 35 require.Equal(t, jEpoch, n.JustifiedEpoch()) 36 require.Equal(t, fEpoch, n.FinalizedEpoch()) 37 require.Equal(t, weight, n.Weight()) 38 require.Equal(t, bestChild, n.BestChild()) 39 require.Equal(t, bestDescendant, n.BestDescendant()) 40 require.Equal(t, graffiti, n.Graffiti()) 41 }