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 {
35 // ************************************************************************** //
36 // ************** string_compare ************** //
37 // ************************************************************************** //
39 #define DEFINE_CSTRING_COMPARISON( oper, name, rev ) \
40 template<typename Lhs,typename Rhs> \
41 struct name<Lhs,Rhs,typename boost::enable_if_c< \
42 unit_test::is_cstring<Lhs>::value && \
43 unit_test::is_cstring<Rhs>::value>::type> { \
44 typedef typename boost::add_const< \
45 typename remove_pointer< \
46 typename decay<Lhs>::type>::type>::type \
48 typedef typename boost::add_const< \
49 typename remove_pointer< \
50 typename decay<Rhs>::type>::type>::type \
53 typedef assertion_result result_type; \
56 eval( Lhs const& lhs, Rhs const& rhs) \
58 return unit_test::basic_cstring<lhs_char_type>(lhs) oper \
59 unit_test::basic_cstring<rhs_char_type>(rhs); \
62 template<typename PrevExprType> \
64 report( std::ostream& ostr, \
65 PrevExprType const& lhs, \
70 << tt_detail::print_helper( rhs ); \
73 static char const* revert() \
74 { return " " #rev " "; } \
78 BOOST_TEST_FOR_EACH_COMP_OP( DEFINE_CSTRING_COMPARISON )
79 #undef DEFINE_CSTRING_COMPARISON
81 //____________________________________________________________________________//
84 } // namespace assertion
85 } // namespace test_tools
88 #include <boost/test/detail/enable_warnings.hpp>
90 #endif // BOOST_TEST_TOOLS_CSTRING_COMPARISON_OP_HPP_050815GER