public void PathConnectionRemovePathIdTest1() { var pathConnection = new PathConnections(); pathConnection.Add(1, 3); pathConnection.Add(3, 1); pathConnection.Add(3, 4); pathConnection.RemovePathId(1); Assert.IsFalse(pathConnection.HasConnection(1, 3)); Assert.IsFalse(pathConnection.HasConnection(3, 1)); Assert.IsTrue(pathConnection.HasConnection(3, 4)); }
public void PathConnectionSplitBasicInTest2() { var pathConnection = new PathConnections(); pathConnection.Add(1, 3); pathConnection.Add(2, 3); pathConnection.Add(3, 4); pathConnection.Split(1, 6, 5, true); Assert.IsTrue(pathConnection.HasConnection(1, 6)); Assert.IsTrue(pathConnection.HasConnection(5, 6)); Assert.IsTrue(pathConnection.HasConnection(6, 3)); Assert.IsTrue(pathConnection.HasConnection(2, 3)); Assert.IsTrue(pathConnection.HasConnection(3, 4)); }
public void PathConnectionComplexTest1() { var pathConnection = new PathConnections(); pathConnection.Add(0, 4); var pathConnectionTracker = new PathConnectionsChecksTracker(pathConnection); pathConnection.Split(0, 5, 1, true); Assert.IsTrue(pathConnectionTracker.HasConnection(0, 5)); Assert.IsTrue(pathConnectionTracker.HasConnection(1, 5)); Assert.IsTrue(pathConnectionTracker.HasConnection(5, 4)); Assert.IsTrue(pathConnectionTracker.AllConnectionsChecked()); pathConnection.Split(5, 6, 2, false); Assert.IsTrue(pathConnectionTracker.HasConnection(0, 5)); Assert.IsTrue(pathConnectionTracker.HasConnection(1, 5)); Assert.IsTrue(pathConnectionTracker.HasConnection(5, 6)); Assert.IsTrue(pathConnectionTracker.HasConnection(5, 2)); Assert.IsTrue(pathConnectionTracker.HasConnection(6, 4)); Assert.IsTrue(pathConnectionTracker.AllConnectionsChecked()); pathConnection.Split(6, 7, 3, true); Assert.IsTrue(pathConnectionTracker.HasConnection(0, 5)); Assert.IsTrue(pathConnectionTracker.HasConnection(1, 5)); Assert.IsTrue(pathConnectionTracker.HasConnection(5, 6)); Assert.IsTrue(pathConnectionTracker.HasConnection(5, 2)); Assert.IsTrue(pathConnectionTracker.HasConnection(6, 7)); Assert.IsTrue(pathConnectionTracker.HasConnection(3, 7)); Assert.IsTrue(pathConnectionTracker.HasConnection(7, 4)); Assert.IsTrue(pathConnectionTracker.AllConnectionsChecked()); }
public void PathConnectionBasicTest1() { var pathConnection = new PathConnections(); Assert.IsFalse(pathConnection.HasConnection(0, 0)); pathConnection.Add(0, 0); Assert.IsTrue(pathConnection.HasConnection(0, 0)); Assert.IsFalse(pathConnection.HasConnection(0, 1)); Assert.IsFalse(pathConnection.HasConnection(1, 0)); pathConnection.Add(0, 1); Assert.IsTrue(pathConnection.HasConnection(0, 1)); }
public void PathConnectionSplitBasicOutTest1() { var pathConnection = new PathConnections(); pathConnection.Add(1, 2); pathConnection.Split(1, 4, 3, false); Assert.IsTrue(pathConnection.HasConnection(1, 4)); Assert.IsTrue(pathConnection.HasConnection(1, 3)); Assert.IsTrue(pathConnection.HasConnection(4, 2)); }
public void PathConnectionRemoveTest1() { var pathConnection = new PathConnections(); Assert.IsFalse(pathConnection.HasConnection(0, 0)); pathConnection.Add(0, 0); Assert.IsFalse(pathConnection.IsEmpty()); Assert.IsTrue(pathConnection.HasConnection(0, 0)); Assert.IsFalse(pathConnection.HasConnection(0, 1)); Assert.IsFalse(pathConnection.Remove(0, 1)); Assert.IsTrue(pathConnection.Remove(0, 0)); Assert.IsTrue(pathConnection.IsEmpty()); }
public void RoadSplitterComplexConnectionTest1() { var paths = PointUtils.CreateFromPoints( new List <GpsCoordinate>() { new GpsCoordinate() { x = 0 }, // 0 new GpsCoordinate() { x = 1 }, new GpsCoordinate() { x = 2 }, new GpsCoordinate() { x = 3 }, new GpsCoordinate() { x = 4 }, new GpsCoordinate() { x = 5 }, new GpsCoordinate() { x = 6 }, new GpsCoordinate() { x = 1, y = 2 }, // 1 new GpsCoordinate() { x = 1, y = 1 }, new GpsCoordinate() { x = 1, y = 0.1 }, new GpsCoordinate() { x = 3, y = -0.1 }, // 2 new GpsCoordinate() { x = 3, y = -1 }, new GpsCoordinate() { x = 3, y = -2 }, new GpsCoordinate() { x = 5, y = 2 }, // 3 new GpsCoordinate() { x = 5, y = 1 }, new GpsCoordinate() { x = 5, y = 0.1 }, new GpsCoordinate() { x = 6.1 }, //4 new GpsCoordinate() { x = 7 }, new GpsCoordinate() { x = -2 }, // 5 new GpsCoordinate() { x = -1 }, new GpsCoordinate() { x = -0.1 }, }, 1); var pathConnections = new PathConnections(); pathConnections.Add(0, 4); pathConnections.Add(1, 0); pathConnections.Add(0, 2); pathConnections.Add(3, 0); pathConnections.Add(5, 0); var splitter = new RoadSplitter(0.5f, pathConnections); splitter.Process(paths); var connectionsTracker = new PathConnectionsChecksTracker(pathConnections); Assert.IsTrue(connectionsTracker.HasConnection(5, 0)); Assert.IsTrue(connectionsTracker.HasConnection(0, 6)); Assert.IsTrue(connectionsTracker.HasConnection(1, 6)); Assert.IsTrue(connectionsTracker.HasConnection(6, 7)); Assert.IsTrue(connectionsTracker.HasConnection(6, 2)); Assert.IsTrue(connectionsTracker.HasConnection(3, 8)); Assert.IsTrue(connectionsTracker.HasConnection(7, 8)); Assert.IsTrue(connectionsTracker.HasConnection(8, 4)); Assert.IsTrue(connectionsTracker.AllConnectionsChecked()); }