mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-24 04:55:52 +00:00
New strConcat concatenates strings in O(n) time.
* Accepts std::string and char const*. * Also accepts numbers, bools and chars. * New ripple::toString function augments std::to_string to handle bools and chars.
This commit is contained in:
@@ -412,14 +412,41 @@ public:
|
||||
"parseUrl: Mixed://domain/path path failed");
|
||||
}
|
||||
|
||||
void testStringConcat ()
|
||||
{
|
||||
testcase ("stringConcat");
|
||||
auto result = stringConcat({});
|
||||
expect(result == "", result);
|
||||
|
||||
result = stringConcat({"hello, ", std::string("world.")});
|
||||
expect(result == "hello, world.", result);
|
||||
|
||||
result = stringConcat({"hello, ", 23});
|
||||
expect(result == "hello, 23", result);
|
||||
|
||||
result = stringConcat({"hello, ", true});
|
||||
expect(result == "hello, true", result);
|
||||
|
||||
result = stringConcat({"hello, ", 'x'});
|
||||
expect(result == "hello, x", result);
|
||||
}
|
||||
|
||||
void testToString ()
|
||||
{
|
||||
testcase ("toString");
|
||||
auto result = toString("hello");
|
||||
expect(result == "hello", result);
|
||||
}
|
||||
|
||||
void run ()
|
||||
{
|
||||
testParseUrl ();
|
||||
|
||||
testUnHex ();
|
||||
testStringConcat ();
|
||||
testToString ();
|
||||
}
|
||||
};
|
||||
|
||||
BEAST_DEFINE_TESTSUITE(StringUtilities,ripple_basics,ripple);
|
||||
BEAST_DEFINE_TESTSUITE(StringUtilities, ripple_basics, ripple);
|
||||
|
||||
} // ripple
|
||||
|
||||
Reference in New Issue
Block a user