Refactorizations in testrunner:

- Avoid creation of std::string instances of static strings where possible in testrunner.
- Removed unnecessary include of tinyxml.h in testcppcheck.cpp
This commit is contained in:
PKEuS 2012-07-16 04:17:14 -07:00
parent 37820af7f8
commit 7d33181fba
5 changed files with 9 additions and 9 deletions

View File

@ -35,7 +35,7 @@ private:
TEST_CASE(BoostForeachContainerModification)
}
void check(const std::string &code) {
void check(const char code[]) {
// Clear the error buffer..
errout.str("");
@ -45,7 +45,7 @@ private:
// Tokenize..
Tokenizer tokenizer(&settings, this);
std::istringstream istr(code.c_str());
std::istringstream istr(code);
tokenizer.tokenize(istr, "test.cpp");
tokenizer.simplifyTokenList();

View File

@ -30,9 +30,6 @@
#include <list>
#include <string>
// use tinyxml with STL
#include <tinyxml.h>
extern std::ostringstream errout;
extern std::ostringstream output;

View File

@ -44,7 +44,7 @@ private:
TEST_CASE(catchExceptionByValue);
}
void check(const std::string &code, bool inconclusive = false) {
void check(const char code[], bool inconclusive = false) {
// Clear the error buffer..
errout.str("");

View File

@ -41,7 +41,7 @@ private:
TEST_CASE(internalError)
}
void check(const std::string &code) {
void check(const char code[]) {
// Clear the error buffer..
errout.str("");
@ -50,7 +50,7 @@ private:
// Tokenize..
Tokenizer tokenizer(&settings, this);
std::istringstream istr(code.c_str());
std::istringstream istr(code);
tokenizer.tokenize(istr, "test.cpp");
tokenizer.simplifyTokenList();

View File

@ -118,7 +118,7 @@ private:
}
void check(const std::string &code, const bool inconclusive=false) {
void check(const char code[], const bool inconclusive=false) {
// Clear the error buffer..
errout.str("");
@ -137,6 +137,9 @@ private:
CheckStl checkStl;
checkStl.runSimplifiedChecks(&tokenizer, &settings, this);
}
void check(const std::string &code, const bool inconclusive=false) {
check(code.c_str(), inconclusive);
}
void iterator1() {