|
Hegel 0.3.5
Property-based testing for C++
|
Handle to the currently-executing test case. More...
#include <test_case.h>
Public Member Functions | |
| TestCase (const TestCase &)=delete | |
| TestCase & | operator= (const TestCase &)=delete |
| TestCase (TestCase &&)=delete | |
| TestCase & | operator= (TestCase &&)=delete |
| template<typename T> | |
| T | draw (const generators::Generator< T > &gen) const |
| Draw a random value from a generator. | |
| void | assume (bool condition) const |
Reject the current test case if condition is false. | |
| void | note (std::string_view message) const |
| Record a message that will be printed on the final replay of a failing test case. | |
Handle to the currently-executing test case.
A TestCase is passed as the sole argument to the callback given to hegel::test(). It is the main way a test definition interacts with Hegel.
TestCase is a non-owning handle into state managed by the Hegel runner. It is neither copyable nor movable, and must not outlive the test-case callback.
| void hegel::TestCase::assume | ( | bool | condition | ) | const |
Reject the current test case if condition is false.
| condition | Value that must be true for the test case to continue. If false, the current test case is rejected. |
| T hegel::TestCase::draw | ( | const generators::Generator< T > & | gen | ) | const |
Draw a random value from a generator.
| T | The value type produced by gen |
| gen | The generator to draw from |
| void hegel::TestCase::note | ( | std::string_view | message | ) | const |
Record a message that will be printed on the final replay of a failing test case.
| message | The message to record. |