#3979 added todo testcases

This commit is contained in:
Ettl Martin 2012-07-19 09:44:06 +02:00
parent dc6c3228d7
commit 4312d31b87
1 changed files with 25 additions and 0 deletions

View File

@ -111,6 +111,7 @@ private:
TEST_CASE(array_index_41); // structs with the same name
TEST_CASE(array_index_42);
TEST_CASE(array_index_43); // struct with array
TEST_CASE(array_index_44); // #3979
TEST_CASE(array_index_multidim);
TEST_CASE(array_index_switch_in_for);
TEST_CASE(array_index_for_in_for); // FP: #2634
@ -1424,6 +1425,30 @@ private:
ASSERT_EQUALS("", errout.str());
}
void array_index_44() { // #3979 (false positive)
check("void f()\n"
"{\n"
" char buf[2];\n"
" int i;\n"
" for (i = 2; --i >= 0; )\n"
" {\n"
" buf[i] = 1;\n"
" }\n"
"}\n");
TODO_ASSERT_EQUALS("","[test.cpp:7]: (error) Buffer is accessed out of bounds: buf\n", errout.str());
check("void f()\n"
"{\n"
" double buf[2];\n"
" for (int i = 2; i--; )\n"
" {\n"
" buf[i] = 2.;\n"
" }\n"
"}\n");
TODO_ASSERT_EQUALS("","[test.cpp:6]: (error) Buffer is accessed out of bounds: buf\n", errout.str());
}
void array_index_multidim() {
check("void f()\n"
"{\n"