Ejemplo n.º 1
0
 public static void SkipWhile_Indexed_NotPipelined_Longrunning(Labeled <ParallelQuery <int> > labeled, int count, int skip)
 {
     SkipWhile_Indexed_NotPipelined(labeled, count, skip);
 }
Ejemplo n.º 2
0
 public static void Join_CustomComparator_LeftWithOrderingColisions_UnorderedRight_Longrunning(Labeled <ParallelQuery <int> > left, int leftCount, Labeled <ParallelQuery <int> > right, int rightCount)
 {
     Join_CustomComparator_LeftWithOrderingColisions_UnorderedRight(left, leftCount, right, rightCount);
 }
Ejemplo n.º 3
0
 public static void Average_Float_Longrunning(Labeled <ParallelQuery <int> > labeled, int count, float average)
 {
     Average_Float(labeled, count, average);
 }
Ejemplo n.º 4
0
 public static void Join_Multiple_LeftWithOrderingColisions_Longrunning(Labeled <ParallelQuery <int> > left, int leftCount, Labeled <ParallelQuery <int> > right, int rightCount)
 {
     Join_Multiple_LeftWithOrderingColisions(left, leftCount, right, rightCount);
 }
Ejemplo n.º 5
0
 public static void Join_CustomComparator_Longrunning(Labeled <ParallelQuery <int> > left, int leftCount, Labeled <ParallelQuery <int> > right, int rightCount)
 {
     Join_CustomComparator(left, leftCount, right, rightCount);
 }
Ejemplo n.º 6
0
 public static void ForAll_Longrunning(Labeled <ParallelQuery <int> > labeled, int count)
 {
     ForAll(labeled, count);
 }
Ejemplo n.º 7
0
        public static void Join_Multiple(Labeled <ParallelQuery <int> > left, int leftCount, Labeled <ParallelQuery <int> > right, int rightCount)
        {
            ParallelQuery <int> leftQuery  = left.Item;
            ParallelQuery <int> rightQuery = right.Item;
            int seen = 0;

            Assert.All(leftQuery.Join(rightQuery, x => x, y => y / KeyFactor, (x, y) => KeyValuePair.Create(x, y)),
                       p =>
            {
                Assert.Equal(p.Key, p.Value / KeyFactor);
                Assert.Equal(seen++, p.Value);
            });
            Assert.Equal(Math.Min(leftCount * KeyFactor, rightCount), seen);
        }
Ejemplo n.º 8
0
 public static void Cast_Valid_NotPipelined_Longrunning(Labeled <ParallelQuery <int> > labeled, int count)
 {
     Cast_Valid(labeled, count);
 }
Ejemplo n.º 9
0
        public static void WithExecutionMode_ArgumentException(Labeled <ParallelQuery <int> > labeled, int count)
        {
            ParallelQuery <int> query = labeled.Item;

            AssertExtensions.Throws <ArgumentException>(null, () => query.WithExecutionMode((ParallelExecutionMode)2));
        }
Ejemplo n.º 10
0
 public static void Cast_Assignable_InvalidCastException(Labeled <ParallelQuery <int> > labeled, int count)
 {
     Functions.AssertThrowsWrapped <InvalidCastException>(() => labeled.Item.Select(x => (Int32)x).Cast <Castable>().ForAll(x => {; }));
     Functions.AssertThrowsWrapped <InvalidCastException>(() => labeled.Item.Select(x => (Int32)x).Cast <Castable>().ToList());
 }
Ejemplo n.º 11
0
 public static void Cast_Unordered_Valid_Longrunning(Labeled <ParallelQuery <int> > labeled, int count)
 {
     Cast_Unordered_Valid(labeled, count);
 }
Ejemplo n.º 12
0
 public static void Skip_Longrunning(Labeled <ParallelQuery <int> > labeled, int count, int skip)
 {
     Skip(labeled, count, skip);
 }
Ejemplo n.º 13
0
 public static void SkipWhile_SomeFalse_Longrunning(Labeled <ParallelQuery <int> > labeled, int count, int[] skip)
 {
     SkipWhile_SomeFalse(labeled, count, skip);
 }
Ejemplo n.º 14
0
 public static void SkipWhile_AllTrue_Longrunning(Labeled <ParallelQuery <int> > labeled, int count, int skip)
 {
     SkipWhile_AllTrue(labeled, count, skip);
 }
Ejemplo n.º 15
0
        public static void Concat(Labeled <ParallelQuery <int> > left, int leftCount, Labeled <ParallelQuery <int> > right, int rightCount)
        {
            // The ordering of Concat is only guaranteed when both operands are ordered,
            // however the current implementation manages to perform ordering if either operand is ordered _in most cases_.
            // If this test starts failing, consider revising the operators and mention the change in release notes.
            ParallelQuery <int> leftQuery  = left.Item;
            ParallelQuery <int> rightQuery = right.Item;
            int seen = 0;

            foreach (int i in leftQuery.Concat(rightQuery))
            {
                Assert.Equal(seen++, i);
            }
            Assert.Equal(seen, leftCount + rightCount);
        }
Ejemplo n.º 16
0
 private static IEnumerable <Labeled <Action <UsedTaskTracker, ParallelQuery <int> > > > EasyOrderedQueries(int count)
 {
     yield return(Labeled.Label <Action <UsedTaskTracker, ParallelQuery <int> > >("Where+Select+Concat(AsOrdered+Where)+ToList",
                                                                                  (verifier, query) => query.Where(x => true).Select(x => verifier.AddCurrent(x)).Concat(Enumerable.Range(0, count).AsParallel().AsOrdered().Where(x => true)).ToList()));
 }
