Boost logo

Boost Users :

Subject: Re: [Boost-users] [Test] BOOST_CHECK_EQUAL can't compare scoped enumerations
From: Gennadiy Rozental (rogeeff_at_[hidden])
Date: 2016-02-05 04:15:16


Merrill Cornish <merrill.cornish <at> earthlink.net> writes:

>
>
> On 2/4/2016 9:03 PM, Gennadiy Rozental wrote:
> > scoped enums are not printable
> I've already run into that problem, so I wrote an inline function,
> enum2int(), to do a static_cast to int when I have to print one.

Why not implement operator<<?

> But
> that aside, why does BOOST_CHECK(mUse == UsedFor::NOTIFY_INPUT); appear
> to work.

As it should.
 
> Some of your documentation implies that BOOST_CHECK_EQUAL(L, R) is
> equivalent to BOOST_CHECK(L == R),

In spirit. The difference is that BOOST_CHECK_EQUAL attempts to report
mismatched values.

In any case you should start using BOOST_TEST(a==b) for all your assertions.

Gennadiy


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