mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-20 10:25:28 +00:00
Add string to wstring conversion helper and related unittest
Bug: dawn:766 Change-Id: I318c630df01fcdb302d36873a783fdf1a39c608c Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/48200 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: 陈俊嘉 <cjj19970505@live.cn>
This commit is contained in:
committed by
Commit Bot service account
parent
9446154d74
commit
672105aa0a
@@ -31,4 +31,21 @@ TEST(WindowsUtilsTests, WCharToUTF8) {
|
||||
|
||||
// Test three-byte utf8 codepoint
|
||||
ASSERT_EQ("\xe1\x81\x90", WCharToUTF8(L"\x1050"));
|
||||
}
|
||||
|
||||
TEST(WindowsUtilsTests, UTF8ToWStr) {
|
||||
// Test the empty string
|
||||
ASSERT_EQ(L"", UTF8ToWStr(""));
|
||||
|
||||
// Test ASCII characters
|
||||
ASSERT_EQ(L"abc", UTF8ToWStr("abc"));
|
||||
|
||||
// Test ASCII characters
|
||||
ASSERT_EQ(L"abc", UTF8ToWStr("abc"));
|
||||
|
||||
// Test two-byte utf8 character
|
||||
ASSERT_EQ(L"\x450", UTF8ToWStr("\xd1\x90"));
|
||||
|
||||
// Test three-byte utf8 codepoint
|
||||
ASSERT_EQ(L"\x1050", UTF8ToWStr("\xe1\x81\x90"));
|
||||
}
|
||||
Reference in New Issue
Block a user