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

Method testEvaluateOr

tests/backend/gsl/ExpressionParserTest.cpp:396–418  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

394}
395
396void 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
420void ExpressionParserTest::testEvaluateNot() {
421 const QString expr = QStringLiteral("!x");

Callers

nothing calls this directly

Calls 2

tryEvaluateCartesianMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected