| 523 | } |
| 524 | |
| 525 | void ExpressionParserTest::testevaluateLessEqualThan() { |
| 526 | const QString expr = QStringLiteral("x <= y"); |
| 527 | const QStringList vars = {QStringLiteral("x"), QStringLiteral("y")}; |
| 528 | |
| 529 | QVector<QVector<double>*> xVectors; |
| 530 | |
| 531 | xVectors << new QVector<double>({0., 1., 0., 1., -1., -std::numeric_limits<double>::infinity(), 1, std::numeric_limits<double>::infinity(), 7.}); // x |
| 532 | xVectors << new QVector<double>({0., 0., 1., 1., -2., std::numeric_limits<double>::infinity(), std::nan("0"), 1e9, 7.}); // y |
| 533 | QVector<double> yVector({5., 5., 5., 5., 5., 5., 5., 5., 5.}); // random value |
| 534 | auto* parser = ExpressionParser::getInstance(); |
| 535 | parser->tryEvaluateCartesian(expr, vars, xVectors, &yVector); |
| 536 | |
| 537 | QCOMPARE(yVector.size(), 9); |
| 538 | QCOMPARE(yVector.at(0), 1.); |
| 539 | QCOMPARE(yVector.at(1), 0.); |
| 540 | QCOMPARE(yVector.at(2), 1.); |
| 541 | QCOMPARE(yVector.at(3), 1.); |
| 542 | QCOMPARE(yVector.at(4), 0.); |
| 543 | QCOMPARE(yVector.at(5), 1.); |
| 544 | QCOMPARE(yVector.at(6), 0.); |
| 545 | QCOMPARE(yVector.at(7), 0.); |
| 546 | QCOMPARE(yVector.at(8), 1.); |
| 547 | } |
| 548 | |
| 549 | void ExpressionParserTest::testevaluateGreaterEqualThan() { |
| 550 | const QString expr = QStringLiteral("x >= y"); |
nothing calls this directly
no test coverage detected