Verify: Fix a false negative in the itc test suite

This commit is contained in:
Daniel Marjamäki 2019-10-25 21:46:02 +02:00
parent 48012aceb4
commit 37bb19f02c
2 changed files with 9 additions and 5 deletions

View File

@ -1092,14 +1092,18 @@ static ExprEngine::ValuePtr executeKnownMacro(const Token *tok, Data &data)
return val;
}
static ExprEngine::ValuePtr executeNumber(const Token *tok)
static ExprEngine::ValuePtr executeNumber(const Token *tok, Data &data)
{
if (tok->valueType()->isFloat()) {
long double value = MathLib::toDoubleNumber(tok->str());
return std::make_shared<ExprEngine::FloatRange>(tok->str(), value, value);
auto v = std::make_shared<ExprEngine::FloatRange>(tok->str(), value, value);
call(data.callbacks, tok, v, &data);
return v;
}
int128_t value = MathLib::toLongNumber(tok->str());
return std::make_shared<ExprEngine::IntRange>(tok->str(), value, value);
auto v = std::make_shared<ExprEngine::IntRange>(tok->str(), value, value);
call(data.callbacks, tok, v, &data);
return v;
}
static ExprEngine::ValuePtr executeStringLiteral(const Token *tok, Data &data)
@ -1150,7 +1154,7 @@ static ExprEngine::ValuePtr executeExpression1(const Token *tok, Data &data)
return executeKnownMacro(tok, data);
if (tok->isNumber() || tok->tokType() == Token::Type::eChar)
return executeNumber(tok);
return executeNumber(tok, data);
if (tok->tokType() == Token::Type::eString)
return executeStringLiteral(tok, data);

View File

@ -12,7 +12,7 @@ import subprocess
ITC_PATH = os.path.expanduser('~/testing')
ZERO_DIVISION = '000/199/329/zero_division.c'
if sys.argv[0] in ('test/verify/juliet.py', './test/verify/juliet.py'):
if sys.argv[0] in ('test/verify/itc.py', './test/verify/itc.py'):
CPPCHECK_PATH = './cppcheck'
else:
CPPCHECK_PATH = '../../cppcheck'