Repository navigation
stateful modifier expressions - #54
Open
gijsvcuyck wants to merge 3 commits into
Open
gijsvcuyck wants to merge 3 commits into
gijsvcuyck wants to merge 3 commits into
Conversation
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The problem
Modifier expressions do not work well when a constraint describing the desired equivalence class needs the value of another variable affected by a modifier expression. In the following scenario, it is therefore not possible to apply a modifier expression over both Alice and Bob at the same time effectively. If done anyway, this increases the trace generation time, sometimes to the point of not finding a trace, because many generated instances of the scenario will be rejected.
The problem is that modifiers are resolved one at a time, and cannot access the values chosen by any of the other modifiers.
This makes it possible to select two people for the variables Alice and Bob such that both people have a friend, but it is not possible to select two people such that they are friends with each other.
A solution
A comprehensive solution to this problem would be complicated and require a substantial rewrite to the modifier system.
Instead, this PR makes some minimal changes to allow for a workaround: stateful modifier expressions.
Modifier expressions can now make variable assignments to scenario variables, which are accessible by all other modifier steps in the same scenario.
To resolve the problem above, the following modifier expression could be used for the step
Given Alice and Bob are friends:This example resolves all variables in one step, but any following step can base further modifier expressions on the value chosen for the first user by accessing
scenario.user.