RecyclableLongList.Contains fixed to cover border cases. Failing tests fixed.

This commit is contained in:
mlemanczyk committed 2023-09-16 21:20:40 +02:00
1 parent 4b2722f15a
commit 68582f0ffd
2 files changed
+2 -2

No files matched your search

+1 -1
View File
@@ -337,7 +337,7 @@ namespace Recyclable.Collections
return false;
}
if (_nextItemBlockIndex == 0 || (_nextItemBlockIndex == 1 && _nextItemIndex == 0))
if (_nextItemBlockIndex == 0 || (_nextItemIndex == 0 && _nextItemBlockIndex == 1))
{
return Array.IndexOf(_memoryBlocks[0], item, 0, checked((int)_longCount)) >= 0;
}
@@ -173,7 +173,7 @@ namespace Recyclable.CollectionsTests
}
// Validate
_ = list.Capacity.Should().Be(0);
_ = list.Capacity.Should().BeGreaterThanOrEqualTo(RecyclableDefaults.InitialCapacity);
_ = list.LastBlockWithData.Should().Be(-1);
_ = list.LongCount.Should().Be(itemsCount);
_ = list.Should().BeEmpty();