wabbajack/Wabbajack.Paths.Test/ArrayExtensionsTests.cs

29 lines
1.3 KiB
C#
Raw Normal View History

2021-09-27 12:42:46 +00:00
using Xunit;
namespace Wabbajack.Paths.Test
{
public class ArrayExtensionsTests
{
[Fact]
public void AreEqualTests()
{
Assert.True(ArrayExtensions.AreEqual(new[] { 1, 2, 3 }, 0, new[] { 1, 2 }, 0, 2));
Assert.False(ArrayExtensions.AreEqual(new[] { 1, 2, 3 }, 0, new[] { 1, 2 }, 0, 3));
Assert.False(ArrayExtensions.AreEqual(new[] { 1, 2 }, 1, new[] { 1, 2, 3 }, 0, 2));
}
[Fact]
public void CompareTo()
{
Assert.Equal(0, ArrayExtensions.Compare(new[] { 1, 1 }, new[] { 1, 1 }));
Assert.Equal(1, ArrayExtensions.Compare(new[] { 1, 1, 1 }, new[] { 1, 1 }));
Assert.Equal(-1, ArrayExtensions.Compare(new[] { 1, 1 }, new[] { 1, 1, 1 }));
Assert.Equal(1, ArrayExtensions.Compare(new[] { 1, 2 }, new[] { 1, 1, 1 }));
Assert.Equal(0, ArrayExtensions.CompareString(new[] { "1", "1" }, new[] { "1", "1" }));
Assert.Equal(1, ArrayExtensions.CompareString(new[] { "1", "1", "1" }, new[] { "1", "1" }));
Assert.Equal(-1, ArrayExtensions.CompareString(new[] { "1", "1" }, new[] { "1", "1", "1" }));
Assert.Equal(1, ArrayExtensions.CompareString(new[] { "1", "2" }, new[] { "1", "1", "1" }));
}
}
}