aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/tests/dice
diff options
context:
space:
mode:
authorRenaud Guezennec <renaud@rolisteam.org>2025-03-30 03:56:37 +0200
committerRenaud Guezennec <renaud@rolisteam.org>2025-03-30 03:58:59 +0200
commite18f4a9936d03a112b1a05b24b0559e5be602e0e (patch)
treee5939fba4307e5b00e3444eb82b477f49d09b166 /src/tests/dice
parent8a3fa044ee7b74be3221717c3f949a10d4e8a178 (diff)
downloadOneRoll-e18f4a9936d03a112b1a05b24b0559e5be602e0e.tar.gz
OneRoll-e18f4a9936d03a112b1a05b24b0559e5be602e0e.zip
[math]: operator priority fix issue.
Diffstat (limited to 'src/tests/dice')
-rw-r--r--src/tests/dice/tst_dice.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/tests/dice/tst_dice.cpp b/src/tests/dice/tst_dice.cpp
index 0332504..eb07e57 100644
--- a/src/tests/dice/tst_dice.cpp
+++ b/src/tests/dice/tst_dice.cpp
@@ -481,7 +481,7 @@ void TestDice::wrongCommandsExecutionTimeTest()
<< "10d10k11"
<< "!!!!";
- for(QString cmd : commands)
+ for(QString cmd : std::as_const(commands))
{
bool test= m_diceParser->parseLine(cmd);
m_diceParser->start();
@@ -603,6 +603,8 @@ void TestDice::mathPriority_data()
QTest::addRow("cmd6") << "10*(3*2)" << 60;
QTest::addRow("cmd7") << "60/(3*2)" << 10;
QTest::addRow("cmd8") << "5-(5*5+5)" << -25;
+ QTest::addRow("cmd9") << "5-(5*5+5)" << -25;
+ QTest::addRow("cmd10") << "2*(5)+1" << 11;
}
void TestDice::dangerousCommandsTest()
@@ -1236,6 +1238,7 @@ void TestDice::ifCommandTest()
auto strResultExpected= startExperted[index];
auto resultText= strResult;
+ qDebug() << "debug: result" << resultText << strResultExpected << results;
QVERIFY2(resultText.startsWith(strResultExpected),
QString("string result does not fit the expectation %1").arg(cmd).toStdString().c_str());
}
@@ -1252,6 +1255,7 @@ void TestDice::ifCommandTest_data()
"[%2]\"}{\"Failure: %1 [%2]\"}}"
<< Dice::CompareOperator::GreaterOrEqual << QList<int>({15, 10, 1})
<< QStringList({"Complete Success:", "Success with Complications:", "Failure:"});
+
QTest::addRow("cmd2") << "2d10;$1i:[>=15]{\"Complete Success: %1 [%2]\"}{$1i:[>=10]{\"Success "
"with Complications: %1 "
"[%2]\"}{\"Failure: %1 [%2]\"}}"