Day09
This commit is contained in:
@@ -67,7 +67,9 @@
|
||||
<Compile Include="Day06_Tests.cs" />
|
||||
<Compile Include="Day07_Tests.cs" />
|
||||
<Compile Include="Day08_Tests.cs" />
|
||||
<Compile Include="Day09_Tests.cs" />
|
||||
<Compile Include="GuardEvent_Tests.cs" />
|
||||
<Compile Include="MarbleGame_Tests.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
||||
68
AdventOfCode2018.Tests/Day09_Tests.cs
Normal file
68
AdventOfCode2018.Tests/Day09_Tests.cs
Normal file
@@ -0,0 +1,68 @@
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
|
||||
namespace AdventOfCode2018.Tests
|
||||
{
|
||||
[TestClass()]
|
||||
public class Day09_Tests
|
||||
{
|
||||
[TestMethod()]
|
||||
public void ResolvePart1__Test1()
|
||||
{
|
||||
Day09 day = new Day09();
|
||||
|
||||
string result = day.ResolvePart1(new string[] { "9 players; last marble is worth 25 points" });
|
||||
|
||||
Assert.AreEqual("32", result);
|
||||
}
|
||||
|
||||
[TestMethod()]
|
||||
public void ResolvePart1__Test2()
|
||||
{
|
||||
Day09 day = new Day09();
|
||||
|
||||
string result = day.ResolvePart1(new string[] { "10 players; last marble is worth 1618 points" });
|
||||
|
||||
Assert.AreEqual("8317", result);
|
||||
}
|
||||
|
||||
[TestMethod()]
|
||||
public void ResolvePart1__Test3()
|
||||
{
|
||||
Day09 day = new Day09();
|
||||
|
||||
string result = day.ResolvePart1(new string[] { "13 players; last marble is worth 7999 points" });
|
||||
|
||||
Assert.AreEqual("146373", result);
|
||||
}
|
||||
|
||||
[TestMethod()]
|
||||
public void ResolvePart1__Test4()
|
||||
{
|
||||
Day09 day = new Day09();
|
||||
|
||||
string result = day.ResolvePart1(new string[] { "17 players; last marble is worth 1104 points" });
|
||||
|
||||
Assert.AreEqual("2764", result);
|
||||
}
|
||||
|
||||
[TestMethod()]
|
||||
public void ResolvePart1__Test5()
|
||||
{
|
||||
Day09 day = new Day09();
|
||||
|
||||
string result = day.ResolvePart1(new string[] { "21 players; last marble is worth 6111 points" });
|
||||
|
||||
Assert.AreEqual("54718", result);
|
||||
}
|
||||
|
||||
[TestMethod()]
|
||||
public void ResolvePart1__Test6()
|
||||
{
|
||||
Day09 day = new Day09();
|
||||
|
||||
string result = day.ResolvePart1(new string[] { "30 players; last marble is worth 5807 points" });
|
||||
|
||||
Assert.AreEqual("37305", result);
|
||||
}
|
||||
}
|
||||
}
|
||||
74
AdventOfCode2018.Tests/MarbleGame_Tests.cs
Normal file
74
AdventOfCode2018.Tests/MarbleGame_Tests.cs
Normal file
@@ -0,0 +1,74 @@
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
|
||||
namespace AdventOfCode2018.Tests
|
||||
{
|
||||
[TestClass()]
|
||||
public class MarbleGame_Tests
|
||||
{
|
||||
[TestMethod()]
|
||||
public void PlayGame__Test1()
|
||||
{
|
||||
MarbleGame marbleGame = new MarbleGame();
|
||||
|
||||
marbleGame.PlayGame(9, 25);
|
||||
long highScore = marbleGame.GetHighScore();
|
||||
|
||||
Assert.AreEqual(32, highScore);
|
||||
}
|
||||
|
||||
[TestMethod()]
|
||||
public void PlayGame__Test2()
|
||||
{
|
||||
MarbleGame marbleGame = new MarbleGame();
|
||||
|
||||
marbleGame.PlayGame(10, 1618);
|
||||
long highScore = marbleGame.GetHighScore();
|
||||
|
||||
Assert.AreEqual(8317, highScore);
|
||||
}
|
||||
|
||||
[TestMethod()]
|
||||
public void PlayGame__Test3()
|
||||
{
|
||||
MarbleGame marbleGame = new MarbleGame();
|
||||
|
||||
marbleGame.PlayGame(13, 7999);
|
||||
long highScore = marbleGame.GetHighScore();
|
||||
|
||||
Assert.AreEqual(146373, highScore);
|
||||
}
|
||||
|
||||
[TestMethod()]
|
||||
public void PlayGame__Test4()
|
||||
{
|
||||
MarbleGame marbleGame = new MarbleGame();
|
||||
|
||||
marbleGame.PlayGame(17, 1104);
|
||||
long highScore = marbleGame.GetHighScore();
|
||||
|
||||
Assert.AreEqual(2764, highScore);
|
||||
}
|
||||
|
||||
[TestMethod()]
|
||||
public void PlayGame__Test5()
|
||||
{
|
||||
MarbleGame marbleGame = new MarbleGame();
|
||||
|
||||
marbleGame.PlayGame(21, 6111);
|
||||
long highScore = marbleGame.GetHighScore();
|
||||
|
||||
Assert.AreEqual(54718, highScore);
|
||||
}
|
||||
|
||||
[TestMethod()]
|
||||
public void PlayGame__Test6()
|
||||
{
|
||||
MarbleGame marbleGame = new MarbleGame();
|
||||
|
||||
marbleGame.PlayGame(30, 5807);
|
||||
long highScore = marbleGame.GetHighScore();
|
||||
|
||||
Assert.AreEqual(37305, highScore);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user