Ion GaztaƱaga writes:
Those test were inherited from Boost.Interprocess and when trying
Boost.Test back in 2005 I found it too heavyweight for the kind of tests
I needed, specially when using the debugger. It could an old problem
with my IDE installation but I never looked back.
After some years I've slowly started porting some tests from my
libraries (maybe not Container, I can't remember) to Core's
lightweight_test which I is dependecy-free, fast and enough for most
needs:
http://www.boost.org/boost/core/lightweight_test.hpp
Not to bead the dead horse, but I'll continue to object to any unqualified
statements about this misconception that this header is any more
lightweight than Boost.Test.
Consider this example:
#include
int main()
{
int object1 = 1;
int object2 = 2;
boost::swap(object1,object2);
BOOST_TEST(object1 == 2);
BOOST_TEST(object2 == 1);
return boost::report_errors();
}
and compare with Boost.Test version:
#define BOOST_TEST_MODULE my test
#include
BOOST_AUTO_TEST_CASE(trivial_swap)
{
int object1 = 1;
int object2 = 2;
boost::swap(object1,object2);
BOOST_TEST(object1 == 2);
BOOST_TEST(object2 == 1);
}
As you can see Boost.Test version is at least as simple. On majority of
modern hardware it takes as much time to build. And I am not even going to
list all the other advantages (better log and report and so on) Boost.Test
version has.
Furthermore, most developer do need at least some form of test
organization. See for example boost sources where lightweight_test.hpp is
used. You will find many cases that look like this:
....
int main()
{
test<1>();
test<2>();
test<4>();
test<8>();
test<16>();
test<32>();
test<64>();
test<128>();
return boost::report_errors();
}
OR
...
int main()
{
test_integral();
test_floating_point();
test_nullptr_t();
test_pointer();
test_member_pointer();
test_enum();
test_class();
return boost::report_errors();
}
Boost.Test based test modules would have look simpler in these cases,
provide better error attribution and many many more other thing.
You are free to use anything for your unit test, but if you are making
claims please back them up.
Gennadiy