| 2599 | EqualsMatcher(std::vector<T> const &comparator) : m_comparator( comparator ) {} |
| 2600 | |
| 2601 | bool match(std::vector<T> const &v) const override { |
| 2602 | // !TBD: This currently works if all elements can be compared using != |
| 2603 | // - a more general approach would be via a compare template that defaults |
| 2604 | // to using !=. but could be specialised for, e.g. std::vector<T> etc |
| 2605 | // - then just call that directly |
| 2606 | if (m_comparator.size() != v.size()) |
| 2607 | return false; |
| 2608 | for (std::size_t i = 0; i < v.size(); ++i) |
| 2609 | if (m_comparator[i] != v[i]) |
| 2610 | return false; |
| 2611 | return true; |
| 2612 | } |
| 2613 | std::string describe() const override { |
| 2614 | return "Equals: " + ::Catch::Detail::stringify( m_comparator ); |
| 2615 | } |