couple new features for string wrapper
This commit is contained in:
@@ -86,4 +86,47 @@ TEST_CASE("String")
|
||||
REQUIRE(str2 == "World");
|
||||
REQUIRE(str2 != "Hello");
|
||||
}
|
||||
|
||||
SECTION("Trim")
|
||||
{
|
||||
String str1(" Hello World ");
|
||||
REQUIRE(str1.Trim() == "Hello World");
|
||||
}
|
||||
|
||||
SECTION("FindIndex")
|
||||
{
|
||||
String str1("Georg will save us all from our doom");
|
||||
REQUIRE(str1.FindStartIndexOf("save") == 11);
|
||||
}
|
||||
|
||||
SECTION("Upper/Lower")
|
||||
{
|
||||
String str1("Hello World");
|
||||
str1.ToUpper();
|
||||
REQUIRE(str1 == "HELLO WORLD");
|
||||
|
||||
String str2("Hello World");
|
||||
str2.ToLower();
|
||||
REQUIRE(str2 == "hello world");
|
||||
|
||||
String str3("Georg will save us all from our doom");
|
||||
str3.ToUpperStarters();
|
||||
REQUIRE(str3 == "Georg Will Save Us All From Our Doom");
|
||||
}
|
||||
|
||||
SECTION("Substring")
|
||||
{
|
||||
String str1("Hello World");
|
||||
REQUIRE(str1.Substring(0, 5) == "Hello");
|
||||
REQUIRE(str1.Substring(6, 11) == "World");
|
||||
}
|
||||
|
||||
SECTION("FromString")
|
||||
{
|
||||
String str1("42");
|
||||
REQUIRE(str1.FromString<int>() == 42);
|
||||
|
||||
String str2("42.42");
|
||||
REQUIRE(str2.FromString<float>() == 42.42f);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user