Created
December 14, 2018 12:38
-
-
Save JoranHonig/9ab2c0d476dcb91c1d8bea8af53d8aa1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for state in states: | |
# Let's filter all the states that are not return statements | |
if state.currently_executing != 6: | |
continue | |
# We want the result to be 10, let's formulate that as a constraint | |
result_constraint = (state.result == 10) | |
# If it is possible to satisfy both the path constraints (these are the constraints collected on each branch) | |
# and the result constraint then there must be an input that makes the function return 10 | |
if is_possible(result_constraint and state.constraints): | |
# Using SMT solving we can get an input that will satisfy all the constraints and make the function return 10 | |
print(give_satisfying_input(result_constraints and state.constraints)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment