Пример #1
0
def list_operators():
    print('Standard mutation operators:')
    for operator in utils.sort_operators(operators.standard_operators):
        print(' - {:3} - {}'.format(operator.name(), operator.long_name()))
    print('Experimental mutation operators:')
    for operator in utils.sort_operators(operators.experimental_operators):
        print(' - {:3} - {}'.format(operator.name(), operator.long_name()))
Пример #2
0
def list_operators():
    print('Standard mutation operators:')
    for operator in utils.sort_operators(operators.standard_operators):
        print(' - {:3} - {}'.format(operator.name(), operator.long_name()))
    print('Experimental mutation operators:')
    for operator in utils.sort_operators(operators.experimental_operators):
        print(' - {:3} - {}'.format(operator.name(), operator.long_name()))
Пример #3
0
 def generate_all_mutations(self, coverage_injector, module, target_ast,
                            to_mutate):
     mutations = []
     for op in utils.sort_operators(self.operators):
         for mutation, _ in op().mutate(target_ast, to_mutate, None,
                                        coverage_injector, module, None,
                                        self.type_check):
             mutations.append(mutation)
     return mutations
Пример #4
0
    def test_sort_operators(self):
        class A(operators.MutationOperator):
            pass

        class Z(operators.MutationOperator):
            pass

        sorted_operators = utils.sort_operators([Z, A])

        self.assertEqual(sorted_operators[0], A)
        self.assertEqual(sorted_operators[1], Z)
Пример #5
0
 def mutate(self,
            target_ast,
            to_mutate=None,
            coverage_injector=None,
            module=None):
     for op in utils.sort_operators(self.operators):
         for mutation, mutant in op().mutate(target_ast,
                                             to_mutate,
                                             self.sampler,
                                             coverage_injector,
                                             module=module):
             yield [mutation], mutant
Пример #6
0
 def mutate(self,
            target_ast,
            to_mutate=None,
            coverage_injector=None,
            module=None):
     annotationsMarker = annotations.get_annotation_marker(self.type_check)
     annotationsMarker.mark_ast_tree(target_ast)
     for op in utils.sort_operators(self.operators):
         for mutation, mutant in op().mutate(target_ast, to_mutate,
                                             self.sampler,
                                             coverage_injector, module,
                                             None, self.type_check):
             yield [mutation], mutant
Пример #7
0
 def generate_all_mutations(self, coverage_injector, module, target_ast, to_mutate):
     mutations = []
     for op in utils.sort_operators(self.operators):
         for mutation, _ in op().mutate(target_ast, to_mutate, None, coverage_injector, module=module):
             mutations.append(mutation)
     return mutations
Пример #8
0
 def mutate(self, target_ast, to_mutate=None, coverage_injector=None, module=None):
     for op in utils.sort_operators(self.operators):
         for mutation, mutant in op().mutate(target_ast, to_mutate, self.sampler, coverage_injector, module=module):
             yield [mutation], mutant