Refactorization: Moved declaration of errout, ... to testsuite.h, uniformized style

This commit is contained in:
PKEuS 2015-03-11 22:26:33 +01:00
parent 958c05cec4
commit bc5132e0ac
51 changed files with 12 additions and 138 deletions

View File

@ -16,13 +16,10 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "tokenize.h" #include "tokenize.h"
#include "check64bit.h" #include "check64bit.h"
#include "testsuite.h" #include "testsuite.h"
#include <sstream>
extern std::ostringstream errout;
class Test64BitPortability : public TestFixture { class Test64BitPortability : public TestFixture {
public: public:

View File

@ -19,9 +19,7 @@
#include "tokenize.h" #include "tokenize.h"
#include "checkassert.h" #include "checkassert.h"
#include "testsuite.h" #include "testsuite.h"
#include <sstream>
extern std::ostringstream errout;
class TestAssert : public TestFixture { class TestAssert : public TestFixture {
public: public:

View File

@ -16,14 +16,10 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "tokenize.h" #include "tokenize.h"
#include "checkautovariables.h" #include "checkautovariables.h"
#include "testsuite.h" #include "testsuite.h"
#include <sstream>
extern std::ostringstream errout;
class TestAutoVariables : public TestFixture { class TestAutoVariables : public TestFixture {
public: public:

View File

@ -16,13 +16,10 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "tokenize.h" #include "tokenize.h"
#include "checkbool.h" #include "checkbool.h"
#include "testsuite.h" #include "testsuite.h"
#include <sstream>
extern std::ostringstream errout;
class TestBool : public TestFixture { class TestBool : public TestFixture {
public: public:

View File

@ -16,14 +16,10 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "tokenize.h" #include "tokenize.h"
#include "checkboost.h" #include "checkboost.h"
#include "testsuite.h" #include "testsuite.h"
#include <sstream>
extern std::ostringstream errout;
class TestBoost : public TestFixture { class TestBoost : public TestFixture {
public: public:

View File

@ -16,16 +16,13 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "tokenize.h" #include "tokenize.h"
#include "checkbufferoverrun.h" #include "checkbufferoverrun.h"
#include "testsuite.h" #include "testsuite.h"
#include <tinyxml2.h> #include <tinyxml2.h>
#include <sstream>
#include <climits> #include <climits>
extern std::ostringstream errout;
class TestBufferOverrun : public TestFixture { class TestBufferOverrun : public TestFixture {
public: public:

View File

@ -16,13 +16,10 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "tokenize.h" #include "tokenize.h"
#include "checkother.h" #include "checkother.h"
#include "testsuite.h" #include "testsuite.h"
#include <sstream>
extern std::ostringstream errout;
class TestCharVar : public TestFixture { class TestCharVar : public TestFixture {
public: public:

View File

@ -16,15 +16,11 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "tokenize.h" #include "tokenize.h"
#include "checkclass.h" #include "checkclass.h"
#include "testsuite.h" #include "testsuite.h"
#include <sstream>
#include <tinyxml2.h> #include <tinyxml2.h>
extern std::ostringstream errout;
class TestClass : public TestFixture { class TestClass : public TestFixture {
public: public:

View File

@ -22,6 +22,7 @@
#include "redirect.h" #include "redirect.h"
#include "timer.h" #include "timer.h"
class TestCmdlineParser : public TestFixture { class TestCmdlineParser : public TestFixture {
public: public:
TestCmdlineParser() TestCmdlineParser()

View File

@ -16,14 +16,11 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "tokenize.h" #include "tokenize.h"
#include "checkcondition.h" #include "checkcondition.h"
#include "testsuite.h" #include "testsuite.h"
#include <sstream>
#include <tinyxml2.h> #include <tinyxml2.h>
extern std::ostringstream errout;
class TestCondition : public TestFixture { class TestCondition : public TestFixture {
public: public:

View File

@ -16,14 +16,10 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "tokenize.h" #include "tokenize.h"
#include "checkclass.h" #include "checkclass.h"
#include "testsuite.h" #include "testsuite.h"
#include <sstream>
extern std::ostringstream errout;
class TestConstructors : public TestFixture { class TestConstructors : public TestFixture {
public: public:

View File

@ -16,7 +16,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "cppcheck.h" #include "cppcheck.h"
#include "cppcheckexecutor.h" #include "cppcheckexecutor.h"
#include "testsuite.h" #include "testsuite.h"
@ -27,8 +26,6 @@
#include <list> #include <list>
#include <string> #include <string>
extern std::ostringstream errout;
extern std::ostringstream output;
class TestCppcheck : public TestFixture { class TestCppcheck : public TestFixture {
public: public:

View File

@ -21,6 +21,7 @@
#include "testsuite.h" #include "testsuite.h"
#include "errorlogger.h" #include "errorlogger.h"
class TestErrorLogger : public TestFixture { class TestErrorLogger : public TestFixture {
public: public:
TestErrorLogger() : TestFixture("TestErrorLogger"), fooCpp5("foo.cpp", 5), barCpp8("bar.cpp", 8) { TestErrorLogger() : TestFixture("TestErrorLogger"), fooCpp5("foo.cpp", 5), barCpp8("bar.cpp", 8) {

View File

@ -16,13 +16,10 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "tokenize.h" #include "tokenize.h"
#include "checkexceptionsafety.h" #include "checkexceptionsafety.h"
#include "testsuite.h" #include "testsuite.h"
#include <sstream>
extern std::ostringstream errout;
class TestExceptionSafety : public TestFixture { class TestExceptionSafety : public TestFixture {
public: public:

View File

@ -22,8 +22,6 @@
#include "settings.h" #include "settings.h"
#include "check.h" #include "check.h"
extern std::ostringstream errout;
class TestGarbage : public TestFixture { class TestGarbage : public TestFixture {
public: public:

View File

@ -16,18 +16,10 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
// Check for unused variables..
#include "testsuite.h" #include "testsuite.h"
#include "tokenize.h" #include "tokenize.h"
#include "checkother.h" #include "checkother.h"
#include <sstream>
extern std::ostringstream errout;
class TestIncompleteStatement : public TestFixture { class TestIncompleteStatement : public TestFixture {
public: public:

View File

@ -21,9 +21,7 @@
#include "tokenize.h" #include "tokenize.h"
#include "checkinternal.h" #include "checkinternal.h"
#include "testsuite.h" #include "testsuite.h"
#include <sstream>
extern std::ostringstream errout;
class TestInternal : public TestFixture { class TestInternal : public TestFixture {
public: public:

View File

@ -19,9 +19,7 @@
#include "checkio.h" #include "checkio.h"
#include "testsuite.h" #include "testsuite.h"
#include "tokenize.h" #include "tokenize.h"
#include <sstream>
extern std::ostringstream errout;
class TestIO : public TestFixture { class TestIO : public TestFixture {
public: public:

View File

@ -16,13 +16,10 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "tokenize.h" #include "tokenize.h"
#include "checkleakautovar.h" #include "checkleakautovar.h"
#include "testsuite.h" #include "testsuite.h"
#include <sstream>
extern std::ostringstream errout;
class TestLeakAutoVar : public TestFixture { class TestLeakAutoVar : public TestFixture {
public: public:

View File

@ -22,6 +22,7 @@
#include "testsuite.h" #include "testsuite.h"
#include <tinyxml2.h> #include <tinyxml2.h>
class TestLibrary : public TestFixture { class TestLibrary : public TestFixture {
public: public:
TestLibrary() : TestFixture("TestLibrary") { } TestLibrary() : TestFixture("TestLibrary") { }

View File

@ -16,11 +16,10 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "mathlib.h" #include "mathlib.h"
#include "testsuite.h" #include "testsuite.h"
class TestMathLib : public TestFixture { class TestMathLib : public TestFixture {
public: public:
TestMathLib() : TestFixture("TestMathLib") { TestMathLib() : TestFixture("TestMathLib") {

View File

@ -16,17 +16,12 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "tokenize.h" #include "tokenize.h"
#include "tokenlist.h" #include "tokenlist.h"
#include "checkmemoryleak.h" #include "checkmemoryleak.h"
#include "testsuite.h" #include "testsuite.h"
#include "symboldatabase.h" #include "symboldatabase.h"
#include "preprocessor.h" #include "preprocessor.h"
#include <sstream>
extern std::ostringstream errout;
class TestMemleak : private TestFixture { class TestMemleak : private TestFixture {

View File

@ -16,14 +16,10 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "tokenize.h" #include "tokenize.h"
#include "checknonreentrantfunctions.h" #include "checknonreentrantfunctions.h"
#include "testsuite.h" #include "testsuite.h"
#include <sstream>
extern std::ostringstream errout;
class TestNonReentrantFunctions : public TestFixture { class TestNonReentrantFunctions : public TestFixture {
public: public:

View File

@ -19,10 +19,8 @@
#include "tokenize.h" #include "tokenize.h"
#include "checknullpointer.h" #include "checknullpointer.h"
#include "testsuite.h" #include "testsuite.h"
#include <sstream>
#include <tinyxml2.h> #include <tinyxml2.h>
extern std::ostringstream errout;
class TestNullPointer : public TestFixture { class TestNullPointer : public TestFixture {
public: public:

View File

@ -16,14 +16,10 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "tokenize.h" #include "tokenize.h"
#include "checkobsolescentfunctions.h" #include "checkobsolescentfunctions.h"
#include "testsuite.h" #include "testsuite.h"
#include <sstream>
extern std::ostringstream errout;
class TestObsoleteFunctions : public TestFixture { class TestObsoleteFunctions : public TestFixture {
public: public:

View File

@ -16,9 +16,7 @@
#include "options.h" #include "options.h"
#include "testsuite.h" #include "testsuite.h"
#include <sstream>
extern std::ostringstream errout;
class TestOptions: public TestFixture { class TestOptions: public TestFixture {
public: public:

View File

@ -22,10 +22,8 @@
#include "checkother.h" #include "checkother.h"
#include "testsuite.h" #include "testsuite.h"
#include "testutils.h" #include "testutils.h"
#include <sstream>
#include <tinyxml2.h> #include <tinyxml2.h>
extern std::ostringstream errout;
class TestOther : public TestFixture { class TestOther : public TestFixture {
public: public:

View File

@ -21,6 +21,7 @@
#include "testsuite.h" #include "testsuite.h"
#include "pathmatch.h" #include "pathmatch.h"
class TestPathMatch : public TestFixture { class TestPathMatch : public TestFixture {
public: public:
TestPathMatch() TestPathMatch()

View File

@ -16,14 +16,10 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "tokenize.h" #include "tokenize.h"
#include "checkpostfixoperator.h" #include "checkpostfixoperator.h"
#include "testsuite.h" #include "testsuite.h"
#include <sstream>
extern std::ostringstream errout;
class TestPostfixOperator : public TestFixture { class TestPostfixOperator : public TestFixture {
public: public:

View File

@ -29,11 +29,8 @@
#include <map> #include <map>
#include <string> #include <string>
#include <sstream>
#include <set> #include <set>
extern std::ostringstream errout;
extern std::ostringstream output;
#ifdef _MSC_VER #ifdef _MSC_VER
// Visual Studio complains about truncated values for '(char)0xff' and '(char)0xfe' // Visual Studio complains about truncated values for '(char)0xff' and '(char)0xfe'

View File

@ -16,7 +16,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "filelister.h" #include "filelister.h"
#include "testsuite.h" #include "testsuite.h"
#include "cppcheckexecutor.h" #include "cppcheckexecutor.h"

View File

@ -22,10 +22,6 @@
#include "settings.h" #include "settings.h"
#include "templatesimplifier.h" #include "templatesimplifier.h"
#include <sstream>
extern std::ostringstream errout;
class TestSimplifyTemplate : public TestFixture { class TestSimplifyTemplate : public TestFixture {
public: public:

View File

@ -21,10 +21,6 @@
#include "token.h" #include "token.h"
#include "settings.h" #include "settings.h"
#include <sstream>
extern std::ostringstream errout;
class TestSimplifyTokens : public TestFixture { class TestSimplifyTokens : public TestFixture {
public: public:

View File

@ -21,10 +21,6 @@
#include "token.h" #include "token.h"
#include "settings.h" #include "settings.h"
#include <sstream>
extern std::ostringstream errout;
class TestSimplifyTypedef : public TestFixture { class TestSimplifyTypedef : public TestFixture {
public: public:

View File

@ -16,13 +16,10 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "tokenize.h" #include "tokenize.h"
#include "checksizeof.h" #include "checksizeof.h"
#include "testsuite.h" #include "testsuite.h"
#include <sstream>
extern std::ostringstream errout;
class TestSizeof : public TestFixture { class TestSizeof : public TestFixture {
public: public:

View File

@ -16,14 +16,10 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "tokenize.h" #include "tokenize.h"
#include "checkstl.h" #include "checkstl.h"
#include "testsuite.h" #include "testsuite.h"
#include <sstream>
extern std::ostringstream errout;
class TestStl : public TestFixture { class TestStl : public TestFixture {
public: public:

View File

@ -22,9 +22,7 @@
#include "testsuite.h" #include "testsuite.h"
#include "preprocessor.h" #include "preprocessor.h"
#include "testutils.h" #include "testutils.h"
#include <sstream>
extern std::ostringstream errout;
class TestString : public TestFixture { class TestString : public TestFixture {
public: public:

View File

@ -80,6 +80,10 @@ public:
static std::size_t runTests(const options& args); static std::size_t runTests(const options& args);
}; };
extern std::ostringstream errout;
extern std::ostringstream output;
extern std::ostringstream warnings;
#define TEST_CASE( NAME ) if ( prepareTest(#NAME) ) { NAME(); } #define TEST_CASE( NAME ) if ( prepareTest(#NAME) ) { NAME(); }
#define ASSERT( CONDITION ) assert_(__FILE__, __LINE__, CONDITION) #define ASSERT( CONDITION ) assert_(__FILE__, __LINE__, CONDITION)
#define ASSERT_EQUALS( EXPECTED , ACTUAL ) assertEquals(__FILE__, __LINE__, EXPECTED, ACTUAL) #define ASSERT_EQUALS( EXPECTED , ACTUAL ) assertEquals(__FILE__, __LINE__, EXPECTED, ACTUAL)

View File

@ -24,9 +24,7 @@
#include <string> #include <string>
#include <map> #include <map>
#include <sstream>
extern std::ostringstream errout;
class TestSuppressions : public TestFixture { class TestSuppressions : public TestFixture {
public: public:

View File

@ -25,8 +25,6 @@
#include <map> #include <map>
#include <string> #include <string>
extern std::ostringstream errout;
extern std::ostringstream output;
class TestThreadExecutor : public TestFixture { class TestThreadExecutor : public TestFixture {
public: public:

View File

@ -16,12 +16,11 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "timer.h" #include "timer.h"
#include "testsuite.h" #include "testsuite.h"
#include <cmath> #include <cmath>
class TestTimer : public TestFixture { class TestTimer : public TestFixture {
public: public:
TestTimer() : TestFixture("TestTimer") { TestTimer() : TestFixture("TestTimer") {

View File

@ -24,7 +24,7 @@
#include <vector> #include <vector>
#include <string> #include <string>
extern std::ostringstream errout;
class TestToken : public TestFixture { class TestToken : public TestFixture {
public: public:
TestToken() : TestFixture("TestToken") { TestToken() : TestFixture("TestToken") {

View File

@ -24,8 +24,6 @@
#include "preprocessor.h" // usually tests here should not use preprocessor... #include "preprocessor.h" // usually tests here should not use preprocessor...
#include <cstring> #include <cstring>
extern std::ostringstream errout;
class TestTokenizer : public TestFixture { class TestTokenizer : public TestFixture {
public: public:

View File

@ -22,10 +22,8 @@
#include "checktype.h" #include "checktype.h"
#include "testsuite.h" #include "testsuite.h"
#include "testutils.h" #include "testutils.h"
#include <sstream>
#include <tinyxml2.h> #include <tinyxml2.h>
extern std::ostringstream errout;
class TestType : public TestFixture { class TestType : public TestFixture {
public: public:

View File

@ -19,9 +19,7 @@
#include "tokenize.h" #include "tokenize.h"
#include "checkuninitvar.h" #include "checkuninitvar.h"
#include "testsuite.h" #include "testsuite.h"
#include <sstream>
extern std::ostringstream errout;
class TestUninitVar : public TestFixture { class TestUninitVar : public TestFixture {
public: public:

View File

@ -20,9 +20,7 @@
#include "tokenize.h" #include "tokenize.h"
#include "testsuite.h" #include "testsuite.h"
#include "checkunusedfunctions.h" #include "checkunusedfunctions.h"
#include <sstream>
extern std::ostringstream errout;
class TestUnusedFunctions : public TestFixture { class TestUnusedFunctions : public TestFixture {
public: public:
@ -31,7 +29,6 @@ public:
private: private:
void run() { void run() {
TEST_CASE(incondition); TEST_CASE(incondition);
TEST_CASE(return1); TEST_CASE(return1);

View File

@ -21,9 +21,6 @@
#include "checkclass.h" #include "checkclass.h"
#include "testsuite.h" #include "testsuite.h"
#include <sstream>
extern std::ostringstream errout;
class TestUnusedPrivateFunction : public TestFixture { class TestUnusedPrivateFunction : public TestFixture {
public: public:

View File

@ -16,16 +16,10 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
// Check for unused variables..
#include "testsuite.h" #include "testsuite.h"
#include "tokenize.h" #include "tokenize.h"
#include "checkunusedvar.h" #include "checkunusedvar.h"
#include <sstream>
extern std::ostringstream errout;
class TestUnusedVar : public TestFixture { class TestUnusedVar : public TestFixture {
public: public:

View File

@ -19,9 +19,7 @@
#include "testsuite.h" #include "testsuite.h"
#include "checkvaarg.h" #include "checkvaarg.h"
#include "tokenize.h" #include "tokenize.h"
#include <sstream>
extern std::ostringstream errout;
class TestVaarg : public TestFixture { class TestVaarg : public TestFixture {
public: public:

View File

@ -25,7 +25,7 @@
#include <vector> #include <vector>
#include <string> #include <string>
extern std::ostringstream errout;
class TestValueFlow : public TestFixture { class TestValueFlow : public TestFixture {
public: public:
TestValueFlow() : TestFixture("TestValueFlow") { TestValueFlow() : TestFixture("TestValueFlow") {

View File

@ -21,10 +21,6 @@
#include "token.h" #include "token.h"
#include "settings.h" #include "settings.h"
#include <sstream>
extern std::ostringstream errout;
class TestVarID : public TestFixture { class TestVarID : public TestFixture {
public: public: