|
Hegel 0.11.4
Property-based testing for C++
|
Macros for defining Hegel property tests. More...
Macros | |
| #define | HEGEL_TEST(name, ...) |
| Define a Hegel property test. | |
| #define | HEGEL_REPRODUCE_FAILURE(name, blob, ...) |
| Replay a failing example for a HEGEL_TEST from its blob. | |
Macros for defining Hegel property tests.
| #define HEGEL_REPRODUCE_FAILURE | ( | name, | |
| blob, | |||
| ... ) |
Replay a failing example for a HEGEL_TEST from its blob.
Place it above the matching HEGEL_TEST, keyed by the same name. The test then replays that example instead of generating new cases. Delete the annotation to return to a normal run. Settings::print_blob controls whether the report prints the line.
At least one blob is required. Additional blobs are accepted for bookkeeping, but only the first is replayed.
| #define HEGEL_TEST | ( | name, | |
| ... ) |
Define a Hegel property test.
It expands to a function name(hegel::Settings = ...) that runs that body via hegel::test() with Settings::database_key defaulted to "file.cpp::name" so counterexamples persisted to the database are scoped to this test and replayed on later runs. A database_key set explicitly in the Settings overrides the derived one.
Settings for the test are written inline after the name. They become the function's default argument, and settings passed at the call site replace them entirely.
With a test framework, write the property inside one of its tests and call hegel::test() instead. If you use HEGEL_TEST, it must be used outside of the test framework's test macro/function then call the named Hegel test.