| 394 | } |
| 395 | |
| 396 | void ExpressionParserTest::testEvaluateOr() { |
| 397 | const QString expr = QStringLiteral("x || y"); |
| 398 | const QStringList vars = {QStringLiteral("x"), QStringLiteral("y")}; |
| 399 | |
| 400 | QVector<QVector<double>*> xVectors; |
| 401 | |
| 402 | xVectors << new QVector<double>({1., 0., 1., 0.}); // x |
| 403 | xVectors << new QVector<double>({0., 0., 1., 1.}); // y |
| 404 | QVector<double> yVector({ |
| 405 | 5., |
| 406 | 5., |
| 407 | 5., |
| 408 | 5., |
| 409 | }); // random value |
| 410 | auto* parser = ExpressionParser::getInstance(); |
| 411 | parser->tryEvaluateCartesian(expr, vars, xVectors, &yVector); |
| 412 | |
| 413 | QCOMPARE(yVector.size(), 4); |
| 414 | QCOMPARE(yVector.at(0), 1.); |
| 415 | QCOMPARE(yVector.at(1), 0.); |
| 416 | QCOMPARE(yVector.at(2), 1.); |
| 417 | QCOMPARE(yVector.at(3), 1.); |
| 418 | } |
| 419 | |
| 420 | void ExpressionParserTest::testEvaluateNot() { |
| 421 | const QString expr = QStringLiteral("!x"); |
nothing calls this directly
no test coverage detected