Пример #1
0
 public static void FirstOrDefault_Longrunning(Labeled <ParallelQuery <int> > labeled, int count, int position)
 {
     FirstOrDefault(labeled, count, position);
 }
Пример #2
0
 public static void First_NoMatch_Longrunning(Labeled <ParallelQuery <int> > labeled, int count, int position)
 {
     First_NoMatch(labeled, count, position);
 }
Пример #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(); }));
 }
Пример #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);
 }
Пример #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();
        }
Пример #6
0
 public static void Distinct_Longrunning(Labeled <ParallelQuery <int> > labeled, int count)
 {
     Distinct(labeled, count);
 }
Пример #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());
 }
Пример #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);
        }
Пример #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);
 }
Пример #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);
        }
Пример #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();
        }
Пример #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);
        }
Пример #13
0
 public static void Partitioning_Default_Longrunning(Labeled <ParallelQuery <int> > labeled, int count, int partitions)
 {
     Partitioning_Default(labeled, count, partitions);
 }
Пример #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));
        }
Пример #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());
        }
Пример #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();
        }
Пример #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());
        }
Пример #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);
        }
Пример #19
0
 public static void Distinct_Unordered_NotPipelined_Longrunning(Labeled <ParallelQuery <int> > labeled, int count)
 {
     Distinct_Unordered_NotPipelined(labeled, count);
 }
Пример #20
0
 public static void Merge_Ordered_Longrunning(Labeled <ParallelQuery <int> > labeled, int count, ParallelMergeOptions options)
 {
     Merge_Ordered(labeled, count, options);
 }