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

Function TestGetSetCompressedBit

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

Source from the content-addressed store, hash-verified

47}
48
49func TestGetSetCompressedBit(t *testing.T) {
50 ba := newSparseBitArray()
51
52 ba.SetBit(5)
53
54 result, err := ba.GetBit(5)
55 assert.Nil(t, err)
56 assert.True(t, result)
57 result, err = ba.GetBit(7)
58 assert.Nil(t, err)
59 assert.False(t, result)
60
61 ba.SetBit(s * 2)
62 result, _ = ba.GetBit(s * 2)
63 assert.True(t, result)
64 result, _ = ba.GetBit(s*2 + 1)
65 assert.False(t, result)
66}
67
68func BenchmarkSetCompressedBit(b *testing.B) {
69 numItems := 1000

Callers

nothing calls this directly

Calls 3

newSparseBitArrayFunction · 0.85
SetBitMethod · 0.65
GetBitMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…