8 Aug
2014
8 Aug
'14
2:53 p.m.
Beman Dawes wrote:
On Fri, Aug 8, 2014 at 9:53 AM, Peter Dimov
Beman Dawes wrote:
Certain library function errors are difficult to regression test because it is not obvious how to observe their behavior in a test framework. Examples include:
...
2) Verification that BOOST_ASSERT fires when a precondition is violated.
You can do this by enabling a custom assert handler and then test that it has been invoked.
Yes, but the question in my mind is how to "test that it has been invoked"?
I just do the obvious: increment an "assertion_failed_" global variable in the handler, then BOOST_TEST that it has been incremented the correct number of times. It's a bit ad-hoc, but it works.