| 328 | } |
| 329 | |
| 330 | void ExpressionParserTest::testevaluateCartesian() { |
| 331 | const QString expr = QStringLiteral("x+y"); |
| 332 | const QStringList vars = {QStringLiteral("x"), QStringLiteral("y")}; |
| 333 | |
| 334 | QVector<QVector<double>*> xVectors; |
| 335 | |
| 336 | xVectors << new QVector<double>({1., 2., 3.}); // x |
| 337 | xVectors << new QVector<double>({4., 5., 6., 9.}); // y |
| 338 | QVector<double> yVector({101., 123., 345., 239., 1290., 43290., 238., 342., 823., 239.}); |
| 339 | auto* parser = ExpressionParser::getInstance(); |
| 340 | parser->tryEvaluateCartesian(expr, vars, xVectors, &yVector); |
| 341 | |
| 342 | QVector<double> ref({5., 7., 9.}); |
| 343 | QCOMPARE(yVector.size(), 10); |
| 344 | COMPARE_DOUBLE_VECTORS_AT_LEAST_LENGTH(yVector, ref); |
| 345 | QCOMPARE(yVector.at(3), NAN); |
| 346 | QCOMPARE(yVector.at(4), NAN); |
| 347 | QCOMPARE(yVector.at(5), NAN); |
| 348 | QCOMPARE(yVector.at(6), NAN); |
| 349 | QCOMPARE(yVector.at(7), NAN); |
| 350 | QCOMPARE(yVector.at(8), NAN); |
| 351 | QCOMPARE(yVector.at(9), NAN); |
| 352 | } |
| 353 | |
| 354 | void ExpressionParserTest::testevaluateCartesianConstExpr() { |
| 355 | const QString expr = QStringLiteral("5 + 5"); |
nothing calls this directly
no test coverage detected