Missing capacity parameter added for better performance.
This commit is contained in:
1 parent
79bd17afad
commit
d99ec044a3
2 files changed
+42
-42
No files matched your search
@@ -210,7 +210,7 @@ namespace Recyclable.CollectionsTests
|
|||||||
public void ClearShouldRemoveAllItems(string testCase, IEnumerable<long> testData, long itemsCount)
|
public void ClearShouldRemoveAllItems(string testCase, IEnumerable<long> testData, long itemsCount)
|
||||||
{
|
{
|
||||||
// Prepare
|
// Prepare
|
||||||
using var list = new RecyclableList<long>(testData);
|
using var list = new RecyclableList<long>(testData, (int)itemsCount);
|
||||||
_ = list.Count.Should().Be((int)itemsCount);
|
_ = list.Count.Should().Be((int)itemsCount);
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
@@ -227,7 +227,7 @@ namespace Recyclable.CollectionsTests
|
|||||||
public void ConsecutiveDisposeShouldSucceed(string testCase, IEnumerable<long> testData, long itemsCount)
|
public void ConsecutiveDisposeShouldSucceed(string testCase, IEnumerable<long> testData, long itemsCount)
|
||||||
{
|
{
|
||||||
// Prepare
|
// Prepare
|
||||||
using var list = new RecyclableList<long>(testData);
|
using var list = new RecyclableList<long>(testData, (int)itemsCount);
|
||||||
list.Dispose();
|
list.Dispose();
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
@@ -239,7 +239,7 @@ namespace Recyclable.CollectionsTests
|
|||||||
public void ConstructorShouldAcceptDuplicates(string testCase, IEnumerable<long> testData, long itemsCount)
|
public void ConstructorShouldAcceptDuplicates(string testCase, IEnumerable<long> testData, long itemsCount)
|
||||||
{
|
{
|
||||||
// Act
|
// Act
|
||||||
using var list = new RecyclableList<long>(testData.Concat(testData), initialCapacity: (int)itemsCount * 2);
|
using var list = new RecyclableList<long>(testData.Concat(testData), (int)itemsCount * 2);
|
||||||
|
|
||||||
// Validate
|
// Validate
|
||||||
_ = list.Count.Should().Be((int)itemsCount * 2);
|
_ = list.Count.Should().Be((int)itemsCount * 2);
|
||||||
@@ -251,7 +251,7 @@ namespace Recyclable.CollectionsTests
|
|||||||
public void ConstructorShouldAddItemsInCorrectOrderWhenSourceIsIEnumerable(string testCase, IEnumerable<long> testData, long itemsCount)
|
public void ConstructorShouldAddItemsInCorrectOrderWhenSourceIsIEnumerable(string testCase, IEnumerable<long> testData, long itemsCount)
|
||||||
{
|
{
|
||||||
// Act
|
// Act
|
||||||
using var list = new RecyclableList<long>(testData);
|
using var list = new RecyclableList<long>(testData, (int)itemsCount);
|
||||||
|
|
||||||
// Validate
|
// Validate
|
||||||
_ = list.Capacity.Should().BeGreaterThanOrEqualTo((int)itemsCount, "when we succeed in taking count without enumerating, then we allocate as much memory as needed, only");
|
_ = list.Capacity.Should().BeGreaterThanOrEqualTo((int)itemsCount, "when we succeed in taking count without enumerating, then we allocate as much memory as needed, only");
|
||||||
@@ -264,7 +264,7 @@ namespace Recyclable.CollectionsTests
|
|||||||
public void ConstructorSourceShouldInitializeList(string testCase, IEnumerable<long> testData, long itemsCount)
|
public void ConstructorSourceShouldInitializeList(string testCase, IEnumerable<long> testData, long itemsCount)
|
||||||
{
|
{
|
||||||
// Act
|
// Act
|
||||||
using var list = new RecyclableList<long>(testData);
|
using var list = new RecyclableList<long>(testData, (int)itemsCount);
|
||||||
|
|
||||||
// Validate
|
// Validate
|
||||||
_ = list.Count.Should().Be((int)itemsCount);
|
_ = list.Count.Should().Be((int)itemsCount);
|
||||||
@@ -281,7 +281,7 @@ namespace Recyclable.CollectionsTests
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Prepare
|
// Prepare
|
||||||
using var list = new RecyclableList<long>(testData);
|
using var list = new RecyclableList<long>(testData, (int)itemsCount);
|
||||||
_ = testData.Any().Should().BeTrue("we need items on the list that we can look for");
|
_ = testData.Any().Should().BeTrue("we need items on the list that we can look for");
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
@@ -313,7 +313,7 @@ namespace Recyclable.CollectionsTests
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Prepare
|
// Prepare
|
||||||
using var list = new RecyclableList<long>(testData);
|
using var list = new RecyclableList<long>(testData, (int)itemsCount);
|
||||||
_ = testData.Any().Should().BeTrue("we need items on the list that we can look for");
|
_ = testData.Any().Should().BeTrue("we need items on the list that we can look for");
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
@@ -332,7 +332,7 @@ namespace Recyclable.CollectionsTests
|
|||||||
public void CopyToShouldCopyAllItemsInTheCorrectOrder(string testCase, IEnumerable<long> testData, long itemsCount)
|
public void CopyToShouldCopyAllItemsInTheCorrectOrder(string testCase, IEnumerable<long> testData, long itemsCount)
|
||||||
{
|
{
|
||||||
// Prepare
|
// Prepare
|
||||||
using var list = new RecyclableList<long>(testData);
|
using var list = new RecyclableList<long>(testData, (int)itemsCount);
|
||||||
long[] copiedItems = new long[itemsCount];
|
long[] copiedItems = new long[itemsCount];
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
@@ -347,7 +347,7 @@ namespace Recyclable.CollectionsTests
|
|||||||
public void EnumerateShouldYieldAllItemsInCorrectOrder(string testCase, IEnumerable<long> testData, long itemsCount)
|
public void EnumerateShouldYieldAllItemsInCorrectOrder(string testCase, IEnumerable<long> testData, long itemsCount)
|
||||||
{
|
{
|
||||||
// Prepare
|
// Prepare
|
||||||
using var list = new RecyclableList<long>(testData);
|
using var list = new RecyclableList<long>(testData, (int)itemsCount);
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
var yieldedItems = new List<long>((int)itemsCount);
|
var yieldedItems = new List<long>((int)itemsCount);
|
||||||
@@ -385,7 +385,7 @@ namespace Recyclable.CollectionsTests
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Prepare
|
// Prepare
|
||||||
using var list = new RecyclableList<long>(testData);
|
using var list = new RecyclableList<long>(testData, (int)itemsCount);
|
||||||
_ = testData.Any().Should().BeTrue("we need items on the list that we can look for");
|
_ = testData.Any().Should().BeTrue("we need items on the list that we can look for");
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
@@ -404,7 +404,7 @@ namespace Recyclable.CollectionsTests
|
|||||||
public void IndexOfShouldReturnCorrectIndexes(string testCase, IEnumerable<long> testData, long itemsCount)
|
public void IndexOfShouldReturnCorrectIndexes(string testCase, IEnumerable<long> testData, long itemsCount)
|
||||||
{
|
{
|
||||||
// Prepare
|
// Prepare
|
||||||
using var list = new RecyclableList<long>(testData);
|
using var list = new RecyclableList<long>(testData, (int)itemsCount);
|
||||||
|
|
||||||
// Act & Validate
|
// Act & Validate
|
||||||
foreach (var index in testData)
|
foreach (var index in testData)
|
||||||
@@ -424,7 +424,7 @@ namespace Recyclable.CollectionsTests
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
using RecyclableList<long> list = new(testData);
|
using RecyclableList<long> list = new(testData, (int)itemsCount);
|
||||||
QuickSortExtensions<long>.QuickSort(list);
|
QuickSortExtensions<long>.QuickSort(list);
|
||||||
|
|
||||||
// Validate
|
// Validate
|
||||||
@@ -457,7 +457,7 @@ namespace Recyclable.CollectionsTests
|
|||||||
public void InsertAtTheBeginningShouldMoveItems(string testCase, IEnumerable<long> testData, long itemsCount)
|
public void InsertAtTheBeginningShouldMoveItems(string testCase, IEnumerable<long> testData, long itemsCount)
|
||||||
{
|
{
|
||||||
// Prepare
|
// Prepare
|
||||||
using var list = new RecyclableList<long>();
|
using var list = new RecyclableList<long>((int)itemsCount);
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
foreach (var item in testData)
|
foreach (var item in testData)
|
||||||
@@ -492,7 +492,7 @@ namespace Recyclable.CollectionsTests
|
|||||||
public void RemoveAtFromTheBeginningShouldSucceed(string testCase, IEnumerable<long> testData, long itemsCount)
|
public void RemoveAtFromTheBeginningShouldSucceed(string testCase, IEnumerable<long> testData, long itemsCount)
|
||||||
{
|
{
|
||||||
// Prepare
|
// Prepare
|
||||||
using var list = new RecyclableList<long>(testData);
|
using var list = new RecyclableList<long>(testData, (int)itemsCount);
|
||||||
|
|
||||||
// Act & Validate
|
// Act & Validate
|
||||||
for (var deleted = 1; deleted <= itemsCount; deleted++)
|
for (var deleted = 1; deleted <= itemsCount; deleted++)
|
||||||
@@ -514,7 +514,7 @@ namespace Recyclable.CollectionsTests
|
|||||||
public void RemoveAtFromTheEndShouldSucceed(string testCase, IEnumerable<long> testData, long itemsCount)
|
public void RemoveAtFromTheEndShouldSucceed(string testCase, IEnumerable<long> testData, long itemsCount)
|
||||||
{
|
{
|
||||||
// Prepare
|
// Prepare
|
||||||
using var list = new RecyclableList<long>(testData);
|
using var list = new RecyclableList<long>(testData, (int)itemsCount);
|
||||||
|
|
||||||
// Act & Validate
|
// Act & Validate
|
||||||
for (var deleted = 1; deleted <= itemsCount; deleted++)
|
for (var deleted = 1; deleted <= itemsCount; deleted++)
|
||||||
@@ -536,7 +536,7 @@ namespace Recyclable.CollectionsTests
|
|||||||
public void RemoveFromTheBeginningShouldRemoveTheCorrectItem(string testCase, IEnumerable<long> testData, long itemsCount)
|
public void RemoveFromTheBeginningShouldRemoveTheCorrectItem(string testCase, IEnumerable<long> testData, long itemsCount)
|
||||||
{
|
{
|
||||||
// Prepare
|
// Prepare
|
||||||
using var list = new RecyclableList<long>(testData);
|
using var list = new RecyclableList<long>(testData, (int)itemsCount);
|
||||||
|
|
||||||
// Act & Validate
|
// Act & Validate
|
||||||
for (var deleted = 1; deleted <= itemsCount; deleted++)
|
for (var deleted = 1; deleted <= itemsCount; deleted++)
|
||||||
@@ -555,7 +555,7 @@ namespace Recyclable.CollectionsTests
|
|||||||
public void RemoveFromTheEndShouldRemoveTheCorrectItem(string testCase, IEnumerable<long> testData, long itemsCount)
|
public void RemoveFromTheEndShouldRemoveTheCorrectItem(string testCase, IEnumerable<long> testData, long itemsCount)
|
||||||
{
|
{
|
||||||
// Act & Validate
|
// Act & Validate
|
||||||
using var list = new RecyclableList<long>(testData);
|
using var list = new RecyclableList<long>(testData, (int)itemsCount);
|
||||||
long deleted = 0;
|
long deleted = 0;
|
||||||
foreach (var item in testData.Reverse())
|
foreach (var item in testData.Reverse())
|
||||||
{
|
{
|
||||||
@@ -574,7 +574,7 @@ namespace Recyclable.CollectionsTests
|
|||||||
public void VersionedEnumerateShouldYieldAllItemsInCorrectOrder(string testCase, IEnumerable<long> testData, long itemsCount)
|
public void VersionedEnumerateShouldYieldAllItemsInCorrectOrder(string testCase, IEnumerable<long> testData, long itemsCount)
|
||||||
{
|
{
|
||||||
// Prepare
|
// Prepare
|
||||||
using var list = new RecyclableList<long>(testData);
|
using var list = new RecyclableList<long>(testData, (int)itemsCount);
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
var yieldedItems = new List<long>((int)itemsCount);
|
var yieldedItems = new List<long>((int)itemsCount);
|
||||||
|
|||||||
@@ -197,7 +197,7 @@ namespace Recyclable.CollectionsTests
|
|||||||
public void GetByIndexShouldReturnCorrectItem(string testCase, IEnumerable<long> testData, long itemsCount, int targetBlockSize)
|
public void GetByIndexShouldReturnCorrectItem(string testCase, IEnumerable<long> testData, long itemsCount, int targetBlockSize)
|
||||||
{
|
{
|
||||||
// Prepare
|
// Prepare
|
||||||
using var list = new RecyclableLongList<long>(testData, minBlockSize: targetBlockSize);
|
using var list = new RecyclableLongList<long>(testData, minBlockSize: targetBlockSize, itemsCount);
|
||||||
|
|
||||||
// Act & Validate
|
// Act & Validate
|
||||||
foreach (var item in testData)
|
foreach (var item in testData)
|
||||||
@@ -212,7 +212,7 @@ namespace Recyclable.CollectionsTests
|
|||||||
public void AddShouldAddItemWhenAfterAddRange(string testCase, IEnumerable<long> testData, long itemsCount, int targetBlockSize)
|
public void AddShouldAddItemWhenAfterAddRange(string testCase, IEnumerable<long> testData, long itemsCount, int targetBlockSize)
|
||||||
{
|
{
|
||||||
// Act
|
// Act
|
||||||
using var list = new RecyclableLongList<long>(minBlockSize: targetBlockSize);
|
using var list = new RecyclableLongList<long>(minBlockSize: targetBlockSize, itemsCount);
|
||||||
list.AddRange(testData);
|
list.AddRange(testData);
|
||||||
foreach (var index in testData)
|
foreach (var index in testData)
|
||||||
{
|
{
|
||||||
@@ -230,7 +230,7 @@ namespace Recyclable.CollectionsTests
|
|||||||
public void ClearShouldRemoveAllItems(string testCase, IEnumerable<long> testData, long itemsCount, int targetBlockSize)
|
public void ClearShouldRemoveAllItems(string testCase, IEnumerable<long> testData, long itemsCount, int targetBlockSize)
|
||||||
{
|
{
|
||||||
// Prepare
|
// Prepare
|
||||||
using var list = new RecyclableLongList<long>(testData, minBlockSize: targetBlockSize, expectedItemsCount: itemsCount);
|
using var list = new RecyclableLongList<long>(testData, minBlockSize: targetBlockSize, itemsCount);
|
||||||
_ = list.LongCount.Should().Be(itemsCount);
|
_ = list.LongCount.Should().Be(itemsCount);
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
@@ -247,7 +247,7 @@ namespace Recyclable.CollectionsTests
|
|||||||
public void ConsecutiveDisposeShouldSucceed(string testCase, IEnumerable<long> testData, long itemsCount, int targetBlockSize)
|
public void ConsecutiveDisposeShouldSucceed(string testCase, IEnumerable<long> testData, long itemsCount, int targetBlockSize)
|
||||||
{
|
{
|
||||||
// Prepare
|
// Prepare
|
||||||
using var list = new RecyclableLongList<long>(testData, minBlockSize: targetBlockSize);
|
using var list = new RecyclableLongList<long>(testData, minBlockSize: targetBlockSize, itemsCount);
|
||||||
list.Dispose();
|
list.Dispose();
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
@@ -262,7 +262,7 @@ namespace Recyclable.CollectionsTests
|
|||||||
testData = testData.Concat(testData).ToArray();
|
testData = testData.Concat(testData).ToArray();
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
using var list = new RecyclableLongList<long>(testData, minBlockSize: targetBlockSize);
|
using var list = new RecyclableLongList<long>(expectedData, minBlockSize: targetBlockSize, itemsCount);
|
||||||
|
|
||||||
// Validate
|
// Validate
|
||||||
_ = list.LongCount.Should().Be(itemsCount * 2);
|
_ = list.LongCount.Should().Be(itemsCount * 2);
|
||||||
@@ -305,7 +305,7 @@ namespace Recyclable.CollectionsTests
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
using var list = new RecyclableLongList<long>(testData, minBlockSize: targetBlockSize);
|
using var list = new RecyclableLongList<long>(testData, minBlockSize: targetBlockSize, itemsCount);
|
||||||
_ = testData.Any().Should().BeTrue("we need items on the list that we can look for");
|
_ = testData.Any().Should().BeTrue("we need items on the list that we can look for");
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
@@ -321,7 +321,7 @@ namespace Recyclable.CollectionsTests
|
|||||||
public void ContainsShouldNotFindAnythingWhenListEmpty(long itemsCount, int targetBlockSize)
|
public void ContainsShouldNotFindAnythingWhenListEmpty(long itemsCount, int targetBlockSize)
|
||||||
{
|
{
|
||||||
// Prepare
|
// Prepare
|
||||||
using var list = new RecyclableLongList<int>(minBlockSize: targetBlockSize, expectedItemsCount: itemsCount);
|
using var list = new RecyclableLongList<int>(minBlockSize: targetBlockSize, itemsCount);
|
||||||
|
|
||||||
// Validate
|
// Validate
|
||||||
_ = list.Contains(0).Should().BeFalse();
|
_ = list.Contains(0).Should().BeFalse();
|
||||||
@@ -339,7 +339,7 @@ namespace Recyclable.CollectionsTests
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
using var list = new RecyclableLongList<long>(testData, minBlockSize: targetBlockSize);
|
using var list = new RecyclableLongList<long>(testData, minBlockSize: targetBlockSize, itemsCount);
|
||||||
_ = testData.Any().Should().BeTrue("we need items on the list that we can look for");
|
_ = testData.Any().Should().BeTrue("we need items on the list that we can look for");
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
@@ -359,7 +359,7 @@ namespace Recyclable.CollectionsTests
|
|||||||
public void CopyToShouldCopyAllItemsInTheCorrectOrder(string testCase, IEnumerable<long> testData, long itemsCount, int targetBlockSize)
|
public void CopyToShouldCopyAllItemsInTheCorrectOrder(string testCase, IEnumerable<long> testData, long itemsCount, int targetBlockSize)
|
||||||
{
|
{
|
||||||
// Prepare
|
// Prepare
|
||||||
using var list = new RecyclableLongList<long>(testData, minBlockSize: targetBlockSize);
|
using var list = new RecyclableLongList<long>(testData, minBlockSize: targetBlockSize, itemsCount);
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
var actual = new long[itemsCount];
|
var actual = new long[itemsCount];
|
||||||
@@ -372,7 +372,7 @@ namespace Recyclable.CollectionsTests
|
|||||||
public void DisposeShouldSucceed(string testCase, IEnumerable<long> testData, long itemsCount, int targetBlockSize)
|
public void DisposeShouldSucceed(string testCase, IEnumerable<long> testData, long itemsCount, int targetBlockSize)
|
||||||
{
|
{
|
||||||
// Prepare
|
// Prepare
|
||||||
using var list = new RecyclableLongList<long>(testData, minBlockSize: targetBlockSize);
|
using var list = new RecyclableLongList<long>(testData, minBlockSize: targetBlockSize, itemsCount);
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
list.Dispose();
|
list.Dispose();
|
||||||
@@ -387,10 +387,10 @@ namespace Recyclable.CollectionsTests
|
|||||||
public void EnumerateShouldYieldAllItemsInCorrectOrder(string testCase, IEnumerable<long> testData, long itemsCount, int targetBlockSize)
|
public void EnumerateShouldYieldAllItemsInCorrectOrder(string testCase, IEnumerable<long> testData, long itemsCount, int targetBlockSize)
|
||||||
{
|
{
|
||||||
// Prepare
|
// Prepare
|
||||||
using var list = new RecyclableLongList<long>(testData, minBlockSize: targetBlockSize);
|
using var list = new RecyclableLongList<long>(testData, minBlockSize: targetBlockSize, itemsCount);
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
var actual = new List<long>();
|
var actual = new List<long>((int)itemsCount);
|
||||||
using var enumerator = list.GetEnumerator();
|
using var enumerator = list.GetEnumerator();
|
||||||
while (enumerator.MoveNext())
|
while (enumerator.MoveNext())
|
||||||
{
|
{
|
||||||
@@ -406,10 +406,10 @@ namespace Recyclable.CollectionsTests
|
|||||||
public void VersionedEnumerateShouldYieldAllItemsInCorrectOrder(string testCase, IEnumerable<long> testData, long itemsCount, int targetBlockSize)
|
public void VersionedEnumerateShouldYieldAllItemsInCorrectOrder(string testCase, IEnumerable<long> testData, long itemsCount, int targetBlockSize)
|
||||||
{
|
{
|
||||||
// Prepare
|
// Prepare
|
||||||
using var list = new RecyclableLongList<long>(testData, minBlockSize: targetBlockSize);
|
using var list = new RecyclableLongList<long>(testData, minBlockSize: targetBlockSize, itemsCount);
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
var actual = new List<long>();
|
var actual = new List<long>((int)itemsCount);
|
||||||
foreach(var item in (IRecyclableVersionedLongList<long>)list)
|
foreach(var item in (IRecyclableVersionedLongList<long>)list)
|
||||||
{
|
{
|
||||||
actual.Add(item);
|
actual.Add(item);
|
||||||
@@ -442,7 +442,7 @@ namespace Recyclable.CollectionsTests
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Prepare
|
// Prepare
|
||||||
using var list = new RecyclableLongList<long>(testData, minBlockSize: targetBlockSize);
|
using var list = new RecyclableLongList<long>(testData, minBlockSize: targetBlockSize, itemsCount);
|
||||||
_ = testData.Any().Should().BeTrue("we need items on the list that we can look for");
|
_ = testData.Any().Should().BeTrue("we need items on the list that we can look for");
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
@@ -461,7 +461,7 @@ namespace Recyclable.CollectionsTests
|
|||||||
public void IndexOfShouldReturnCorrectIndexes(string testCase, IEnumerable<long> testData, long itemsCount, int targetBlockSize)
|
public void IndexOfShouldReturnCorrectIndexes(string testCase, IEnumerable<long> testData, long itemsCount, int targetBlockSize)
|
||||||
{
|
{
|
||||||
// Prepare
|
// Prepare
|
||||||
using var list = new RecyclableLongList<long>(testData, minBlockSize: targetBlockSize);
|
using var list = new RecyclableLongList<long>(testData, minBlockSize: targetBlockSize, itemsCount);
|
||||||
|
|
||||||
// Act & Validate
|
// Act & Validate
|
||||||
foreach (var item in testData)
|
foreach (var item in testData)
|
||||||
@@ -481,7 +481,7 @@ namespace Recyclable.CollectionsTests
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
using RecyclableLongList<long> list = new(testData, minBlockSize: targetBlockSize);
|
using RecyclableLongList<long> list = new(testData, minBlockSize: targetBlockSize, itemsCount);
|
||||||
QuickSortExtensions<long>.QuickSort(list);
|
QuickSortExtensions<long>.QuickSort(list);
|
||||||
|
|
||||||
// Validate
|
// Validate
|
||||||
@@ -514,7 +514,7 @@ namespace Recyclable.CollectionsTests
|
|||||||
public void InsertAtTheBeginningShouldMoveItems(string testCase, IEnumerable<long> testData, long itemsCount, int targetBlockSize)
|
public void InsertAtTheBeginningShouldMoveItems(string testCase, IEnumerable<long> testData, long itemsCount, int targetBlockSize)
|
||||||
{
|
{
|
||||||
// Prepare
|
// Prepare
|
||||||
using var list = new RecyclableLongList<long>();
|
using var list = new RecyclableLongList<long>(testData, targetBlockSize, itemsCount);
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
foreach (var item in testData)
|
foreach (var item in testData)
|
||||||
@@ -566,7 +566,7 @@ namespace Recyclable.CollectionsTests
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Prepare
|
// Prepare
|
||||||
using var list = new RecyclableLongList<long>(testData, minBlockSize: targetBlockSize);
|
using var list = new RecyclableLongList<long>(testData, minBlockSize: targetBlockSize, itemsCount);
|
||||||
_ = testData.Any().Should().BeTrue("we need items on the list that we can look for");
|
_ = testData.Any().Should().BeTrue("we need items on the list that we can look for");
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
@@ -585,7 +585,7 @@ namespace Recyclable.CollectionsTests
|
|||||||
public void LongIndexOfShouldReturnCorrectIndexes(string testCase, IEnumerable<long> testData, long itemsCount, int targetBlockSize)
|
public void LongIndexOfShouldReturnCorrectIndexes(string testCase, IEnumerable<long> testData, long itemsCount, int targetBlockSize)
|
||||||
{
|
{
|
||||||
// Prepare
|
// Prepare
|
||||||
using var list = new RecyclableLongList<long>(testData, minBlockSize: targetBlockSize);
|
using var list = new RecyclableLongList<long>(testData, minBlockSize: targetBlockSize, itemsCount);
|
||||||
|
|
||||||
// Act & Validate
|
// Act & Validate
|
||||||
foreach (var item in testData)
|
foreach (var item in testData)
|
||||||
@@ -603,7 +603,7 @@ namespace Recyclable.CollectionsTests
|
|||||||
public void RemoveAtFromTheBeginningShouldSucceed(string testCase, IEnumerable<long> testData, long itemsCount, int targetBlockSize)
|
public void RemoveAtFromTheBeginningShouldSucceed(string testCase, IEnumerable<long> testData, long itemsCount, int targetBlockSize)
|
||||||
{
|
{
|
||||||
// Prepare
|
// Prepare
|
||||||
using var list = new RecyclableLongList<long>(testData, minBlockSize: targetBlockSize);
|
using var list = new RecyclableLongList<long>(testData, minBlockSize: targetBlockSize, itemsCount);
|
||||||
var listAsArray = list.ToArray();
|
var listAsArray = list.ToArray();
|
||||||
|
|
||||||
// Act & Validate
|
// Act & Validate
|
||||||
@@ -628,7 +628,7 @@ namespace Recyclable.CollectionsTests
|
|||||||
public void RemoveAtFromTheEndShouldSucceed(string testCase, IEnumerable<long> testData, long itemsCount, int targetBlockSize)
|
public void RemoveAtFromTheEndShouldSucceed(string testCase, IEnumerable<long> testData, long itemsCount, int targetBlockSize)
|
||||||
{
|
{
|
||||||
// Prepare
|
// Prepare
|
||||||
using var list = new RecyclableLongList<long>(testData, minBlockSize: targetBlockSize);
|
using var list = new RecyclableLongList<long>(testData, minBlockSize: targetBlockSize, itemsCount);
|
||||||
var listAsArray = list.ToArray();
|
var listAsArray = list.ToArray();
|
||||||
|
|
||||||
// Act & Validate
|
// Act & Validate
|
||||||
@@ -653,7 +653,7 @@ namespace Recyclable.CollectionsTests
|
|||||||
public void RemoveFromTheBeginningShouldRemoveTheCorrectItem(string testCase, IEnumerable<long> testData, long itemsCount, int targetBlockSize)
|
public void RemoveFromTheBeginningShouldRemoveTheCorrectItem(string testCase, IEnumerable<long> testData, long itemsCount, int targetBlockSize)
|
||||||
{
|
{
|
||||||
// Prepare
|
// Prepare
|
||||||
using var list = new RecyclableLongList<long>(testData, minBlockSize: targetBlockSize);
|
using var list = new RecyclableLongList<long>(testData, targetBlockSize, itemsCount)
|
||||||
var listAsArray = list.ToArray();
|
var listAsArray = list.ToArray();
|
||||||
|
|
||||||
// Act & Validate
|
// Act & Validate
|
||||||
@@ -678,7 +678,7 @@ namespace Recyclable.CollectionsTests
|
|||||||
public void RemoveFromTheEndShouldRemoveTheCorrectItem(string testCase, IEnumerable<long> testData, long itemsCount, int targetBlockSize)
|
public void RemoveFromTheEndShouldRemoveTheCorrectItem(string testCase, IEnumerable<long> testData, long itemsCount, int targetBlockSize)
|
||||||
{
|
{
|
||||||
// Prepare
|
// Prepare
|
||||||
using var list = new RecyclableLongList<long>(testData, minBlockSize: targetBlockSize);
|
using var list = new RecyclableLongList<long>(testData, minBlockSize: targetBlockSize, itemsCount);
|
||||||
var listAsArray = testData.ToArray();
|
var listAsArray = testData.ToArray();
|
||||||
int removedCount = 0;
|
int removedCount = 0;
|
||||||
foreach (var item in testData.Reverse())
|
foreach (var item in testData.Reverse())
|
||||||
|
|||||||
Reference in new issue
Block a user