diff --git a/utils.go b/utils.go index eb959dc95..3de35fd31 100644 --- a/utils.go +++ b/utils.go @@ -3,7 +3,6 @@ package gobot import ( "math" "math/rand" - "reflect" "time" ) @@ -40,21 +39,6 @@ func Rand(max int) int { return r.Intn(max) } -func Call(thing interface{}, method string, params ...interface{}) []reflect.Value { - in := make([]reflect.Value, len(params)) - for k, param := range params { - in[k] = reflect.ValueOf(param) - } - return reflect.ValueOf(thing).MethodByName(method).Call(in) -} - -func FieldByName(thing interface{}, field string) reflect.Value { - return reflect.ValueOf(thing).FieldByName(field) -} -func FieldByNamePtr(thing interface{}, field string) reflect.Value { - return reflect.ValueOf(thing).Elem().FieldByName(field) -} - func FromScale(input, min, max float64) float64 { return (input - math.Min(min, max)) / (math.Max(min, max) - math.Min(min, max)) } diff --git a/utils_test.go b/utils_test.go index 8be658e0d..8118cb8aa 100644 --- a/utils_test.go +++ b/utils_test.go @@ -62,18 +62,3 @@ func TestRand(t *testing.T) { t.Error(fmt.Sprintf("%v should not equal %v", a, b)) } } - -func TestFieldByName(t *testing.T) { - testInterface := *NewTestStruct() - Expect(t, FieldByName(testInterface, "i").Int(), int64(10)) -} - -func TestFieldByNamePtr(t *testing.T) { - testInterface := NewTestStruct() - Expect(t, FieldByNamePtr(testInterface, "f").Float(), 0.2) -} - -func TestCall(t *testing.T) { - testInterface := NewTestStruct() - Expect(t, Call(testInterface, "Hello", "Human", "How are you?")[0].String(), "Hello Human! How are you?") -}