darned floats
This commit is contained in:
24
ledger/deltas_test.go
Normal file
24
ledger/deltas_test.go
Normal 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"][""][""])
|
||||
}
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user