mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-14 12:49:54 +05:00
Test Sort for acc profiles in utils/accountprofile.go
This commit is contained in:
committed by
Dan Christian Bogos
parent
34cd10ea20
commit
35fa23394a
@@ -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))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user