github.com/shrimpyuk/bor@v0.2.15-0.20220224151350-fb4ec6020bae/internal/cli/server/service_test.go (about)

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