| 255 | |
| 256 | #define testValueOfXImpossible(...) testValueOfXImpossible_(__FILE__, __LINE__, __VA_ARGS__) |
| 257 | bool testValueOfXImpossible_(const char* file, int line, const char code[], unsigned int linenr, int value) { |
| 258 | // Tokenize.. |
| 259 | SimpleTokenizer tokenizer(settings, *this); |
| 260 | ASSERT_LOC(tokenizer.tokenize(code), file, line); |
| 261 | |
| 262 | for (const Token *tok = tokenizer.tokens(); tok; tok = tok->next()) { |
| 263 | if (tok->str() == "x" && tok->linenr() == linenr) { |
| 264 | if (std::any_of(tok->values().begin(), tok->values().end(), [&](const ValueFlow::Value& val) { |
| 265 | if (val.isSymbolicValue()) |
| 266 | return false; |
| 267 | if (val.isImpossible() && val.intvalue == value) |
| 268 | return true; |
| 269 | return false; |
| 270 | })) |
| 271 | return true; |
| 272 | } |
| 273 | } |
| 274 | |
| 275 | return false; |
| 276 | } |
| 277 | |
| 278 | bool testValueOfXImpossible_(const char* file, int line, const char code[], unsigned int linenr, const std::string& expr, int value) |
| 279 | { |
nothing calls this directly
no test coverage detected