|
|
|
@ -3,7 +3,7 @@
|
|
|
|
|
|
|
|
|
|
using namespace std::literals;
|
|
|
|
|
|
|
|
|
|
TEST_CASE("TrimWhiteSpace -- positive tests", "[str][trim]")
|
|
|
|
|
TEST_CASE("TrimWhitespace -- positive tests", "[str][trim]")
|
|
|
|
|
{
|
|
|
|
|
// Test that things that should be trimmed actually get trimmed
|
|
|
|
|
auto fee = " J a c k"s;
|
|
|
|
@ -11,7 +11,7 @@ TEST_CASE("TrimWhiteSpace -- positive tests", "[str][trim]")
|
|
|
|
|
auto fo = "\fthe "s;
|
|
|
|
|
auto fum = " \t\r\n\v\f Beanstalk\n\n\n\t\r\f\v \n\n\r\f\f\f\f\v"s;
|
|
|
|
|
for (auto* s: {&fee, &fi, &fo, &fum})
|
|
|
|
|
*s = llarp::TrimWhiteSpace(*s);
|
|
|
|
|
*s = llarp::TrimWhitespace(*s);
|
|
|
|
|
|
|
|
|
|
REQUIRE( fee == "J a c k" );
|
|
|
|
|
REQUIRE( fi == "a\nd" );
|
|
|
|
@ -24,7 +24,7 @@ TEST_CASE("TrimWhitespace -- negative tests", "[str][trim]")
|
|
|
|
|
// Test that things that shouldn't be trimmed don't get trimmed
|
|
|
|
|
auto c = GENERATE(range(std::numeric_limits<char>::min(), std::numeric_limits<char>::max()));
|
|
|
|
|
std::string plant = c + "bean"s + c;
|
|
|
|
|
plant = llarp::TrimWhiteSpace(plant);
|
|
|
|
|
plant = llarp::TrimWhitespace(plant);
|
|
|
|
|
if (c == ' ' || c == '\t' || c == '\r' || c == '\n' || c == '\f' || c == '\v')
|
|
|
|
|
REQUIRE( plant == "bean" );
|
|
|
|
|
else
|
|
|
|
|