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)
5
6// See http://www.boost.org/libs/test for the library home page.
7//
8// File : $RCSfile$
9//
10// Version : $Revision: 74248 $
11//
12// Description : inidiration interfaces to support manipulators and message output
13// ***************************************************************************
14
15#ifndef BOOST_TEST_TOOLS_DETAIL_INDIRECTIONS_HPP_112812GER
16#define BOOST_TEST_TOOLS_DETAIL_INDIRECTIONS_HPP_112812GER
17
18// Boost.Test
19#include <boost/test/tools/detail/fwd.hpp>
20
21#include <boost/test/tools/assertion_result.hpp>
22
23#include <boost/test/detail/suppress_warnings.hpp>
24
25//____________________________________________________________________________//
26
27namespace boost {
28namespace test_tools {
29namespace tt_detail {
30
31// ************************************************************************** //
32// ************** assertion_evaluate indirection ************** //
33// ************************************************************************** //
34
35template<typename E>
36struct assertion_evaluate_t {
37 assertion_evaluate_t( E const& e ) : m_e( e ) {}
38 operator assertion_result() { return m_e.evaluate( true ); }
39
40 E const& m_e;
41};
42
43//____________________________________________________________________________//
44
45template<typename E>
46inline assertion_evaluate_t<E>
47assertion_evaluate( E const& e ) { return assertion_evaluate_t<E>( e ); }
48
49//____________________________________________________________________________//
50
51template<typename E, typename T>
52inline assertion_evaluate_t<E>
53operator<<( assertion_evaluate_t<E> const& ae, T const& ) { return ae; }
54
55//____________________________________________________________________________//
56
57// ************************************************************************** //
58// ************** assertion_text indirection ************** //
59// ************************************************************************** //
60
61template<typename T>
62inline unit_test::lazy_ostream const&
63assertion_text( unit_test::lazy_ostream const& /*et*/, T const& m ) { return m; }
64
65//____________________________________________________________________________//
66
67inline unit_test::lazy_ostream const&
68assertion_text( unit_test::lazy_ostream const& et, int ) { return et; }
69
70//____________________________________________________________________________//
71
72// ************************************************************************** //
73// ************** assertion_evaluate indirection ************** //
74// ************************************************************************** //
75
76struct assertion_type {
77 operator check_type() { return CHECK_MSG; }
78};
79
80//____________________________________________________________________________//
81
82template<typename T>
83inline assertion_type
84operator<<( assertion_type const& at, T const& ) { return at; }
85
86//____________________________________________________________________________//
87
88} // namespace tt_detail
89} // namespace test_tools
90} // namespace boost
91
92#include <boost/test/detail/enable_warnings.hpp>
93
94#endif // BOOST_TEST_TOOLS_DETAIL_INDIRECTIONS_HPP_112812GER
95

source code of boost/boost/test/tools/detail/indirections.hpp