|
Boost Users : |
From: Zeljko Vrba (zvrba_at_[hidden])
Date: 2007-06-22 03:49:17
I'm using the boost minimal testing facility - mostly because I do not
want to build full boost. [I spent one day about an hour trying to figure
out how to build a 64-bit version on Solaris with SunCC and failed.
So I gave up. Besides, minimal testing facility is enough for me.]
Is it possible to configure BOOST_CHECK or BOOST_REQUIRE to behave as
assert? BOOST_REQUIRE throws an exception which eventually gets caught
and the test just prints "failed". That's not what I want. I want
that the message is printed and abort() immediately called so that I
can inspect the core-dump and debug the problem.
A quick&dirty fix is to add something like the following on top of
each test:
#ifdef BTEST_OVERRIDE
#define BOOST_REQUIRE assert
#define BOOST_CHECK assert
#endif
Is there another possibility? Ideally, there would be a command-line
switch to toggle this behaviour at runtime. So the first run of tests
in "normal" mode just gives a quick overview of everything, and another
"diagnostic" mode (running with a hypothetical "-abort" switch) calls
abort() as soon as any CHECK or REQUIRE fails.
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net