|
Hegel 0.11.4
Property-based testing for C++
|
Base class for a state machine. Holds the state and declares the rules and the invariants that act on it. More...
#include <stateful.h>
Public Types | |
| using | state_type = State |
| The type of the state the rules act on. | |
Public Member Functions | |
| StateMachine (StateMachineParams< State > params) | |
| Builds a machine holding the given initial state. | |
| std::vector< Invariant< Derived > > | invariants () |
| Invariants checked before the first step and after every valid step. Override to add them. Defaults to none. | |
Public Attributes | |
| State | state |
Base class for a state machine. Holds the state and declares the rules and the invariants that act on it.
Derive from it with the deriving type as Derived and the state's type as State, pass the initial state to this constructor, and define
returning the actions the test may apply. Optionally override invariants to add predicates checked before the first step and after every valid step. Rules mutate state in place. Pass an instance to run.
A machine may hold members besides the state, for anything the state's type cannot carry. A Pool, for instance, is tied to a test case and is neither copyable nor movable.
| Derived | The deriving state-machine type |
| State | The type of the state the rules act on |
|
inlineexplicit |
Builds a machine holding the given initial state.
| params | The initial state. See StateMachineParams. |
|
inline |
Invariants checked before the first step and after every valid step. Override to add them. Defaults to none.
| State hegel::stateful::StateMachine< Derived, State >::state |
The state the rules act on. Rules mutate it in place, and a failing run prints it. See RunParams::print_state.