UTF : capturing asserts
Hi, Just started using the BOOST unit test framework. I have legacy code that exercises asserts. This resided on both a linux and windows platform. Using 1.42 release of boost. Is there a method in which to capture assert so as to pass a test ( like BOOST_REQUIRE_THROW)? It is either that, compile code without debug on ( which I wouldn't want to do if debugging) or replace all asserts which would be painful considering it is legacy code. Regards CONFIDENTIAL INFORMATION NOTICE: The information contained in this e-mail is privileged, confidential and intended solely for the use of the addressee named above. If the reader of this e-mail is not the intended recipient, you are hereby notified that any dissemination, distribution or copying of this e-mail is strictly prohibited. If you received this in error, please contact the sender and destroy all copies of this e-mail. Thank you.
Carla Strembicke
Is there a method in which to capture assert so as to pass a test ( like BOOST_REQUIRE_THROW)?
There is no way to capture assert in a portable way.
It is either that, compile code without debug on ( which I wouldn’t want to do if debugging) or replace all asserts which would be painful considering it is legacy code.
In a long term later is probably your best option. Gennadiy
Carla Strembicke wrote:
Hi,
Just started using the BOOST unit test framework. I have legacy code that exercises asserts. This resided on both a linux and windows platform.
Using 1.42 release of boost.
Is there a method in which to capture assert so as to pass a test ( like BOOST_REQUIRE_THROW)?
Can your assert be redefined globally to throw a specific exception that can then be caught by BOOST_REQUIRE_THROW for purposes of testing? Jeff
participants (3)
-
Carla Strembicke
-
Gennadiy Rozental
-
Jeff Flinn