Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions include/boost/test/tools/cstring_comparison_op.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include <boost/test/tools/assertion.hpp>

#include <boost/test/utils/is_cstring.hpp>
#include <boost/test/utils/is_forward_iterable.hpp>
#include <boost/test/utils/basic_cstring/compare.hpp>

// Boost
Expand All @@ -37,8 +38,12 @@ namespace op {
#define DEFINE_CSTRING_COMPARISON( oper, name, rev, name_inverse ) \
template<typename Lhs,typename Rhs> \
struct name<Lhs,Rhs,typename boost::enable_if_c< \
( unit_test::is_cstring_comparable<Lhs>::value \
&& unit_test::is_cstring_comparable<Rhs>::value) \
( ( unit_test::is_cstring_comparable<Lhs>::value \
&& unit_test::is_cstring_comparable<Rhs>::value) \
|| ( unit_test::is_cstring_comparable<Lhs>::value \
&& unit_test::is_forward_iterable<Rhs>::value) \
|| ( unit_test::is_forward_iterable<Lhs>::value \
&& unit_test::is_cstring_comparable<Rhs>::value)) \
>::type > \
{ \
typedef typename unit_test::deduce_cstring_transform<Lhs>::type lhs_char_type; \
Expand Down
10 changes: 10 additions & 0 deletions test/writing-test-ts/collection-comparison-test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,16 @@ BOOST_AUTO_TEST_CASE( test_collection_of_collection_comp )

//____________________________________________________________________________//

BOOST_AUTO_TEST_CASE( test_string_non_string_per_element )
{
char const* a = "abc";
std::vector<int> b{'a', 'b', 'c'};
BOOST_TEST( a == b, tt::per_element() );
BOOST_TEST( b == a, tt::per_element() );
}

//____________________________________________________________________________//

// this one does not have const_iterator nor a size, but should be forward iterable
// and possible to use in the collection comparison
struct fwd_iterable_custom {
Expand Down