mirror of
https://github.com/emirpasic/gods.git
synced 2026-06-14 16:06:42 +03:00
14f714261f
* Generics migration This attempts to migrate this library in the least invasive way by preserving as much of the original API as possible. It does not change the tests in a meaningful way nor does it attempt to upgrade any logic that can be simplified or improved with generics. This is purely an API migration, and still requires a lot of additional work to be fully ready. * Fix a few broken tests around serialization * Add v2 suffix * Temporarily change mod name for testing * Rename module to /v2
19 lines
384 B
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)
|
|
}
|
|
}
|