MCPcopy Create free account
hub / github.com/KDE/labplot / testevaluateCartesianConstExpr

Method testevaluateCartesianConstExpr

tests/backend/gsl/ExpressionParserTest.cpp:354–370  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

352}
353
354void ExpressionParserTest::testevaluateCartesianConstExpr() {
355 const QString expr = QStringLiteral("5 + 5");
356 const QStringList vars = {QStringLiteral("x"), QStringLiteral("y")};
357
358 QVector<QVector<double>*> xVectors;
359
360 xVectors << new QVector<double>({1., 2., 3.}); // x
361 xVectors << new QVector<double>({4., 5., 6., 9.}); // y
362 QVector<double> yVector({101., 123., 345., 239., 1290., 43290., 238., 342., 823., 239.});
363 auto* parser = ExpressionParser::getInstance();
364 parser->tryEvaluateCartesian(expr, vars, xVectors, &yVector);
365
366 QCOMPARE(yVector.size(), 10);
367 // All yVector rows are filled
368 for (const auto v : yVector)
369 QCOMPARE(v, 5. + 5.);
370}
371
372void ExpressionParserTest::testEvaluateAnd() {
373 const QString expr = QStringLiteral("x && y");

Callers

nothing calls this directly

Calls 2

tryEvaluateCartesianMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected