diff options
Diffstat (limited to 'tests/src/CoreMangLib/cti/system/globalization/charunicodeinfo')
8 files changed, 0 insertions, 2700 deletions
diff --git a/tests/src/CoreMangLib/cti/system/globalization/charunicodeinfo/CharUnicodeInfoGetNumericValue1.csproj b/tests/src/CoreMangLib/cti/system/globalization/charunicodeinfo/CharUnicodeInfoGetNumericValue1.csproj deleted file mode 100644 index 7ee428d34e..0000000000 --- a/tests/src/CoreMangLib/cti/system/globalization/charunicodeinfo/CharUnicodeInfoGetNumericValue1.csproj +++ /dev/null @@ -1,45 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> - <PropertyGroup> - <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> - <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> - <SchemaVersion>2.0</SchemaVersion> - <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> - <OutputType>Exe</OutputType> - <AppDesignerFolder>Properties</AppDesignerFolder> - <FileAlignment>512</FileAlignment> - <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> - <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> - <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> - <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> - <AllowUnsafeBlocks>true</AllowUnsafeBlocks> - <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib> - <CLRTestKind>BuildAndRun</CLRTestKind> - <CLRTestPriority>1</CLRTestPriority> - </PropertyGroup> - <!-- Default configurations to help VS understand the configurations --> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> - </PropertyGroup> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> - </PropertyGroup> - <ItemGroup> - <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> - <Visible>False</Visible> - </CodeAnalysisDependentAssemblyPaths> - </ItemGroup> - <ItemGroup> - <!-- Add Compile Object Here --> - <Compile Include="charunicodeinfogetnumericvalue1.cs" /> - </ItemGroup> - <ItemGroup> - <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> - </ItemGroup> - <ItemGroup> - <ProjectReference Include="../../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" /> - <ProjectReference Include="../../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" /> - </ItemGroup> - <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> - <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> - </PropertyGroup> -</Project>
\ No newline at end of file diff --git a/tests/src/CoreMangLib/cti/system/globalization/charunicodeinfo/CharUnicodeInfoGetNumericValue2.csproj b/tests/src/CoreMangLib/cti/system/globalization/charunicodeinfo/CharUnicodeInfoGetNumericValue2.csproj deleted file mode 100644 index 61274599c8..0000000000 --- a/tests/src/CoreMangLib/cti/system/globalization/charunicodeinfo/CharUnicodeInfoGetNumericValue2.csproj +++ /dev/null @@ -1,45 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> - <PropertyGroup> - <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> - <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> - <SchemaVersion>2.0</SchemaVersion> - <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> - <OutputType>Exe</OutputType> - <AppDesignerFolder>Properties</AppDesignerFolder> - <FileAlignment>512</FileAlignment> - <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> - <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> - <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> - <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> - <AllowUnsafeBlocks>true</AllowUnsafeBlocks> - <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib> - <CLRTestKind>BuildAndRun</CLRTestKind> - <CLRTestPriority>1</CLRTestPriority> - </PropertyGroup> - <!-- Default configurations to help VS understand the configurations --> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> - </PropertyGroup> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> - </PropertyGroup> - <ItemGroup> - <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> - <Visible>False</Visible> - </CodeAnalysisDependentAssemblyPaths> - </ItemGroup> - <ItemGroup> - <!-- Add Compile Object Here --> - <Compile Include="charunicodeinfogetnumericvalue2.cs" /> - </ItemGroup> - <ItemGroup> - <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> - </ItemGroup> - <ItemGroup> - <ProjectReference Include="../../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" /> - <ProjectReference Include="../../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" /> - </ItemGroup> - <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> - <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> - </PropertyGroup> -</Project>
\ No newline at end of file diff --git a/tests/src/CoreMangLib/cti/system/globalization/charunicodeinfo/CharUnicodeInfoGetUnicodeCategory1.csproj b/tests/src/CoreMangLib/cti/system/globalization/charunicodeinfo/CharUnicodeInfoGetUnicodeCategory1.csproj deleted file mode 100644 index b9b9088b6b..0000000000 --- a/tests/src/CoreMangLib/cti/system/globalization/charunicodeinfo/CharUnicodeInfoGetUnicodeCategory1.csproj +++ /dev/null @@ -1,45 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> - <PropertyGroup> - <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> - <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> - <SchemaVersion>2.0</SchemaVersion> - <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> - <OutputType>Exe</OutputType> - <AppDesignerFolder>Properties</AppDesignerFolder> - <FileAlignment>512</FileAlignment> - <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> - <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> - <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> - <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> - <AllowUnsafeBlocks>true</AllowUnsafeBlocks> - <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib> - <CLRTestKind>BuildAndRun</CLRTestKind> - <CLRTestPriority>1</CLRTestPriority> - </PropertyGroup> - <!-- Default configurations to help VS understand the configurations --> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> - </PropertyGroup> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> - </PropertyGroup> - <ItemGroup> - <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> - <Visible>False</Visible> - </CodeAnalysisDependentAssemblyPaths> - </ItemGroup> - <ItemGroup> - <!-- Add Compile Object Here --> - <Compile Include="charunicodeinfogetunicodecategory1.cs" /> - </ItemGroup> - <ItemGroup> - <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> - </ItemGroup> - <ItemGroup> - <ProjectReference Include="../../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" /> - <ProjectReference Include="../../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" /> - </ItemGroup> - <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> - <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> - </PropertyGroup> -</Project>
\ No newline at end of file diff --git a/tests/src/CoreMangLib/cti/system/globalization/charunicodeinfo/CharUnicodeInfoGetUnicodeCategory2.csproj b/tests/src/CoreMangLib/cti/system/globalization/charunicodeinfo/CharUnicodeInfoGetUnicodeCategory2.csproj deleted file mode 100644 index 716b0f9ccf..0000000000 --- a/tests/src/CoreMangLib/cti/system/globalization/charunicodeinfo/CharUnicodeInfoGetUnicodeCategory2.csproj +++ /dev/null @@ -1,45 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> - <PropertyGroup> - <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> - <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> - <SchemaVersion>2.0</SchemaVersion> - <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> - <OutputType>Exe</OutputType> - <AppDesignerFolder>Properties</AppDesignerFolder> - <FileAlignment>512</FileAlignment> - <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> - <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> - <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> - <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> - <AllowUnsafeBlocks>true</AllowUnsafeBlocks> - <ReferenceLocalMscorlib>false</ReferenceLocalMscorlib> - <CLRTestKind>BuildAndRun</CLRTestKind> - <CLRTestPriority>1</CLRTestPriority> - </PropertyGroup> - <!-- Default configurations to help VS understand the configurations --> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> - </PropertyGroup> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> - </PropertyGroup> - <ItemGroup> - <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> - <Visible>False</Visible> - </CodeAnalysisDependentAssemblyPaths> - </ItemGroup> - <ItemGroup> - <!-- Add Compile Object Here --> - <Compile Include="charunicodeinfogetunicodecategory2.cs" /> - </ItemGroup> - <ItemGroup> - <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> - </ItemGroup> - <ItemGroup> - <ProjectReference Include="../../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" /> - <ProjectReference Include="../../../../../Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" /> - </ItemGroup> - <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> - <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> - </PropertyGroup> -</Project>
\ No newline at end of file diff --git a/tests/src/CoreMangLib/cti/system/globalization/charunicodeinfo/charunicodeinfogetnumericvalue1.cs b/tests/src/CoreMangLib/cti/system/globalization/charunicodeinfo/charunicodeinfogetnumericvalue1.cs deleted file mode 100644 index 01926ba435..0000000000 --- a/tests/src/CoreMangLib/cti/system/globalization/charunicodeinfo/charunicodeinfogetnumericvalue1.cs +++ /dev/null @@ -1,226 +0,0 @@ -// 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. -using System; -using System.Globalization; - -///<summary> -///System.Globalization.CharUnicodeInfo.GetNumericValue(Char) -///</summary> - -public class CharUnicodeInfoGetNumericValue -{ - - public static int Main() - { - CharUnicodeInfoGetNumericValue testObj = new CharUnicodeInfoGetNumericValue(); - TestLibrary.TestFramework.BeginTestCase("for method of System.Globalization.CharUnicodeInfo.GetNumericValue"); - if (testObj.RunTests()) - { - TestLibrary.TestFramework.EndTestCase(); - TestLibrary.TestFramework.LogInformation("PASS"); - return 100; - } - else - { - TestLibrary.TestFramework.EndTestCase(); - TestLibrary.TestFramework.LogInformation("FAIL"); - return 0; - } - - } - - public bool RunTests() - { - bool retVal = true; - retVal = PosTest1() && retVal; - retVal = PosTest2() && retVal; - retVal = PosTest3() && retVal; - retVal = PosTest4() && retVal; - retVal = PosTest5() && retVal; - retVal = PosTest6() && retVal; - return retVal; - } - - - #region Test Logic - public bool PosTest1() - { - bool retVal = true; - - Char ch = '\0'; - - Double expectedValue = -1; - - Double actualValue; - - TestLibrary.TestFramework.BeginScenario(@"PosTest1:Test the method with '\0'"); - try - { - actualValue = CharUnicodeInfo.GetNumericValue(ch); - if (expectedValue != actualValue) - { - TestLibrary.TestFramework.LogError("001", "ExpectedValue(" + expectedValue + ") !=ActualValue(" + actualValue + ")"); - retVal = false; - } - - } - catch (Exception e) - { - TestLibrary.TestFramework.LogError("002", "Unexpected exception:" + e); - retVal = false; - } - return retVal; - } - - public bool PosTest2() - { - bool retVal = true; - - Char ch = '0'; - - Double expectedValue = 0; - - Double actualValue; - - TestLibrary.TestFramework.BeginScenario("PosTest1:Test the method with char '0'"); - try - { - actualValue = CharUnicodeInfo.GetNumericValue(ch); - if (expectedValue != actualValue) - { - TestLibrary.TestFramework.LogError("003", "ExpectedValue(" + expectedValue + ") !=ActualValue(" + actualValue + ")"); - retVal = false; - } - - } - catch (Exception e) - { - TestLibrary.TestFramework.LogError("004", "Unexpected exception:" + e); - retVal = false; - } - return retVal; - } - - public bool PosTest3() - { - bool retVal = true; - - Char ch = '9'; - - Double expectedValue = 9; - - Double actualValue; - - TestLibrary.TestFramework.BeginScenario("PosTest1:Test the method with char '9'"); - try - { - actualValue = CharUnicodeInfo.GetNumericValue(ch); - if (expectedValue != actualValue) - { - TestLibrary.TestFramework.LogError("005", "ExpectedValue(" + expectedValue + ") !=ActualValue(" + actualValue + ")"); - retVal = false; - } - - } - catch (Exception e) - { - TestLibrary.TestFramework.LogError("006", "Unexpected exception:" + e); - retVal = false; - } - return retVal; - } - - - public bool PosTest4() - { - bool retVal = true; - - Char ch = '\u3289'; - - Double expectedValue = 10; - - Double actualValue; - - TestLibrary.TestFramework.BeginScenario("PosTest1:Test the method with char '\\u3289'"); - try - { - actualValue = CharUnicodeInfo.GetNumericValue(ch); - if (expectedValue != actualValue) - { - TestLibrary.TestFramework.LogError("007", "ExpectedValue(" + expectedValue + ") !=ActualValue(" + actualValue + ")"); - retVal = false; - } - - } - catch (Exception e) - { - TestLibrary.TestFramework.LogError("008", "Unexpected exception:" + e); - retVal = false; - } - return retVal; - } - - - public bool PosTest5() - { - bool retVal = true; - - Char ch = 'a'; - - Double expectedValue = -1; - - Double actualValue; - - TestLibrary.TestFramework.BeginScenario("PosTest1:Test the method with char 'a'"); - try - { - actualValue = CharUnicodeInfo.GetNumericValue(ch); - if (expectedValue != actualValue) - { - TestLibrary.TestFramework.LogError("009", "ExpectedValue(" + expectedValue + ") !=ActualValue(" + actualValue + ")"); - retVal = false; - } - - } - catch (Exception e) - { - TestLibrary.TestFramework.LogError("010", "Unexpected exception:" + e); - retVal = false; - } - return retVal; - } - - - public bool PosTest6() - { - bool retVal = true; - - Char ch = 'Z'; - - Double expectedValue = -1; - - Double actualValue; - - TestLibrary.TestFramework.BeginScenario("PosTest1:Test the method with char 'Z'"); - try - { - actualValue = CharUnicodeInfo.GetNumericValue(ch); - if (expectedValue != actualValue) - { - TestLibrary.TestFramework.LogError("011", "ExpectedValue(" + expectedValue + ") !=ActualValue(" + actualValue + ")"); - retVal = false; - } - - } - catch (Exception e) - { - TestLibrary.TestFramework.LogError("012", "Unexpected exception:" + e); - retVal = false; - } - return retVal; - } - - - #endregion -} diff --git a/tests/src/CoreMangLib/cti/system/globalization/charunicodeinfo/charunicodeinfogetnumericvalue2.cs b/tests/src/CoreMangLib/cti/system/globalization/charunicodeinfo/charunicodeinfogetnumericvalue2.cs deleted file mode 100644 index 2e7403e65a..0000000000 --- a/tests/src/CoreMangLib/cti/system/globalization/charunicodeinfo/charunicodeinfogetnumericvalue2.cs +++ /dev/null @@ -1,310 +0,0 @@ -// 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. -using System; -using System.Globalization; - -///<summary> -///System.Globalization.CharUnicodeInfo.GetNumericValue(System.String,System.Int32) -///</summary> - -public class CharUnicodeInfoGetNumericValue -{ - - public static int Main() - { - CharUnicodeInfoGetNumericValue testObj = new CharUnicodeInfoGetNumericValue(); - TestLibrary.TestFramework.BeginTestCase("for method of System.Globalization.CharUnicodeInfo.GetNumericValue"); - if (testObj.RunTests()) - { - TestLibrary.TestFramework.EndTestCase(); - TestLibrary.TestFramework.LogInformation("PASS"); - return 100; - } - else - { - TestLibrary.TestFramework.EndTestCase(); - TestLibrary.TestFramework.LogInformation("FAIL"); - return 0; - } - - } - - public bool RunTests() - { - bool retVal = true; - retVal = PosTest1() && retVal; - retVal = PosTest2() && retVal; - retVal = PosTest3() && retVal; - retVal = PosTest4() && retVal; - retVal = PosTest5() && retVal; - retVal = PosTest6() && retVal; - retVal = NegTest1() && retVal; - retVal = NegTest2() && retVal; - retVal = NegTest3() && retVal; - - return retVal; - } - - - #region Positive Test Logic - public bool PosTest1() - { - bool retVal = true; - - String str = "\009aZ\u0f33"; - - Double expectedValue = -1; - - Double actualValue; - - TestLibrary.TestFramework.BeginScenario(@"PosTest1:Test the method with '\0'"); - try - { - actualValue = CharUnicodeInfo.GetNumericValue(str,0); - if (expectedValue != actualValue) - { - TestLibrary.TestFramework.LogError("001", "ExpectedValue(" + expectedValue + ") !=ActualValue(" + actualValue + ")"); - retVal = false; - } - - } - catch (Exception e) - { - TestLibrary.TestFramework.LogError("002", "Unexpected exception:" + e); - retVal = false; - } - return retVal; - } - - public bool PosTest2() - { - bool retVal = true; - - String str = "\009aZ\u0f33"; - - Double expectedValue = 0; - - Double actualValue; - - TestLibrary.TestFramework.BeginScenario("PosTest1:Test the method with char '0'"); - try - { - actualValue = CharUnicodeInfo.GetNumericValue(str,1); - if (expectedValue != actualValue) - { - TestLibrary.TestFramework.LogError("003", "ExpectedValue(" + expectedValue + ") !=ActualValue(" + actualValue + ")"); - retVal = false; - } - - } - catch (Exception e) - { - TestLibrary.TestFramework.LogError("004", "Unexpected exception:" + e); - retVal = false; - } - return retVal; - } - - public bool PosTest3() - { - bool retVal = true; - - String str = "\009aZ\u0f33"; - - Double expectedValue = 9; - - Double actualValue; - - TestLibrary.TestFramework.BeginScenario("PosTest1:Test the method with char '9'"); - try - { - actualValue = CharUnicodeInfo.GetNumericValue(str,2); - if (expectedValue != actualValue) - { - TestLibrary.TestFramework.LogError("005", "ExpectedValue(" + expectedValue + ") !=ActualValue(" + actualValue + ")"); - retVal = false; - } - - } - catch (Exception e) - { - TestLibrary.TestFramework.LogError("006", "Unexpected exception:" + e); - retVal = false; - } - return retVal; - } - - - public bool PosTest4() - { - bool retVal = true; - - String str = "\009aZ\u0f33"; - - Double expectedValue = -1; - - Double actualValue; - - TestLibrary.TestFramework.BeginScenario("PosTest1:Test the method with char 'a'"); - try - { - actualValue = CharUnicodeInfo.GetNumericValue(str,3); - if (expectedValue != actualValue) - { - TestLibrary.TestFramework.LogError("007", "ExpectedValue(" + expectedValue + ") !=ActualValue(" + actualValue + ")"); - retVal = false; - } - - } - catch (Exception e) - { - TestLibrary.TestFramework.LogError("008", "Unexpected exception:" + e); - retVal = false; - } - return retVal; - } - - - public bool PosTest5() - { - bool retVal = true; - - String str = "\009aZ\u0f33"; - - Double expectedValue = -1; - - Double actualValue; - - TestLibrary.TestFramework.BeginScenario("PosTest1:Test the method with char 'Z'"); - try - { - actualValue = CharUnicodeInfo.GetNumericValue(str,4); - if (expectedValue != actualValue) - { - TestLibrary.TestFramework.LogError("009", "ExpectedValue(" + expectedValue + ") !=ActualValue(" + actualValue + ")"); - retVal = false; - } - - } - catch (Exception e) - { - TestLibrary.TestFramework.LogError("010", "Unexpected exception:" + e); - retVal = false; - } - return retVal; - } - - - public bool PosTest6() - { - bool retVal = true; - - String str = "\009aZ\u0f33"; - - Double expectedValue = -0.5; - - Double actualValue; - - TestLibrary.TestFramework.BeginScenario("PosTest1:Test the method with char '\\u0f33'"); - try - { - actualValue = CharUnicodeInfo.GetNumericValue(str,5); - if (expectedValue != actualValue) - { - TestLibrary.TestFramework.LogError("011", "ExpectedValue(" + expectedValue + ") !=ActualValue(" + actualValue + ")"); - retVal = false; - } - - } - catch (Exception e) - { - TestLibrary.TestFramework.LogError("012", "Unexpected exception:" + e); - retVal = false; - } - return retVal; - } - - #endregion - - #region Negative Test Logic - - public bool NegTest1() - { - bool retVal = true; - - String str = null; - Double actureValue = 0; - - TestLibrary.TestFramework.BeginScenario("NegTest1:Invoke the method with null string"); - try - { - actureValue = CharUnicodeInfo.GetNumericValue(str, 0); - TestLibrary.TestFramework.LogError("013", "No ArgumentNullExcepthion thrown out expected."); - retVal = false; - } - catch (ArgumentNullException) - { - - } - catch (Exception e) - { - TestLibrary.TestFramework.LogError("014", "Unexpected exception:" + e); - retVal = false; - } - return retVal; - } - - public bool NegTest2() - { - bool retVal = true; - - String str = TestLibrary.Generator.GetString(-55, false,1,5); - Double actureValue = 0; - - TestLibrary.TestFramework.BeginScenario("NegTest1:Invoke the method with index out of left range"); - try - { - actureValue = CharUnicodeInfo.GetNumericValue(str, -1); - TestLibrary.TestFramework.LogError("014", "No ArgumentNullExcepthion thrown out expected."); - retVal = false; - } - catch (ArgumentOutOfRangeException) - { - - } - catch (Exception e) - { - TestLibrary.TestFramework.LogError("015", "Unexpected exception:" + e); - retVal = false; - } - return retVal; - } - - public bool NegTest3() - { - bool retVal = true; - - String str = TestLibrary.Generator.GetString(-55, false, 1, 5); - Double actureValue = 0; - - TestLibrary.TestFramework.BeginScenario("NegTest1:Invoke the method with index out of right range"); - try - { - actureValue = CharUnicodeInfo.GetNumericValue(str, 5); - TestLibrary.TestFramework.LogError("014", "No ArgumentNullExcepthion thrown out expected."); - retVal = false; - } - catch (ArgumentOutOfRangeException) - { - - } - catch (Exception e) - { - TestLibrary.TestFramework.LogError("015", "Unexpected exception:" + e); - retVal = false; - } - return retVal; - } - #endregion -} diff --git a/tests/src/CoreMangLib/cti/system/globalization/charunicodeinfo/charunicodeinfogetunicodecategory1.cs b/tests/src/CoreMangLib/cti/system/globalization/charunicodeinfo/charunicodeinfogetunicodecategory1.cs deleted file mode 100644 index ee79c21e2a..0000000000 --- a/tests/src/CoreMangLib/cti/system/globalization/charunicodeinfo/charunicodeinfogetunicodecategory1.cs +++ /dev/null @@ -1,944 +0,0 @@ -// 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. -using System; -using System.Globalization; - -///<summary> -///System.Globalization.CharUnicodeInfo.GetUnicodeCategory(System.Char) -///</summary> - -public class CharUnicodeInfoGetUnicodeCategory -{ - - public static int Main() - { - CharUnicodeInfoGetUnicodeCategory testObj = new CharUnicodeInfoGetUnicodeCategory(); - TestLibrary.TestFramework.BeginTestCase("for method of System.Globalization.CharUnicodeInfo.GetUnicodeCategory"); - if (testObj.RunTests()) - { - TestLibrary.TestFramework.EndTestCase(); - TestLibrary.TestFramework.LogInformation("PASS"); - return 100; - } - else - { - TestLibrary.TestFramework.EndTestCase(); - TestLibrary.TestFramework.LogInformation("FAIL"); - return 0; - } - - } - - public bool RunTests() - { - bool retVal = true; - retVal = PosTest1() && retVal; - retVal = PosTest2() && retVal; - retVal = PosTest3() && retVal; - retVal = PosTest4() && retVal; - retVal = PosTest5() && retVal; - retVal = PosTest6() && retVal; - retVal = PosTest7() && retVal; - retVal = PosTest8() && retVal; - retVal = PosTest9() && retVal; - retVal = PosTest10() && retVal; - retVal = PosTest11() && retVal; - retVal = PosTest12() && retVal; - retVal = PosTest13() && retVal; - retVal = PosTest14() && retVal; - retVal = PosTest15() && retVal; - retVal = PosTest16() && retVal; - retVal = PosTest17() && retVal; - retVal = PosTest18() && retVal; - retVal = PosTest19() && retVal; - retVal = PosTest20() && retVal; - retVal = PosTest21() && retVal; - retVal = PosTest22() && retVal; - retVal = PosTest23() && retVal; - retVal = PosTest24() && retVal; - retVal = PosTest25() && retVal; - retVal = PosTest26() && retVal; - retVal = PosTest27() && retVal; - retVal = PosTest28() && retVal; - retVal = PosTest29() && retVal; - retVal = PosTest30() && retVal; - return retVal; - } - - - #region Test Logic - public bool PosTest1() - { - bool retVal = true; - - Char ch = 'A'; - - int expectedValue = (int)UnicodeCategory.UppercaseLetter; - - int actualValue; - - TestLibrary.TestFramework.BeginScenario("PosTest1:Test the method with upper letter"); - - try - { - actualValue = (int)(CharUnicodeInfo.GetUnicodeCategory(ch)); - - if (expectedValue != actualValue) - { - TestLibrary.TestFramework.LogError("001", "ExpectedValue(" + expectedValue + ") !=ActualValue(" + actualValue + ") when char is '" + ch + "'" ); - retVal = false; - } - - } - catch (Exception e) - { - TestLibrary.TestFramework.LogError("002", "when char is '" + ch + "',Unexpected exception:" + e); - retVal = false; - } - return retVal; - } - - public bool PosTest2() - { - bool retVal = true; - - Char ch = 'a'; - - int expectedValue = (int)UnicodeCategory.LowercaseLetter; - - int actualValue; - - TestLibrary.TestFramework.BeginScenario("PosTest2:Test the method with low case char"); - try - { - actualValue = (int)(CharUnicodeInfo.GetUnicodeCategory(ch)); - if (expectedValue != actualValue) - { - TestLibrary.TestFramework.LogError("003", "ExpectedValue(" + expectedValue + ") !=ActualValue(" + actualValue + ")"); - retVal = false; - } - - } - catch (Exception e) - { - TestLibrary.TestFramework.LogError("004", "when char is '" + ch + "',Unexpected exception:" + e); - retVal = false; - } - return retVal; - } - - public bool PosTest3() - { - bool retVal = true; - - Char ch = '\u1fa8'; //this char is a TitlecaseLetter char - - int expectedValue = (int)UnicodeCategory.TitlecaseLetter; - - int actualValue; - - TestLibrary.TestFramework.BeginScenario("PosTest3:Test the method with '\\0'"); - try - { - actualValue = (int)(CharUnicodeInfo.GetUnicodeCategory(ch)); - if (expectedValue != actualValue) - { - TestLibrary.TestFramework.LogError("005", "ExpectedValue(" + expectedValue + ") !=ActualValue(" + actualValue + ")"); - retVal = false; - } - - } - catch (Exception e) - { - TestLibrary.TestFramework.LogError("006", "when char is '" + ch + "',Unexpected exception:" + e); - retVal = false; - } - return retVal; - } - - - public bool PosTest4() - { - bool retVal = true; - - Char ch = '\u02b0'; - - int expectedValue = (int)UnicodeCategory.ModifierLetter; - - int actualValue; - - TestLibrary.TestFramework.BeginScenario("PosTest4:Test the method with '\\u02b0'"); - try - { - actualValue = (int)(CharUnicodeInfo.GetUnicodeCategory(ch)); - if (expectedValue != actualValue) - { - TestLibrary.TestFramework.LogError("007", "ExpectedValue(" + expectedValue + ") !=ActualValue(" + actualValue + ")"); - retVal = false; - } - - } - catch (Exception e) - { - TestLibrary.TestFramework.LogError("008", "when char is '" + ch + "',Unexpected exception:" + e); - retVal = false; - } - return retVal; - } - - public bool PosTest5() - { - bool retVal = true; - - Char ch = '\u404e'; - - int expectedValue = (int)UnicodeCategory.OtherLetter; - - int actualValue; - - TestLibrary.TestFramework.BeginScenario("PosTest5:Test the method with '\\u404e'"); - try - { - actualValue = (int)(CharUnicodeInfo.GetUnicodeCategory(ch)); - if (expectedValue != actualValue) - { - TestLibrary.TestFramework.LogError("009", "ExpectedValue(" + expectedValue + ") !=ActualValue(" + actualValue + ")"); - retVal = false; - } - - } - catch (Exception e) - { - TestLibrary.TestFramework.LogError("010", "when char is '" + ch + "',Unexpected exception:" + e); - retVal = false; - } - return retVal; - } - - public bool PosTest6() - { - bool retVal = true; - - Char ch = '\u0300'; - - int expectedValue = (int)UnicodeCategory.NonSpacingMark; - - int actualValue; - - TestLibrary.TestFramework.BeginScenario("PosTest6:Test the method with '\\u0300'"); - try - { - actualValue = (int)(CharUnicodeInfo.GetUnicodeCategory(ch)); - if (expectedValue != actualValue) - { - TestLibrary.TestFramework.LogError("011", "ExpectedValue(" + expectedValue + ") !=ActualValue(" + actualValue + ")"); - retVal = false; - } - - } - catch (Exception e) - { - TestLibrary.TestFramework.LogError("012", "when char is '" + ch + "',Unexpected exception:" + e); - retVal = false; - } - return retVal; - } - - public bool PosTest7() - { - bool retVal = true; - - Char ch = '\u0903'; - - int expectedValue = (int)UnicodeCategory.SpacingCombiningMark; - - int actualValue; - - TestLibrary.TestFramework.BeginScenario("PosTest7:Test the method with '\\u0903'"); - try - { - actualValue = (int)(CharUnicodeInfo.GetUnicodeCategory(ch)); - if (expectedValue != actualValue) - { - TestLibrary.TestFramework.LogError("013", "ExpectedValue(" + expectedValue + ") !=ActualValue(" + actualValue + ")"); - retVal = false; - } - - } - catch (Exception e) - { - TestLibrary.TestFramework.LogError("014", "when char is '" + ch + "',Unexpected exception:" + e); - retVal = false; - } - return retVal; - } - - public bool PosTest8() - { - bool retVal = true; - - Char ch = '\u0488'; - - int expectedValue = (int)UnicodeCategory.EnclosingMark; - - int actualValue; - - TestLibrary.TestFramework.BeginScenario("PosTest8:Test the method with '\\u0488'"); - try - { - actualValue = (int)(CharUnicodeInfo.GetUnicodeCategory(ch)); - if (expectedValue != actualValue) - { - TestLibrary.TestFramework.LogError("017", "ExpectedValue(" + expectedValue + ") !=ActualValue(" + actualValue + ")"); - retVal = false; - } - - } - catch (Exception e) - { - TestLibrary.TestFramework.LogError("018", "when char is '" + ch + "',Unexpected exception:" + e); - retVal = false; - } - return retVal; - } - - public bool PosTest9() - { - bool retVal = true; - - Char ch = '0'; - - int expectedValue = (int)UnicodeCategory.DecimalDigitNumber; - - int actualValue; - - TestLibrary.TestFramework.BeginScenario("PosTest9:Test the method with '0'"); - try - { - actualValue = (int)(CharUnicodeInfo.GetUnicodeCategory(ch)); - if (expectedValue != actualValue) - { - TestLibrary.TestFramework.LogError("017", "ExpectedValue(" + expectedValue + ") !=ActualValue(" + actualValue + ")"); - retVal = false; - } - - } - catch (Exception e) - { - TestLibrary.TestFramework.LogError("018", "when char is '" + ch + "',Unexpected exception:" + e); - retVal = false; - } - return retVal; - } - - public bool PosTest10() - { - bool retVal = true; - - Char ch = '\u16ee'; - - int expectedValue = (int)UnicodeCategory.LetterNumber; - - int actualValue; - - TestLibrary.TestFramework.BeginScenario("PosTest10:Test the method with '\\u16ee'"); - try - { - actualValue = (int)(CharUnicodeInfo.GetUnicodeCategory(ch)); - if (expectedValue != actualValue) - { - TestLibrary.TestFramework.LogError("019", "ExpectedValue(" + expectedValue + ") !=ActualValue(" + actualValue + ")"); - retVal = false; - } - - } - catch (Exception e) - { - TestLibrary.TestFramework.LogError("020", "when char is '" + ch + "',Unexpected exception:" + e); - retVal = false; - } - return retVal; - } - - public bool PosTest11() - { - bool retVal = true; - - Char ch = '\u00b2'; - - int expectedValue = (int)UnicodeCategory.OtherNumber; - - int actualValue; - - TestLibrary.TestFramework.BeginScenario("PosTest11:Test the method with '\\u00b2'"); - try - { - actualValue = (int)(CharUnicodeInfo.GetUnicodeCategory(ch)); - if (expectedValue != actualValue) - { - TestLibrary.TestFramework.LogError("021", "ExpectedValue(" + expectedValue + ") !=ActualValue(" + actualValue + ")"); - retVal = false; - } - - } - catch (Exception e) - { - TestLibrary.TestFramework.LogError("022", "when char is '" + ch + "',Unexpected exception:" + e); - retVal = false; - } - return retVal; - } - - public bool PosTest12() - { - bool retVal = true; - - Char ch = '\u0020'; - - int expectedValue = (int)UnicodeCategory.SpaceSeparator; - - int actualValue; - - TestLibrary.TestFramework.BeginScenario("PosTest12:Test the method with '\\u0020'"); - try - { - actualValue = (int)(CharUnicodeInfo.GetUnicodeCategory(ch)); - if (expectedValue != actualValue) - { - TestLibrary.TestFramework.LogError("023", "ExpectedValue(" + expectedValue + ") !=ActualValue(" + actualValue + ")"); - retVal = false; - } - - } - catch (Exception e) - { - TestLibrary.TestFramework.LogError("024", "when char is '" + ch + "',Unexpected exception:" + e); - retVal = false; - } - return retVal; - } - - public bool PosTest13() - { - bool retVal = true; - - Char ch = '\u2028'; - - int expectedValue = (int)UnicodeCategory.LineSeparator; - - int actualValue; - - TestLibrary.TestFramework.BeginScenario("PosTest13:Test the method with '\\u2028'"); - try - { - actualValue = (int)(CharUnicodeInfo.GetUnicodeCategory(ch)); - if (expectedValue != actualValue) - { - TestLibrary.TestFramework.LogError("025", "ExpectedValue(" + expectedValue + ") !=ActualValue(" + actualValue + ")"); - retVal = false; - } - - } - catch (Exception e) - { - TestLibrary.TestFramework.LogError("026", "when char is '" + ch + "',Unexpected exception:" + e); - retVal = false; - } - return retVal; - } - - public bool PosTest14() - { - bool retVal = true; - - Char ch = '\u2029'; - - int expectedValue = (int)UnicodeCategory.ParagraphSeparator; - - int actualValue; - - TestLibrary.TestFramework.BeginScenario("PosTest14:Test the method with '\\u2029'"); - try - { - actualValue = (int)(CharUnicodeInfo.GetUnicodeCategory(ch)); - if (expectedValue != actualValue) - { - TestLibrary.TestFramework.LogError("027", "ExpectedValue(" + expectedValue + ") !=ActualValue(" + actualValue + ")"); - retVal = false; - } - - } - catch (Exception e) - { - TestLibrary.TestFramework.LogError("028", "when char is '" + ch + "',Unexpected exception:" + e); - retVal = false; - } - return retVal; - } - - public bool PosTest15() - { - bool retVal = true; - - Char ch = '\0'; - - int expectedValue = (int)UnicodeCategory.Control; - - int actualValue; - - TestLibrary.TestFramework.BeginScenario("PosTest15:Test the method with '\\0'"); - try - { - actualValue = (int)(CharUnicodeInfo.GetUnicodeCategory(ch)); - if (expectedValue != actualValue) - { - TestLibrary.TestFramework.LogError("029", "ExpectedValue(" + expectedValue + ") !=ActualValue(" + actualValue + ")"); - retVal = false; - } - - } - catch (Exception e) - { - TestLibrary.TestFramework.LogError("030", "when char is '" + ch + "',Unexpected exception:" + e); - retVal = false; - } - return retVal; - } - - public bool PosTest16() - { - bool retVal = true; - - Char ch = '\u00ad'; - - int expectedValue = (int)UnicodeCategory.Format; - - int actualValue; - - TestLibrary.TestFramework.BeginScenario("PosTest16:Test the method with '\\u00ad'"); - try - { - actualValue = (int)(CharUnicodeInfo.GetUnicodeCategory(ch)); - if (expectedValue != actualValue) - { - TestLibrary.TestFramework.LogError("031", "ExpectedValue(" + expectedValue + ") !=ActualValue(" + actualValue + ")"); - retVal = false; - } - - } - catch (Exception e) - { - TestLibrary.TestFramework.LogError("032", "when char is '" + ch + "',Unexpected exception:" + e); - retVal = false; - } - return retVal; - } - - public bool PosTest17() - { - bool retVal = true; - - Char ch = '\ud800'; - - int expectedValue = (int)UnicodeCategory.Surrogate; - - int actualValue; - - TestLibrary.TestFramework.BeginScenario("PosTest17:Test the method with '\\ud800'"); - try - { - actualValue = (int)(CharUnicodeInfo.GetUnicodeCategory(ch)); - if (expectedValue != actualValue) - { - TestLibrary.TestFramework.LogError("033", "ExpectedValue(" + expectedValue + ") !=ActualValue(" + actualValue + ")"); - retVal = false; - } - - } - catch (Exception e) - { - TestLibrary.TestFramework.LogError("034", "when char is '" + ch + "',Unexpected exception:" + e); - retVal = false; - } - return retVal; - } - - public bool PosTest18() - { - bool retVal = true; - - Char ch = '\ue000'; - - int expectedValue = (int)UnicodeCategory.PrivateUse; - - int actualValue; - - TestLibrary.TestFramework.BeginScenario("PosTest18:Test the method with '\\ue000'"); - try - { - actualValue = (int)(CharUnicodeInfo.GetUnicodeCategory(ch)); - if (expectedValue != actualValue) - { - TestLibrary.TestFramework.LogError("035", "ExpectedValue(" + expectedValue + ") !=ActualValue(" + actualValue + ")"); - retVal = false; - } - - } - catch (Exception e) - { - TestLibrary.TestFramework.LogError("036", "when char is '" + ch + "',Unexpected exception:" + e); - retVal = false; - } - return retVal; - } - - public bool PosTest19() - { - bool retVal = true; - - Char ch = '\u005f'; - - int expectedValue = (int)UnicodeCategory.ConnectorPunctuation; - - int actualValue; - - TestLibrary.TestFramework.BeginScenario("PosTest19:Test the method with '\\u005f'"); - try - { - actualValue = (int)(CharUnicodeInfo.GetUnicodeCategory(ch)); - if (expectedValue != actualValue) - { - TestLibrary.TestFramework.LogError("037", "ExpectedValue(" + expectedValue + ") !=ActualValue(" + actualValue + ")"); - retVal = false; - } - - } - catch (Exception e) - { - TestLibrary.TestFramework.LogError("038", "when char is '" + ch + "',Unexpected exception:" + e); - retVal = false; - } - return retVal; - } - - public bool PosTest20() - { - bool retVal = true; - - Char ch = '-'; - - int expectedValue = (int)UnicodeCategory.DashPunctuation; - - int actualValue; - - TestLibrary.TestFramework.BeginScenario("PosTest20:Test the method with '-'"); - try - { - actualValue = (int)(CharUnicodeInfo.GetUnicodeCategory(ch)); - if (expectedValue != actualValue) - { - TestLibrary.TestFramework.LogError("039", "ExpectedValue(" + expectedValue + ") !=ActualValue(" + actualValue + ")"); - retVal = false; - } - - } - catch (Exception e) - { - TestLibrary.TestFramework.LogError("040", "when char is '" + ch + "',Unexpected exception:" + e); - retVal = false; - } - return retVal; - } - - public bool PosTest21() - { - bool retVal = true; - - Char ch = '('; - - int expectedValue = (int)UnicodeCategory.OpenPunctuation; - - int actualValue; - - TestLibrary.TestFramework.BeginScenario("PosTest21:Test the method with '('"); - try - { - actualValue = (int)(CharUnicodeInfo.GetUnicodeCategory(ch)); - if (expectedValue != actualValue) - { - TestLibrary.TestFramework.LogError("041", "ExpectedValue(" + expectedValue + ") !=ActualValue(" + actualValue + ")"); - retVal = false; - } - - } - catch (Exception e) - { - TestLibrary.TestFramework.LogError("042", "when char is '" + ch + "',Unexpected exception:" + e); - retVal = false; - } - return retVal; - } - - public bool PosTest22() - { - bool retVal = true; - - Char ch = ')'; - - int expectedValue = (int)UnicodeCategory.ClosePunctuation; - - int actualValue; - - TestLibrary.TestFramework.BeginScenario("PosTest22:Test the method with ')'"); - try - { - actualValue = (int)(CharUnicodeInfo.GetUnicodeCategory(ch)); - if (expectedValue != actualValue) - { - TestLibrary.TestFramework.LogError("043", "ExpectedValue(" + expectedValue + ") !=ActualValue(" + actualValue + ")"); - retVal = false; - } - - } - catch (Exception e) - { - TestLibrary.TestFramework.LogError("044", "when char is '" + ch + "',Unexpected exception:" + e); - retVal = false; - } - return retVal; - } - - public bool PosTest23() - { - bool retVal = true; - - Char ch = '\u00ab'; - - int expectedValue = (int)UnicodeCategory.InitialQuotePunctuation; - - int actualValue; - - TestLibrary.TestFramework.BeginScenario("PosTest23:Test the method with '\\u00ab'"); - try - { - actualValue = (int)(CharUnicodeInfo.GetUnicodeCategory(ch)); - if (expectedValue != actualValue) - { - TestLibrary.TestFramework.LogError("045", "ExpectedValue(" + expectedValue + ") !=ActualValue(" + actualValue + ")"); - retVal = false; - } - - } - catch (Exception e) - { - TestLibrary.TestFramework.LogError("046", "when char is '" + ch + "',Unexpected exception:" + e); - retVal = false; - } - return retVal; - } - - public bool PosTest24() - { - bool retVal = true; - - Char ch = '\u00bb'; - - int expectedValue = (int)UnicodeCategory.FinalQuotePunctuation; - - int actualValue; - - TestLibrary.TestFramework.BeginScenario("PosTest24:Test the method with '\\u00bb'"); - try - { - actualValue = (int)(CharUnicodeInfo.GetUnicodeCategory(ch)); - if (expectedValue != actualValue) - { - TestLibrary.TestFramework.LogError("047", "ExpectedValue(" + expectedValue + ") !=ActualValue(" + actualValue + ")"); - retVal = false; - } - - } - catch (Exception e) - { - TestLibrary.TestFramework.LogError("048", "when char is '" + ch + "',Unexpected exception:" + e); - retVal = false; - } - return retVal; - } - - public bool PosTest25() - { - bool retVal = true; - - Char ch = '!'; - - int expectedValue = (int)UnicodeCategory.OtherPunctuation; - - int actualValue; - - TestLibrary.TestFramework.BeginScenario("PosTest25:Test the method with '!'"); - try - { - actualValue = (int)(CharUnicodeInfo.GetUnicodeCategory(ch)); - if (expectedValue != actualValue) - { - TestLibrary.TestFramework.LogError("049", "ExpectedValue(" + expectedValue + ") !=ActualValue(" + actualValue + ")"); - retVal = false; - } - - } - catch (Exception e) - { - TestLibrary.TestFramework.LogError("050", "when char is '" + ch + "',Unexpected exception:" + e); - retVal = false; - } - return retVal; - } - - public bool PosTest26() - { - bool retVal = true; - - Char ch = '+'; - - int expectedValue = (int)UnicodeCategory.MathSymbol; - - int actualValue; - - TestLibrary.TestFramework.BeginScenario("PosTest26:Test the method with '+'"); - try - { - actualValue = (int)(CharUnicodeInfo.GetUnicodeCategory(ch)); - if (expectedValue != actualValue) - { - TestLibrary.TestFramework.LogError("051", "ExpectedValue(" + expectedValue + ") !=ActualValue(" + actualValue + ")"); - retVal = false; - } - - } - catch (Exception e) - { - TestLibrary.TestFramework.LogError("052", "when char is '" + ch + "',Unexpected exception:" + e); - retVal = false; - } - return retVal; - } - - public bool PosTest27() - { - bool retVal = true; - - Char ch = '$'; - - int expectedValue = (int)UnicodeCategory.CurrencySymbol; - - int actualValue; - - TestLibrary.TestFramework.BeginScenario("PosTest27:Test the method with '$'"); - try - { - actualValue = (int)(CharUnicodeInfo.GetUnicodeCategory(ch)); - if (expectedValue != actualValue) - { - TestLibrary.TestFramework.LogError("053", "ExpectedValue(" + expectedValue + ") !=ActualValue(" + actualValue + ")"); - retVal = false; - } - - } - catch (Exception e) - { - TestLibrary.TestFramework.LogError("054", "when char is '" + ch + "',Unexpected exception:" + e); - retVal = false; - } - return retVal; - } - - public bool PosTest28() - { - bool retVal = true; - - Char ch = '^'; - - int expectedValue = (int)UnicodeCategory.ModifierSymbol; - - int actualValue; - - TestLibrary.TestFramework.BeginScenario("PosTest28:Test the method with '^'"); - try - { - actualValue = (int)(CharUnicodeInfo.GetUnicodeCategory(ch)); - if (expectedValue != actualValue) - { - TestLibrary.TestFramework.LogError("055", "ExpectedValue(" + expectedValue + ") !=ActualValue(" + actualValue + ")"); - retVal = false; - } - - } - catch (Exception e) - { - TestLibrary.TestFramework.LogError("056", "when char is '" + ch + "',Unexpected exception:" + e); - retVal = false; - } - return retVal; - } - - public bool PosTest29() - { - bool retVal = true; - - Char ch = '\u00a6'; - - int expectedValue = (int)UnicodeCategory.OtherSymbol; - - int actualValue; - - TestLibrary.TestFramework.BeginScenario("PosTest29:Test the method with '\\u00a6'"); - try - { - actualValue = (int)(CharUnicodeInfo.GetUnicodeCategory(ch)); - if (expectedValue != actualValue) - { - TestLibrary.TestFramework.LogError("057", "ExpectedValue(" + expectedValue + ") !=ActualValue(" + actualValue + ")"); - retVal = false; - } - - } - catch (Exception e) - { - TestLibrary.TestFramework.LogError("058", "when char is '" + ch + "',Unexpected exception:" + e); - retVal = false; - } - return retVal; - } - - public bool PosTest30() - { - bool retVal = true; - - Char ch = '\u0242'; - - int expectedValue = (int)UnicodeCategory.LowercaseLetter; - - int actualValue; - - TestLibrary.TestFramework.BeginScenario("PosTest30:Test the method with '\\u0242'"); - try - { - actualValue = (int)(CharUnicodeInfo.GetUnicodeCategory(ch)); - if (expectedValue != actualValue) - { - TestLibrary.TestFramework.LogError("059", "ExpectedValue(" + expectedValue + ") !=ActualValue(" + actualValue + ")"); - retVal = false; - } - - } - catch (Exception e) - { - TestLibrary.TestFramework.LogError("060", "when char is '" + ch + "',Unexpected exception:" + e); - retVal = false; - } - return retVal; - } - #endregion -} diff --git a/tests/src/CoreMangLib/cti/system/globalization/charunicodeinfo/charunicodeinfogetunicodecategory2.cs b/tests/src/CoreMangLib/cti/system/globalization/charunicodeinfo/charunicodeinfogetunicodecategory2.cs deleted file mode 100644 index 200ece2abc..0000000000 --- a/tests/src/CoreMangLib/cti/system/globalization/charunicodeinfo/charunicodeinfogetunicodecategory2.cs +++ /dev/null @@ -1,1040 +0,0 @@ -// 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. -using System; -using System.Globalization; - -///<summary> -///System.Globalization.CharUnicodeInfo.GetUnicodeCategory(System.String,System.Int32) -///</summary> - -public class CharUnicodeInfoGetUnicodeCategory -{ - public String str = "Aa\u1fa8\u02b0\u404e\u0300\u0903\u0488\u0030\u16ee\u00b2\u0020\u2028\u2029\0\u00ad\ud800\ue000\u005f\u002d()\u00ab\u00bb!+$^\u00a6\u0242"; - - public static int Main() - { - CharUnicodeInfoGetUnicodeCategory testObj = new CharUnicodeInfoGetUnicodeCategory(); - TestLibrary.TestFramework.BeginTestCase("for method of System.Globalization.CharUnicodeInfo.GetUnicodeCategory"); - if (testObj.RunTests()) - { - TestLibrary.TestFramework.EndTestCase(); - TestLibrary.TestFramework.LogInformation("PASS"); - return 100; - } - else - { - TestLibrary.TestFramework.EndTestCase(); - TestLibrary.TestFramework.LogInformation("FAIL"); - return 0; - } - - } - - public bool RunTests() - { - bool retVal = true; - retVal = PosTest1() && retVal; - retVal = PosTest2() && retVal; - retVal = PosTest3() && retVal; - retVal = PosTest4() && retVal; - retVal = PosTest5() && retVal; - retVal = PosTest6() && retVal; - retVal = PosTest7() && retVal; - retVal = PosTest8() && retVal; - retVal = PosTest9() && retVal; - retVal = PosTest10() && retVal; - retVal = PosTest11() && retVal; - retVal = PosTest12() && retVal; - retVal = PosTest13() && retVal; - retVal = PosTest14() && retVal; - retVal = PosTest15() && retVal; - retVal = PosTest16() && retVal; - retVal = PosTest17() && retVal; - retVal = PosTest18() && retVal; - retVal = PosTest19() && retVal; - retVal = PosTest20() && retVal; - retVal = PosTest21() && retVal; - retVal = PosTest22() && retVal; - retVal = PosTest23() && retVal; - retVal = PosTest24() && retVal; - retVal = PosTest25() && retVal; - retVal = PosTest26() && retVal; - retVal = PosTest27() && retVal; - retVal = PosTest28() && retVal; - retVal = PosTest29() && retVal; - retVal = PosTest30() && retVal; - - retVal = NegTest1() && retVal; - retVal = NegTest2() && retVal; - retVal = NegTest3() && retVal; - return retVal; - } - - - #region Positive Test Logic - public bool PosTest1() - { - bool retVal = true; - - Char ch = 'A'; - - int expectedValue = (int)UnicodeCategory.UppercaseLetter; - - int actualValue; - - TestLibrary.TestFramework.BeginScenario("PosTest1:Test the method with upper letter"); - - try - { - actualValue = (int)(CharUnicodeInfo.GetUnicodeCategory(str,0)); - - if (expectedValue != actualValue) - { - TestLibrary.TestFramework.LogError("001", "ExpectedValue(" + expectedValue + ") !=ActualValue(" + actualValue + ") when char is '" + ch + "'"); - retVal = false; - } - - } - catch (Exception e) - { - TestLibrary.TestFramework.LogError("002", "when char is '" + ch + "',Unexpected exception:" + e); - retVal = false; - } - return retVal; - } - - public bool PosTest2() - { - bool retVal = true; - - Char ch = 'a'; - - int expectedValue = (int)UnicodeCategory.LowercaseLetter; - - int actualValue; - - TestLibrary.TestFramework.BeginScenario("PosTest2:Test the method with low case char"); - try - { - actualValue = (int)(CharUnicodeInfo.GetUnicodeCategory(str,1)); - if (expectedValue != actualValue) - { - TestLibrary.TestFramework.LogError("003", "ExpectedValue(" + expectedValue + ") !=ActualValue(" + actualValue + ")"); - retVal = false; - } - - } - catch (Exception e) - { - TestLibrary.TestFramework.LogError("004", "when char is '" + ch + "',Unexpected exception:" + e); - retVal = false; - } - return retVal; - } - - public bool PosTest3() - { - bool retVal = true; - - Char ch = '\0'; - - int expectedValue = (int)UnicodeCategory.TitlecaseLetter; - - int actualValue; - - TestLibrary.TestFramework.BeginScenario("PosTest3:Test the method with '\\0'"); - try - { - actualValue = (int)(CharUnicodeInfo.GetUnicodeCategory(str,2)); - if (expectedValue != actualValue) - { - TestLibrary.TestFramework.LogError("005", "ExpectedValue(" + expectedValue + ") !=ActualValue(" + actualValue + ")"); - retVal = false; - } - - } - catch (Exception e) - { - TestLibrary.TestFramework.LogError("006", "when char is '" + ch + "',Unexpected exception:" + e); - retVal = false; - } - return retVal; - } - - - public bool PosTest4() - { - bool retVal = true; - - Char ch = '\u02b0'; - - int expectedValue = (int)UnicodeCategory.ModifierLetter; - - int actualValue; - - TestLibrary.TestFramework.BeginScenario("PosTest4:Test the method with '\\u02b0'"); - try - { - actualValue = (int)(CharUnicodeInfo.GetUnicodeCategory(str,3)); - if (expectedValue != actualValue) - { - TestLibrary.TestFramework.LogError("007", "ExpectedValue(" + expectedValue + ") !=ActualValue(" + actualValue + ")"); - retVal = false; - } - - } - catch (Exception e) - { - TestLibrary.TestFramework.LogError("008", "when char is '" + ch + "',Unexpected exception:" + e); - retVal = false; - } - return retVal; - } - - public bool PosTest5() - { - bool retVal = true; - - Char ch = '\u404e'; - - int expectedValue = (int)UnicodeCategory.OtherLetter; - - int actualValue; - - TestLibrary.TestFramework.BeginScenario("PosTest5:Test the method with '\\u404e'"); - try - { - actualValue = (int)(CharUnicodeInfo.GetUnicodeCategory(str,4)); - if (expectedValue != actualValue) - { - TestLibrary.TestFramework.LogError("009", "ExpectedValue(" + expectedValue + ") !=ActualValue(" + actualValue + ")"); - retVal = false; - } - - } - catch (Exception e) - { - TestLibrary.TestFramework.LogError("010", "when char is '" + ch + "',Unexpected exception:" + e); - retVal = false; - } - return retVal; - } - - public bool PosTest6() - { - bool retVal = true; - - Char ch = '\u0300'; - - int expectedValue = (int)UnicodeCategory.NonSpacingMark; - - int actualValue; - - TestLibrary.TestFramework.BeginScenario("PosTest6:Test the method with '\\u0300'"); - try - { - actualValue = (int)(CharUnicodeInfo.GetUnicodeCategory(str,5)); - if (expectedValue != actualValue) - { - TestLibrary.TestFramework.LogError("011", "ExpectedValue(" + expectedValue + ") !=ActualValue(" + actualValue + ")"); - retVal = false; - } - - } - catch (Exception e) - { - TestLibrary.TestFramework.LogError("012", "when char is '" + ch + "',Unexpected exception:" + e); - retVal = false; - } - return retVal; - } - - public bool PosTest7() - { - bool retVal = true; - - Char ch = '\u0903'; - - int expectedValue = (int)UnicodeCategory.SpacingCombiningMark; - - int actualValue; - - TestLibrary.TestFramework.BeginScenario("PosTest7:Test the method with '\\u0903'"); - try - { - actualValue = (int)(CharUnicodeInfo.GetUnicodeCategory(str,6)); - if (expectedValue != actualValue) - { - TestLibrary.TestFramework.LogError("013", "ExpectedValue(" + expectedValue + ") !=ActualValue(" + actualValue + ")"); - retVal = false; - } - - } - catch (Exception e) - { - TestLibrary.TestFramework.LogError("014", "when char is '" + ch + "',Unexpected exception:" + e); - retVal = false; - } - return retVal; - } - - public bool PosTest8() - { - bool retVal = true; - - Char ch = '\u0488'; - - int expectedValue = (int)UnicodeCategory.EnclosingMark; - - int actualValue; - - TestLibrary.TestFramework.BeginScenario("PosTest8:Test the method with '\\u0488'"); - try - { - actualValue = (int)(CharUnicodeInfo.GetUnicodeCategory(str,7)); - if (expectedValue != actualValue) - { - TestLibrary.TestFramework.LogError("017", "ExpectedValue(" + expectedValue + ") !=ActualValue(" + actualValue + ")"); - retVal = false; - } - - } - catch (Exception e) - { - TestLibrary.TestFramework.LogError("018", "when char is '" + ch + "',Unexpected exception:" + e); - retVal = false; - } - return retVal; - } - - public bool PosTest9() - { - bool retVal = true; - - Char ch = '0'; - - int expectedValue = (int)UnicodeCategory.DecimalDigitNumber; - - int actualValue; - - TestLibrary.TestFramework.BeginScenario("PosTest9:Test the method with '0'"); - try - { - actualValue = (int)(CharUnicodeInfo.GetUnicodeCategory(str,8)); - if (expectedValue != actualValue) - { - TestLibrary.TestFramework.LogError("017", "ExpectedValue(" + expectedValue + ") !=ActualValue(" + actualValue + ")"); - retVal = false; - } - - } - catch (Exception e) - { - TestLibrary.TestFramework.LogError("018", "when char is '" + ch + "',Unexpected exception:" + e); - retVal = false; - } - return retVal; - } - - public bool PosTest10() - { - bool retVal = true; - - Char ch = '\u16ee'; - - int expectedValue = (int)UnicodeCategory.LetterNumber; - - int actualValue; - - TestLibrary.TestFramework.BeginScenario("PosTest10:Test the method with '\\u16ee'"); - try - { - actualValue = (int)(CharUnicodeInfo.GetUnicodeCategory(str,9)); - if (expectedValue != actualValue) - { - TestLibrary.TestFramework.LogError("019", "ExpectedValue(" + expectedValue + ") !=ActualValue(" + actualValue + ")"); - retVal = false; - } - - } - catch (Exception e) - { - TestLibrary.TestFramework.LogError("020", "when char is '" + ch + "',Unexpected exception:" + e); - retVal = false; - } - return retVal; - } - - public bool PosTest11() - { - bool retVal = true; - - Char ch = '\u00b2'; - - int expectedValue = (int)UnicodeCategory.OtherNumber; - - int actualValue; - - TestLibrary.TestFramework.BeginScenario("PosTest11:Test the method with '\\u00b2'"); - try - { - actualValue = (int)(CharUnicodeInfo.GetUnicodeCategory(str,10)); - if (expectedValue != actualValue) - { - TestLibrary.TestFramework.LogError("021", "ExpectedValue(" + expectedValue + ") !=ActualValue(" + actualValue + ")"); - retVal = false; - } - - } - catch (Exception e) - { - TestLibrary.TestFramework.LogError("022", "when char is '" + ch + "',Unexpected exception:" + e); - retVal = false; - } - return retVal; - } - - public bool PosTest12() - { - bool retVal = true; - - Char ch = '\u0020'; - - int expectedValue = (int)UnicodeCategory.SpaceSeparator; - - int actualValue; - - TestLibrary.TestFramework.BeginScenario("PosTest12:Test the method with '\\u0020'"); - try - { - actualValue = (int)(CharUnicodeInfo.GetUnicodeCategory(str,11)); - if (expectedValue != actualValue) - { - TestLibrary.TestFramework.LogError("023", "ExpectedValue(" + expectedValue + ") !=ActualValue(" + actualValue + ")"); - retVal = false; - } - - } - catch (Exception e) - { - TestLibrary.TestFramework.LogError("024", "when char is '" + ch + "',Unexpected exception:" + e); - retVal = false; - } - return retVal; - } - - public bool PosTest13() - { - bool retVal = true; - - Char ch = '\u2028'; - - int expectedValue = (int)UnicodeCategory.LineSeparator; - - int actualValue; - - TestLibrary.TestFramework.BeginScenario("PosTest13:Test the method with '\\u2028'"); - try - { - actualValue = (int)(CharUnicodeInfo.GetUnicodeCategory(str,12)); - if (expectedValue != actualValue) - { - TestLibrary.TestFramework.LogError("025", "ExpectedValue(" + expectedValue + ") !=ActualValue(" + actualValue + ")"); - retVal = false; - } - - } - catch (Exception e) - { - TestLibrary.TestFramework.LogError("026", "when char is '" + ch + "',Unexpected exception:" + e); - retVal = false; - } - return retVal; - } - - public bool PosTest14() - { - bool retVal = true; - - Char ch = '\u2029'; - - int expectedValue = (int)UnicodeCategory.ParagraphSeparator; - - int actualValue; - - TestLibrary.TestFramework.BeginScenario("PosTest14:Test the method with '\\u2029'"); - try - { - actualValue = (int)(CharUnicodeInfo.GetUnicodeCategory(str,13)); - if (expectedValue != actualValue) - { - TestLibrary.TestFramework.LogError("027", "ExpectedValue(" + expectedValue + ") !=ActualValue(" + actualValue + ")"); - retVal = false; - } - - } - catch (Exception e) - { - TestLibrary.TestFramework.LogError("028", "when char is '" + ch + "',Unexpected exception:" + e); - retVal = false; - } - return retVal; - } - - public bool PosTest15() - { - bool retVal = true; - - Char ch = '\0'; - - int expectedValue = (int)UnicodeCategory.Control; - - int actualValue; - - TestLibrary.TestFramework.BeginScenario("PosTest15:Test the method with '\\0'"); - try - { - actualValue = (int)(CharUnicodeInfo.GetUnicodeCategory(str,14)); - if (expectedValue != actualValue) - { - TestLibrary.TestFramework.LogError("029", "ExpectedValue(" + expectedValue + ") !=ActualValue(" + actualValue + ")"); - retVal = false; - } - - } - catch (Exception e) - { - TestLibrary.TestFramework.LogError("030", "when char is '" + ch + "',Unexpected exception:" + e); - retVal = false; - } - return retVal; - } - - public bool PosTest16() - { - bool retVal = true; - - Char ch = '\u00ad'; - - int expectedValue = (int)UnicodeCategory.Format; - - int actualValue; - - TestLibrary.TestFramework.BeginScenario("PosTest16:Test the method with '\\u00ad'"); - try - { - actualValue = (int)(CharUnicodeInfo.GetUnicodeCategory(str,15)); - if (expectedValue != actualValue) - { - TestLibrary.TestFramework.LogError("031", "ExpectedValue(" + expectedValue + ") !=ActualValue(" + actualValue + ")"); - retVal = false; - } - - } - catch (Exception e) - { - TestLibrary.TestFramework.LogError("032", "when char is '" + ch + "',Unexpected exception:" + e); - retVal = false; - } - return retVal; - } - - public bool PosTest17() - { - bool retVal = true; - - Char ch = '\ud800'; - - int expectedValue = (int)UnicodeCategory.Surrogate; - - int actualValue; - - TestLibrary.TestFramework.BeginScenario("PosTest17:Test the method with '\\ud800'"); - try - { - actualValue = (int)(CharUnicodeInfo.GetUnicodeCategory(str,16)); - if (expectedValue != actualValue) - { - TestLibrary.TestFramework.LogError("033", "ExpectedValue(" + expectedValue + ") !=ActualValue(" + actualValue + ")"); - retVal = false; - } - - } - catch (Exception e) - { - TestLibrary.TestFramework.LogError("034", "when char is '" + ch + "',Unexpected exception:" + e); - retVal = false; - } - return retVal; - } - - public bool PosTest18() - { - bool retVal = true; - - Char ch = '\ue000'; - - int expectedValue = (int)UnicodeCategory.PrivateUse; - - int actualValue; - - TestLibrary.TestFramework.BeginScenario("PosTest18:Test the method with '\\ue000'"); - try - { - actualValue = (int)(CharUnicodeInfo.GetUnicodeCategory(str,17)); - if (expectedValue != actualValue) - { - TestLibrary.TestFramework.LogError("035", "ExpectedValue(" + expectedValue + ") !=ActualValue(" + actualValue + ")"); - retVal = false; - } - - } - catch (Exception e) - { - TestLibrary.TestFramework.LogError("036", "when char is '" + ch + "',Unexpected exception:" + e); - retVal = false; - } - return retVal; - } - - public bool PosTest19() - { - bool retVal = true; - - Char ch = '\u005f'; - - int expectedValue = (int)UnicodeCategory.ConnectorPunctuation; - - int actualValue; - - TestLibrary.TestFramework.BeginScenario("PosTest19:Test the method with '\\u005f'"); - try - { - actualValue = (int)(CharUnicodeInfo.GetUnicodeCategory(str,18)); - if (expectedValue != actualValue) - { - TestLibrary.TestFramework.LogError("037", "ExpectedValue(" + expectedValue + ") !=ActualValue(" + actualValue + ")"); - retVal = false; - } - - } - catch (Exception e) - { - TestLibrary.TestFramework.LogError("038", "when char is '" + ch + "',Unexpected exception:" + e); - retVal = false; - } - return retVal; - } - - public bool PosTest20() - { - bool retVal = true; - - Char ch = '-'; - - int expectedValue = (int)UnicodeCategory.DashPunctuation; - - int actualValue; - - TestLibrary.TestFramework.BeginScenario("PosTest20:Test the method with '-'"); - try - { - actualValue = (int)(CharUnicodeInfo.GetUnicodeCategory(str,19)); - if (expectedValue != actualValue) - { - TestLibrary.TestFramework.LogError("039", "ExpectedValue(" + expectedValue + ") !=ActualValue(" + actualValue + ")"); - retVal = false; - } - - } - catch (Exception e) - { - TestLibrary.TestFramework.LogError("040", "when char is '" + ch + "',Unexpected exception:" + e); - retVal = false; - } - return retVal; - } - - public bool PosTest21() - { - bool retVal = true; - - Char ch = '('; - - int expectedValue = (int)UnicodeCategory.OpenPunctuation; - - int actualValue; - - TestLibrary.TestFramework.BeginScenario("PosTest21:Test the method with '('"); - try - { - actualValue = (int)(CharUnicodeInfo.GetUnicodeCategory(str,20)); - if (expectedValue != actualValue) - { - TestLibrary.TestFramework.LogError("041", "ExpectedValue(" + expectedValue + ") !=ActualValue(" + actualValue + ")"); - retVal = false; - } - - } - catch (Exception e) - { - TestLibrary.TestFramework.LogError("042", "when char is '" + ch + "',Unexpected exception:" + e); - retVal = false; - } - return retVal; - } - - public bool PosTest22() - { - bool retVal = true; - - Char ch = ')'; - - int expectedValue = (int)UnicodeCategory.ClosePunctuation; - - int actualValue; - - TestLibrary.TestFramework.BeginScenario("PosTest22:Test the method with ')'"); - try - { - actualValue = (int)(CharUnicodeInfo.GetUnicodeCategory(str,21)); - if (expectedValue != actualValue) - { - TestLibrary.TestFramework.LogError("043", "ExpectedValue(" + expectedValue + ") !=ActualValue(" + actualValue + ")"); - retVal = false; - } - - } - catch (Exception e) - { - TestLibrary.TestFramework.LogError("044", "when char is '" + ch + "',Unexpected exception:" + e); - retVal = false; - } - return retVal; - } - - public bool PosTest23() - { - bool retVal = true; - - Char ch = '\u00ab'; - - int expectedValue = (int)UnicodeCategory.InitialQuotePunctuation; - - int actualValue; - - TestLibrary.TestFramework.BeginScenario("PosTest23:Test the method with '\\u00ab'"); - try - { - actualValue = (int)(CharUnicodeInfo.GetUnicodeCategory(str,22)); - if (expectedValue != actualValue) - { - TestLibrary.TestFramework.LogError("045", "ExpectedValue(" + expectedValue + ") !=ActualValue(" + actualValue + ")"); - retVal = false; - } - - } - catch (Exception e) - { - TestLibrary.TestFramework.LogError("046", "when char is '" + ch + "',Unexpected exception:" + e); - retVal = false; - } - return retVal; - } - - public bool PosTest24() - { - bool retVal = true; - - Char ch = '\u00bb'; - - int expectedValue = (int)UnicodeCategory.FinalQuotePunctuation; - - int actualValue; - - TestLibrary.TestFramework.BeginScenario("PosTest24:Test the method with '\\u00bb'"); - try - { - actualValue = (int)(CharUnicodeInfo.GetUnicodeCategory(str,23)); - if (expectedValue != actualValue) - { - TestLibrary.TestFramework.LogError("047", "ExpectedValue(" + expectedValue + ") !=ActualValue(" + actualValue + ")"); - retVal = false; - } - - } - catch (Exception e) - { - TestLibrary.TestFramework.LogError("048", "when char is '" + ch + "',Unexpected exception:" + e); - retVal = false; - } - return retVal; - } - - public bool PosTest25() - { - bool retVal = true; - - Char ch = '!'; - - int expectedValue = (int)UnicodeCategory.OtherPunctuation; - - int actualValue; - - TestLibrary.TestFramework.BeginScenario("PosTest25:Test the method with '!'"); - try - { - actualValue = (int)(CharUnicodeInfo.GetUnicodeCategory(str,24)); - if (expectedValue != actualValue) - { - TestLibrary.TestFramework.LogError("049", "ExpectedValue(" + expectedValue + ") !=ActualValue(" + actualValue + ")"); - retVal = false; - } - - } - catch (Exception e) - { - TestLibrary.TestFramework.LogError("050", "when char is '" + ch + "',Unexpected exception:" + e); - retVal = false; - } - return retVal; - } - - public bool PosTest26() - { - bool retVal = true; - - Char ch = '+'; - - int expectedValue = (int)UnicodeCategory.MathSymbol; - - int actualValue; - - TestLibrary.TestFramework.BeginScenario("PosTest26:Test the method with '+'"); - try - { - actualValue = (int)(CharUnicodeInfo.GetUnicodeCategory(str,25)); - if (expectedValue != actualValue) - { - TestLibrary.TestFramework.LogError("051", "ExpectedValue(" + expectedValue + ") !=ActualValue(" + actualValue + ")"); - retVal = false; - } - - } - catch (Exception e) - { - TestLibrary.TestFramework.LogError("052", "when char is '" + ch + "',Unexpected exception:" + e); - retVal = false; - } - return retVal; - } - - public bool PosTest27() - { - bool retVal = true; - - Char ch = '$'; - - int expectedValue = (int)UnicodeCategory.CurrencySymbol; - - int actualValue; - - TestLibrary.TestFramework.BeginScenario("PosTest27:Test the method with '$'"); - try - { - actualValue = (int)(CharUnicodeInfo.GetUnicodeCategory(str,26)); - if (expectedValue != actualValue) - { - TestLibrary.TestFramework.LogError("053", "ExpectedValue(" + expectedValue + ") !=ActualValue(" + actualValue + ")"); - retVal = false; - } - - } - catch (Exception e) - { - TestLibrary.TestFramework.LogError("054", "when char is '" + ch + "',Unexpected exception:" + e); - retVal = false; - } - return retVal; - } - - public bool PosTest28() - { - bool retVal = true; - - Char ch = '^'; - - int expectedValue = (int)UnicodeCategory.ModifierSymbol; - - int actualValue; - - TestLibrary.TestFramework.BeginScenario("PosTest28:Test the method with '^'"); - try - { - actualValue = (int)(CharUnicodeInfo.GetUnicodeCategory(str,27)); - if (expectedValue != actualValue) - { - TestLibrary.TestFramework.LogError("055", "ExpectedValue(" + expectedValue + ") !=ActualValue(" + actualValue + ")"); - retVal = false; - } - - } - catch (Exception e) - { - TestLibrary.TestFramework.LogError("056", "when char is '" + ch + "',Unexpected exception:" + e); - retVal = false; - } - return retVal; - } - - public bool PosTest29() - { - bool retVal = true; - - Char ch = '\u00a6'; - - int expectedValue = (int)UnicodeCategory.OtherSymbol; - - int actualValue; - - TestLibrary.TestFramework.BeginScenario("PosTest29:Test the method with '\\u00a6'"); - try - { - actualValue = (int)(CharUnicodeInfo.GetUnicodeCategory(str,28)); - if (expectedValue != actualValue) - { - TestLibrary.TestFramework.LogError("057", "ExpectedValue(" + expectedValue + ") !=ActualValue(" + actualValue + ")"); - retVal = false; - } - - } - catch (Exception e) - { - TestLibrary.TestFramework.LogError("058", "when char is '" + ch + "',Unexpected exception:" + e); - retVal = false; - } - return retVal; - } - - public bool PosTest30() - { - bool retVal = true; - - Char ch = '\u0242'; - - // The values 0242 thru 024F on the Mac PPC (which is unicode 4.0) are OtherNotAssigned - // On Whidbey (QFE branch), Telesto and Intel Mac this 0242 has the value of LowercaseLetter - int expectedValue = (int)UnicodeCategory.LowercaseLetter; - if ((!TestLibrary.Utilities.IsWindows) && (TestLibrary.Utilities.IsBigEndian)) - { - expectedValue = (int)UnicodeCategory.OtherNotAssigned; - } - - int actualValue; - - TestLibrary.TestFramework.BeginScenario("PosTest30:Test the method with '\\u0242'"); - try - { - actualValue = (int) CharUnicodeInfo.GetUnicodeCategory(str,29); - if (expectedValue != actualValue) - { - TestLibrary.TestFramework.LogError("059", "ExpectedValue(" + expectedValue + ") !=ActualValue(" + actualValue + ")"); - retVal = false; - } - - } - catch (Exception e) - { - TestLibrary.TestFramework.LogError("060", "when char is '" + ch + "',Unexpected exception:" + e); - retVal = false; - } - return retVal; - } - #endregion - - #region Negative Test Logic - - public bool NegTest1() - { - bool retVal = true; - - String testStr = null; - - int actualValue; - - TestLibrary.TestFramework.BeginScenario("NegTest1:Invoke the method with null string"); - try - { - actualValue = (int)CharUnicodeInfo.GetUnicodeCategory(testStr, 0); - TestLibrary.TestFramework.LogError("061", "No ArgumentNullExcepthion thrown out expected."); - retVal = false; - } - catch (ArgumentNullException) - { - - } - catch (Exception e) - { - TestLibrary.TestFramework.LogError("062", "Unexpected exception:" + e); - retVal = false; - } - return retVal; - } - - public bool NegTest2() - { - bool retVal = true; - - int actualValue; - - String testStr = TestLibrary.Generator.GetString(-55, false,1,5); - - TestLibrary.TestFramework.BeginScenario("NegTest2:Invoke the method with index out of left range."); - try - { - actualValue = (int)CharUnicodeInfo.GetUnicodeCategory(testStr, -1); - TestLibrary.TestFramework.LogError("063", "No ArgumentNullExcepthion thrown out expected."); - retVal = false; - } - catch (ArgumentOutOfRangeException) - { - - } - catch (Exception e) - { - TestLibrary.TestFramework.LogError("064", "Unexpected exception:" + e); - retVal = false; - } - return retVal; - } - - public bool NegTest3() - { - bool retVal = true; - - int actualValue; - - String testStr = TestLibrary.Generator.GetString(-55, false,1,5); - - TestLibrary.TestFramework.BeginScenario("NegTest3:Invoke the method with index out of right range"); - try - { - actualValue = (int)CharUnicodeInfo.GetUnicodeCategory(testStr, 6); - TestLibrary.TestFramework.LogError("065", "No ArgumentNullExcepthion thrown out expected."); - retVal = false; - } - catch (ArgumentOutOfRangeException) - { - - } - catch (Exception e) - { - TestLibrary.TestFramework.LogError("066", "Unexpected exception:" + e); - retVal = false; - } - return retVal; - } - - #endregion -} |