mirror of
https://github.com/libretro/devilutionX.git
synced 2026-11-10 17:20:56 -10:00
codecvt is deprecated in C++17 and we don't really need all of its heavy machinery for simply converting to UTF-8.
39 lines
604 B
C++
39 lines
604 B
C++
|
|
#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
|