Skip to content

Commit

Permalink
[CORRECTIVE] Fix unary minus expression parsing of non-ints. Fix Syst…
Browse files Browse the repository at this point in the history
…emVerilogExpressionParser test project.
  • Loading branch information
hagantsa committed Jul 16, 2024
1 parent 835fd54 commit bbea2de
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
7 changes: 6 additions & 1 deletion KactusAPI/expressions/SystemVerilogExpressionParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,12 @@ QString SystemVerilogExpressionParser::solveUnary(QStringView operation, QString
}
else if (operation.compare(QLatin1String("`")) == 0)
{
return QString::number(~term.toLongLong() + 1);
if (!term.contains(QLatin1Char('.')))
{
return QString::number(-term.toLongLong());
}

return QString::number(-term.toDouble(), 'f', precisionOf(term));
}

return QStringLiteral("x");
Expand Down
6 changes: 4 additions & 2 deletions tests/Core/tst_SystemVerilogExpressionParser.pro
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,19 @@ TARGET = tst_SystemVerilogExpressionParser
QT += core xml gui testlib
CONFIG += c++11 testcase console

LIBS += -L$$PWD/../../executable/ -lKactusAPI

win32:CONFIG(release, debug|release) {
LIBS += -L$$PWD/../../executable/ -lKactusAPI
DESTDIR = ./release
}
else:win32:CONFIG(debug, debug|release) {
LIBS += -L$$PWD/../../executable/ -lKactusAPId
DESTDIR = ./debug
}
else:unix {
LIBS += -L$$PWD/../../executable/ -lKactusAPI
DESTDIR = ./release
}
}

INCLUDEPATH += $$DESTDIR
INCLUDEPATH += ../../
Expand Down

0 comments on commit bbea2de

Please sign in to comment.