def testValueTruncedFuzzable(self): field = String(name='trunced', value='abc') uut = Trunc(max_size=self.trunc_size, fields=field, fuzzable=True) self._testValueTrunced(field, uut, self.trunc_size) self.assertEqual(uut.num_mutations(), field.num_mutations()) self.assertGreater(uut.num_mutations(), 0) while uut.mutate(): self._testValueTrunced(field, uut, self.trunc_size)
def testIsFuzzable(self): field = String('abc') uut = Meta(name=self.uut_name, fields=[field], fuzzable=True) num_mutations = uut.num_mutations() self.assertGreater(num_mutations, 0) self.assertGreaterEqual(num_mutations, field.num_mutations()) actual_num_mutations = 0 while uut.mutate(): actual_num_mutations += 1 self.assertEqual(actual_num_mutations, num_mutations)
def testNumMutations(self): field = String(name='trunced', value='abc') uut = Trunc(self.trunc_size, fields=field, name=self.uut_name) field_num_mutations = field.num_mutations() uut_num_mutations = uut.num_mutations() self.assertEqual(uut_num_mutations, field_num_mutations) self.assertGreater(uut_num_mutations, 0) actual_num_mutations = 0 while uut.mutate(): actual_num_mutations += 1 self.assertEqual(actual_num_mutations, uut_num_mutations)
def testNumMutations(self): field = String(name='padded', value='abc') uut = Pad(self.pad_length, fields=field, name=self.uut_name) field_num_mutations = field.num_mutations() uut_num_mutations = uut.num_mutations() self.assertEqual(uut_num_mutations, field_num_mutations) self.assertGreater(uut_num_mutations, 0) actual_num_mutations = 0 while uut.mutate(): actual_num_mutations += 1 self.assertEqual(actual_num_mutations, uut_num_mutations)