RecyclableList.BinarySearch tests added.
This commit is contained in:
1 parent
4f0102438e
commit
896e2d4000
1 file changed
+23
+23
@@ -11,6 +11,29 @@ namespace Recyclable.CollectionsTests
|
|||||||
{
|
{
|
||||||
public class RecyclableListCompatibilityListTests
|
public class RecyclableListCompatibilityListTests
|
||||||
{
|
{
|
||||||
|
[Theory]
|
||||||
|
[MemberData(nameof(RecyclableLongListTestData.SourceDataWithItemIndexVariants), MemberType = typeof(RecyclableLongListTestData))]
|
||||||
|
public void BinarySearchShouldFindAllItems(string testCase, IEnumerable<long> testData, int itemsCount, in long[] itemIndexes)
|
||||||
|
{
|
||||||
|
_ = testData.Any().Should().BeTrue("we need items on the list that we can look for");
|
||||||
|
|
||||||
|
// Prepare
|
||||||
|
using var list = new RecyclableList<long>(testData, itemsCount);
|
||||||
|
var expectedData = testData.ToList();
|
||||||
|
|
||||||
|
foreach (var itemIndex in itemIndexes)
|
||||||
|
{
|
||||||
|
var expectedItem = expectedData[(int)itemIndex];
|
||||||
|
var expected = expectedData.BinarySearch(expectedItem);
|
||||||
|
|
||||||
|
// Act
|
||||||
|
var actual = list.BinarySearch(expectedItem);
|
||||||
|
|
||||||
|
// Validate
|
||||||
|
_ = actual.Should().Be(expected);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[Theory]
|
[Theory]
|
||||||
[MemberData(nameof(RecyclableLongListTestData.SourceDataVariants), MemberType = typeof(RecyclableLongListTestData))]
|
[MemberData(nameof(RecyclableLongListTestData.SourceDataVariants), MemberType = typeof(RecyclableLongListTestData))]
|
||||||
public void ConvertAllShouldConvertAllItems(string testCase, IEnumerable<long> testData, int itemsCount)
|
public void ConvertAllShouldConvertAllItems(string testCase, IEnumerable<long> testData, int itemsCount)
|
||||||
|
|||||||
Reference in new issue
Block a user