2022-04-20 16:12:55 +00:00
|
|
|
package testhelpers
|
|
|
|
|
|
|
|
import (
|
2022-04-22 12:28:01 +00:00
|
|
|
"fmt"
|
2022-04-20 16:12:55 +00:00
|
|
|
"reflect"
|
|
|
|
)
|
|
|
|
|
|
|
|
// ExpectEqual asserts the provided interfaces are deep equal
|
2022-04-22 12:28:01 +00:00
|
|
|
func IsEqual(got interface{}, want interface{}) (bool, error) {
|
2022-04-20 16:12:55 +00:00
|
|
|
if !reflect.DeepEqual(got, want) {
|
2022-04-22 12:28:01 +00:00
|
|
|
return false, fmt.Errorf("Expected: %v\nActual: %v", want, got)
|
2022-04-20 16:12:55 +00:00
|
|
|
}
|
2022-04-22 12:28:01 +00:00
|
|
|
return true, nil
|
2022-04-20 16:12:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// ListContainsString used to check if a list of strings contains a particular string
|
|
|
|
func ListContainsString(sss []string, s string) bool {
|
|
|
|
for _, str := range sss {
|
|
|
|
if s == str {
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false
|
|
|
|
}
|