mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-12 02:26:26 +05:00
Added tests for engine/rateprofile_test.go
This commit is contained in:
committed by
Dan Christian Bogos
parent
da2a802766
commit
72ffc8dfd9
@@ -674,3 +674,65 @@ func TestRateProfileCostCorrectCost(t *testing.T) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func TestRateProfileCostCorrectCostMinCost(t *testing.T) {
|
||||
testRPC := &RateProfileCost{
|
||||
Cost: 0.5,
|
||||
MinCost: 1.5,
|
||||
}
|
||||
testRPC.CorrectCost(utils.IntPointer(2), "")
|
||||
if testRPC.Cost != 1.5 {
|
||||
t.Errorf("\nExpecting: <1.5>,\n Received: <%+v>", testRPC.Cost)
|
||||
}
|
||||
}
|
||||
|
||||
func TestRateProfileCostCorrectCostMaxCost(t *testing.T) {
|
||||
testRPC := &RateProfileCost{
|
||||
Cost: 2.5,
|
||||
MaxCost: 1.5,
|
||||
}
|
||||
testRPC.CorrectCost(utils.IntPointer(2), "")
|
||||
if testRPC.Cost != 1.5 {
|
||||
t.Errorf("\nExpecting: <1.5>,\n Received: <%+v>", testRPC.Cost)
|
||||
}
|
||||
}
|
||||
|
||||
func TestRateSIncrementCompressEquals(t *testing.T) {
|
||||
rate1 := &Rate{
|
||||
ID: "RATE1",
|
||||
Weight: 0,
|
||||
ActivationTimes: "* * * * *",
|
||||
IntervalRates: []*IntervalRate{
|
||||
{
|
||||
IntervalStart: 0,
|
||||
RecurrentFee: 0.12,
|
||||
Unit: time.Minute,
|
||||
Increment: time.Minute,
|
||||
},
|
||||
{
|
||||
IntervalStart: time.Minute,
|
||||
RecurrentFee: 0.06,
|
||||
Unit: time.Minute,
|
||||
Increment: time.Second,
|
||||
},
|
||||
},
|
||||
}
|
||||
inCr1 := &RateSIncrement{
|
||||
UsageStart: 0,
|
||||
Usage: time.Minute,
|
||||
Rate: rate1,
|
||||
IntervalRateIndex: 0,
|
||||
CompressFactor: 1,
|
||||
}
|
||||
inCr2 := &RateSIncrement{
|
||||
UsageStart: 0,
|
||||
Usage: time.Minute,
|
||||
Rate: rate1,
|
||||
IntervalRateIndex: 0,
|
||||
CompressFactor: 1,
|
||||
}
|
||||
result := inCr1.CompressEquals(inCr2)
|
||||
if result != true {
|
||||
t.Errorf("\nExpecting: <true>,\n Received: <%+v>", result)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user