Boost logo

Boost :

Subject: Re: [boost] [assert] Assert library? - Was: [regression] Where's boost/assert.hpp ??
From: Mathias Gaunard (mathias.gaunard_at_[hidden])
Date: 2014-02-24 09:54:05


On 24/02/14 15:33, Peter Dimov wrote:
> Klaim - Joël Lamotte wrote:
>> [1] http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n3877.pdf
>
> Assertion macros taking a level (BOOST_ASSERTL, BOOST_ASSERTL_MSG)
> controlled by, f.ex. BOOST_ASSERT_LEVEL (0 - opt, 1 - debug, 2 - safe)
> would be a relatively straightforward addition. The rest is not really
> in the spirit of the current Boost.Assert. It could be added though.
>
> I'm not entirely sure about the purpose of the test macros.

The main difference with Boost.Assert is that the interface allows to
change the handler at runtime.

By changing it at runtime, it is possible to temporarily make the
handler throw exceptions, which is how the TEST_ macros are implemented.
They're useful if you want to write unit tests that checks that your
functions do indeed emit an assert in a situation that is invalid.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk