[Test] Asserting a failure
Hi. Is there a way inside a test case using the Unit Testing Framework to specify that a particular function call ought to fail? For example, I have a function that asserts when passed invalid input. In my test case I want to pass it an invalid parameter and check that the assert is triggered. I'm looking for a macro called BOOST_CHECK_FAILURE (or something like that), but cannot find one. All I see are macros that assert successes, and those that assert exceptions. But my particular function does not throw, it simply "assert()"s. Any ideas? Thanks, Mike
cannot find one. All I see are macros that assert successes, and those that assert exceptions. But my particular function does not throw, it simply "assert()"s.
I do not know reliable/portable way to intercept an assert invocation. So you are on your own here. If you know any hooks to do the job, I am open to suggestions. Gennadiy
participants (2)
-
Gennadiy Rozental
-
Mike