| 475 | } |
| 476 | |
| 477 | void ExpressionParserTest::testevaluateGreaterThan() { |
| 478 | const QString expr = QStringLiteral("x > y"); |
| 479 | const QStringList vars = {QStringLiteral("x"), QStringLiteral("y")}; |
| 480 | |
| 481 | QVector<QVector<double>*> xVectors; |
| 482 | |
| 483 | xVectors << new QVector<double>({0., 1., 0., 1., -1., -std::numeric_limits<double>::infinity(), 1, std::numeric_limits<double>::infinity(), 7.}); // x |
| 484 | xVectors << new QVector<double>({0., 0., 1., 1., -2., std::numeric_limits<double>::infinity(), std::nan("0"), 1e9, 7.}); // y |
| 485 | QVector<double> yVector({5., 5., 5., 5., 5., 5., 5., 5., 5.}); // random value |
| 486 | auto* parser = ExpressionParser::getInstance(); |
| 487 | parser->tryEvaluateCartesian(expr, vars, xVectors, &yVector); |
| 488 | |
| 489 | QCOMPARE(yVector.size(), 9); |
| 490 | QCOMPARE(yVector.at(0), 0.); |
| 491 | QCOMPARE(yVector.at(1), 1.); |
| 492 | QCOMPARE(yVector.at(2), 0.); |
| 493 | QCOMPARE(yVector.at(3), 0.); |
| 494 | QCOMPARE(yVector.at(4), 1.); |
| 495 | QCOMPARE(yVector.at(5), 0.); |
| 496 | QCOMPARE(yVector.at(6), 0.); |
| 497 | QCOMPARE(yVector.at(7), 1.); |
| 498 | QCOMPARE(yVector.at(8), 0.); |
| 499 | } |
| 500 | |
| 501 | void ExpressionParserTest::testevaluateLessThan() { |
| 502 | const QString expr = QStringLiteral("x < y"); |
nothing calls this directly
no test coverage detected