[CRT_APITEST] Fix tests for wctomb

- Dynamically load function from the appropriate DLL
- Remove from ntdll_apitest (these are not exported by ntdll)
This commit is contained in:
Timo Kreuzer
2025-09-11 18:08:39 +03:00
parent 5272cc27d6
commit 02af7e7ecb
3 changed files with 19 additions and 6 deletions

View File

@@ -18,6 +18,17 @@
#define todo_static todo_if(1)
#else
#define todo_static
typedef int (__cdecl *PFN_wctomb)(char *mbchar, wchar_t wchar);
static PFN_wctomb p_wctomb;
static BOOL Init(void)
{
HMODULE hdll = LoadLibraryA(TEST_DLL_NAME);
p_wctomb = (PFN_wctomb)GetProcAddress(hdll, "wctomb");
ok(p_wctomb != NULL, "Failed to load wctomb from %s\n", TEST_DLL_NAME);
return (p_wctomb != NULL);
}
#define wctomb p_wctomb
#endif
START_TEST(wctomb)
@@ -28,6 +39,14 @@ START_TEST(wctomb)
unsigned int codepage = ___lc_codepage_func();
wchar_t wchSrc[2] = {L'R', 0414}; // 0414 corresponds to a Russian character in Windows-1251
#ifndef TEST_STATIC_CRT
if (!Init())
{
skip("Skipping tests, because wctomb is not available\n");
return;
}
#endif
chDest = AllocateGuarded(sizeof(*chDest));
if (!chDest)
{

View File

@@ -14,7 +14,6 @@ list(APPEND SOURCE_CRT_TESTS
../crt/_vsnprintf.c
../crt/_vsnwprintf.c
../crt/mbstowcs.c
../crt/mbtowc.c
../crt/setjmp.c
../crt/sprintf.c
../crt/strcpy.c
@@ -22,7 +21,6 @@ list(APPEND SOURCE_CRT_TESTS
../crt/strtoul.c
../crt/wcstombs.c
../crt/wcstoul.c
../crt/wctomb.c
)
add_library(ntdll_crt_test_lib ${SOURCE_CRT_TESTS})

View File

@@ -8,14 +8,12 @@ extern void func__vscwprintf(void);
extern void func__vsnprintf(void);
extern void func__vsnwprintf(void);
extern void func_mbstowcs(void);
extern void func_mbtowc(void);
extern void func_setjmp(void);
extern void func_sprintf(void);
extern void func_strcpy(void);
extern void func_strlen(void);
extern void func_strtoul(void);
extern void func_wcstoul(void);
extern void func_wctomb(void);
extern void func_wcstombs(void);
extern void func_DllLoadNotification(void);
@@ -135,14 +133,12 @@ const struct test winetest_testlist[] =
{ "_vsnprintf", func__vsnprintf },
{ "_vsnwprintf", func__vsnwprintf },
{ "mbstowcs", func_mbstowcs },
{ "mbtowc", func_mbtowc },
{ "setjmp", func_setjmp },
{ "sprintf", func_sprintf },
{ "strcpy", func_strcpy },
{ "strlen", func_strlen },
{ "strtoul", func_strtoul },
{ "wcstoul", func_wcstoul },
{ "wctomb", func_wctomb },
{ "wcstombs", func_wcstombs },
{ "DllLoadNotification", func_DllLoadNotification },