0

I would like to get a flag result of test for to do something like this:

BOOST_CHECK_EQUAL(...);

if (flag == sucess){
   then this
}
else
{
   this
}

any idea how to do that?

Thanks.

DavidW
  • 29,336
  • 6
  • 55
  • 86

1 Answers1

1

From BOOST_CHECK_EQUAL

BOOST_CHECK_EQUAL( left, right )

The same as BOOST_CHECK( left == right ).

So, you can just use

BOOST_CHECK_EQUAL(a, b);
const bool flag = (a == b);

I think, there is no other way.

ForEveR
  • 55,233
  • 2
  • 119
  • 133
  • hum, so boost does not offer so tools for that's :( – Gaetan Griffon Du Bellay Aug 21 '15 at 08:33
  • @GaetanGriffonDuBellay no, it checks equality internally, probably there is no way to get check result from boost. – ForEveR Aug 21 '15 at 08:35
  • GaetanGriffon: if I understand correctly, if the test in BOOST_CHECK_EQUAL fails then it will throw an exception, so the premise of the question doesn't make much sense (unless you catch that exception, but it would be quite ugly) – Chris Beck Aug 21 '15 at 10:35
  • @ChrisBeck no, it will not throw exception. It's `CHECK`, only message will be printed. – ForEveR Aug 21 '15 at 10:39