diff --git a/src/System.Memory/tests/ReadOnlySpan/SequenceCompareTo.byte.cs b/src/System.Memory/tests/ReadOnlySpan/SequenceCompareTo.byte.cs index 9accd0826edf..7f079f740f7a 100644 --- a/src/System.Memory/tests/ReadOnlySpan/SequenceCompareTo.byte.cs +++ b/src/System.Memory/tests/ReadOnlySpan/SequenceCompareTo.byte.cs @@ -71,10 +71,30 @@ public static void LengthMismatchSequenceCompareTo_Byte() Assert.True(result > 0); } + [Fact] + public static void SequenceCompareToEqual_Byte() + { + for (int length = 1; length < 128; length++) + { + var first = new byte[length]; + var second = new byte[length]; + for (int i = 0; i < length; i++) + { + first[i] = second[i] = (byte)(i + 1); + } + + var firstSpan = new ReadOnlySpan(first); + var secondSpan = new ReadOnlySpan(second); + + Assert.Equal(0, firstSpan.SequenceCompareTo(secondSpan)); + Assert.Equal(0, secondSpan.SequenceCompareTo(firstSpan)); + } + } + [Fact] public static void SequenceCompareToWithSingleMismatch_Byte() { - for (int length = 1; length < 32; length++) + for (int length = 1; length < 128; length++) { for (int mismatchIndex = 0; mismatchIndex < length; mismatchIndex++) { @@ -101,7 +121,7 @@ public static void SequenceCompareToWithSingleMismatch_Byte() [Fact] public static void SequenceCompareToNoMatch_Byte() { - for (int length = 1; length < 32; length++) + for (int length = 1; length < 128; length++) { var first = new byte[length]; var second = new byte[length]; diff --git a/src/System.Memory/tests/Span/SequenceCompareTo.byte.cs b/src/System.Memory/tests/Span/SequenceCompareTo.byte.cs index 73f3728fa1aa..bc6c64005af3 100644 --- a/src/System.Memory/tests/Span/SequenceCompareTo.byte.cs +++ b/src/System.Memory/tests/Span/SequenceCompareTo.byte.cs @@ -71,10 +71,30 @@ public static void LengthMismatchSequenceCompareTo_Byte() Assert.True(result > 0); } + [Fact] + public static void SequenceCompareToEqual_Byte() + { + for (int length = 1; length < 128; length++) + { + var first = new byte[length]; + var second = new byte[length]; + for (int i = 0; i < length; i++) + { + first[i] = second[i] = (byte)(i + 1); + } + + var firstSpan = new Span(first); + var secondSpan = new Span(second); + + Assert.Equal(0, firstSpan.SequenceCompareTo(secondSpan)); + Assert.Equal(0, secondSpan.SequenceCompareTo(firstSpan)); + } + } + [Fact] public static void SequenceCompareToWithSingleMismatch_Byte() { - for (int length = 1; length < 32; length++) + for (int length = 1; length < 128; length++) { for (int mismatchIndex = 0; mismatchIndex < length; mismatchIndex++) { @@ -101,7 +121,7 @@ public static void SequenceCompareToWithSingleMismatch_Byte() [Fact] public static void SequenceCompareToNoMatch_Byte() { - for (int length = 1; length < 32; length++) + for (int length = 1; length < 128; length++) { byte[] first = new byte[length]; byte[] second = new byte[length];