[test] Why doesn't BOOST_REQUIRE_THROW exist?

Hi there I have a test where it doesn't make any sense to continue if a certain function does not throw. BOOST_CHECK_THROW works but IMHO expresses the wrong thing. Thanks & Regards, -- Andreas Huber When replying by private email, please remove the words spam and trap from the address shown in the header.

I have a test where it doesn't make any sense to continue if a certain function does not throw. BOOST_CHECK_THROW works but IMHO expresses the wrong thing.
Well, I am not quite sure what you ask, but here what I could answer: BOOST_REQUIRE_THROW doesn't exist BOOST_CHECK_THROW check that argument expression throw an exception BOOST_REQUIRE checks that argument condition is true and stop further testing in current test case if it failes Gennadiy

Gennadiy Rozental wrote:
I have a test where it doesn't make any sense to continue if a certain function does not throw. BOOST_CHECK_THROW works but IMHO expresses the wrong thing.
Well, I am not quite sure what you ask, but here what I could answer:
BOOST_REQUIRE_THROW doesn't exist
Yes, but why?
BOOST_CHECK_THROW check that argument expression throw an exception BOOST_REQUIRE checks that argument condition is true and stop further testing in current test case if it failes
Yes, I understand that. My point is the following: All BOOST_CHECK_XXX macros check something and then let testing continue *always* (no matter what the outcome of the check was). All BOOST_REQUIRE_XXX macros check something and let testing continue *only* *if* the check succeeds. By this definition, it seems for every BOOST_CHECK_XXX macro there should also be a corresponding BOOST_REQUIRE_XXX macro. I say this because I'm implementing a test where I first need to test that a function really throws in certain situations before I use it to check other things. If the function doesn't throw, there is no point in continuing as the whole rest of the test would give meaningless results. The first test would best be expressed with BOOST_REQUIRE_THROW, wouldn't it? As I said, I can live with BOOST_CHECK_THROW, but it doesn't do the right thing. Regards, Andreas -- Andreas Huber When replying by private email, please remove the words spam and trap from the address shown in the header.

Gennadiy Rozental wrote:
All BOOST_REQUIRE_XXX macros check something and let testing continue *only* *if* the check succeeds. By this definition, it seems for every BOOST_CHECK_XXX macro there should also be a corresponding BOOST_REQUIRE_XXX macro.
I guess it make sence. I will try to do this.
Thank you. Sorry for being unclear! Regards, -- Andreas Huber When replying by private email, please remove the words spam and trap from the address shown in the header.

"Andreas Huber" <ahd6974-spamgroupstrap@yahoo.com> wrote in message news:csnv2d$glt$1@sea.gmane.org...
Hi there
I have a test where it doesn't make any sense to continue if a certain function does not throw.
Sorry. I got now what you meant. (BTW why BOOST_CHECK_THROW expresses the wrong thing?). It seems like not that frequent situation to warrant a tool, but I could provide one for completeness. Gennadiy
participants (2)
-
Andreas Huber
-
Gennadiy Rozental