20 #ifndef OTest2_INCLUDE_OTEST2_ASSERTIONSMAPIMPL_H_
21 #define OTest2_INCLUDE_OTEST2_ASSERTIONSMAPIMPL_H_
40 template<
template<
typename,
typename>
class Compare_,
typename ContainerA_,
typename ContainerB_>
42 std::vector<std::string>& messages_,
43 const ContainerA_& a_,
44 const ContainerB_& b_) {
49 typedef Compare_<AValue_, BValue_> Comparator_;
53 std::ostringstream first_line_;
54 first_line_ <<
"the assertion a ";
56 first_line_ <<
" b has ";
61 while(iter_a_ != end_a_) {
64 if(range_b_.first == range_b_.second) {
66 std::ostringstream sos_;
67 sos_ << first_line_.str() <<
"failed: the item <";
71 sos_ <<
"> is not present in the map b";
73 messages_.push_back(sos_.str());
82 std::ostringstream sos_;
83 sos_ << first_line_.str() <<
"failed: the subsequence of items with the key ";
85 sos_ <<
" is shorter in the map a than in the map b";
86 messages_.push_back(sos_.str());
91 if(!cmp_((*iter_a_).second, (*range_b_.first).second)) {
93 std::ostringstream sos_;
94 sos_ << first_line_.str() <<
"failed: check a[";
100 sos_ <<
"] has failed";
101 messages_.push_back(sos_.str());
108 messages_.push_back(sos_.str());
115 messages_.push_back(sos_.str());
122 if(range_b_.first == range_b_.second) {
124 auto iter_a_tmp_(iter_a_);
132 std::ostringstream sos_;
133 sos_ << first_line_.str() <<
"failed: the subsequence of items with the key ";
135 sos_ <<
" is longer in the map a than in the map b";
136 messages_.push_back(sos_.str());
150 while(iter_b_ != end_b_) {
152 if(range_a_.first == range_a_.second) {
154 std::ostringstream sos_;
155 sos_ << first_line_.str() <<
"failed: the item <";
159 sos_ <<
"> is not present in the map a";
161 messages_.push_back(sos_.str());
169 std::ostringstream sos_;
170 sos_ << first_line_.str() <<
"passed";
171 messages_.push_back(sos_.str());
178 template<
template<
typename,
typename>
class Compare_,
typename ContainerA_,
typename ContainerB_>
180 const ContainerA_& a_,
181 const ContainerB_& b_) {
182 std::vector<std::string> messages_;
183 bool result_(Private::compareMaps<Compare_>(messages_, a_, b_));
184 assert(!messages_.empty());
187 for(
const auto& message_ : messages_)