MCPcopy Index your code
hub / github.com/dropbox/godropbox / TestIsAnyClear

Function TestIsAnyClear

container/bitarray/bitarray_test.go:124–150  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

122}
123
124func TestIsAnyClear(t *testing.T) {
125 for _, n := range ns {
126 a := New(n)
127 a.SetRange(0, n-1)
128 for i := 0; i < n; i++ {
129 for j := 0; j < n; j++ {
130 wrapRequire(t, a.IsSet(j), "n=%v, i=%v, j=%v", n, i, j)
131 }
132 a.Clear(i)
133 wrapRequire(t, !a.IsSet(i), "n=%v, i=%v", n, i)
134 // parallel arrays.
135 ss := []int{0, i - 1, i, i, i + 1, 0}
136 es := []int{i - 1, i, i, i + 1, n - 1, n - 1}
137 for j := 0; j < len(ss); j++ {
138 s := ss[j]
139 e := es[j]
140 if s < 0 || e < 0 {
141 continue
142 }
143 wrapRequire(t,
144 (s <= i && i <= e) == a.IsAnyClear(s, e),
145 "n=%v, i=%v, s=%v, e=%v", n, i, s, e)
146 }
147 a.Set(i)
148 }
149 }
150}
151
152func TestSetRange(t *testing.T) {
153 for _, n := range ns {

Callers

nothing calls this directly

Calls 7

wrapRequireFunction · 0.85
SetRangeMethod · 0.80
IsSetMethod · 0.80
IsAnyClearMethod · 0.80
NewFunction · 0.70
ClearMethod · 0.65
SetMethod · 0.65

Tested by

no test coverage detected