[PATCH v3] kernel32/tests: Add tests for NormalizeString API function.

Huw Davies huw at codeweavers.com
Mon Apr 9 11:44:45 CDT 2018


> On 9 Apr 2018, at 17:33, Sergio Gómez Del Real <sdelreal at codeweavers.com> wrote:
> 
> Signed-off-by: Sergio Gómez Del Real <sdelreal at codeweavers.com>
> ---
> dlls/kernel32/tests/locale.c | 189 +++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 189 insertions(+)
> 
> diff --git a/dlls/kernel32/tests/locale.c b/dlls/kernel32/tests/locale.c
> index a99763db92..bac97c647b 100644
> --- a/dlls/kernel32/tests/locale.c
> +++ b/dlls/kernel32/tests/locale.c
> @@ -106,6 +106,7 @@ static INT (WINAPI *pGetNumberFormatEx)(LPCWSTR, DWORD, LPCWSTR, const NUMBERFMT
> static INT (WINAPI *pFindNLSStringEx)(LPCWSTR, DWORD, LPCWSTR, INT, LPCWSTR, INT, LPINT, LPNLSVERSIONINFO, LPVOID, LPARAM);
> static LANGID (WINAPI *pSetThreadUILanguage)(LANGID);
> static LANGID (WINAPI *pGetThreadUILanguage)(VOID);
> +static INT (WINAPI *pNormalizeString)(NORM_FORM, LPCWSTR, INT, LPWSTR, INT);
> 
> static void InitFunctionPointers(void)
> {
> @@ -141,6 +142,7 @@ static void InitFunctionPointers(void)
>   X(FindNLSStringEx);
>   X(SetThreadUILanguage);
>   X(GetThreadUILanguage);
> +  X(NormalizeString);
> 
>   mod = GetModuleHandleA("ntdll");
>   X(RtlUpcaseUnicodeChar);
> @@ -5470,6 +5472,192 @@ static void test_SetThreadUILanguage(void)
>     "expected %d got %d\n", MAKELANGID(LANG_DUTCH, SUBLANG_DUTCH_BELGIAN), res);
> }
> 
> +    struct test_data_normal {
> +        const WCHAR *str;
> +        const WCHAR *nfc;
> +        const WCHAR *nfd;
> +        const WCHAR *nfkc;
> +        const WCHAR *nfkd;
> +    };

Now that you’re looping the normal forms, it would be neater
to have the expected values as an array:

const WCHAR * const expected[4];

That would avoid the pointer manipulation you do within the loop.

Huw.




More information about the wine-devel mailing list