25 lines
456 B
Go
25 lines
456 B
Go
package ledger
|
|
|
|
import "testing"
|
|
|
|
func TestDeltas(t *testing.T) {
|
|
t.Run("register", func(t *testing.T) {
|
|
deltas := Deltas{
|
|
{Date: "a", Value: 0.1},
|
|
{Date: "a", Value: 2.2},
|
|
{Date: "b", Value: 4.3},
|
|
}
|
|
got := deltas.Register()
|
|
t.Logf("%+v", got)
|
|
if len(got) != 2 {
|
|
t.Error(len(got))
|
|
}
|
|
if int(10*got["a"][""][""]) != 23 {
|
|
t.Error(got["a"][""][""])
|
|
}
|
|
if int(10*got["b"][""][""]) != 66 {
|
|
t.Error(got["b"][""][""])
|
|
}
|
|
})
|
|
}
|