mirror of
https://github.com/reactos/reactos.git
synced 2025-04-30 02:58:48 +00:00
[NTDLL_APITEST] Add tests for RtlxUnicodeStringToAnsiSize & RtlxUnicodeStringToOemSize
CORE-17571
This commit is contained in:
parent
50e0b006e7
commit
0a8b51da80
4 changed files with 73 additions and 0 deletions
|
@ -8,6 +8,7 @@ spec2def(ntdll_apitest.exe ntdll_apitest.spec)
|
||||||
list(APPEND SOURCE
|
list(APPEND SOURCE
|
||||||
LdrEnumResources.c
|
LdrEnumResources.c
|
||||||
load_notifications.c
|
load_notifications.c
|
||||||
|
locale.c
|
||||||
NtAcceptConnectPort.c
|
NtAcceptConnectPort.c
|
||||||
NtAllocateVirtualMemory.c
|
NtAllocateVirtualMemory.c
|
||||||
NtApphelpCacheControl.c
|
NtApphelpCacheControl.c
|
||||||
|
@ -81,6 +82,8 @@ list(APPEND SOURCE
|
||||||
RtlUnicodeStringToAnsiString.c
|
RtlUnicodeStringToAnsiString.c
|
||||||
RtlUpcaseUnicodeStringToCountedOemString.c
|
RtlUpcaseUnicodeStringToCountedOemString.c
|
||||||
RtlValidateUnicodeString.c
|
RtlValidateUnicodeString.c
|
||||||
|
RtlxUnicodeStringToAnsiSize.c
|
||||||
|
RtlxUnicodeStringToOemSize.c
|
||||||
StackOverflow.c
|
StackOverflow.c
|
||||||
SystemInfo.c
|
SystemInfo.c
|
||||||
Timer.c)
|
Timer.c)
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
/*
|
||||||
|
* PROJECT: ReactOS API tests
|
||||||
|
* LICENSE: 0BSD (https://spdx.org/licenses/0BSD.html)
|
||||||
|
* PURPOSE: Test for RtlxUnicodeStringToAnsiSize
|
||||||
|
* COPYRIGHT: Copyright 2021 Jérôme Gardou <jerome.gardou@reactos.org>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "precomp.h"
|
||||||
|
|
||||||
|
static const struct
|
||||||
|
{
|
||||||
|
ULONG AnsiCp;
|
||||||
|
ULONG OemCp;
|
||||||
|
PCWSTR Str;
|
||||||
|
ULONG OemLength;
|
||||||
|
} TestData[] =
|
||||||
|
{
|
||||||
|
{ 1252, 932, L"\u30c7\u30b9\u30af\u30c8\u30c3\u30d7", 7 }, /* "Desktop" in Japanese */
|
||||||
|
{ 932, 1252, L"\u30c7\u30b9\u30af\u30c8\u30c3\u30d7", 13 }, /* "Desktop" in Japanese */
|
||||||
|
};
|
||||||
|
|
||||||
|
START_TEST(RtlxUnicodeStringToAnsiSize)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < _countof(TestData); i++)
|
||||||
|
{
|
||||||
|
SetupLocale(TestData[i].AnsiCp, TestData[i].OemCp, -1);
|
||||||
|
UNICODE_STRING Ustr;
|
||||||
|
RtlInitUnicodeString(&Ustr, TestData[i].Str);
|
||||||
|
ULONG Length = RtlxUnicodeStringToAnsiSize(&Ustr);
|
||||||
|
ok(Length == TestData[i].OemLength, "Wrong OEM length for test %u, expected %u, got %u\n",
|
||||||
|
i, (UINT)TestData[i].OemLength, (UINT)Length);
|
||||||
|
}
|
||||||
|
}
|
33
modules/rostests/apitests/ntdll/RtlxUnicodeStringToOemSize.c
Normal file
33
modules/rostests/apitests/ntdll/RtlxUnicodeStringToOemSize.c
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
/*
|
||||||
|
* PROJECT: ReactOS API tests
|
||||||
|
* LICENSE: 0BSD (https://spdx.org/licenses/0BSD.html)
|
||||||
|
* PURPOSE: Test for RtlxUnicodeStringToOemSize
|
||||||
|
* COPYRIGHT: Copyright 2021 Jérôme Gardou <jerome.gardou@reactos.org>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "precomp.h"
|
||||||
|
|
||||||
|
static const struct
|
||||||
|
{
|
||||||
|
ULONG AnsiCp;
|
||||||
|
ULONG OemCp;
|
||||||
|
PCWSTR Str;
|
||||||
|
ULONG OemLength;
|
||||||
|
} TestData[] =
|
||||||
|
{
|
||||||
|
{ 1252, 932, L"\u30c7\u30b9\u30af\u30c8\u30c3\u30d7", 7 }, /* "Desktop" in Japanese */
|
||||||
|
{ 932, 1252, L"\u30c7\u30b9\u30af\u30c8\u30c3\u30d7", 13 }, /* "Desktop" in Japanese */
|
||||||
|
};
|
||||||
|
|
||||||
|
START_TEST(RtlxUnicodeStringToOemSize)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < _countof(TestData); i++)
|
||||||
|
{
|
||||||
|
SetupLocale(TestData[i].AnsiCp, TestData[i].OemCp, -1);
|
||||||
|
UNICODE_STRING Ustr;
|
||||||
|
RtlInitUnicodeString(&Ustr, TestData[i].Str);
|
||||||
|
ULONG Length = RtlxUnicodeStringToOemSize(&Ustr);
|
||||||
|
ok(Length == TestData[i].OemLength, "Wrong OEM length for test %u, expected %u, got %u\n",
|
||||||
|
i, (UINT)TestData[i].OemLength, (UINT)Length);
|
||||||
|
}
|
||||||
|
}
|
|
@ -78,6 +78,8 @@ extern void func_RtlReAllocateHeap(void);
|
||||||
extern void func_RtlUnicodeStringToAnsiString(void);
|
extern void func_RtlUnicodeStringToAnsiString(void);
|
||||||
extern void func_RtlUpcaseUnicodeStringToCountedOemString(void);
|
extern void func_RtlUpcaseUnicodeStringToCountedOemString(void);
|
||||||
extern void func_RtlValidateUnicodeString(void);
|
extern void func_RtlValidateUnicodeString(void);
|
||||||
|
extern void func_RtlxUnicodeStringToAnsiSize(void);
|
||||||
|
extern void func_RtlxUnicodeStringToOemSize(void);
|
||||||
extern void func_StackOverflow(void);
|
extern void func_StackOverflow(void);
|
||||||
extern void func_TimerResolution(void);
|
extern void func_TimerResolution(void);
|
||||||
|
|
||||||
|
@ -155,7 +157,9 @@ const struct test winetest_testlist[] =
|
||||||
{ "RtlpEnsureBufferSize", func_RtlpEnsureBufferSize },
|
{ "RtlpEnsureBufferSize", func_RtlpEnsureBufferSize },
|
||||||
{ "RtlQueryTimeZoneInformation", func_RtlQueryTimeZoneInformation },
|
{ "RtlQueryTimeZoneInformation", func_RtlQueryTimeZoneInformation },
|
||||||
{ "RtlReAllocateHeap", func_RtlReAllocateHeap },
|
{ "RtlReAllocateHeap", func_RtlReAllocateHeap },
|
||||||
|
{ "RtlUnicodeStringToAnsiSize", func_RtlxUnicodeStringToAnsiSize }, /* For some reason, starting test name with Rtlx hides it */
|
||||||
{ "RtlUnicodeStringToAnsiString", func_RtlUnicodeStringToAnsiString },
|
{ "RtlUnicodeStringToAnsiString", func_RtlUnicodeStringToAnsiString },
|
||||||
|
{ "RtlUnicodeStringToOemSize", func_RtlxUnicodeStringToOemSize },
|
||||||
{ "RtlUpcaseUnicodeStringToCountedOemString", func_RtlUpcaseUnicodeStringToCountedOemString },
|
{ "RtlUpcaseUnicodeStringToCountedOemString", func_RtlUpcaseUnicodeStringToCountedOemString },
|
||||||
{ "RtlValidateUnicodeString", func_RtlValidateUnicodeString },
|
{ "RtlValidateUnicodeString", func_RtlValidateUnicodeString },
|
||||||
{ "StackOverflow", func_StackOverflow },
|
{ "StackOverflow", func_StackOverflow },
|
||||||
|
|
Loading…
Reference in a new issue