The core protocol of WoopChain
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
woop/internal/attack/attack_test.go

27 lines
607 B

6 years ago
package attack
import (
"testing"
"github.com/stretchr/testify/assert"
)
// Simple test for IncorrectResponse
func TestIncorrectResponse(t *testing.T) {
GetInstance().SetAttackEnabled(false)
assert.False(t, GetInstance().IncorrectResponse(), "error")
GetInstance().SetAttackEnabled(true)
}
// Simple test for UpdateConsensusReady
func TestUpdateConsensusReady(t *testing.T) {
model := GetInstance()
model.NodeKilledByItSelf()
model.UpdateConsensusReady(model.ConsensusIDThreshold - 1)
model.DelayResponse()
model.UpdateConsensusReady(model.ConsensusIDThreshold + 1)
model.DelayResponse()
}