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_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)); }