add unittest for calculate sprint

This commit is contained in:
Arpit Temani 2022-09-22 14:28:52 +05:30
parent 17f403e404
commit 623d1ecf12

View file

@ -13,6 +13,7 @@ import (
"github.com/ethereum/go-ethereum/eth"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/p2p/enode"
"github.com/ethereum/go-ethereum/params"
"gotest.tools/assert"
)
@ -150,3 +151,14 @@ func TestValidatorsBlockProduction(t *testing.T) {
assert.Equal(t, authorVal0, nodes[1].AccountManager().Accounts()[0])
}
func TestSprintLengths(t *testing.T) {
testBorConfig := params.TestChainConfig.Bor
testBorConfig.Sprint = map[string]uint64{
"0": 16,
"8": 4,
}
assert.Equal(t, testBorConfig.CalculateSprint(0), 16)
assert.Equal(t, testBorConfig.CalculateSprint(9), 4)
}