A rule is one possible action in a stateful test.
More...
#include <stateful.h>
|
| | Rule (std::string name, std::function< void(TestCase &, T &)> step) |
| | Declares a new Rule.
|
| | Rule (std::string name, double weight, std::function< void(TestCase &, T &)> step) |
| | Declares a new Rule with a weight.
|
| | Rule (RuleParams< T > params) |
| | Declares a new Rule from named arguments.
|
| const std::string & | name () const |
| | Returns the name of the rule.
|
| const std::function< void(TestCase &, T &)> & | step () const |
| | Returns the underlying step function of the rule.
|
| double | weight () const |
| | Returns the weight of the rule.
|
template<typename T>
class hegel::stateful::Rule< T >
A rule is one possible action in a stateful test.
stack.push_back(tc.draw(gs::integers<int>()));
});
Handle to the currently-executing test case.
Definition test_case.h:46
A rule is one possible action in a stateful test.
Definition stateful.h:831
- Template Parameters
-
| T | The state-machine type the rule acts on |
◆ Rule() [1/3]
Declares a new Rule.
- Parameters
-
| name | name of the rule |
| step | function representing the step a rule takes. It mutates the state in place, drawing any arguments it needs from the test case. Always check preconditions with assume() before mutating. A rule that rejects after mutating leaves the state partially modified. |
◆ Rule() [2/3]
Declares a new Rule with a weight.
- Parameters
-
| name | name of the rule |
| weight | selection weight of the rule |
| step | The function the rule applies |
◆ Rule() [3/3]
Declares a new Rule from named arguments.
- Parameters
-
| params | The name, weight and step of the rule |
◆ name()
Returns the name of the rule.
- Returns
- const std::string&
◆ step()
Returns the underlying step function of the rule.
- Returns
- const std::function<void(TestCase&, T&)>&
◆ weight()
Returns the weight of the rule.
- Returns
- The weight of the rule
The documentation for this class was generated from the following file: