Added a utf16 > utf-8 test case for win32 performance test
git-svn-id: http://svn.code.sf.net/p/utfcpp/code@51 a809a056-fc17-0410-9590-b4f493f8b08e
This commit is contained in:
parent
856d0d2b3d
commit
4e848f2c69
1 changed files with 27 additions and 1 deletions
|
@ -58,7 +58,7 @@ int main(int argc, char** argv)
|
|||
wchar_t* utf16iconvbuf = new wchar_t[wlength];
|
||||
{
|
||||
memset (utf16iconvbuf, 0 , wlength * sizeof(wchar_t));
|
||||
// iconv
|
||||
// win32
|
||||
cout << "win32: ";
|
||||
|
||||
{
|
||||
|
@ -72,7 +72,33 @@ int main(int argc, char** argv)
|
|||
if (!equal(utf16buf, utf16buf + wlength, utf16iconvbuf))
|
||||
cout << "Different result!!!";
|
||||
|
||||
// the other way around
|
||||
cout << "UTF16 to UTF-8\n";
|
||||
{
|
||||
//win32
|
||||
memset(buf, 0, length);
|
||||
cout<< "win32: ";
|
||||
|
||||
{
|
||||
timer t(cout);
|
||||
WideCharToMultiByte(CP_UTF8, 0, utf16buf, wlength, buf, length, NULL, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
memset (buf, 0 , length);
|
||||
// utf-8 cpp:
|
||||
cout << "unchecked::utf16to8: ";
|
||||
timer t(cout);
|
||||
utf8::unchecked::utf16to8(utf16buf, utf16buf + wlength, buf);
|
||||
}
|
||||
|
||||
{
|
||||
memset (buf, 0 , length);
|
||||
cout << "utf16to8: ";
|
||||
timer t(cout);
|
||||
utf8::utf16to8(utf16buf, utf16buf + wlength, buf);
|
||||
}
|
||||
|
||||
delete [] buf;
|
||||
delete [] utf16buf;
|
||||
|
|
Loading…
Reference in a new issue