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

Method enum13

test/testsymboldatabase.cpp:6589–6603  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6587 }
6588
6589 void enum13() {
6590 GET_SYMBOL_DB("struct S { enum E { E0, E1 }; };\n"
6591 "void f(bool b) {\n"
6592 " auto e = b ? S::E0 : S::E1;\n"
6593 "}\n");
6594 ASSERT(db != nullptr);
6595 auto it = db->scopeList.begin();
6596 std::advance(it, 2);
6597 const Enumerator* E1 = it->findEnumerator("E1");
6598 ASSERT(E1 && E1->value_known);
6599 ASSERT_EQUALS(E1->value, 1);
6600 const Token* const a = Token::findsimplematch(tokenizer.tokens(), "auto");
6601 ASSERT(a && a->valueType());
6602 ASSERT(E1->scope == a->valueType()->typeScope);
6603 }
6604
6605 void enum14() {
6606 GET_SYMBOL_DB("void f() {\n" // #11421

Callers

nothing calls this directly

Calls 3

findsimplematchFunction · 0.85
findEnumeratorMethod · 0.80
beginMethod · 0.45

Tested by

no test coverage detected