darned floats

This commit is contained in:
Bel LaPointe
2023-10-25 07:36:44 -06:00
parent 29506b5a04
commit 6cc34f7f42
3 changed files with 32 additions and 20 deletions

24
ledger/deltas_test.go Normal file
View File

@@ -0,0 +1,24 @@
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"][""][""])
}
})
}