Delete Single/Double.GetHashCode tests (#16567)
authorJan Kotas <jkotas@microsoft.com>
Mon, 26 Feb 2018 17:29:23 +0000 (09:29 -0800)
committerGitHub <noreply@github.com>
Mon, 26 Feb 2018 17:29:23 +0000 (09:29 -0800)
The test is failing because of change in the -NaN hashcode. CoreFX has redundant and better test coverage for these.

Fixes #16566

tests/src/CoreMangLib/cti/system/double/DoubleGetHashCode.csproj [deleted file]
tests/src/CoreMangLib/cti/system/double/doublegethashcode.cs [deleted file]
tests/src/CoreMangLib/cti/system/single/SingleGetHashCode.csproj [deleted file]
tests/src/CoreMangLib/cti/system/single/singlegethashcode.cs [deleted file]

diff --git a/tests/src/CoreMangLib/cti/system/double/DoubleGetHashCode.csproj b/tests/src/CoreMangLib/cti/system/double/DoubleGetHashCode.csproj
deleted file mode 100644 (file)
index fbf6b4d..0000000
+++ /dev/null
@@ -1,40 +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>
-    <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
-    <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
-    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
-    <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="doublegethashcode.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/double/doublegethashcode.cs b/tests/src/CoreMangLib/cti/system/double/doublegethashcode.cs
deleted file mode 100644 (file)
index d06e2d1..0000000
+++ /dev/null
@@ -1,73 +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;
-
-/// <summary>
-/// GetHashCode
-/// </summary>
-
-public class DoubleGetHashCode
-{
-    #region Public Methods
-    public bool RunTests()
-    {
-        bool retVal = true;
-
-        TestLibrary.TestFramework.LogInformation("[Positive]");
-        retVal = PosTest1() && retVal;  
-        
-        return retVal;
-    }
-
-    #region Positive Test Cases
-    public bool PosTest1()
-    {
-        bool retVal = true;
-
-        TestLibrary.TestFramework.BeginScenario("PosTest1: check that if the return value is equal.");
-
-        try
-        {
-            Double i = TestLibrary.Generator.GetDouble(-55);
-            Double i1 = i;
-            Double i2 = i;
-
-            if (i1.GetHashCode() != i2.GetHashCode())
-            {
-                TestLibrary.TestFramework.LogError("001.1", "gethashcode is not equal  : " + i1);
-                retVal = false;
-            }
-        }
-        catch (Exception e)
-        {
-            TestLibrary.TestFramework.LogError("001.2", "Unexpected exception: " + e);
-            retVal = false;
-        }
-
-        return retVal;
-    }
-    #endregion
-
-    #endregion
-
-    public static int Main()
-    {
-        DoubleGetHashCode test = new DoubleGetHashCode();
-
-        TestLibrary.TestFramework.BeginTestCase("DoubleGetHashCode");
-
-        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/single/SingleGetHashCode.csproj b/tests/src/CoreMangLib/cti/system/single/SingleGetHashCode.csproj
deleted file mode 100644 (file)
index 3c2e1ca..0000000
+++ /dev/null
@@ -1,40 +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>
-    <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
-    <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
-    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
-    <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="singlegethashcode.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/single/singlegethashcode.cs b/tests/src/CoreMangLib/cti/system/single/singlegethashcode.cs
deleted file mode 100644 (file)
index af93605..0000000
+++ /dev/null
@@ -1,152 +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;
-/// <summary>
-/// GetHashCode
-/// </summary>
-public class SingleGetHashCode
-{
-    #region Public Methods
-    public bool RunTests()
-    {
-        bool retVal = true;
-
-        TestLibrary.TestFramework.LogInformation("[Positive]");
-        retVal = PosTest1() && retVal;
-        retVal = PosTest2() && retVal;
-        retVal = PosTest3() && retVal;
-        return retVal;
-    }
-
-    #region Positive Test Cases
-    public bool PosTest1()
-    {
-        bool retVal = true;
-
-        TestLibrary.TestFramework.BeginScenario("PosTest1: check a random Single has a correct hashcode.");
-
-        try
-        {
-            Single i1 = TestLibrary.Generator.GetSingle(-55);
-            int expectValue=GetExpectValue(i1);
-            int actualValue = i1.GetHashCode();
-            if (actualValue != expectValue)
-            {
-                TestLibrary.TestFramework.LogError("001.1", "GetHashCode return an error value. ");
-                retVal = false;
-            }
-        }
-        catch (Exception e)
-        {
-            TestLibrary.TestFramework.LogError("001.2", "Unexpected exception: " + e);
-            retVal = false;
-        }
-
-        return retVal;
-    }
-    public bool PosTest2()
-    {
-        bool retVal = true;
-
-        TestLibrary.TestFramework.BeginScenario("PosTest2: check 0 and -0  has a correct hashcode.");
-
-        try
-        {
-            Single i1 = (Single)0;
-            int expectValue = GetExpectValue(i1);
-            int actualValue = i1.GetHashCode();
-            if (actualValue != expectValue)
-            {
-                TestLibrary.TestFramework.LogError("002.1", "GetHashCode return an error value. ");
-                retVal = false;
-            }
-            i1 = (Single)(-0);
-            expectValue = GetExpectValue(i1);
-            actualValue = i1.GetHashCode();
-            if (actualValue != expectValue)
-            {
-                TestLibrary.TestFramework.LogError("002.2", "GetHashCode return an error value. ");
-                retVal = false;
-            }
-        }
-        catch (Exception e)
-        {
-            TestLibrary.TestFramework.LogError("002.3", "Unexpected exception: " + e);
-            retVal = false;
-        }
-
-        return retVal;
-    }
-    public bool PosTest3()
-    {
-        bool retVal = true;
-
-        TestLibrary.TestFramework.BeginScenario("PosTest3: check value  which is  not a number   has a correct hashcode.");
-
-        try
-        {
-            Single i1 = Single.NaN;
-            int expectValue = GetExpectValue(i1);
-            int actualValue = i1.GetHashCode();
-            if (actualValue != expectValue)
-            {
-                TestLibrary.TestFramework.LogError("003.1", "GetHashCode return an error value. ");
-                retVal = false;
-            }
-            i1 = Single.NegativeInfinity;
-            expectValue = GetExpectValue(i1);
-            actualValue = i1.GetHashCode();
-            if (actualValue != expectValue)
-            {
-                TestLibrary.TestFramework.LogError("003.2", "GetHashCode return an error value. ");
-                retVal = false;
-            }
-            i1 = Single.PositiveInfinity;
-            expectValue = GetExpectValue(i1);
-            actualValue = i1.GetHashCode();
-            if (actualValue != expectValue)
-            {
-                TestLibrary.TestFramework.LogError("003.3", "GetHashCode return an error value. ");
-                retVal = false;
-            }
-        }
-        catch (Exception e)
-        {
-            TestLibrary.TestFramework.LogError("003.4", "Unexpected exception: " + e);
-            retVal = false;
-        }
-
-        return retVal;
-    }
-    #endregion
-
-    #endregion
-
-    public static int Main()
-    {
-        SingleGetHashCode test = new SingleGetHashCode();
-
-        TestLibrary.TestFramework.BeginTestCase("SingleGetHashCode");
-
-        if (test.RunTests())
-        {
-            TestLibrary.TestFramework.EndTestCase();
-            TestLibrary.TestFramework.LogInformation("PASS");
-            return 100;
-        }
-        else
-        {
-            TestLibrary.TestFramework.EndTestCase();
-            TestLibrary.TestFramework.LogInformation("FAIL");
-            return 0;
-        }
-    }
-    #region private method
-    public unsafe  int GetExpectValue(float myValue )
-    {
-        int v = BitConverter.ToInt32(BitConverter.GetBytes(myValue), 0);
-        return v;
-    }
-    #endregion
-}