mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-02-12 19:25:00 +00:00
Util method for getting a sequence as a series of adjacent pairs
This commit is contained in:
@@ -331,6 +331,25 @@ namespace ICD.Common.Utils.Tests.Extensions
|
||||
Assert.AreEqual(8, items[2][1]);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetAdjacentPairsTest()
|
||||
{
|
||||
IEnumerable<int> a = new int[] {};
|
||||
Assert.AreEqual(0, a.GetAdjacentPairs().Count());
|
||||
|
||||
IEnumerable<int> b = new int[] { 1 };
|
||||
Assert.AreEqual(0, b.GetAdjacentPairs().Count());
|
||||
|
||||
IEnumerable<int> c = new int[] { 1, 2, 3 };
|
||||
int[][] cPairs = c.GetAdjacentPairs().ToArray();
|
||||
|
||||
Assert.AreEqual(2, cPairs.Length);
|
||||
Assert.AreEqual(1, cPairs[0][0]);
|
||||
Assert.AreEqual(2, cPairs[0][1]);
|
||||
Assert.AreEqual(2, cPairs[1][0]);
|
||||
Assert.AreEqual(3, cPairs[1][1]);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void MinByTest()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user