test balances zeroing and unzeroing
This commit is contained in:
@@ -3,6 +3,23 @@ package ledger
|
||||
import "testing"
|
||||
|
||||
func TestDeltas(t *testing.T) {
|
||||
t.Run("balances", func(t *testing.T) {
|
||||
deltas := Deltas{
|
||||
{Name: "a", Value: 0},
|
||||
{Name: "b", Value: 1},
|
||||
{Name: "b", Value: -.999999999999999999999999},
|
||||
{Name: "b", Value: 1.3},
|
||||
}
|
||||
|
||||
balances := deltas.Balances()
|
||||
if len(balances) != 1 {
|
||||
t.Error(len(balances), balances)
|
||||
}
|
||||
if balances["b"][""] != 1.3 {
|
||||
t.Error(balances["b"])
|
||||
}
|
||||
})
|
||||
|
||||
t.Run("register", func(t *testing.T) {
|
||||
deltas := Deltas{
|
||||
{Date: "a", Value: 0.1},
|
||||
|
||||
Reference in New Issue
Block a user