bsc/consensus/parlia/snapshot_test.go

24 lines
457 B
Go
Raw Permalink Normal View History

2020-05-20 11:46:45 +08:00
package parlia
import (
"bytes"
"sort"
"testing"
"github.com/stretchr/testify/assert"
"github.com/ethereum/go-ethereum/common"
)
func TestValidatorSetSort(t *testing.T) {
size := 100
validators := make([]common.Address, size)
for i := 0; i < size; i++ {
validators[i] = randomAddress()
}
sort.Sort(validatorsAscending(validators))
for i := 0; i < size-1; i++ {
assert.True(t, bytes.Compare(validators[i][:], validators[i+1][:]) < 0)
}
}