diff --git a/src/libraries/Common/tests/System/GenericMathTestMemberData.cs b/src/libraries/Common/tests/System/GenericMathTestMemberData.cs index 0cceb281ef407b..6161d414e92b41 100644 --- a/src/libraries/Common/tests/System/GenericMathTestMemberData.cs +++ b/src/libraries/Common/tests/System/GenericMathTestMemberData.cs @@ -1372,13 +1372,8 @@ public static IEnumerable MaxDouble yield return new object[] { double.NegativeInfinity, double.NaN, double.NaN }; yield return new object[] { double.NaN, double.PositiveInfinity, double.NaN }; yield return new object[] { double.NaN, double.NegativeInfinity, double.NaN }; - // [ActiveIssue("https://github.com/dotnet/runtime/issues/133311")] - // [ActiveIssue("https://github.com/dotnet/runtime/issues/134268")] - if (!((PlatformDetection.IsMonoRuntime && PlatformDetection.IsWasm) || PlatformDetection.IsWasmReadyToRun)) - { - yield return new object[] { PositiveNaNDouble, -0.0, PositiveNaNDouble }; - yield return new object[] { -0.0, NegativeNaNDouble, NegativeNaNDouble }; - } + yield return new object[] { PositiveNaNDouble, -0.0, PositiveNaNDouble }; + yield return new object[] { -0.0, NegativeNaNDouble, NegativeNaNDouble }; yield return new object[] { -0.0f, 0.0f, 0.0f }; yield return new object[] { 0.0f, -0.0f, 0.0f }; yield return new object[] { 2.0f, -3.0f, 2.0f }; @@ -1577,13 +1572,8 @@ public static IEnumerable MinDouble yield return new object[] { double.NegativeInfinity, double.NaN, double.NaN }; yield return new object[] { double.NaN, double.PositiveInfinity, double.NaN }; yield return new object[] { double.NaN, double.NegativeInfinity, double.NaN }; - // [ActiveIssue("https://github.com/dotnet/runtime/issues/133311")] - // [ActiveIssue("https://github.com/dotnet/runtime/issues/134268")] - if (!((PlatformDetection.IsMonoRuntime && PlatformDetection.IsWasm) || PlatformDetection.IsWasmReadyToRun)) - { - yield return new object[] { PositiveNaNDouble, -0.0, PositiveNaNDouble }; - yield return new object[] { -0.0, NegativeNaNDouble, NegativeNaNDouble }; - } + yield return new object[] { PositiveNaNDouble, -0.0, PositiveNaNDouble }; + yield return new object[] { -0.0, NegativeNaNDouble, NegativeNaNDouble }; yield return new object[] { -0.0f, 0.0f, -0.0f }; yield return new object[] { 0.0f, -0.0f, -0.0f }; yield return new object[] { 2.0f, -3.0f, -3.0f }; diff --git a/src/libraries/Common/tests/TestUtilities/System/AssertExtensions.cs b/src/libraries/Common/tests/TestUtilities/System/AssertExtensions.cs index cc3de8dba7d995..6d74a4da5a6080 100644 --- a/src/libraries/Common/tests/TestUtilities/System/AssertExtensions.cs +++ b/src/libraries/Common/tests/TestUtilities/System/AssertExtensions.cs @@ -1222,9 +1222,8 @@ public static void Equal(double expected, double actual) return; } - if (PlatformDetection.IsRiscV64Process && double.IsNaN(expected) && double.IsNaN(actual)) + if (!PlatformDetection.IsNaNPayloadPreservationExpected && double.IsNaN(expected) && double.IsNaN(actual)) { - // RISC-V does not preserve payload return; } @@ -1247,9 +1246,8 @@ static unsafe int SingleToInt32Bits(float value) return; } - if (PlatformDetection.IsRiscV64Process && float.IsNaN(expected) && float.IsNaN(actual)) + if (!PlatformDetection.IsNaNPayloadPreservationExpected && float.IsNaN(expected) && float.IsNaN(actual)) { - // RISC-V does not preserve payload return; } @@ -1268,9 +1266,8 @@ public static void Equal(Half expected, Half actual) return; } - if (PlatformDetection.IsRiscV64Process && Half.IsNaN(expected) && Half.IsNaN(actual)) + if (!PlatformDetection.IsNaNPayloadPreservationExpected && Half.IsNaN(expected) && Half.IsNaN(actual)) { - // RISC-V does not preserve payload return; } diff --git a/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.cs b/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.cs index 47db2845b1777b..5702019a9d0f3a 100644 --- a/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.cs +++ b/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.cs @@ -86,6 +86,10 @@ public static partial class PlatformDetection public static bool Is64BitProcess => IntPtr.Size == 8; public static bool IsNotWindows => !IsWindows; + // Test expectation for floating-point operations, not a platform-wide guarantee. + // Bitcasts and other explicitly bit-preserving operations should still be tested exactly. + public static bool IsNaNPayloadPreservationExpected => !IsRiscV64Process && !IsWasm; + private static volatile int s_isPrivilegedProcess = -1; public static bool IsPrivilegedProcess {