2021-09-27 12:42:46 +00:00
|
|
|
using Xunit;
|
|
|
|
|
2021-10-23 16:51:17 +00:00
|
|
|
namespace Wabbajack.Paths.Test;
|
|
|
|
|
|
|
|
public class ArrayExtensionsTests
|
2021-09-27 12:42:46 +00:00
|
|
|
{
|
2021-10-23 16:51:17 +00:00
|
|
|
[Fact]
|
|
|
|
public void AreEqualTests()
|
2021-09-27 12:42:46 +00:00
|
|
|
{
|
2021-10-23 16:51:17 +00:00
|
|
|
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));
|
|
|
|
}
|
2021-09-27 12:42:46 +00:00
|
|
|
|
2021-10-23 16:51:17 +00:00
|
|
|
[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}));
|
2021-09-27 12:42:46 +00:00
|
|
|
|
2021-10-23 16:51:17 +00:00
|
|
|
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"}));
|
2021-09-27 12:42:46 +00:00
|
|
|
}
|
|
|
|
}
|