BOOST_IS_DEFINED( symbol )

Unlike the rest of the tools in the toolbox this tool does not perform the logging itself. It's only purpose is to check at runtime whether or not the supplied preprocessor symbol is defined. Use it in combination with BOOST_CHECK to perform and log validation. Macros of any arity could be checked. To check the macro definition with non-zero arity specify dummy arguments for it. See below for example.

The only tool's argument is a preprocessor symbol that gets validated.

Example: test.cpp

#define BOOST_TEST_MAIN
#include <boost/test/unit_test.hpp>
BOOST_AUTO_TEST_CASE( test ) { BOOST_CHECK( BOOST_IS_DEFINED(SYMBOL1) ); BOOST_CHECK( BOOST_IS_DEFINED(SYMBOL2(arg)) ); }

Output:

test.cpp(6): error in "test": check ::boost::test_tools::tt_detail::is_defined_impl( "SYMBOL1", "= SYMBOL1" ) failed
test.cpp(7): error in "test": check ::boost::test_tools::tt_detail::is_defined_impl( "SYMBOL2(arg)", "= SYMBOL2(arg)" ) failed

*** 2 failures detected in test suite "Master Test Suite"

See Also

BOOST_CHECK