20 #ifndef OTest2_INCLUDE_OTEST2_ASSERTIONSITEMWISEIMPL_H_
21 #define OTest2_INCLUDE_OTEST2_ASSERTIONSITEMWISEIMPL_H_
30 #include <type_traits>
46 template<
typename,
typename>
class Compare_,
50 std::vector<std::string>& messages_,
57 typedef Compare_<AType_, BType_> Comparator_;
62 while(begin_a_ != end_a_ && begin_b_ != end_b_) {
63 bool condition_(cmp_(*begin_a_, *begin_b_));
66 std::ostringstream sos_;
69 sos_ <<
" item has failed: a[" << index_ <<
"] ";
71 sos_ <<
" b[" << index_ <<
"]";
72 messages_.push_back(sos_.str());
75 sos_ <<
"a[" << index_ <<
"] = ";
77 messages_.push_back(sos_.str());
80 sos_ <<
"b[" << index_ <<
"] = ";
82 messages_.push_back(sos_.str());
94 if(begin_a_ != end_a_) {
95 messages_.push_back(
"left container is bigger then the right one");
100 if(begin_b_ != end_b_) {
101 messages_.push_back(
"left container is smaller then the right one");
105 messages_.push_back(
"the check has passed");
112 template<
typename,
typename>
class Compare_,
115 bool ItemWiseAssertion::testAssertItemWiseList(
121 std::vector<std::string> messages_;
122 bool result_(Private::compareListsItemWise<Compare_>(
123 messages_, begin_a_, end_a_, begin_b_, end_b_));
124 assert(messages_.size() > 0);
128 for(
const auto& message_ : messages_)
130 return report_.getResult();
133 template<
template<
typename,
typename>
class Compare_,
typename IterA_,
typename IterB_>
139 return testAssertItemWiseList<Compare_>(begin_a_, end_a_, begin_b_, end_b_);
142 template<
template<
typename,
typename>
class Compare_,
typename ContainerA_,
typename IterB_>
144 const ContainerA_& a_,
147 return testAssertItemWiseList<Compare_>(
154 template<
template<
typename,
typename>
class Compare_,
typename IterA_,
typename ContainerB_>
158 const ContainerB_& b_) {
159 return testAssertItemWiseList<Compare_>(
166 template<
template<
typename,
typename>
class Compare_,
typename ContainerA_,
typename ContainerB_>
168 const ContainerA_& a_,
169 const ContainerB_& b_) {
170 return testAssertItemWiseList<Compare_>(