1 // (C) Copyright Gennadiy Rozental 2001.
2 // Distributed under the Boost Software License, Version 1.0.
3 // (See accompanying file LICENSE_1_0.txt or copy at
4 // http://www.boost.org/LICENSE_1_0.txt)
6 // See http://www.boost.org/libs/test for the library home page.
10 // Version : $Revision: 74248 $
12 // Description : inidiration interfaces to support manipulators and message output
13 // ***************************************************************************
15 #ifndef BOOST_TEST_TOOLS_DETAIL_INDIRECTIONS_HPP_112812GER
16 #define BOOST_TEST_TOOLS_DETAIL_INDIRECTIONS_HPP_112812GER
19 #include <boost/test/tools/detail/fwd.hpp>
21 #include <boost/test/tools/assertion_result.hpp>
23 #include <boost/test/detail/suppress_warnings.hpp>
25 //____________________________________________________________________________//
28 namespace test_tools {
31 // ************************************************************************** //
32 // ************** assertion_evaluate indirection ************** //
33 // ************************************************************************** //
36 struct assertion_evaluate_t {
37 assertion_evaluate_t( E const& e ) : m_e( e ) {}
38 operator assertion_result() { return m_e.evaluate( true ); }
43 //____________________________________________________________________________//
46 inline assertion_evaluate_t<E>
47 assertion_evaluate( E const& e ) { return assertion_evaluate_t<E>( e ); }
49 //____________________________________________________________________________//
51 template<typename E, typename T>
52 inline assertion_evaluate_t<E>
53 operator<<( assertion_evaluate_t<E> const& ae, T const& ) { return ae; }
55 //____________________________________________________________________________//
57 // ************************************************************************** //
58 // ************** assertion_text indirection ************** //
59 // ************************************************************************** //
62 inline unit_test::lazy_ostream const&
63 assertion_text( unit_test::lazy_ostream const& /*et*/, T const& m ) { return m; }
65 //____________________________________________________________________________//
67 inline unit_test::lazy_ostream const&
68 assertion_text( unit_test::lazy_ostream const& et, int ) { return et; }
70 //____________________________________________________________________________//
72 // ************************************************************************** //
73 // ************** assertion_evaluate indirection ************** //
74 // ************************************************************************** //
76 struct assertion_type {
77 operator check_type() { return CHECK_MSG; }
80 //____________________________________________________________________________//
84 operator<<( assertion_type const& at, T const& ) { return at; }
86 //____________________________________________________________________________//
88 } // namespace tt_detail
89 } // namespace test_tools
92 #include <boost/test/detail/enable_warnings.hpp>
94 #endif // BOOST_TEST_TOOLS_DETAIL_INDIRECTIONS_HPP_112812GER