testrunner: revert changes to avoid compiler warnings

This commit is contained in:
Daniel Marjamäki 2015-07-01 19:15:27 +02:00
parent 4a1695c879
commit 14044bf60b
2 changed files with 21 additions and 22 deletions

View File

@ -129,7 +129,7 @@ void TestFixture::assert_(const char *filename, unsigned int linenr, bool condit
}
}
void TestFixture::_assertEquals(const char *filename, unsigned int linenr, const std::string &expected, const std::string &actual, const std::string &msg) const
void TestFixture::assertEquals(const char *filename, unsigned int linenr, const std::string &expected, const std::string &actual, const std::string &msg) const
{
if (expected != actual) {
++fails_counter;
@ -155,28 +155,35 @@ void TestFixture::_assertEquals(const char *filename, unsigned int linenr, const
}
}
}
template<>
void TestFixture::assertEquals(const char *filename, unsigned int linenr, const char expected[], const std::string& actual, const std::string &msg) const
{
assertEquals(filename, linenr, std::string(expected), actual, msg);
}
template<>
void TestFixture::assertEquals(const char *filename, unsigned int linenr, const char expected[], const char actual[], const std::string &msg) const
{
assertEquals(filename, linenr, std::string(expected), std::string(actual), msg);
}
template<>
void TestFixture::assertEquals(const char *filename, unsigned int linenr, const std::string& expected, const char actual[], const std::string &msg) const
{
assertEquals(filename, linenr, expected, std::string(actual), msg);
}
void TestFixture::assertEquals(const char *filename, unsigned int linenr, long long expected, long long actual, const std::string &msg) const
{
std::ostringstream ostr1;
ostr1 << expected;
std::ostringstream ostr2;
ostr2 << actual;
assertEquals(filename, linenr, ostr1.str(), ostr2.str(), msg);
}
void TestFixture::assertEqualsDouble(const char *filename, unsigned int linenr, double expected, double actual, const std::string &msg) const
{
assertEquals(filename, linenr, MathLib::toString(expected), MathLib::toString(actual), msg);
std::ostringstream ostr1;
ostr1 << expected;
std::ostringstream ostr2;
ostr2 << actual;
assertEquals(filename, linenr, ostr1.str(), ostr2.str(), msg);
}
void TestFixture::todoAssertEquals(const char *filename, unsigned int linenr,
@ -294,7 +301,7 @@ std::size_t TestFixture::runTests(const options& args)
if (!missingLibs.empty()) {
std::cerr << "Missing libraries: ";
for (std::set<std::string>::const_iterator i = missingLibs.cbegin(); i != missingLibs.cend(); ++i)
for (std::set<std::string>::const_iterator i = missingLibs.begin(); i != missingLibs.end(); ++i)
std::cerr << *i << " ";
std::cerr << std::endl << std::endl;
}

View File

@ -51,13 +51,12 @@ protected:
void assert_(const char *filename, unsigned int linenr, bool condition) const;
void todoAssert(const char *filename, unsigned int linenr, bool condition) const;
void _assertEquals(const char *filename, unsigned int linenr, const std::string &expected, const std::string &actual, const std::string &msg) const;
template <typename E, typename A>
void assertEquals(const char *filename, unsigned int linenr, const E expected, const A actual, const std::string &msg = emptyString) const {
_assertEquals(filename, linenr, MathLib::toString(expected), MathLib::toString(actual), msg);
}
void assertEquals(const char *filename, unsigned int linenr, const std::string &expected, const std::string &actual, const std::string &msg = emptyString) const;
void assertEquals(const char *filename, unsigned int linenr, const char expected[], const std::string& actual, const std::string &msg = emptyString) const;
void assertEquals(const char *filename, unsigned int linenr, const char expected[], const char actual[], const std::string &msg = emptyString) const;
void assertEquals(const char *filename, unsigned int linenr, const std::string& expected, const char actual[], const std::string &msg = emptyString) const;
void assertEquals(const char *filename, unsigned int linenr, long long expected, long long actual, const std::string &msg = emptyString) const;
void assertEqualsDouble(const char *filename, unsigned int linenr, double expected, double actual, const std::string &msg = emptyString) const;
void todoAssertEquals(const char *filename, unsigned int linenr, const std::string &wanted,
@ -81,13 +80,6 @@ public:
static std::size_t runTests(const options& args);
};
template<>
void TestFixture::assertEquals(const char *filename, unsigned int linenr, const char expected[], const std::string& actual, const std::string &msg) const;
template<>
void TestFixture::assertEquals(const char *filename, unsigned int linenr, const char expected[], const char actual[], const std::string &msg) const;
template<>
void TestFixture::assertEquals(const char *filename, unsigned int linenr, const std::string& expected, const char actual[], const std::string &msg) const;
extern std::ostringstream errout;
extern std::ostringstream output;
extern std::ostringstream warnings;