Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit 67a5965

Browse files
committed
fix MiddleIndex perf tests
1 parent dc60908 commit 67a5965

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/System.Memory/tests/Performance/Perf.Span.BinarySearch.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public void SpanBinarySearch_Int_FirstIndex(int size)
2929
[InlineData(1000)]
3030
public void SpanBinarySearch_Int_MiddleIndex(int size)
3131
{
32-
BenchmarkAndAssert(size, size / 2, size / 2);
32+
BenchmarkAndAssert(size, (size - 1) / 2, (size - 1) / 2);
3333
}
3434

3535
[Benchmark(InnerIterationCount = InnerCount)]
@@ -80,7 +80,7 @@ public void SpanBinarySearch_String_FirstIndex(int size)
8080
[InlineData(1000)]
8181
public void SpanBinarySearch_String_MiddleIndex(int size)
8282
{
83-
BenchmarkAndAssert(size, (size / 2).ToString(NumberFormat), size / 2);
83+
BenchmarkAndAssert(size, ((size - 1) / 2).ToString(NumberFormat), (size - 1) / 2);
8484
}
8585

8686
[Benchmark(InnerIterationCount = InnerCount)]

0 commit comments

Comments
 (0)