Пример #1
0
    public void BlinqShouldEqualLinqNativeArrayElementAt([ArrayValues] int[] sourceArr)
    {
        var index    = 10;
        var source   = new NativeArray <int>(sourceArr, Allocator.Persistent);
        var expected = ExceptionAndValue(() => Linq.ElementAt(source, index));
        var actual   = ExceptionAndValue(() => Blinq.ElementAt(source, index));

        AssertAreEqual(expected, actual);
        source.Dispose();
    }
Пример #2
0
    public void BlinqShouldEqualLinqNativeSequenceScheduleElementAt([ArrayValues] int[] sourceArr)
    {
        var index = 10;

        using (var source = new NativeArray <int>(sourceArr, Allocator.Persistent))
        {
            var seq      = Blinq.ToValueSequence(in source);
            var expected = ExceptionAndValue(() => Linq.ElementAt(seq, index));
            if (expected.exception != null)
            {
                return;
            }
            var actual = ExceptionAndValue(() => Blinq.ScheduleElementAt(seq, index).Complete());
            AssertAreEqual(expected, actual);
        }
    }
Пример #3
0
 public static TSource ElementAt <TSource>(this IEnumerable <TSource> source, int index) =>
 LinqEnumerable.ElementAt(source, index);