Ticket #8209: Added regression test

This commit is contained in:
orbitcowboy 2021-10-12 08:25:08 +02:00
parent 6a30eabf21
commit c3af708a55
1 changed files with 7 additions and 0 deletions

View File

@ -4024,6 +4024,13 @@ private:
"}\n");
ASSERT_EQUALS("[test.cpp:3]: (style) Condition 'i<=18' is always true\n", errout.str());
// #8209
check("void f() {\n"
" for(int x = 0; x < 3; ++x)\n"
" if(x == -5) {}\n"
"}");
ASSERT_EQUALS("[test.cpp:3]: (style) Condition 'x==-5' is always false\n", errout.str());
check("void f(unsigned int u1, unsigned int u2) {\n"
" if (u1 <= 10 && u2 >= 20) {\n"
" if (u1 != u2) {}\n"