mirror of
https://github.com/debauchee/barrier.git
synced 2025-08-06 10:09:28 +02:00
Added unit tests for string operations
This commit is contained in:
parent
28eb85660f
commit
dd574c4f2c
1 changed files with 29 additions and 0 deletions
|
@ -53,3 +53,32 @@ TEST(StringTests, sprintf)
|
||||||
|
|
||||||
EXPECT_EQ("answer=42", result);
|
EXPECT_EQ("answer=42", result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(StringTests, toHex)
|
||||||
|
{
|
||||||
|
String subject = "foobar";
|
||||||
|
int width = 2;
|
||||||
|
|
||||||
|
string::toHex(subject, width);
|
||||||
|
|
||||||
|
EXPECT_EQ("666f6f626172", subject);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(StringTests, uppercase)
|
||||||
|
{
|
||||||
|
String subject = "12foo3BaR";
|
||||||
|
|
||||||
|
string::uppercase(subject);
|
||||||
|
|
||||||
|
EXPECT_EQ("12FOO3BAR", subject);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(StringTests, removeChar)
|
||||||
|
{
|
||||||
|
String subject = "foobar";
|
||||||
|
const char c = 'o';
|
||||||
|
|
||||||
|
string::removeChar(subject, c);
|
||||||
|
|
||||||
|
EXPECT_EQ("fbar", subject);
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue