public static void Aggregate_Product_Seed(Labeled <ParallelQuery <int> > labeled, int count, int start) { ParallelQuery <int> query = labeled.Item; // The operation will overflow for long-running sizes, but that's okay: // The helper is overflowing too! Assert.Equal(Functions.ProductRange(start, count), query.Aggregate(1L, (x, y) => x * y)); }
public static void Aggregate_Product_SeedFunction(Labeled <ParallelQuery <int> > labeled, int count, int start) { ParallelQuery <int> query = labeled.Item; long actual = query.Aggregate( () => 1L, (accumulator, x) => accumulator * x, (left, right) => left * right, result => result + ResultFuncModifier); Assert.Equal(Functions.ProductRange(start, count) + ResultFuncModifier, actual); }
public static void Aggregate_Product_SeedFunction(int count) { ParallelQuery <int> query = ParallelEnumerable.Range(1, count); long actual = query.Aggregate( () => 1L, (accumulator, x) => unchecked (accumulator * x), (left, right) => left * right, result => result + ResultFuncModifier); Assert.Equal(Functions.ProductRange(1, count) + ResultFuncModifier, actual); }
public static void Aggregate_Product_Result(Labeled <ParallelQuery <int> > labeled, int count, int start) { ParallelQuery <int> query = labeled.Item; Assert.Equal(Functions.ProductRange(start, count) + ResultFuncModifier, query.Aggregate(1L, (x, y) => x * y, result => result + ResultFuncModifier)); }
public static void Aggregate_Product_Seed(int count) { // The operation will overflow for long-running sizes, but that's okay: // The helper is overflowing too! Assert.Equal(Functions.ProductRange(1, count), ParallelEnumerable.Range(1, count).Aggregate(1L, (x, y) => unchecked (x * y))); }
public static void Aggregate_Product_Result(int count) { Assert.Equal(Functions.ProductRange(1, count) + ResultFuncModifier, ParallelEnumerable.Range(1, count).Aggregate(1L, (x, y) => unchecked (x * y), result => result + ResultFuncModifier)); }