| 321 | |
| 322 | #define testValueOfX(...) testValueOfX_(__FILE__, __LINE__, __VA_ARGS__) |
| 323 | bool testValueOfX_(const char* file, int line, const char code[], unsigned int linenr, MathLib::bigint value, const Settings *s = nullptr) { |
| 324 | const Settings *settings1 = s ? s : &settings; |
| 325 | |
| 326 | // Tokenize.. |
| 327 | SimpleTokenizer tokenizer(*settings1, *this); |
| 328 | ASSERT_LOC(tokenizer.tokenize(code), file, line); |
| 329 | |
| 330 | for (const Token *tok = tokenizer.tokens(); tok; tok = tok->next()) { |
| 331 | if (tok->str() == "x" && tok->linenr() == linenr) { |
| 332 | if (std::any_of(tok->values().cbegin(), tok->values().cend(), [&](const ValueFlow::Value& v) { |
| 333 | return v.isIntValue() && !v.isImpossible() && v.intvalue == value; |
| 334 | })) |
| 335 | return true; |
| 336 | } |
| 337 | } |
| 338 | |
| 339 | return false; |
| 340 | } |
| 341 | |
| 342 | bool testValueOfX_(const char* file, int line, const char code[], unsigned int linenr, const std::string& expr, int value) |
| 343 | { |
nothing calls this directly
no test coverage detected