You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
604 B
39 lines
604 B
|
4 years ago
|
|
||
|
|
#include <gtest/gtest.h>
|
||
|
|
|
||
|
|
#include "utils/utf8.hpp"
|
||
|
|
|
||
|
|
namespace devilution {
|
||
|
|
namespace {
|
||
|
|
|
||
|
|
TEST(AppendUtf8Test, OneByteCodePoint)
|
||
|
|
{
|
||
|
|
std::string s = "x";
|
||
|
|
AppendUtf8(U'a', s);
|
||
|
|
EXPECT_EQ(s, "xa");
|
||
|
|
}
|
||
|
|
|
||
|
|
TEST(AppendUtf8Test, TwoByteCodePoint)
|
||
|
|
{
|
||
|
|
std::string s = "x";
|
||
|
|
AppendUtf8(U'Á', s);
|
||
|
|
EXPECT_EQ(s, "xÁ");
|
||
|
|
}
|
||
|
|
|
||
|
|
TEST(AppendUtf8Test, ThreeByteCodePoint)
|
||
|
|
{
|
||
|
|
std::string s;
|
||
|
|
AppendUtf8(U'€', s);
|
||
|
|
EXPECT_EQ(s, "€");
|
||
|
|
}
|
||
|
|
|
||
|
|
TEST(AppendUtf8Test, FourByteCodePoint)
|
||
|
|
{
|
||
|
|
std::string s;
|
||
|
|
AppendUtf8(U'あ', s);
|
||
|
|
EXPECT_EQ(s, "あ");
|
||
|
|
}
|
||
|
|
|
||
|
|
} // namespace
|
||
|
|
} // namespace devilution
|