public static void FirstOrDefault_Longrunning(Labeled <ParallelQuery <int> > labeled, int count, int position) { FirstOrDefault(labeled, count, position); }
public static void First_NoMatch_Longrunning(Labeled <ParallelQuery <int> > labeled, int count, int position) { First_NoMatch(labeled, count, position); }
public static void First_AggregateException(Labeled <ParallelQuery <int> > labeled, int count) { Functions.AssertThrowsWrapped <DeliberateTestException>(() => labeled.Item.First(x => { throw new DeliberateTestException(); })); Functions.AssertThrowsWrapped <DeliberateTestException>(() => labeled.Item.FirstOrDefault(x => { throw new DeliberateTestException(); })); }
public static void Intersect_Longrunning(Labeled <ParallelQuery <int> > left, int leftCount, Labeled <ParallelQuery <int> > right, int rightCount, int count) { Intersect(left, leftCount, right, rightCount, count); }
public static void Intersect_Unordered_NotPipelined(Labeled <ParallelQuery <int> > left, int leftCount, Labeled <ParallelQuery <int> > right, int rightCount, int count) { ParallelQuery <int> leftQuery = left.Item; ParallelQuery <int> rightQuery = right.Item; IntegerRangeSet seen = new IntegerRangeSet(0, count); Assert.All(leftQuery.Intersect(rightQuery).ToList(), x => seen.Add(x)); seen.AssertComplete(); }
public static void Distinct_Longrunning(Labeled <ParallelQuery <int> > labeled, int count) { Distinct(labeled, count); }
// FailingMergeData has enumerables that throw errors when attempting to perform the nth enumeration. // This test checks whether the query runs in a pipelined or buffered fashion. public static void Merge_Ordered_Pipelining(Labeled <ParallelQuery <int> > labeled, int count, ParallelMergeOptions options) { Assert.Equal(0, labeled.Item.WithDegreeOfParallelism(count - 1).WithMergeOptions(options).First()); }
public static void Intersect_Distinct_NotPipelined(Labeled <ParallelQuery <int> > left, int leftCount, Labeled <ParallelQuery <int> > right, int rightCount, int count) { ParallelQuery <int> leftQuery = left.Item; ParallelQuery <int> rightQuery = right.Item; leftCount = Math.Min(DuplicateFactor * 2, leftCount); rightCount = Math.Min(DuplicateFactor, (rightCount + 1) / 2); int seen = 0; Assert.All(leftQuery.Intersect(rightQuery.Select(x => Math.Abs(x) % DuplicateFactor), new ModularCongruenceComparer(DuplicateFactor * 2)).ToList(), x => Assert.Equal(seen++, x)); Assert.Equal(Math.Min(leftCount, rightCount), seen); }
public static void Intersect_Distinct_NotPipelined_Longrunning(Labeled <ParallelQuery <int> > left, int leftCount, Labeled <ParallelQuery <int> > right, int rightCount, int count) { Intersect_Distinct_NotPipelined(left, leftCount, right, rightCount, count); }
public static void Intersect_Distinct(Labeled <ParallelQuery <int> > left, int leftCount, Labeled <ParallelQuery <int> > right, int rightCount, int count) { ParallelQuery <int> leftQuery = left.Item; ParallelQuery <int> rightQuery = right.Item; leftCount = Math.Min(DuplicateFactor * 2, leftCount); rightCount = Math.Min(DuplicateFactor, (rightCount + 1) / 2); int seen = 0; foreach (int i in leftQuery.Intersect(rightQuery.Select(x => Math.Abs(x) % DuplicateFactor), new ModularCongruenceComparer(DuplicateFactor * 2))) { Assert.Equal(seen++, i); } Assert.Equal(Math.Min(leftCount, rightCount), seen); }
public static void Intersect_Unordered_Distinct_NotPipelined(Labeled <ParallelQuery <int> > left, int leftCount, Labeled <ParallelQuery <int> > right, int rightCount, int count) { ParallelQuery <int> leftQuery = left.Item; ParallelQuery <int> rightQuery = right.Item; leftCount = Math.Min(DuplicateFactor * 2, leftCount); rightCount = Math.Min(DuplicateFactor, (rightCount + 1) / 2); IntegerRangeSet seen = new IntegerRangeSet(0, Math.Min(leftCount, rightCount)); Assert.All(leftQuery.Intersect(rightQuery.Select(x => Math.Abs(x) % DuplicateFactor), new ModularCongruenceComparer(DuplicateFactor * 2)).ToList(), x => seen.Add(x % (DuplicateFactor * 2))); seen.AssertComplete(); }
public static void Intersect_NotPipelined(Labeled <ParallelQuery <int> > left, int leftCount, Labeled <ParallelQuery <int> > right, int rightCount, int count) { ParallelQuery <int> leftQuery = left.Item; ParallelQuery <int> rightQuery = right.Item; int seen = 0; Assert.All(leftQuery.Intersect(rightQuery).ToList(), x => Assert.Equal(seen++, x)); Assert.Equal(count, seen); }
public static void Partitioning_Default_Longrunning(Labeled <ParallelQuery <int> > labeled, int count, int partitions) { Partitioning_Default(labeled, count, partitions); }
public static void Merge_ArgumentException(Labeled <ParallelQuery <int> > labeled, int count) { ParallelQuery <int> query = labeled.Item; Assert.Throws <ArgumentException>(() => query.WithMergeOptions((ParallelMergeOptions)4)); }
public static void First_Empty(Labeled <ParallelQuery <int> > labeled, int count, int position) { ParallelQuery <int> query = labeled.Item; Assert.Throws <InvalidOperationException>(() => query.First()); }
public static void Intersect_Unordered(Labeled <ParallelQuery <int> > left, int leftCount, Labeled <ParallelQuery <int> > right, int rightCount, int count) { ParallelQuery <int> leftQuery = left.Item; ParallelQuery <int> rightQuery = right.Item; IntegerRangeSet seen = new IntegerRangeSet(0, count); foreach (int i in leftQuery.Intersect(rightQuery)) { seen.Add(i); } seen.AssertComplete(); }
public static void FirstOrDefault_Empty(Labeled <ParallelQuery <int> > labeled, int count, int position) { ParallelQuery <int> query = labeled.Item; Assert.Equal(default(int), query.FirstOrDefault()); }
public static void Intersect(Labeled <ParallelQuery <int> > left, int leftCount, Labeled <ParallelQuery <int> > right, int rightCount, int count) { ParallelQuery <int> leftQuery = left.Item; ParallelQuery <int> rightQuery = right.Item; int seen = 0; foreach (int i in leftQuery.Intersect(rightQuery)) { Assert.Equal(seen++, i); } Assert.Equal(count, seen); }
public static void Distinct_Unordered_NotPipelined_Longrunning(Labeled <ParallelQuery <int> > labeled, int count) { Distinct_Unordered_NotPipelined(labeled, count); }
public static void Merge_Ordered_Longrunning(Labeled <ParallelQuery <int> > labeled, int count, ParallelMergeOptions options) { Merge_Ordered(labeled, count, options); }