diff --git a/include/boost/test/data/monomorphic/singleton.hpp b/include/boost/test/data/monomorphic/singleton.hpp index 1b02dde179..6b9311590a 100644 --- a/include/boost/test/data/monomorphic/singleton.hpp +++ b/include/boost/test/data/monomorphic/singleton.hpp @@ -18,9 +18,6 @@ #include -// Boost -#include - //____________________________________________________________________________// namespace boost { diff --git a/include/boost/test/tools/collection_comparison_op.hpp b/include/boost/test/tools/collection_comparison_op.hpp index fd093decd7..55d63301b3 100644 --- a/include/boost/test/tools/collection_comparison_op.hpp +++ b/include/boost/test/tools/collection_comparison_op.hpp @@ -392,9 +392,9 @@ compare_collections( Lhs const& lhs, Rhs const& rhs, boost::type >* template \ struct name::value \ + && !unit_test::is_cstring_comparable::value \ && unit_test::is_forward_iterable::value \ - && !( unit_test::is_cstring_comparable::value \ - || unit_test::is_cstring_comparable::value)>::type> { \ + && !unit_test::is_cstring_comparable::value>::type> { \ public: \ typedef assertion_result result_type; \ typedef name_inverse inverse; \ diff --git a/include/boost/test/utils/basic_cstring/basic_cstring.hpp b/include/boost/test/utils/basic_cstring/basic_cstring.hpp index 09a70dd53d..d1953dbd36 100644 --- a/include/boost/test/utils/basic_cstring/basic_cstring.hpp +++ b/include/boost/test/utils/basic_cstring/basic_cstring.hpp @@ -170,26 +170,6 @@ class BOOST_SYMBOL_VISIBLE basic_cstring { static CharT null; }; -// ************************************************************************** // -// ************** cstring_forward_iterable_helper ************** // -// ************************************************************************** // - - -// Helper for instantiating a subclass of cstring using a forward iterable. -//! @internal -template -class BOOST_SYMBOL_VISIBLE cstring_forward_iterable_helper : public basic_cstring { -public: - cstring_forward_iterable_helper(forward_iterable const& fi) - : m_storage(fi.begin(), fi.end()) - { - this->assign(m_storage.c_str(), m_storage.size()); - } -private: - std::basic_string m_storage; -}; - - // ************************************************************************** // // ************** cstring_string_view_helper ************** // // ************************************************************************** // diff --git a/include/boost/test/utils/is_cstring.hpp b/include/boost/test/utils/is_cstring.hpp index 4b562a93d0..ffec3657ac 100644 --- a/include/boost/test/utils/is_cstring.hpp +++ b/include/boost/test/utils/is_cstring.hpp @@ -12,9 +12,6 @@ #ifndef BOOST_TEST_UTILS_IS_CSTRING_HPP #define BOOST_TEST_UTILS_IS_CSTRING_HPP -// Boost.Test -#include - // Boost #include #include @@ -56,13 +53,17 @@ struct is_cstring_impl : public mpl::true_ {}; template<> struct is_cstring_impl : public mpl::true_ {}; -template ::value, - bool is_forward_iterable_ = is_forward_iterable::value> +template ::type>::value > struct deduce_cstring_transform_impl; +template +struct deduce_cstring_transform_impl : public deduce_cstring_transform_impl{}; + +template +struct deduce_cstring_transform_impl : public deduce_cstring_transform_impl{}; + template -struct deduce_cstring_transform_impl { +struct deduce_cstring_transform_impl { typedef typename boost::add_const< typename boost::remove_pointer< typename boost::decay::type @@ -72,27 +73,21 @@ struct deduce_cstring_transform_impl { }; template -struct deduce_cstring_transform_impl { - typedef typename boost::remove_const::value_type>::type U; - typedef typename boost::conditional< - boost::is_same::value || boost::is_same::value, - cstring_forward_iterable_helper, - T>::type type; -}; - -template -struct deduce_cstring_transform_impl< T, false, false > { - typedef T type; +struct deduce_cstring_transform_impl< T, false > { + typedef typename + boost::remove_const< + typename boost::remove_reference::type + >::type type; }; template -struct deduce_cstring_transform_impl< std::basic_string >, false, true > { +struct deduce_cstring_transform_impl< std::basic_string >, false > { typedef boost::unit_test::basic_cstring::type> type; }; #if defined(BOOST_TEST_STRING_VIEW) template -struct deduce_cstring_transform_impl< std::basic_string_view >, false, true > { +struct deduce_cstring_transform_impl< std::basic_string_view >, false > { private: using sv_t = std::basic_string_view > ; @@ -125,7 +120,11 @@ struct is_cstring_comparable< boost::unit_test::basic_cstring, false > : publ template struct deduce_cstring_transform { - typedef typename ut_detail::deduce_cstring_transform_impl::type>::type type; + typedef typename + boost::remove_const< + typename boost::remove_reference::type + >::type U; + typedef typename ut_detail::deduce_cstring_transform_impl::type>::type type; }; } // namespace unit_test diff --git a/include/boost/test/utils/is_forward_iterable.hpp b/include/boost/test/utils/is_forward_iterable.hpp index 14f7be3b85..d6d8dd8a85 100644 --- a/include/boost/test/utils/is_forward_iterable.hpp +++ b/include/boost/test/utils/is_forward_iterable.hpp @@ -22,10 +22,10 @@ #endif #endif +#if defined(BOOST_TEST_FWD_ITERABLE_CXX03) // Boost #include -#if defined(BOOST_TEST_FWD_ITERABLE_CXX03) // STL #include #include @@ -37,10 +37,10 @@ // Boost #include #include -#include -#include #include #include +#include +#include // STL #include diff --git a/test/writing-test-ts/collection-comparison-test.cpp b/test/writing-test-ts/collection-comparison-test.cpp index 3dad80c513..8c5ff7033b 100644 --- a/test/writing-test-ts/collection-comparison-test.cpp +++ b/test/writing-test-ts/collection-comparison-test.cpp @@ -142,17 +142,12 @@ BOOST_AUTO_TEST_CASE( test_collection_of_collection_comp ) //____________________________________________________________________________// -BOOST_AUTO_TEST_CASE( test_string_non_string ) +BOOST_AUTO_TEST_CASE( test_string_non_string_per_element ) { - std::string a("abc"); - std::vector b{'a', 'b', 'c'}; - std::vector c{'a', 'b', 'c'}; + char const* a = "abc"; + std::vector b{'a', 'b', 'c'}; BOOST_TEST( a == b, tt::per_element() ); BOOST_TEST( b == a, tt::per_element() ); - BOOST_TEST( a == c, tt::per_element() ); - BOOST_TEST( c == a, tt::per_element() ); - BOOST_TEST( b == c, tt::per_element() ); - BOOST_TEST( c == b, tt::per_element() ); } //____________________________________________________________________________//