From c96ad4ccbaab46a8b492414eb2a622d096d62651 Mon Sep 17 00:00:00 2001 From: Bjorn Reese Date: Sat, 11 Feb 2017 18:39:06 +0100 Subject: [PATCH] Added container sizes to error output of test_all_eq_impl --- include/boost/core/lightweight_test.hpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/include/boost/core/lightweight_test.hpp b/include/boost/core/lightweight_test.hpp index e263e01..4532819 100644 --- a/include/boost/core/lightweight_test.hpp +++ b/include/boost/core/lightweight_test.hpp @@ -187,9 +187,16 @@ void test_all_eq_impl(FormattedOutputFunction& output, ForwardIterator1 first_begin, ForwardIterator1 first_end, ForwardIterator2 second_begin, ForwardIterator2 second_end) { - if (std::distance(first_begin, first_end) != std::distance(second_begin, second_end)) + typename std::iterator_traits::difference_type first_distance = std::distance(first_begin, first_end); + typename std::iterator_traits::difference_type second_distance = std::distance(second_begin, second_end); + if (first_distance != second_distance) { - ::boost::detail::error_impl("Container sizes are different", file, line, function); + output << file << "(" << line << "): " + << "Container sizes are different" + << " in function '" << function << "': " + << first_distance << " != " << second_distance + << std::endl; + ++test_errors(); } else {