Can I link multiple BOOST unit tests into a single test binary?

I guess, this is precisely how to use boost test.
I would keep one short main.cpp file consisting of literally 2 lines:

#define BOOST_TEST_MODULE "C++ Unit Tests for MyTangledLibrary"
#include <boost/test/included/unit_test.hpp>

And then I would keep adding test module *.cpp files compiled together into one executable

#include <boost/test/unit_test.hpp>
<< your include files >>

BOOST_AUTO_TEST_SUITE(FancyShmancyLogic)

BOOST_AUTO_TEST_CASE(TestingIf2x3equals6)
{
  ...
}

BOOST_AUTO_TEST_CASE(TestingIf2x2equals4)
{
  ...
}

BOOST_AUTO_TEST_SUITE_END()

Yes, you will be able to compile that main.cpp and all of your modules into one large executable.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)