package ledger import ( "testing" ) func TestRegisterPrediction(t *testing.T) { t.Run("contribution", func(t *testing.T) { input := newTestRegister() got, err := RegisterWithContributionPrediction(input, .12) if err != nil { t.Fatal(err) } t.Logf("%+v", got) if len(got) != len(input)+1 { t.Error(len(got)) } if _, ok := got["2001-11"]; !ok { t.Error(ok) } t.Error("not impl") }) t.Run("compounding interest", func(t *testing.T) { input := newTestRegister() got, err := RegisterWithCompoundingInterestPrediction(input, 1, "X", .04) if err != nil { t.Fatal(err) } t.Logf("%+v", got) if len(got) <= len(input) { t.Error(len(got)) } t.Error("not impl") }) } func TestBPIPrediction(t *testing.T) { t.Run("fixed growth", func(t *testing.T) { t.Error("not impl") }) } func newTestRegister() map[string]Balances { return map[string]Balances{ "2001-01": Balances{"X": Balance{USD: 1}}, "2001-02": Balances{"X": Balance{USD: 2}}, "2001-03": Balances{"X": Balance{USD: 3}}, "2001-04": Balances{"X": Balance{USD: 4}}, "2001-05": Balances{"X": Balance{USD: 5}}, "2001-06": Balances{"X": Balance{USD: 6}}, "2001-07": Balances{"X": Balance{USD: 8}}, "2001-08": Balances{"X": Balance{USD: 10}}, "2001-09": Balances{"X": Balance{USD: 12}}, "2001-10": Balances{"X": Balance{USD: 16}}, } }