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

Method isVariableChangedTest

test/testastutils.cpp:231–252  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

229 }
230
231 void isVariableChangedTest() {
232 // #8211 - no lhs for >> , do not crash
233 (void)isVariableChanged("void f() {\n"
234 " int b;\n"
235 " if (b) { (int)((INTOF(8))result >> b); }\n"
236 "}", "if", "}");
237 // #9235
238 ASSERT_EQUALS(false,
239 isVariableChanged("void f() {\n"
240 " int &a = a;\n"
241 "}\n",
242 "= a",
243 "}"));
244
245 ASSERT_EQUALS(false, isVariableChanged("void f(const A& a) { a.f(); }", "{", "}"));
246 ASSERT_EQUALS(true,
247 isVariableChanged("void g(int*);\n"
248 "void f(int x) { g(&x); }\n",
249 "{",
250 "}"));
251 ASSERT_EQUALS(false, isVariableChanged("const int A[] = { 1, 2, 3 };", "[", "]"));
252 }
253
254#define isVariableChangedByFunctionCall(...) isVariableChangedByFunctionCall_( __FILE__, __LINE__, __VA_ARGS__)
255 template<size_t size>

Callers

nothing calls this directly

Calls 1

isVariableChangedFunction · 0.85

Tested by

no test coverage detected