testbufferoverrun.cpp: minor updates to make it work better as extracted code

This commit is contained in:
Daniel Marjamäki 2009-11-07 19:51:18 +01:00
parent b9ebdee2f5
commit 3b9b3b241e
1 changed files with 4 additions and 2 deletions

View File

@ -1075,7 +1075,9 @@ private:
void cin1() void cin1()
{ {
check("void f()\n" check("#include <iostream>\n"
"using namespace std;\n"
"void f()\n"
"{\n" "{\n"
" char str[10];\n" " char str[10];\n"
" cin >> str;\n" " cin >> str;\n"
@ -1136,7 +1138,7 @@ private:
check("void foo()\n" check("void foo()\n"
"{\n" "{\n"
" char *s = malloc(10);\n" " char *s = (char *)malloc(10);\n"
" s[10] = 0;\n" " s[10] = 0;\n"
"}\n"); "}\n");
ASSERT_EQUALS("[test.cpp:4]: (error) Array index out of bounds\n", errout.str()); ASSERT_EQUALS("[test.cpp:4]: (error) Array index out of bounds\n", errout.str());