MCPcopy Index your code
hub / github.com/coder/coder / TestOverlap

Function TestOverlap

coderd/util/slice/slice_test.go:144–159  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

142}
143
144func TestOverlap(t *testing.T) {
145 t.Parallel()
146
147 assertSetOverlaps(t, true, []int{1, 2, 3, 4, 5}, []int{1, 2, 3, 4, 5})
148 assertSetOverlaps(t, true, []int{10}, []int{10})
149
150 assertSetOverlaps(t, false, []int{1, 2, 3, 4, 5}, []int{6, 7, 8, 9})
151 assertSetOverlaps(t, false, []int{1, 2, 3, 4, 5}, []int{})
152 assertSetOverlaps(t, false, []int{}, []int{})
153
154 assertSetOverlaps(t, true, []string{"hello", "world", "foo", "bar", "baz"}, []string{"hello", "world", "baz"})
155 assertSetOverlaps(t, true,
156 []uuid.UUID{uuid.New(), uuid.MustParse("c7c6686d-a93c-4df2-bef9-5f837e9a33d5"), uuid.MustParse("8f3b3e0b-2c3f-46a5-a365-fd5b62bd8818")},
157 []uuid.UUID{uuid.MustParse("c7c6686d-a93c-4df2-bef9-5f837e9a33d5")},
158 )
159}
160
161func assertSetOverlaps[T comparable](t *testing.T, overlap bool, a []T, b []T) {
162 t.Helper()

Callers

nothing calls this directly

Calls 2

assertSetOverlapsFunction · 0.85
NewMethod · 0.65

Tested by

no test coverage detected