| 3258 | EqualsMatcher(std::vector<T> const &comparator) : m_comparator( comparator ) {} |
| 3259 | |
| 3260 | bool match(std::vector<T> const &v) const override { |
| 3261 | // !TBD: This currently works if all elements can be compared using != |
| 3262 | // - a more general approach would be via a compare template that defaults |
| 3263 | // to using !=. but could be specialised for, e.g. std::vector<T> etc |
| 3264 | // - then just call that directly |
| 3265 | if (m_comparator.size() != v.size()) |
| 3266 | return false; |
| 3267 | for (std::size_t i = 0; i < v.size(); ++i) |
| 3268 | if (m_comparator[i] != v[i]) |
| 3269 | return false; |
| 3270 | return true; |
| 3271 | } |
| 3272 | std::string describe() const override { |
| 3273 | return "Equals: " + ::Catch::Detail::stringify( m_comparator ); |
| 3274 | } |