ana-ledger/ledger/balances_test.go

20 lines
401 B
Go

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"])
}
})
}