Author: pschweitzer
Date: Sun Mar 20 11:31:42 2016
New Revision: 71028
URL:
http://svn.reactos.org/svn/reactos?rev=71028&view=rev
Log:
[NTDLL_APITEST]
RtlGenerate8dot3Name: add more test locales
Modified:
trunk/rostests/apitests/ntdll/RtlGenerate8dot3Name.c
Modified: trunk/rostests/apitests/ntdll/RtlGenerate8dot3Name.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/ntdll/RtlGenerat…
==============================================================================
--- trunk/rostests/apitests/ntdll/RtlGenerate8dot3Name.c [iso-8859-1] (original)
+++ trunk/rostests/apitests/ntdll/RtlGenerate8dot3Name.c [iso-8859-1] Sun Mar 20 11:31:42
2016
@@ -20,12 +20,42 @@
_Inout_ PGENERATE_NAME_CONTEXT Context,
_Inout_ PUNICODE_STRING Name8dot3);
-PWSTR Names[] = { L"Menu Démarrer", L"Sélecteur de configuration
clavier.lnk", L"éèà ùç.txt", L"çùà èé.txt",
L"éèà ù.txt", L"çùà è.txt", L"éèà ùçeeauc.txt",
L"éeèéçcùu.txt", L"test.éxè", L"t£$t¤.txt",
L"Long file name.txt", L"Long file name",
L"Longfilename.txt", L"Longfilename" };
-PWSTR ShortNames1[] = { L"MENUDM~1", L"SLECTE~1.LNK",
L"5C2D~1.TXT", L"423C~1.TXT", L"925E~1.TXT",
L"7E4C~1.TXT", L"EEAUC~1.TXT", L"ECU~1.TXT",
L"TEST~1.X", L"T$T~1.TXT", L"LONGFI~1.TXT",
L"LONGFI~1", L"LONGFI~1.TXT", L"LONGFI~1" };
-PWSTR ShortNames2[] = { L"MENUDM~2", L"SLECTE~2.LNK",
L"5C2D~2.TXT", L"423C~2.TXT", L"925E~2.TXT",
L"7E4C~2.TXT", L"EEAUC~2.TXT", L"ECU~2.TXT",
L"TEST~2.X", L"T$T~2.TXT", L"LONGFI~2.TXT",
L"LONGFI~2", L"LONGFI~2.TXT", L"LONGFI~2" };
-PWSTR ExShortNames1[] = { L"MENUDÃ~1", L"SÃLECT~1.LNK",
L"ÃÃÃÃÃ~1.TXT", L"ÃÃÃÃÃ~1.TXT", L"ÃÃÃÃ~1.TXT",
L"ÃÃÃÃ~1.TXT", L"ÃÃÃÃÃE~1.TXT",
L"ÃEÃÃÃC~1.TXT", L"TEST~1.ÃXÃ", L"T£$T¤~1.TXT",
L"LONGFI~1.TXT", L"LONGFI~1", L"LONGFI~1.TXT",
L"LONGFI~1" };
-PWSTR ExShortNames2[] = { L"MENUDÃ~2", L"SÃLECT~2.LNK",
L"ÃÃÃÃÃ~2.TXT", L"ÃÃÃÃÃ~2.TXT", L"ÃÃÃÃ~2.TXT",
L"ÃÃÃÃ~2.TXT", L"ÃÃÃÃÃE~2.TXT",
L"ÃEÃÃÃC~2.TXT", L"TEST~2.ÃXÃ", L"T£$T¤~2.TXT",
L"LONGFI~2.TXT", L"LONGFI~2", L"LONGFI~2.TXT",
L"LONGFI~2" };
-
+#define NAMES_COUNT 14
+#define LOCALES_COUNT 3
+
+PWSTR Names[NAMES_COUNT] = { L"Menu Démarrer", L"Sélecteur de
configuration clavier.lnk", L"éèà ùç.txt", L"çùà èé.txt",
L"éèà ù.txt", L"çùà è.txt", L"éèà ùçeeauc.txt",
L"éeèéçcùu.txt", L"test.éxè", L"t£$t¤.txt",
L"Long file name.txt", L"Long file name",
L"Longfilename.txt", L"Longfilename" };
+PWSTR ShortNames1[LOCALES_COUNT][NAMES_COUNT] =
+{
+ { L"MENUDM~1", L"SLECTE~1.LNK", L"5C2D~1.TXT",
L"423C~1.TXT", L"925E~1.TXT", L"7E4C~1.TXT",
L"EEAUC~1.TXT", L"ECU~1.TXT", L"TEST~1.X",
L"T$T~1.TXT", L"LONGFI~1.TXT", L"LONGFI~1",
L"LONGFI~1.TXT", L"LONGFI~1" },
+ { L"MENUDM~1", L"SLECTE~1.LNK", L"5C2D~1.TXT",
L"423C~1.TXT", L"925E~1.TXT", L"7E4C~1.TXT",
L"EEAUC~1.TXT", L"ECU~1.TXT", L"TEST~1.X",
L"T$T~1.TXT", L"LONGFI~1.TXT", L"LONGFI~1",
L"LONGFI~1.TXT", L"LONGFI~1" },
+ { L"MENUDM~1", L"SLECTE~1.LNK", L"5C2D~1.TXT",
L"423C~1.TXT", L"925E~1.TXT", L"7E4C~1.TXT",
L"EEAUC~1.TXT", L"ECU~1.TXT", L"TEST~1.X",
L"T$T~1.TXT", L"LONGFI~1.TXT", L"LONGFI~1",
L"LONGFI~1.TXT", L"LONGFI~1" },
+};
+PWSTR ShortNames2[LOCALES_COUNT][NAMES_COUNT] =
+{
+ { L"MENUDM~2", L"SLECTE~2.LNK", L"5C2D~2.TXT",
L"423C~2.TXT", L"925E~2.TXT", L"7E4C~2.TXT",
L"EEAUC~2.TXT", L"ECU~2.TXT", L"TEST~2.X",
L"T$T~2.TXT", L"LONGFI~2.TXT", L"LONGFI~2",
L"LONGFI~2.TXT", L"LONGFI~2" },
+ { L"MENUDM~2", L"SLECTE~2.LNK", L"5C2D~2.TXT",
L"423C~2.TXT", L"925E~2.TXT", L"7E4C~2.TXT",
L"EEAUC~2.TXT", L"ECU~2.TXT", L"TEST~2.X",
L"T$T~2.TXT", L"LONGFI~2.TXT", L"LONGFI~2",
L"LONGFI~2.TXT", L"LONGFI~2" },
+ { L"MENUDM~2", L"SLECTE~2.LNK", L"5C2D~2.TXT",
L"423C~2.TXT", L"925E~2.TXT", L"7E4C~2.TXT",
L"EEAUC~2.TXT", L"ECU~2.TXT", L"TEST~2.X",
L"T$T~2.TXT", L"LONGFI~2.TXT", L"LONGFI~2",
L"LONGFI~2.TXT", L"LONGFI~2" },
+};
+PWSTR ExShortNames1[LOCALES_COUNT][NAMES_COUNT] =
+{
+ { L"MENUDÃ~1", L"SÃLECT~1.LNK", L"ÃÃÃÃÃ~1.TXT",
L"ÃÃÃÃÃ~1.TXT", L"ÃÃÃÃ~1.TXT", L"ÃÃÃÃ~1.TXT",
L"ÃÃÃÃÃE~1.TXT", L"ÃEÃÃÃC~1.TXT", L"TEST~1.ÃXÃ",
L"T£$T¤~1.TXT", L"LONGFI~1.TXT", L"LONGFI~1",
L"LONGFI~1.TXT", L"LONGFI~1" },
+ { L"MENUDÃ~1", L"SÃLECT~1.LNK", L"ÃÃÃÃÃ~1.TXT",
L"ÃÃÃÃÃ~1.TXT", L"ÃÃÃÃ~1.TXT", L"ÃÃÃÃ~1.TXT",
L"ÃÃÃÃÃE~1.TXT", L"ÃEÃÃÃC~1.TXT", L"TEST~1.ÃXÃ",
L"T£$T_~1.TXT", L"LONGFI~1.TXT", L"LONGFI~1",
L"LONGFI~1.TXT", L"LONGFI~1" },
+ { L"MENUDÃ~1", L"SÃLECT~1.LNK", L"ÃCAU~1.TXT",
L"UACÃ~1.TXT", L"ÃCAU~1.TXT", L"UAC~1.TXT",
L"ÃCAUEE~1.TXT", L"ÃECÃCU~1.TXT", L"TEST~1.ÃXC",
L"T£$T¤~1.TXT", L"LONGFI~1.TXT", L"LONGFI~1",
L"LONGFI~1.TXT", L"LONGFI~1" },
+};
+PWSTR ExShortNames2[LOCALES_COUNT][NAMES_COUNT] =
+{
+ { L"MENUDÃ~2", L"SÃLECT~2.LNK", L"ÃÃÃÃÃ~2.TXT",
L"ÃÃÃÃÃ~2.TXT", L"ÃÃÃÃ~2.TXT", L"ÃÃÃÃ~2.TXT",
L"ÃÃÃÃÃE~2.TXT", L"ÃEÃÃÃC~2.TXT", L"TEST~2.ÃXÃ",
L"T£$T¤~2.TXT", L"LONGFI~2.TXT", L"LONGFI~2",
L"LONGFI~2.TXT", L"LONGFI~2" },
+ { L"MENUDÃ~2", L"SÃLECT~2.LNK", L"ÃÃÃÃÃ~2.TXT",
L"ÃÃÃÃÃ~2.TXT", L"ÃÃÃÃ~2.TXT", L"ÃÃÃÃ~2.TXT",
L"ÃÃÃÃÃE~2.TXT", L"ÃEÃÃÃC~2.TXT", L"TEST~2.ÃXÃ",
L"T£$T_~2.TXT", L"LONGFI~2.TXT", L"LONGFI~2",
L"LONGFI~2.TXT", L"LONGFI~2" },
+ { L"MENUDÃ~2", L"SÃLECT~2.LNK", L"ÃCAU~2.TXT",
L"UACÃ~2.TXT", L"ÃCAU~2.TXT", L"UAC~2.TXT",
L"ÃCAUEE~2.TXT", L"ÃECÃCU~2.TXT", L"TEST~2.ÃXC",
L"T£$T¤~2.TXT", L"LONGFI~2.TXT", L"LONGFI~2",
L"LONGFI~2.TXT", L"LONGFI~2" },
+};
+
+ULONG Locales[LOCALES_COUNT][2] =
+{
+ {1252, 850}, // Most used for latin langs
+ {1252, 437}, // Used for English US (not only)
+ {1252, 775}, // Used for Estonian
+};
+
PVOID LoadCodePageData(ULONG Code)
{
char filename[MAX_PATH], sysdir[MAX_PATH];
@@ -71,41 +101,44 @@
START_TEST(RtlGenerate8dot3Name)
{
- USHORT i;
+ USHORT i, j;
- /* Set a french locale. */
- SetupLocale(1252, 850, -1);
+ for (j = 0; j < LOCALES_COUNT; ++j)
+ {
+ /* Setup locale. */
+ SetupLocale(Locales[j][0], Locales[j][1], -1);
- for (i = 0; i < 14; ++i)
- {
- WCHAR Buffer[12];
- GENERATE_NAME_CONTEXT Context;
- UNICODE_STRING LongName, ShortName, Expected;
+ for (i = 0; i < NAMES_COUNT; ++i)
+ {
+ WCHAR Buffer[12];
+ GENERATE_NAME_CONTEXT Context;
+ UNICODE_STRING LongName, ShortName, Expected;
- RtlZeroMemory(&Context, sizeof(GENERATE_NAME_CONTEXT));
- RtlInitUnicodeString(&LongName, Names[i]);
- ShortName.Buffer = Buffer;
- ShortName.Length = 0;
- ShortName.MaximumLength = sizeof(Buffer);
+ RtlZeroMemory(&Context, sizeof(GENERATE_NAME_CONTEXT));
+ RtlInitUnicodeString(&LongName, Names[i]);
+ ShortName.Buffer = Buffer;
+ ShortName.Length = 0;
+ ShortName.MaximumLength = sizeof(Buffer);
- RtlGenerate8dot3Name(&LongName, FALSE, &Context, &ShortName);
- RtlInitUnicodeString(&Expected, ShortNames1[i]);
- ok(RtlEqualUnicodeString(&Expected, &ShortName, FALSE), "Generated:
%.*S. Expected: %.*S\n", ShortName.Length / sizeof(WCHAR), ShortName.Buffer,
Expected.Length / sizeof(WCHAR), Expected.Buffer);
+ RtlGenerate8dot3Name(&LongName, FALSE, &Context, &ShortName);
+ RtlInitUnicodeString(&Expected, ShortNames1[j][i]);
+ ok(RtlEqualUnicodeString(&Expected, &ShortName, FALSE), "%u::
Generated: %.*S. Expected: %.*S\n", j, ShortName.Length / sizeof(WCHAR),
ShortName.Buffer, Expected.Length / sizeof(WCHAR), Expected.Buffer);
- ShortName.Length = 0;
- RtlGenerate8dot3Name(&LongName, FALSE, &Context, &ShortName);
- RtlInitUnicodeString(&Expected, ShortNames2[i]);
- ok(RtlEqualUnicodeString(&Expected, &ShortName, FALSE), "Generated:
%.*S. Expected: %.*S\n", ShortName.Length / sizeof(WCHAR), ShortName.Buffer,
Expected.Length / sizeof(WCHAR), Expected.Buffer);
+ ShortName.Length = 0;
+ RtlGenerate8dot3Name(&LongName, FALSE, &Context, &ShortName);
+ RtlInitUnicodeString(&Expected, ShortNames2[j][i]);
+ ok(RtlEqualUnicodeString(&Expected, &ShortName, FALSE), "%u::
Generated: %.*S. Expected: %.*S\n", j, ShortName.Length / sizeof(WCHAR),
ShortName.Buffer, Expected.Length / sizeof(WCHAR), Expected.Buffer);
- RtlZeroMemory(&Context, sizeof(GENERATE_NAME_CONTEXT));
- ShortName.Length = 0;
- RtlGenerate8dot3Name(&LongName, TRUE, &Context, &ShortName);
- RtlInitUnicodeString(&Expected, ExShortNames1[i]);
- ok(RtlEqualUnicodeString(&Expected, &ShortName, FALSE), "Generated:
%.*S. Expected: %.*S\n", ShortName.Length / sizeof(WCHAR), ShortName.Buffer,
Expected.Length / sizeof(WCHAR), Expected.Buffer);
+ RtlZeroMemory(&Context, sizeof(GENERATE_NAME_CONTEXT));
+ ShortName.Length = 0;
+ RtlGenerate8dot3Name(&LongName, TRUE, &Context, &ShortName);
+ RtlInitUnicodeString(&Expected, ExShortNames1[j][i]);
+ ok(RtlEqualUnicodeString(&Expected, &ShortName, FALSE), "%u::
Generated: %.*S. Expected: %.*S\n", j, ShortName.Length / sizeof(WCHAR),
ShortName.Buffer, Expected.Length / sizeof(WCHAR), Expected.Buffer);
- ShortName.Length = 0;
- RtlGenerate8dot3Name(&LongName, TRUE, &Context, &ShortName);
- RtlInitUnicodeString(&Expected, ExShortNames2[i]);
- ok(RtlEqualUnicodeString(&Expected, &ShortName, FALSE), "Generated:
%.*S. Expected: %.*S\n", ShortName.Length / sizeof(WCHAR), ShortName.Buffer,
Expected.Length / sizeof(WCHAR), Expected.Buffer);
+ ShortName.Length = 0;
+ RtlGenerate8dot3Name(&LongName, TRUE, &Context, &ShortName);
+ RtlInitUnicodeString(&Expected, ExShortNames2[j][i]);
+ ok(RtlEqualUnicodeString(&Expected, &ShortName, FALSE), "%u::
Generated: %.*S. Expected: %.*S\n", j, ShortName.Length / sizeof(WCHAR),
ShortName.Buffer, Expected.Length / sizeof(WCHAR), Expected.Buffer);
+ }
}
}