Skip to content

Commit

Permalink
modify to_tchar test
Browse files Browse the repository at this point in the history
  • Loading branch information
mutouyun committed Aug 15, 2021
1 parent e8cf471 commit df3cf1b
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions test/test_platform.cpp
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
#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"

#include "libipc/platform/to_tchar.h"

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);
Expand All @@ -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));
}
}

Expand Down

0 comments on commit df3cf1b

Please sign in to comment.