From 9330c3fef3c99e76945a66dd280e265d58ff1a9a Mon Sep 17 00:00:00 2001 From: esohel30 Date: Fri, 26 Jul 2024 02:07:44 -0400 Subject: [PATCH] finsihed conditional function mutation: : --- scripts/pysa_fuzzer/code_generator2.py | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/scripts/pysa_fuzzer/code_generator2.py b/scripts/pysa_fuzzer/code_generator2.py index 080f9904b1b..4ea1573560c 100644 --- a/scripts/pysa_fuzzer/code_generator2.py +++ b/scripts/pysa_fuzzer/code_generator2.py @@ -73,9 +73,30 @@ def source_mutation_3(self) -> None: """) self.last_source = var_2 + def source_mutation_4(self) -> None: + indent_space = ' ' * 4 + function_1 = self.generate_new_function() + function_2 = self.generate_new_function() + self.source_statements.append(f""" +if False: +{indent_space}def {function_1}(x): +{indent_space * 2}return x +else: +{indent_space}def {function_2}(x): +{indent_space * 2}return x + """) + temp = self.last_source + self.last_source = f"{function_2}({temp})" + + + generator = CodeGenerator() +generator.source_mutation_4() +generator.source_mutation_4() +generator.source_mutation_4() +generator.source_mutation_4() print(generator.generate()) -import random +