|
Boost : |
From: Petr Ovchenkov (night-crow_at_[hidden])
Date: 2003-09-09 03:32:40
Rozental, Gennadiy wrote:
>> Hi.
>
>> What you think about conditional expansion of macros from
>> test_tools.hpp?
>
> [...]
>
>> This allow skip any checks with single #define (in sources or as
>> compiler option). It's may be useful in release builds, for example.
>
>> - ptr
>
> Why would you need that? It's test program - it's supposed to test,
> whether you compile it in debug or production mode. If you have a test
> case that tests performance, it most probably make sence to separate it
> and compile as standalone module, so that rest of the test wouldn't affect
> the results. Did I miss something?
>
May be you right. Boost.Test implement 'external' view point.
But sometimes I want made 'internal' check of something. The effect and
design aspects of such check are near the same as Boost.Test primitives, so
spawn new entities don't seem as good solution.
'internal' checks are useful as temporary pre-/postconditions during
development:
class X
{
public:
...
char get_ch( int i )
{ return (char)my_func(i); }
...
private:
...
int my_func( int i )
{
CHECK( i >= 0 && i <= 255 ); // I will think about errors
// processing later
return v[i];
}
vactor<int> v;
...
};
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk