MCPcopy Create free account
hub / github.com/cppcheck-opensource/cppcheck / hasKnownIntValue

Method hasKnownIntValue

test/testtoken.cpp:1254–1268  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1252 }
1253
1254 void hasKnownIntValue() const {
1255 // pointer might be NULL
1256 ValueFlow::Value v1(0);
1257
1258 // pointer points at buffer that is 2 bytes
1259 ValueFlow::Value v2(2);
1260 v2.valueType = ValueFlow::Value::ValueType::BUFFER_SIZE;
1261 v2.setKnown();
1262
1263 auto tokensFrontBack = std::make_shared<TokensFrontBack>();
1264 Token token(list, std::move(tokensFrontBack));
1265 ASSERT_EQUALS(true, token.addValue(v1));
1266 ASSERT_EQUALS(true, token.addValue(v2));
1267 ASSERT_EQUALS(false, token.hasKnownIntValue());
1268 }
1269
1270#define assert_tok(...) _assert_tok(__FILE__, __LINE__, __VA_ARGS__)
1271 void _assert_tok(const char* file, int line, const Token* tok, Token::Type t, bool l = false, bool std = false, bool ctrl = false) const

Callers 2

valueFlow1Method · 0.45
valueFlow2Method · 0.45

Calls 1

addValueMethod · 0.80

Tested by

no test coverage detected