(t *testing.T)
| 128 | } |
| 129 | |
| 130 | func TestBitmapStructure_BitOp(t *testing.T) { |
| 131 | type bitmapStruct struct { |
| 132 | key string |
| 133 | arr []uint |
| 134 | } |
| 135 | |
| 136 | tests := []struct { |
| 137 | name string |
| 138 | op BitOperation |
| 139 | input []bitmapStruct |
| 140 | expected bitmapStruct |
| 141 | }{ |
| 142 | { |
| 143 | name: "bitset OR operation", |
| 144 | op: BitOrOperation, |
| 145 | input: []bitmapStruct{ |
| 146 | {"1", []uint{2, 3}}, // 0011 |
| 147 | {"2", []uint{0, 6, 12, 17}}, // 100000100000100001 |
| 148 | {"3", []uint{1, 4, 10, 11, 19}}, // 01001000001100000001 |
| 149 | {"4", []uint{10, 12, 14}}, // 000000000010101 |
| 150 | }, |
| 151 | expected: bitmapStruct{ |
| 152 | "5", |
| 153 | []uint{0, 1, 2, 3, 4, 6, 10, 11, 12, 14, 17, 19}, |
| 154 | }, |
| 155 | }, |
| 156 | { |
| 157 | name: "bitset AND operation", |
| 158 | op: BitAndOperation, |
| 159 | input: []bitmapStruct{ |
| 160 | {"1", []uint{2, 3, 6}}, // 0011001 |
| 161 | {"2", []uint{0, 6, 12, 17}}, // 100000100000100001 |
| 162 | {"3", []uint{1, 4, 6, 10, 11, 19}}, // 01001010001100000001 |
| 163 | {"4", []uint{10, 12, 14, 6}}, |
| 164 | }, |
| 165 | expected: bitmapStruct{ |
| 166 | "5", |
| 167 | []uint{6}, |
| 168 | }, |
| 169 | }, |
| 170 | { |
| 171 | name: "bitset NOT operation", |
| 172 | op: BitNotOperation, |
| 173 | input: []bitmapStruct{ |
| 174 | {"1", []uint{0, 1, 2, 3, 12}}, |
| 175 | {"2", []uint{0, 6, 12, 17}}, // 100000100000100001 |
| 176 | {"3", []uint{1, 4, 10, 11, 19}}, // 01001010001100000001 |
| 177 | {"4", []uint{10, 12, 14}}, |
| 178 | }, |
| 179 | expected: bitmapStruct{ |
| 180 | "5", |
| 181 | []uint{2, 3}, |
| 182 | }, |
| 183 | }, |
| 184 | { |
| 185 | name: "bitset XOR operation", |
| 186 | op: BitXorOperation, |
| 187 | input: []bitmapStruct{ |
nothing calls this directly
no test coverage detected