test: Various micro optimizations: Replaced std::string() with std::string(). Use std::string::clear() instead of s = and prefer std::string::empty() instead of (s == ) for checking a string is empty.
This commit is contained in:
parent
d6dae27803
commit
53fbfc9fdb
|
@ -308,7 +308,7 @@ private:
|
|||
ASSERT_EQUALS(1714631779, MathLib::toLongNumber("'\\U0001f34c'"));
|
||||
{
|
||||
// some unit-testing for a utility function
|
||||
ASSERT_EQUALS(0, MathLib::characterLiteralToLongNumber(std::string("")));
|
||||
ASSERT_EQUALS(0, MathLib::characterLiteralToLongNumber(std::string()));
|
||||
ASSERT_EQUALS(32, MathLib::characterLiteralToLongNumber(std::string(" ")));
|
||||
ASSERT_EQUALS(538976288, MathLib::characterLiteralToLongNumber(std::string(" ")));
|
||||
ASSERT_THROW(MathLib::characterLiteralToLongNumber(std::string("\\u")), InternalError);
|
||||
|
@ -700,7 +700,7 @@ private:
|
|||
value = "garbage";
|
||||
ASSERT_EQUALS(false, MathLib::isValidIntegerSuffix(value.begin(), value.end()));
|
||||
|
||||
value = "";
|
||||
value.clear();
|
||||
ASSERT_EQUALS(false, MathLib::isValidIntegerSuffix(value.begin(), value.end()));
|
||||
|
||||
value = "llu ";
|
||||
|
|
|
@ -2596,7 +2596,7 @@ private:
|
|||
" if ((ret = alloc(&p)) != 0) return;\n"
|
||||
" free(p);\n"
|
||||
"}");
|
||||
ASSERT_EQUALS(std::string(""), errout.str());
|
||||
ASSERT_EQUALS(std::string(), errout.str());
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1361,7 +1361,7 @@ private:
|
|||
" if (pDocSh && !getCellRangesForAddress(nFlags)) ;\n"
|
||||
"}");
|
||||
|
||||
ASSERT(db && errout.str() == "");
|
||||
ASSERT(db && errout.str().empty());
|
||||
|
||||
if (db) {
|
||||
const Scope *scope = db->findScopeByName("getFormula1");
|
||||
|
@ -1377,7 +1377,7 @@ private:
|
|||
" if (pDocSh && !getCellRangesForAddress(nFlags)) ;\n"
|
||||
"}");
|
||||
|
||||
ASSERT(db && errout.str() == "");
|
||||
ASSERT(db && errout.str().empty());
|
||||
|
||||
if (db) {
|
||||
const Scope *scope = db->findScopeByName("getFormula1");
|
||||
|
@ -1397,7 +1397,7 @@ private:
|
|||
" if (pDocSh && !getCellRangesForAddress(nFlags)) ;\n"
|
||||
"}");
|
||||
|
||||
ASSERT(db && errout.str() == "");
|
||||
ASSERT(db && errout.str().empty());
|
||||
|
||||
if (db) {
|
||||
const Scope *scope = db->findScopeByName("getFormula1");
|
||||
|
@ -1414,7 +1414,7 @@ private:
|
|||
"extern void f5() { };\n"
|
||||
"void f6() { }");
|
||||
|
||||
ASSERT(db && errout.str() == "");
|
||||
ASSERT(db && errout.str().empty());
|
||||
|
||||
if (db) {
|
||||
const Token *f = Token::findsimplematch(tokenizer.tokens(), "f1");
|
||||
|
|
Loading…
Reference in New Issue