Boost logo

Boost Users :

Subject: Re: [Boost-users] Boost.Test - how to print the value of a variable in case of error?
From: Richard (legalize+jeeves_at_[hidden])
Date: 2010-06-28 01:11:26


[Please do not mail me a copy of your followup]

boost-users_at_[hidden] spake the secret code
<BD63511532FE974CBFF3543FD105DDC44B07B20F4C_at_[hidden]> thusly:

>Richard wrote:
>>
>> BOOST_WARN_MESSAGE( res > 1,
>> "sin(45){" << res << "} is <= 1. Hmm.. Strange. " ); }
>
>Thanks! I was doing that earlier, but I was hoping there is a "better"
>solution.

Yeah, most assertion frameworks have some way to optionally provide a
message. Since Boost.Test's assertions are done with macros, there
isn't a way to provide an overloaded version that supplies a
contextual message. I'm afraid the best you can do is use
BOOST_REQUIRE_MESSAGE() or provide your own assertion macros on top of
it.

-- 
"The Direct3D Graphics Pipeline" -- DirectX 9 draft available for download
 <http://legalizeadulthood.wordpress.com/the-direct3d-graphics-pipeline/>
      Legalize Adulthood! <http://legalizeadulthood.wordpress.com>

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