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

Method array_ptr

test/testsymboldatabase.cpp:653–674  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

651 }
652
653 void array_ptr() {
654 GET_SYMBOL_DB("const char* a[] = { \"abc\" };\n"
655 "const char* b[] = { \"def\", \"ghijkl\" };");
656 ASSERT(db != nullptr);
657
658 ASSERT(db->variableList().size() == 3); // the first one is not used
659 const Variable* v = db->getVariableFromVarId(1);
660 ASSERT(v != nullptr);
661
662 ASSERT(v->isArray());
663 ASSERT(v->isPointerArray());
664 ASSERT_EQUALS(1U, v->dimensions().size());
665 ASSERT_EQUALS(1U, v->dimension(0));
666
667 v = db->getVariableFromVarId(2);
668 ASSERT(v != nullptr);
669
670 ASSERT(v->isArray());
671 ASSERT(v->isPointerArray());
672 ASSERT_EQUALS(1U, v->dimensions().size());
673 ASSERT_EQUALS(2U, v->dimension(0));
674 }
675
676 void stlarray1() {
677 GET_SYMBOL_DB("std::array<int, 16 + 4> arr;");

Callers

nothing calls this directly

Calls 3

isArrayMethod · 0.80
isPointerArrayMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected