catch3
Progmasoft Catch3: an independently maintained C++17 test framework with a parallel runner, property checks, snapshots and structured results.
Clonegit clone https://git.progmasoft.com/catch3
Removed <algorithm> include from the main path
- Commit
d01fe03ba630b5f7be7cfd52dc91cf4a8a20532e- Author
- Martin Hořeňovský ·
- Parents
287cc92b2ce6
Changes
include/internal/catch_matchers_vector.h | 22 +++++++++++++++++----- projects/SelfTest/MiscTests.cpp | 1 + 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/include/internal/catch_matchers_vector.h b/include/internal/catch_matchers_vector.h index b176d4a3..4bf39d70 100644 --- a/include/internal/catch_matchers_vector.h +++ b/include/internal/catch_matchers_vector.h @@ -10,8 +10,6 @@ #include "catch_matchers.hpp" -#include <algorithm> - namespace Catch { namespace Matchers { @@ -23,7 +21,12 @@ namespace Matchers { ContainsElementMatcher(T const &comparator) : m_comparator( comparator) {} bool match(std::vector<T> const &v) const override { - return std::find(v.begin(), v.end(), m_comparator) != v.end(); + for (auto const& el : v) { + if (el == m_comparator) { + return true; + } + } + return false; } std::string describe() const override { @@ -42,9 +45,18 @@ namespace Matchers { // !TBD: see note in EqualsMatcher if (m_comparator.size() > v.size()) return false; - for ( auto const& comparator : m_comparator ) - if (std::find(v.begin(), v.end(), comparator) == v.end()) + for (auto const& comparator : m_comparator) { + auto present = false; + for (const auto& el : v) { + if (el == comparator) { + present = true; + break; + } + } + if (!present) { return false; + } + } return true; } std::string describe() const override { diff --git a/projects/SelfTest/MiscTests.cpp b/projects/SelfTest/MiscTests.cpp index 5b3e9ed7..c8a7b302 100644 --- a/projects/SelfTest/MiscTests.cpp +++ b/projects/SelfTest/MiscTests.cpp @@ -17,6 +17,7 @@ #include <iostream> #include <cerrno> +#include <limits> TEST_CASE( "random SECTION tests", "[.][sections][failing]" ) { int a = 1;