[CRT_APITEST] Implement tests for _wcsicmp and _wcsnicmp

This commit is contained in:
Timo Kreuzer
2025-10-24 08:53:21 +03:00
parent 7872c0d391
commit ae3eb6cb36
6 changed files with 126 additions and 0 deletions

View File

@@ -0,0 +1,53 @@
/*
* PROJECT: ReactOS API tests
* LICENSE: LGPL-2.1-or-later (https://spdx.org/licenses/LGPL-2.1-or-later)
* PURPOSE: Tests for _wcsicmp
* COPYRIGHT: Copyright 2025 Timo Kreuzer (timo.kreuzer@reactos.org)
*/
#define WIN32_NO_STATUS
#include <apitest.h>
#include <pseh/pseh2.h>
#include <ndk/umtypes.h>
typedef int (__cdecl *PFN_wcsicmp)(const wchar_t* _String1, const wchar_t* _String2);
static PFN_wcsicmp p_wcsicmp;
static BOOL Init(void)
{
HMODULE hdll = LoadLibraryA(TEST_DLL_NAME);
p_wcsicmp = (PFN_wcsicmp)GetProcAddress(hdll, "_wcsicmp");
ok(p_wcsicmp != NULL, "Failed to load _wcsicmp from %s\n", TEST_DLL_NAME);
return (p_wcsicmp != NULL);
}
START_TEST(_wcsicmp)
{
int result;
#ifndef TEST_STATIC_CRT
if (!Init())
{
skip("Skipping tests, because _wcsicmp is not available\n");
return;
}
#endif
StartSeh()
result = p_wcsicmp(L"a", NULL);
ok_int(result, MAXLONG);
#ifdef TEST_NTDLL
EndSeh(STATUS_ACCESS_VIOLATION);
#else
EndSeh((is_reactos() || _winver >= _WIN32_WINNT_VISTA) ? STATUS_SUCCESS : STATUS_ACCESS_VIOLATION);
#endif
StartSeh()
result = p_wcsicmp(NULL, L"a");
ok_int(result, MAXLONG);
#ifdef TEST_NTDLL
EndSeh(STATUS_ACCESS_VIOLATION);
#else
EndSeh((is_reactos() || _winver >= _WIN32_WINNT_VISTA) ? STATUS_SUCCESS : STATUS_ACCESS_VIOLATION);
#endif
}

View File

@@ -0,0 +1,61 @@
/*
* PROJECT: ReactOS API tests
* LICENSE: LGPL-2.1-or-later (https://spdx.org/licenses/LGPL-2.1-or-later)
* PURPOSE: Tests for _wcsnicmp
* COPYRIGHT: Copyright 2025 Timo Kreuzer (timo.kreuzer@reactos.org)
*/
#define WIN32_NO_STATUS
#include <apitest.h>
#include <pseh/pseh2.h>
#include <ndk/umtypes.h>
typedef int (__cdecl *PFN_wcsnicmp)(const wchar_t* _String1, const wchar_t* _String2, size_t _MaxCount);
static PFN_wcsnicmp p_wcsnicmp;
static BOOL Init(void)
{
HMODULE hdll = LoadLibraryA(TEST_DLL_NAME);
p_wcsnicmp = (PFN_wcsnicmp)GetProcAddress(hdll, "_wcsnicmp");
ok(p_wcsnicmp != NULL, "Failed to load _wcsnicmp from %s\n", TEST_DLL_NAME);
return (p_wcsnicmp != NULL);
}
START_TEST(_wcsnicmp)
{
int result;
#ifndef TEST_STATIC_CRT
if (!Init())
{
skip("Skipping tests, because _wcsnicmp is not available\n");
return;
}
#endif
StartSeh()
result = p_wcsnicmp(L"a", NULL, 0);
EndSeh(STATUS_SUCCESS);
StartSeh()
result = p_wcsnicmp(L"a", NULL, 1);
ok_int(result, MAXLONG);
#ifdef TEST_NTDLL
EndSeh(STATUS_ACCESS_VIOLATION);
#else
EndSeh((is_reactos() || GetNTVersion() >= _WIN32_WINNT_VISTA) ? STATUS_SUCCESS : STATUS_ACCESS_VIOLATION);
#endif
StartSeh()
result = p_wcsnicmp(NULL, L"a", 0);
EndSeh(STATUS_SUCCESS);
StartSeh()
result = p_wcsnicmp(NULL, L"a", 1);
ok_int(result, MAXLONG);
#ifdef TEST_NTDLL
EndSeh(STATUS_ACCESS_VIOLATION);
#else
EndSeh((is_reactos() || GetNTVersion() >= _WIN32_WINNT_VISTA) ? STATUS_SUCCESS : STATUS_ACCESS_VIOLATION);
#endif
}

View File

@@ -22,6 +22,8 @@ list(APPEND SOURCE_CRT_TESTS
../crt/_vscwprintf.c
../crt/_vsnprintf.c
../crt/_vsnwprintf.c
../crt/_wcsicmp.c
../crt/_wcsnicmp.c
../crt/_wsystem.c
../crt/acos.c
../crt/asin.c

View File

@@ -16,6 +16,8 @@ extern void func__vscprintf(void);
extern void func__vscwprintf(void);
extern void func__vsnprintf(void);
extern void func__vsnwprintf(void);
extern void func__wcsicmp(void);
extern void func__wcsnicmp(void);
extern void func__wsystem(void);
extern void func_acos(void);
extern void func_asin(void);
@@ -76,6 +78,8 @@ const struct test winetest_testlist[] =
{ "_vscwprintf", func__vscwprintf },
{ "_vsnprintf", func__vsnprintf },
{ "_vsnwprintf", func__vsnwprintf },
{ "_wcsicmp", func__wcsicmp },
{ "_wcsnicmp", func__wcsnicmp },
{ "_wsystem", func__wsystem },
{ "acos", func_acos },
{ "asin", func_asin },

View File

@@ -15,6 +15,8 @@ list(APPEND SOURCE_CRT_TESTS
../crt/_vscwprintf.c
../crt/_vsnprintf.c
../crt/_vsnwprintf.c
../crt/_wcsicmp.c
../crt/_wcsnicmp.c
../crt/mbstowcs.c
../crt/setjmp.c
../crt/sprintf.c

View File

@@ -9,6 +9,8 @@ extern void func__strnicmp(void);
extern void func__vscwprintf(void);
extern void func__vsnprintf(void);
extern void func__vsnwprintf(void);
extern void func__wcsicmp(void);
extern void func__wcsnicmp(void);
extern void func_mbstowcs(void);
extern void func_setjmp(void);
extern void func_sprintf(void);
@@ -136,6 +138,8 @@ const struct test winetest_testlist[] =
{ "_vscwprintf", func__vscwprintf },
{ "_vsnprintf", func__vsnprintf },
{ "_vsnwprintf", func__vsnwprintf },
{ "_wcsicmp", func__wcsicmp },
{ "_wcsnicmp", func__wcsnicmp },
{ "mbstowcs", func_mbstowcs },
{ "setjmp", func_setjmp },
{ "sprintf", func_sprintf },