RecyclableArrayList.AddRange(IEnumerable<T>) performance improvements. ...WhenSourceIsIEnumerable benchmarks reworked to use real IEnumerable, which can't be typecasted to anything.

This commit is contained in:
mlemanczyk committed 2023-01-15 20:12:52 +01:00
1 parent bf2d966f28
commit f500f846ac
7 files changed
+121 -33

No files matched your search

@@ -62,6 +62,22 @@ namespace Recyclable.CollectionsTests
.And.BeEquivalentTo(testData);
}
[Fact]
public void ConstructorShouldAddItemsInCorrectOrderWhenSourceIsIEnumerable()
{
// Prepare
var testData = _testData;
// Act
var list = new RecyclableArrayList<int>(testData);
// Validate
_ = list.Capacity.Should().Be(32, "when we succeed in taking count without enumerating, then we allocate as much memory as needed, only");
_ = list.Should().HaveCount(testData.Count())
.And.ContainInConsecutiveOrder(testData)
.And.BeEquivalentTo(testData);
}
[Fact]
public void InsertAtTheBeginningShouldMoveItems()
{