Update contrib.
1 #ifndef BOOST_DETAIL_LIGHTWEIGHT_TEST_HPP_INCLUDED
2 #define BOOST_DETAIL_LIGHTWEIGHT_TEST_HPP_INCLUDED
4 // MS compatible compilers support #pragma once
6 #if defined(_MSC_VER) && (_MSC_VER >= 1020)
11 // boost/detail/lightweight_test.hpp - lightweight test library
13 // Copyright (c) 2002 Peter Dimov and Multi Media Ltd.
15 // Distributed under the Boost Software License, Version 1.0. (See
16 // accompanying file LICENSE_1_0.txt or copy at
17 // http://www.boost.org/LICENSE_1_0.txt)
19 // BOOST_TEST(expression)
20 // BOOST_ERROR(message)
22 // int boost::report_errors()
25 #include <boost/current_function.hpp>
34 inline int & test_errors()
40 inline void test_failed_impl(char const * expr, char const * file, int line, char const * function)
42 std::cerr << file << "(" << line << "): test '" << expr << "' failed in function '" << function << "'" << std::endl;
46 inline void error_impl(char const * msg, char const * file, int line, char const * function)
48 std::cerr << file << "(" << line << "): " << msg << " in function '" << function << "'" << std::endl;
54 inline int report_errors()
56 int errors = detail::test_errors();
60 std::cerr << "No errors detected." << std::endl;
65 std::cerr << errors << " error" << (errors == 1? "": "s") << " detected." << std::endl;
72 #define BOOST_TEST(expr) ((expr)? (void)0: ::boost::detail::test_failed_impl(#expr, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION))
73 #define BOOST_ERROR(msg) ::boost::detail::error_impl(msg, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION)
75 #endif // #ifndef BOOST_DETAIL_LIGHTWEIGHT_TEST_HPP_INCLUDED