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

Method options

test/options.cpp:21–57  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

19#include "timer.h"
20
21options::options(int argc, const char* const argv[])
22 : mExe(argv[0])
23{
24 const std::set<std::string> args(argv + 1, argv + argc);
25 for (const auto& arg : args) {
26 if (arg.empty())
27 continue; // empty argument
28 if (arg[0] == '-') {
29 if (arg == "-q")
30 mQuiet = true;
31 else if (arg == "-h" || arg == "--help")
32 mHelp = true;
33 else if (arg == "-n")
34 mSummary = false;
35 else if (arg == "-d")
36 mDryRun = true;
37 else if (arg == "-x")
38 mExcludeTests = true;
39 else if (arg == "-t")
40 mTimerResults.reset(new TimerResults);
41 else
42 mErrors.emplace_back("unknown option '" + arg + "'");
43 continue; // command-line switch
44 }
45 const auto pos = arg.find("::");
46 if (pos == std::string::npos) {
47 mWhichTests[arg] = {}; // run whole fixture
48 continue;
49 }
50 const std::string fixture = arg.substr(0, pos);
51 const auto it = mWhichTests.find(fixture);
52 if (it != mWhichTests.cend() && it->second.empty())
53 continue; // whole fixture is already included
54 const std::string test = arg.substr(pos+2);
55 mWhichTests[fixture].emplace(test); // run individual test
56 }
57}
58
59options::~options()
60{

Callers

nothing calls this directly

Calls 3

emptyMethod · 0.45
resetMethod · 0.45
findMethod · 0.45

Tested by

no test coverage detected