Using fixtures in Boost.Test
The larger a test module is and the more similar the test cases are, the more likely it is to have test cases that require the same setup, cleanup, and maybe the same data. A component that contains these is called a test fixture or test context. Fixtures are important to establish a well-defined environment for running tests so that the results are repeatable. Examples can include copying a specific set of files to some location before executing the tests and deleting them after, or loading data from a particular data source.
Boost.Test provides several ways to define test fixtures for a test case, test suite, or a module (globally). In this recipe, we will look at how fixtures work.
Getting ready
The examples in this recipe use the following classes and functions for specifying test unit fixtures:
struct standard_fixture
{
standard_fixture() {BOOST_TEST_MESSAGE("setup");}
~standard_fixture() {BOOST_TEST_MESSAGE...