string: add recoding from UTF-16 to UTF-32

I know there are system functions for this (and libiconv), but this is
so trivial and quick in our implementation.
This commit is contained in:
Simon Rozman
2024-09-27 14:11:11 +02:00
parent da11495282
commit 5675f8b139
5 changed files with 70 additions and 1 deletions

View File

@@ -12,6 +12,13 @@ using namespace Microsoft::VisualStudio::CppUnitTestFramework;
namespace UnitTests
{
void string::strncpy()
{
stdex::utf32_t tmp[0x100];
stdex::strncpy(tmp, u"This is a 🐔Test🐮.");
Assert::AreEqual(reinterpret_cast<const stdex::utf32_t*>(U"This is a 🐔Test🐮."), tmp);
}
void string::sprintf()
{
stdex::locale locale(stdex::create_locale(LC_ALL, "en_US.UTF-8"));