mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
Added tests to statmetrics
This commit is contained in:
committed by
Dan Christian Bogos
parent
9d8bc0f7c6
commit
64e65d70d2
@@ -3222,3 +3222,43 @@ func TestStatMetricsStatDistinctRemEvent(t *testing.T) {
|
||||
t.Errorf("\nExpecting <%+v>,\n Recevied <%+v>", expected, dst)
|
||||
}
|
||||
}
|
||||
|
||||
func TestStatMetricsStatDistinctRemEvent2(t *testing.T) {
|
||||
dst := StatDistinct{
|
||||
FilterIDs: []string{"Test_Filter_ID"},
|
||||
FieldValues: map[string]utils.StringSet{
|
||||
"FieldValue1": {},
|
||||
},
|
||||
Events: map[string]map[string]int64{
|
||||
"Event1": {
|
||||
"FieldValue1": 2,
|
||||
},
|
||||
"Event2": {},
|
||||
},
|
||||
MinItems: 3,
|
||||
FieldName: "Test_Field_Name",
|
||||
Count: 3,
|
||||
}
|
||||
expected := StatDistinct{
|
||||
FilterIDs: []string{"Test_Filter_ID"},
|
||||
FieldValues: map[string]utils.StringSet{
|
||||
"FieldValue1": {},
|
||||
},
|
||||
Events: map[string]map[string]int64{
|
||||
"Event1": {
|
||||
"FieldValue1": 1,
|
||||
},
|
||||
"Event2": {},
|
||||
},
|
||||
MinItems: 3,
|
||||
FieldName: "Test_Field_Name",
|
||||
Count: 2,
|
||||
}
|
||||
err := dst.RemEvent("Event1")
|
||||
if err != nil {
|
||||
t.Errorf("\nExpecting <nil>,\n Recevied <%+v>", err)
|
||||
}
|
||||
if !reflect.DeepEqual(expected, dst) {
|
||||
t.Errorf("\nExpecting <%+v>,\n Recevied <%+v>", expected, dst)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user