mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-15 21:29:52 +05:00
Add 1 more case for suppliers sort
This commit is contained in:
committed by
Dan Christian Bogos
parent
cad0d1b4f7
commit
baecd90446
@@ -681,3 +681,67 @@ func TestLibSuppliersSortQOS6(t *testing.T) {
|
||||
utils.ToJSON(eOrderedSpls), utils.ToJSON(sSpls))
|
||||
}
|
||||
}
|
||||
|
||||
func TestLibSuppliersSortQOS7(t *testing.T) {
|
||||
sSpls := &SortedSuppliers{
|
||||
SortedSuppliers: []*SortedSupplier{
|
||||
&SortedSupplier{
|
||||
SupplierID: "supplier1",
|
||||
globalStats: map[string]float64{
|
||||
utils.MetaACD: 1000000,
|
||||
utils.Weight: 15.0,
|
||||
},
|
||||
SupplierParameters: "param1",
|
||||
},
|
||||
&SortedSupplier{
|
||||
SupplierID: "supplier2",
|
||||
globalStats: map[string]float64{
|
||||
utils.MetaACD: 1000000,
|
||||
utils.Weight: 25.0,
|
||||
},
|
||||
SupplierParameters: "param2",
|
||||
},
|
||||
&SortedSupplier{
|
||||
SupplierID: "supplier3",
|
||||
globalStats: map[string]float64{
|
||||
utils.MetaACD: 1000000,
|
||||
utils.Weight: 20.0,
|
||||
},
|
||||
SupplierParameters: "param3",
|
||||
},
|
||||
},
|
||||
}
|
||||
sSpls.SortQOS([]string{utils.MetaACD})
|
||||
eOrderedSpls := &SortedSuppliers{
|
||||
SortedSuppliers: []*SortedSupplier{
|
||||
&SortedSupplier{
|
||||
SupplierID: "supplier2",
|
||||
globalStats: map[string]float64{
|
||||
utils.MetaACD: 1000000,
|
||||
utils.Weight: 25.0,
|
||||
},
|
||||
SupplierParameters: "param2",
|
||||
},
|
||||
&SortedSupplier{
|
||||
SupplierID: "supplier3",
|
||||
globalStats: map[string]float64{
|
||||
utils.MetaACD: 1000000,
|
||||
utils.Weight: 20.0,
|
||||
},
|
||||
SupplierParameters: "param3",
|
||||
},
|
||||
&SortedSupplier{
|
||||
SupplierID: "supplier1",
|
||||
globalStats: map[string]float64{
|
||||
utils.MetaACD: 1000000,
|
||||
utils.Weight: 15.0,
|
||||
},
|
||||
SupplierParameters: "param1",
|
||||
},
|
||||
},
|
||||
}
|
||||
if !reflect.DeepEqual(eOrderedSpls, sSpls) {
|
||||
t.Errorf("Expecting: %s, received: %s",
|
||||
utils.ToJSON(eOrderedSpls), utils.ToJSON(sSpls))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user