Skip to content

Commit

Permalink
Fix logic that broke in rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
DRMacIver committed Dec 16, 2019
1 parent 4d4e05c commit 902ac47
Showing 1 changed file with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -181,20 +181,21 @@ def attempt_to_improve(self, example_index, upwards):
# it will take too long to complete.
if self.random.randint(0, 1):
if upwards:
replacement_range = (existing_as_int + 1, max_int_value)
replacement_as_int = self.random.randint(
existing_as_int + 1, max_int_value
)
else:
replacement_range = (0, existing_as_int - 1)
replacement_as_int = self.random.randint(*replacement_range)
replacement_as_int = self.random.randint(0, existing_as_int - 1)
elif upwards:
replacement_as_int = existing_as_int + 1
else:
replacement_as_int = existing_as_int - 1

replacement = int_to_bytes(replacement_as_int, len(existing))

prefix + replacement + suffix

attempt = self.engine.cached_test_function(prefix, extend=BUFFER_SIZE,)
attempt = self.engine.cached_test_function(
prefix + replacement + suffix, extend=BUFFER_SIZE,
)

if self.consider_new_test_data(attempt):
return True
Expand Down

0 comments on commit 902ac47

Please sign in to comment.