mirror of
https://github.com/oliverbooth/X10D
synced 2024-11-22 19:28:48 +00:00
test: add tests for Span<T>.Count
This commit is contained in:
parent
586057ba3d
commit
f10ff4a36c
@ -6,6 +6,26 @@ namespace X10D.Tests.Collections;
|
||||
[TestClass]
|
||||
public class SpanTest
|
||||
{
|
||||
[TestMethod]
|
||||
public void Count_ShouldReturn0_GivenEmptySpan()
|
||||
{
|
||||
Span<int> span = Span<int>.Empty;
|
||||
|
||||
int count = span.Count(2);
|
||||
|
||||
Assert.AreEqual(0, count);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Count_ShouldReturn8_GivenSpanWith8MatchingElements()
|
||||
{
|
||||
Span<int> span = stackalloc int[16] {1, 2, 3, 2, 5, 2, 7, 2, 9, 2, 11, 2, 13, 2, 15, 2};
|
||||
|
||||
int count = span.Count(2);
|
||||
|
||||
Assert.AreEqual(8, count);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Split_OnEmptySpan_ShouldYieldNothing()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user