diff --git a/test/testastutils.cpp b/test/testastutils.cpp index 5bb57fb2f..27cba353c 100644 --- a/test/testastutils.cpp +++ b/test/testastutils.cpp @@ -241,6 +241,12 @@ private: inconclusive = false; ASSERT_EQUALS(false, isVariableChangedByFunctionCall(code, "x ) ;", &inconclusive)); ASSERT_EQUALS(true, inconclusive); + + code = "int f(int x) {\n" + "return int(x);\n" + "}\n"; + ASSERT_EQUALS(false, isVariableChangedByFunctionCall(code, "x ) ;", &inconclusive)); + TODO_ASSERT_EQUALS(false, true, inconclusive); } bool nextAfterAstRightmostLeaf(const char code[], const char parentPattern[], const char rightPattern[]) { diff --git a/test/testvalueflow.cpp b/test/testvalueflow.cpp index 15aeec1db..8e55e3a02 100644 --- a/test/testvalueflow.cpp +++ b/test/testvalueflow.cpp @@ -4402,6 +4402,22 @@ private: ASSERT(value.isKnown()); ASSERT_EQUALS(1, value.intvalue); + code = "bool f() {\n" + " const int s = int( 4 );" + " return s == 4;\n" // <- known value + "}"; + value = valueOfTok(code, "=="); + ASSERT(value.isKnown()); + ASSERT_EQUALS(1, value.intvalue); + + code = "bool f() {\n" + " const int s = int{ 4 };" + " return s == 4;\n" // <- known value + "}"; + value = valueOfTok(code, "=="); + ASSERT(value.isKnown()); + ASSERT_EQUALS(1, value.intvalue); + // calculation with known result code = "int f(int x) { a = x & 0; }"; // <- & is 0 value = valueOfTok(code, "&");