(self, x)
| 230 | self.assertEqual(x, y) |
| 231 | |
| 232 | def check_bitop_identities_1(self, x): |
| 233 | eq = self.assertEqual |
| 234 | with self.subTest(x=x): |
| 235 | eq(x & 0, 0) |
| 236 | eq(x | 0, x) |
| 237 | eq(x ^ 0, x) |
| 238 | eq(x & -1, x) |
| 239 | eq(x | -1, -1) |
| 240 | eq(x ^ -1, ~x) |
| 241 | eq(x, ~~x) |
| 242 | eq(x & x, x) |
| 243 | eq(x | x, x) |
| 244 | eq(x ^ x, 0) |
| 245 | eq(x & ~x, 0) |
| 246 | eq(x | ~x, -1) |
| 247 | eq(x ^ ~x, -1) |
| 248 | eq(-x, 1 + ~x) |
| 249 | eq(-x, ~(x-1)) |
| 250 | for n in range(2*SHIFT): |
| 251 | p2 = 2 ** n |
| 252 | with self.subTest(x=x, n=n, p2=p2): |
| 253 | eq(x << n >> n, x) |
| 254 | eq(x // p2, x >> n) |
| 255 | eq(x * p2, x << n) |
| 256 | eq(x & -p2, x >> n << n) |
| 257 | eq(x & -p2, x & ~(p2 - 1)) |
| 258 | |
| 259 | def check_bitop_identities_2(self, x, y): |
| 260 | eq = self.assertEqual |
no test coverage detected