Skip to content

Commit

Permalink
finsihed conditional function mutation:
Browse files Browse the repository at this point in the history
:
  • Loading branch information
esohel30 committed Jul 26, 2024
1 parent ec365b6 commit 9330c3f
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion scripts/pysa_fuzzer/code_generator2.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 9330c3f

Please sign in to comment.