bsc/consensus/parlia/snapshot_test.go

24 lines
457 B
Go
Raw Normal View History

2020-05-20 06:46:45 +03: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)
}
}