RE: [Boost-users] Re: boost test doesn't track validation outside autofunctions
void validate(X args) { if (some tests) BOOST_ERROR("message"); } BOOST_AUTO_UNIT_TEST(testfunction) { // set up arguments validate(args) } [...] 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.
It should actually say that 1 test cases being run, but no assertions executed.
Does that sound right?
Is there a way to signal to boost that you are doing a test, without the error?
You have 2 choices. 1. Rewrite your test, so that it looks like: ... BOOST_CHECK_MESSAGE( some_test, "message" ); 2. Or you could write it like this: .... If(some_test) BOOST_ERROR("message") else BOOST_MESSAGE( "no error" ); I prefer first solution usually. HTH, Gennadiy
On Fri, 2004-07-02 at 12:57, Rozental, Gennadiy wrote:
void validate(X args) { if (some tests) BOOST_ERROR("message"); } BOOST_AUTO_UNIT_TEST(testfunction) { // set up arguments validate(args) } [...] 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.
It should actually say that 1 test cases being run, but no assertions executed. Yes, that's what it was saying.
So I think everything's good. Thanks.
participants (2)
-
Ross Boylan
-
Rozental, Gennadiy