Boost C++ Libraries

...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
PrevUpHomeNext
BOOST_TEST(statement);
BOOST_TEST_<level>(statement);

// replacement failure message, requires variadic macros
BOOST_TEST(statement, "failure message");

// Floating point comparison, requires variadic macros, auto and decltype
BOOST_TEST(statement, floating_point_comparison_manipulation);

// bitwise comparison, requires variadic macros, auto and decltype
BOOST_TEST(statement, boost::test_tools::bitwise() );

// element-wise comparison, for containers
BOOST_TEST(statement, boost::test_tools::per_element() );

// lexicographic comparison, for containers
BOOST_TEST(statement, boost::test_tools::lexicographic() );

The full documentation of this macro is located here.

The macro is available in three variants, corresponding to different assertion severity levels:

BOOST_TEST // or BOOST_TEST_CHECK
BOOST_TEST_REQUIRE
BOOST_TEST_WARN
  • "failure message" is a C-string printed in case of failure in place of the default message. See this section for more details.
  • floating_point_comparison_manipulation is one of the floating point comparison manipulators. See this section for more details.
  • boost::test_tools::bitwise is a manipulator indicating that the comparison should be performed bitwise. See this section for more details
  • boost::test_tools::per_element is a manipulator indicating that the comparison should be performed on each element, in sequence, rather than on containers. See this section for more details
  • boost::test_tools::lexicographic is a manipulator indicating that the comparison should be performed with the lexicographic order. See this section for more details

Limitations and workaround

There are some restrictions on the statements that are supported by this tool. Those are explained in details in this section.


PrevUpHomeNext