public static void GetOrderableDynamicPartitions(long from, long count) { long to = from + count; var partitioner = Partitioner.Create(from, to); //var elements = partitioner.GetOrderableDynamicPartitions().SelectMany(tuple => tuple.UnRoll()); IList <long> elements = new List <long>(); foreach (var partition in partitioner.GetOrderableDynamicPartitions()) { foreach (var item in partition.UnRoll()) { elements.Add(item); } } Assert.True(elements.CompareSequences <long>(RangePartitionerHelpers.LongEnumerable(from, to)), "GetOrderableDynamicPartitions Element mismatch"); //var keys = partitioner.GetOrderableDynamicPartitions().Select(tuple => tuple.Key).ToArray(); IList <long> keys = new List <long>(); foreach (var tuple in partitioner.GetOrderableDynamicPartitions()) { keys.Add(tuple.Key); } Assert.True(keys.CompareSequences <long>(RangePartitionerHelpers.LongEnumerable(keys[0], keys.Count)), "GetOrderableDynamicPartitions key mismatch"); }
public static void CheckGetDynamicPartitionsWithRange(long from, long count, long desiredRangeSize) { long to = from + count; var partitioner = Partitioner.Create(from, to, desiredRangeSize); //var elements = partitioner.GetDynamicPartitions().SelectMany(tuple => tuple.UnRoll()); IList <long> elements = new List <long>(); foreach (var partition in partitioner.GetDynamicPartitions()) { foreach (var item in partition.UnRoll()) { elements.Add(item); } } Assert.True(elements.CompareSequences <long>(RangePartitionerHelpers.LongEnumerable(from, to)), "GetDynamicPartitions Element mismatch"); //var rangeSizes = partitioner.GetDynamicPartitions().Select(tuple => tuple.GetRangeSize()).ToArray(); IList <long> rangeSizes = new List <long>(); foreach (var partition in partitioner.GetDynamicPartitions()) { rangeSizes.Add(partition.GetRangeSize()); } ValidateRangeSize(desiredRangeSize, rangeSizes); }
public static void CheckGetOrderablePartitions(long from, long count, int dop) { long to = from + count; var partitioner = Partitioner.Create(from, to); //var elements = partitioner.GetOrderablePartitions(dop).SelectMany(enumerator => enumerator.UnRoll()); IList <long> elements = new List <long>(); foreach (var partition in partitioner.GetPartitions(dop)) { foreach (var item in partition.UnRoll()) { elements.Add(item); } } Assert.True(elements.CompareSequences <long>(RangePartitionerHelpers.LongEnumerable(from, to)), "GetOrderablePartitions Element mismatch"); //var keys = partitioner.GetOrderablePartitions(dop).SelectMany(enumerator => enumerator.UnRollIndices()).ToArray(); IList <long> keys = new List <long>(); foreach (var partition in partitioner.GetOrderablePartitions(dop)) { foreach (var item in partition.UnRollIndices()) { keys.Add(item); } } Assert.True(keys.CompareSequences <long>(RangePartitionerHelpers.LongEnumerable(keys[0], keys.Count)), "GetOrderablePartitions key mismatch"); }
public static void GetOrderableDynamicPartitionsWithRange(int from, int count, int desiredRangeSize) { int to = from + count; var partitioner = Partitioner.Create(from, to, desiredRangeSize); //var elements = partitioner.GetOrderableDynamicPartitions().SelectMany(tuple => tuple.UnRoll()); IList <int> elements = new List <int>(); foreach (var tuple in partitioner.GetOrderableDynamicPartitions()) { foreach (var item in tuple.UnRoll()) { elements.Add(item); } } Assert.True(elements.CompareSequences <int>(RangePartitionerHelpers.IntEnumerable(from, to)), "GetOrderableDynamicPartitions Element mismatch"); //var keys = partitioner.GetOrderableDynamicPartitions().Select(tuple => tuple.Key).ToArray(); IList <long> keys = new List <long>(); foreach (var tuple in partitioner.GetOrderableDynamicPartitions()) { keys.Add(tuple.Key); } Assert.True(keys.CompareSequences <long>(RangePartitionerHelpers.LongEnumerable(keys[0], keys.Count)), "GetOrderableDynamicPartitions key mismatch"); //var rangeSizes = partitioner.GetOrderableDynamicPartitions().Select(tuple => tuple.GetRangeSize()).ToArray(); IList <int> rangeSizes = new List <int>(); foreach (var partition in partitioner.GetOrderableDynamicPartitions()) { rangeSizes.Add(partition.GetRangeSize()); } ValidateRangeSize(desiredRangeSize, rangeSizes); }
public static void CheckGetPartitionsWithRange(int from, int count, int desiredRangeSize, int dop) { int to = from + count; var partitioner = Partitioner.Create(from, to, desiredRangeSize); //var elements = partitioner.GetPartitions(dop).SelectMany(enumerator => enumerator.UnRoll()); IList <int> elements = new List <int>(); foreach (var partition in partitioner.GetPartitions(dop)) { foreach (var item in partition.UnRoll()) { elements.Add(item); } } Assert.True(elements.CompareSequences <int>(RangePartitionerHelpers.IntEnumerable(from, to)), "GetPartitions element mismatch"); //var rangeSizes = partitioner.GetPartitions(dop).SelectMany(enumerator => enumerator.GetRangeSize()).ToArray(); IList <int> rangeSizes = new List <int>(); foreach (var partition in partitioner.GetPartitions(dop)) { foreach (var item in partition.GetRangeSize()) { rangeSizes.Add(item); } } ValidateRangeSize(desiredRangeSize, rangeSizes); }
public static void CheckGetDynamicPartitions(int from, int count) { int to = from + count; var partitioner = Partitioner.Create(from, to); //var elements = partitioner.GetDynamicPartitions().SelectMany(tuple => tuple.UnRoll()); IList <int> elements = new List <int>(); foreach (var partition in partitioner.GetDynamicPartitions()) { foreach (var item in partition.UnRoll()) { elements.Add(item); } } Assert.True(elements.CompareSequences <int>(RangePartitionerHelpers.IntEnumerable(from, to)), "GetDynamicPartitions Element mismatch"); }
public static void CheckGetPartitions(int from, int count, int dop) { int to = from + count; var partitioner = Partitioner.Create(from, to); //var elements = dopPartitions.SelectMany(enumerator => enumerator.UnRoll()); IList <int> elements = new List <int>(); foreach (var partition in partitioner.GetPartitions(dop)) { foreach (var item in partition.UnRoll()) { elements.Add(item); } } Assert.True(elements.CompareSequences <int>(RangePartitionerHelpers.IntEnumerable(from, to)), "GetPartitions element mismatch"); }