[ADVAPI32_APITEST] IsTextUnicode: Use __LINE__ to identify test entry

CORE-18837
This commit is contained in:
Katayama Hirofumi MZ 2023-05-11 12:27:18 +09:00
parent 059d12a5ac
commit df531336b1

View file

@ -58,10 +58,12 @@ START_TEST(IsTextUnicode)
#define INVALID_FLAG 0xFFFFFFFF
#define NEW_TEST(Buffer, Flags, ResultFlags, Success) \
{ (PVOID)(Buffer), sizeof((Buffer)), (Flags), (ResultFlags), (Success) }
{ __LINE__, (PVOID)(Buffer), sizeof((Buffer)), (Flags), (ResultFlags), (Success) }
static struct
{
INT lineno;
/* Input */
PVOID Buffer;
INT Size;
@ -73,57 +75,46 @@ START_TEST(IsTextUnicode)
} Tests[] =
{
/* ANSI string */
// 0
NEW_TEST("ANSI string", IS_TEXT_UNICODE_ASCII16, 0, FALSE),
NEW_TEST("ANSI string", IS_TEXT_UNICODE_STATISTICS, 0, FALSE),
NEW_TEST("ANSI string", INVALID_FLAG, 0, FALSE),
/* UNICODE strings */
// 3
NEW_TEST(L"a", IS_TEXT_UNICODE_ASCII16, IS_TEXT_UNICODE_ASCII16, TRUE),
NEW_TEST(L"a", IS_TEXT_UNICODE_UNICODE_MASK, IS_TEXT_UNICODE_STATISTICS | IS_TEXT_UNICODE_ASCII16, TRUE),
NEW_TEST(L"a", IS_TEXT_UNICODE_STATISTICS, IS_TEXT_UNICODE_STATISTICS, TRUE),
NEW_TEST(L"a", INVALID_FLAG, 0, TRUE),
// 7
NEW_TEST(L"UNICODE String 0", IS_TEXT_UNICODE_ASCII16, 0, FALSE),
NEW_TEST(L"UNICODE String 0", IS_TEXT_UNICODE_UNICODE_MASK, IS_TEXT_UNICODE_CONTROLS | IS_TEXT_UNICODE_STATISTICS, TRUE),
NEW_TEST(L"UNICODE String 0", IS_TEXT_UNICODE_STATISTICS, IS_TEXT_UNICODE_STATISTICS, TRUE),
NEW_TEST(L"UNICODE String 0", INVALID_FLAG, 0, TRUE),
// 11
NEW_TEST(L"\xFEFF" L"UNICODE String 1", IS_TEXT_UNICODE_ASCII16, 0, FALSE),
NEW_TEST(L"\xFEFF" L"UNICODE String 1", IS_TEXT_UNICODE_UNICODE_MASK, IS_TEXT_UNICODE_SIGNATURE | IS_TEXT_UNICODE_CONTROLS, TRUE),
NEW_TEST(L"\xFEFF" L"UNICODE String 1", IS_TEXT_UNICODE_STATISTICS, 0, FALSE),
NEW_TEST(L"\xFEFF" L"UNICODE String 1", INVALID_FLAG, 0, TRUE),
// 15
NEW_TEST(L"\xFFFE" L"UNICODE String 2", IS_TEXT_UNICODE_ASCII16, 0, FALSE),
NEW_TEST(L"\xFFFE" L"UNICODE String 2", IS_TEXT_UNICODE_UNICODE_MASK, IS_TEXT_UNICODE_CONTROLS, TRUE),
NEW_TEST(L"\xFFFE" L"UNICODE String 2", IS_TEXT_UNICODE_STATISTICS, 0, FALSE),
NEW_TEST(L"\xFFFE" L"UNICODE String 2", INVALID_FLAG, 0, FALSE),
// 19
NEW_TEST(L"UNICODE String 3 Привет!", IS_TEXT_UNICODE_ASCII16, 0, FALSE),
NEW_TEST(L"UNICODE String 3 Привет!", IS_TEXT_UNICODE_UNICODE_MASK, IS_TEXT_UNICODE_CONTROLS | IS_TEXT_UNICODE_STATISTICS, TRUE),
NEW_TEST(L"UNICODE String 3 Привет!", IS_TEXT_UNICODE_STATISTICS, IS_TEXT_UNICODE_STATISTICS, TRUE),
NEW_TEST(L"UNICODE String 3 Привет!", INVALID_FLAG, 0, TRUE),
// 23
NEW_TEST(L"\xFEFF" L"UNICODE String 4 Привет!", IS_TEXT_UNICODE_ASCII16, 0, FALSE),
NEW_TEST(L"\xFEFF" L"UNICODE String 4 Привет!", IS_TEXT_UNICODE_UNICODE_MASK, IS_TEXT_UNICODE_SIGNATURE | IS_TEXT_UNICODE_CONTROLS, TRUE),
NEW_TEST(L"\xFEFF" L"UNICODE String 4 Привет!", IS_TEXT_UNICODE_STATISTICS, 0, FALSE),
NEW_TEST(L"\xFEFF" L"UNICODE String 4 Привет!", INVALID_FLAG, 0, TRUE),
// 27
NEW_TEST(L"\xFFFE" L"UNICODE String 5 Привет!", IS_TEXT_UNICODE_ASCII16, 0, FALSE),
NEW_TEST(L"\xFFFE" L"UNICODE String 5 Привет!", IS_TEXT_UNICODE_UNICODE_MASK, IS_TEXT_UNICODE_CONTROLS, TRUE),
NEW_TEST(L"\xFFFE" L"UNICODE String 5 Привет!", IS_TEXT_UNICODE_STATISTICS, 0, FALSE),
NEW_TEST(L"\xFFFE" L"UNICODE String 5 Привет!", INVALID_FLAG, 0, FALSE),
// 31
/* Reverse BOM */
NEW_TEST(L"UNICODE S" L"\xFFFE" L"tring 5 Привет!", IS_TEXT_UNICODE_ILLEGAL_CHARS, IS_TEXT_UNICODE_ILLEGAL_CHARS, FALSE),
/* UNICODE_NUL */
@ -133,7 +124,6 @@ START_TEST(IsTextUnicode)
/* Unicode 0xFFFF */
NEW_TEST(L"UNICODE S" L"\xFFFF" L"tring 5 Привет!", IS_TEXT_UNICODE_ILLEGAL_CHARS, IS_TEXT_UNICODE_ILLEGAL_CHARS, FALSE),
// 35
NEW_TEST(L"UNICODE String 0", IS_TEXT_UNICODE_DBCS_LEADBYTE, 0, FALSE)
};
@ -150,9 +140,9 @@ START_TEST(IsTextUnicode)
{
Result = Tests[i].Flags;
Success = IsTextUnicode(Tests[i].Buffer, Tests[i].Size, ((Result != INVALID_FLAG) ? &Result : NULL));
ok(Success == Tests[i].Success, "IsTextUnicode(%u) returned 0x%x, expected %s\n", i, Success, (Tests[i].Success ? "TRUE" : "FALSE"));
ok(Success == Tests[i].Success, "Line %u: IsTextUnicode() returned 0x%x, expected %s\n", Tests[i].lineno, Success, (Tests[i].Success ? "TRUE" : "FALSE"));
if (Result != INVALID_FLAG)
ok(Result == Tests[i].ResultFlags, "IsTextUnicode(%u) Result returned 0x%x, expected 0x%x\n", i, Result, Tests[i].ResultFlags);
ok(Result == Tests[i].ResultFlags, "Line %u: IsTextUnicode() Result returned 0x%x, expected 0x%x\n", Tests[i].lineno, Result, Tests[i].ResultFlags);
}
/* Japanese */