| 1 | package testutils |
| 2 | |
| 3 | import "testing" |
| 4 | |
| 5 | func SameElements[T comparable](t *testing.T, actual, expected []T) { |
| 6 | if len(actual) != len(expected) { |
| 7 | t.Errorf("Got %d expected %d", len(actual), len(expected)) |
| 8 | } |
| 9 | outer: |
| 10 | for _, e := range expected { |
| 11 | for _, a := range actual { |
| 12 | if e == a { |
| 13 | continue outer |
| 14 | } |
| 15 | } |
| 16 | t.Errorf("Did not find expected element %v in %v", e, actual) |
| 17 | } |
| 18 | } |