Example #1
0
 public static void FirstOrDefault_Longrunning(Labeled <ParallelQuery <int> > labeled, int count, int position)
 {
     FirstOrDefault(labeled, count, position);
 }
Example #2
0
 public static void First_NoMatch_Longrunning(Labeled <ParallelQuery <int> > labeled, int count, int position)
 {
     First_NoMatch(labeled, count, position);
 }
Example #3
0
 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(); }));
 }
Example #4
0
 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);
 }
Example #5
0
        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();
        }
Example #6
0
 public static void Distinct_Longrunning(Labeled <ParallelQuery <int> > labeled, int count)
 {
     Distinct(labeled, count);
 }
Example #7
0
 // 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());
 }
Example #8
0
        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);
        }
Example #9
0
 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);
 }
Example #10
0
        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);
        }
Example #11
0
        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();
        }
Example #12
0
        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);
        }
Example #13
0
 public static void Partitioning_Default_Longrunning(Labeled <ParallelQuery <int> > labeled, int count, int partitions)
 {
     Partitioning_Default(labeled, count, partitions);
 }
Example #14
0
        public static void Merge_ArgumentException(Labeled <ParallelQuery <int> > labeled, int count)
        {
            ParallelQuery <int> query = labeled.Item;

            Assert.Throws <ArgumentException>(() => query.WithMergeOptions((ParallelMergeOptions)4));
        }
Example #15
0
        public static void First_Empty(Labeled <ParallelQuery <int> > labeled, int count, int position)
        {
            ParallelQuery <int> query = labeled.Item;

            Assert.Throws <InvalidOperationException>(() => query.First());
        }
Example #16
0
        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();
        }
Example #17
0
        public static void FirstOrDefault_Empty(Labeled <ParallelQuery <int> > labeled, int count, int position)
        {
            ParallelQuery <int> query = labeled.Item;

            Assert.Equal(default(int), query.FirstOrDefault());
        }
Example #18
0
        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);
        }
Example #19
0
 public static void Distinct_Unordered_NotPipelined_Longrunning(Labeled <ParallelQuery <int> > labeled, int count)
 {
     Distinct_Unordered_NotPipelined(labeled, count);
 }
Example #20
0
 public static void Merge_Ordered_Longrunning(Labeled <ParallelQuery <int> > labeled, int count, ParallelMergeOptions options)
 {
     Merge_Ordered(labeled, count, options);
 }