Testing; Readded tests

This commit is contained in:
Daniel Marjamäki 2019-11-03 08:45:07 +01:00
parent 7de55b09f8
commit df8bdabddd
1 changed files with 13 additions and 0 deletions

View File

@ -2833,6 +2833,19 @@ private:
"}");
ASSERT_EQUALS("[test.cpp:4]: (style) Condition '!x' is always true\n", errout.str());
check("bool f(int x) {\n"
" if(x == 0) { x++; return x == 0; } \n"
" return false;\n"
"}");
TODO_ASSERT_EQUALS("return value is always true?", "", errout.str());
check("void f() {\n" // #6898 (Token::expressionString)
" int x = 0;\n"
" A(x++ == 1);\n"
" A(x++ == 2);\n"
"}");
TODO_ASSERT_EQUALS("function argument is always true? however is code really weird/suspicious?", "", errout.str());
check("void f1(const std::string &s) { if(s.empty()) if(s.size() == 0) {}} ");
ASSERT_EQUALS("[test.cpp:1] -> [test.cpp:1]: (style) Condition 's.size()==0' is always true\n", errout.str());