Test Sort for acc profiles in utils/accountprofile.go

This commit is contained in:
ionutboangiu
2021-03-04 13:33:19 +02:00
committed by Dan Christian Bogos
parent 34cd10ea20
commit 35fa23394a

View File

@@ -371,7 +371,6 @@ func TestAPAccountBalancesBackup(t *testing.T) {
t.Errorf("\ngot: <%+v>, \nwant: <%+v>", value, actPrf.Balances[key].Units.Big)
}
}
}
func TestAPNewDefaultBalance(t *testing.T) {
@@ -408,3 +407,34 @@ func TestAPNewDefaultBalance(t *testing.T) {
t.Errorf("\nReceived: <%+v>,\nExpected: <%+v>", received, expected)
}
}
func TestAPSort(t *testing.T) {
apS := AccountProfilesWithWeight{
{
Weight: 2,
},
{
Weight: 1,
},
{
Weight: 3,
},
}
expected := AccountProfilesWithWeight{
{
Weight: 3,
},
{
Weight: 2,
},
{
Weight: 1,
},
}
apS.Sort()
if !reflect.DeepEqual(apS, expected) {
t.Errorf("\nReceived: <%+v>, \nExpected: <%+v>", ToJSON(apS), ToJSON(expected))
}
}