From 5dbd517a86c7cf91541a685b5b34711141ae0bf3 Mon Sep 17 00:00:00 2001 From: Ulrich Weigand Date: Tue, 16 Mar 2021 17:46:13 +0100 Subject: [PATCH 1/2] Big-endian test case fixes: Xoshiro hash * Skip Xoshiro_AlgorithmBehavesAsExpected on big-endian systems --- .../System.Runtime.Extensions/tests/System/Random.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/libraries/System.Runtime.Extensions/tests/System/Random.cs b/src/libraries/System.Runtime.Extensions/tests/System/Random.cs index 56318e7b34d329..ff75ff4f51fe25 100644 --- a/src/libraries/System.Runtime.Extensions/tests/System/Random.cs +++ b/src/libraries/System.Runtime.Extensions/tests/System/Random.cs @@ -388,7 +388,10 @@ public void Empty_Success(bool derived, bool seeded) r.NextBytes(Span.Empty); } - [Fact] + // The following test makes assumptions about the implementation that hold + // true only on little-endian platforms. + public static bool IsLittleEndian => BitConverter.IsLittleEndian; + [ConditionalFact(nameof(IsLittleEndian))] public void Xoshiro_AlgorithmBehavesAsExpected() { // This test is validating implementation detail. If the algorithm used by `new Random()` is ever From 578a2942646a1cb70399d7542f53af6946d955d2 Mon Sep 17 00:00:00 2001 From: Stephen Toub Date: Thu, 18 Mar 2021 21:11:52 -0400 Subject: [PATCH 2/2] Update src/libraries/System.Runtime.Extensions/tests/System/Random.cs --- .../System.Runtime.Extensions/tests/System/Random.cs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/libraries/System.Runtime.Extensions/tests/System/Random.cs b/src/libraries/System.Runtime.Extensions/tests/System/Random.cs index ff75ff4f51fe25..1d39866627b1fd 100644 --- a/src/libraries/System.Runtime.Extensions/tests/System/Random.cs +++ b/src/libraries/System.Runtime.Extensions/tests/System/Random.cs @@ -388,10 +388,7 @@ public void Empty_Success(bool derived, bool seeded) r.NextBytes(Span.Empty); } - // The following test makes assumptions about the implementation that hold - // true only on little-endian platforms. - public static bool IsLittleEndian => BitConverter.IsLittleEndian; - [ConditionalFact(nameof(IsLittleEndian))] + [ConditionalFact(typeof(BitConverter), nameof(BitConverter.IsLittleEndian))] // test makes little-endian assumptions public void Xoshiro_AlgorithmBehavesAsExpected() { // This test is validating implementation detail. If the algorithm used by `new Random()` is ever