Module: wine Branch: master Commit: d0e8c9a1ab7894bef53a1f62d81a85386c65fff7 URL: https://source.winehq.org/git/wine.git/?a=commit;h=d0e8c9a1ab7894bef53a1f62d...
Author: Daniel Lehman dlehman@esri.com Date: Tue May 1 14:28:23 2018 -0700
msvcr110/tests: Add setlocale tests.
Signed-off-by: Daniel Lehman dlehman@esri.com Signed-off-by: Piotr Caban piotr@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
configure | 1 + configure.ac | 1 + dlls/msvcr110/tests/Makefile.in | 5 +++ dlls/msvcr110/tests/msvcr110.c | 78 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 85 insertions(+)
diff --git a/configure b/configure index cf625c8..119391d 100755 --- a/configure +++ b/configure @@ -18837,6 +18837,7 @@ wine_fn_config_makefile dlls/msvcp90/tests enable_tests wine_fn_config_makefile dlls/msvcr100 enable_msvcr100 wine_fn_config_makefile dlls/msvcr100/tests enable_tests wine_fn_config_makefile dlls/msvcr110 enable_msvcr110 +wine_fn_config_makefile dlls/msvcr110/tests enable_tests wine_fn_config_makefile dlls/msvcr120 enable_msvcr120 wine_fn_config_makefile dlls/msvcr120/tests enable_tests wine_fn_config_makefile dlls/msvcr120_app enable_msvcr120_app diff --git a/configure.ac b/configure.ac index 7386d74..1bc3d13 100644 --- a/configure.ac +++ b/configure.ac @@ -3459,6 +3459,7 @@ WINE_CONFIG_MAKEFILE(dlls/msvcp90/tests) WINE_CONFIG_MAKEFILE(dlls/msvcr100) WINE_CONFIG_MAKEFILE(dlls/msvcr100/tests) WINE_CONFIG_MAKEFILE(dlls/msvcr110) +WINE_CONFIG_MAKEFILE(dlls/msvcr110/tests) WINE_CONFIG_MAKEFILE(dlls/msvcr120) WINE_CONFIG_MAKEFILE(dlls/msvcr120/tests) WINE_CONFIG_MAKEFILE(dlls/msvcr120_app) diff --git a/dlls/msvcr110/tests/Makefile.in b/dlls/msvcr110/tests/Makefile.in new file mode 100644 index 0000000..e8fa818 --- /dev/null +++ b/dlls/msvcr110/tests/Makefile.in @@ -0,0 +1,5 @@ +TESTDLL = msvcr110.dll +APPMODE = -mno-cygwin + +C_SRCS = \ + msvcr110.c diff --git a/dlls/msvcr110/tests/msvcr110.c b/dlls/msvcr110/tests/msvcr110.c new file mode 100644 index 0000000..0a18f73 --- /dev/null +++ b/dlls/msvcr110/tests/msvcr110.c @@ -0,0 +1,78 @@ +/* + * Copyright 2018 Daniel Lehman + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include <errno.h> +#include <stdarg.h> +#include <stdlib.h> +#include <wchar.h> +#include <stdio.h> +#include <float.h> +#include <limits.h> + +#include <windef.h> +#include <winbase.h> +#include <winnls.h> +#include "wine/test.h" + +#include <locale.h> + +static char* (CDECL *p_setlocale)(int category, const char* locale); + +static BOOL init(void) +{ + HMODULE module; + + module = LoadLibraryA("msvcr110.dll"); + if (!module) + { + win_skip("msvcr110.dll not installed\n"); + return FALSE; + } + + p_setlocale = (void*)GetProcAddress(module, "setlocale"); + return TRUE; +} + +static void test_setlocale(void) +{ + int i; + char *ret; + static const char *names[] = + { + "en-us", + "en-US", + "EN-US", + "syr-SY", + "uz-Latn-uz", + }; + + for(i=0; i<sizeof(names)/sizeof(*names); i++) { + ret = p_setlocale(LC_ALL, names[i]); + todo_wine ok(!!ret, "expected success, but got NULL\n"); + if(ret) ok(!strcmp(ret, names[i]), + "expected %s, got %s\n", names[i], ret); + } + + p_setlocale(LC_ALL, "C"); +} + +START_TEST(msvcr110) +{ + if (!init()) return; + test_setlocale(); +}