1 /*
2 * PROJECT: ReactOS API tests
3 * LICENSE: 0BSD (https://spdx.org/licenses/0BSD)
4 * PURPOSE: Test for RtlxUnicodeStringToOemSize
5 * COPYRIGHT: Copyright 2021 Jérôme Gardou <jerome.gardou@reactos.org>
6 */
7
8 #include "precomp.h"
9
10 static const struct
11 {
12 ULONG AnsiCp;
13 ULONG OemCp;
14 PCWSTR Str;
15 ULONG OemLength;
16 } TestData[] =
17 {
18 { 1252, 932, L"\u30c7\u30b9\u30af\u30c8\u30c3\u30d7", 7 }, /* "Desktop" in Japanese */
19 { 932, 1252, L"\u30c7\u30b9\u30af\u30c8\u30c3\u30d7", 13 }, /* "Desktop" in Japanese */
20 };
21
START_TEST(RtlxUnicodeStringToOemSize)22 START_TEST(RtlxUnicodeStringToOemSize)
23 {
24 for (int i = 0; i < _countof(TestData); i++)
25 {
26 SetupLocale(TestData[i].AnsiCp, TestData[i].OemCp, -1);
27 UNICODE_STRING Ustr;
28 RtlInitUnicodeString(&Ustr, TestData[i].Str);
29 ULONG Length = RtlxUnicodeStringToOemSize(&Ustr);
30 ok(Length == TestData[i].OemLength, "Wrong OEM length for test %u, expected %u, got %u\n",
31 i, (UINT)TestData[i].OemLength, (UINT)Length);
32 }
33 }
34