mirror of
https://github.com/reactos/reactos.git
synced 2025-01-03 21:09:19 +00:00
[NTDLL_APITESTS]
Add a few tests for RtlGenerate8dot3Name() svn path=/trunk/; revision=69303
This commit is contained in:
parent
47083e371b
commit
1e31c8d334
3 changed files with 53 additions and 0 deletions
|
@ -22,6 +22,7 @@ list(APPEND SOURCE
|
|||
RtlDosPathNameToNtPathName_U.c
|
||||
RtlDosSearchPath_U.c
|
||||
RtlDosSearchPath_Ustr.c
|
||||
RtlGenerate8dot3Name.c
|
||||
RtlGetFullPathName_U.c
|
||||
RtlGetFullPathName_Ustr.c
|
||||
RtlGetFullPathName_UstrEx.c
|
||||
|
|
50
rostests/apitests/ntdll/RtlGenerate8dot3Name.c
Normal file
50
rostests/apitests/ntdll/RtlGenerate8dot3Name.c
Normal file
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
* PROJECT: ReactOS api tests
|
||||
* LICENSE: GPLv2+ - See COPYING in the top level directory
|
||||
* PURPOSE: Test for RtlGenerate8dot3Name
|
||||
* PROGRAMMER: Pierre Schweitzer <pierre@reactos.org>
|
||||
*/
|
||||
|
||||
#include <apitest.h>
|
||||
|
||||
#define WIN32_NO_STATUS
|
||||
#include <ndk/rtlfuncs.h>
|
||||
|
||||
NTSYSAPI
|
||||
VOID
|
||||
NTAPI
|
||||
RtlGenerate8dot3Name(
|
||||
_In_ PCUNICODE_STRING Name,
|
||||
_In_ BOOLEAN AllowExtendedCharacters,
|
||||
_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"éèàùçeeauc.txt" };
|
||||
PWSTR ShortNames1[] = { L"MENUDM~1", L"SLECTE~1.LNK", L"5C2D~1.TXT", L"EEAUC~1.TXT" };
|
||||
PWSTR ShortNames2[] = { L"MENUDM~2", L"SLECTE~2.LNK", L"5C2D~2.TXT", L"EEAUC~2.TXT" };
|
||||
|
||||
START_TEST(RtlGenerate8dot3Name)
|
||||
{
|
||||
USHORT i;
|
||||
|
||||
for (i = 0; i < 4; ++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 = sizeof(Buffer);
|
||||
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, ShortName.Buffer, Expected.Length, Expected.Buffer);
|
||||
|
||||
RtlGenerate8dot3Name(&LongName, FALSE, &Context, &ShortName);
|
||||
RtlInitUnicodeString(&Expected, ShortNames2[i]);
|
||||
ok(RtlEqualUnicodeString(&Expected, &ShortName, FALSE), "Generated: %.*S. Expected: %.*S\n", ShortName.Length, ShortName.Buffer, Expected.Length, Expected.Buffer);
|
||||
}
|
||||
}
|
|
@ -26,6 +26,7 @@ extern void func_RtlDoesFileExists(void);
|
|||
extern void func_RtlDosPathNameToNtPathName_U(void);
|
||||
extern void func_RtlDosSearchPath_U(void);
|
||||
extern void func_RtlDosSearchPath_Ustr(void);
|
||||
extern void func_RtlGenerate8dot3Name(void);
|
||||
extern void func_RtlGetFullPathName_U(void);
|
||||
extern void func_RtlGetFullPathName_Ustr(void);
|
||||
extern void func_RtlGetFullPathName_UstrEx(void);
|
||||
|
@ -62,6 +63,7 @@ const struct test winetest_testlist[] =
|
|||
{ "RtlDosPathNameToNtPathName_U", func_RtlDosPathNameToNtPathName_U },
|
||||
{ "RtlDosSearchPath_U", func_RtlDosSearchPath_U },
|
||||
{ "RtlDosSearchPath_Ustr", func_RtlDosSearchPath_Ustr },
|
||||
{ "RtlGenerate8dot3Name", func_RtlGenerate8dot3Name },
|
||||
{ "RtlGetFullPathName_U", func_RtlGetFullPathName_U },
|
||||
{ "RtlGetFullPathName_Ustr", func_RtlGetFullPathName_Ustr },
|
||||
{ "RtlGetFullPathName_UstrEx", func_RtlGetFullPathName_UstrEx },
|
||||
|
|
Loading…
Reference in a new issue