Skip to content

Commit

Permalink
fixup: Use find_if instead of count_if
Browse files Browse the repository at this point in the history
  • Loading branch information
chfast committed Sep 30, 2022
1 parent f260acc commit 385261e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions test/statetest/statetest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,10 @@ class StateTest : public testing::Test
int main(int argc, char* argv[])
{
static constexpr std::string_view filter_flag_name = "--gtest_filter";
const auto has_user_filter = std::count_if(argv, argv + argc, [](const char* arg) noexcept {
const auto has_user_filter = std::find_if(argv, argv + argc, [](const char* arg) noexcept {
// TODO(C++20): Use .starts_with().
return std::string_view{arg}.substr(0, filter_flag_name.size()) == filter_flag_name;
}) != 0;
}) != (argv + argc);

testing::InitGoogleTest(&argc, argv); // Process GoogleTest flags.

Expand Down

0 comments on commit 385261e

Please sign in to comment.