Code for Day06 part 1
This commit is contained in:
@@ -56,6 +56,7 @@
|
||||
<Otherwise />
|
||||
</Choose>
|
||||
<ItemGroup>
|
||||
<Compile Include="ChronoPoint_Tests.cs" />
|
||||
<Compile Include="Claim_Tests.cs" />
|
||||
<Compile Include="Day01_Tests.cs" />
|
||||
<Compile Include="Day02_Tests.cs" />
|
||||
|
||||
65
AdventOfCode2018.Tests/ChronoPoint_Tests.cs
Normal file
65
AdventOfCode2018.Tests/ChronoPoint_Tests.cs
Normal file
@@ -0,0 +1,65 @@
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
|
||||
namespace AdventOfCode2018.Tests
|
||||
{
|
||||
[TestClass()]
|
||||
public class ChronoPoint_Tests
|
||||
{
|
||||
#region FromString
|
||||
|
||||
[TestMethod()]
|
||||
public void FromString__Test1()
|
||||
{
|
||||
ChronoPoint point = ChronoPoint.FromString("1, 1");
|
||||
|
||||
Assert.AreEqual(1, point.X);
|
||||
Assert.AreEqual(1, point.Y);
|
||||
}
|
||||
|
||||
[TestMethod()]
|
||||
public void FromString__Test2()
|
||||
{
|
||||
ChronoPoint point = ChronoPoint.FromString("1, 6");
|
||||
|
||||
Assert.AreEqual(1, point.X);
|
||||
Assert.AreEqual(6, point.Y);
|
||||
}
|
||||
|
||||
[TestMethod()]
|
||||
public void FromString__Test3()
|
||||
{
|
||||
ChronoPoint point = ChronoPoint.FromString("8, 9");
|
||||
|
||||
Assert.AreEqual(8, point.X);
|
||||
Assert.AreEqual(9, point.Y);
|
||||
}
|
||||
|
||||
#endregion FromString
|
||||
|
||||
#region ManhattanDistance
|
||||
|
||||
[TestMethod()]
|
||||
public void ManhattanDistance__Test1()
|
||||
{
|
||||
ChronoPoint p0 = ChronoPoint.FromString("8, 9");
|
||||
ChronoPoint p1 = ChronoPoint.FromString("1, 6");
|
||||
|
||||
int distance = ChronoPoint.ManhattanDistance(p0, p1);
|
||||
|
||||
Assert.AreEqual(10, distance);
|
||||
}
|
||||
|
||||
[TestMethod()]
|
||||
public void ManhattanDistance__Test2()
|
||||
{
|
||||
ChronoPoint p0 = ChronoPoint.FromString("1, 1");
|
||||
ChronoPoint p1 = ChronoPoint.FromString("1, 6");
|
||||
|
||||
int distance = ChronoPoint.ManhattanDistance(p0, p1);
|
||||
|
||||
Assert.AreEqual(5, distance);
|
||||
}
|
||||
|
||||
#endregion ManhattanDistance
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user