]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/test/tools/detail/indirections.hpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / boost / test / tools / detail / indirections.hpp
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
27 namespace boost {
28 namespace test_tools {
29 namespace tt_detail {
30
31 // ************************************************************************** //
32 // ************** assertion_evaluate indirection ************** //
33 // ************************************************************************** //
34
35 template<typename E>
36 struct 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
45 template<typename E>
46 inline assertion_evaluate_t<E>
47 assertion_evaluate( E const& e ) { return assertion_evaluate_t<E>( e ); }
48
49 //____________________________________________________________________________//
50
51 template<typename E, typename T>
52 inline assertion_evaluate_t<E>
53 operator<<( assertion_evaluate_t<E> const& ae, T const& ) { return ae; }
54
55 //____________________________________________________________________________//
56
57 // ************************************************************************** //
58 // ************** assertion_text indirection ************** //
59 // ************************************************************************** //
60
61 template<typename T>
62 inline unit_test::lazy_ostream const&
63 assertion_text( unit_test::lazy_ostream const& /*et*/, T const& m ) { return m; }
64
65 //____________________________________________________________________________//
66
67 inline unit_test::lazy_ostream const&
68 assertion_text( unit_test::lazy_ostream const& et, int ) { return et; }
69
70 //____________________________________________________________________________//
71
72 // ************************************************************************** //
73 // ************** assertion_evaluate indirection ************** //
74 // ************************************************************************** //
75
76 struct assertion_type {
77 operator check_type() { return CHECK_MSG; }
78 };
79
80 //____________________________________________________________________________//
81
82 template<typename T>
83 inline assertion_type
84 operator<<( 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