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

Don't drop actions depending on shrunk predecessors. #453

Merged

Conversation

ChickenProp
Copy link
Contributor

@ChickenProp ChickenProp commented Feb 28, 2022

Closes #448. Suppose we have an Action list

A 1 -> Var 0
B (Var 0) -> ...

Then when we shrink A, we would previously get the list

A 0 -> Var 1
B (Var 0) -> ...

And then we'd drop B from this list, because Var 0 no longer exists.
Now shrinking will give

A 0 -> Var 0
B (Var 0) -> ...

which is fine.

This means we now generate Vars even for actions whose Require fails.

I don't know if this is the ideal way to fix this. I wonder whether, when shrinking, the context should be rolled back so that the output we previously generated is no longer present? But I wouldn't know how to change that, and I'd be much less confident of not breaking anything else if I did.

Closes hedgehogqa#448. Suppose we have an Action list

    A 1 -> Var 0
    B (Var 0) -> ...

Then when we shrink A, we would previously get the list

    A 0 -> Var 1
    B (Var 0) -> ...

And then we'd drop B from this list, because `Var 0` no longer exists.
Now shrinking will give

    A 0 -> Var 0
    B (Var 0) -> ...

which is fine.

This means we now generate Vars even for actions whose `Require` fails.
@jacobstanley
Copy link
Member

jacobstanley commented May 23, 2022

Good catch, the vars end up being synonymous with the index of the action in the initial generated list, it doesn't really make sense to change that during shrinking.

@jacobstanley
Copy link
Member

This means we now generate Vars even for actions whose Require fails.

It might make sense in the long run to have a separate pass which minimizes the variable ids. That is, if you're left with three variables after shrinking they are always 0, 1, 2.

@jacobstanley jacobstanley merged commit 20c4774 into hedgehogqa:master May 23, 2022
@moodmosaic
Copy link
Member

Available in hedgehog 1.2.

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.

When a Command shrinks, later commands depending on it are dropped
3 participants