Hegel 0.11.4
Property-based testing for C++
Loading...
Searching...
No Matches
hegel::stateful::Invariant< T > Class Template Reference

An invariant is a predicate that must hold at any point in the stateful test. They are evaluated on the initial state and after every valid step. The invariant function should throw when the invariant is violated. More...

#include <stateful.h>

Public Member Functions

 Invariant (std::string name, std::function< void(const T &)> invariant)
 Declare a new invariant.
const std::string & name () const
 Returns the name of the invariant.
const std::function< void(const T &)> & invariant () const
 Returns the function representing the predicate of the invariant.

Detailed Description

template<typename T>
class hegel::stateful::Invariant< T >

An invariant is a predicate that must hold at any point in the stateful test. They are evaluated on the initial state and after every valid step. The invariant function should throw when the invariant is violated.

Template Parameters
TThe state-machine type the invariant checks

Constructor & Destructor Documentation

◆ Invariant()

template<typename T>
hegel::stateful::Invariant< T >::Invariant ( std::string name,
std::function< void(const T &)> invariant )
inlineexplicit

Declare a new invariant.

Parameters
name
invariant

Member Function Documentation

◆ invariant()

template<typename T>
const std::function< void(const T &)> & hegel::stateful::Invariant< T >::invariant ( ) const
inline

Returns the function representing the predicate of the invariant.

Returns
const std::function<void(const T&)>&

◆ name()

template<typename T>
const std::string & hegel::stateful::Invariant< T >::name ( ) const
inline

Returns the name of the invariant.

Returns
const std::string&

The documentation for this class was generated from the following file: