|
Boost : |
From: Gennadiy Rozental (gennadiy.rozental_at_[hidden])
Date: 2002-12-01 23:06:45
> Actually I was hoping you would choose option 3. :-) For me, option 2
> just doesn't feel right. And I think it's not in the spirit of the
> standard, either. (Implicit conversion from char * to string doesn't
> exist, a char * is just a pointer.) I would classify this as
> "suprising behaviour" which should be avoided wherever possible.
Test library is all about usability and only then generocity or "standart
purity". Would you be working with c strings I wonder how long it will take
until you became tired adding std::string on both sides of comparison:
BOOST_CHECK_EQUAL( std::string( s ), std::string( t ) );
...
BOOST_CHECK_EQUAL( std::string( s ), std::string( t ) );
...
BOOST_CHECK_EQUAL( std::string( s ), std::string( t ) );
and will introduce simple forwarding macro
#define M_CHECK_EQUAL_STR( s, t ) \
BOOST_CHECK_EQUAL( std::string( s ), std::string( t ) );
Boost.Test is doing this for you now. There is a very little posibility of
misuse (comparison of pointers as check for correctness is very strange
things in general IMO).
Gennadiy.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk