Boost logo

Boost :

From: Ed Brey (brey_at_[hidden])
Date: 2000-12-01 13:13:20

From: "Beman Dawes" <beman_at_[hidden]>
> A preliminary Test Tools Library has been uploaded at

I think it's a great way to get the boost regression test started. I also
think that it should be a library that is designed to be used by boost users
for their own non-boost code, as well as being used by boost library
developers to test other library code. I know I'm planning on using it at
my work to as a way to kickstart a more formalized unit-level regression
testing process.

Looking at the implementation, I see one major problem: If there are
multiple translation units that include test_tools.hpp,
boost::report_non_fatal_error and boost::report_fatal_error will be multiply
defined. To solve the problem, I'd recommend moving the implementation of
those functions to test_main.hpp. I also would rename test_main.hpp to
test_main.cpp, to make it obvious that it should only be included in from a
single translation unit (or not #included at all, but rather linked in from
the boost library (.a, .lib, or .dll).

I also have a semi-nit: The long list of catches for classes deriving from
std::exception, could be replaced by:
  catch ( const std::exception & ex )
    { std::cout << typeid(ex).name() << ": " << ex.what() << std::endl; }

And finally some fundamentally nitty nits:
1. test_main.hpp(66): xmain -> test_main
2. test_main.hpp(75): ex.c_str() -> ex
3. test_main.hpp(69): boost::test_tools_exception& -> const

And then a question: In order to better support existing test apps that
return a value to indicate an error (as opposed to using the BOOST_TEST
macros or exceptions), would it be useful to have main print out the value
of "result"?

Boost list run by bdawes at, gregod at, cpdaniel at, john at