PropCheck.StateM.precondition

You're seeing just the callback precondition, go back to PropCheck.StateM module for more information.

Specs

precondition(s :: symbolic_state(), call :: symbolic_call()) :: boolean()

Specifies the precondition that should hold so that call can be included in the command sequence, given the current state s of the abstract state machine.

In case precondition doesn't hold, a new call is chosen using the command/1 generator. If preconditions are very strict, it will take a lot of tries for PropEr to randomly choose a valid command. Testing will be stopped in case the constraint_tries limit is reached (see the Options section in the {@link proper} module documentation). Preconditions are also important for correct shrinking of failing test cases. When shrinking command sequences, we try to eliminate commands that do not contribute to failure, ensuring that all preconditions still hold. Validating preconditions is necessary because during shrinking we usually attempt to perform a call with the system being in a state different from the state it was when initially running the test.