...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
BOOST_TEST
: details on expressionsOnce a test case has been declared, the body of this test should be written. A test case is a sequence of operations in which assertions are inserted. Those assertions evaluate statements that implement the expectation being validated, and report failures and/or information in a uniform manner, depending on the log level.
The Unit Test Framework's supplies a toolbox of assertions
to ease the creation and maintenance of test cases and provide a uniform error
reporting mechanism. The toolbox supplied is in most part in a form of macro
declarations. An (almost) unique interface to all of them implemented by the
macro BOOST_TEST
.
Note | |
---|---|
All macros arguments are calculated once, so it's safe to pass complex expressions in their place. |
All tools automatically supply an error location: a file name and a line number, which can also be overridden.
Caution | |
---|---|
The testing tools are intended for unit test code rather than library or
production code, where throwing exceptions, using |
For a list of all supplied testing tools and usage examples, see the summary or the reference.