Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions test/testautovariables.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,7 @@ class TestAutoVariables : public TestFixture {
tokenizer.simplifyTokenList2();
const std::string str2(tokenizer.tokens()->stringifyList(0,true));
if (str1 != str2)
warn(("Unsimplified code in test case. It looks like this test "
"should either be cleaned up or moved to TestTokenizer or "
"TestSimplifyTokens instead.\nstr1="+str1+"\nstr2="+str2).c_str());

warnUnsimplified(str1, str2);

// Check auto variables
checkAutoVariables.autoVariables();
Expand Down
2 changes: 1 addition & 1 deletion test/testboost.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class TestBoost : public TestFixture {
tokenizer.simplifyTokenList2();
const std::string str2(tokenizer.tokens()->stringifyList(0,true));
if (str1 != str2)
warn("Unsimplified code in test case");
warnUnsimplified(str1, str2);

// Check..
CheckBoost checkBoost;
Expand Down
4 changes: 1 addition & 3 deletions test/testbufferoverrun.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,7 @@ class TestBufferOverrun : public TestFixture {

// Ensure that the test case is not bad.
if (verify && str1 != str2) {
warn(("Unsimplified code in test case. It looks like this test "
"should either be cleaned up or moved to TestTokenizer or "
"TestSimplifyTokens instead.\nstr1="+str1+"\nstr2="+str2).c_str());
warnUnsimplified(str1, str2);
}

// Check for buffer overruns..
Expand Down
2 changes: 1 addition & 1 deletion test/testclass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2628,7 +2628,7 @@ class TestClass : public TestFixture {
tokenizer.simplifyTokenList2();
const std::string str2(tokenizer.tokens()->stringifyList(0,true));
if (verify && str1 != str2)
warn(("Unsimplified code in test case\nstr1="+str1+"\nstr2="+str2).c_str());
warnUnsimplified(str1, str2);

CheckClass checkClass(&tokenizer, &settings, this);
checkClass.checkConst();
Expand Down
4 changes: 1 addition & 3 deletions test/testcondition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,7 @@ class TestCondition : public TestFixture {

// Ensure that the test case is not bad.
if (validate && str1 != str2) {
warn(("Unsimplified code in test case. It looks like this test "
"should either be cleaned up or moved to TestTokenizer or "
"TestSimplifyTokens instead.\nstr1="+str1+"\nstr2="+str2).c_str());
warnUnsimplified(str1, str2);
}
}

Expand Down
4 changes: 1 addition & 3 deletions test/testnullpointer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,7 @@ class TestNullPointer : public TestFixture {
tokenizer.simplifyTokenList2();
const std::string str2(tokenizer.tokens()->stringifyList(0,true));
if (verify && str1 != str2)
warn(("Unsimplified code in test case. It looks like this test "
"should either be cleaned up or moved to TestTokenizer or "
"TestSimplifyTokens instead.\nstr1="+str1+"\nstr2="+str2).c_str());
warnUnsimplified(str1, str2);

checkNullPointer.nullConstantDereference();
}
Expand Down
2 changes: 1 addition & 1 deletion test/testother.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ class TestOther : public TestFixture {
tokenizer.simplifyTokenList2();
const std::string str2(tokenizer.tokens()->stringifyList(0,true));
if (str1 != str2)
warn(("Unsimplified code in test case\nstr1="+str1+"\nstr2="+str2).c_str());
warnUnsimplified(str1, str2);
checkOther.runSimplifiedChecks(&tokenizer, settings, this);
}
}
Expand Down
7 changes: 7 additions & 0 deletions test/testsuite.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,13 @@ void TestFixture::warn(const char msg[])
warnings << "Warning: " << currentTest << " " << msg << std::endl;
}

void TestFixture::warnUnsimplified(const std::string& unsimplified, const std::string& simplified)
{
warn(("Unsimplified code in test case. It looks like this test "
"should either be cleaned up or moved to TestTokenizer or "
"TestSimplifyTokens instead.\nactual=" + unsimplified + "\nexpected=" + simplified).c_str());
}

void TestFixture::processOptions(const options& args)
{
quiet_tests = args.quiet();
Expand Down
1 change: 1 addition & 0 deletions test/testsuite.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ class TestFixture : public ErrorLogger {
virtual void reportErr(const ErrorLogger::ErrorMessage &msg);
void run(const std::string &str);
void warn(const char msg[]);
void warnUnsimplified(const std::string& unsimplified, const std::string& simplified);

TestFixture(const std::string &_name);
virtual ~TestFixture() { }
Expand Down
4 changes: 1 addition & 3 deletions test/testuninitvar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2093,9 +2093,7 @@ class TestUninitVar : public TestFixture {
tokenizer.simplifyTokenList2();
const std::string str2(tokenizer.tokens()->stringifyList(0,true));
if (verify && str1 != str2)
warn(("Unsimplified code in test case. It looks like this test "
"should either be cleaned up or moved to TestTokenizer or "
"TestSimplifyTokens instead.\nstr1="+str1+"\nstr2="+str2).c_str());
warnUnsimplified(str1, str2);

// Check for redundant code..
CheckUninitVar checkuninitvar(&tokenizer, &settings1, this);
Expand Down