コード例 #1
0
    public void BlinqShouldEqualLinqNativeArrayOrderByDescending([OrderValues] Order[] sourceArr)
    {
        var source   = new NativeArray <Order>(sourceArr, Allocator.Persistent);
        var expected = ExceptionAndValue(() => Linq.ToArray(Linq.OrderByDescending(source, SelectFirst.Invoke)));
        var actual   = ExceptionAndValue(() => Linq.ToArray(Blinq.OrderByDescending(source, SelectFirst)));

        AssertAreEqual(expected, actual);
        source.Dispose();
    }
コード例 #2
0
    public void BlinqSelect_int(
        [ValueSource(typeof(SelectValues), nameof(SelectValues.Values))] int[] sourceArr
        )
    {
        var src = new NativeArray <int>(sourceArr, Allocator.Persistent);

        MakeMeasurement("Blinq_int", () => Blinq.RunAverage(src, IntTo_int)).Run();
        src.Dispose();
    }
コード例 #3
0
    public void BlinqShouldEqualLinqNativeArraySequenceCountPredicate([ArrayValues] int[] sourceArr)
    {
        var sourceNativeArr = new NativeArray <int>(sourceArr, Allocator.Persistent);
        var expected        = ExceptionAndValue(() => Linq.Count(sourceNativeArr, EqualsOne.Invoke));
        var actual          = ExceptionAndValue(() => Blinq.Count(sourceNativeArr, EqualsOne));

        AssertAreEqual(expected, actual);
        sourceNativeArr.Dispose();
    }
コード例 #4
0
    public void Blinq_float(
        [ValueSource(typeof(Values_float), nameof(Values_float.Values))] float[] sourceArr
        )
    {
        var src = new NativeArray <float>(sourceArr, Allocator.Persistent);

        MakeMeasurement("Blinq_float", () => Blinq.RunAverage(src)).Run();
        src.Dispose();
    }
コード例 #5
0
    public void Blinq_double(
        [ValueSource(typeof(Values_double), nameof(Values_double.Values))] double[] sourceArr
        )
    {
        var src = new NativeArray <double>(sourceArr, Allocator.Persistent);

        MakeMeasurement("Blinq_double", () => Blinq.RunAverage(src)).Run();
        src.Dispose();
    }
コード例 #6
0
    public void BlinqShouldEqualLinqNativeArrayMinComparableSelector([ArrayValues] int[] sourceArr)
    {
        var arr            = Linq.ToArray(Linq.Select(sourceArr, (i) => (Comparable)i));
        var srcNativeArray = new NativeArray <Comparable>(arr, Allocator.Persistent);
        var expected       = ExceptionAndValue(() => Linq.Min(srcNativeArray, SelectSelf <Comparable>().Invoke));
        var actual         = ExceptionAndValue(() => Blinq.Min(srcNativeArray, SelectSelf <Comparable>()));

        srcNativeArray.Dispose();
    }
コード例 #7
0
    public void BlinqShouldEqualLinqNativeArrayWhereWithIndex([ArrayValues] int[] sourceArr)
    {
        var source   = new NativeArray <int>(sourceArr, Allocator.Persistent);
        var expected = ExceptionAndValue(() => Linq.ToArray(Linq.Where(source, EqualToIndex.Invoke)));
        var actual   = ExceptionAndValue(() => Linq.ToArray(Blinq.Where(source, EqualToIndex)));

        AssertAreEqual(expected, actual);
        source.Dispose();
    }
コード例 #8
0
    public void BlinqShouldEqualLinqNativeArraySelect([ArrayValues] int[] sourceArr)
    {
        var source   = new NativeArray <int>(sourceArr, Allocator.Persistent);
        var expected = ExceptionAndValue(() => Linq.ToArray(Linq.Select(source, IntToLong.Invoke)));
        var actual   = ExceptionAndValue(() => Linq.ToArray(Blinq.Select(source, IntToLong)));

        AssertAreEqual(expected, actual);
        source.Dispose();
    }
コード例 #9
0
    public void BlinqShouldEqualLinqNativeArraySelectManyIndexResultSelector([ArrayValues] int[] sourceArr)
    {
        var sourceNativeArr = new NativeArray <int>(sourceArr, Allocator.Persistent);
        var expected        = ExceptionAndValue(() => Linq.ToArray(Linq.SelectMany(sourceNativeArr, (x, i) => RepeatAmountPlusIndex.Invoke(x, i), AddToIndex.Invoke)));
        var actual          = ExceptionAndValue(() => Linq.ToArray(Blinq.SelectMany(sourceNativeArr, RepeatAmountPlusIndex, AddToIndex)));

        AssertAreEqual(expected, actual);
        sourceNativeArr.Dispose();
    }
コード例 #10
0
    public void BlinqShouldEqualLinqNativeArrayAnyPredicate([ArrayValues] int[] sourceArr)
    {
        var source   = new NativeArray <int>(sourceArr, Allocator.Persistent);
        var expected = ExceptionAndValue(() => Linq.Any(source, EqualsZero.Invoke));
        var actual   = ExceptionAndValue(() => Blinq.Any(source, EqualsZero));

        AssertAreEqual(expected, actual);
        source.Dispose();
    }
コード例 #11
0
    public void BlinqShouldEqualLinqValueSequenceLongCount([ArrayValues] int[] sourceArr)
    {
        var sourceNativeArr = new NativeArray <int>(sourceArr, Allocator.Persistent);
        var source          = sourceNativeArr.ToValueSequence();
        var expected        = ExceptionAndValue(() => Linq.LongCount(source));
        var actual          = ExceptionAndValue(() => Blinq.LongCount(source));

        AssertAreEqual(expected, actual);
        sourceNativeArr.Dispose();
    }
コード例 #12
0
    public void BlinqShouldEqualLinqNativeArrayPrepend([ArrayValues] int[] sourceArr)
    {
        int item     = 1;
        var source   = new NativeArray <int>(sourceArr, Allocator.Persistent);
        var expected = ExceptionAndValue(() => Linq.ToArray(Linq.Prepend(source, item)));
        var actual   = ExceptionAndValue(() => Linq.ToArray(Blinq.Prepend(source, item)));

        AssertAreEqual(expected, actual);
        source.Dispose();
    }
コード例 #13
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();
    }
コード例 #14
0
    public void BlinqShouldEqualLinqNativeArrayMinSelector_double(
        [ValueSource(typeof(Values_double), nameof(Values_double.Values))] double[] sourceArr
        )
    {
        var srcNativeArray = new NativeArray <double>(sourceArr, Allocator.Persistent);
        var expected       = ExceptionAndValue(() => Linq.Min(srcNativeArray, SelectSelf <double>().Invoke));
        var actual         = ExceptionAndValue(() => Blinq.Min(srcNativeArray, SelectSelf <double>()));

        srcNativeArray.Dispose();
    }
コード例 #15
0
    public void BlinqShouldEqualLinqValueSequenceSelectMany([ArrayValues] int[] sourceArr)
    {
        var sourceNativeArr = new NativeArray <int>(sourceArr, Allocator.Persistent);
        var source          = sourceNativeArr.ToValueSequence();
        var expected        = ExceptionAndValue(() => Linq.ToArray(Linq.SelectMany(source, (x) => RepeatAmount.Invoke(x))));
        var actual          = ExceptionAndValue(() => Linq.ToArray(Blinq.SelectMany(source, RepeatAmount)));

        AssertAreEqual(expected, actual);
        sourceNativeArr.Dispose();
    }
コード例 #16
0
    public void BlinqShouldEqualLinqValueSequenceThenBy([OrderValues] Order[] sourceArr)
    {
        var sourceNativeArr = new NativeArray <Order>(sourceArr, Allocator.Persistent);
        var source          = sourceNativeArr.ToValueSequence();
        var expected        = ExceptionAndValue(() => Linq.ToArray(Linq.ThenBy(Linq.OrderBy(source, SelectSecond.Invoke), SelectFirst.Invoke)));
        var actual          = ExceptionAndValue(() => Linq.ToArray(Blinq.ThenBy(Blinq.OrderBy(source, SelectSecond), SelectFirst)));

        AssertAreEqual(expected, actual);
        sourceNativeArr.Dispose();
    }
コード例 #17
0
    public void BlinqShouldEqualLinqNativeArraySumSelector_float(
        [ValueSource(typeof(Values_float), nameof(Values_float.Values))] float[] sourceArr
        )
    {
        var srcNativeArray = new NativeArray <float>(sourceArr, Allocator.Persistent);
        var expected       = ExceptionAndValue(() => Linq.Sum(srcNativeArray, SelectSelf <float>().Invoke));
        var actual         = ExceptionAndValue(() => Blinq.Sum(srcNativeArray, SelectSelf <float>()));

        srcNativeArray.Dispose();
    }
コード例 #18
0
    public void BlinqShouldEqualLinqNativeArraySum_int(
        [ValueSource(typeof(Values_int), nameof(Values_int.Values))] int[] sourceArr
        )
    {
        var srcNativeArray = new NativeArray <int>(sourceArr, Allocator.Persistent);
        var expected       = ExceptionAndValue(() => Linq.Sum(srcNativeArray));
        var actual         = ExceptionAndValue(() => Blinq.Sum(srcNativeArray));

        srcNativeArray.Dispose();
    }
コード例 #19
0
    public void BlinqShouldEqualLinqValueSequenceTakeWhile([ArrayValues] int[] sourceArr)
    {
        var sourceNativeArr = new NativeArray <int>(sourceArr, Allocator.Persistent);
        var source          = sourceNativeArr.ToValueSequence();
        var expected        = ExceptionAndValue(() => Linq.ToArray(Linq.TakeWhile(source, EqualToIndex.Invoke)));
        var actual          = ExceptionAndValue(() => Linq.ToArray(Blinq.TakeWhile(source, EqualToIndex)));

        AssertAreEqual(expected, actual);
        sourceNativeArr.Dispose();
    }
コード例 #20
0
    public void BlinqShouldEqualLinqNativeArrayTake([ArrayValues] int[] sourceArr)
    {
        var count    = 5;
        var source   = new NativeArray <int>(sourceArr, Allocator.Persistent);
        var expected = ExceptionAndValue(() => Linq.ToArray(Linq.Take(source, count)));
        var actual   = ExceptionAndValue(() => Linq.ToArray(Blinq.Take(source, count)));

        AssertAreEqual(expected, actual);
        source.Dispose();
    }
コード例 #21
0
 public void BlinqShouldEqualLinqNativeArrayAverage_double(
     [ValueSource(typeof(Values_double), nameof(Values_double.Values))] double[] sourceArr
     )
 {
     using (var srcNativeArray = new NativeArray <double>(sourceArr, Allocator.Persistent))
     {
         var expected = ExceptionAndValue(() => Linq.Average(srcNativeArray));
         var actual   = ExceptionAndValue(() => Blinq.Average(srcNativeArray));
         AssertAreEqual(expected, actual);
     }
 }
コード例 #22
0
 public void BlinqShouldEqualLinqNativeArrayAverageSelector_int(
     [ValueSource(typeof(Values_int), nameof(Values_int.Values))] int[] sourceArr
     )
 {
     using (var srcNativeArray = new NativeArray <int>(sourceArr, Allocator.Persistent))
     {
         var expected = ExceptionAndValue(() => Linq.Average(srcNativeArray, SelectSelf <int>().Invoke));
         var actual   = ExceptionAndValue(() => Blinq.Average(srcNativeArray, SelectSelf <int>()));
         AssertAreEqual(expected, actual);
     }
 }
コード例 #23
0
    public void BlinqShouldEqualLinqNativeArrayUnion([ArrayValues] int[] sourceArr, [ArrayValues] int[] secondArr)
    {
        var source   = new NativeArray <int>(sourceArr, Allocator.Persistent);
        var second   = new NativeArray <int>(secondArr, Allocator.Persistent);
        var expected = ExceptionAndValue(() => Linq.ToArray(Linq.Union(source, second)));
        var actual   = ExceptionAndValue(() => Linq.ToArray(Blinq.Union(source, second)));

        AssertAreEqual(expected, actual);
        source.Dispose();
        second.Dispose();
    }
