Boost logo

Boost Users :

From: Ross Boylan (ross_at_[hidden])
Date: 2004-07-02 14:16:13


On Tue, 2004-06-29 at 19:29, Gennadiy Rozental wrote:
> > I have a test program that looks like this, in stylized form:
> > --------------------------
> > #include <boost/test/auto_unit_test.hpp>
> >
> > using namespace boost::unit_test_framework;
>
> You shouldn't need this.
>
> > void validate(X args) {
> > if (some tests)
> > BOOST_ERROR("message");
> > }
> > BOOST_AUTO_UNIT_TEST(testfunction) {
> > // set up arguments
> > validate(args)
> > }
> > ----------------------------------
> > When I run this with report-level detailed, it reports that there are 0
> > assertions in testfunction. Furthermore, the assertions done in
> > validate are not even added to the overall number of assertions reported
> > for the run.
>
> I couldn't reproduce it. And frankly it kinda hard to believe. There should
> be absolutely no difference where your assertion is located: directly in
> test function or in some other function you called from it.
I think the problem is a think-o on my part.
In the pseudo-code above, BOOST_ERROR is not executed unless "some
tests" is true. So if the tests are OK, BOOST_ERROR is never hit.

I think the report of 0 (boost) tests being run is therefore accurate,
though confusing.

Does that sound right?

Is there a way to signal to boost that you are doing a test, without the
error?

I suppose, trivially, I could do
if (some tests)
  BOOST_ERROR("message");
else
  BOOST_CHECK(true);


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