Boost logo

Boost :

Subject: Re: [boost] [Boost.Test] Assertion changes in trunk? [WAS: Call for Review: Boost.Test documentation rewrite]
From: Gennadiy Rozental (rogeeff_at_[hidden])
Date: 2014-01-24 11:36:54


Thorsten Ottosen <thorsten.ottosen <at> dezide.com> writes:

>
> On 22-01-2014 13:11, Mathias Gaunard wrote:
> > On 22/01/14 11:52, Alexander Lamaison wrote:
> >
> >> BOOST_TEST(a <operator> b), however, cleverly parses a, b and <operator>
> >> from the macro and does something like
> >>
> >> bool x = (a <operator> b)
> >> BOOST_CHECK_MESSAGE_IMPL(x, "a must be <operator> to b", a, b);
> >
> >
> > What sort of magic allows to parse a <operator> b, and how reliable is
> > it in the real world?
>
> Completely reliable. You just bind the first object to some wrapper
> class object which provide the overloaded operators (via delegation).

There are few rare examples where this tool won't work (Ihave few examples in
my unit test). THe easiest work around is: BOOST_TEST(( expr )).

Gennadiy


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