Files
devilutionX/test/utf8_test.cpp
T
Gleb Mazovetskiy f22d1d0149 Remove uses of deprecated codecvt
codecvt is deprecated in C++17 and we don't really need all of its heavy
machinery for simply converting to UTF-8.
2022-06-16 13:54:29 +01:00

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