コード例 #24
0
    public void BlinqShouldEqualLinqNativeArraySequenceEqualArray([ArrayValues] int[] sourceArr, [ArrayValues] int[] secondArr)
    {
        var sourceNativeArr = new NativeArray <int>(sourceArr, Allocator.Persistent);
        var secondNativeArr = new NativeArray <int>(secondArr, Allocator.Persistent);
        var expected        = ExceptionAndValue(() => Linq.SequenceEqual(sourceNativeArr, secondNativeArr));
        var actual          = ExceptionAndValue(() => Blinq.SequenceEqual(sourceNativeArr, secondNativeArr));

        AssertAreEqual(expected, actual);
        sourceNativeArr.Dispose();
        secondNativeArr.Dispose();
    }
コード例 #25
0
    public void BlinqShouldEqualLinqValueSequenceAppendSequence([ArrayValues] int[] sourceArr, [ArrayValues] int[] secondArr)
    {
        var sourceNativeArr = new NativeArray <int>(sourceArr, Allocator.Persistent);
        var secondNativeArr = new NativeArray <int>(secondArr, Allocator.Persistent);
        var source          = sourceNativeArr.ToValueSequence();
        var second          = secondNativeArr.ToValueSequence();
        var expected        = ExceptionAndValue(() => Linq.ToArray(Linq.Concat(source, second)));
        var actual          = ExceptionAndValue(() => Linq.ToArray(Blinq.Concat(source, second)));

        AssertAreEqual(expected, actual);
        sourceNativeArr.Dispose();
        secondNativeArr.Dispose();
    }
コード例 #26
0
    public void BlinqShouldEqualLinqNativeArrayAggregateWithAccumulate([ArrayValues] int[] sourceArr)
    {
        var source   = new NativeArray <int>(sourceArr, Allocator.Persistent);
        var expected = ExceptionAndValue(() => Linq.Aggregate <int, long>(
                                             source,
                                             0,
                                             LongSum.Invoke
                                             ));
        var actual = ExceptionAndValue(() => Blinq.Aggregate(source, 0, LongSum));

        AssertAreEqual(expected, actual);
        source.Dispose();
    }
コード例 #27
0
    public void BlinqShouldEqualLinqNativeArrayJoinNativeArray(
        [ValueSource(typeof(JoinAValues), nameof(JoinAValues.Values))] JoinA[] outerArr,
        [ValueSource(typeof(JoinBValues), nameof(JoinBValues.Values))] JoinB[] innerArr
        )
    {
        var outer    = new NativeArray <JoinA>(outerArr, Allocator.Persistent);
        var inner    = new NativeArray <JoinB>(innerArr, Allocator.Persistent);
        var expected = ExceptionAndValue(() => Linq.ToArray(Linq.Join(outer, inner, JoinAKeySelector.Invoke, JoinBKeySelector.Invoke, JointABSelector.Invoke)));
        var actual   = ExceptionAndValue(() => Linq.ToArray(Blinq.Join(outer, inner, JoinAKeySelector, JoinBKeySelector, JointABSelector)));

        AssertAreEqual(expected, actual);
        outer.Dispose();
        inner.Dispose();
    }
コード例 #28
0
 public void BlinqShouldEqualLinqNativeArrayScheduleAverage_int(
     [ValueSource(typeof(Values_int), nameof(Values_int.Values))] int[] sourceArr
     )
 {
     using (var srcNativeArray = new NativeArray <int>(sourceArr, Allocator.Persistent))
     {
         var expected = ExceptionAndValue(() => Linq.Average(srcNativeArray));
         if (expected.Item1 != null)
         {
             return; // Exceptions are not supported in Burst
         }
         var actual = ExceptionAndValue(() => Blinq.ScheduleAverage(srcNativeArray).Complete());
         AssertAreEqual(expected, actual);
     }
 }
コード例 #29
0
 public void BlinqShouldEqualLinqNativeArrayRunAverageSelector_double(
     [ValueSource(typeof(Values_double), nameof(Values_double.Values))] double[] sourceArr
     )
 {
     using (var srcNativeArray = new NativeArray <double>(sourceArr, Allocator.Persistent))
     {
         var expected = ExceptionAndValue(() => Linq.Average(srcNativeArray, SelectSelf <double>().Invoke));
         if (expected.Item1 != null)
         {
             return; // Exceptions are not supported in Burst
         }
         var actual = ExceptionAndValue(() => Blinq.RunAverage(srcNativeArray, SelectSelf <double>()));
         AssertAreEqual(expected, actual);
     }
 }
コード例 #30
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);
        }
    }