test balances push
This commit is contained in:
19
ledger/balances_test.go
Normal file
19
ledger/balances_test.go
Normal 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"])
|
||||
}
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user