added further testcases to multidimensional out of bounds unit test

This commit is contained in:
Martin Ettl 2010-04-23 22:04:49 +02:00
parent bd4bead561
commit 5eb9c78533
1 changed files with 26 additions and 1 deletions

View File

@ -945,6 +945,13 @@ private:
"}\n");
ASSERT_EQUALS("[test.cpp:4]: (error) Array 'a[2][2][2]' index a[1][2][1] out of bounds\n", errout.str());
check("void f()\n"
"{\n"
" char a[2][2][2][2];\n"
" a[1][2][1][1] = 'a';\n"
"}\n");
ASSERT_EQUALS("[test.cpp:4]: (error) Array 'a[2][2][2][2]' index a[1][2][1][1] out of bounds\n", errout.str());
check("void f()\n"
"{\n"
" char a[2][2][2];\n"
@ -966,7 +973,25 @@ private:
" char a[ii][ii][ii];\n"
" a[i*3][4*ii][ii] = 'a';\n"
"}\n");
TODO_ASSERT_EQUALS("[test.cpp:6]: (error) Array 'a[10][10][10]' index a[6][40][10] out of bounds\n", errout.str());
ASSERT_EQUALS("[test.cpp:6]: (error) Array 'a[10][10][10]' index a[6][40][10] out of bounds\n", errout.str());
check("void f()\n"
"{\n"
" int i=2;\n"
" int ii=1;\n"
" char a[ii][ii][ii];\n"
" a[i][i][i] = 'a';\n"
"}\n");
ASSERT_EQUALS("[test.cpp:6]: (error) Array 'a[1][1][1]' index a[2][2][2] out of bounds\n", errout.str());
check("void f()\n"
"{\n"
" int i=2;\n"
" int ii=i*3;\n"
" char a[ii][ii][ii];\n"
" a[i*3][i*3][i] = 'a';\n"
"}\n");
ASSERT_EQUALS("[test.cpp:6]: (error) Array 'a[6][6][6]' index a[6][6][2] out of bounds\n", errout.str());
}