From 272b8f68721ba83de3a533237dce7b9b5faf437b Mon Sep 17 00:00:00 2001 From: Tanner Gooding Date: Fri, 12 Apr 2024 19:34:19 -0700 Subject: [PATCH] Fixing some tests for x86 and skipping some tests on Mono --- .../tests/Vectors/Vector128Tests.cs | 8 +++ .../tests/Vectors/Vector256Tests.cs | 8 +++ .../tests/Vectors/Vector512Tests.cs | 8 +++ .../tests/Vectors/Vector64Tests.cs | 8 +++ .../System/DoubleTests.GenericMath.cs | 58 +++++++----------- .../System/SingleTests.GenericMath.cs | 59 +++++++------------ 6 files changed, 75 insertions(+), 74 deletions(-) diff --git a/src/libraries/System.Runtime.Intrinsics/tests/Vectors/Vector128Tests.cs b/src/libraries/System.Runtime.Intrinsics/tests/Vectors/Vector128Tests.cs index 345da5e4553b8c..95cf6d16b66171 100644 --- a/src/libraries/System.Runtime.Intrinsics/tests/Vectors/Vector128Tests.cs +++ b/src/libraries/System.Runtime.Intrinsics/tests/Vectors/Vector128Tests.cs @@ -4875,6 +4875,7 @@ public void Log2SingleTest(float value, float expectedResult, float variance) } [Fact] + [SkipOnMono("https://github.com/dotnet/runtime/issues/100368")] public void ConvertToInt32Test() { Assert.Equal(Vector128.Create(int.MinValue), Vector128.ConvertToInt32(Vector128.Create(float.MinValue))); @@ -4883,6 +4884,7 @@ public void ConvertToInt32Test() } [Fact] + [SkipOnMono("https://github.com/dotnet/runtime/issues/100368")] public void ConvertToInt32NativeTest() { if (Vector128.IsHardwareAccelerated && Sse2.IsSupported) @@ -4898,6 +4900,7 @@ public void ConvertToInt32NativeTest() } [Fact] + [SkipOnMono("https://github.com/dotnet/runtime/issues/100368")] public void ConvertToInt64Test() { Assert.Equal(Vector128.Create(long.MinValue), Vector128.ConvertToInt64(Vector128.Create(double.MinValue))); @@ -4906,6 +4909,7 @@ public void ConvertToInt64Test() } [Fact] + [SkipOnMono("https://github.com/dotnet/runtime/issues/100368")] public void ConvertToInt64NativeTest() { if (Vector128.IsHardwareAccelerated && Avx512DQ.VL.IsSupported) @@ -4922,6 +4926,7 @@ public void ConvertToInt64NativeTest() } [Fact] + [SkipOnMono("https://github.com/dotnet/runtime/issues/100368")] public void ConvertToUInt32Test() { Assert.Equal(Vector128.Create(uint.MinValue), Vector128.ConvertToUInt32(Vector128.Create(float.MinValue))); @@ -4930,6 +4935,7 @@ public void ConvertToUInt32Test() } [Fact] + [SkipOnMono("https://github.com/dotnet/runtime/issues/100368")] public void ConvertToUInt32NativeTest() { if (Vector128.IsHardwareAccelerated && Avx512F.VL.IsSupported) @@ -4946,6 +4952,7 @@ public void ConvertToUInt32NativeTest() } [Fact] + [SkipOnMono("https://github.com/dotnet/runtime/issues/100368")] public void ConvertToUInt64Test() { Assert.Equal(Vector128.Create(ulong.MinValue), Vector128.ConvertToUInt64(Vector128.Create(double.MinValue))); @@ -4954,6 +4961,7 @@ public void ConvertToUInt64Test() } [Fact] + [SkipOnMono("https://github.com/dotnet/runtime/issues/100368")] public void ConvertToUInt64NativeTest() { if (Vector128.IsHardwareAccelerated && Avx512DQ.VL.IsSupported) diff --git a/src/libraries/System.Runtime.Intrinsics/tests/Vectors/Vector256Tests.cs b/src/libraries/System.Runtime.Intrinsics/tests/Vectors/Vector256Tests.cs index 7f373a45e790f9..a5559d43c81505 100644 --- a/src/libraries/System.Runtime.Intrinsics/tests/Vectors/Vector256Tests.cs +++ b/src/libraries/System.Runtime.Intrinsics/tests/Vectors/Vector256Tests.cs @@ -5890,6 +5890,7 @@ public void Log2SingleTest(float value, float expectedResult, float variance) } [Fact] + [SkipOnMono("https://github.com/dotnet/runtime/issues/100368")] public void ConvertToInt32Test() { Assert.Equal(Vector256.Create(int.MinValue), Vector256.ConvertToInt32(Vector256.Create(float.MinValue))); @@ -5898,6 +5899,7 @@ public void ConvertToInt32Test() } [Fact] + [SkipOnMono("https://github.com/dotnet/runtime/issues/100368")] public void ConvertToInt32NativeTest() { if (Vector128.IsHardwareAccelerated && Sse2.IsSupported) @@ -5913,6 +5915,7 @@ public void ConvertToInt32NativeTest() } [Fact] + [SkipOnMono("https://github.com/dotnet/runtime/issues/100368")] public void ConvertToInt64Test() { Assert.Equal(Vector256.Create(long.MinValue), Vector256.ConvertToInt64(Vector256.Create(double.MinValue))); @@ -5921,6 +5924,7 @@ public void ConvertToInt64Test() } [Fact] + [SkipOnMono("https://github.com/dotnet/runtime/issues/100368")] public void ConvertToInt64NativeTest() { if (Vector128.IsHardwareAccelerated && Avx512DQ.VL.IsSupported) @@ -5937,6 +5941,7 @@ public void ConvertToInt64NativeTest() } [Fact] + [SkipOnMono("https://github.com/dotnet/runtime/issues/100368")] public void ConvertToUInt32Test() { Assert.Equal(Vector256.Create(uint.MinValue), Vector256.ConvertToUInt32(Vector256.Create(float.MinValue))); @@ -5945,6 +5950,7 @@ public void ConvertToUInt32Test() } [Fact] + [SkipOnMono("https://github.com/dotnet/runtime/issues/100368")] public void ConvertToUInt32NativeTest() { if (Vector128.IsHardwareAccelerated && Avx512F.VL.IsSupported) @@ -5961,6 +5967,7 @@ public void ConvertToUInt32NativeTest() } [Fact] + [SkipOnMono("https://github.com/dotnet/runtime/issues/100368")] public void ConvertToUInt64Test() { Assert.Equal(Vector256.Create(ulong.MinValue), Vector256.ConvertToUInt64(Vector256.Create(double.MinValue))); @@ -5969,6 +5976,7 @@ public void ConvertToUInt64Test() } [Fact] + [SkipOnMono("https://github.com/dotnet/runtime/issues/100368")] public void ConvertToUInt64NativeTest() { if (Vector128.IsHardwareAccelerated && Avx512DQ.VL.IsSupported) diff --git a/src/libraries/System.Runtime.Intrinsics/tests/Vectors/Vector512Tests.cs b/src/libraries/System.Runtime.Intrinsics/tests/Vectors/Vector512Tests.cs index b7d0427a78df55..c01f88facbf574 100644 --- a/src/libraries/System.Runtime.Intrinsics/tests/Vectors/Vector512Tests.cs +++ b/src/libraries/System.Runtime.Intrinsics/tests/Vectors/Vector512Tests.cs @@ -5323,6 +5323,7 @@ public void Log2SingleTest(float value, float expectedResult, float variance) } [Fact] + [SkipOnMono("https://github.com/dotnet/runtime/issues/100368")] public void ConvertToInt32Test() { Assert.Equal(Vector512.Create(int.MinValue), Vector512.ConvertToInt32(Vector512.Create(float.MinValue))); @@ -5331,6 +5332,7 @@ public void ConvertToInt32Test() } [Fact] + [SkipOnMono("https://github.com/dotnet/runtime/issues/100368")] public void ConvertToInt32NativeTest() { if (Vector128.IsHardwareAccelerated && Sse2.IsSupported) @@ -5346,6 +5348,7 @@ public void ConvertToInt32NativeTest() } [Fact] + [SkipOnMono("https://github.com/dotnet/runtime/issues/100368")] public void ConvertToInt64Test() { Assert.Equal(Vector512.Create(long.MinValue), Vector512.ConvertToInt64(Vector512.Create(double.MinValue))); @@ -5354,6 +5357,7 @@ public void ConvertToInt64Test() } [Fact] + [SkipOnMono("https://github.com/dotnet/runtime/issues/100368")] public void ConvertToInt64NativeTest() { if (Vector128.IsHardwareAccelerated && Avx512DQ.VL.IsSupported) @@ -5370,6 +5374,7 @@ public void ConvertToInt64NativeTest() } [Fact] + [SkipOnMono("https://github.com/dotnet/runtime/issues/100368")] public void ConvertToUInt32Test() { Assert.Equal(Vector512.Create(uint.MinValue), Vector512.ConvertToUInt32(Vector512.Create(float.MinValue))); @@ -5378,6 +5383,7 @@ public void ConvertToUInt32Test() } [Fact] + [SkipOnMono("https://github.com/dotnet/runtime/issues/100368")] public void ConvertToUInt32NativeTest() { if (Vector128.IsHardwareAccelerated && Avx512F.VL.IsSupported) @@ -5394,6 +5400,7 @@ public void ConvertToUInt32NativeTest() } [Fact] + [SkipOnMono("https://github.com/dotnet/runtime/issues/100368")] public void ConvertToUInt64Test() { Assert.Equal(Vector512.Create(ulong.MinValue), Vector512.ConvertToUInt64(Vector512.Create(double.MinValue))); @@ -5402,6 +5409,7 @@ public void ConvertToUInt64Test() } [Fact] + [SkipOnMono("https://github.com/dotnet/runtime/issues/100368")] public void ConvertToUInt64NativeTest() { if (Vector128.IsHardwareAccelerated && Avx512DQ.VL.IsSupported) diff --git a/src/libraries/System.Runtime.Intrinsics/tests/Vectors/Vector64Tests.cs b/src/libraries/System.Runtime.Intrinsics/tests/Vectors/Vector64Tests.cs index d974c334946b5b..3c2d8064681fe1 100644 --- a/src/libraries/System.Runtime.Intrinsics/tests/Vectors/Vector64Tests.cs +++ b/src/libraries/System.Runtime.Intrinsics/tests/Vectors/Vector64Tests.cs @@ -4290,6 +4290,7 @@ public void Log2SingleTest(float value, float expectedResult, float variance) } [Fact] + [SkipOnMono("https://github.com/dotnet/runtime/issues/100368")] public void ConvertToInt32Test() { Assert.Equal(Vector64.Create(int.MinValue), Vector64.ConvertToInt32(Vector64.Create(float.MinValue))); @@ -4298,6 +4299,7 @@ public void ConvertToInt32Test() } [Fact] + [SkipOnMono("https://github.com/dotnet/runtime/issues/100368")] public void ConvertToInt32NativeTest() { Assert.Equal(Vector64.Create(int.MinValue), Vector64.ConvertToInt32Native(Vector64.Create(float.MinValue))); @@ -4306,6 +4308,7 @@ public void ConvertToInt32NativeTest() } [Fact] + [SkipOnMono("https://github.com/dotnet/runtime/issues/100368")] public void ConvertToInt64Test() { Assert.Equal(Vector64.Create(long.MinValue), Vector64.ConvertToInt64(Vector64.Create(double.MinValue))); @@ -4314,6 +4317,7 @@ public void ConvertToInt64Test() } [Fact] + [SkipOnMono("https://github.com/dotnet/runtime/issues/100368")] public void ConvertToInt64NativeTest() { Assert.Equal(Vector64.Create(long.MinValue), Vector64.ConvertToInt64Native(Vector64.Create(double.MinValue))); @@ -4322,6 +4326,7 @@ public void ConvertToInt64NativeTest() } [Fact] + [SkipOnMono("https://github.com/dotnet/runtime/issues/100368")] public void ConvertToUInt32Test() { Assert.Equal(Vector64.Create(uint.MinValue), Vector64.ConvertToUInt32(Vector64.Create(float.MinValue))); @@ -4330,6 +4335,7 @@ public void ConvertToUInt32Test() } [Fact] + [SkipOnMono("https://github.com/dotnet/runtime/issues/100368")] public void ConvertToUInt32NativeTest() { Assert.Equal(Vector64.Create(uint.MinValue), Vector64.ConvertToUInt32Native(Vector64.Create(float.MinValue))); @@ -4338,6 +4344,7 @@ public void ConvertToUInt32NativeTest() } [Fact] + [SkipOnMono("https://github.com/dotnet/runtime/issues/100368")] public void ConvertToUInt64Test() { Assert.Equal(Vector64.Create(ulong.MinValue), Vector64.ConvertToUInt64(Vector64.Create(double.MinValue))); @@ -4346,6 +4353,7 @@ public void ConvertToUInt64Test() } [Fact] + [SkipOnMono("https://github.com/dotnet/runtime/issues/100368")] public void ConvertToUInt64NativeTest() { Assert.Equal(Vector64.Create(ulong.MinValue), Vector64.ConvertToUInt64Native(Vector64.Create(double.MinValue))); diff --git a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/DoubleTests.GenericMath.cs b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/DoubleTests.GenericMath.cs index 5666891611766d..7f3c2d14e822b2 100644 --- a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/DoubleTests.GenericMath.cs +++ b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/DoubleTests.GenericMath.cs @@ -358,6 +358,7 @@ public static void op_InequalityTest() // [Fact] + [SkipOnMono("https://github.com/dotnet/runtime/issues/100368")] public static void ConvertToIntegerTest() { // Signed Values @@ -408,39 +409,17 @@ public static void ConvertToIntegerTest() } [Fact] + [SkipOnMono("https://github.com/dotnet/runtime/issues/100368")] public static void ConvertToIntegerNativeTest() { // Signed Values - if (Sse2.IsSupported) - { - // On Xarch: - // * Conversion to int is natively supported and returns 0x8000_0000 - // * Conversion to long is natively supported on 64-bit and returns 0x8000_0000_0000_0000 - - Assert.Equal(0, FloatingPointHelper.ConvertToIntegerNative(double.MinValue)); - Assert.Equal(int.MinValue, FloatingPointHelper.ConvertToIntegerNative(double.MinValue)); - Assert.Equal(nint.MinValue, FloatingPointHelper.ConvertToIntegerNative(double.MinValue)); - Assert.Equal(0, FloatingPointHelper.ConvertToIntegerNative(double.MinValue)); - - if (Environment.Is64BitProcess) - { - Assert.Equal(long.MinValue, FloatingPointHelper.ConvertToIntegerNative(double.MinValue)); - } - else - { - Assert.Equal(0, FloatingPointHelper.ConvertToIntegerNative(double.MinValue)); - } - } - else - { - Assert.Equal(short.MinValue, FloatingPointHelper.ConvertToIntegerNative(double.MinValue)); - Assert.Equal(int.MinValue, FloatingPointHelper.ConvertToIntegerNative(double.MinValue)); - Assert.Equal(long.MinValue, FloatingPointHelper.ConvertToIntegerNative(double.MinValue)); - Assert.Equal(nint.MinValue, FloatingPointHelper.ConvertToIntegerNative(double.MinValue)); - Assert.Equal(sbyte.MinValue, FloatingPointHelper.ConvertToIntegerNative(double.MinValue)); - } + Assert.Equal(0, FloatingPointHelper.ConvertToIntegerNative(double.MinValue)); + Assert.Equal(int.MinValue, FloatingPointHelper.ConvertToIntegerNative(double.MinValue)); + Assert.Equal(long.MinValue, FloatingPointHelper.ConvertToIntegerNative(double.MinValue)); Assert.Equal(Int128.MinValue, FloatingPointHelper.ConvertToIntegerNative(double.MinValue)); + Assert.Equal(nint.MinValue, FloatingPointHelper.ConvertToIntegerNative(double.MinValue)); + Assert.Equal(0, FloatingPointHelper.ConvertToIntegerNative(double.MinValue)); Assert.Equal(2, FloatingPointHelper.ConvertToIntegerNative(2.6)); Assert.Equal(2, FloatingPointHelper.ConvertToIntegerNative(2.6)); @@ -456,19 +435,26 @@ public static void ConvertToIntegerNativeTest() // * Conversion to long is natively supported on 64-bit and returns 0x8000_0000_0000_0000 Assert.Equal(0, FloatingPointHelper.ConvertToIntegerNative(double.MaxValue)); - Assert.Equal(0, FloatingPointHelper.ConvertToIntegerNative(double.MaxValue)); - Assert.Equal(int.MinValue, FloatingPointHelper.ConvertToIntegerNative(double.MaxValue)); - Assert.Equal(long.MinValue, FloatingPointHelper.ConvertToIntegerNative(double.MaxValue)); Assert.Equal(nint.MinValue, FloatingPointHelper.ConvertToIntegerNative(double.MaxValue)); + Assert.Equal(0, FloatingPointHelper.ConvertToIntegerNative(double.MaxValue)); + + if (Environment.Is64BitProcess) + { + Assert.Equal(long.MinValue, FloatingPointHelper.ConvertToIntegerNative(double.MaxValue)); + } + else + { + Assert.Equal(long.MaxValue, FloatingPointHelper.ConvertToIntegerNative(double.MaxValue)); + } } else { - Assert.Equal(short.MaxValue, FloatingPointHelper.ConvertToIntegerNative(double.MaxValue)); + Assert.Equal(-1, FloatingPointHelper.ConvertToIntegerNative(double.MaxValue)); Assert.Equal(int.MaxValue, FloatingPointHelper.ConvertToIntegerNative(double.MaxValue)); Assert.Equal(long.MaxValue, FloatingPointHelper.ConvertToIntegerNative(double.MaxValue)); Assert.Equal(nint.MaxValue, FloatingPointHelper.ConvertToIntegerNative(double.MaxValue)); - Assert.Equal(sbyte.MaxValue, FloatingPointHelper.ConvertToIntegerNative(double.MaxValue)); + Assert.Equal(-1, FloatingPointHelper.ConvertToIntegerNative(double.MaxValue)); } Assert.Equal(Int128.MaxValue, FloatingPointHelper.ConvertToIntegerNative(double.MaxValue)); @@ -529,12 +515,12 @@ public static void ConvertToIntegerNativeTest() else { Assert.Equal(byte.MaxValue, FloatingPointHelper.ConvertToIntegerNative(double.MaxValue)); - Assert.Equal(nuint.MaxValue, FloatingPointHelper.ConvertToIntegerNative(double.MaxValue)); + Assert.Equal(ushort.MaxValue, FloatingPointHelper.ConvertToIntegerNative(double.MaxValue)); } Assert.Equal(uint.MaxValue, FloatingPointHelper.ConvertToIntegerNative(double.MaxValue)); Assert.Equal(ulong.MaxValue, FloatingPointHelper.ConvertToIntegerNative(double.MaxValue)); + Assert.Equal(nuint.MaxValue, FloatingPointHelper.ConvertToIntegerNative(double.MaxValue)); Assert.Equal(UInt128.MaxValue, FloatingPointHelper.ConvertToIntegerNative(double.MaxValue)); - Assert.Equal(nuint.MaxValue, FloatingPointHelper.ConvertToIntegerNative(double.MaxValue)); } [Fact] @@ -1236,7 +1222,7 @@ public static void CreateCheckedFromDecimalTest() AssertBitwiseEqual(-0.0, NumberBaseHelper.CreateChecked(-0.0m)); AssertBitwiseEqual(+0.0, NumberBaseHelper.CreateChecked(+0.0m)); AssertBitwiseEqual(+1.0, NumberBaseHelper.CreateChecked(+1.0m)); - AssertBitwiseEqual(+79228162514264337593543950335.0, NumberBaseHelper.CreateChecked(decimal.MaxValue)); + AssertBitwiseEqual(+79228162514264337593543950335.0, NumberBaseHelper.CreateChecked(decimal.MaxValue)); } [Fact] diff --git a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/SingleTests.GenericMath.cs b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/SingleTests.GenericMath.cs index 48dd4b5240058c..550aa7cef2c2c3 100644 --- a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/SingleTests.GenericMath.cs +++ b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/SingleTests.GenericMath.cs @@ -358,6 +358,7 @@ public static void op_InequalityTest() // [Fact] + [SkipOnMono("https://github.com/dotnet/runtime/issues/100368")] public static void ConvertToIntegerTest() { // Signed Values @@ -408,39 +409,17 @@ public static void ConvertToIntegerTest() } [Fact] + [SkipOnMono("https://github.com/dotnet/runtime/issues/100368")] public static void ConvertToIntegerNativeTest() { // Signed Values - if (Sse2.IsSupported) - { - // On Xarch: - // * Conversion to int is natively supported and returns 0x8000_0000 - // * Conversion to long is natively supported on 64-bit and returns 0x8000_0000_0000_0000 - - Assert.Equal(0, FloatingPointHelper.ConvertToIntegerNative(float.MinValue)); - Assert.Equal(int.MinValue, FloatingPointHelper.ConvertToIntegerNative(float.MinValue)); - Assert.Equal(nint.MinValue, FloatingPointHelper.ConvertToIntegerNative(float.MinValue)); - Assert.Equal(0, FloatingPointHelper.ConvertToIntegerNative(float.MinValue)); - - if (Environment.Is64BitProcess) - { - Assert.Equal(long.MinValue, FloatingPointHelper.ConvertToIntegerNative(float.MinValue)); - } - else - { - Assert.Equal(0, FloatingPointHelper.ConvertToIntegerNative(float.MinValue)); - } - } - else - { - Assert.Equal(short.MinValue, FloatingPointHelper.ConvertToIntegerNative(float.MinValue)); - Assert.Equal(int.MinValue, FloatingPointHelper.ConvertToIntegerNative(float.MinValue)); - Assert.Equal(long.MinValue, FloatingPointHelper.ConvertToIntegerNative(float.MinValue)); - Assert.Equal(nint.MinValue, FloatingPointHelper.ConvertToIntegerNative(float.MinValue)); - Assert.Equal(sbyte.MinValue, FloatingPointHelper.ConvertToIntegerNative(float.MinValue)); - } + Assert.Equal(0, FloatingPointHelper.ConvertToIntegerNative(float.MinValue)); + Assert.Equal(int.MinValue, FloatingPointHelper.ConvertToIntegerNative(float.MinValue)); + Assert.Equal(long.MinValue, FloatingPointHelper.ConvertToIntegerNative(float.MinValue)); Assert.Equal(Int128.MinValue, FloatingPointHelper.ConvertToIntegerNative(float.MinValue)); + Assert.Equal(nint.MinValue, FloatingPointHelper.ConvertToIntegerNative(float.MinValue)); + Assert.Equal(0, FloatingPointHelper.ConvertToIntegerNative(float.MinValue)); Assert.Equal(2, FloatingPointHelper.ConvertToIntegerNative(2.6f)); Assert.Equal(2, FloatingPointHelper.ConvertToIntegerNative(2.6f)); @@ -456,19 +435,26 @@ public static void ConvertToIntegerNativeTest() // * Conversion to long is natively supported on 64-bit and returns 0x8000_0000_0000_0000 Assert.Equal(0, FloatingPointHelper.ConvertToIntegerNative(float.MaxValue)); - Assert.Equal(0, FloatingPointHelper.ConvertToIntegerNative(float.MaxValue)); - Assert.Equal(int.MinValue, FloatingPointHelper.ConvertToIntegerNative(float.MaxValue)); - Assert.Equal(long.MinValue, FloatingPointHelper.ConvertToIntegerNative(float.MaxValue)); Assert.Equal(nint.MinValue, FloatingPointHelper.ConvertToIntegerNative(float.MaxValue)); + Assert.Equal(0, FloatingPointHelper.ConvertToIntegerNative(float.MaxValue)); + + if (Environment.Is64BitProcess) + { + Assert.Equal(long.MinValue, FloatingPointHelper.ConvertToIntegerNative(float.MaxValue)); + } + else + { + Assert.Equal(long.MaxValue, FloatingPointHelper.ConvertToIntegerNative(float.MaxValue)); + } } else { - Assert.Equal(short.MaxValue, FloatingPointHelper.ConvertToIntegerNative(float.MaxValue)); + Assert.Equal(-1, FloatingPointHelper.ConvertToIntegerNative(float.MaxValue)); Assert.Equal(int.MaxValue, FloatingPointHelper.ConvertToIntegerNative(float.MaxValue)); Assert.Equal(long.MaxValue, FloatingPointHelper.ConvertToIntegerNative(float.MaxValue)); Assert.Equal(nint.MaxValue, FloatingPointHelper.ConvertToIntegerNative(float.MaxValue)); - Assert.Equal(sbyte.MaxValue, FloatingPointHelper.ConvertToIntegerNative(float.MaxValue)); + Assert.Equal(-1, FloatingPointHelper.ConvertToIntegerNative(float.MaxValue)); } Assert.Equal(Int128.MaxValue, FloatingPointHelper.ConvertToIntegerNative(float.MaxValue)); @@ -480,9 +466,6 @@ public static void ConvertToIntegerNativeTest() // * Conversion to uint is natively supported w/ Avx512 and returns 0xFFFF_FFFF // * Conversion to ulong is natively supported on 64-bit w/ Avx512 and returns 0xFFFF_FFFF_FFFF_FFFF - Assert.Equal(0, FloatingPointHelper.ConvertToIntegerNative(float.MinValue)); - Assert.Equal(0, FloatingPointHelper.ConvertToIntegerNative(float.MinValue)); - if (Avx512F.IsSupported) { Assert.Equal(uint.MaxValue, FloatingPointHelper.ConvertToIntegerNative(float.MinValue)); @@ -505,12 +488,12 @@ public static void ConvertToIntegerNativeTest() } else { - Assert.Equal(byte.MinValue, FloatingPointHelper.ConvertToIntegerNative(float.MinValue)); - Assert.Equal(ushort.MinValue, FloatingPointHelper.ConvertToIntegerNative(float.MinValue)); Assert.Equal(uint.MinValue, FloatingPointHelper.ConvertToIntegerNative(float.MinValue)); Assert.Equal(ulong.MinValue, FloatingPointHelper.ConvertToIntegerNative(float.MinValue)); Assert.Equal(nuint.MinValue, FloatingPointHelper.ConvertToIntegerNative(float.MinValue)); } + Assert.Equal(byte.MinValue, FloatingPointHelper.ConvertToIntegerNative(float.MinValue)); + Assert.Equal(ushort.MinValue, FloatingPointHelper.ConvertToIntegerNative(float.MinValue)); Assert.Equal(UInt128.MinValue, FloatingPointHelper.ConvertToIntegerNative(float.MinValue)); Assert.Equal(2u, FloatingPointHelper.ConvertToIntegerNative(2.6f));