Boost logo

Boost :

From: Robert Ramey (ramey_at_[hidden])
Date: 2006-06-10 12:59:43


Dear Gennadiy Rozental,

I've converted my local copy of the serialization library tests to use
test/minimal.hpp in the hope that I can use it in the future as the "lowest
common denominator" to permit testing against a wider array of platforms.

Boost Test for support of msvc is scheduled to be remove in the near future.

I've had problems testing the serialization library with comeau compilers
because both the seriailzation library and boost test include instantiated
code for string output and the comeau "pre-linker" fails here.

I've felt the need for a "lighter weight" version of boost test. Recently
on a contract job of mine I used some headers from boost. I didn't need to
compile any boost libraries in this case. The existence of test/minimal.hpp
permitted me to use boost test without going building the libraries which
turned out to be very convenient for a number of reasons.

So - I'm happy with test/minimal.hpp -

But - in order to make it work with the serialization library I had to make
a couple of tweaks which I would like to submit in the hope that they can be
incorporated into the official boost test version.

Change # 1

A small change to permit commeau to be tested with the serialization
library. This is obviously a crude hack but perhaps it can be fine tuned to
make it acceptable.

RCS file: /cvsroot/boost/boost/boost/test/impl/unit_test_parameters.ipp,v
retrieving revision 1.10
diff -r1.10 unit_test_parameters.ipp
204,205c204,205
< const_string rs_str = retrieve_framework_parameter( RANDOM_SEED, argc,
argv );
< s_random_seed = rs_str.is_empty() ? 0 : lexical_cast<unsigned
int>(rs_str );

---
> //    const_string rs_str = retrieve_framework_parameter( RANDOM_SEED, 
> argc, argv );
> //    s_random_seed       = rs_str.is_empty() ? 0 : lexical_cast<unsigned 
> int>( rs_str );
Change #2
I added some test tool macros for test/minimal.hpp .  I would like to see 
these incorporated but of course could life without them if I have to.
Index: minimal.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/test/minimal.hpp,v
retrieving revision 1.19
diff -r1.19 minimal.hpp
17a18,19
> #define BOOST_TEST_INCLUDED
>
22a25,29
> #define BOOST_WARN(exp)        \
>   ( (exp)                      \
>       ? static_cast<void>(0)   \
>       : boost::minimal_test::report_message(#exp,__FILE__,__LINE__, 
> BOOST_CURRENT_FUNCTION, true) )
>
27a35,62
> #define BOOST_CHECK_MESSAGE(exp, msg_)       \
>   ( (exp)                      \
>       ? static_cast<void>(0)   \
>       : boost::minimal_test::report_error(msg_,__FILE__,__LINE__, 
> BOOST_CURRENT_FUNCTION) )
>
> #define BOOST_WARN_MESSAGE(exp, msg_)       \
>   ( (exp)                      \
>       ? static_cast<void>(0)   \
>       : boost::minimal_test::report_message(msg_,__FILE__,__LINE__, 
> BOOST_CURRENT_FUNCTION) )
>
> #define BOOST_REQUIRE_MESSAGE(exp, msg_)     \
>   ( (exp)                      \
>       ? static_cast<void>(0)   \
>       : 
> boost::minimal_test::report_critical_error(msg_,__FILE__,__LINE__,BOOST_CURRENT_FUNCTION))
>
> #define BOOST_WARN_EQUAL( left, right ) \
>     BOOST_WARN((left) == (right))
> #define BOOST_CHECK_EQUAL( left, right ) \
>     BOOST_CHECK((left) == (right))
> #define BOOST_REQUIRE_EQUAL( left, right ) \
>     BOOST_require((left) == (right))
>
> #define BOOST_TEST_CHECKPOINT(msg_) \
>         boost::minimal_test::report_message( (msg_),__FILE__,__LINE__, 
> BOOST_CURRENT_FUNCTION, true )
>
> #define BOOST_TEST_MESSAGE(msg_) \
>         boost::minimal_test::report_message( (msg_),__FILE__,__LINE__, 
> BOOST_CURRENT_FUNCTION, true )
>
29a65
>
32a69,70
> #define BOOST_TEST_DONT_PRINT_LOG_VALUE( ArgumentType )
>
36c74,75
< #include <boost/test/detail/global_typedef.hpp>
---
> #define BOOST_DISABLE_WIN32
> //#include <boost/test/detail/global_typedef.hpp>
38c77
< #include <boost/test/utils/class_properties.hpp>
---
> //#include <boost/test/utils/class_properties.hpp>
42c81
< #include <boost/cstdlib.hpp>            // for exit codes#include 
<boost/cstdlib.hpp>            // for exit codes
---
> //#include <boost/cstdlib.hpp>            // for exit codes#include 
> <boost/cstdlib.hpp>            // for exit codes
47c86
< #include <string>                       // std::string
---
> //#include <string>                       // std::string
63c102
< report_error( const char* msg, const char* file, int line, const_string 
func_name, bool is_msg = false )
---
> report_message( const char* msg, const char* file, int line, const_string 
> func_name, bool is_msg = false )
65d103
<     ++errors_counter();
79a118,124
> report_error( const char* msg, const char* file, int line, const_string 
> func_name, bool is_msg = false )
> {
>     ++errors_counter();
>     report_message(msg, file, line, func_name, is_msg);
> }
>
> inline void
Thank you very much - I should say that one of your boost articles - maybe 
its still in there about how testing can change your life had a great effect 
on me.  It has been very helpful to me personally.  The "testing philosophy" 
expounded there - along with the instant availability of test/minimal.hpp - 
has made a night / day difference in the quality of code produced at one
of my customers.
Though off topic, I never really thanked you for your in depth review of the 
my original serialization library submission.  Except for one tiny slip 
("... contains this gem"), it was an exhaustive point by point critique of 
every aspect of it.  Not that I enjoyed being on the receiving end of such 
criticism, it was clear to me that it was basically correct and well thought 
out.. After I recovered from the rejection I went back and re-did it using 
your critique as a checklist and was eventually successful in getting the 
library accepted.  So, for better or worse,  this library is part of boost 
only because of your six hour investment.
Robert Ramey

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk