| 264 | } |
| 265 | |
| 266 | void 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 | |
| 282 | void ExpressionParserTest::testSpecialFunctions() { |
| 283 | auto fnct = getFunction1(QStringLiteral("cbrt")); |
nothing calls this directly
no test coverage detected