MCPcopy
hub / github.com/Workiva/go-datastructures / TestLongCompressedIntersects

Function TestLongCompressedIntersects

bitarray/sparse_bitarray_test.go:239–262  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

237}
238
239func TestLongCompressedIntersects(t *testing.T) {
240 ba := newSparseBitArray()
241 other := newSparseBitArray()
242
243 ba.SetBit(5)
244 other.SetBit(5)
245
246 assert.True(t, ba.Intersects(other))
247
248 other.SetBit(s * 2)
249
250 assert.False(t, ba.Intersects(other))
251 assert.True(t, other.Intersects(ba))
252
253 ba.SetBit(s * 2)
254
255 assert.True(t, ba.Intersects(other))
256 assert.True(t, other.Intersects(ba))
257
258 other.SetBit(s*2 + 1)
259
260 assert.False(t, ba.Intersects(other))
261 assert.True(t, other.Intersects(ba))
262}
263
264func BenchmarkCompressedIntersects(b *testing.B) {
265 numItems := uint64(1000)

Callers

nothing calls this directly

Calls 3

newSparseBitArrayFunction · 0.85
SetBitMethod · 0.65
IntersectsMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…