Support for failure messages on assertions
Warwolt opened this issue · 0 comments
Warwolt commented
I've used RapidCheck in a small project and enjoyed it so far, but I've found myself in cases where I want to run property assertions inside of a kind of parameterized test, but as far as I can tell RapidCheck seems to kind of assume there will only be one assertion per test case based on its reporting.
I made a wrapper macro that allows me to print a message on failed assertions, but the problem is that they repeat whenever RapidCheck shrinks the input and re-tests the properties, so you get the same message a bunch of times.
#define RC_ASSERT_MSG(condition, message) \
try { \
RC_ASSERT(condition);\
}\
catch (const rc::detail::CaseResult& result) {\
std::cout << message << std::endl; throw result;\
}
Would it be possible to add support to add an optional failure message directly to RapidCheck, so that it gets reported only when the entire test case has failed?