From 69d1aa414449c42c06c928e8eea45caf75cef6d8 Mon Sep 17 00:00:00 2001 From: Stephen Toub Date: Thu, 3 Jul 2025 21:53:12 -0400 Subject: [PATCH] Re-enable some binary specifier tests --- .../tests/System.Runtime.Tests/System/Int128Tests.cs | 3 +-- .../tests/System.Runtime.Tests/System/Int64Tests.cs | 3 +-- .../tests/System.Runtime.Tests/System/UInt128Tests.cs | 3 +-- .../tests/System.Runtime.Tests/System/UInt64Tests.cs | 3 +-- 4 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Int128Tests.cs b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Int128Tests.cs index 9b9103b56ec20c..4bb3f0a73a5494 100644 --- a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Int128Tests.cs +++ b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Int128Tests.cs @@ -365,8 +365,7 @@ public static IEnumerable Parse_Invalid_TestData() foreach (object[] objs in Int32Tests.Parse_Invalid_TestData()) { if ((Type)objs[3] == typeof(OverflowException) && - (((NumberStyles)objs[1] & NumberStyles.AllowBinarySpecifier) != 0 || // TODO https://github.com/dotnet/runtime/issues/83619: Remove once BigInteger supports binary parsing - !BigInteger.TryParse((string)objs[0], (NumberStyles)objs[1], null, out BigInteger bi) || + (!BigInteger.TryParse((string)objs[0], (NumberStyles)objs[1], null, out BigInteger bi) || (bi >= Int128.MinValue && bi <= Int128.MaxValue))) { continue; diff --git a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Int64Tests.cs b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Int64Tests.cs index ac902ebdbd7c85..2e2af6716ef343 100644 --- a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Int64Tests.cs +++ b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Int64Tests.cs @@ -303,8 +303,7 @@ public static IEnumerable Parse_Invalid_TestData() foreach (object[] objs in Int32Tests.Parse_Invalid_TestData()) { if ((Type)objs[3] == typeof(OverflowException) && - (((NumberStyles)objs[1] & NumberStyles.AllowBinarySpecifier) != 0 || // TODO https://github.com/dotnet/runtime/issues/83619: Remove once BigInteger supports binary parsing - !BigInteger.TryParse((string)objs[0], (NumberStyles)objs[1], null, out BigInteger bi) || + (!BigInteger.TryParse((string)objs[0], (NumberStyles)objs[1], null, out BigInteger bi) || (bi >= long.MinValue && bi <= long.MaxValue))) { continue; diff --git a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/UInt128Tests.cs b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/UInt128Tests.cs index e3d2c474bcd46b..d37f1d2a2c7bf6 100644 --- a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/UInt128Tests.cs +++ b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/UInt128Tests.cs @@ -294,8 +294,7 @@ public static IEnumerable Parse_Invalid_TestData() foreach (object[] objs in Int128Tests.Parse_Invalid_TestData()) { if ((Type)objs[3] == typeof(OverflowException) && - (((NumberStyles)objs[1] & NumberStyles.AllowBinarySpecifier) != 0 || // TODO https://github.com/dotnet/runtime/issues/83619: Remove once BigInteger supports binary parsing - !BigInteger.TryParse((string)objs[0], (NumberStyles)objs[1], null, out BigInteger bi) || + (!BigInteger.TryParse((string)objs[0], (NumberStyles)objs[1], null, out BigInteger bi) || bi <= UInt128.MaxValue)) { continue; diff --git a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/UInt64Tests.cs b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/UInt64Tests.cs index de44a6f175884f..27efe49e48289e 100644 --- a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/UInt64Tests.cs +++ b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/UInt64Tests.cs @@ -276,8 +276,7 @@ public static IEnumerable Parse_Invalid_TestData() foreach (object[] objs in Int64Tests.Parse_Invalid_TestData()) { if ((Type)objs[3] == typeof(OverflowException) && - (((NumberStyles)objs[1] & NumberStyles.AllowBinarySpecifier) != 0 || // TODO https://github.com/dotnet/runtime/issues/83619: Remove once BigInteger supports binary parsing - !BigInteger.TryParse((string)objs[0], (NumberStyles)objs[1], null, out BigInteger bi) || + (!BigInteger.TryParse((string)objs[0], (NumberStyles)objs[1], null, out BigInteger bi) || bi <= ulong.MaxValue)) { continue;