testrunner: assert-like functions should take linenr parameter as a 'unsigned int' (maybe in the future these should be converted to 'size_t'?);

fix discrepancy between 'todoAssertEquals' and 'AssertEquals' so that the parameters 'expected, wanted, actual and current' are 'long long' types.
This commit is contained in:
Edoardo Prezioso 2012-01-03 15:34:34 +01:00
parent f20e88fcc5
commit 8d84e5f852
2 changed files with 15 additions and 15 deletions

View File

@ -109,7 +109,7 @@ static std::string writestr(const std::string &str, bool gccStyle = false)
return ostr.str(); return ostr.str();
} }
void TestFixture::assert_(const char *filename, int linenr, bool condition) void TestFixture::assert_(const char *filename, unsigned int linenr, bool condition)
{ {
if (!condition) { if (!condition) {
++fails_counter; ++fails_counter;
@ -121,7 +121,7 @@ void TestFixture::assert_(const char *filename, int linenr, bool condition)
} }
} }
void TestFixture::assertEquals(const char *filename, int linenr, const std::string &expected, const std::string &actual, const std::string &msg) void TestFixture::assertEquals(const char *filename, unsigned int linenr, const std::string &expected, const std::string &actual, const std::string &msg)
{ {
if (expected != actual) { if (expected != actual) {
++fails_counter; ++fails_counter;
@ -146,7 +146,7 @@ void TestFixture::assertEquals(const char *filename, int linenr, const std::stri
} }
} }
void TestFixture::assertEquals(const char *filename, int linenr, long long expected, long long actual, const std::string &msg) void TestFixture::assertEquals(const char *filename, unsigned int linenr, long long expected, long long actual, const std::string &msg)
{ {
std::ostringstream ostr1; std::ostringstream ostr1;
ostr1 << expected; ostr1 << expected;
@ -155,7 +155,7 @@ void TestFixture::assertEquals(const char *filename, int linenr, long long expec
assertEquals(filename, linenr, ostr1.str(), ostr2.str(), msg); assertEquals(filename, linenr, ostr1.str(), ostr2.str(), msg);
} }
void TestFixture::assertEqualsDouble(const char *filename, int linenr, double expected, double actual, const std::string &msg) void TestFixture::assertEqualsDouble(const char *filename, unsigned int linenr, double expected, double actual, const std::string &msg)
{ {
std::ostringstream ostr1; std::ostringstream ostr1;
ostr1 << expected; ostr1 << expected;
@ -164,7 +164,7 @@ void TestFixture::assertEqualsDouble(const char *filename, int linenr, double ex
assertEquals(filename, linenr, ostr1.str(), ostr2.str(), msg); assertEquals(filename, linenr, ostr1.str(), ostr2.str(), msg);
} }
void TestFixture::todoAssertEquals(const char *filename, int linenr, void TestFixture::todoAssertEquals(const char *filename, unsigned int linenr,
const std::string &wanted, const std::string &wanted,
const std::string &current, const std::string &current,
const std::string &actual) const std::string &actual)
@ -184,7 +184,7 @@ void TestFixture::todoAssertEquals(const char *filename, int linenr,
} }
} }
void TestFixture::todoAssertEquals(const char *filename, int linenr, unsigned int wanted, unsigned int current, unsigned int actual) void TestFixture::todoAssertEquals(const char *filename, unsigned int linenr, long long wanted, long long current, long long actual)
{ {
std::ostringstream wantedStr, currentStr, actualStr; std::ostringstream wantedStr, currentStr, actualStr;
wantedStr << wanted; wantedStr << wanted;
@ -193,7 +193,7 @@ void TestFixture::todoAssertEquals(const char *filename, int linenr, unsigned in
todoAssertEquals(filename, linenr, wantedStr.str(), currentStr.str(), actualStr.str()); todoAssertEquals(filename, linenr, wantedStr.str(), currentStr.str(), actualStr.str());
} }
void TestFixture::assertThrowFail(const char *filename, int linenr) void TestFixture::assertThrowFail(const char *filename, unsigned int linenr)
{ {
++fails_counter; ++fails_counter;
if (gcc_style_errors) { if (gcc_style_errors) {

View File

@ -46,17 +46,17 @@ protected:
bool runTest(const char testname[]); bool runTest(const char testname[]);
void assert_(const char *filename, int linenr, bool condition); void assert_(const char *filename, unsigned int linenr, bool condition);
void assertEquals(const char *filename, int linenr, const std::string &expected, const std::string &actual, const std::string &msg = ""); void assertEquals(const char *filename, unsigned int linenr, const std::string &expected, const std::string &actual, const std::string &msg = "");
void assertEquals(const char *filename, int linenr, long long expected, long long actual, const std::string &msg=""); void assertEquals(const char *filename, unsigned int linenr, long long expected, long long actual, const std::string &msg="");
void assertEqualsDouble(const char *filename, int linenr, double expected, double actual, const std::string &msg=""); void assertEqualsDouble(const char *filename, unsigned int linenr, double expected, double actual, const std::string &msg="");
void todoAssertEquals(const char *filename, int linenr, const std::string &wanted, void todoAssertEquals(const char *filename, unsigned int linenr, const std::string &wanted,
const std::string &current, const std::string &actual); const std::string &current, const std::string &actual);
void todoAssertEquals(const char *filename, int linenr, unsigned int wanted, void todoAssertEquals(const char *filename, unsigned int linenr, long long wanted,
unsigned int current, unsigned int actual); long long current, long long actual);
void assertThrowFail(const char *filename, int linenr); void assertThrowFail(const char *filename, unsigned int linenr);
void processOptions(const options& args); void processOptions(const options& args);
public: public:
virtual void reportOut(const std::string &outmsg); virtual void reportOut(const std::string &outmsg);