Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
chrchr-github committed Feb 23, 2025
1 parent f9af4dd commit 5281792
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions test/teststl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5868,6 +5868,17 @@ class TestStl : public TestFixture {
"}\n",
dinit(CheckOptions, $.inconclusive = true));
ASSERT_EQUALS("[test.cpp:5]: (style) Consider using std::max_element algorithm instead of a raw loop.\n", errout_str());

check("int f(const std::vector<int>& v) {\n"
" int minY = 0;\n"
" for (int y : v) {\n"
" if (y < minY)\n"
" minY = y;\n"
" }\n"
" return minY;\n"
"}\n",
dinit(CheckOptions, $.inconclusive = true));
ASSERT_EQUALS("[test.cpp:5]: (style) Consider using std::min_element algorithm instead of a raw loop.\n", errout_str());
}

void loopAlgoMultipleReturn()
Expand Down

0 comments on commit 5281792

Please sign in to comment.