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(); }
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(); }
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(); }
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(); }
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(); }
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(); }
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(); }
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(); }
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(); }
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(); }
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(); }
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(); }
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(); }
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(); }
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(); }
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(); }
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(); }
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(); }
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(); }
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(); }
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); } }
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); } }
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(); }
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(); }
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(); }
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(); }
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(); }
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); } }
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); } }
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); } }