2014-12-08 05:43:33 -06:00
|
|
|
package whisper
|
|
|
|
|
2015-03-20 18:57:18 -05:00
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/ethereum/go-ethereum/common"
|
|
|
|
)
|
2014-12-08 05:43:33 -06:00
|
|
|
|
|
|
|
func TestSorting(t *testing.T) {
|
2015-03-20 18:57:18 -05:00
|
|
|
m := map[int32]common.Hash{
|
|
|
|
1: {1},
|
|
|
|
3: {3},
|
|
|
|
2: {2},
|
|
|
|
5: {5},
|
2014-12-08 05:43:33 -06:00
|
|
|
}
|
|
|
|
exp := []int32{1, 2, 3, 5}
|
|
|
|
res := sortKeys(m)
|
|
|
|
for i, k := range res {
|
|
|
|
if k != exp[i] {
|
|
|
|
t.Error(k, "failed. Expected", exp[i])
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|