(t *testing.T)
| 23 | ) |
| 24 | |
| 25 | func TestNandSparseWithSparseBitArray(t *testing.T) { |
| 26 | sba := newSparseBitArray() |
| 27 | other := newSparseBitArray() |
| 28 | |
| 29 | // bits for which only one of the arrays is set |
| 30 | sba.SetBit(3) |
| 31 | sba.SetBit(280) |
| 32 | other.SetBit(9) |
| 33 | other.SetBit(100) |
| 34 | sba.SetBit(1000) |
| 35 | other.SetBit(1001) |
| 36 | |
| 37 | // bits for which both arrays are set |
| 38 | sba.SetBit(1) |
| 39 | other.SetBit(1) |
| 40 | sba.SetBit(2680) |
| 41 | other.SetBit(2680) |
| 42 | sba.SetBit(30) |
| 43 | other.SetBit(30) |
| 44 | |
| 45 | ba := nandSparseWithSparseBitArray(sba, other) |
| 46 | |
| 47 | // Bits in both |
| 48 | checkBit(t, ba, 1, false) |
| 49 | checkBit(t, ba, 30, false) |
| 50 | checkBit(t, ba, 2680, false) |
| 51 | |
| 52 | // Bits in sba but not other |
| 53 | checkBit(t, ba, 3, true) |
| 54 | checkBit(t, ba, 280, true) |
| 55 | checkBit(t, ba, 1000, true) |
| 56 | |
| 57 | // Bits in other but not sba |
| 58 | checkBit(t, ba, 9, false) |
| 59 | checkBit(t, ba, 100, false) |
| 60 | checkBit(t, ba, 2, false) |
| 61 | |
| 62 | nums := ba.ToNums() |
| 63 | assert.Equal(t, []uint64{3, 280, 1000}, nums) |
| 64 | } |
| 65 | |
| 66 | func TestNandSparseWithDenseBitArray(t *testing.T) { |
| 67 | sba := newSparseBitArray() |
nothing calls this directly
no test coverage detected
searching dependent graphs…