Add test for #2490 (#4551)

This commit is contained in:
chrchr-github 2022-10-14 11:55:45 +02:00 committed by GitHub
parent b8b6be48d9
commit 544ec38ca9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 0 deletions

View File

@ -5482,6 +5482,13 @@ private:
" if (p=foo()){}\n"
"}");
ASSERT_EQUALS("", errout.str());
check("void f(uint32_t u) {\n" // #2490
" if ((u = 0x00000000) || (u = 0xffffffff)) {}\n"
"}\n");
ASSERT_EQUALS("[test.cpp:2]: (style) Condition 'u=0x00000000' is always false\n"
"[test.cpp:2]: (style) Condition 'u=0xffffffff' is always true\n",
errout.str());
}
void compareOutOfTypeRange() {