diff options
author | Jiyoung Yun <jy910.yun@samsung.com> | 2016-11-23 19:09:09 +0900 |
---|---|---|
committer | Jiyoung Yun <jy910.yun@samsung.com> | 2016-11-23 19:09:09 +0900 |
commit | 4b4aad7217d3292650e77eec2cf4c198ea9c3b4b (patch) | |
tree | 98110734c91668dfdbb126fcc0e15ddbd93738ca /tests/src/CoreMangLib/cti/system/runtimefieldhandle | |
parent | fa45f57ed55137c75ac870356a1b8f76c84b229c (diff) | |
download | coreclr-4b4aad7217d3292650e77eec2cf4c198ea9c3b4b.tar.gz coreclr-4b4aad7217d3292650e77eec2cf4c198ea9c3b4b.tar.bz2 coreclr-4b4aad7217d3292650e77eec2cf4c198ea9c3b4b.zip |
Imported Upstream version 1.1.0upstream/1.1.0
Diffstat (limited to 'tests/src/CoreMangLib/cti/system/runtimefieldhandle')
4 files changed, 394 insertions, 0 deletions
diff --git a/tests/src/CoreMangLib/cti/system/runtimefieldhandle/RuntimeFieldHandleEquals.csproj b/tests/src/CoreMangLib/cti/system/runtimefieldhandle/RuntimeFieldHandleEquals.csproj new file mode 100644 index 0000000000..d854a94841 --- /dev/null +++ b/tests/src/CoreMangLib/cti/system/runtimefieldhandle/RuntimeFieldHandleEquals.csproj @@ -0,0 +1,45 @@ +<?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="runtimefieldhandleequals.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/runtimefieldhandle/RuntimeFieldHandleGetHashCode.csproj b/tests/src/CoreMangLib/cti/system/runtimefieldhandle/RuntimeFieldHandleGetHashCode.csproj new file mode 100644 index 0000000000..88e7b1533d --- /dev/null +++ b/tests/src/CoreMangLib/cti/system/runtimefieldhandle/RuntimeFieldHandleGetHashCode.csproj @@ -0,0 +1,45 @@ +<?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="runtimefieldhandlegethashcode.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/runtimefieldhandle/runtimefieldhandleequals.cs b/tests/src/CoreMangLib/cti/system/runtimefieldhandle/runtimefieldhandleequals.cs new file mode 100644 index 0000000000..fdd58e3753 --- /dev/null +++ b/tests/src/CoreMangLib/cti/system/runtimefieldhandle/runtimefieldhandleequals.cs @@ -0,0 +1,172 @@ +// 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; + +/// <summary> +/// Equals(System.Object) [v-jianq] +/// </summary> + +public class RuntimeFieldHandleEquals +{ + #region Public Methods + public bool RunTests() + { + bool retVal = true; + + TestLibrary.TestFramework.LogInformation("[Positive]"); + retVal = PosTest1() && retVal; + retVal = PosTest2() && retVal; + retVal = PosTest3() && retVal; + + // + // TODO: Add your negative test cases here + // + // TestLibrary.TestFramework.LogInformation("[Negative]"); + // retVal = NegTest1() && retVal; + + return retVal; + } + + #region Positive Test Cases + public bool PosTest1() + { + bool retVal = true; + + // Add your scenario description here + TestLibrary.TestFramework.BeginScenario("PosTest1: Verify a struct RuntimeFieldHandle equals to itself."); + + try + { + RuntimeFieldHandle rfh = new RuntimeFieldHandle(); + + bool expected = true; + bool actual = rfh.Equals(rfh); + + if (actual != expected) + { + TestLibrary.TestFramework.LogError("001.1", "Method Equals Err."); + TestLibrary.TestFramework.LogInformation("WARNING [LOCAL VARIABLE] actual = " + actual + ", expected = " + expected); + retVal = false; + } + } + catch (Exception e) + { + TestLibrary.TestFramework.LogError("001.2", "Unexpected exception: " + e); + TestLibrary.TestFramework.LogInformation(e.StackTrace); + retVal = false; + } + + return retVal; + } + + public bool PosTest2() + { + bool retVal = true; + + // Add your scenario description here + TestLibrary.TestFramework.BeginScenario("PosTest2: Verify two struct RuntimeFieldHandle equals."); + + try + { + RuntimeFieldHandle rfh1 = new RuntimeFieldHandle(); + RuntimeFieldHandle rfh2 = new RuntimeFieldHandle(); + + bool expected = true; + bool actual = rfh1.Equals(rfh2); + + if (actual != expected) + { + TestLibrary.TestFramework.LogError("002.1", "Method Equals Err."); + TestLibrary.TestFramework.LogInformation("WARNING [LOCAL VARIABLE] actual = " + actual + ", expected = " + expected); + retVal = false; + } + } + catch (Exception e) + { + TestLibrary.TestFramework.LogError("002.2", "Unexpected exception: " + e); + TestLibrary.TestFramework.LogInformation(e.StackTrace); + retVal = false; + } + + return retVal; + } + + public bool PosTest3() + { + bool retVal = true; + + // Add your scenario description here + TestLibrary.TestFramework.BeginScenario("PosTest3: Verify a struct RuntimeFieldHandle is not equals to a object."); + + try + { + RuntimeFieldHandle rfh = new RuntimeFieldHandle(); + object obj = new object(); + + bool expected = false; + bool actual = rfh.Equals(obj); + + if (actual != expected) + { + TestLibrary.TestFramework.LogError("003.1", "Method Equals Err."); + TestLibrary.TestFramework.LogInformation("WARNING [LOCAL VARIABLE] actual = " + actual + ", expected = " + expected); + retVal = false; + } + } + catch (Exception e) + { + TestLibrary.TestFramework.LogError("003.2", "Unexpected exception: " + e); + TestLibrary.TestFramework.LogInformation(e.StackTrace); + retVal = false; + } + + return retVal; + } + #endregion + + #region Nagetive Test Cases + //public bool NegTest1() + //{ + // bool retVal = true; + + // TestLibrary.TestFramework.BeginScenario("NegTest1: "); + + // try + // { + // // + // // Add your test logic here + // // + // } + // catch (Exception e) + // { + // TestLibrary.TestFramework.LogError("101", "Unexpected exception: " + e); + // TestLibrary.TestFramework.LogInformation(e.StackTrace); + // retVal = false; + // } + + // return retVal; + //} + #endregion + #endregion + + public static int Main() + { + RuntimeFieldHandleEquals test = new RuntimeFieldHandleEquals(); + + TestLibrary.TestFramework.BeginTestCase("RuntimeFieldHandleEquals"); + + if (test.RunTests()) + { + TestLibrary.TestFramework.EndTestCase(); + TestLibrary.TestFramework.LogInformation("PASS"); + return 100; + } + else + { + TestLibrary.TestFramework.EndTestCase(); + TestLibrary.TestFramework.LogInformation("FAIL"); + return 0; + } + } +} diff --git a/tests/src/CoreMangLib/cti/system/runtimefieldhandle/runtimefieldhandlegethashcode.cs b/tests/src/CoreMangLib/cti/system/runtimefieldhandle/runtimefieldhandlegethashcode.cs new file mode 100644 index 0000000000..7cf7065bf2 --- /dev/null +++ b/tests/src/CoreMangLib/cti/system/runtimefieldhandle/runtimefieldhandlegethashcode.cs @@ -0,0 +1,132 @@ +// 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; + +/// <summary> +/// GetHashCode [v-jianq] +/// </summary> + +public class RuntimeFieldHandleGetHashCode +{ + #region Public Methods + public bool RunTests() + { + bool retVal = true; + + TestLibrary.TestFramework.LogInformation("[Positive]"); + retVal = PosTest1() && retVal; + retVal = PosTest2() && retVal; + + // + // TODO: Add your negative test cases here + // + // TestLibrary.TestFramework.LogInformation("[Negative]"); + // retVal = NegTest1() && retVal; + + return retVal; + } + + #region Positive Test Cases + public bool PosTest1() + { + bool retVal = true; + + // Add your scenario description here + TestLibrary.TestFramework.BeginScenario("PosTest1: Verify two hashcode of RuntimeFieldHandle equals"); + + try + { + RuntimeFieldHandle rfh1 = new RuntimeFieldHandle(); + RuntimeFieldHandle rfh2 = new RuntimeFieldHandle(); + + if (rfh1.GetHashCode() != rfh2.GetHashCode()) + { + TestLibrary.TestFramework.LogError("001.1", "Method GetHashCode Err !"); + retVal = false; + } + } + catch (Exception e) + { + TestLibrary.TestFramework.LogError("001.2", "Unexpected exception: " + e); + TestLibrary.TestFramework.LogInformation(e.StackTrace); + retVal = false; + } + + return retVal; + } + + public bool PosTest2() + { + bool retVal = true; + + // Add your scenario description here + TestLibrary.TestFramework.BeginScenario("PosTest2: Verify a hashcode of RuntimeFieldHandle is not equal to object"); + + try + { + RuntimeFieldHandle rfh = new RuntimeFieldHandle(); + object obj = new object(); + + if (rfh.GetHashCode() == obj.GetHashCode()) + { + TestLibrary.TestFramework.LogError("001.1", "Method GetHashCode Err !"); + retVal = false; + } + } + catch (Exception e) + { + TestLibrary.TestFramework.LogError("001.2", "Unexpected exception: " + e); + TestLibrary.TestFramework.LogInformation(e.StackTrace); + retVal = false; + } + + return retVal; + } + #endregion + + #region Nagetive Test Cases + //public bool NegTest1() + //{ + // bool retVal = true; + + // TestLibrary.TestFramework.BeginScenario("NegTest1: "); + + // try + // { + // // + // // Add your test logic here + // // + // } + // catch (Exception e) + // { + // TestLibrary.TestFramework.LogError("101", "Unexpected exception: " + e); + // TestLibrary.TestFramework.LogInformation(e.StackTrace); + // retVal = false; + // } + + // return retVal; + //} + #endregion + #endregion + + public static int Main() + { + RuntimeFieldHandleGetHashCode test = new RuntimeFieldHandleGetHashCode(); + + TestLibrary.TestFramework.BeginTestCase("RuntimeFieldHandleGetHashCode"); + + if (test.RunTests()) + { + TestLibrary.TestFramework.EndTestCase(); + TestLibrary.TestFramework.LogInformation("PASS"); + return 100; + } + else + { + TestLibrary.TestFramework.EndTestCase(); + TestLibrary.TestFramework.LogInformation("FAIL"); + return 0; + } + } +} |