Ticket #8407: Added regression test

This commit is contained in:
orbitcowboy 2021-10-12 09:42:18 +02:00
parent c3af708a55
commit f09b4139fe
1 changed files with 9 additions and 0 deletions

View File

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