Boost logo

Boost :

From: Petr Ovchenkov (night-crow_at_[hidden])
Date: 2003-08-14 08:38:56


Hi.

What you think about conditional expansion of macros from
test_tools.hpp?

Something like

#ifdef BOOST_TEST_NO_CHECKS
# define BOOST_CHECKPOINT(message_)
# define BOOST_WARN(predicate)
....
#else // BOOST_TEST_NO_CHECKS
// Boost.Test
#include <boost/test/detail/unit_test_config.hpp>
#include <boost/test/unit_test_log.hpp>
#include <boost/test/detail/class_properties.hpp>
#include <boost/test/detail/wrap_stringstream.hpp>

// BOOST
#include <boost/cstdlib.hpp> // for boost::exit_success;
#include <boost/config.hpp> // compilers workarounds
#include <boost/shared_ptr.hpp>

#include <stdexcept> // for std::exception
#include <cstddef> // for std::size_t
#include <memory> // for std::auto_ptr
#include <string> // for std::string

#define BOOST_CHECKPOINT(message_) \
    boost::test_toolbox::detail::checkpoint_impl( \
        boost::wrap_stringstream().ref() << message_, __FILE__, __LINE__)

#define BOOST_WARN(predicate) \
    boost::test_toolbox::detail::warn_and_continue_impl((predicate), \
        boost::wrap_stringstream().ref() << #predicate, __FILE__, __LINE__)

...
#endif // BOOST_TEST_NO_CHECKS

This allow skip any checks with single #define (in sources or as compiler
option). It's may be useful in release builds, for example.

  - ptr


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk