CreateBigSourceDataWithBlockSize() will yield only items count + block size if the number of blocks fits max array size.
This commit is contained in:
1 parent
78467e5178
commit
cb2ae350ae
1 file changed
+4
-1
@@ -189,10 +189,13 @@ namespace Recyclable.Collections.TestData
|
|||||||
long itemsCount = Array.MaxLength;
|
long itemsCount = Array.MaxLength;
|
||||||
using var testData = CreateTestData(itemsCount).ToRecyclableLongList();
|
using var testData = CreateTestData(itemsCount).ToRecyclableLongList();
|
||||||
foreach (var blockSize in BlockSizeVariants)
|
foreach (var blockSize in BlockSizeVariants)
|
||||||
|
{
|
||||||
|
if (IsValidBlockSize(itemsCount, blockSize))
|
||||||
{
|
{
|
||||||
yield return ($"long[{itemsCount}]", testData, itemsCount, blockSize);
|
yield return ($"long[{itemsCount}]", testData, itemsCount, blockSize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static IEnumerable<(string TestCase, IEnumerable<long> TestData, long ItemsCount, int BlockSize, IEnumerable<(long ItemIndex, long RangeStartItemIndex, long RangeItemsCount)> ItemIndexesWithRange)> CreateBigSourceDataWithOutOfRangeItemIndexesWithRange()
|
public static IEnumerable<(string TestCase, IEnumerable<long> TestData, long ItemsCount, int BlockSize, IEnumerable<(long ItemIndex, long RangeStartItemIndex, long RangeItemsCount)> ItemIndexesWithRange)> CreateBigSourceDataWithOutOfRangeItemIndexesWithRange()
|
||||||
{
|
{
|
||||||
@@ -439,7 +442,7 @@ namespace Recyclable.Collections.TestData
|
|||||||
yield return index;
|
yield return index;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static bool IsValidBlockSize(long itemsCount, long blockSize) => itemsCount is < 1024 || blockSize is > 8;
|
public static bool IsValidBlockSize(long itemsCount, long blockSize) => itemsCount is < 1024 || (itemsCount / blockSize + (itemsCount % blockSize > 0 ? 1 : 0) <= Array.MaxLength);
|
||||||
|
|
||||||
public static IEnumerable<int> BlockSizeVariants { get; }= new int[]
|
public static IEnumerable<int> BlockSizeVariants { get; }= new int[]
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in new issue
Block a user