aboutsummaryrefslogtreecommitdiffstats
path: root/whisper/sort_test.go
blob: a61fde4c2d41656dae2ae9c4f25aadaece40fd01 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package whisper

import (
    "testing"

    "github.com/ethereum/go-ethereum/common"
)

func TestSorting(t *testing.T) {
    m := map[int32]common.Hash{
        1: {1},
        3: {3},
        2: {2},
        5: {5},
    }
    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])
        }
    }
}