Made several functions in testsuite.cpp const according to cppcheck suggestions
This commit is contained in:
parent
7b25c48f9f
commit
8594eca9cd
|
@ -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, unsigned int linenr, bool condition)
|
void TestFixture::assert_(const char *filename, unsigned int linenr, bool condition) const
|
||||||
{
|
{
|
||||||
if (!condition) {
|
if (!condition) {
|
||||||
++fails_counter;
|
++fails_counter;
|
||||||
|
@ -121,7 +121,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)
|
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) {
|
if (expected != actual) {
|
||||||
++fails_counter;
|
++fails_counter;
|
||||||
|
@ -146,7 +146,7 @@ void TestFixture::assertEquals(const char *filename, unsigned int linenr, const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestFixture::assertEquals(const char *filename, unsigned 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) const
|
||||||
{
|
{
|
||||||
std::ostringstream ostr1;
|
std::ostringstream ostr1;
|
||||||
ostr1 << expected;
|
ostr1 << expected;
|
||||||
|
@ -155,7 +155,7 @@ void TestFixture::assertEquals(const char *filename, unsigned int linenr, long l
|
||||||
assertEquals(filename, linenr, ostr1.str(), ostr2.str(), msg);
|
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)
|
void TestFixture::assertEqualsDouble(const char *filename, unsigned int linenr, double expected, double actual, const std::string &msg) const
|
||||||
{
|
{
|
||||||
std::ostringstream ostr1;
|
std::ostringstream ostr1;
|
||||||
ostr1 << expected;
|
ostr1 << expected;
|
||||||
|
@ -167,7 +167,7 @@ void TestFixture::assertEqualsDouble(const char *filename, unsigned int linenr,
|
||||||
void TestFixture::todoAssertEquals(const char *filename, unsigned int linenr,
|
void TestFixture::todoAssertEquals(const char *filename, unsigned int linenr,
|
||||||
const std::string &wanted,
|
const std::string &wanted,
|
||||||
const std::string ¤t,
|
const std::string ¤t,
|
||||||
const std::string &actual)
|
const std::string &actual) const
|
||||||
{
|
{
|
||||||
if (wanted == actual) {
|
if (wanted == actual) {
|
||||||
if (gcc_style_errors) {
|
if (gcc_style_errors) {
|
||||||
|
@ -184,7 +184,7 @@ void TestFixture::todoAssertEquals(const char *filename, unsigned int linenr,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestFixture::todoAssertEquals(const char *filename, unsigned int linenr, long long wanted, long long current, long long actual)
|
void TestFixture::todoAssertEquals(const char *filename, unsigned int linenr, long long wanted, long long current, long long actual) const
|
||||||
{
|
{
|
||||||
std::ostringstream wantedStr, currentStr, actualStr;
|
std::ostringstream wantedStr, currentStr, actualStr;
|
||||||
wantedStr << wanted;
|
wantedStr << wanted;
|
||||||
|
@ -193,7 +193,7 @@ void TestFixture::todoAssertEquals(const char *filename, unsigned int linenr, lo
|
||||||
todoAssertEquals(filename, linenr, wantedStr.str(), currentStr.str(), actualStr.str());
|
todoAssertEquals(filename, linenr, wantedStr.str(), currentStr.str(), actualStr.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestFixture::assertThrowFail(const char *filename, unsigned int linenr)
|
void TestFixture::assertThrowFail(const char *filename, unsigned int linenr) const
|
||||||
{
|
{
|
||||||
++fails_counter;
|
++fails_counter;
|
||||||
if (gcc_style_errors) {
|
if (gcc_style_errors) {
|
||||||
|
|
|
@ -44,17 +44,17 @@ protected:
|
||||||
|
|
||||||
bool runTest(const char testname[]);
|
bool runTest(const char testname[]);
|
||||||
|
|
||||||
void assert_(const char *filename, unsigned int linenr, bool condition);
|
void assert_(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 = "");
|
void assertEquals(const char *filename, unsigned int linenr, const std::string &expected, const std::string &actual, const std::string &msg = "") const;
|
||||||
void assertEquals(const char *filename, unsigned 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="") const;
|
||||||
void assertEqualsDouble(const char *filename, unsigned 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="") const;
|
||||||
|
|
||||||
void todoAssertEquals(const char *filename, unsigned int linenr, const std::string &wanted,
|
void todoAssertEquals(const char *filename, unsigned int linenr, const std::string &wanted,
|
||||||
const std::string ¤t, const std::string &actual);
|
const std::string ¤t, const std::string &actual) const;
|
||||||
void todoAssertEquals(const char *filename, unsigned int linenr, long long wanted,
|
void todoAssertEquals(const char *filename, unsigned int linenr, long long wanted,
|
||||||
long long current, long long actual);
|
long long current, long long actual) const;
|
||||||
void assertThrowFail(const char *filename, unsigned int linenr);
|
void assertThrowFail(const char *filename, unsigned int linenr) const;
|
||||||
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);
|
||||||
|
|
Loading…
Reference in New Issue