github.com/palisadeinc/bor@v0.0.0-20230615125219-ab7196213d15/internal/cli/server/service_test.go (about) 1 package server 2 3 import ( 4 "math/big" 5 "testing" 6 7 "github.com/stretchr/testify/assert" 8 9 "github.com/ethereum/go-ethereum/internal/cli/server/proto" 10 ) 11 12 func TestGatherBlocks(t *testing.T) { 13 type c struct { 14 ABlock *big.Int 15 BBlock *big.Int 16 } 17 type d struct { 18 DBlock uint64 19 } 20 val := &c{ 21 BBlock: new(big.Int).SetInt64(1), 22 } 23 val2 := &d{ 24 DBlock: 10, 25 } 26 27 expect := []*proto.StatusResponse_Fork{ 28 { 29 Name: "A", 30 Disabled: true, 31 }, 32 { 33 Name: "B", 34 Block: 1, 35 }, 36 { 37 Name: "D", 38 Block: 10, 39 }, 40 } 41 42 res := gatherForks(val, val2) 43 assert.Equal(t, res, expect) 44 }