mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-01-11 19:44:55 +00:00
feat: Initial commit of SequenceComparer
This commit is contained in:
33
ICD.Common.Utils.Tests/Comparers/SequenceComparerTest.cs
Normal file
33
ICD.Common.Utils.Tests/Comparers/SequenceComparerTest.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using ICD.Common.Utils.Comparers;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace ICD.Common.Utils.Tests.Comparers
|
||||
{
|
||||
[TestFixture]
|
||||
public sealed class SequenceComparerTest
|
||||
{
|
||||
[Test]
|
||||
public void CompareTest()
|
||||
{
|
||||
SequenceComparer<int> comparer = new SequenceComparer<int>();
|
||||
|
||||
// Equal
|
||||
int[] a = {1, 2, 3};
|
||||
int[] b = {1, 2, 3};
|
||||
|
||||
Assert.AreEqual(0, comparer.Compare(a, b));
|
||||
|
||||
// A comes before B
|
||||
a = new[] {1, 2};
|
||||
b = new[] {1, 2, 3};
|
||||
|
||||
Assert.AreEqual(-1, comparer.Compare(a, b));
|
||||
|
||||
// B comes before A
|
||||
a = new[] { 2, 2, 3 };
|
||||
b = new[] { 1, 2, 3 };
|
||||
|
||||
Assert.AreEqual(1, comparer.Compare(a, b));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user