Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Plasma
Plasma Add-ons
Commits
ed78d2d3
Verified
Commit
ed78d2d3
authored
Mar 14, 2021
by
Alexander Lohnau
💬
Browse files
converterrunner: Add test case for rounding of currencies
parent
6da4e3dd
Changes
1
Hide whitespace changes
Inline
Side-by-side
runners/converter/autotests/converterrunnertest.cpp
View file @
ed78d2d3
...
...
@@ -7,6 +7,7 @@
#include <KRunner/AbstractRunnerTest>
#include <KUnitConversion/Converter>
#include <KUnitConversion/UnitCategory>
#include <QRegularExpression>
#include <QTest>
using
namespace
KUnitConversion
;
...
...
@@ -24,6 +25,7 @@ private Q_SLOTS:
void
testQuery
();
void
testInvalidQuery_data
();
void
testInvalidQuery
();
void
testRoundingOfCurrencies
();
};
void
ConverterRunnerTest
::
initTestCase
()
...
...
@@ -127,6 +129,17 @@ void ConverterRunnerTest::testInvalidQuery()
QCOMPARE
(
manager
->
matches
().
count
(),
0
);
}
void
ConverterRunnerTest
::
testRoundingOfCurrencies
()
{
launchQuery
(
QStringLiteral
(
"40000000000000000000000000000000000000000000000000$"
));
QVERIFY
(
!
manager
->
matches
().
isEmpty
());
QVERIFY
(
!
manager
->
matches
().
constFirst
().
text
().
startsWith
(
"-"
));
launchQuery
(
QStringLiteral
(
"50.123$"
));
QVERIFY
(
!
manager
->
matches
().
isEmpty
());
QRegularExpression
hasTwoDecimalPrescision
(
QStringLiteral
(
R"(^\d+\.\d\d)"
));
QVERIFY
(
manager
->
matches
().
constFirst
().
text
().
contains
(
hasTwoDecimalPrescision
));
}
QTEST_MAIN
(
ConverterRunnerTest
)
#include "converterrunnertest.moc"
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment