Make sure that the sparse array is trimmed correctly if compared against a smaller dense bit array.
(t *testing.T)
| 106 | // Make sure that the sparse array is trimmed correctly if compared against a |
| 107 | // smaller dense bit array. |
| 108 | func TestAndSparseWithSmallerDenseBitArray(t *testing.T) { |
| 109 | sba := newSparseBitArray() |
| 110 | other := newBitArray(512) |
| 111 | |
| 112 | other.SetBit(1) |
| 113 | sba.SetBit(1) |
| 114 | other.SetBit(150) |
| 115 | sba.SetBit(150) |
| 116 | sba.SetBit(155) |
| 117 | sba.SetBit(500) |
| 118 | |
| 119 | other.SetBit(128) |
| 120 | sba.SetBit(1500) |
| 121 | sba.SetBit(1200) |
| 122 | |
| 123 | ba := andSparseWithDenseBitArray(sba, other) |
| 124 | |
| 125 | // Bits in both |
| 126 | checkBit(t, ba, 1, true) |
| 127 | checkBit(t, ba, 150, true) |
| 128 | |
| 129 | // Bits in sba but not other |
| 130 | checkBit(t, ba, 155, false) |
| 131 | checkBit(t, ba, 500, false) |
| 132 | checkBit(t, ba, 1200, false) |
| 133 | checkBit(t, ba, 1500, false) |
| 134 | |
| 135 | // Bits in other but not sba |
| 136 | checkBit(t, ba, 128, false) |
| 137 | } |
| 138 | |
| 139 | func TestAndDenseWithDenseBitArray(t *testing.T) { |
| 140 | dba := newBitArray(1000) |
nothing calls this directly
no test coverage detected
searching dependent graphs…