func verifyTerms(t *testing.T, terms []*Term, balance currency.Amount) { prevBalance := balance.Int64() for _, term := range terms { verifyTerm(t, term) balance := term.Balance().Int64() if prevBalance-term.Principal().Int64() != balance { t.Error("Balance wrong") } prevBalance = balance } if prevBalance != 0 { t.Error("Final balance not zero.") } }