rename based on plans
This commit is contained in:
35
ana/legacy_bpi_test.go
Normal file
35
ana/legacy_bpi_test.go
Normal file
@@ -0,0 +1,35 @@
|
||||
package ana
|
||||
|
||||
import (
|
||||
"slices"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"gogs.inhome.blapointe.com/ana-ledger/ledger"
|
||||
)
|
||||
|
||||
func TestBPIPrediction(t *testing.T) {
|
||||
t.Run("fixed growth", func(t *testing.T) {
|
||||
bpis := ledger.BPIs{
|
||||
ledger.USD: ledger.BPI{
|
||||
"2001-01": -1000,
|
||||
"2001-02": 100,
|
||||
},
|
||||
}
|
||||
|
||||
got, err := BPIsWithFixedGrowthPrediction(bpis, time.Hour*24*365, string(ledger.USD), 0.06)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
dates := []string{}
|
||||
for d := range got[ledger.USD] {
|
||||
dates = append(dates, d)
|
||||
}
|
||||
slices.Sort(dates)
|
||||
|
||||
for _, d := range dates {
|
||||
t.Logf("%s | %s %.2f", ledger.USD, d, got[ledger.USD][d])
|
||||
}
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user