UTests pass with Pathfinder2D
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
using FluentAssertions;
|
||||
using Gameboard.ShogiUI.BoardState;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using PathFinding;
|
||||
using System.Collections.Generic;
|
||||
using System.Numerics;
|
||||
|
||||
namespace Gameboard.ShogiUI.UnitTests.PathFinding
|
||||
{
|
||||
[TestClass]
|
||||
public class PathFinder2DShould
|
||||
{
|
||||
class TestElement : IPlanarElement
|
||||
{
|
||||
public ICollection<Path> GetPaths() => throw new System.NotImplementedException();
|
||||
public bool IsUpsideDown => false;
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Maths()
|
||||
{
|
||||
var finder = new PathFinder2D<TestElement>(new Array2D<TestElement>(5, 5));
|
||||
|
||||
var result = finder.IsPathable(
|
||||
new Vector2(2, 2),
|
||||
new Vector2(7, 7),
|
||||
new Vector2(3, 3)
|
||||
);
|
||||
result.Should().BeTrue();
|
||||
|
||||
result = finder.IsPathable(
|
||||
new Vector2(2, 2),
|
||||
new Vector2(7, 7),
|
||||
new Vector2(2, 2)
|
||||
);
|
||||
result.Should().BeFalse();
|
||||
|
||||
result = finder.IsPathable(
|
||||
new Vector2(2, 2),
|
||||
new Vector2(7, 7),
|
||||
new Vector2(-1, 1)
|
||||
);
|
||||
result.Should().BeFalse();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user