diff options
Diffstat (limited to 'Build/source/libs/icu/icu-src/source/test/cintltst')
8 files changed, 182 insertions, 192 deletions
diff --git a/Build/source/libs/icu/icu-src/source/test/cintltst/ccaltst.c b/Build/source/libs/icu/icu-src/source/test/cintltst/ccaltst.c index 7f03cb16a6e..205e9fbda44 100644 --- a/Build/source/libs/icu/icu-src/source/test/cintltst/ccaltst.c +++ b/Build/source/libs/icu/icu-src/source/test/cintltst/ccaltst.c @@ -111,7 +111,7 @@ static void TestCalendar() UDateFormat *datdef = 0; UChar *result = 0; int32_t resultlength, resultlengthneeded; - char tempMsgBuf[256]; + char tempMsgBuf[1024]; // u_austrcpy() of some formatted dates & times. UChar zone1[32], zone2[32]; const char *tzver = 0; UChar canonicalID[64]; diff --git a/Build/source/libs/icu/icu-src/source/test/cintltst/cintltst.vcxproj b/Build/source/libs/icu/icu-src/source/test/cintltst/cintltst.vcxproj index 8b926f3c1f3..f64f9d20048 100644 --- a/Build/source/libs/icu/icu-src/source/test/cintltst/cintltst.vcxproj +++ b/Build/source/libs/icu/icu-src/source/test/cintltst/cintltst.vcxproj @@ -1,51 +1,16 @@ <?xml version="1.0" encoding="utf-8"?> <Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup Label="ProjectConfigurations"> - <ProjectConfiguration Include="Debug|Win32"> - <Configuration>Debug</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Debug|x64"> - <Configuration>Debug</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|Win32"> - <Configuration>Release</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|x64"> - <Configuration>Release</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - </ItemGroup> + <!-- The following import will include the 'default' configuration options for VS projects. --> + <Import Project="..\..\allinone\Build.Windows.ProjectConfiguration.props" /> + <PropertyGroup Label="Globals"> <ProjectGuid>{3D1246AE-1B32-479B-BECA-AEFA97BE2321}</ProjectGuid> - <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion> </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> - <ConfigurationType>Application</ConfigurationType> - <UseOfMfc>false</UseOfMfc> - <CharacterSet>MultiByte</CharacterSet> - <PlatformToolset>v140</PlatformToolset> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <PropertyGroup Label="Configuration"> <ConfigurationType>Application</ConfigurationType> <UseOfMfc>false</UseOfMfc> <CharacterSet>MultiByte</CharacterSet> - <PlatformToolset>v140</PlatformToolset> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> - <ConfigurationType>Application</ConfigurationType> - <UseOfMfc>false</UseOfMfc> - <CharacterSet>MultiByte</CharacterSet> - <PlatformToolset>v140</PlatformToolset> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> - <ConfigurationType>Application</ConfigurationType> - <UseOfMfc>false</UseOfMfc> - <CharacterSet>MultiByte</CharacterSet> - <PlatformToolset>v140</PlatformToolset> </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <ImportGroup Label="ExtensionSettings"> @@ -82,38 +47,33 @@ <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">.\x64\Release\</IntDir> <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental> </PropertyGroup> + <!-- Options that are common to *all* project configurations --> + <ItemDefinitionGroup> + <ClCompile> + <AdditionalIncludeDirectories>..\..\..\include;..\..\tools\ctestfw;..\..\common;..\..\i18n;..\..\tools\toolutil;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>U_ATTRIBUTE_DEPRECATED=;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <DisableLanguageExtensions>false</DisableLanguageExtensions> + <WarningLevel>Level3</WarningLevel> + </ClCompile> + </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <Midl> <TypeLibraryName>.\x86\Debug/cintltst.tlb</TypeLibraryName> </Midl> <ClCompile> - <Optimization>Disabled</Optimization> - <AdditionalIncludeDirectories>..\..\..\include;..\..\tools\ctestfw;..\..\common;..\..\i18n;..\..\tools\toolutil;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>U_ATTRIBUTE_DEPRECATED=;WIN32;_DEBUG;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> - <BufferSecurityCheck>true</BufferSecurityCheck> - <DisableLanguageExtensions>false</DisableLanguageExtensions> - <TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType> <PrecompiledHeaderOutputFile>.\x86\Debug/cintltst.pch</PrecompiledHeaderOutputFile> <AssemblerListingLocation>.\x86\Debug/</AssemblerListingLocation> <ObjectFileName>.\x86\Debug/</ObjectFileName> <ProgramDataBaseFileName>.\x86\Debug/</ProgramDataBaseFileName> <BrowseInformation>true</BrowseInformation> - <WarningLevel>Level3</WarningLevel> - <SuppressStartupBanner>true</SuppressStartupBanner> <DebugInformationFormat>EditAndContinue</DebugInformationFormat> <CompileAs>Default</CompileAs> - <AdditionalOptions>/utf-8 %(AdditionalOptions)</AdditionalOptions> </ClCompile> - <ResourceCompile> - <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <Culture>0x0409</Culture> - </ResourceCompile> <Link> <OutputFile>.\x86\Debug/cintltst.exe</OutputFile> - <SuppressStartupBanner>true</SuppressStartupBanner> - <GenerateDebugInformation>true</GenerateDebugInformation> + <AdditionalDependencies>icuucd.lib;icuind.lib;icutestd.lib;icutud.lib;%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalLibraryDirectories>..\..\..\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> <ProgramDatabaseFile>.\x86\Debug/cintltst.pdb</ProgramDatabaseFile> <SubSystem>Console</SubSystem> <RandomizedBaseAddress>false</RandomizedBaseAddress> @@ -127,30 +87,19 @@ <TypeLibraryName>.\x86\Release/cintltst.tlb</TypeLibraryName> </Midl> <ClCompile> - <AdditionalIncludeDirectories>..\..\..\include;..\..\tools\ctestfw;..\..\common;..\..\i18n;..\..\tools\toolutil;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>U_ATTRIBUTE_DEPRECATED=;WIN32;NDEBUG;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <StringPooling>true</StringPooling> <RuntimeLibrary>MultiThreaded</RuntimeLibrary> <BufferSecurityCheck>true</BufferSecurityCheck> <FunctionLevelLinking>true</FunctionLevelLinking> - <DisableLanguageExtensions>false</DisableLanguageExtensions> - <TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType> <PrecompiledHeaderOutputFile>.\x86\Release/cintltst.pch</PrecompiledHeaderOutputFile> <AssemblerListingLocation>.\x86\Release/</AssemblerListingLocation> <ObjectFileName>.\x86\Release/</ObjectFileName> <ProgramDataBaseFileName>.\x86\Release/</ProgramDataBaseFileName> - <WarningLevel>Level3</WarningLevel> - <SuppressStartupBanner>true</SuppressStartupBanner> <CompileAs>Default</CompileAs> - <AdditionalOptions>/utf-8 %(AdditionalOptions)</AdditionalOptions> </ClCompile> - <ResourceCompile> - <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <Culture>0x0409</Culture> - </ResourceCompile> <Link> <OutputFile>.\x86\Release/cintltst.exe</OutputFile> - <SuppressStartupBanner>true</SuppressStartupBanner> + <AdditionalDependencies>icuuc.lib;icuin.lib;icutest.lib;icutu.lib;%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalLibraryDirectories>..\..\..\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> <GenerateDebugInformation>true</GenerateDebugInformation> <ProgramDatabaseFile>.\x86\Release/cintltst.pdb</ProgramDatabaseFile> <SubSystem>Console</SubSystem> @@ -161,77 +110,48 @@ </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <Midl> - <TargetEnvironment>X64</TargetEnvironment> <TypeLibraryName>.\x64\Debug/cintltst.tlb</TypeLibraryName> </Midl> <ClCompile> - <Optimization>Disabled</Optimization> - <AdditionalIncludeDirectories>..\..\..\include;..\..\tools\ctestfw;..\..\common;..\..\i18n;..\..\tools\toolutil;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>U_ATTRIBUTE_DEPRECATED=;WIN64;WIN32;_DEBUG;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> - <BufferSecurityCheck>true</BufferSecurityCheck> - <DisableLanguageExtensions>false</DisableLanguageExtensions> - <TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType> <PrecompiledHeaderOutputFile>.\x64\Debug/cintltst.pch</PrecompiledHeaderOutputFile> <AssemblerListingLocation>.\x64\Debug/</AssemblerListingLocation> <ObjectFileName>.\x64\Debug/</ObjectFileName> <ProgramDataBaseFileName>.\x64\Debug/</ProgramDataBaseFileName> <BrowseInformation>true</BrowseInformation> - <WarningLevel>Level3</WarningLevel> - <SuppressStartupBanner>true</SuppressStartupBanner> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> <CompileAs>Default</CompileAs> - <AdditionalOptions>/utf-8 %(AdditionalOptions)</AdditionalOptions> </ClCompile> - <ResourceCompile> - <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <Culture>0x0409</Culture> - </ResourceCompile> <Link> <OutputFile>.\x64\Debug/cintltst.exe</OutputFile> - <SuppressStartupBanner>true</SuppressStartupBanner> - <GenerateDebugInformation>true</GenerateDebugInformation> + <AdditionalDependencies>icuucd.lib;icuind.lib;icutestd.lib;icutud.lib;%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalLibraryDirectories>..\..\..\lib64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> <ProgramDatabaseFile>.\x64\Debug/cintltst.pdb</ProgramDatabaseFile> <SubSystem>Console</SubSystem> - <TargetMachine>MachineX64</TargetMachine> <FixedBaseAddress>false</FixedBaseAddress> </Link> </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <Midl> - <TargetEnvironment>X64</TargetEnvironment> <TypeLibraryName>.\x64\Release/cintltst.tlb</TypeLibraryName> </Midl> <ClCompile> - <AdditionalIncludeDirectories>..\..\..\include;..\..\tools\ctestfw;..\..\common;..\..\i18n;..\..\tools\toolutil;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>U_ATTRIBUTE_DEPRECATED=;WIN64;WIN32;NDEBUG;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <StringPooling>true</StringPooling> <RuntimeLibrary>MultiThreaded</RuntimeLibrary> <BufferSecurityCheck>true</BufferSecurityCheck> <FunctionLevelLinking>true</FunctionLevelLinking> - <DisableLanguageExtensions>false</DisableLanguageExtensions> - <TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType> <PrecompiledHeaderOutputFile>.\x64\Release/cintltst.pch</PrecompiledHeaderOutputFile> <AssemblerListingLocation>.\x64\Release/</AssemblerListingLocation> <ObjectFileName>.\x64\Release/</ObjectFileName> <ProgramDataBaseFileName>.\x64\Release/</ProgramDataBaseFileName> - <WarningLevel>Level3</WarningLevel> - <SuppressStartupBanner>true</SuppressStartupBanner> <CompileAs>Default</CompileAs> - <AdditionalOptions>/utf-8 %(AdditionalOptions)</AdditionalOptions> </ClCompile> - <ResourceCompile> - <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <Culture>0x0409</Culture> - </ResourceCompile> <Link> <OutputFile>.\x64\Release/cintltst.exe</OutputFile> - <SuppressStartupBanner>true</SuppressStartupBanner> + <AdditionalDependencies>icuuc.lib;icuin.lib;icutest.lib;icutu.lib;%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalLibraryDirectories>..\..\..\lib64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> <GenerateDebugInformation>true</GenerateDebugInformation> <ProgramDatabaseFile>.\x64\Release/cintltst.pdb</ProgramDatabaseFile> <SubSystem>Console</SubSystem> - <TargetMachine>MachineX64</TargetMachine> </Link> </ItemDefinitionGroup> <ItemGroup> @@ -255,10 +175,7 @@ <ClCompile Include="cturtst.c" /> <ClCompile Include="encoll.c" /> <ClCompile Include="usrchdat.c"> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> + <ExcludedFromBuild>true</ExcludedFromBuild> </ClCompile> <ClCompile Include="usrchtst.c" /> <ClCompile Include="chashtst.c" /> @@ -278,8 +195,7 @@ <ClCompile Include="stdnmtst.c" /> <ClCompile Include="ucnvseltst.c" /> <ClCompile Include="ucsdetst.c" /> - <ClCompile Include="udatatst.c"> - </ClCompile> + <ClCompile Include="udatatst.c"/> <ClCompile Include="ccaltst.c" /> <ClCompile Include="cdateintervalformattest.c" /> <ClCompile Include="cdattst.c" /> @@ -364,25 +280,7 @@ <ClInclude Include="cucdapi.h" /> <ClInclude Include="nfsprep.h" /> </ItemGroup> - <ItemGroup> - <ProjectReference Include="..\..\common\common.vcxproj"> - <Project>{73c0a65b-d1f2-4de1-b3a6-15dad2c23f3d}</Project> - <ReferenceOutputAssembly>false</ReferenceOutputAssembly> - </ProjectReference> - <ProjectReference Include="..\..\i18n\i18n.vcxproj"> - <Project>{0178b127-6269-407d-b112-93877bb62776}</Project> - <ReferenceOutputAssembly>false</ReferenceOutputAssembly> - </ProjectReference> - <ProjectReference Include="..\..\tools\ctestfw\ctestfw.vcxproj"> - <Project>{eca6b435-b4fa-4f9f-bf95-f451d078fc47}</Project> - <ReferenceOutputAssembly>false</ReferenceOutputAssembly> - </ProjectReference> - <ProjectReference Include="..\..\tools\toolutil\toolutil.vcxproj"> - <Project>{6b231032-3cb5-4eed-9210-810d666a23a0}</Project> - <ReferenceOutputAssembly>false</ReferenceOutputAssembly> - </ProjectReference> - </ItemGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <ImportGroup Label="ExtensionTargets"> </ImportGroup> -</Project> +</Project>
\ No newline at end of file diff --git a/Build/source/libs/icu/icu-src/source/test/cintltst/cnumtst.c b/Build/source/libs/icu/icu-src/source/test/cintltst/cnumtst.c index e2cd68abae1..d11cca78b3e 100644 --- a/Build/source/libs/icu/icu-src/source/test/cintltst/cnumtst.c +++ b/Build/source/libs/icu/icu-src/source/test/cintltst/cnumtst.c @@ -2372,7 +2372,7 @@ static const NumSysTestItem numSysTestItems[] = { { "en", "latn", 10, FALSE, latnDesc }, { "en@numbers=roman", "roman", 10, TRUE, romanDesc }, { "en@numbers=finance", "latn", 10, FALSE, latnDesc }, - { "ar", "arab", 10, FALSE, arabDesc }, + { "ar-EG", "arab", 10, FALSE, arabDesc }, { "fa", "arabext", 10, FALSE, arabextDesc }, { "zh_Hans@numbers=hanidec", "hanidec", 10, FALSE, hanidecDesc }, { "zh_Hant@numbers=traditional", "hant", 10, TRUE, hantDesc }, diff --git a/Build/source/libs/icu/icu-src/source/test/cintltst/creststn.c b/Build/source/libs/icu/icu-src/source/test/cintltst/creststn.c index 48717c10653..098cd46e472 100644 --- a/Build/source/libs/icu/icu-src/source/test/cintltst/creststn.c +++ b/Build/source/libs/icu/icu-src/source/test/cintltst/creststn.c @@ -2129,7 +2129,7 @@ static void TestFallback() UResourceBundle* tResB; UResourceBundle* zoneResource; const UChar* version = NULL; - static const UChar versionStr[] = { 0x0032, 0x002E, 0x0031, 0x002E, 0x0033, 0x0031, 0x002E, 0x0033, 0x0033, 0x0000}; // 2.1.31.33 in nn_NO + static const UChar versionStr[] = { 0x0032, 0x002E, 0x0031, 0x002E, 0x0033, 0x0038, 0x002E, 0x0036, 0x0039, 0x0000}; // 2.1.38.69 in nn_NO if(err != U_ZERO_ERROR){ log_data_err("Expected U_ZERO_ERROR when trying to test no_NO_NY aliased to nn_NO for Version err=%s\n",u_errorName(err)); diff --git a/Build/source/libs/icu/icu-src/source/test/cintltst/cucdtst.c b/Build/source/libs/icu/icu-src/source/test/cintltst/cucdtst.c index 788aa803757..67b53a62e0f 100644 --- a/Build/source/libs/icu/icu-src/source/test/cintltst/cucdtst.c +++ b/Build/source/libs/icu/icu-src/source/test/cintltst/cucdtst.c @@ -60,7 +60,6 @@ static void TestNumericProperties(void); static void TestPropertyNames(void); static void TestPropertyValues(void); static void TestConsistency(void); -static void TestUBiDiProps(void); static void TestCaseFolding(void); /* internal methods used */ @@ -196,7 +195,6 @@ void addUnicodeTest(TestNode** root) addTest(root, &TestPropertyNames, "tsutil/cucdtst/TestPropertyNames"); addTest(root, &TestPropertyValues, "tsutil/cucdtst/TestPropertyValues"); addTest(root, &TestConsistency, "tsutil/cucdtst/TestConsistency"); - addTest(root, &TestUBiDiProps, "tsutil/cucdtst/TestUBiDiProps"); addTest(root, &TestCaseFolding, "tsutil/cucdtst/TestCaseFolding"); } @@ -3302,59 +3300,6 @@ TestConsistency() { uset_close(set2); } -/* - * Starting with ICU4C 3.4, the core Unicode properties files - * (uprops.icu, ucase.icu, ubidi.icu, unorm.icu) - * are hardcoded in the common DLL and therefore not included - * in the data package any more. - * Test requiring these files are disabled so that - * we need not jump through hoops (like adding snapshots of these files - * to testdata). - * See Jitterbug 4497. - */ -#define HARDCODED_DATA_4497 1 - -/* API coverage for ubidi_props.c */ -static void TestUBiDiProps() { -#if !HARDCODED_DATA_4497 - UDataMemory *pData; - UBiDiProps *bdp; - const UBiDiProps *cbdp; - UErrorCode errorCode; - - /* coverage for ubidi_openBinary() */ - errorCode=U_ZERO_ERROR; - pData=udata_open(NULL, UBIDI_DATA_TYPE, UBIDI_DATA_NAME, &errorCode); - if(U_FAILURE(errorCode)) { - log_data_err("unable to open " UBIDI_DATA_NAME "." UBIDI_DATA_TYPE ": %s\n", - u_errorName(errorCode)); - return; - } - - bdp=ubidi_openBinary((const uint8_t *)pData->pHeader, -1, &errorCode); - if(U_FAILURE(errorCode)) { - log_err("ubidi_openBinary() fails for the contents of " UBIDI_DATA_NAME "." UBIDI_DATA_TYPE ": %s\n", - u_errorName(errorCode)); - udata_close(pData); - return; - } - - if(0x2215!=ubidi_getMirror(bdp, 0x29F5)) { /* verify some data */ - log_err("ubidi_openBinary() does not seem to return working UBiDiProps\n"); - } - - ubidi_closeProps(bdp); - udata_close(pData); - - /* coverage for ubidi_getDummy() */ - errorCode=U_ZERO_ERROR; - cbdp=ubidi_getDummy(&errorCode); - if(ubidi_getClass(cbdp, 0x20)!=0) { - log_err("ubidi_getClass(dummy, space)!=0\n"); - } -#endif -} - /* test case folding, compare return values with CaseFolding.txt ------------ */ /* bit set for which case foldings for a character have been tested already */ diff --git a/Build/source/libs/icu/icu-src/source/test/cintltst/udatpg_test.c b/Build/source/libs/icu/icu-src/source/test/cintltst/udatpg_test.c index 8895c508acc..2338a2f687f 100644 --- a/Build/source/libs/icu/icu-src/source/test/cintltst/udatpg_test.c +++ b/Build/source/libs/icu/icu-src/source/test/cintltst/udatpg_test.c @@ -42,12 +42,14 @@ static void TestOpenClose(void); static void TestUsage(void); static void TestBuilder(void); static void TestOptions(void); +static void TestGetFieldDisplayNames(void); void addDateTimePatternGeneratorTest(TestNode** root) { TESTCASE(TestOpenClose); TESTCASE(TestUsage); TESTCASE(TestBuilder); TESTCASE(TestOptions); + TESTCASE(TestGetFieldDisplayNames); } /* @@ -438,4 +440,74 @@ static void TestOptions() { } } +typedef struct FieldDisplayNameData { + const char * locale; + UDateTimePatternField field; + UDateTimePGDisplayWidth width; + const char * expected; +} FieldDisplayNameData; +enum { kFieldDisplayNameMax = 32, kFieldDisplayNameBytesMax = 64}; + +static void TestGetFieldDisplayNames() { + const FieldDisplayNameData testData[] = { + /*loc field width expectedName */ + { "de", UDATPG_QUARTER_FIELD, UDATPG_WIDE, "Quartal" }, + { "de", UDATPG_QUARTER_FIELD, UDATPG_ABBREVIATED, "Quart." }, + { "de", UDATPG_QUARTER_FIELD, UDATPG_NARROW, "Q" }, + { "en", UDATPG_DAY_OF_WEEK_IN_MONTH_FIELD, UDATPG_WIDE, "weekday of the month" }, + { "en", UDATPG_DAY_OF_WEEK_IN_MONTH_FIELD, UDATPG_ABBREVIATED, "wkday. of mo." }, + { "en", UDATPG_DAY_OF_WEEK_IN_MONTH_FIELD, UDATPG_NARROW, "wkday. of mo." }, // fallback + { "en_GB", UDATPG_DAY_OF_WEEK_IN_MONTH_FIELD, UDATPG_WIDE, "weekday of the month" }, + { "en_GB", UDATPG_DAY_OF_WEEK_IN_MONTH_FIELD, UDATPG_ABBREVIATED, "wkday of mo" }, // override + { "en_GB", UDATPG_DAY_OF_WEEK_IN_MONTH_FIELD, UDATPG_NARROW, "wkday of mo" }, + { "it", UDATPG_SECOND_FIELD, UDATPG_WIDE, "secondo" }, + { "it", UDATPG_SECOND_FIELD, UDATPG_ABBREVIATED, "s" }, + { "it", UDATPG_SECOND_FIELD, UDATPG_NARROW, "s" }, + }; + + int count = UPRV_LENGTHOF(testData); + const FieldDisplayNameData * testDataPtr = testData; + for (; count-- > 0; ++testDataPtr) { + UErrorCode status = U_ZERO_ERROR; + UDateTimePatternGenerator * dtpgen = udatpg_open(testDataPtr->locale, &status); + if ( U_FAILURE(status) ) { + log_data_err("ERROR udatpg_open failed for locale %s : %s - (Are you missing data?)\n", testDataPtr->locale, myErrorName(status)); + } else { + UChar expName[kFieldDisplayNameMax]; + UChar getName[kFieldDisplayNameMax]; + u_unescape(testDataPtr->expected, expName, kFieldDisplayNameMax); + + int32_t getLen = udatpg_getFieldDisplayName(dtpgen, testDataPtr->field, testDataPtr->width, + getName, kFieldDisplayNameMax, &status); + if ( U_FAILURE(status) ) { + log_err("ERROR udatpg_getFieldDisplayName locale %s field %d width %d, got status %s, len %d\n", + testDataPtr->locale, testDataPtr->field, testDataPtr->width, u_errorName(status), getLen); + } else if ( u_strncmp(expName, getName, kFieldDisplayNameMax) != 0 ) { + char expNameB[kFieldDisplayNameBytesMax]; + char getNameB[kFieldDisplayNameBytesMax]; + log_err("ERROR udatpg_getFieldDisplayName locale %s field %d width %d, expected %s, got %s, status %s\n", + testDataPtr->locale, testDataPtr->field, testDataPtr->width, + u_austrncpy(expNameB,expName,kFieldDisplayNameBytesMax), + u_austrncpy(getNameB,getName,kFieldDisplayNameBytesMax), u_errorName(status) ); + } else if (testDataPtr->width == UDATPG_WIDE && getLen > 1) { + // test preflight & inadequate buffer + int32_t getNewLen; + status = U_ZERO_ERROR; + getNewLen = udatpg_getFieldDisplayName(dtpgen, testDataPtr->field, UDATPG_WIDE, NULL, 0, &status); + if (U_FAILURE(status) || getNewLen != getLen) { + log_err("ERROR udatpg_getFieldDisplayName locale %s field %d width %d, preflight expected len %d, got %d, status %s\n", + testDataPtr->locale, testDataPtr->field, testDataPtr->width, getLen, getNewLen, u_errorName(status) ); + } + status = U_ZERO_ERROR; + getNewLen = udatpg_getFieldDisplayName(dtpgen, testDataPtr->field, UDATPG_WIDE, getName, getLen-1, &status); + if (status!=U_BUFFER_OVERFLOW_ERROR || getNewLen != getLen) { + log_err("ERROR udatpg_getFieldDisplayName locale %s field %d width %d, overflow expected len %d & BUFFER_OVERFLOW_ERROR, got %d & status %s\n", + testDataPtr->locale, testDataPtr->field, testDataPtr->width, getLen, getNewLen, u_errorName(status) ); + } + } + udatpg_close(dtpgen); + } + } +} + #endif diff --git a/Build/source/libs/icu/icu-src/source/test/cintltst/uregiontest.c b/Build/source/libs/icu/icu-src/source/test/cintltst/uregiontest.c index cefbfde4a15..fb8690db91a 100644 --- a/Build/source/libs/icu/icu-src/source/test/cintltst/uregiontest.c +++ b/Build/source/libs/icu/icu-src/source/test/cintltst/uregiontest.c @@ -122,12 +122,12 @@ static KnownRegion knownRegions[] = { { "BS" , 44, "029", URGN_TERRITORY, "019" }, { "BT" , 64, "034", URGN_TERRITORY, "142" }, { "BU" , 104, "035", URGN_TERRITORY, "142" }, - { "BV" , 74, "QO" , URGN_TERRITORY, "009" }, + { "BV" , 74, "005", URGN_TERRITORY, "019" }, { "BW" , 72, "018", URGN_TERRITORY, "002" }, { "BY" , 112, "151", URGN_TERRITORY, "150" }, { "BZ" , 84, "013", URGN_TERRITORY, "019" }, { "CA" , 124, "021", URGN_TERRITORY, "019" }, - { "CC" , 166, "QO" , URGN_TERRITORY, "009" }, + { "CC" , 166, "053", URGN_TERRITORY, "009" }, { "CD" , 180, "017", URGN_TERRITORY, "002" }, { "CF" , 140, "017", URGN_TERRITORY, "002" }, { "CG" , 178, "017", URGN_TERRITORY, "002" }, @@ -143,7 +143,7 @@ static KnownRegion knownRegions[] = { { "CU" , 192, "029", URGN_TERRITORY, "019" }, { "CV" , 132, "011", URGN_TERRITORY, "002" }, { "CW" , 531, "029", URGN_TERRITORY, "019" }, - { "CX" , 162, "QO" , URGN_TERRITORY, "009" }, + { "CX" , 162, "053", URGN_TERRITORY, "009" }, { "CY" , 196, "145", URGN_TERRITORY, "142" }, { "CZ" , 203, "151", URGN_TERRITORY, "150" }, { "DD" , 276, "155", URGN_TERRITORY, "150" }, @@ -184,13 +184,13 @@ static KnownRegion knownRegions[] = { { "GP" , 312, "029", URGN_TERRITORY, "019" }, { "GQ" , 226, "017", URGN_TERRITORY, "002" }, { "GR" , 300, "039", URGN_TERRITORY, "150" }, - { "GS" , 239, "QO" , URGN_TERRITORY, "009" }, + { "GS" , 239, "005", URGN_TERRITORY, "019" }, { "GT" , 320, "013", URGN_TERRITORY, "019" }, { "GU" , 316, "057", URGN_TERRITORY, "009" }, { "GW" , 624, "011", URGN_TERRITORY, "002" }, { "GY" , 328, "005", URGN_TERRITORY, "019" }, { "HK" , 344, "030", URGN_TERRITORY, "142" }, - { "HM" , 334, "QO" , URGN_TERRITORY, "009" }, + { "HM" , 334, "053", URGN_TERRITORY, "009" }, { "HN" , 340, "013", URGN_TERRITORY, "019" }, { "HR" , 191, "039", URGN_TERRITORY, "150" }, { "HT" , 332, "029", URGN_TERRITORY, "019" }, @@ -201,7 +201,7 @@ static KnownRegion knownRegions[] = { { "IL" , 376, "145", URGN_TERRITORY, "142" }, { "IM" , 833, "154", URGN_TERRITORY, "150" }, { "IN" , 356, "034", URGN_TERRITORY, "142" }, - { "IO" , 86, "QO" , URGN_TERRITORY, "009" }, + { "IO" , 86, "014", URGN_TERRITORY, "002" }, { "IQ" , 368, "145", URGN_TERRITORY, "142" }, { "IR" , 364, "034", URGN_TERRITORY, "142" }, { "IS" , 352, "154", URGN_TERRITORY, "150" }, @@ -316,7 +316,7 @@ static KnownRegion knownRegions[] = { { "TA" , -1, "QO", URGN_TERRITORY, "009" }, { "TC" , 796, "029", URGN_TERRITORY, "019" }, { "TD" , 148, "017", URGN_TERRITORY, "002" }, - { "TF" , 260, "QO" , URGN_TERRITORY, "009" }, + { "TF" , 260, "145", URGN_TERRITORY, "142" }, { "TG" , 768, "011", URGN_TERRITORY, "002" }, { "TH" , 764, "035", URGN_TERRITORY, "142" }, { "TJ" , 762, "143", URGN_TERRITORY, "142" }, @@ -333,7 +333,7 @@ static KnownRegion knownRegions[] = { { "TZ" , 834, "014", URGN_TERRITORY, "002" }, { "UA" , 804, "151", URGN_TERRITORY, "150" }, { "UG" , 800, "014", URGN_TERRITORY, "002" }, - { "UM" , 581, "QO" , URGN_TERRITORY, "009" }, + { "UM" , 581, "057", URGN_TERRITORY, "009" }, { "US" , 840, "021", URGN_TERRITORY, "019" }, { "UY" , 858, "005", URGN_TERRITORY, "019" }, { "UZ" , 860, "143", URGN_TERRITORY, "142" }, diff --git a/Build/source/libs/icu/icu-src/source/test/cintltst/utf8tst.c b/Build/source/libs/icu/icu-src/source/test/cintltst/utf8tst.c index 0bbb5e5413d..9f4109c2078 100644 --- a/Build/source/libs/icu/icu-src/source/test/cintltst/utf8tst.c +++ b/Build/source/libs/icu/icu-src/source/test/cintltst/utf8tst.c @@ -94,6 +94,7 @@ static void TestFwdBack(void); static void TestFwdBackUnsafe(void); static void TestSetChar(void); static void TestSetCharUnsafe(void); +static void TestTruncateIfIncomplete(void); static void TestAppendChar(void); static void TestAppend(void); static void TestSurrogates(void); @@ -114,6 +115,7 @@ addUTF8Test(TestNode** root) addTest(root, &TestFwdBackUnsafe, "utf8tst/TestFwdBackUnsafe"); addTest(root, &TestSetChar, "utf8tst/TestSetChar"); addTest(root, &TestSetCharUnsafe, "utf8tst/TestSetCharUnsafe"); + addTest(root, &TestTruncateIfIncomplete, "utf8tst/TestTruncateIfIncomplete"); addTest(root, &TestAppendChar, "utf8tst/TestAppendChar"); addTest(root, &TestAppend, "utf8tst/TestAppend"); addTest(root, &TestSurrogates, "utf8tst/TestSurrogates"); @@ -755,6 +757,14 @@ static void TestFwdBack() { } } +/** +* Ticket #13636 - Visual Studio 2017 has problems optimizing this function. +* As a workaround, we will turn off optimization just for this function on VS2017 and above. +*/ +#if defined(_MSC_VER) && (_MSC_VER > 1900) +#pragma optimize( "", off ) +#endif + static void TestFwdBackUnsafe() { /* * Use a (mostly) well-formed UTF-8 string and test at code point boundaries. @@ -840,6 +850,13 @@ static void TestFwdBackUnsafe() { } } +/** +* Ticket #13636 - Turn optimization back on. +*/ +#if defined(_MSC_VER) && (_MSC_VER > 1900) +#pragma optimize( "", on ) +#endif + static void TestSetChar() { static const uint8_t input[] = {0x61, 0xe4, 0xba, 0x8c, 0x7f, 0xfe, 0x62, 0xc5, 0x7f, 0x61, 0x80, 0x80, 0xe0, 0x00 }; @@ -927,6 +944,64 @@ static void TestSetCharUnsafe() { } } +static void TestTruncateIfIncomplete() { + // Difference from U8_SET_CP_START(): + // U8_TRUNCATE_IF_INCOMPLETE() does not look at s[length]. + // Therefore, if the last byte is a lead byte, then this macro truncates + // even if the byte at the input index cannot continue a valid sequence + // (including when that is not a trail byte). + // On the other hand, if the last byte is a trail byte, then the two macros behave the same. + static const struct { + const char *s; + int32_t expected; + } cases[] = { + { "", 0 }, + { "a", 1 }, + { "\x80", 1 }, + { "\xC1", 1 }, + { "\xC2", 0 }, + { "\xE0", 0 }, + { "\xF4", 0 }, + { "\xF5", 1 }, + { "\x80\x80", 2 }, + { "\xC2\xA0", 2 }, + { "\xE0\x9F", 2 }, + { "\xE0\xA0", 0 }, + { "\xED\x9F", 0 }, + { "\xED\xA0", 2 }, + { "\xF0\x8F", 2 }, + { "\xF0\x90", 0 }, + { "\xF4\x8F", 0 }, + { "\xF4\x90", 2 }, + { "\xF5\x80", 2 }, + { "\x80\x80\x80", 3 }, + { "\xC2\xA0\x80", 3 }, + { "\xE0\xA0\x80", 3 }, + { "\xF0\x8F\x80", 3 }, + { "\xF0\x90\x80", 0 }, + { "\xF4\x8F\x80", 0 }, + { "\xF4\x90\x80", 3 }, + { "\xF5\x80\x80", 3 }, + { "\x80\x80\x80\x80", 4 }, + { "\xC2\xA0\x80\x80", 4 }, + { "\xE0\xA0\x80\x80", 4 }, + { "\xF0\x90\x80\x80", 4 }, + { "\xF5\x80\x80\x80", 4 } + }; + int32_t i; + for (i = 0; i < UPRV_LENGTHOF(cases); ++i) { + const char *s = cases[i].s; + int32_t expected = cases[i].expected; + int32_t length = (int32_t)strlen(s); + int32_t adjusted = length; + U8_TRUNCATE_IF_INCOMPLETE(s, 0, adjusted); + if (adjusted != expected) { + log_err("ERROR: U8_TRUNCATE_IF_INCOMPLETE failed for i=%d, length=%d. Expected:%d Got:%d\n", + (int)i, (int)length, (int)expected, (int)adjusted); + } + } +} + static void TestAppendChar(){ #if !U_HIDE_OBSOLETE_UTF_OLD_H static const uint8_t s[11]={0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x00}; |