test balances push

This commit is contained in:
Bel LaPointe
2023-10-25 07:16:42 -06:00
parent 29fec124af
commit a76e7b5546
4 changed files with 60 additions and 0 deletions

19
ledger/balances_test.go Normal file
View File

@@ -0,0 +1,19 @@
package ledger
import "testing"
func TestBalances(t *testing.T) {
t.Run("push", func(t *testing.T) {
b := make(Balances)
b.Push(Delta{Name: "x", Currency: "y", Value: 0.1})
b.Push(Delta{Name: "x", Currency: "y", Value: 1.2})
b.Push(Delta{Name: "x", Currency: "z", Value: 2.3})
ba := b["x"]
if ba["y"] != 1.3 {
t.Error(ba["y"])
}
if ba["z"] != 2.3 {
t.Error(ba["z"])
}
})
}