]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/boost/test/tools/cstring_comparison_op.hpp
import new upstream nautilus stable release 14.2.8
[ceph.git] / ceph / src / boost / boost / test / tools / cstring_comparison_op.hpp
CommitLineData
7c673cae
FG
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
9//!@brief C string comparison with enhanced reporting
10// ***************************************************************************
11
12#ifndef BOOST_TEST_TOOLS_CSTRING_COMPARISON_OP_HPP_050815GER
13#define BOOST_TEST_TOOLS_CSTRING_COMPARISON_OP_HPP_050815GER
14
15// Boost.Test
16#include <boost/test/tools/assertion.hpp>
17
18#include <boost/test/utils/is_cstring.hpp>
19#include <boost/test/utils/basic_cstring/compare.hpp>
20
21// Boost
22#include <boost/utility/enable_if.hpp>
23
24#include <boost/test/detail/suppress_warnings.hpp>
25
26//____________________________________________________________________________//
27
28namespace boost {
29namespace test_tools {
30namespace assertion {
31namespace op {
32
7c673cae
FG
33// ************************************************************************** //
34// ************** string_compare ************** //
35// ************************************************************************** //
36
37#define DEFINE_CSTRING_COMPARISON( oper, name, rev ) \
38template<typename Lhs,typename Rhs> \
39struct name<Lhs,Rhs,typename boost::enable_if_c< \
b32b8144
FG
40 ( unit_test::is_cstring_comparable<Lhs>::value \
41 && unit_test::is_cstring_comparable<Rhs>::value) \
42 >::type > \
43{ \
92f5a8d4
TL
44 typedef typename unit_test::deduce_cstring_transform<Lhs>::type lhs_char_type; \
45 typedef typename unit_test::deduce_cstring_transform<Rhs>::type rhs_char_type; \
7c673cae
FG
46public: \
47 typedef assertion_result result_type; \
48 \
b32b8144
FG
49 typedef name< \
50 typename lhs_char_type::value_type, \
51 typename rhs_char_type::value_type> elem_op; \
52 \
7c673cae
FG
53 static bool \
54 eval( Lhs const& lhs, Rhs const& rhs) \
55 { \
b32b8144 56 return lhs_char_type(lhs) oper rhs_char_type(rhs); \
7c673cae
FG
57 } \
58 \
59 template<typename PrevExprType> \
60 static void \
61 report( std::ostream& ostr, \
62 PrevExprType const& lhs, \
63 Rhs const& rhs) \
64 { \
65 lhs.report( ostr ); \
66 ostr << revert() \
67 << tt_detail::print_helper( rhs ); \
68 } \
69 \
70 static char const* revert() \
71 { return " " #rev " "; } \
72}; \
73/**/
74
75BOOST_TEST_FOR_EACH_COMP_OP( DEFINE_CSTRING_COMPARISON )
76#undef DEFINE_CSTRING_COMPARISON
77
78//____________________________________________________________________________//
79
80} // namespace op
81} // namespace assertion
82} // namespace test_tools
83} // namespace boost
84
85#include <boost/test/detail/enable_warnings.hpp>
86
87#endif // BOOST_TEST_TOOLS_CSTRING_COMPARISON_OP_HPP_050815GER
88