mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-19 14:38:18 +00:00
Add test cases
This commit is contained in:
parent
6b053936c7
commit
e48596dc6c
|
@ -208,3 +208,29 @@ TEST(Str, StrCopyNum)
|
|||
str_utf8_truncate(aBuf3, sizeof(aBuf3), foo, 7);
|
||||
EXPECT_STREQ(aBuf3, "Foobaré");
|
||||
}
|
||||
|
||||
TEST(Str, StrCopyUtf8)
|
||||
{
|
||||
const char *foo = "DDNet最好了";
|
||||
char aBuf[64];
|
||||
str_utf8_copy(aBuf, foo, 7);
|
||||
EXPECT_STREQ(aBuf, "DDNet");
|
||||
str_utf8_copy(aBuf, foo, 8);
|
||||
EXPECT_STREQ(aBuf, "DDNet");
|
||||
str_utf8_copy(aBuf, foo, 9);
|
||||
EXPECT_STREQ(aBuf, "DDNet");
|
||||
str_utf8_copy(aBuf, foo, 10);
|
||||
EXPECT_STREQ(aBuf, "DDNet最");
|
||||
str_utf8_copy(aBuf, foo, 11);
|
||||
EXPECT_STREQ(aBuf, "DDNet最");
|
||||
str_utf8_copy(aBuf, foo, 12);
|
||||
EXPECT_STREQ(aBuf, "DDNet最");
|
||||
str_utf8_copy(aBuf, foo, 13);
|
||||
EXPECT_STREQ(aBuf, "DDNet最好");
|
||||
str_utf8_copy(aBuf, foo, 14);
|
||||
EXPECT_STREQ(aBuf, "DDNet最好");
|
||||
str_utf8_copy(aBuf, foo, 15);
|
||||
EXPECT_STREQ(aBuf, "DDNet最好");
|
||||
str_utf8_copy(aBuf, foo, 16);
|
||||
EXPECT_STREQ(aBuf, "DDNet最好了");
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue