| 418 | } |
| 419 | |
| 420 | void ExpressionParserTest::testEvaluateNot() { |
| 421 | const QString expr = QStringLiteral("!x"); |
| 422 | const QStringList vars = {QStringLiteral("x")}; |
| 423 | |
| 424 | QVector<QVector<double>*> xVectors; |
| 425 | |
| 426 | xVectors << new QVector<double>({1., 0., -1., 2.}); // x |
| 427 | QVector<double> yVector({5., 5., 5., 5.}); // random value |
| 428 | auto* parser = ExpressionParser::getInstance(); |
| 429 | parser->tryEvaluateCartesian(expr, vars, xVectors, &yVector); |
| 430 | |
| 431 | QCOMPARE(yVector.size(), 4); |
| 432 | QCOMPARE(yVector.at(0), 0.); |
| 433 | QCOMPARE(yVector.at(1), 1.); |
| 434 | QCOMPARE(yVector.at(2), 0.); // According to C/C++ standard, -1 is true for bool and therefore the negated is false |
| 435 | QCOMPARE(yVector.at(3), 0.); |
| 436 | } |
| 437 | |
| 438 | void ExpressionParserTest::testEvaluateLogicalExpression() { |
| 439 | const QString expr = QStringLiteral("!x || y && x"); |
nothing calls this directly
no test coverage detected