modify to_tchar test

This commit is contained in:
mutouyun 2021-08-15 15:10:29 +08:00
parent e8cf471615
commit df3cf1b4c4

View File

@ -1,9 +1,10 @@
#if defined(WIN64) || defined(_WIN64) || defined(__WIN64__) || \
#if defined(WIN64) || defined(_WIN64) || defined(__WIN64__) || \
defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__) || \
defined(WINCE) || defined(_WIN32_WCE)
#include <locale>
#include <iostream>
//#include <fstream>
#include "test.h"
@ -11,9 +12,9 @@
TEST(Platform, to_tchar) {
char const *utf8 = "hello world, "
"\xe6\xb5\xa3\xe7\x8a\xb2\xe3\x82\xbd\xe9\x94\x9b\xe5\xb1\xbb\xe4"
"\xba\xbe\xe9\x8a\x88\xe6\x92\xb1\xe4\xbc\x80\xe9\x8a\x87\xc2\xb0"
"\xe4\xbc\x85";
"\xe4\xbd\xa0\xe5\xa5\xbd\xef\xbc"
"\x8c\xe3\x81\x93\xe3\x82\x93\xe3"
"\x81\xab\xe3\x81\xa1\xe3\x81\xaf";
wchar_t const *utf16 = L"hello world, \u4f60\u597d\uff0c\u3053\u3093\u306b\u3061\u306f";
{
ipc::string str = ipc::detail::to_tchar<char>(utf8);
@ -22,6 +23,8 @@ TEST(Platform, to_tchar) {
{
ipc::wstring wtr = ipc::detail::to_tchar<wchar_t>(utf8);
EXPECT_STREQ(wtr.c_str(), utf16);
//std::ofstream out("out.txt", std::ios::binary|std::ios::out);
//out.write((char const *)wtr.c_str(), wtr.size() * sizeof(wchar_t));
}
}