Improved test case for ticket 1586

This commit is contained in:
orbitcowboy 2022-01-08 18:39:19 +01:00
parent 89e60af516
commit 4a3a287248
1 changed files with 4 additions and 1 deletions

View File

@ -2096,6 +2096,7 @@ private:
"{\n" "{\n"
" A a;\n" " A a;\n"
" a.data[3] = 0;\n" " a.data[3] = 0;\n"
" a.b.data[2] = 0;\n"
"}"); "}");
ASSERT_EQUALS("", errout.str()); ASSERT_EQUALS("", errout.str());
@ -2110,8 +2111,10 @@ private:
"{\n" "{\n"
" A a;\n" " A a;\n"
" a.data[4] = 0;\n" " a.data[4] = 0;\n"
" a.b.data[3] = 0;\n"
"}"); "}");
ASSERT_EQUALS("[test.cpp:10]: (error) Array 'a.data[4]' accessed at index 4, which is out of bounds.\n", errout.str()); ASSERT_EQUALS("[test.cpp:10]: (error) Array 'a.data[4]' accessed at index 4, which is out of bounds.\n"
"[test.cpp:11]: (error) Array 'a.b.data[3]' accessed at index 3, which is out of bounds.\n", errout.str());
} }
void array_index_for_andand_oror() { // #3907 - using && or || void array_index_for_andand_oror() { // #3907 - using && or ||