more validations and tests

This commit is contained in:
Radu Ioan Fericean
2015-05-21 16:38:22 +03:00
parent bb6a7ea6c3
commit 364f74c6c8
2 changed files with 5 additions and 0 deletions

View File

@@ -160,6 +160,9 @@ func (rp *RatingPlan) areRatesSane() bool {
if math.Mod(nextRate.GroupIntervalStart.Seconds(), rate.RateIncrement.Seconds()) != 0 {
return false
}
if rate.RateUnit == 0 || rate.RateIncrement == 0 {
return false
}
}
}
}

View File

@@ -380,10 +380,12 @@ func TestRatingPlanSaneRatingsGoot(t *testing.T) {
&Rate{
GroupIntervalStart: 60 * time.Second,
RateIncrement: 30 * time.Second,
RateUnit: 1 * time.Second,
},
&Rate{
GroupIntervalStart: 0 * time.Second,
RateIncrement: 30 * time.Second,
RateUnit: 1 * time.Second,
},
},
},