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

Method testEvaluateAnd

tests/backend/gsl/ExpressionParserTest.cpp:372–394  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

370}
371
372void ExpressionParserTest::testEvaluateAnd() {
373 const QString expr = QStringLiteral("x && y");
374 const QStringList vars = {QStringLiteral("x"), QStringLiteral("y")};
375
376 QVector<QVector<double>*> xVectors;
377
378 xVectors << new QVector<double>({1., 0., 1., 0.}); // x
379 xVectors << new QVector<double>({0., 0., 1., 1.}); // y
380 QVector<double> yVector({
381 5.,
382 5.,
383 5.,
384 5.,
385 }); // random value
386 auto* parser = ExpressionParser::getInstance();
387 parser->tryEvaluateCartesian(expr, vars, xVectors, &yVector);
388
389 QCOMPARE(yVector.size(), 4);
390 QCOMPARE(yVector.at(0), 0.);
391 QCOMPARE(yVector.at(1), 0.);
392 QCOMPARE(yVector.at(2), 1.);
393 QCOMPARE(yVector.at(3), 0.);
394}
395
396void ExpressionParserTest::testEvaluateOr() {
397 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