You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: test/teststl.cpp
+16Lines changed: 16 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -42,6 +42,7 @@ class TestStl : public TestFixture {
42
42
TEST_CASE(outOfBoundsSymbolic);
43
43
TEST_CASE(outOfBoundsIndexExpression);
44
44
TEST_CASE(outOfBoundsIterator);
45
+
TEST_CASE(outOfBoundsErrorPath;
45
46
46
47
TEST_CASE(iterator1);
47
48
TEST_CASE(iterator2);
@@ -1124,6 +1125,21 @@ class TestStl : public TestFixture {
1124
1125
errout_str());
1125
1126
}
1126
1127
1128
+
voidoutOfBoundsErrorPath() {
1129
+
Settings s = settings;
1130
+
s.templateLocation = "{file}:{line}:note:{info}";
1131
+
check("int f(int i) {\n"
1132
+
" std::string s = \"abc\";\n"
1133
+
" if (i > 5)\n"
1134
+
" return 0;\n"
1135
+
" return s[i];\n"
1136
+
"}\n", s);
1137
+
ASSERT_EQUALS("[test.cpp:5:13]: warning: Either the condition 'i>5' is redundant or 'i' can have the value 5. Expression 's[i]' causes access out of bounds. [containerOutOfBounds]\n"
1138
+
"[test.cpp:3:11]: note: Assuming that condition 'i>5' is not redundant\n"
0 commit comments