add some counterexamples
This commit is contained in:
parent
d45210432c
commit
b3b8790793
|
@ -690,8 +690,8 @@ func TestValidatorsetKeeper(t *testing.T) {
|
||||||
ctx, _, keeper := createTestInput(t, false, 0)
|
ctx, _, keeper := createTestInput(t, false, 0)
|
||||||
|
|
||||||
total := int64(0)
|
total := int64(0)
|
||||||
amts := []int64{9, 8, 7, 6, 5}
|
amts := []int64{9, 8, 7}
|
||||||
var candidates [5]Candidate
|
var candidates [3]Candidate
|
||||||
for i, amt := range amts {
|
for i, amt := range amts {
|
||||||
candidates[i] = Candidate{
|
candidates[i] = Candidate{
|
||||||
Address: addrVals[i],
|
Address: addrVals[i],
|
||||||
|
@ -705,19 +705,25 @@ func TestValidatorsetKeeper(t *testing.T) {
|
||||||
total += amt
|
total += amt
|
||||||
}
|
}
|
||||||
|
|
||||||
assert.Equal(t, 5, keeper.Size(ctx))
|
assert.Equal(t, 3, keeper.Size(ctx))
|
||||||
|
|
||||||
for _, addr := range addrVals[:5] {
|
for _, addr := range addrVals[:3] {
|
||||||
assert.True(t, keeper.IsValidator(ctx, addr))
|
assert.True(t, keeper.IsValidator(ctx, addr))
|
||||||
}
|
}
|
||||||
for _, addr := range addrVals[5:] {
|
for _, addr := range addrVals[3:] {
|
||||||
assert.False(t, keeper.IsValidator(ctx, addr))
|
assert.False(t, keeper.IsValidator(ctx, addr))
|
||||||
}
|
}
|
||||||
|
|
||||||
for i, can := range candidates {
|
for i, addr := range addrVals[:3] {
|
||||||
index, val := keeper.GetByAddress(ctx, can.Address)
|
index, val := keeper.GetByAddress(ctx, addr)
|
||||||
assert.Equal(t, i, index)
|
assert.Equal(t, i, index)
|
||||||
assert.Equal(t, can.validator().abciValidator(keeper.cdc), *val)
|
assert.Equal(t, candidates[i].validator().abciValidator(keeper.cdc), *val)
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, addr := range addrVals[3:] {
|
||||||
|
index, val := keeper.GetByAddress(ctx, addr)
|
||||||
|
assert.Equal(t, -1, index)
|
||||||
|
assert.Nil(t, val)
|
||||||
}
|
}
|
||||||
|
|
||||||
for i, can := range candidates {
|
for i, can := range candidates {
|
||||||
|
|
Loading…
Reference in New Issue