From 9fc24e6a1ac49d9d8408d7939950c3b9a42e762a Mon Sep 17 00:00:00 2001 From: ionutboangiu Date: Wed, 3 Mar 2021 13:50:49 +0200 Subject: [PATCH] Test AccountBalancesBackup func in utils/accountprofile.go --- utils/accountprofile_test.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/utils/accountprofile_test.go b/utils/accountprofile_test.go index 1739a71e9..6a147dea7 100644 --- a/utils/accountprofile_test.go +++ b/utils/accountprofile_test.go @@ -19,6 +19,7 @@ along with this program. If not, see package utils import ( + "fmt" "reflect" "testing" "time" @@ -355,3 +356,22 @@ func TestAP_RestoreFromBackup(t *testing.T) { } } } + +func TestAP_AccountBalancesBackup(t *testing.T) { + actPrf := &AccountProfile{ + Balances: map[string]*Balance{ + "testKey": { + Units: &Decimal{decimal.New(1234, 3)}, + }, + }, + } + + actBk := actPrf.AccountBalancesBackup() + for key, value := range actBk { + if actPrf.Balances[key].Units.Big.Cmp(value) != 0 { + fmt.Println(actPrf.Balances[key].Units.Big, value) + t.Errorf("\ngot: <%+v>, \nwant: <%+v>", value, actPrf.Balances[key].Units.Big) + } + } + +}