From 36aa85d842cc2daf684f9ce8f5dfacaf66cf548f Mon Sep 17 00:00:00 2001 From: ionutboangiu Date: Thu, 4 Mar 2021 17:12:06 +0200 Subject: [PATCH] Test Sort for balances in utils/accountprofile.go --- utils/accountprofile_test.go | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/utils/accountprofile_test.go b/utils/accountprofile_test.go index 521996313..cb60cec91 100644 --- a/utils/accountprofile_test.go +++ b/utils/accountprofile_test.go @@ -408,7 +408,7 @@ func TestAPNewDefaultBalance(t *testing.T) { } } -func TestAPSort(t *testing.T) { +func TestAPApsSort(t *testing.T) { apS := AccountProfilesWithWeight{ { @@ -612,3 +612,34 @@ func TestAPTenantIDs(t *testing.T) { t.Errorf("\nReceived: <%v>, \nExpected: <%+v>", received, expected) } } + +func TestAPBlcsSort(t *testing.T) { + + blncS := BalancesWithWeight{ + { + Weight: 2, + }, + { + Weight: 1, + }, + { + Weight: 3, + }, + } + expected := BalancesWithWeight{ + { + Weight: 3, + }, + { + Weight: 2, + }, + { + Weight: 1, + }, + } + + blncS.Sort() + if !reflect.DeepEqual(blncS, expected) { + t.Errorf("\nReceived: <%+v>, \nExpected: <%+v>", ToJSON(blncS), ToJSON(expected)) + } +}