sl@0: #ifndef BOOST_DETAIL_LIGHTWEIGHT_TEST_HPP_INCLUDED sl@0: #define BOOST_DETAIL_LIGHTWEIGHT_TEST_HPP_INCLUDED sl@0: sl@0: // MS compatible compilers support #pragma once sl@0: sl@0: #if defined(_MSC_VER) && (_MSC_VER >= 1020) sl@0: # pragma once sl@0: #endif sl@0: sl@0: // sl@0: // boost/detail/lightweight_test.hpp - lightweight test library sl@0: // sl@0: // Copyright (c) 2002 Peter Dimov and Multi Media Ltd. sl@0: // sl@0: // Distributed under the Boost Software License, Version 1.0. (See sl@0: // accompanying file LICENSE_1_0.txt or copy at sl@0: // http://www.boost.org/LICENSE_1_0.txt) sl@0: // sl@0: // BOOST_TEST(expression) sl@0: // BOOST_ERROR(message) sl@0: // sl@0: // int boost::report_errors() sl@0: // sl@0: sl@0: #include sl@0: #include sl@0: sl@0: namespace boost sl@0: { sl@0: sl@0: namespace detail sl@0: { sl@0: sl@0: inline int & test_errors() sl@0: { sl@0: static int x = 0; sl@0: return x; sl@0: } sl@0: sl@0: inline void test_failed_impl(char const * expr, char const * file, int line, char const * function) sl@0: { sl@0: std::cerr << file << "(" << line << "): test '" << expr << "' failed in function '" << function << "'" << std::endl; sl@0: ++test_errors(); sl@0: } sl@0: sl@0: inline void error_impl(char const * msg, char const * file, int line, char const * function) sl@0: { sl@0: std::cerr << file << "(" << line << "): " << msg << " in function '" << function << "'" << std::endl; sl@0: ++test_errors(); sl@0: } sl@0: sl@0: } // namespace detail sl@0: sl@0: inline int report_errors() sl@0: { sl@0: int errors = detail::test_errors(); sl@0: sl@0: if(errors == 0) sl@0: { sl@0: std::cerr << "No errors detected." << std::endl; sl@0: return 0; sl@0: } sl@0: else sl@0: { sl@0: std::cerr << errors << " error" << (errors == 1? "": "s") << " detected." << std::endl; sl@0: return 1; sl@0: } sl@0: } sl@0: sl@0: } // namespace boost sl@0: sl@0: #define BOOST_TEST(expr) ((expr)? (void)0: ::boost::detail::test_failed_impl(#expr, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION)) sl@0: #define BOOST_ERROR(msg) ::boost::detail::error_impl(msg, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION) sl@0: sl@0: #endif // #ifndef BOOST_DETAIL_LIGHTWEIGHT_TEST_HPP_INCLUDED