From 4b4aad7217d3292650e77eec2cf4c198ea9c3b4b Mon Sep 17 00:00:00 2001 From: Jiyoung Yun Date: Wed, 23 Nov 2016 19:09:09 +0900 Subject: Imported Upstream version 1.1.0 --- .../locale_info/GetLocaleInfoW/CMakeLists.txt | 5 ++ .../GetLocaleInfoW/test1/CMakeLists.txt | 19 +++++ .../locale_info/GetLocaleInfoW/test1/test1.c | 89 ++++++++++++++++++++++ .../locale_info/GetLocaleInfoW/test1/testinfo.dat | 12 +++ .../GetLocaleInfoW/test2/CMakeLists.txt | 19 +++++ .../locale_info/GetLocaleInfoW/test2/test2.c | 51 +++++++++++++ .../locale_info/GetLocaleInfoW/test2/testinfo.dat | 14 ++++ 7 files changed, 209 insertions(+) create mode 100644 src/pal/tests/palsuite/locale_info/GetLocaleInfoW/CMakeLists.txt create mode 100644 src/pal/tests/palsuite/locale_info/GetLocaleInfoW/test1/CMakeLists.txt create mode 100644 src/pal/tests/palsuite/locale_info/GetLocaleInfoW/test1/test1.c create mode 100644 src/pal/tests/palsuite/locale_info/GetLocaleInfoW/test1/testinfo.dat create mode 100644 src/pal/tests/palsuite/locale_info/GetLocaleInfoW/test2/CMakeLists.txt create mode 100644 src/pal/tests/palsuite/locale_info/GetLocaleInfoW/test2/test2.c create mode 100644 src/pal/tests/palsuite/locale_info/GetLocaleInfoW/test2/testinfo.dat (limited to 'src/pal/tests/palsuite/locale_info/GetLocaleInfoW') diff --git a/src/pal/tests/palsuite/locale_info/GetLocaleInfoW/CMakeLists.txt b/src/pal/tests/palsuite/locale_info/GetLocaleInfoW/CMakeLists.txt new file mode 100644 index 0000000000..ef14ea5352 --- /dev/null +++ b/src/pal/tests/palsuite/locale_info/GetLocaleInfoW/CMakeLists.txt @@ -0,0 +1,5 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +add_subdirectory(test1) +add_subdirectory(test2) + diff --git a/src/pal/tests/palsuite/locale_info/GetLocaleInfoW/test1/CMakeLists.txt b/src/pal/tests/palsuite/locale_info/GetLocaleInfoW/test1/CMakeLists.txt new file mode 100644 index 0000000000..f373b98f7c --- /dev/null +++ b/src/pal/tests/palsuite/locale_info/GetLocaleInfoW/test1/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.8.12.2) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(SOURCES + test1.c +) + +add_executable(paltest_getlocaleinfow_test1 + ${SOURCES} +) + +add_dependencies(paltest_getlocaleinfow_test1 coreclrpal) + +target_link_libraries(paltest_getlocaleinfow_test1 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/locale_info/GetLocaleInfoW/test1/test1.c b/src/pal/tests/palsuite/locale_info/GetLocaleInfoW/test1/test1.c new file mode 100644 index 0000000000..0994940a57 --- /dev/null +++ b/src/pal/tests/palsuite/locale_info/GetLocaleInfoW/test1/test1.c @@ -0,0 +1,89 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +/*============================================================================ +** +** Source: test1.c +** +** Purpose: Tests that GetLocaleInfoW gives the correction information for +** LOCALE_NEUTRAL. +** +** +**==========================================================================*/ + +#include + + +int Types[] = { LOCALE_SDECIMAL, LOCALE_STHOUSAND, LOCALE_ILZERO, + LOCALE_SCURRENCY, LOCALE_SMONDECIMALSEP, LOCALE_SMONTHOUSANDSEP }; + +char *TypeStrings[] = { "LOCALE_SDECIMAL", "LOCALE_STHOUSAND", "LOCALE_ILZERO", + "LOCALE_SCURRENCY", "LOCALE_SMONDECIMALSEP", "LOCALE_SMONTHOUSANDSEP" }; + +#define NUM_TYPES (sizeof(Types) / sizeof(Types[0])) + +typedef WCHAR InfoStrings[NUM_TYPES][4]; + +typedef struct +{ + LCID lcid; + InfoStrings Strings; +} LocalInfoType; + +LocalInfoType Locales[] = +{ + {LOCALE_NEUTRAL, + {{'.',0}, {',',0}, {'1',0}, {'$',0}, {'.',0}, {',',0}}}, +}; + +int NumLocales = sizeof(Locales) / sizeof(Locales[0]); + + +int __cdecl main(int argc, char *argv[]) +{ + WCHAR buffer[256] = { 0 }; + int ret; + int i,j; + + if (PAL_Initialize(argc, argv)) + { + return FAIL; + } + + for (i=0; i + +int __cdecl main(int argc, char *argv[]) +{ + WCHAR buffer[256] = { 0 }; + int ret; + + if (PAL_Initialize(argc, argv)) + { + return FAIL; + } + + ret = GetLocaleInfoW(LOCALE_NEUTRAL, LOCALE_SDECIMAL, buffer, 0); + if (ret != 2) + { + Fail("GetLocaleInfoW gave incorrect desired length for buffer.\n" + "Expected 2, got %d.\n", ret); + } + + ret = GetLocaleInfoW(LOCALE_NEUTRAL, LOCALE_SDECIMAL, buffer, 1); + if (ret != 0) + { + Fail("GetLocaleInfoW expected to return 0, returned %d", ret); + } + + if (GetLastError() != ERROR_INSUFFICIENT_BUFFER) + { + Fail("GetLocaleInfoW failed to set last error to " + "ERROR_INSUFFICIENT_BUFFER!\n"); + } + + PAL_Terminate(); + + return PASS; +} + diff --git a/src/pal/tests/palsuite/locale_info/GetLocaleInfoW/test2/testinfo.dat b/src/pal/tests/palsuite/locale_info/GetLocaleInfoW/test2/testinfo.dat new file mode 100644 index 0000000000..b9fc4886ee --- /dev/null +++ b/src/pal/tests/palsuite/locale_info/GetLocaleInfoW/test2/testinfo.dat @@ -0,0 +1,14 @@ +# Licensed to the .NET Foundation under one or more agreements. +# The .NET Foundation licenses this file to you under the MIT license. +# See the LICENSE file in the project root for more information. + +Version = 1.0 +Section = Locale Information +Function = GetLocaleInfoW +Name = Test #2 for GetLocaleInfoW +TYPE = DEFAULT +EXE1 = test2 +Description +=Tests that GetLocaleInfoW will correctly return the amount of +=buffer space required. Also tests that it correctly handles a +=buffer of insufficient space. -- cgit v1.2.3