mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-14 20:59:53 +05:00
Added test to reflect.go in utils
This commit is contained in:
committed by
Dan Christian Bogos
parent
920b304a6f
commit
10192a3fdd
@@ -1560,7 +1560,7 @@ func TestReflectDivideFloat64Error(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestReflectFieldMethodInterfaceMap(t *testing.T) {
|
||||
func TestReflectFieldMethodInterfaceArray(t *testing.T) {
|
||||
obj := []int{2, 3, 5, 7, 11, 13}
|
||||
fldName := "0"
|
||||
result, _ := ReflectFieldMethodInterface(obj, fldName)
|
||||
@@ -1568,3 +1568,22 @@ func TestReflectFieldMethodInterfaceMap(t *testing.T) {
|
||||
t.Errorf("Expected <2> ,received: <%+v>", result)
|
||||
}
|
||||
}
|
||||
|
||||
func TestReflectFieldMethodInterfaceArrayError1(t *testing.T) {
|
||||
obj := []int{2, 3, 5, 7, 11, 13}
|
||||
fldName := "0"
|
||||
result, _ := ReflectFieldMethodInterface(obj, fldName)
|
||||
if !reflect.DeepEqual(result, 2) {
|
||||
t.Errorf("Expected <2> ,received: <%+v>", result)
|
||||
}
|
||||
}
|
||||
|
||||
func TestReflectFieldMethodInterfaceMap(t *testing.T) {
|
||||
var obj = map[string]string{"field1": "val1", "field2": "val2"}
|
||||
fldName := "field1"
|
||||
result, _ := ReflectFieldMethodInterface(obj, fldName)
|
||||
if !reflect.DeepEqual(result, "val1") {
|
||||
t.Errorf("Expected <val1> ,received: <%+v>", result)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user