Reactos

[CRT_APITEST] Fix tests for wctomb

- Dynamically load function from the appropriate DLL
- Remove from ntdll_apitest (these are not exported by ntdll)

+19 -6
+19
modules/rostests/apitests/crt/wctomb.c
··· 18 18 #define todo_static todo_if(1) 19 19 #else 20 20 #define todo_static 21 + typedef int (__cdecl *PFN_wctomb)(char *mbchar, wchar_t wchar); 22 + static PFN_wctomb p_wctomb; 23 + 24 + static BOOL Init(void) 25 + { 26 + HMODULE hdll = LoadLibraryA(TEST_DLL_NAME); 27 + p_wctomb = (PFN_wctomb)GetProcAddress(hdll, "wctomb"); 28 + ok(p_wctomb != NULL, "Failed to load wctomb from %s\n", TEST_DLL_NAME); 29 + return (p_wctomb != NULL); 30 + } 31 + #define wctomb p_wctomb 21 32 #endif 22 33 23 34 START_TEST(wctomb) ··· 27 38 char *loc; 28 39 unsigned int codepage = ___lc_codepage_func(); 29 40 wchar_t wchSrc[2] = {L'R', 0414}; // 0414 corresponds to a Russian character in Windows-1251 41 + 42 + #ifndef TEST_STATIC_CRT 43 + if (!Init()) 44 + { 45 + skip("Skipping tests, because wctomb is not available\n"); 46 + return; 47 + } 48 + #endif 30 49 31 50 chDest = AllocateGuarded(sizeof(*chDest)); 32 51 if (!chDest)
-2
modules/rostests/apitests/ntdll/CMakeLists.txt
··· 14 14 ../crt/_vsnprintf.c 15 15 ../crt/_vsnwprintf.c 16 16 ../crt/mbstowcs.c 17 - ../crt/mbtowc.c 18 17 ../crt/setjmp.c 19 18 ../crt/sprintf.c 20 19 ../crt/strcpy.c ··· 22 21 ../crt/strtoul.c 23 22 ../crt/wcstombs.c 24 23 ../crt/wcstoul.c 25 - ../crt/wctomb.c 26 24 ) 27 25 28 26 add_library(ntdll_crt_test_lib ${SOURCE_CRT_TESTS})
-4
modules/rostests/apitests/ntdll/testlist.c
··· 8 8 extern void func__vsnprintf(void); 9 9 extern void func__vsnwprintf(void); 10 10 extern void func_mbstowcs(void); 11 - extern void func_mbtowc(void); 12 11 extern void func_setjmp(void); 13 12 extern void func_sprintf(void); 14 13 extern void func_strcpy(void); 15 14 extern void func_strlen(void); 16 15 extern void func_strtoul(void); 17 16 extern void func_wcstoul(void); 18 - extern void func_wctomb(void); 19 17 extern void func_wcstombs(void); 20 18 21 19 extern void func_DllLoadNotification(void); ··· 135 133 { "_vsnprintf", func__vsnprintf }, 136 134 { "_vsnwprintf", func__vsnwprintf }, 137 135 { "mbstowcs", func_mbstowcs }, 138 - { "mbtowc", func_mbtowc }, 139 136 { "setjmp", func_setjmp }, 140 137 { "sprintf", func_sprintf }, 141 138 { "strcpy", func_strcpy }, 142 139 { "strlen", func_strlen }, 143 140 { "strtoul", func_strtoul }, 144 141 { "wcstoul", func_wcstoul }, 145 - { "wctomb", func_wctomb }, 146 142 { "wcstombs", func_wcstombs }, 147 143 148 144 { "DllLoadNotification", func_DllLoadNotification },