You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gods/testutils/testutils.go

19 lines
384 B
Go

package testutils
import "testing"
func SameElements[T comparable](t *testing.T, actual, expected []T) {
if len(actual) != len(expected) {
t.Errorf("Got %d expected %d", len(actual), len(expected))
}
outer:
for _, e := range expected {
for _, a := range actual {
if e == a {
continue outer
}
}
t.Errorf("Did not find expected element %v in %v", e, actual)
}
}