MCPcopy Index your code
hub / github.com/Workiva/go-datastructures / TestClearCompressedBit

Function TestClearCompressedBit

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

Source from the content-addressed store, hash-verified

145}
146
147func TestClearCompressedBit(t *testing.T) {
148 ba := newSparseBitArray()
149 ba.SetBit(5)
150 ba.ClearBit(5)
151
152 result, err := ba.GetBit(5)
153 assert.Nil(t, err)
154 assert.False(t, result)
155 assert.Len(t, ba.blocks, 0)
156 assert.Len(t, ba.indices, 0)
157
158 ba.SetBit(s * 2)
159 ba.ClearBit(s * 2)
160
161 result, _ = ba.GetBit(s * 2)
162 assert.False(t, result)
163 assert.Len(t, ba.indices, 0)
164 assert.Len(t, ba.blocks, 0)
165}
166
167func BenchmarkClearCompressedBit(b *testing.B) {
168 numItems := 1000

Callers

nothing calls this directly

Calls 5

newSparseBitArrayFunction · 0.85
SetBitMethod · 0.65
ClearBitMethod · 0.65
GetBitMethod · 0.65
LenMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…