def testFuzzableIsFalse(self): uut = BitFlip(b'\x00\x00', num_bits=3, fuzzable=False) self.assertEqual(uut.num_mutations(), 0) self.assertEqual(self.get_all_mutations(uut), [])
def _testBase(self, value, num_bits_to_flip, expected_mutations): len_in_bits = len(value) * 8 uut = BitFlip(value=value, num_bits=num_bits_to_flip) self.assertEqual(uut.num_mutations(), len_in_bits - num_bits_to_flip + 1) mutations = map(lambda x: x.tobytes(), self.get_all_mutations(uut)) self.assertEqual(set(mutations), set(expected_mutations))