Ejemplo n.º 17
0
 public static void Concat_Longrunning(Labeled <ParallelQuery <int> > left, int leftCount, Labeled <ParallelQuery <int> > right, int rightCount)
 {
     Concat(left, leftCount, right, rightCount);
 }
Ejemplo n.º 18
0
 public static void OfType_Unordered_AllValid_Longrunning(Labeled <ParallelQuery <int> > labeled, int count)
 {
     OfType_Unordered_AllValid(labeled, count);
 }
Ejemplo n.º 19
0
 public static void ForAll_AggregateException(Labeled <ParallelQuery <int> > labeled, int count)
 {
     Functions.AssertThrowsWrapped <DeliberateTestException>(() => labeled.Item.ForAll(x => { throw new DeliberateTestException(); }));
     Functions.AssertThrowsWrapped <DeliberateTestException>(() => labeled.Item.Select((Func <int, int>)(x => { throw new DeliberateTestException(); })).ForAll(x => { }));
 }
Ejemplo n.º 20
0
 public static void OfType_SomeNull_Longrunning(Labeled <ParallelQuery <int> > labeled, int count)
 {
     OfType_SomeNull(labeled, count);
 }
Ejemplo n.º 21
0
        public static void Join_Multiple_LeftWithOrderingColisions(Labeled <ParallelQuery <int> > left, int leftCount, Labeled <ParallelQuery <int> > right, int rightCount)
        {
            LeftOrderingCollisionTestWithOrderedRight validator = new LeftOrderingCollisionTestWithOrderedRight();

            validator.Validate(left.Item, leftCount, right.Item, rightCount);
        }
Ejemplo n.º 22
0
 public static void OfType_AllValid_NotPipelined_Longrunning(Labeled <ParallelQuery <int> > labeled, int count)
 {
     OfType_AllValid_NotPipelined(labeled, count);
 }
Ejemplo n.º 23
0
        public static void Join_CustomComparator(Labeled <ParallelQuery <int> > left, int leftCount, Labeled <ParallelQuery <int> > right, int rightCount)
        {
            ParallelQuery <int> leftQuery  = left.Item;
            ParallelQuery <int> rightQuery = right.Item;
            int seenOuter     = 0;
            int previousOuter = -1;
            int seenInner     = Math.Max(previousOuter % KeyFactor, rightCount - KeyFactor + previousOuter % KeyFactor);

            Assert.All(leftQuery.Join(rightQuery, x => x, y => y,
                                      (x, y) => KeyValuePair.Create(x, y), new ModularCongruenceComparer(KeyFactor)),
                       p =>
            {
                if (p.Key != previousOuter)
                {
                    Assert.Equal(seenOuter, p.Key);
                    Assert.Equal(p.Key % 8, p.Value);
                    // If there aren't sufficient elements in the RHS (< 8), the LHS skips an entry at the end of the mod cycle.
                    seenOuter = Math.Min(leftCount, seenOuter + (p.Key % KeyFactor + 1 == rightCount ? KeyFactor - p.Key % KeyFactor : 1));
                    Assert.Equal(Math.Max(previousOuter % KeyFactor, rightCount - KeyFactor + previousOuter % KeyFactor), seenInner);
                    previousOuter = p.Key;
                    seenInner     = (p.Key % KeyFactor) - KeyFactor;
                }
                Assert.Equal(p.Key % KeyFactor, p.Value % KeyFactor);
                Assert.Equal(seenInner += KeyFactor, p.Value);
            });
            Assert.Equal(rightCount == 0 ? 0 : leftCount, seenOuter);
            Assert.Equal(Math.Max(previousOuter % KeyFactor, rightCount - KeyFactor + previousOuter % KeyFactor), seenInner);
        }
Ejemplo n.º 24
0
        public static void OfType_NoneValid(Labeled <ParallelQuery <int> > labeled, int count)
        {
            ParallelQuery <int> query = labeled.Item;

            Assert.Empty(query.OfType <long>());
        }
Ejemplo n.º 25
0
        public static void Join_CustomComparator_LeftWithOrderingColisions_UnorderedRight(Labeled <ParallelQuery <int> > left, int leftCount, Labeled <ParallelQuery <int> > right, int rightCount)
        {
            LeftOrderingCollisionTestWithUnorderedRightAndCustomComparator validator = new LeftOrderingCollisionTestWithUnorderedRightAndCustomComparator();

            validator.Validate(left.Item, leftCount, right.Item, rightCount);
        }
Ejemplo n.º 26
0
 public static void Distinct_Longrunning(Labeled <ParallelQuery <int> > labeled, int count)
 {
     Distinct(labeled, count);
 }
Ejemplo n.º 27
0
 public static void Join_Longrunning(Labeled <ParallelQuery <int> > left, int leftCount, int rightCount)
 {
     Join(left, leftCount, rightCount);
 }
Ejemplo n.º 28
0
 public static void Distinct_Unordered_NotPipelined_Longrunning(Labeled <ParallelQuery <int> > labeled, int count)
 {
     Distinct_Unordered_NotPipelined(labeled, count);
 }
Ejemplo n.º 29
0
 public static void Average_Double_Longrunning(Labeled <ParallelQuery <int> > labeled, int count, double average)
 {
     Average_Double(labeled, count, average);
 }
Ejemplo n.º 30
0
 public static void Select_NotPipelined_Longrunning(Labeled <ParallelQuery <int> > labeled, int count)
 {
     Select_NotPipelined(labeled, count);
 }