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.
9 //!@brief C string comparison with enhanced reporting
10 // ***************************************************************************
12 #ifndef BOOST_TEST_TOOLS_CSTRING_COMPARISON_OP_HPP_050815GER
13 #define BOOST_TEST_TOOLS_CSTRING_COMPARISON_OP_HPP_050815GER
16 #include <boost/test/tools/assertion.hpp>
18 #include <boost/test/utils/is_cstring.hpp>
19 #include <boost/test/utils/basic_cstring/compare.hpp>
22 #include <boost/utility/enable_if.hpp>
24 #include <boost/test/detail/suppress_warnings.hpp>
26 //____________________________________________________________________________//
29 namespace test_tools {
33 // ************************************************************************** //
34 // ************** string_compare ************** //
35 // ************************************************************************** //
37 #define DEFINE_CSTRING_COMPARISON( oper, name, rev ) \
38 template<typename Lhs,typename Rhs> \
39 struct name<Lhs,Rhs,typename boost::enable_if_c< \
40 ( unit_test::is_cstring_comparable<Lhs>::value \
41 && unit_test::is_cstring_comparable<Rhs>::value) \
44 typedef typename unit_test::deduce_cstring<Lhs>::type lhs_char_type; \
45 typedef typename unit_test::deduce_cstring<Rhs>::type rhs_char_type; \
47 typedef assertion_result result_type; \
50 typename lhs_char_type::value_type, \
51 typename rhs_char_type::value_type> elem_op; \
54 eval( Lhs const& lhs, Rhs const& rhs) \
56 return lhs_char_type(lhs) oper rhs_char_type(rhs); \
59 template<typename PrevExprType> \
61 report( std::ostream& ostr, \
62 PrevExprType const& lhs, \
67 << tt_detail::print_helper( rhs ); \
70 static char const* revert() \
71 { return " " #rev " "; } \
75 BOOST_TEST_FOR_EACH_COMP_OP( DEFINE_CSTRING_COMPARISON )
76 #undef DEFINE_CSTRING_COMPARISON
78 //____________________________________________________________________________//
81 } // namespace assertion
82 } // namespace test_tools
85 #include <boost/test/detail/enable_warnings.hpp>
87 #endif // BOOST_TEST_TOOLS_CSTRING_COMPARISON_OP_HPP_050815GER