This commit is contained in:
Daniel Marjamäki 2014-01-10 16:51:58 +01:00
parent 3e7f692d4d
commit 3eebc8a9f1
2 changed files with 21 additions and 11 deletions

View File

@ -154,13 +154,23 @@ private:
}
void valueFlowForLoop() {
const char code[] = "void f() {\n"
const char *code;
code = "void f() {\n"
" for (int x = 0; x < 10; x++)\n"
" a[x] = 0;\n"
"}";
ASSERT_EQUALS(true, testValueOfX(code, 3U, 0));
ASSERT_EQUALS(true, testValueOfX(code, 3U, 9));
ASSERT_EQUALS(false, testValueOfX(code, 3U, 10));
code = "void f() {\n"
" for (int x = 0; x < (short)10; x++)\n"
" a[x] = 0;\n"
"}";
ASSERT_EQUALS(true, testValueOfX(code, 3U, 0));
ASSERT_EQUALS(true, testValueOfX(code, 3U, 9));
ASSERT_EQUALS(false, testValueOfX(code, 3U, 10));
}
void valueFlowSubFunction() {