Skip to content

Commit

Permalink
[#688] pkg/ir/governance: Add unsorted test case
Browse files Browse the repository at this point in the history
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
  • Loading branch information
carpawell authored and alexvanin committed Jul 12, 2021
1 parent bb3f16d commit c20eb15
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions pkg/innerring/processors/governance/list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,19 @@ func TestNewAlphabetList(t *testing.T) {
require.True(t, equalPublicKeyLists(list, rounds[i]))
}
})

t.Run("unsorted keys", func(t *testing.T) {
orig := keys.PublicKeys{k[1], k[2], k[3], k[4]}
main := keys.PublicKeys{k[1], k[2], k[5], k[4]}

exp := make(keys.PublicKeys, len(main))
copy(exp, main)
sort.Sort(exp)

got, err := newAlphabetList(orig, main)
require.NoError(t, err)
require.True(t, equalPublicKeyLists(exp, got)) // expect {1, 2, 4, 5}, not {1, 2, 3, 5}
})
}

func TestUpdateInnerRing(t *testing.T) {
Expand Down

0 comments on commit c20eb15

Please sign in to comment.