testing: Various fixes to make the tests compile without warnings/errors

This commit is contained in:
Daniel Marjamäki 2008-10-16 17:22:26 +00:00
parent fb5707b73e
commit b235c373a5
9 changed files with 19 additions and 14 deletions

View File

@ -7,7 +7,7 @@ TESTS=testbufferoverrun.o testcharvar.o testconstructors.o testdivision.o testme
all: ${OBJS} main.o
g++ -Wall -g -o cppcheck $^
test: ${OBJS} TestsRunner.o MiniCppUnit.o ${TESTS}
g++ -Wall -g -o testsrunner $^
test: ${OBJS} testrunner.o testsuite.o ${TESTS}
g++ -Wall -g -o testrunner $^
clean:
rm -f *.o cppcheck_test cppcheck

View File

@ -319,6 +319,6 @@ private:
};
REGISTER_TEST( TestBufferOverrun );
REGISTER_TEST( TestBufferOverrun )

View File

@ -77,5 +77,5 @@ private:
}
};
REGISTER_TEST( TestCharVar );
REGISTER_TEST( TestCharVar )

View File

@ -97,4 +97,4 @@ private:
};
REGISTER_TEST( TestConstructors );
REGISTER_TEST( TestConstructors )

View File

@ -128,6 +128,6 @@ private:
}
};
REGISTER_TEST( TestDivision );
REGISTER_TEST( TestDivision )

View File

@ -542,6 +542,6 @@ private:
};
REGISTER_TEST( TestMemleak );
REGISTER_TEST( TestMemleak )

View File

@ -53,10 +53,12 @@ TestFixture::TestFixture(const std::string &_name) : classname(_name)
TestRegistry::theInstance().addTest(this);
}
/*
TestFixture::~TestFixture()
{
TestRegistry::theInstance().removeTest(this);
}
*/
bool TestFixture::runTest(const char testname[])
{

View File

@ -19,7 +19,7 @@ protected:
public:
TestFixture(const std::string &_name);
~TestFixture();
virtual ~TestFixture() { }
static void printTests();
static void runTests();
@ -28,5 +28,5 @@ public:
#define TEST_CASE( NAME ) if ( runTest(#NAME) ) NAME ();
#define ASSERT_EQUALS( EXPECTED , ACTUAL ) if (EXPECTED!=ACTUAL) assertFail(__FILE__, __LINE__);
#define REGISTER_TEST( CLASSNAME ) namespace { CLASSNAME instance; };
#define REGISTER_TEST( CLASSNAME ) namespace { CLASSNAME instance; }

View File

@ -1,7 +1,7 @@
// Check for unused variables..
#include "MiniCppUnit.h"
#include "testsuite.h"
#include "tokenize.h"
#include "CheckOther.h"
@ -9,8 +9,12 @@
extern std::ostringstream errout;
class TestUnusedVar : public TestFixture<TestUnusedVar>
class TestUnusedVar : public TestFixture
{
public:
TestUnusedVar() : TestFixture("TestUnusedVar")
{ }
private:
void check( const char code[] )
{
@ -27,8 +31,7 @@ private:
CheckStructMemberUsage();
}
public:
TEST_FIXTURE( TestUnusedVar )
void run()
{
TEST_CASE( structmember1 );
}
@ -48,6 +51,6 @@ public:
};
REGISTER_FIXTURE( TestUnusedVar )
REGISTER_TEST( TestUnusedVar )