Refactorization: Improved string handling in test suite
Merged from LCppC.
This commit is contained in:
parent
141d2ac215
commit
3998836b03
|
@ -105,9 +105,7 @@ bool TestFixture::prepareTest(const char testname[])
|
||||||
|
|
||||||
std::string TestFixture::getLocationStr(const char * const filename, const unsigned int linenr) const
|
std::string TestFixture::getLocationStr(const char * const filename, const unsigned int linenr) const
|
||||||
{
|
{
|
||||||
std::ostringstream ret;
|
return filename + ':' + std::to_string(linenr) + '(' + classname + "::" + mTestname + ')';
|
||||||
ret << filename << ':' << linenr << '(' << classname << "::" << mTestname << ')';
|
|
||||||
return ret.str();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::string writestr(const std::string &str, bool gccStyle = false)
|
static std::string writestr(const std::string &str, bool gccStyle = false)
|
||||||
|
@ -245,6 +243,15 @@ void TestFixture::todoAssertEquals(const char * const filename, const unsigned i
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TestFixture::todoAssertEquals(const char* const filename, const unsigned int linenr,
|
||||||
|
const char wanted[],
|
||||||
|
const char current[],
|
||||||
|
const std::string& actual) const
|
||||||
|
{
|
||||||
|
todoAssertEquals(filename, linenr, std::string(wanted), std::string(current), actual);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void TestFixture::todoAssertEquals(const char * const filename, const unsigned int linenr, const long long wanted, const long long current, const long long actual) const
|
void TestFixture::todoAssertEquals(const char * const filename, const unsigned int linenr, const long long wanted, const long long current, const long long actual) const
|
||||||
{
|
{
|
||||||
std::ostringstream wantedStr, currentStr, actualStr;
|
std::ostringstream wantedStr, currentStr, actualStr;
|
||||||
|
|
|
@ -80,6 +80,8 @@ protected:
|
||||||
|
|
||||||
void todoAssertEquals(const char * const filename, const unsigned int linenr, const std::string &wanted,
|
void todoAssertEquals(const char * const filename, const unsigned int linenr, const std::string &wanted,
|
||||||
const std::string ¤t, const std::string &actual) const;
|
const std::string ¤t, const std::string &actual) const;
|
||||||
|
void todoAssertEquals(const char * const filename, const unsigned int linenr, const char wanted[],
|
||||||
|
const char current[], const std::string &actual) const;
|
||||||
void todoAssertEquals(const char * const filename, const unsigned int linenr, const long long wanted,
|
void todoAssertEquals(const char * const filename, const unsigned int linenr, const long long wanted,
|
||||||
const long long current, const long long actual) const;
|
const long long current, const long long actual) const;
|
||||||
void assertThrow(const char * const filename, const unsigned int linenr) const;
|
void assertThrow(const char * const filename, const unsigned int linenr) const;
|
||||||
|
|
Loading…
Reference in New Issue