-
Notifications
You must be signed in to change notification settings - Fork 35
/
Copy pathSelectManyTests.cs
41 lines (31 loc) · 1.16 KB
/
SelectManyTests.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
using NUnit.Framework;
using JM.LinqFaster;
using System.Linq;
using static Tests.Test;
namespace Tests
{
[TestFixture]
class SelectManyTests
{
[Test]
public void SelectManyArray()
{
var a = floatArray.SelectManyF(x => LinqFaster.RepeatArrayF(x, 2));
var b = floatArray.SelectMany(x => Enumerable.Repeat(x, 2).ToArray()).ToArray();
Assert.That(a, Is.EqualTo(b));
a = floatArray.SelectManyF((x,i) => LinqFaster.RepeatArrayF(x+i, 2));
b = floatArray.SelectMany((x,i) => Enumerable.Repeat(x+i, 2).ToArray()).ToArray();
Assert.That(a, Is.EqualTo(b));
}
[Test]
public void SelectManyList()
{
var a = floatList.SelectManyF(x => LinqFaster.RepeatListF(x, 2));
var b = floatList.SelectMany(x => Enumerable.Repeat(x, 2).ToList()).ToList();
Assert.That(a, Is.EqualTo(b));
a = floatList.SelectManyF((x, i) => LinqFaster.RepeatListF(x + i, 2));
b = floatList.SelectMany((x, i) => Enumerable.Repeat(x + i, 2).ToList()).ToList();
Assert.That(a, Is.EqualTo(b));
}
}
}