[#688] pkg/ir/governance: Add unsorted test case

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
Pavel Karpy 2021-07-12 18:17:39 +03:00 committed by Alex Vanin
parent bb3f16d487
commit c20eb15bd5

View file

@ -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) {