20 #ifndef OTest2_INCLUDE_OTEST2_ASSERTIONSLEXIIMPL_H_
21 #define OTest2_INCLUDE_OTEST2_ASSERTIONSLEXIIMPL_H_
41 template<
template<
typename,
typename>
class Compare_,
typename IterA_,
typename IterB_>
43 std::vector<std::string>& messages_,
50 typedef Compare_<AType_, BType_> Comparator_;
54 std::ostringstream sos_;
55 while(begin_a_ != end_a_ && begin_b_ != end_b_) {
56 int cmp_result_(cmp_.checkItems(*begin_a_, *begin_b_));
59 sos_ <<
"the assertion 'a ";
61 sos_ <<
" b' has passed";
62 messages_.push_back(sos_.str());
69 sos_ <<
" items have 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());
96 const bool a_ends_(begin_a_ == end_a_);
97 const bool b_ends_(begin_b_ == end_b_);
98 if(cmp_.checkRests(a_ends_, b_ends_)) {
99 sos_ <<
"the assertion 'a ";
101 sos_ <<
" b' has passed: one list is the prefix of the other one";
102 messages_.push_back(sos_.str());
107 sos_ <<
"the assertion 'a ";
109 sos_ <<
" b' has failed.";
110 messages_.push_back(sos_.str());
112 if(a_ends_ && b_ends_) {
113 messages_.push_back(
"the lists are the same length");
116 messages_.push_back(
"the list a is shorter");
119 messages_.push_back(
"the list a is longer");
126 template<
template<
typename,
typename>
class Compare_,
typename IterA_,
typename IterB_>
127 bool LexicographicalAssertion::testAssertLexiList(
133 std::vector<std::string> messages_;
134 bool result_(Private::compareListsLexicographically<Compare_>(
135 messages_, begin_a_, end_a_, begin_b_, end_b_));
136 assert(messages_.size() > 0);
140 for(
const auto& message_ : messages_)
142 return report_.getResult();
145 template<
template<
typename,
typename>
class Compare_,
typename IterA_,
typename IterB_>
151 return testAssertLexiList<Compare_>(begin_a_, end_a_, begin_b_, end_b_);
154 template<
template<
typename,
typename>
class Compare_,
typename ContainerA_,
typename IterB_>
156 const ContainerA_& a_,
159 return testAssertLexiList<Compare_>(
166 template<
template<
typename,
typename>
class Compare_,
typename IterA_,
typename ContainerB_>
170 const ContainerB_& b_) {
171 return testAssertLexiList<Compare_>(
178 template<
template<
typename,
typename>
class Compare_,
typename ContainerA_,
typename ContainerB_>
180 const ContainerA_& a_,
181 const ContainerB_& b_) {
182 return testAssertLexiList<Compare_>(