mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-09 15:49:25 +01:00
Merge pull request #5553 from sepalani/strpopback
StringUtil: Add StringPopBackIf UnitTests
This commit is contained in:
commit
f018d69bff
@ -41,6 +41,40 @@ TEST(StringUtil, StringEndsWith)
|
|||||||
EXPECT_TRUE(StringEndsWith("", ""));
|
EXPECT_TRUE(StringEndsWith("", ""));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(StringUtil, StringPopBackIf)
|
||||||
|
{
|
||||||
|
std::string abc = "abc";
|
||||||
|
std::string empty = "";
|
||||||
|
|
||||||
|
StringPopBackIf(&abc, 'a');
|
||||||
|
StringPopBackIf(&empty, 'a');
|
||||||
|
EXPECT_STREQ("abc", abc.c_str());
|
||||||
|
EXPECT_STRNE(empty.c_str(), abc.c_str());
|
||||||
|
|
||||||
|
StringPopBackIf(&abc, 'c');
|
||||||
|
StringPopBackIf(&empty, 'c');
|
||||||
|
EXPECT_STRNE("abc", abc.c_str());
|
||||||
|
EXPECT_STREQ("ab", abc.c_str());
|
||||||
|
EXPECT_STRNE(empty.c_str(), abc.c_str());
|
||||||
|
|
||||||
|
StringPopBackIf(&abc, 'b');
|
||||||
|
StringPopBackIf(&empty, 'b');
|
||||||
|
EXPECT_STRNE("ab", abc.c_str());
|
||||||
|
EXPECT_STREQ("a", abc.c_str());
|
||||||
|
EXPECT_STRNE(empty.c_str(), abc.c_str());
|
||||||
|
|
||||||
|
StringPopBackIf(&abc, 'a');
|
||||||
|
StringPopBackIf(&empty, 'a');
|
||||||
|
EXPECT_STRNE("a", abc.c_str());
|
||||||
|
EXPECT_STREQ("", abc.c_str());
|
||||||
|
EXPECT_STREQ(empty.c_str(), abc.c_str());
|
||||||
|
|
||||||
|
StringPopBackIf(&abc, 'a');
|
||||||
|
StringPopBackIf(&empty, 'a');
|
||||||
|
EXPECT_STREQ("", abc.c_str());
|
||||||
|
EXPECT_STREQ(empty.c_str(), abc.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
TEST(StringUtil, UTF8ToSHIFTJIS)
|
TEST(StringUtil, UTF8ToSHIFTJIS)
|
||||||
{
|
{
|
||||||
const std::string kirby_unicode =
|
const std::string kirby_unicode =
|
||||||
|
Loading…
x
Reference in New Issue
Block a user