ethash: add isPrivateNetwork test

This commit is contained in:
Chris Purta 2018-07-07 07:46:01 -07:00
parent 68e62fa804
commit 5f4ef4fda2

View file

@ -84,3 +84,21 @@ func TestCalcDifficulty(t *testing.T) {
}
}
}
func TestIsPrivateNetwork(t *testing.T) {
tests := make(map[*big.Int]bool)
tests[big.NewInt(314)] = true
tests[params.MainnetChainConfig.ChainID] = false
tests[params.TestChainConfig.ChainID] = false
tests[params.RinkebyChainConfig.ChainID] = false
for chainID, expected := range tests {
config := &params.ChainConfig{ChainID: chainID}
isPrivate := isPrivateNetwork(config)
if isPrivate != expected {
t.Error("Private chain test failed. Expected", expected, "but determined", isPrivate)
}
}
}