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

Function TestClear

bitarray/bitarray_test.go:168–201  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

166}
167
168func TestClear(t *testing.T) {
169 ba := newBitArray(10)
170
171 err := ba.SetBit(5)
172 if err != nil {
173 t.Fatal(err)
174 }
175
176 err = ba.SetBit(9)
177 if err != nil {
178 t.Fatal(err)
179 }
180
181 ba.Reset()
182
183 assert.False(t, ba.anyset)
184 result, err := ba.GetBit(5)
185 if err != nil {
186 t.Fatal(err)
187 }
188
189 if result {
190 t.Errorf(`BA not reset.`)
191 }
192
193 result, err = ba.GetBit(9)
194 if err != nil {
195 t.Fatal(err)
196 }
197
198 if result {
199 t.Errorf(`BA not reset.`)
200 }
201}
202
203func BenchmarkGetBit(b *testing.B) {
204 numItems := uint64(168000)

Callers

nothing calls this directly

Calls 4

newBitArrayFunction · 0.85
SetBitMethod · 0.65
ResetMethod · 0.65
GetBitMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…