Boost logo

Boost Users :

From: Gennadiy Rozental (rogeeff_at_[hidden])
Date: 2008-05-05 01:23:40


> "Christopher E Piggott" <cepasp_at_[hidden]>
>
> That's too bad, I like the automatic registration facility because it is
> less error-prone
> It doesn't allow you to write test cases and not notice that they never
> get called.

Yes. That was one of the main drivers to implement it.

> How hard would it be for me to fake it?
> I wonder if there's some preprocessor trickery that could keep a list,
> e.g.
>
> #define MY_TEST_CASE( function_name ) \
> #define TEMP LISTOFTESTS, function_name \
> #undef LISTOFTESTS \
> #define LISTOFTESTS TEMP \
> #undef TEMP \
> BOOST_CLASS_TEST_CASE(function_name())
>
> Well I know that obviously won't work but you get the idea ... To wind up
> with a list that looks like:
>
> function1, function2, function3,
>
> Which I can then use in an initialized array, and have my test_suite
> automatically add all of them.
> Possible? Good approach or bad?

You might be able to do somehing relying on static variables, not macros. In
1.35.0 you should be able change the test unit properties in global fixture,
so you can add timeout postfactum.

Gennadiy


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