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

Method testErrors

tests/backend/Parser/ParserTest.cpp:115–146  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

113}
114
115void ParserTest::testErrors() {
116 Parsing::Parser parser(false);
117 gsl_set_error_handler_off(); // do not crash
118
119 const QVector<QString> testsNan{QString(),
120 QStringLiteral("a"),
121 QStringLiteral("1+"),
122 QStringLiteral("a+1"),
123 QStringLiteral("&"),
124 QStringLiteral("%"),
125 QStringLiteral("+"),
126 QStringLiteral("*"),
127 QStringLiteral("/"),
128 QStringLiteral("{1}"),
129 QStringLiteral("{1*2}"),
130 QStringLiteral("(1+1))"),
131 QStringLiteral("a/0"),
132 QStringLiteral("0/0"),
133 QStringLiteral("1/0 + a"),
134 QStringLiteral("sqrt(-1)"),
135 QStringLiteral("log(-1)"),
136 QStringLiteral("log(0)"),
137 QStringLiteral("asin(2)")};
138
139 for (auto& expr : testsNan)
140 QVERIFY(std::isnan(parser.parse(qPrintable(expr), "C")));
141
142 const QVector<QString> testsInf{QStringLiteral("1/0"), QStringLiteral("-1/0"), QStringLiteral("1+1/0")};
143
144 for (auto& expr : testsInf)
145 QVERIFY(std::isinf(parser.parse(qPrintable(expr), "C")));
146}
147
148void ParserTest::testVariables() {
149 Parsing::Parser parser(false);

Callers

nothing calls this directly

Calls 2

QStringClass · 0.50
parseMethod · 0.45

Tested by

no test coverage detected