Skip to content

Commit 5ec9f9e

Browse files
Update testcondition.cpp
1 parent c39ac62 commit 5ec9f9e

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

test/testcondition.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4065,7 +4065,7 @@ class TestCondition : public TestFixture {
40654065
" unsigned int num = max - 1;\n"
40664066
" if (num < 0) {}\n" // <- do not report knownConditionTrueFalse
40674067
"}");
4068-
ASSERT_EQUALS("", errout_str());
4068+
ASSERT_EQUALS("[test.cpp:3:15]: (style) Comparing expression of type 'unsigned int' against value 0. Condition is always false. [compareValueOutOfTypeRangeError]", errout_str());
40694069

40704070
// #10297
40714071
check("void foo(size_t len, int start) {\n"
@@ -6355,6 +6355,15 @@ class TestCondition : public TestFixture {
63556355
"}\n", settingsUnix64);
63566356
ASSERT_EQUALS("[test.cpp:2:14]: (style) Comparing expression of type 'bool' against value 2. Condition is always true. [compareValueOutOfTypeRangeError]\n",
63576357
errout_str());
6358+
6359+
check("void f(const std::uint32_t& u) {\n" // #9078
6360+
" if (u >= UINT32_MAX) {}\n"
6361+
" if (u <= UINT32_MAX) {}\n"
6362+
" if (u > UINT32_MAX) {}\n"
6363+
"}\n");
6364+
ASSERT_EQUALS("[test.cpp:3:14]: (style) Comparing expression of type 'const unsigned int &' against value 4294967295. Condition is always true. [compareValueOutOfTypeRangeError]\n"
6365+
"[test.cpp:4:13]: (style) Comparing expression of type 'const unsigned int &' against value 4294967295. Condition is always false. [compareValueOutOfTypeRangeError]\n",
6366+
errout_str());
63586367
}
63596368

63606369
void knownConditionCast() {

0 commit comments

Comments
 (0)