Add simple --showtime test case

This commit is contained in:
Reijo Tomperi 2010-04-13 23:52:19 +03:00
parent 9c5e907b5c
commit e1fe238f06
1 changed files with 25 additions and 0 deletions

View File

@ -60,6 +60,7 @@ private:
TEST_CASE(getErrorMessages);
TEST_CASE(parseOutputtingArgs);
TEST_CASE(parseOutputtingInvalidArgs);
TEST_CASE(parseArgsAndCheck);
}
bool argCheck(int argc, const char *argv[])
@ -70,6 +71,30 @@ private:
return cppCheck.parseFromArgs(argc, argv);
}
bool argCheckWithCheck(int argc, const char *argv[], const std::string &data)
{
errout.str("");
output.str("");
CppCheck cppCheck(*this);
cppCheck.addFile("file.cpp", data);
bool result = cppCheck.parseFromArgs(argc, argv);
if (result)
cppCheck.check();
return result;
}
void parseArgsAndCheck()
{
{
const char *argv[] = {"cppcheck", "--showtime=top5"};
const char *data = "void foo(){}";
ASSERT_EQUALS(true, argCheckWithCheck(2, argv, data));
ASSERT_EQUALS("", errout.str());
// ASSERT_EQUALS(true, output.str().find("Overall time:") != std::string::npos);
}
}
void parseOutputtingArgs()
{
{