Boost logo

Boost Users :

Subject: Re: [Boost-users] [unit_test_framework] checkpoints for BOOST_CHECK*?
From: rozelak_at_[hidden]
Date: 2009-08-29 15:18:08


> rozelak_at_[hidden] wrote:
> > Is there a change to accept it in the boost test
> > framework, if I try
> > > to implement it?
>
> 1. I forgot to mention that you can use BOOST_CHECK_MESSAGE
> and record whatever you want there.

Yes, I know. But I cannot use it in form BOOST_CHECK_EQUAL_MESSAGE. If
such a for of CHECK_EQUAL would be there, it is also what I could use
for what I need. Imagine the following:

1) BOOST_CHECK_MESSAGE(4 == 5, "are you normal?");
2) BOOST_CHECK_EQUAL(4, 5);

1) does not print expected and actual value, which I would like to know.
It just prints something like:
Test.cpp(150): error in "JustExample": are you normal?

2) on the contrary cannot print a message.

What I looking for is to have the join of the two. Something like:

Test.cpp(151): error in "JustExample": check 4 == 5 failed [4 != 5]:
are you normal?

>
> 2. I do not see how this is better than BOOST_TEST_MESSAGE
> approach. You run your test either with log level set to message
> all the time or run it with default log level, but as soon as it fails
> > you can rerun it with lower log level and see all the details. What
> do you find lacking in this approach?
>
There are extensive tests started automatically on regular basis required,
and some random permutations are used in some of the special tests (we
can discuss about meaningfulness of it, but it is the requirement ...).
So, when BOOST_TEST_MESSAGE is used, it either prints everything or
nothing (depending on the log level set). It is much more convenient
to have only failures included in test results (as boost already does
it now, and even I don't care about conditions not resulting in test
failure ...). However, I need to have detailed test conditions included
within the failure message as well (and they may be quite complex ;-)).
That's my motivation.

But you are right. It may be easier to create BOOST_TEST_EQUAL_MESSAGE
macro (and those not supporting messages as well), than to introduce
new kind of "checkpoint".

Thank you again. Best regards,
Dan


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