// (C) Copyright Gennadiy Rozental 2014-2015. // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org/libs/test for the library home page. // //!@file //!@brief C string comparison with enhanced reporting // *************************************************************************** #ifndef BOOST_TEST_TOOLS_CSTRING_COMPARISON_OP_HPP_050815GER #define BOOST_TEST_TOOLS_CSTRING_COMPARISON_OP_HPP_050815GER // Boost.Test #include #include #include // Boost #include #include //____________________________________________________________________________// namespace boost { namespace test_tools { namespace assertion { namespace op { // ************************************************************************** // // ************** string_compare ************** // // ************************************************************************** // #define DEFINE_CSTRING_COMPARISON( oper, name, rev ) \ template \ struct name::value && \ unit_test::is_cstring::value>::type> { \ typedef typename boost::add_const< \ typename remove_pointer< \ typename decay::type>::type>::type \ lhs_char_type; \ typedef typename boost::add_const< \ typename remove_pointer< \ typename decay::type>::type>::type \ rhs_char_type; \ public: \ typedef assertion_result result_type; \ \ static bool \ eval( Lhs const& lhs, Rhs const& rhs) \ { \ return unit_test::basic_cstring(lhs) oper \ unit_test::basic_cstring(rhs); \ } \ \ template \ static void \ report( std::ostream& ostr, \ PrevExprType const& lhs, \ Rhs const& rhs) \ { \ lhs.report( ostr ); \ ostr << revert() \ << tt_detail::print_helper( rhs ); \ } \ \ static char const* revert() \ { return " " #rev " "; } \ }; \ /**/ BOOST_TEST_FOR_EACH_COMP_OP( DEFINE_CSTRING_COMPARISON ) #undef DEFINE_CSTRING_COMPARISON //____________________________________________________________________________// } // namespace op } // namespace assertion } // namespace test_tools } // namespace boost #include #endif // BOOST_TEST_TOOLS_CSTRING_COMPARISON_OP_HPP_050815GER