Refactorization: Moved two tests to testgarbage.cpp

Fixed wrong comment in testcppcheck.cpp (forgotten in previous commit)
This commit is contained in:
PKEuS 2015-11-06 21:58:49 +01:00
parent 61b16909bd
commit b20a7e3192
3 changed files with 10 additions and 9 deletions

View File

@ -80,7 +80,7 @@ private:
cppCheck.getErrorMessages();
ASSERT(!errorLogger.id.empty());
// TODO: check if there are duplicate error ids in errorLogger.id
// Check if there are duplicate error ids in errorLogger.id
std::string duplicate;
for (std::list<std::string>::iterator it = errorLogger.id.begin();
it != errorLogger.id.end();

View File

@ -199,6 +199,7 @@ private:
TEST_CASE(garbageCode148); // #7090
TEST_CASE(garbageCode149); // #7085
TEST_CASE(garbageCode150); // #7089
TEST_CASE(garbageCode151); // #4175
TEST_CASE(garbageValueFlow);
TEST_CASE(garbageSymbolDatabase);
@ -1195,6 +1196,14 @@ private:
"}\n"), InternalError);
}
void garbageCode151() { // #4175
checkCode(">{ x while (y) z int = }");
checkCode("void f() {\n" // #4911 - bad simplification => don't crash
" int a;\n"
" do { a=do_something() } while (a);\n"
"}");
}
void garbageValueFlow() {
// #6089
const char* code = "{} int foo(struct, x1, struct x2, x3, int, x5, x6, x7)\n"

View File

@ -3338,12 +3338,6 @@ private:
"}");
ASSERT_EQUALS("[test.cpp:2]: (error) Uninitialized variable: ptr3\n", errout.str());
checkUninitVar("void f() {\n" // #4911 - bad simplification => don't crash
" int a;\n"
" do { a=do_something() } while (a);\n"
"}\n", "test.cpp", /*debugwarnings=*/true);
ASSERT_EQUALS("[test.cpp:3]: (debug) ValueFlow bailout: variable a stopping on }\n", errout.str());
checkUninitVar("void f() {\n"
" int x;\n"
" while (a) {\n"
@ -3391,8 +3385,6 @@ private:
"}");
ASSERT_EQUALS("", errout.str());
checkUninitVar(">{ x while (y) z int = }"); // #4175 : don't crash
checkUninitVar("int f(void) {\n"
" int x;\n"
" while (a()) {\n" // <- condition must always be true or there will be problem