Пример #1
0
 def testTenBytesDefaultRangeIs124(self):
     uut = ByteFlips('\x00' * 10)
     expected_mutations = self._generate_mutations(10, [1, 2, 4])
     mutations = map(lambda x: x.tobytes(), self.get_all_mutations(uut))
     self.assertGreaterEqual(len(mutations), len(expected_mutations))
     for em in expected_mutations:
         self.assertIn(em, mutations)
 def testFourByteDefaultRangeIs124(self):
     uut = ByteFlips(b'\x00\x00\x00\x00')
     expected_mutations = self._generate_mutations(4, [1, 2, 4])
     mutations = list(
         map(lambda x: x.tobytes(), self.get_all_mutations(uut)))
     self.assertGreaterEqual(len(mutations), len(expected_mutations))
     for em in expected_mutations:
         self.assertIn(em, mutations)
Пример #3
0
 def _testBase(self, num_bytes, itr, uut=None):
     if uut is None:
         uut = ByteFlips('\x00' * num_bytes, itr)
     expected_mutations = self._generate_mutations(num_bytes, itr)
     mutations = map(lambda x: x.tobytes(), self.get_all_mutations(uut))
     self.assertGreaterEqual(len(mutations), len(expected_mutations))
     for em in expected_mutations:
         self.assertIn(em, mutations)
 def get_field(self, value=b'\x00\x00\x00\x00'):
     return ByteFlips(value=value, bytes_range=[1, 3])
 def testExceptionIfUnorderedRangeOverflowsMultipleBytes(self):
     with self.assertRaises(KittyException):
         ByteFlips(b'\x00' * 10, bytes_range=[3, 11, 7])
 def testExceptionIfUnorderedRangeOverflowsSingleByte(self):
     with self.assertRaises(KittyException):
         ByteFlips(b'\x00', bytes_range=[2, 1])
Пример #7
0
 def testExceptionIfRangeOverflowsMultipleBytes(self):
     with self.assertRaises(KittyException):
         ByteFlips('\x00' * 10, bytes_range=[11])