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

Function TestIsAnySet

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

Source from the content-addressed store, hash-verified

95}
96
97func TestIsAnySet(t *testing.T) {
98 for _, n := range ns {
99 a := New(n)
100 for i := 0; i < n; i++ {
101 for j := 0; j < n; j++ {
102 wrapRequire(t, !a.IsSet(j), "n=%v, i=%v, j=%v", n, i, j)
103 }
104 a.Set(i)
105 wrapRequire(t, a.IsSet(i), "n=%v, i=%v", n, i)
106 // parallel arrays.
107 ss := []int{0, i - 1, i, i, i + 1, 0}
108 es := []int{i - 1, i, i, i + 1, n - 1, n - 1}
109 for j := 0; j < len(ss); j++ {
110 s := ss[j]
111 e := es[j]
112 if s < 0 || e < 0 {
113 continue
114 }
115 wrapRequire(t,
116 (s <= i && i <= e) == a.IsAnySet(s, e),
117 "n=%v, i=%v, s=%v, e=%v", n, i, s, e)
118 }
119 a.Clear(i)
120 }
121 }
122}
123
124func TestIsAnyClear(t *testing.T) {
125 for _, n := range ns {

Callers

nothing calls this directly

Calls 6

wrapRequireFunction · 0.85
IsSetMethod · 0.80
IsAnySetMethod · 0.80
NewFunction · 0.70
SetMethod · 0.65
ClearMethod · 0.65

Tested by

no test coverage detected