https://git.reactos.org/?p=reactos.git;a=commitdiff;h=89af984b167aa9ed31b9a…
commit 89af984b167aa9ed31b9a90abcd9c57920ba59e7
Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
AuthorDate: Sat Apr 6 17:48:15 2019 +0900
Commit: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
CommitDate: Sat Apr 6 17:48:15 2019 +0900
[KERNEL32_APITEST] 5-byte, 6-byte, ... UTF-8 sequences
---
.../apitests/kernel32/MultiByteToWideChar.c | 34 ++++++++++++++++++++++
1 file changed, 34 insertions(+)
diff --git a/modules/rostests/apitests/kernel32/MultiByteToWideChar.c
b/modules/rostests/apitests/kernel32/MultiByteToWideChar.c
index a3f6e8ff46..80d77a7fe1 100644
--- a/modules/rostests/apitests/kernel32/MultiByteToWideChar.c
+++ b/modules/rostests/apitests/kernel32/MultiByteToWideChar.c
@@ -111,6 +111,40 @@ static const ENTRY Entries[] =
/* Japanese CP932 truncated source */
{ __LINE__, 1, 0xBEAF, CP932, 0, SJIS_Japanese, 1, 4, {0x30FB, 0x7F7F}, 2 },
{ __LINE__, 0, ERROR_NO_UNICODE_TRANSLATION, CP932, MB_ERR_INVALID_CHARS,
SJIS_Japanese, 1, 4, {0x7F7F, 0x7F7F}, 2 },
+ /* invalid 5-byte UTF-8 sequences */
+ { __LINE__, 1, 48815, CP_UTF8, 0, "\xF8\xA3\xA3\xA3\xA3", 1, 4, {0xFFFD,
0x7F7F}, 2 },
+ { __LINE__, 2, 48815, CP_UTF8, 0, "\xF8\xA3\xA3\xA3\xA3", 2, 4, {0xFFFD,
0xFFFD, 0x7F7F}, 3 },
+ { __LINE__, 3, 48815, CP_UTF8, 0, "\xF8\xA3\xA3\xA3\xA3", 3, 4, {0xFFFD,
0xFFFD, 0xFFFD, 0x7F7F}, 4 },
+ { __LINE__, 4, 48815, CP_UTF8, 0, "\xF8\xA3\xA3\xA3\xA3", 4, 4, {0xFFFD,
0xFFFD, 0xFFFD, 0xFFFD, 0x7F7F}, 5 },
+ { __LINE__, 5, 48815, CP_UTF8, 0, "\xF8\xA3\xA3\xA3\xA3", 5, 5, {0xFFFD,
0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0x7F7F}, 6 },
+ { __LINE__, 0, ERROR_INSUFFICIENT_BUFFER, CP_UTF8, 0,
"\xF8\xA3\xA3\xA3\xA3", 6, 5, {0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0x7F7F},
6 },
+ /* invalid 6-byte UTF-8 sequences */
+ { __LINE__, 1, 48815, CP_UTF8, 0, "\xFC\xA3\xA3\xA3\xA3\xA3", 1, 4,
{0xFFFD, 0x7F7F}, 2 },
+ { __LINE__, 2, 48815, CP_UTF8, 0, "\xFC\xA3\xA3\xA3\xA3\xA3", 2, 4,
{0xFFFD, 0xFFFD, 0x7F7F}, 3 },
+ { __LINE__, 3, 48815, CP_UTF8, 0, "\xFC\xA3\xA3\xA3\xA3\xA3", 3, 4,
{0xFFFD, 0xFFFD, 0xFFFD, 0x7F7F}, 4 },
+ { __LINE__, 4, 48815, CP_UTF8, 0, "\xFC\xA3\xA3\xA3\xA3\xA3", 4, 4,
{0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0x7F7F}, 5 },
+ { __LINE__, 5, 48815, CP_UTF8, 0, "\xFC\xA3\xA3\xA3\xA3\xA3", 5, 5,
{0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0x7F7F}, 6 },
+ { __LINE__, 0, ERROR_INSUFFICIENT_BUFFER, CP_UTF8, 0,
"\xFC\xA3\xA3\xA3\xA3\xA3", 6, 5, {0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD,
0x7F7F}, 6 },
+ { __LINE__, 0, ERROR_INSUFFICIENT_BUFFER, CP_UTF8, 0,
"\xFC\xA3\xA3\xA3\xA3\xA3", 7, 5, {0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD,
0x7F7F}, 6 },
+ /* invalid 7-byte UTF-8 sequences */
+ { __LINE__, 1, 48815, CP_UTF8, 0, "\xFE\xA3\xA3\xA3\xA3\xA3\xA3", 1, 4,
{0xFFFD, 0x7F7F}, 2 },
+ { __LINE__, 2, 48815, CP_UTF8, 0, "\xFE\xA3\xA3\xA3\xA3\xA3\xA3", 2, 4,
{0xFFFD, 0xFFFD, 0x7F7F}, 3 },
+ { __LINE__, 3, 48815, CP_UTF8, 0, "\xFE\xA3\xA3\xA3\xA3\xA3\xA3", 3, 4,
{0xFFFD, 0xFFFD, 0xFFFD, 0x7F7F}, 4 },
+ { __LINE__, 4, 48815, CP_UTF8, 0, "\xFE\xA3\xA3\xA3\xA3\xA3\xA3", 4, 4,
{0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0x7F7F}, 5 },
+ { __LINE__, 5, 48815, CP_UTF8, 0, "\xFE\xA3\xA3\xA3\xA3\xA3\xA3", 5, 5,
{0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0x7F7F}, 6 },
+ { __LINE__, 0, ERROR_INSUFFICIENT_BUFFER, CP_UTF8, 0,
"\xFE\xA3\xA3\xA3\xA3\xA3\xA3", 6, 5, {0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD,
0x7F7F}, 6 },
+ { __LINE__, 0, ERROR_INSUFFICIENT_BUFFER, CP_UTF8, 0,
"\xFE\xA3\xA3\xA3\xA3\xA3\xA3", 7, 5, {0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD,
0x7F7F}, 6 },
+ { __LINE__, 0, ERROR_INSUFFICIENT_BUFFER, CP_UTF8, 0,
"\xFE\xA3\xA3\xA3\xA3\xA3\xA3", 8, 5, {0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD,
0x7F7F}, 6 },
+ /* invalid UTF-8 sequences */
+ { __LINE__, 1, 48815, CP_UTF8, 0, "\xFF\xA3\xA3\xA3\xA3\xA3\xA3", 1, 4,
{0xFFFD, 0x7F7F}, 2 },
+ { __LINE__, 2, 48815, CP_UTF8, 0, "\xFF\xA3\xA3\xA3\xA3\xA3\xA3", 2, 4,
{0xFFFD, 0xFFFD, 0x7F7F}, 3 },
+ { __LINE__, 3, 48815, CP_UTF8, 0, "\xFF\xA3\xA3\xA3\xA3\xA3\xA3", 3, 4,
{0xFFFD, 0xFFFD, 0xFFFD, 0x7F7F}, 4 },
+ { __LINE__, 4, 48815, CP_UTF8, 0, "\xFF\xA3\xA3\xA3\xA3\xA3\xA3", 4, 4,
{0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0x7F7F}, 5 },
+ { __LINE__, 5, 48815, CP_UTF8, 0, "\xFF\xA3\xA3\xA3\xA3\xA3\xA3", 5, 5,
{0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0x7F7F}, 6 },
+ { __LINE__, 0, ERROR_INSUFFICIENT_BUFFER, CP_UTF8, 0,
"\xFF\xA3\xA3\xA3\xA3\xA3\xA3", 6, 5, {0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD,
0x7F7F}, 6 },
+ { __LINE__, 0, ERROR_INSUFFICIENT_BUFFER, CP_UTF8, 0,
"\xFF\xA3\xA3\xA3\xA3\xA3\xA3", 7, 5, {0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD,
0x7F7F}, 6 },
+ { __LINE__, 0, ERROR_INSUFFICIENT_BUFFER, CP_UTF8, 0,
"\xFF\xA3\xA3\xA3\xA3\xA3\xA3", 8, 5, {0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD,
0x7F7F}, 6 },
+ { __LINE__, 0, ERROR_INSUFFICIENT_BUFFER, CP_UTF8, 0,
"\xFF\xA3\xA3\xA3\xA3\xA3\xA3", 9, 5, {0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD,
0x7F7F}, 6 },
};
static void TestEntry(const ENTRY *pEntry)