MCPcopy Create free account
hub / github.com/CLIUtils/CLI11 / checkSections

Function checkSections

tests/ConfigFileTest.cpp:440–463  ·  view source on GitHub ↗

check function to make sure that open sections match close sections

Source from the content-addressed store, hash-verified

438
439// check function to make sure that open sections match close sections
440bool checkSections(const std::vector<CLI::ConfigItem> &output) {
441 std::set<std::string> open;
442 for(const auto &ci : output) {
443 if(ci.name == "++") {
444 auto nm = ci.fullname();
445 nm.pop_back();
446 nm.pop_back();
447 auto rv = open.insert(nm);
448 if(!rv.second) {
449 return false;
450 }
451 }
452 if(ci.name == "--") {
453 auto nm = ci.fullname();
454 nm.pop_back();
455 nm.pop_back();
456 auto rv = open.erase(nm);
457 if(rv != 1U) {
458 return false;
459 }
460 }
461 }
462 return open.empty();
463}
464TEST_CASE("StringBased: Layers", "[config]") {
465 std::stringstream ofile;
466

Callers 1

ConfigFileTest.cppFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected