MCPcopy Create free account
hub / github.com/KDE/labplot / testRoundn

Method testRoundn

tests/backend/gsl/ExpressionParserTest.cpp:266–280  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

264}
265
266void ExpressionParserTest::testRoundn() {
267 auto fnct = getFunction2(QStringLiteral("roundn"));
268 QVERIFY(fnct);
269
270 QCOMPARE(fnct(3.1415, 2), 3.14); // round down
271 QCOMPARE(fnct(10.2397281298423, 5), 10.23973); // roundup
272 QCOMPARE(fnct(10000.1, 5), 10000.1);
273 QCOMPARE(fnct(123.45, -1), 120.);
274 QCOMPARE(fnct(1.45, 1), 1.5);
275 QCOMPARE(fnct(-1.45, 1), -1.5);
276 QCOMPARE(fnct(-1.44, 1), -1.4);
277 QCOMPARE(fnct(-123.45, 1), -123.5);
278 QCOMPARE(fnct(-123.44, 1), -123.4);
279 QCOMPARE(fnct(-123.45, -1), -120);
280}
281
282void ExpressionParserTest::testSpecialFunctions() {
283 auto fnct = getFunction1(QStringLiteral("cbrt"));

Callers

nothing calls this directly

Calls 1

getFunction2Function · 0.85

Tested by

no test coverage detected