Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
sk-zk committed Mar 3, 2024
1 parent 525b691 commit e5f762b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
11 changes: 11 additions & 0 deletions TruckLibTests/TruckLib/ScsMap/Collections/NodeDictionaryTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,18 @@ public void IndexerSet()

Assert.Empty(dict.Within(0, 0, 20, 20));
Assert.Equal(node2, dict.Within(40, 40, 60, 60)[0]);
}

[Fact]
public void MoveNode()
{
var map = new Map("foo");
var node = map.AddNode(new Vector3(10, 0, 10));

node.Move(new Vector3(150, 0, 150));

Assert.Empty(map.Nodes.Within(0, 0, 20, 20));
Assert.Equal(node, map.Nodes.Within(140, 140, 160, 160)[0]);
}
}
}
2 changes: 2 additions & 0 deletions TruckLibTests/TruckLib/ScsMap/MapTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public void AddNode()
Assert.Equal(node, map.Nodes[node.Uid]);
Assert.Equal(new(-69, 0, -420), node.Position);
Assert.True(node.IsRed);
Assert.Single(map.Nodes.Within(-80, -440, -60, -400));

Assert.Single(map.Sectors);
Assert.True(map.Sectors.ContainsKey(new SectorCoordinate(-1, -1)));
Expand All @@ -55,6 +56,7 @@ public void DeleteNode()
map.Delete(node);

Assert.Empty(map.Nodes);
Assert.Empty(map.Nodes.Within(-1000, -1000, 1000, 1000));
}

[Fact]
Expand Down

0 comments on commit e5f762b

Please sign in to comment.