Using Boost::Test for parallel code

I want to create some tests with boost::unit_test for my parallel (mpi based) C++ codes. I have some basic experiences in using the test framework. For me the main problem, when going to parallel codes, is where to put MPI::Init, such that it is called first. In the test suites I have created there is no main function. Furthermore, does Boost::Test exists correctly (with respect to mpi) when some assertions fail on a subset of the existing ranks?


Boost Test has fixture support, which allows you to perform setup/cleanup per test case, test suite, or globally. Sounds like you should put the call to MPI::Init in a global fixture.

struct MPIFixture {
    MPIFixture() { MPI::Init(); }
    ~MPIFixture() { /* I bet there's a deinit you should call */ }


If you have trouble working with that, or if you are working in a framework that provides its own main function, then you can #define BOOST_TEST_NO_MAIN before including the Boost headers. Then you can invoke boost::unit_test::unit_test_main yourself to run your test suites.

Need Your Help

FOXCHKSUM algorithm


Who knows how this function calculates checksum values?

Implementing web service with WCF 4.0 with authentification

c# .net wcf web-services

I am starting development of the new project and since I am new in the WCF world I want to ask your advice.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.