May 2017
Intermediate to advanced
590 pages
17h 18m
English
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("cleanup");} int n {42}; }; struct extended_fixture { std::string name; int data; extended_fixture(std::string const & n = "") : name(n), data(0) { BOOST_TEST_MESSAGE("setup "+ name); } ~extended_fixture() { BOOST_TEST_MESSAGE("cleanup "+ name); } }; void fixture_setup() { BOOST_TEST_MESSAGE("fixture setup"); } void fixture_cleanup() { BOOST_TEST_MESSAGE("fixture cleanup"); }
Read now
Unlock full access