From 7c5058a42d9f1bade8c4422ad51419234fb3438e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Mon, 23 Apr 2018 12:39:47 +0200 Subject: [PATCH] Refactoring. Rename methods --- cli/cmdlineparser.cpp | 74 +++++----- cli/cmdlineparser.h | 20 +-- cli/cppcheckexecutor.cpp | 16 +-- test/testcmdlineparser.cpp | 268 ++++++++++++++++++------------------- 4 files changed, 189 insertions(+), 189 deletions(-) diff --git a/cli/cmdlineparser.cpp b/cli/cmdlineparser.cpp index 58c56055f..d38cfce37 100644 --- a/cli/cmdlineparser.cpp +++ b/cli/cmdlineparser.cpp @@ -102,17 +102,17 @@ CmdLineParser::CmdLineParser(Settings *settings) { } -void CmdLineParser::PrintMessage(const std::string &message) +void CmdLineParser::printMessage(const std::string &message) { std::cout << message << std::endl; } -void CmdLineParser::PrintMessage(const char* message) +void CmdLineParser::printMessage(const char* message) { std::cout << message << std::endl; } -bool CmdLineParser::ParseFromArgs(int argc, const char* const argv[]) +bool CmdLineParser::parseFromArgs(int argc, const char* const argv[]) { bool def = false; bool maxconfigs = false; @@ -168,7 +168,7 @@ bool CmdLineParser::ParseFromArgs(int argc, const char* const argv[]) } else { i++; if (i >= argc || argv[i][0] == '-') { - PrintMessage("cppcheck: No language given to '-x' option."); + printMessage("cppcheck: No language given to '-x' option."); return false; } str = argv[i]; @@ -179,7 +179,7 @@ bool CmdLineParser::ParseFromArgs(int argc, const char* const argv[]) else if (str == "c++") _settings->enforcedLang = Settings::CPP; else { - PrintMessage("cppcheck: Unknown language '" + str + "' enforced."); + printMessage("cppcheck: Unknown language '" + str + "' enforced."); return false; } } @@ -191,12 +191,12 @@ bool CmdLineParser::ParseFromArgs(int argc, const char* const argv[]) std::ifstream f(filename); if (!f.is_open()) { - PrintMessage("cppcheck: Couldn't open the file: \"" + filename + "\"."); + printMessage("cppcheck: Couldn't open the file: \"" + filename + "\"."); return false; } const std::string errmsg(_settings->nofail.parseFile(f)); if (!errmsg.empty()) { - PrintMessage(errmsg); + printMessage(errmsg); return false; } } @@ -218,12 +218,12 @@ bool CmdLineParser::ParseFromArgs(int argc, const char* const argv[]) message += "\n cppcheck --suppressions-list=a.txt --suppressions-list=b.txt file.cpp"; } - PrintMessage(message); + printMessage(message); return false; } const std::string errmsg(_settings->nomsg.parseFile(f)); if (!errmsg.empty()) { - PrintMessage(errmsg); + printMessage(errmsg); return false; } } @@ -232,7 +232,7 @@ bool CmdLineParser::ParseFromArgs(int argc, const char* const argv[]) const char * filename = argv[i] + 15; const std::string errmsg(_settings->nomsg.parseXmlFile(filename)); if (!errmsg.empty()) { - PrintMessage(errmsg); + printMessage(errmsg); return false; } } @@ -241,7 +241,7 @@ bool CmdLineParser::ParseFromArgs(int argc, const char* const argv[]) const std::string suppression = argv[i]+11; const std::string errmsg(_settings->nomsg.addSuppressionLine(suppression)); if (!errmsg.empty()) { - PrintMessage(errmsg); + printMessage(errmsg); return false; } } @@ -275,7 +275,7 @@ bool CmdLineParser::ParseFromArgs(int argc, const char* const argv[]) paths.erase(0, pos + 1); } } else { - PrintMessage("cppcheck: No paths specified for the '" + std::string(argv[i]) + "' option."); + printMessage("cppcheck: No paths specified for the '" + std::string(argv[i]) + "' option."); return false; } } @@ -303,13 +303,13 @@ bool CmdLineParser::ParseFromArgs(int argc, const char* const argv[]) std::istringstream iss(numberString); if (!(iss >> _settings->xml_version)) { - PrintMessage("cppcheck: argument to '--xml-version' is not a number."); + printMessage("cppcheck: argument to '--xml-version' is not a number."); return false; } if (_settings->xml_version != 2) { // We only have xml version 2 - PrintMessage("cppcheck: '--xml-version' can only be 2."); + printMessage("cppcheck: '--xml-version' can only be 2."); return false; } @@ -334,7 +334,7 @@ bool CmdLineParser::ParseFromArgs(int argc, const char* const argv[]) else if (std::strncmp(argv[i], "--enable=", 9) == 0) { const std::string errmsg = _settings->addEnabled(argv[i] + 9); if (!errmsg.empty()) { - PrintMessage(errmsg); + printMessage(errmsg); return false; } // when "style" is enabled, also enable "warning", "performance" and "portability" @@ -351,7 +351,7 @@ bool CmdLineParser::ParseFromArgs(int argc, const char* const argv[]) std::istringstream iss(temp); if (!(iss >> _settings->exitCode)) { _settings->exitCode = 0; - PrintMessage("cppcheck: Argument must be an integer. Try something like '--error-exitcode=1'."); + printMessage("cppcheck: Argument must be an integer. Try something like '--error-exitcode=1'."); return false; } } @@ -364,7 +364,7 @@ bool CmdLineParser::ParseFromArgs(int argc, const char* const argv[]) if (std::strcmp(argv[i], "-D") == 0) { ++i; if (i >= argc || argv[i][0] == '-') { - PrintMessage("cppcheck: argument to '-D' is missing."); + printMessage("cppcheck: argument to '-D' is missing."); return false; } @@ -393,7 +393,7 @@ bool CmdLineParser::ParseFromArgs(int argc, const char* const argv[]) if (std::strcmp(argv[i], "-U") == 0) { ++i; if (i >= argc || argv[i][0] == '-') { - PrintMessage("cppcheck: argument to '-U' is missing."); + printMessage("cppcheck: argument to '-U' is missing."); return false; } @@ -420,7 +420,7 @@ bool CmdLineParser::ParseFromArgs(int argc, const char* const argv[]) if (std::strcmp(argv[i], "-I") == 0) { ++i; if (i >= argc || argv[i][0] == '-') { - PrintMessage("cppcheck: argument to '-I' is missing."); + printMessage("cppcheck: argument to '-I' is missing."); return false; } path = argv[i]; @@ -470,7 +470,7 @@ bool CmdLineParser::ParseFromArgs(int argc, const char* const argv[]) if (std::strcmp(argv[i], "-i") == 0) { ++i; if (i >= argc || argv[i][0] == '-') { - PrintMessage("cppcheck: argument to '-i' is missing."); + printMessage("cppcheck: argument to '-i' is missing."); return false; } path = argv[i]; @@ -507,7 +507,7 @@ bool CmdLineParser::ParseFromArgs(int argc, const char* const argv[]) if (std::strstr(argv[i], ".sln") || std::strstr(argv[i], ".vcxproj")) { if (!CppCheckExecutor::tryLoadLibrary(_settings->library, argv[0], "windows.cfg")) { // This shouldn't happen normally. - PrintMessage("cppcheck: Failed to load 'windows.cfg'. Your Cppcheck installation is broken. Please re-install."); + printMessage("cppcheck: Failed to load 'windows.cfg'. Your Cppcheck installation is broken. Please re-install."); return false; } } @@ -545,7 +545,7 @@ bool CmdLineParser::ParseFromArgs(int argc, const char* const argv[]) ++i; _settings->templateFormat = argv[i]; } else { - PrintMessage("cppcheck: argument to '--template' is missing."); + printMessage("cppcheck: argument to '--template' is missing."); return false; } @@ -571,7 +571,7 @@ bool CmdLineParser::ParseFromArgs(int argc, const char* const argv[]) ++i; _settings->templateLocation = argv[i]; } else { - PrintMessage("cppcheck: argument to '--template' is missing."); + printMessage("cppcheck: argument to '--template' is missing."); return false; } } @@ -584,7 +584,7 @@ bool CmdLineParser::ParseFromArgs(int argc, const char* const argv[]) if (std::strcmp(argv[i], "-j") == 0) { ++i; if (i >= argc || argv[i][0] == '-') { - PrintMessage("cppcheck: argument to '-j' is missing."); + printMessage("cppcheck: argument to '-j' is missing."); return false; } @@ -597,14 +597,14 @@ bool CmdLineParser::ParseFromArgs(int argc, const char* const argv[]) std::istringstream iss(numberString); if (!(iss >> _settings->jobs)) { - PrintMessage("cppcheck: argument to '-j' is not a number."); + printMessage("cppcheck: argument to '-j' is not a number."); return false; } if (_settings->jobs > 10000) { // This limit is here just to catch typos. If someone has // need for more jobs, this value should be increased. - PrintMessage("cppcheck: argument for '-j' is allowed to be 10000 at max."); + printMessage("cppcheck: argument for '-j' is allowed to be 10000 at max."); return false; } } else if (std::strncmp(argv[i], "-l", 2) == 0) { @@ -614,7 +614,7 @@ bool CmdLineParser::ParseFromArgs(int argc, const char* const argv[]) if (std::strcmp(argv[i], "-l") == 0) { ++i; if (i >= argc || argv[i][0] == '-') { - PrintMessage("cppcheck: argument to '-l' is missing."); + printMessage("cppcheck: argument to '-l' is missing."); return false; } @@ -627,7 +627,7 @@ bool CmdLineParser::ParseFromArgs(int argc, const char* const argv[]) std::istringstream iss(numberString); if (!(iss >> _settings->loadAverage)) { - PrintMessage("cppcheck: argument to '-l' is not a number."); + printMessage("cppcheck: argument to '-l' is not a number."); return false; } } @@ -671,7 +671,7 @@ bool CmdLineParser::ParseFromArgs(int argc, const char* const argv[]) std::string message("cppcheck: error: unrecognized showtime mode: \""); message += showtimeMode; message += "\". Supported modes: file, summary, top5."; - PrintMessage(message); + printMessage(message); return false; } } @@ -745,7 +745,7 @@ bool CmdLineParser::ParseFromArgs(int argc, const char* const argv[]) std::string message("cppcheck: error: unrecognized platform: \""); message += platform; message += "\"."; - PrintMessage(message); + printMessage(message); return false; } } @@ -756,12 +756,12 @@ bool CmdLineParser::ParseFromArgs(int argc, const char* const argv[]) std::istringstream iss(14+argv[i]); if (!(iss >> _settings->maxConfigs)) { - PrintMessage("cppcheck: argument to '--max-configs=' is not a number."); + printMessage("cppcheck: argument to '--max-configs=' is not a number."); return false; } if (_settings->maxConfigs < 1) { - PrintMessage("cppcheck: argument to '--max-configs=' must be greater than 0."); + printMessage("cppcheck: argument to '--max-configs=' must be greater than 0."); return false; } @@ -780,7 +780,7 @@ bool CmdLineParser::ParseFromArgs(int argc, const char* const argv[]) std::string message("cppcheck: error: unrecognized command line option: \""); message += argv[i]; message += "\"."; - PrintMessage(message); + printMessage(message); return false; } } @@ -801,7 +801,7 @@ bool CmdLineParser::ParseFromArgs(int argc, const char* const argv[]) _settings->maxConfigs = 1U; if (_settings->isEnabled(Settings::UNUSED_FUNCTION) && _settings->jobs > 1) { - PrintMessage("cppcheck: unusedFunction check can't be used with '-j' option. Disabling unusedFunction check."); + printMessage("cppcheck: unusedFunction check can't be used with '-j' option. Disabling unusedFunction check."); } if (argc <= 1) { @@ -810,13 +810,13 @@ bool CmdLineParser::ParseFromArgs(int argc, const char* const argv[]) } if (_showHelp) { - PrintHelp(); + printHelp(); return true; } // Print error only if we have "real" command and expect files if (!_exitAfterPrint && _pathnames.empty() && _settings->project.fileSettings.empty()) { - PrintMessage("cppcheck: No C or C++ source files found."); + printMessage("cppcheck: No C or C++ source files found."); return false; } @@ -827,7 +827,7 @@ bool CmdLineParser::ParseFromArgs(int argc, const char* const argv[]) return true; } -void CmdLineParser::PrintHelp() +void CmdLineParser::printHelp() { std::cout << "Cppcheck - A tool for static C/C++ code analysis\n" "\n" diff --git a/cli/cmdlineparser.h b/cli/cmdlineparser.h index b02923795..8afe1f1b3 100644 --- a/cli/cmdlineparser.h +++ b/cli/cmdlineparser.h @@ -49,47 +49,47 @@ public: * Parse given command line. * @return true if command line was ok, false if there was an error. */ - bool ParseFromArgs(int argc, const char* const argv[]); + bool parseFromArgs(int argc, const char* const argv[]); /** * Return if user wanted to see program version. */ - bool GetShowVersion() const { + bool getShowVersion() const { return _showVersion; } /** * Return if user wanted to see list of error messages. */ - bool GetShowErrorMessages() const { + bool getShowErrorMessages() const { return _showErrorMessages; } /** * Return the path names user gave to command line. */ - const std::vector& GetPathNames() const { + const std::vector& getPathNames() const { return _pathnames; } /** * Return if help is shown to user. */ - bool GetShowHelp() const { + bool getShowHelp() const { return _showHelp; } /** * Return if we should exit after printing version, help etc. */ - bool ExitAfterPrinting() const { + bool exitAfterPrinting() const { return _exitAfterPrint; } /** * Return a list of paths user wants to ignore. */ - const std::vector& GetIgnoredPaths() const { + const std::vector& getIgnoredPaths() const { return _ignoredPaths; } @@ -98,13 +98,13 @@ protected: /** * Print help text to the console. */ - static void PrintHelp(); + static void printHelp(); /** * Print message (to console?). */ - static void PrintMessage(const std::string &message); - static void PrintMessage(const char* message); + static void printMessage(const std::string &message); + static void printMessage(const char* message); private: std::vector _pathnames; diff --git a/cli/cppcheckexecutor.cpp b/cli/cppcheckexecutor.cpp index 68e6c36e6..8da708696 100644 --- a/cli/cppcheckexecutor.cpp +++ b/cli/cppcheckexecutor.cpp @@ -92,10 +92,10 @@ bool CppCheckExecutor::parseFromArgs(CppCheck *cppcheck, int argc, const char* c { Settings& settings = cppcheck->settings(); CmdLineParser parser(&settings); - const bool success = parser.ParseFromArgs(argc, argv); + const bool success = parser.parseFromArgs(argc, argv); if (success) { - if (parser.GetShowVersion() && !parser.GetShowErrorMessages()) { + if (parser.getShowVersion() && !parser.getShowErrorMessages()) { const char * const extraVersion = cppcheck->extraVersion(); if (*extraVersion != 0) std::cout << "Cppcheck " << cppcheck->version() << " (" @@ -104,14 +104,14 @@ bool CppCheckExecutor::parseFromArgs(CppCheck *cppcheck, int argc, const char* c std::cout << "Cppcheck " << cppcheck->version() << std::endl; } - if (parser.GetShowErrorMessages()) { + if (parser.getShowErrorMessages()) { errorlist = true; std::cout << ErrorLogger::ErrorMessage::getXMLHeader(); cppcheck->getErrorMessages(); std::cout << ErrorLogger::ErrorMessage::getXMLFooter() << std::endl; } - if (parser.ExitAfterPrinting()) { + if (parser.exitAfterPrinting()) { settings.terminate(); return true; } @@ -138,9 +138,9 @@ bool CppCheckExecutor::parseFromArgs(CppCheck *cppcheck, int argc, const char* c // Output a warning for the user if he tries to exclude headers bool warn = false; - const std::vector& ignored = parser.GetIgnoredPaths(); - for (std::vector::const_iterator i = ignored.cbegin(); i != ignored.cend(); ++i) { - if (Path::isHeader(*i)) { + const std::vector& ignored = parser.getIgnoredPaths(); + for (const std::string &i : ignored) { + if (Path::isHeader(i)) { warn = true; break; } @@ -150,7 +150,7 @@ bool CppCheckExecutor::parseFromArgs(CppCheck *cppcheck, int argc, const char* c std::cout << "cppcheck: Please use --suppress for ignoring results from the header files." << std::endl; } - const std::vector& pathnames = parser.GetPathNames(); + const std::vector& pathnames = parser.getPathNames(); #if defined(_WIN32) // For Windows we want case-insensitive path matching diff --git a/test/testcmdlineparser.cpp b/test/testcmdlineparser.cpp index 35b814e06..542c706ec 100644 --- a/test/testcmdlineparser.cpp +++ b/test/testcmdlineparser.cpp @@ -154,65 +154,65 @@ private: REDIRECT; const char *argv[] = {"cppcheck"}; CmdLineParser parser(&settings); - ASSERT(parser.ParseFromArgs(1, argv)); - ASSERT_EQUALS(true, parser.GetShowHelp()); + ASSERT(parser.parseFromArgs(1, argv)); + ASSERT_EQUALS(true, parser.getShowHelp()); } void helpshort() { REDIRECT; const char *argv[] = {"cppcheck", "-h"}; CmdLineParser parser(&settings); - ASSERT(parser.ParseFromArgs(2, argv)); - ASSERT_EQUALS(true, parser.GetShowHelp()); + ASSERT(parser.parseFromArgs(2, argv)); + ASSERT_EQUALS(true, parser.getShowHelp()); } void helplong() { REDIRECT; const char *argv[] = {"cppcheck", "--help"}; CmdLineParser parser(&settings); - ASSERT(parser.ParseFromArgs(2, argv)); - ASSERT_EQUALS(true, parser.GetShowHelp()); + ASSERT(parser.parseFromArgs(2, argv)); + ASSERT_EQUALS(true, parser.getShowHelp()); } void showversion() { REDIRECT; const char *argv[] = {"cppcheck", "--version"}; CmdLineParser parser(&settings); - ASSERT(parser.ParseFromArgs(2, argv)); - ASSERT_EQUALS(true, parser.GetShowVersion()); + ASSERT(parser.parseFromArgs(2, argv)); + ASSERT_EQUALS(true, parser.getShowVersion()); } void onefile() { REDIRECT; const char *argv[] = {"cppcheck", "file.cpp"}; CmdLineParser parser(&settings); - ASSERT(parser.ParseFromArgs(2, argv)); - ASSERT_EQUALS(1, (int)parser.GetPathNames().size()); - ASSERT_EQUALS("file.cpp", parser.GetPathNames().at(0)); + ASSERT(parser.parseFromArgs(2, argv)); + ASSERT_EQUALS(1, (int)parser.getPathNames().size()); + ASSERT_EQUALS("file.cpp", parser.getPathNames().at(0)); } void onepath() { REDIRECT; const char *argv[] = {"cppcheck", "src"}; CmdLineParser parser(&settings); - ASSERT(parser.ParseFromArgs(2, argv)); - ASSERT_EQUALS(1, (int)parser.GetPathNames().size()); - ASSERT_EQUALS("src", parser.GetPathNames().at(0)); + ASSERT(parser.parseFromArgs(2, argv)); + ASSERT_EQUALS(1, (int)parser.getPathNames().size()); + ASSERT_EQUALS("src", parser.getPathNames().at(0)); } void optionwithoutfile() { REDIRECT; const char *argv[] = {"cppcheck", "-v"}; CmdLineParser parser(&settings); - ASSERT_EQUALS(false, parser.ParseFromArgs(2, argv)); - ASSERT_EQUALS(0, (int)parser.GetPathNames().size()); + ASSERT_EQUALS(false, parser.parseFromArgs(2, argv)); + ASSERT_EQUALS(0, (int)parser.getPathNames().size()); } void verboseshort() { REDIRECT; const char *argv[] = {"cppcheck", "-v", "file.cpp"}; settings.verbose = false; - ASSERT(defParser.ParseFromArgs(3, argv)); + ASSERT(defParser.parseFromArgs(3, argv)); ASSERT_EQUALS(true, settings.verbose); } @@ -220,7 +220,7 @@ private: REDIRECT; const char *argv[] = {"cppcheck", "--verbose", "file.cpp"}; settings.verbose = false; - ASSERT(defParser.ParseFromArgs(3, argv)); + ASSERT(defParser.parseFromArgs(3, argv)); ASSERT_EQUALS(true, settings.verbose); } @@ -228,7 +228,7 @@ private: REDIRECT; const char *argv[] = {"cppcheck", "--debug", "file.cpp"}; settings.debug = false; - ASSERT(defParser.ParseFromArgs(3, argv)); + ASSERT(defParser.parseFromArgs(3, argv)); ASSERT_EQUALS(true, settings.debug); } @@ -236,7 +236,7 @@ private: REDIRECT; const char *argv[] = {"cppcheck", "--debug-warnings", "file.cpp"}; settings.debugwarnings = false; - ASSERT(defParser.ParseFromArgs(3, argv)); + ASSERT(defParser.parseFromArgs(3, argv)); ASSERT_EQUALS(true, settings.debugwarnings); } @@ -244,7 +244,7 @@ private: REDIRECT; const char *argv[] = {"cppcheck", "-f", "file.cpp"}; settings.force = false; - ASSERT(defParser.ParseFromArgs(3, argv)); + ASSERT(defParser.parseFromArgs(3, argv)); ASSERT_EQUALS(true, settings.force); } @@ -252,7 +252,7 @@ private: REDIRECT; const char *argv[] = {"cppcheck", "--force", "file.cpp"}; settings.force = false; - ASSERT(defParser.ParseFromArgs(3, argv)); + ASSERT(defParser.parseFromArgs(3, argv)); ASSERT_EQUALS(true, settings.force); } @@ -261,20 +261,20 @@ private: settings.relativePaths = false; const char *argvs[] = {"cppcheck", "-rp", "file.cpp"}; - ASSERT(defParser.ParseFromArgs(3, argvs)); + ASSERT(defParser.parseFromArgs(3, argvs)); ASSERT_EQUALS(true, settings.relativePaths); settings.relativePaths = false; const char *argvl[] = {"cppcheck", "--relative-paths", "file.cpp"}; - ASSERT(defParser.ParseFromArgs(3, argvl)); + ASSERT(defParser.parseFromArgs(3, argvl)); ASSERT_EQUALS(true, settings.relativePaths); settings.relativePaths = false; settings.basePaths.clear(); const char *argvsp[] = {"cppcheck", "-rp=C:/foo;C:\\bar", "file.cpp"}; - ASSERT(defParser.ParseFromArgs(3, argvsp)); + ASSERT(defParser.parseFromArgs(3, argvsp)); ASSERT_EQUALS(true, settings.relativePaths); ASSERT_EQUALS(2, settings.basePaths.size()); ASSERT_EQUALS("C:/foo", settings.basePaths[0]); @@ -284,7 +284,7 @@ private: settings.basePaths.clear(); const char *argvlp[] = {"cppcheck", "--relative-paths=C:/foo;C:\\bar", "file.cpp"}; - ASSERT(defParser.ParseFromArgs(3, argvlp)); + ASSERT(defParser.parseFromArgs(3, argvlp)); ASSERT_EQUALS(true, settings.relativePaths); ASSERT_EQUALS(2, settings.basePaths.size()); ASSERT_EQUALS("C:/foo", settings.basePaths[0]); @@ -295,7 +295,7 @@ private: REDIRECT; const char *argv[] = {"cppcheck", "-q", "file.cpp"}; settings.quiet = false; - ASSERT(defParser.ParseFromArgs(3, argv)); + ASSERT(defParser.parseFromArgs(3, argv)); ASSERT_EQUALS(true, settings.quiet); } @@ -303,7 +303,7 @@ private: REDIRECT; const char *argv[] = {"cppcheck", "--quiet", "file.cpp"}; settings.quiet = false; - ASSERT(defParser.ParseFromArgs(3, argv)); + ASSERT(defParser.parseFromArgs(3, argv)); ASSERT_EQUALS(true, settings.quiet); } @@ -311,28 +311,28 @@ private: REDIRECT; const char *argv[] = {"cppcheck", "-D"}; // Fails since -D has no param - ASSERT_EQUALS(false, defParser.ParseFromArgs(2, argv)); + ASSERT_EQUALS(false, defParser.parseFromArgs(2, argv)); } void defines_noarg2() { REDIRECT; const char *argv[] = {"cppcheck", "-D", "-v", "file.cpp"}; // Fails since -D has no param - ASSERT_EQUALS(false, defParser.ParseFromArgs(4, argv)); + ASSERT_EQUALS(false, defParser.parseFromArgs(4, argv)); } void defines_noarg3() { REDIRECT; const char *argv[] = {"cppcheck", "-D", "--quiet", "file.cpp"}; // Fails since -D has no param - ASSERT_EQUALS(false, defParser.ParseFromArgs(4, argv)); + ASSERT_EQUALS(false, defParser.parseFromArgs(4, argv)); } void defines() { REDIRECT; const char *argv[] = {"cppcheck", "-D_WIN32", "file.cpp"}; settings.userDefines.clear(); - ASSERT(defParser.ParseFromArgs(3, argv)); + ASSERT(defParser.parseFromArgs(3, argv)); ASSERT_EQUALS("_WIN32=1", settings.userDefines); } @@ -340,7 +340,7 @@ private: REDIRECT; const char *argv[] = {"cppcheck", "-D_WIN32", "-DNODEBUG", "file.cpp"}; settings.userDefines.clear();; - ASSERT(defParser.ParseFromArgs(4, argv)); + ASSERT(defParser.parseFromArgs(4, argv)); ASSERT_EQUALS("_WIN32=1;NODEBUG=1", settings.userDefines); } @@ -348,7 +348,7 @@ private: REDIRECT; const char *argv[] = {"cppcheck", "-D", "DEBUG", "file.cpp"}; settings.userDefines.clear(); - ASSERT(defParser.ParseFromArgs(4, argv)); + ASSERT(defParser.parseFromArgs(4, argv)); ASSERT_EQUALS("DEBUG=1", settings.userDefines); } @@ -356,7 +356,7 @@ private: REDIRECT; const char *argv[] = {"cppcheck", "-DDEBUG=", "file.cpp"}; // #5137 - defining empty macro settings.userDefines.clear(); - ASSERT(defParser.ParseFromArgs(3, argv)); + ASSERT(defParser.parseFromArgs(3, argv)); ASSERT_EQUALS("DEBUG=", settings.userDefines); } @@ -365,38 +365,38 @@ private: { const char *argv[] = {"cppcheck", "file.cpp"}; settings.enforcedLang = Settings::None; - ASSERT(defParser.ParseFromArgs(2, argv)); + ASSERT(defParser.parseFromArgs(2, argv)); ASSERT_EQUALS(Settings::None, settings.enforcedLang); } { const char *argv[] = {"cppcheck", "-x", "c++", "file.cpp"}; settings.enforcedLang = Settings::None; - ASSERT(defParser.ParseFromArgs(4, argv)); + ASSERT(defParser.parseFromArgs(4, argv)); ASSERT_EQUALS(Settings::CPP, settings.enforcedLang); } { const char *argv[] = {"cppcheck", "-x"}; - ASSERT(!defParser.ParseFromArgs(2, argv)); + ASSERT(!defParser.parseFromArgs(2, argv)); } { const char *argv[] = {"cppcheck", "-x", "--inconclusive", "file.cpp"}; - ASSERT(!defParser.ParseFromArgs(4, argv)); + ASSERT(!defParser.parseFromArgs(4, argv)); } { const char *argv[] = {"cppcheck", "--language=c++", "file.cpp"}; settings.enforcedLang = Settings::None; - ASSERT(defParser.ParseFromArgs(3, argv)); + ASSERT(defParser.parseFromArgs(3, argv)); ASSERT_EQUALS(Settings::CPP, settings.enforcedLang); } { const char *argv[] = {"cppcheck", "--language=c", "file.cpp"}; settings.enforcedLang = Settings::None; - ASSERT(defParser.ParseFromArgs(3, argv)); + ASSERT(defParser.parseFromArgs(3, argv)); ASSERT_EQUALS(Settings::C, settings.enforcedLang); } { const char *argv[] = {"cppcheck", "--language=unknownLanguage", "file.cpp"}; - ASSERT(!defParser.ParseFromArgs(3, argv)); + ASSERT(!defParser.parseFromArgs(3, argv)); } } @@ -404,14 +404,14 @@ private: REDIRECT; const char *argv[] = {"cppcheck", "-I"}; // Fails since -I has no param - ASSERT_EQUALS(false, defParser.ParseFromArgs(2, argv)); + ASSERT_EQUALS(false, defParser.parseFromArgs(2, argv)); } void includes() { REDIRECT; const char *argv[] = {"cppcheck", "-I", "include", "file.cpp"}; settings.includePaths.clear(); - ASSERT(defParser.ParseFromArgs(4, argv)); + ASSERT(defParser.parseFromArgs(4, argv)); ASSERT_EQUALS("include/", settings.includePaths.front()); } @@ -419,7 +419,7 @@ private: REDIRECT; const char *argv[] = {"cppcheck", "-I", "include/", "file.cpp"}; settings.includePaths.clear(); - ASSERT(defParser.ParseFromArgs(4, argv)); + ASSERT(defParser.parseFromArgs(4, argv)); ASSERT_EQUALS("include/", settings.includePaths.front()); } @@ -427,7 +427,7 @@ private: REDIRECT; const char *argv[] = {"cppcheck", "-I", "include\\", "file.cpp"}; settings.includePaths.clear(); - ASSERT(defParser.ParseFromArgs(4, argv)); + ASSERT(defParser.parseFromArgs(4, argv)); ASSERT_EQUALS("include/", settings.includePaths.front()); } @@ -435,7 +435,7 @@ private: REDIRECT; const char *argv[] = {"cppcheck", "-Iinclude", "file.cpp"}; settings.includePaths.clear(); - ASSERT(defParser.ParseFromArgs(3, argv)); + ASSERT(defParser.parseFromArgs(3, argv)); ASSERT_EQUALS("include/", settings.includePaths.front()); } @@ -443,7 +443,7 @@ private: REDIRECT; const char *argv[] = {"cppcheck", "-I", "include/", "-I", "framework/", "file.cpp"}; settings.includePaths.clear(); - ASSERT(defParser.ParseFromArgs(6, argv)); + ASSERT(defParser.parseFromArgs(6, argv)); ASSERT_EQUALS("include/", settings.includePaths.front()); settings.includePaths.pop_front(); ASSERT_EQUALS("framework/", settings.includePaths.front()); @@ -454,14 +454,14 @@ private: REDIRECT; const char *argv[] = {"cppcheck", "--includes-file=inclpaths.txt", "file.cpp"}; settings.includePaths.clear(); - ASSERT_EQUALS(true, defParser.ParseFromArgs(3, argv)); + ASSERT_EQUALS(true, defParser.parseFromArgs(3, argv)); } void enabledAll() { REDIRECT; const char *argv[] = {"cppcheck", "--enable=all", "file.cpp"}; settings = Settings(); - ASSERT(defParser.ParseFromArgs(3, argv)); + ASSERT(defParser.parseFromArgs(3, argv)); ASSERT(settings.isEnabled(Settings::STYLE)); ASSERT(settings.isEnabled(Settings::WARNING)); ASSERT(settings.isEnabled(Settings::UNUSED_FUNCTION)); @@ -473,7 +473,7 @@ private: REDIRECT; const char *argv[] = {"cppcheck", "--enable=style", "file.cpp"}; settings = Settings(); - ASSERT(defParser.ParseFromArgs(3, argv)); + ASSERT(defParser.parseFromArgs(3, argv)); ASSERT(settings.isEnabled(Settings::STYLE)); ASSERT(settings.isEnabled(Settings::WARNING)); ASSERT(settings.isEnabled(Settings::PERFORMANCE)); @@ -486,7 +486,7 @@ private: REDIRECT; const char *argv[] = {"cppcheck", "--enable=performance", "file.cpp"}; settings = Settings(); - ASSERT(defParser.ParseFromArgs(3, argv)); + ASSERT(defParser.parseFromArgs(3, argv)); ASSERT(!settings.isEnabled(Settings::STYLE)); ASSERT(!settings.isEnabled(Settings::WARNING)); ASSERT(settings.isEnabled(Settings::PERFORMANCE)); @@ -499,7 +499,7 @@ private: REDIRECT; const char *argv[] = {"cppcheck", "--enable=portability", "file.cpp"}; settings = Settings(); - ASSERT(defParser.ParseFromArgs(3, argv)); + ASSERT(defParser.parseFromArgs(3, argv)); ASSERT(!settings.isEnabled(Settings::STYLE)); ASSERT(!settings.isEnabled(Settings::WARNING)); ASSERT(!settings.isEnabled(Settings::PERFORMANCE)); @@ -512,7 +512,7 @@ private: REDIRECT; const char *argv[] = {"cppcheck", "--enable=unusedFunction", "file.cpp"}; settings = Settings(); - ASSERT(defParser.ParseFromArgs(3, argv)); + ASSERT(defParser.parseFromArgs(3, argv)); ASSERT(settings.isEnabled(Settings::UNUSED_FUNCTION)); } @@ -520,7 +520,7 @@ private: REDIRECT; const char *argv[] = {"cppcheck", "--enable=missingInclude", "file.cpp"}; settings = Settings(); - ASSERT(defParser.ParseFromArgs(3, argv)); + ASSERT(defParser.parseFromArgs(3, argv)); ASSERT(settings.isEnabled(Settings::MISSING_INCLUDE)); } @@ -529,7 +529,7 @@ private: REDIRECT; const char *argv[] = {"cppcheck", "--enable=internal", "file.cpp"}; settings = Settings(); - ASSERT(defParser.ParseFromArgs(3, argv)); + ASSERT(defParser.parseFromArgs(3, argv)); ASSERT(settings.isEnabled(Settings::INTERNAL)); } #endif @@ -538,7 +538,7 @@ private: REDIRECT; const char *argv[] = {"cppcheck", "--enable=missingInclude,portability,warning", "file.cpp"}; settings = Settings(); - ASSERT(defParser.ParseFromArgs(3, argv)); + ASSERT(defParser.parseFromArgs(3, argv)); ASSERT(!settings.isEnabled(Settings::STYLE)); ASSERT(settings.isEnabled(Settings::WARNING)); ASSERT(!settings.isEnabled(Settings::PERFORMANCE)); @@ -551,7 +551,7 @@ private: REDIRECT; const char *argv[] = {"cppcheck", "--inconclusive"}; settings.inconclusive = false; - ASSERT(defParser.ParseFromArgs(2, argv)); + ASSERT(defParser.parseFromArgs(2, argv)); ASSERT_EQUALS(true, settings.inconclusive); } @@ -559,7 +559,7 @@ private: REDIRECT; const char *argv[] = {"cppcheck", "--error-exitcode=5", "file.cpp"}; settings.exitCode = 0; - ASSERT(defParser.ParseFromArgs(3, argv)); + ASSERT(defParser.parseFromArgs(3, argv)); ASSERT_EQUALS(5, settings.exitCode); } @@ -568,7 +568,7 @@ private: const char *argv[] = {"cppcheck", "--error-exitcode=", "file.cpp"}; settings.exitCode = 0; // Fails since exit code not given - ASSERT_EQUALS(false, defParser.ParseFromArgs(3, argv)); + ASSERT_EQUALS(false, defParser.parseFromArgs(3, argv)); } void errorExitcodeStr() { @@ -576,7 +576,7 @@ private: const char *argv[] = {"cppcheck", "--error-exitcode=foo", "file.cpp"}; settings.exitCode = 0; // Fails since invalid exit code - ASSERT_EQUALS(false, defParser.ParseFromArgs(3, argv)); + ASSERT_EQUALS(false, defParser.parseFromArgs(3, argv)); } void exitcodeSuppressionsOld() { @@ -584,7 +584,7 @@ private: REDIRECT; const char *argv[] = {"cppcheck", "--exitcode-suppressions", "suppr.txt", "file.cpp"}; settings.exitCode = 0; - TODO_ASSERT_EQUALS(true, false, defParser.ParseFromArgs(4, argv)); + TODO_ASSERT_EQUALS(true, false, defParser.parseFromArgs(4, argv)); } void exitcodeSuppressions() { @@ -592,7 +592,7 @@ private: REDIRECT; const char *argv[] = {"cppcheck", "--exitcode-suppressions=suppr.txt", "file.cpp"}; settings.exitCode = 0; - TODO_ASSERT_EQUALS(true, false, defParser.ParseFromArgs(3, argv)); + TODO_ASSERT_EQUALS(true, false, defParser.parseFromArgs(3, argv)); } void exitcodeSuppressionsNoFile() { @@ -600,14 +600,14 @@ private: REDIRECT; const char *argv[] = {"cppcheck", "--exitcode-suppressions", "file.cpp"}; settings.exitCode = 0; - TODO_ASSERT_EQUALS(true, false, defParser.ParseFromArgs(3, argv)); + TODO_ASSERT_EQUALS(true, false, defParser.parseFromArgs(3, argv)); } void fileList() { // TODO: Fails since cannot open the file REDIRECT; const char *argv[] = {"cppcheck", "--file-list", "files.txt", "file.cpp"}; - TODO_ASSERT_EQUALS(true, false, defParser.ParseFromArgs(4, argv)); + TODO_ASSERT_EQUALS(true, false, defParser.parseFromArgs(4, argv)); } /* void fileListStdin() { @@ -615,20 +615,20 @@ private: // files in stdin (_pathnames) is empty REDIRECT; const char *argv[] = {"cppcheck", "--file-list=-", "file.cpp"}; - TODO_ASSERT_EQUALS(true, false, defParser.ParseFromArgs(3, argv)); + TODO_ASSERT_EQUALS(true, false, defParser.parseFromArgs(3, argv)); } */ void inlineSuppr() { REDIRECT; const char *argv[] = {"cppcheck", "--inline-suppr", "file.cpp"}; - ASSERT(defParser.ParseFromArgs(3, argv)); + ASSERT(defParser.parseFromArgs(3, argv)); } void jobs() { REDIRECT; const char *argv[] = {"cppcheck", "-j", "3", "file.cpp"}; settings.jobs = 0; - ASSERT(defParser.ParseFromArgs(4, argv)); + ASSERT(defParser.parseFromArgs(4, argv)); ASSERT_EQUALS(3, settings.jobs); } @@ -637,7 +637,7 @@ private: const char *argv[] = {"cppcheck", "-j", "file.cpp"}; settings.jobs = 0; // Fails since -j is missing thread count - ASSERT_EQUALS(false, defParser.ParseFromArgs(3, argv)); + ASSERT_EQUALS(false, defParser.parseFromArgs(3, argv)); } void jobsInvalid() { @@ -645,7 +645,7 @@ private: const char *argv[] = {"cppcheck", "-j", "e", "file.cpp"}; settings.jobs = 0; // Fails since invalid count given for -j - ASSERT_EQUALS(false, defParser.ParseFromArgs(4, argv)); + ASSERT_EQUALS(false, defParser.parseFromArgs(4, argv)); } void maxConfigs() { @@ -653,7 +653,7 @@ private: const char *argv[] = {"cppcheck", "-f", "--max-configs=12", "file.cpp"}; settings.force = false; settings.maxConfigs = 12; - ASSERT(defParser.ParseFromArgs(4, argv)); + ASSERT(defParser.parseFromArgs(4, argv)); ASSERT_EQUALS(12, settings.maxConfigs); ASSERT_EQUALS(false, settings.force); } @@ -662,28 +662,28 @@ private: REDIRECT; const char *argv[] = {"cppcheck", "--max-configs=", "file.cpp"}; // Fails since --max-configs= is missing limit - ASSERT_EQUALS(false, defParser.ParseFromArgs(3, argv)); + ASSERT_EQUALS(false, defParser.parseFromArgs(3, argv)); } void maxConfigsInvalid() { REDIRECT; const char *argv[] = {"cppcheck", "--max-configs=e", "file.cpp"}; // Fails since invalid count given for --max-configs= - ASSERT_EQUALS(false, defParser.ParseFromArgs(3, argv)); + ASSERT_EQUALS(false, defParser.parseFromArgs(3, argv)); } void maxConfigsTooSmall() { REDIRECT; const char *argv[] = {"cppcheck", "--max-configs=0", "file.cpp"}; // Fails since limit must be greater than 0 - ASSERT_EQUALS(false, defParser.ParseFromArgs(3, argv)); + ASSERT_EQUALS(false, defParser.parseFromArgs(3, argv)); } void reportProgressTest() { REDIRECT; const char *argv[] = {"cppcheck", "--report-progress", "file.cpp"}; settings.reportProgress = false; - ASSERT(defParser.ParseFromArgs(3, argv)); + ASSERT(defParser.parseFromArgs(3, argv)); ASSERT(settings.reportProgress); } @@ -691,7 +691,7 @@ private: REDIRECT; const char *argv[] = {"cppcheck", "--std=posix", "file.cpp"}; settings.standards.posix = false; - ASSERT(defParser.ParseFromArgs(3, argv)); + ASSERT(defParser.parseFromArgs(3, argv)); ASSERT(settings.standards.posix); } @@ -699,7 +699,7 @@ private: REDIRECT; const char *argv[] = {"cppcheck", "--std=c99", "file.cpp"}; settings.standards.c = Standards::C89; - ASSERT(defParser.ParseFromArgs(3, argv)); + ASSERT(defParser.parseFromArgs(3, argv)); ASSERT(settings.standards.c == Standards::C99); } @@ -707,7 +707,7 @@ private: REDIRECT; const char *argv[] = {"cppcheck", "--std=c++11", "file.cpp"}; settings.standards.cpp = Standards::CPP03; - ASSERT(defParser.ParseFromArgs(3, argv)); + ASSERT(defParser.parseFromArgs(3, argv)); ASSERT(settings.standards.cpp == Standards::CPP11); } @@ -715,7 +715,7 @@ private: REDIRECT; const char *argv[] = {"cppcheck", "--platform=win64", "file.cpp"}; settings.platform(Settings::Unspecified); - ASSERT(defParser.ParseFromArgs(3, argv)); + ASSERT(defParser.parseFromArgs(3, argv)); ASSERT(settings.platformType == Settings::Win64); } @@ -723,14 +723,14 @@ private: // TODO: Fails because there is no suppr.txt file! REDIRECT; const char *argv[] = {"cppcheck", "--suppressions", "suppr.txt", "file.cpp"}; - ASSERT(!defParser.ParseFromArgs(4, argv)); + ASSERT(!defParser.parseFromArgs(4, argv)); } void suppressions() { // TODO: Fails because there is no suppr.txt file! REDIRECT; const char *argv[] = {"cppcheck", "--suppressions-list=suppr.txt", "file.cpp"}; - TODO_ASSERT_EQUALS(true, false, defParser.ParseFromArgs(3, argv)); + TODO_ASSERT_EQUALS(true, false, defParser.parseFromArgs(3, argv)); } void suppressionsNoFile() { @@ -738,21 +738,21 @@ private: { CLEAR_REDIRECT_OUTPUT; const char *argv[] = {"cppcheck", "--suppressions-list=", "file.cpp"}; - ASSERT_EQUALS(false, defParser.ParseFromArgs(3, argv)); + ASSERT_EQUALS(false, defParser.parseFromArgs(3, argv)); ASSERT_EQUALS(false, GET_REDIRECT_OUTPUT.find("If you want to pass two files") != std::string::npos); } { CLEAR_REDIRECT_OUTPUT; const char *argv[] = {"cppcheck", "--suppressions-list=a.suppr,b.suppr", "file.cpp"}; - ASSERT_EQUALS(false, defParser.ParseFromArgs(3, argv)); + ASSERT_EQUALS(false, defParser.parseFromArgs(3, argv)); ASSERT_EQUALS(true, GET_REDIRECT_OUTPUT.find("If you want to pass two files") != std::string::npos); } { CLEAR_REDIRECT_OUTPUT; const char *argv[] = {"cppcheck", "--suppressions-list=a.suppr b.suppr", "file.cpp"}; - ASSERT_EQUALS(false, defParser.ParseFromArgs(3, argv)); + ASSERT_EQUALS(false, defParser.parseFromArgs(3, argv)); ASSERT_EQUALS(true, GET_REDIRECT_OUTPUT.find("If you want to pass two files") != std::string::npos); } } @@ -769,7 +769,7 @@ private: REDIRECT; const char *argv[] = {"cppcheck", "--suppress=uninitvar", "file.cpp"}; settings = Settings(); - ASSERT(defParser.ParseFromArgs(3, argv)); + ASSERT(defParser.parseFromArgs(3, argv)); ASSERT_EQUALS(true, settings.nomsg.isSuppressed(errorMessage("uninitvar", "file.cpp", 1))); } @@ -777,7 +777,7 @@ private: REDIRECT; const char *argv[] = {"cppcheck", "--suppress=uninitvar:file.cpp", "file.cpp"}; settings = Settings(); - ASSERT(defParser.ParseFromArgs(3, argv)); + ASSERT(defParser.parseFromArgs(3, argv)); ASSERT_EQUALS(true, settings.nomsg.isSuppressed(errorMessage("uninitvar", "file.cpp", 1U))); } @@ -785,7 +785,7 @@ private: REDIRECT; const char *argv[] = {"cppcheck", "--suppress=uninitvar,noConstructor", "file.cpp"}; settings = Settings(); - TODO_ASSERT_EQUALS(true, false, defParser.ParseFromArgs(3, argv)); + TODO_ASSERT_EQUALS(true, false, defParser.parseFromArgs(3, argv)); TODO_ASSERT_EQUALS(true, false, settings.nomsg.isSuppressed(errorMessage("uninitvar", "file.cpp", 1U))); TODO_ASSERT_EQUALS(true, false, settings.nomsg.isSuppressed(errorMessage("noConstructor", "file.cpp", 1U))); } @@ -794,7 +794,7 @@ private: REDIRECT; const char *argv[] = {"cppcheck", "--suppress=uninitvar", "--suppress=noConstructor", "file.cpp"}; settings = Settings(); - ASSERT(defParser.ParseFromArgs(4, argv)); + ASSERT(defParser.parseFromArgs(4, argv)); ASSERT_EQUALS(true, settings.nomsg.isSuppressed(errorMessage("uninitvar", "file.cpp", 1U))); ASSERT_EQUALS(true, settings.nomsg.isSuppressed(errorMessage("noConstructor", "file.cpp", 1U))); } @@ -803,7 +803,7 @@ private: REDIRECT; const char *argv[] = {"cppcheck", "--template", "{file}:{line},{severity},{id},{message}", "file.cpp"}; settings.templateFormat.clear(); - ASSERT(defParser.ParseFromArgs(4, argv)); + ASSERT(defParser.parseFromArgs(4, argv)); ASSERT_EQUALS("{file}:{line},{severity},{id},{message}", settings.templateFormat); } @@ -811,7 +811,7 @@ private: REDIRECT; const char *argv[] = {"cppcheck", "--template", "gcc", "file.cpp"}; settings.templateFormat.clear(); - ASSERT(defParser.ParseFromArgs(4, argv)); + ASSERT(defParser.parseFromArgs(4, argv)); ASSERT_EQUALS("{file}:{line}:{column}: warning: {message} [{id}]\\n{code}", settings.templateFormat); } @@ -819,7 +819,7 @@ private: REDIRECT; const char *argv[] = {"cppcheck", "--template", "vs", "file.cpp"}; settings.templateFormat.clear(); - ASSERT(defParser.ParseFromArgs(4, argv)); + ASSERT(defParser.parseFromArgs(4, argv)); ASSERT_EQUALS("{file}({line}): {severity}: {message}", settings.templateFormat); } @@ -827,7 +827,7 @@ private: REDIRECT; const char *argv[] = {"cppcheck", "--template", "edit", "file.cpp"}; settings.templateFormat.clear(); - ASSERT(defParser.ParseFromArgs(4, argv)); + ASSERT(defParser.parseFromArgs(4, argv)); ASSERT_EQUALS("{file} +{line}: {severity}: {message}", settings.templateFormat); } @@ -836,7 +836,7 @@ private: const char *argv[] = {"cppcheck", "--xml", "file.cpp"}; settings.xml_version = 1; settings.xml = false; - ASSERT(defParser.ParseFromArgs(3, argv)); + ASSERT(defParser.parseFromArgs(3, argv)); ASSERT(settings.xml); ASSERT_EQUALS(1, settings.xml_version); } @@ -846,7 +846,7 @@ private: const char *argv[] = {"cppcheck", "--xml-version=2", "file.cpp"}; settings.xml_version = 1; settings.xml = false; - ASSERT(defParser.ParseFromArgs(3, argv)); + ASSERT(defParser.parseFromArgs(3, argv)); ASSERT(settings.xml); ASSERT_EQUALS(2, settings.xml_version); } @@ -856,7 +856,7 @@ private: const char *argv[] = {"cppcheck", "--xml", "--xml-version=2", "file.cpp"}; settings.xml_version = 1; settings.xml = false; - ASSERT(defParser.ParseFromArgs(4, argv)); + ASSERT(defParser.parseFromArgs(4, argv)); ASSERT(settings.xml); ASSERT_EQUALS(2, settings.xml_version); } @@ -866,7 +866,7 @@ private: const char *argv[] = {"cppcheck", "--xml-version=2", "--xml", "file.cpp"}; settings.xml_version = 1; settings.xml = false; - ASSERT(defParser.ParseFromArgs(4, argv)); + ASSERT(defParser.parseFromArgs(4, argv)); ASSERT(settings.xml); ASSERT_EQUALS(2, settings.xml_version); } @@ -875,43 +875,43 @@ private: REDIRECT; const char *argv[] = {"cppcheck", "--xml", "--xml-version=3", "file.cpp"}; // FAils since unknown XML format version - ASSERT_EQUALS(false, defParser.ParseFromArgs(4, argv)); + ASSERT_EQUALS(false, defParser.parseFromArgs(4, argv)); } void xmlverinvalid() { REDIRECT; const char *argv[] = {"cppcheck", "--xml", "--xml-version=a", "file.cpp"}; // FAils since unknown XML format version - ASSERT_EQUALS(false, defParser.ParseFromArgs(4, argv)); + ASSERT_EQUALS(false, defParser.parseFromArgs(4, argv)); } void doc() { REDIRECT; const char *argv[] = {"cppcheck", "--doc"}; - ASSERT(defParser.ParseFromArgs(2, argv)); - ASSERT(defParser.ExitAfterPrinting()); + ASSERT(defParser.parseFromArgs(2, argv)); + ASSERT(defParser.exitAfterPrinting()); } void showtime() { REDIRECT; const char *argv[] = {"cppcheck", "--showtime=summary"}; settings.showtime = SHOWTIME_NONE; - ASSERT(defParser.ParseFromArgs(2, argv)); + ASSERT(defParser.parseFromArgs(2, argv)); ASSERT(settings.showtime == SHOWTIME_SUMMARY); } void errorlist1() { REDIRECT; const char *argv[] = {"cppcheck", "--errorlist"}; - ASSERT(defParser.ParseFromArgs(2, argv)); - ASSERT(defParser.GetShowErrorMessages()); + ASSERT(defParser.parseFromArgs(2, argv)); + ASSERT(defParser.getShowErrorMessages()); } void errorlistverbose1() { REDIRECT; const char *argv[] = {"cppcheck", "--verbose", "--errorlist"}; settings.verbose = false; - ASSERT(defParser.ParseFromArgs(3, argv)); + ASSERT(defParser.parseFromArgs(3, argv)); ASSERT(settings.verbose); } @@ -919,7 +919,7 @@ private: REDIRECT; const char *argv[] = {"cppcheck", "--errorlist", "--verbose"}; settings.verbose = false; - ASSERT(defParser.ParseFromArgs(3, argv)); + ASSERT(defParser.parseFromArgs(3, argv)); ASSERT(settings.verbose); } @@ -928,8 +928,8 @@ private: const char *argv[] = {"cppcheck", "-i"}; CmdLineParser parser(&settings); // Fails since no ignored path given - ASSERT_EQUALS(false, parser.ParseFromArgs(2, argv)); - ASSERT_EQUALS(0, parser.GetIgnoredPaths().size()); + ASSERT_EQUALS(false, parser.parseFromArgs(2, argv)); + ASSERT_EQUALS(0, parser.getIgnoredPaths().size()); } /* @@ -937,77 +937,77 @@ private: REDIRECT; const char *argv[] = {"cppcheck", "-isrc", "file.cpp"}; CmdLineParser parser(&settings); - ASSERT(parser.ParseFromArgs(3, argv)); - ASSERT_EQUALS(1, parser.GetIgnoredPaths().size()); - ASSERT_EQUALS("src/", parser.GetIgnoredPaths()[0]); + ASSERT(parser.parseFromArgs(3, argv)); + ASSERT_EQUALS(1, parser.getIgnoredPaths().size()); + ASSERT_EQUALS("src/", parser.getIgnoredPaths()[0]); } void ignorepaths2() { REDIRECT; const char *argv[] = {"cppcheck", "-i", "src", "file.cpp"}; CmdLineParser parser(&settings); - ASSERT(parser.ParseFromArgs(4, argv)); - ASSERT_EQUALS(1, parser.GetIgnoredPaths().size()); - ASSERT_EQUALS("src/", parser.GetIgnoredPaths()[0]); + ASSERT(parser.parseFromArgs(4, argv)); + ASSERT_EQUALS(1, parser.getIgnoredPaths().size()); + ASSERT_EQUALS("src/", parser.getIgnoredPaths()[0]); } void ignorepaths3() { REDIRECT; const char *argv[] = {"cppcheck", "-isrc", "-imodule", "file.cpp"}; CmdLineParser parser(&settings); - ASSERT(parser.ParseFromArgs(4, argv)); - ASSERT_EQUALS(2, parser.GetIgnoredPaths().size()); - ASSERT_EQUALS("src/", parser.GetIgnoredPaths()[0]); - ASSERT_EQUALS("module/", parser.GetIgnoredPaths()[1]); + ASSERT(parser.parseFromArgs(4, argv)); + ASSERT_EQUALS(2, parser.getIgnoredPaths().size()); + ASSERT_EQUALS("src/", parser.getIgnoredPaths()[0]); + ASSERT_EQUALS("module/", parser.getIgnoredPaths()[1]); } */ void ignorepaths4() { REDIRECT; const char *argv[] = {"cppcheck", "-i", "src", "-i", "module", "file.cpp"}; CmdLineParser parser(&settings); - ASSERT(parser.ParseFromArgs(6, argv)); - ASSERT_EQUALS(2, parser.GetIgnoredPaths().size()); - ASSERT_EQUALS("src/", parser.GetIgnoredPaths()[0]); - ASSERT_EQUALS("module/", parser.GetIgnoredPaths()[1]); + ASSERT(parser.parseFromArgs(6, argv)); + ASSERT_EQUALS(2, parser.getIgnoredPaths().size()); + ASSERT_EQUALS("src/", parser.getIgnoredPaths()[0]); + ASSERT_EQUALS("module/", parser.getIgnoredPaths()[1]); } /* void ignorefilepaths1() { REDIRECT; const char *argv[] = {"cppcheck", "-ifoo.cpp", "file.cpp"}; CmdLineParser parser(&settings); - ASSERT(parser.ParseFromArgs(3, argv)); - ASSERT_EQUALS(1, parser.GetIgnoredPaths().size()); - ASSERT_EQUALS("foo.cpp", parser.GetIgnoredPaths()[0]); + ASSERT(parser.parseFromArgs(3, argv)); + ASSERT_EQUALS(1, parser.getIgnoredPaths().size()); + ASSERT_EQUALS("foo.cpp", parser.getIgnoredPaths()[0]); } */ void ignorefilepaths2() { REDIRECT; const char *argv[] = {"cppcheck", "-isrc/foo.cpp", "file.cpp"}; CmdLineParser parser(&settings); - ASSERT(parser.ParseFromArgs(3, argv)); - ASSERT_EQUALS(1, parser.GetIgnoredPaths().size()); - ASSERT_EQUALS("src/foo.cpp", parser.GetIgnoredPaths()[0]); + ASSERT(parser.parseFromArgs(3, argv)); + ASSERT_EQUALS(1, parser.getIgnoredPaths().size()); + ASSERT_EQUALS("src/foo.cpp", parser.getIgnoredPaths()[0]); } void checkconfig() { REDIRECT; const char *argv[] = {"cppcheck", "--check-config", "file.cpp"}; settings.checkConfiguration = false; - ASSERT(defParser.ParseFromArgs(3, argv)); + ASSERT(defParser.parseFromArgs(3, argv)); ASSERT_EQUALS(true, settings.checkConfiguration); } void unknownParam() { REDIRECT; const char *argv[] = {"cppcheck", "--foo", "file.cpp"}; - ASSERT(!defParser.ParseFromArgs(3, argv)); + ASSERT(!defParser.parseFromArgs(3, argv)); } void undefs() { REDIRECT; const char *argv[] = {"cppcheck", "-U_WIN32", "file.cpp"}; settings = Settings(); - ASSERT(defParser.ParseFromArgs(3, argv)); + ASSERT(defParser.parseFromArgs(3, argv)); ASSERT_EQUALS(1, settings.userUndefs.size()); ASSERT(settings.userUndefs.find("_WIN32") != settings.userUndefs.end()); } @@ -1016,7 +1016,7 @@ private: REDIRECT; const char *argv[] = {"cppcheck", "-U_WIN32", "-UNODEBUG", "file.cpp"}; settings = Settings(); - ASSERT(defParser.ParseFromArgs(4, argv)); + ASSERT(defParser.parseFromArgs(4, argv)); ASSERT_EQUALS(2, settings.userUndefs.size()); ASSERT(settings.userUndefs.find("_WIN32") != settings.userUndefs.end()); ASSERT(settings.userUndefs.find("NODEBUG") != settings.userUndefs.end()); @@ -1026,21 +1026,21 @@ private: REDIRECT; const char *argv[] = {"cppcheck", "-U"}; // Fails since -U has no param - ASSERT_EQUALS(false, defParser.ParseFromArgs(2, argv)); + ASSERT_EQUALS(false, defParser.parseFromArgs(2, argv)); } void undefs_noarg2() { REDIRECT; const char *argv[] = {"cppcheck", "-U", "-v", "file.cpp"}; // Fails since -U has no param - ASSERT_EQUALS(false, defParser.ParseFromArgs(4, argv)); + ASSERT_EQUALS(false, defParser.parseFromArgs(4, argv)); } void undefs_noarg3() { REDIRECT; const char *argv[] = {"cppcheck", "-U", "--quiet", "file.cpp"}; // Fails since -U has no param - ASSERT_EQUALS(false, defParser.ParseFromArgs(4, argv)); + ASSERT_EQUALS(false, defParser.parseFromArgs(4, argv)); } };