Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix "Fork, Conditional Jump, Encodings" test and fix the "Return" operation. #88

Merged
merged 2 commits into from
Mar 6, 2017

Conversation

tlwr
Copy link
Contributor

@tlwr tlwr commented Mar 4, 2017

The return operation was setting state.progress to the length of the recipe.

Under async this is incorrect behaviour because after any flow control operation the Recipe executes state.progress + 1, and then at the beginning of the recursed Recipe.execute checks the length and returns if currentStep === recipe.opList.length

Return now sets state.progress equal to state.opList.length - 1.

This bug could instead have been fixed by changing finish condition from currentStep === recipe.opList.length to currentStep >= recipe.opList.length to prevent this class of bugs in the future. I'll leave that decision to @n1474335.

Additionally there was a type in the test "Fork, Conditional Jump, Encodings" which was just a missing newline in the input which was required to match the output.

Screenshot of tests passing
image

@n1474335 n1474335 merged commit 7f0ce0d into gchq:feature-async-ops Mar 6, 2017
@n1474335
Copy link
Member

n1474335 commented Mar 6, 2017

Good spot. I changed currentStep === recipe.opList.length to currentStep >= recipe.opList.length as it seems like a good defensive measure and I can't think of any scenario where it wouldn't be wanted. If such a scenario presents itself in future we can always change it again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants