added test case TestBufferOverrun::sizeof2

This commit is contained in:
Daniel Marjamäki 2009-01-30 06:11:31 +00:00
parent 988d4c0d66
commit 7d98c74d40
1 changed files with 20 additions and 0 deletions

View File

@ -69,6 +69,7 @@ private:
TEST_CASE(noerr4);
TEST_CASE(sizeof1);
TEST_CASE(sizeof2);
TEST_CASE(array_index_1);
TEST_CASE(array_index_2);
@ -171,6 +172,25 @@ private:
ASSERT_EQUALS(std::string(""), errout.str());
}
void sizeof2()
{
check("static void f()\n"
"{\n"
" char data[10];\n"
" data[ sizeof(data[0]) ] = 0;\n"
"}\n");
ASSERT_EQUALS(std::string(""), errout.str());
/* TODO
check("static void f()\n"
"{\n"
" int data[2];\n"
" data[ sizeof(data[0]) ] = 0;\n"
"}\n");
ASSERT_EQUALS(std::string("[test.cpp:4]: Array index out of bounds\n"), errout.str());
*/
}