Rename resolve methods
This commit is contained in:
@@ -5,102 +5,102 @@ namespace AdventOfCode2018.Tests
|
|||||||
[TestClass()]
|
[TestClass()]
|
||||||
public class Day01_Tests
|
public class Day01_Tests
|
||||||
{
|
{
|
||||||
#region ResolveDay01
|
#region ResolvePart1
|
||||||
|
|
||||||
[TestMethod()]
|
[TestMethod()]
|
||||||
public void ResolveDay01__Test1()
|
public void ResolvePart1__Test1()
|
||||||
{
|
{
|
||||||
Day01 day01 = new Day01();
|
Day01 day01 = new Day01();
|
||||||
|
|
||||||
string result = day01.ResolveDay01(new string[] { "+1", "-2", "+3", "+1", });
|
string result = day01.ResolvePart1(new string[] { "+1", "-2", "+3", "+1", });
|
||||||
|
|
||||||
Assert.AreEqual("3", result);
|
Assert.AreEqual("3", result);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod()]
|
[TestMethod()]
|
||||||
public void ResolveDay01__Test2()
|
public void ResolvePart1__Test2()
|
||||||
{
|
{
|
||||||
Day01 day01 = new Day01();
|
Day01 day01 = new Day01();
|
||||||
|
|
||||||
string result = day01.ResolveDay01(new string[] { "+1", "+1", "+1", });
|
string result = day01.ResolvePart1(new string[] { "+1", "+1", "+1", });
|
||||||
|
|
||||||
Assert.AreEqual("3", result);
|
Assert.AreEqual("3", result);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod()]
|
[TestMethod()]
|
||||||
public void ResolveDay01__Test3()
|
public void ResolvePart1__Test3()
|
||||||
{
|
{
|
||||||
Day01 day01 = new Day01();
|
Day01 day01 = new Day01();
|
||||||
|
|
||||||
string result = day01.ResolveDay01(new string[] { "+1", "+1", "-2", });
|
string result = day01.ResolvePart1(new string[] { "+1", "+1", "-2", });
|
||||||
|
|
||||||
Assert.AreEqual("0", result);
|
Assert.AreEqual("0", result);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod()]
|
[TestMethod()]
|
||||||
public void ResolveDay01__Test4()
|
public void ResolvePart1__Test4()
|
||||||
{
|
{
|
||||||
Day01 day01 = new Day01();
|
Day01 day01 = new Day01();
|
||||||
|
|
||||||
string result = day01.ResolveDay01(new string[] { "-1", "-2", "-3", });
|
string result = day01.ResolvePart1(new string[] { "-1", "-2", "-3", });
|
||||||
|
|
||||||
Assert.AreEqual("-6", result);
|
Assert.AreEqual("-6", result);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion ResolveDay01
|
#endregion ResolveDay01
|
||||||
|
|
||||||
#region ResolveDay01_Part2
|
#region ResolvePart2
|
||||||
|
|
||||||
[TestMethod()]
|
[TestMethod()]
|
||||||
public void ResolveDay01_Part2__Test1()
|
public void ResolvePart2__Test1()
|
||||||
{
|
{
|
||||||
Day01 day01 = new Day01();
|
Day01 day01 = new Day01();
|
||||||
|
|
||||||
string result = day01.ResolveDay01_Part2(new string[] { "+1", "-2", "+3", "+1", });
|
string result = day01.ResolvePart2(new string[] { "+1", "-2", "+3", "+1", });
|
||||||
|
|
||||||
Assert.AreEqual("2", result);
|
Assert.AreEqual("2", result);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod()]
|
[TestMethod()]
|
||||||
public void ResolveDay01_Part2__Test2()
|
public void ResolvePart2__Test2()
|
||||||
{
|
{
|
||||||
Day01 day01 = new Day01();
|
Day01 day01 = new Day01();
|
||||||
|
|
||||||
string result = day01.ResolveDay01_Part2(new string[] { "+1", "-1", });
|
string result = day01.ResolvePart2(new string[] { "+1", "-1", });
|
||||||
|
|
||||||
Assert.AreEqual("0", result);
|
Assert.AreEqual("0", result);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod()]
|
[TestMethod()]
|
||||||
public void ResolveDay01_Part2__Test3()
|
public void ResolvePart2__Test3()
|
||||||
{
|
{
|
||||||
Day01 day01 = new Day01();
|
Day01 day01 = new Day01();
|
||||||
|
|
||||||
string result = day01.ResolveDay01_Part2(new string[] { "+3", "+3", "+4", "-2", "-4", });
|
string result = day01.ResolvePart2(new string[] { "+3", "+3", "+4", "-2", "-4", });
|
||||||
|
|
||||||
Assert.AreEqual("10", result);
|
Assert.AreEqual("10", result);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod()]
|
[TestMethod()]
|
||||||
public void ResolveDay01_Part2__Test4()
|
public void ResolvePart2__Test4()
|
||||||
{
|
{
|
||||||
Day01 day01 = new Day01();
|
Day01 day01 = new Day01();
|
||||||
|
|
||||||
string result = day01.ResolveDay01_Part2(new string[] { "-6", "+3", "+8", "+5", "-6", });
|
string result = day01.ResolvePart2(new string[] { "-6", "+3", "+8", "+5", "-6", });
|
||||||
|
|
||||||
Assert.AreEqual("5", result);
|
Assert.AreEqual("5", result);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod()]
|
[TestMethod()]
|
||||||
public void ResolveDay01_Part2__Test5()
|
public void ResolvePart2__Test5()
|
||||||
{
|
{
|
||||||
Day01 day01 = new Day01();
|
Day01 day01 = new Day01();
|
||||||
|
|
||||||
string result = day01.ResolveDay01_Part2(new string[] { "+7", "+7", "-2", "-7", "-4", });
|
string result = day01.ResolvePart2(new string[] { "+7", "+7", "-2", "-7", "-4", });
|
||||||
|
|
||||||
Assert.AreEqual("14", result);
|
Assert.AreEqual("14", result);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion ResolveDay01_Part2
|
#endregion ResolvePart2
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -6,11 +6,11 @@ namespace AdventOfCode2018.Tests
|
|||||||
public class Day02_Tests
|
public class Day02_Tests
|
||||||
{
|
{
|
||||||
[TestMethod()]
|
[TestMethod()]
|
||||||
public void ResolveDay02__Test1()
|
public void ResolvePart1__Test1()
|
||||||
{
|
{
|
||||||
Day02 day02 = new Day02();
|
Day02 day02 = new Day02();
|
||||||
|
|
||||||
string result = day02.ResolveDay02(new string[] {
|
string result = day02.ResolvePart1(new string[] {
|
||||||
"abcdef",
|
"abcdef",
|
||||||
"bababc",
|
"bababc",
|
||||||
"abbcde",
|
"abbcde",
|
||||||
@@ -24,11 +24,11 @@ namespace AdventOfCode2018.Tests
|
|||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod()]
|
[TestMethod()]
|
||||||
public void ResolveDay02_Part2__Test()
|
public void ResolvePart2__Test()
|
||||||
{
|
{
|
||||||
Day02 day02 = new Day02();
|
Day02 day02 = new Day02();
|
||||||
|
|
||||||
string result = day02.ResolveDay02_Part2(new string[] {
|
string result = day02.ResolvePart2(new string[] {
|
||||||
"abcde",
|
"abcde",
|
||||||
"fghij",
|
"fghij",
|
||||||
"klmno",
|
"klmno",
|
||||||
|
|||||||
@@ -6,11 +6,11 @@ namespace AdventOfCode2018.Tests
|
|||||||
public class Day03_Tests
|
public class Day03_Tests
|
||||||
{
|
{
|
||||||
[TestMethod()]
|
[TestMethod()]
|
||||||
public void ResolveDay03__Test()
|
public void ResolvePart1__Test()
|
||||||
{
|
{
|
||||||
Day03 day03 = new Day03();
|
Day03 day03 = new Day03();
|
||||||
|
|
||||||
string result = day03.ResolveDay03(new string[] {
|
string result = day03.ResolvePart1(new string[] {
|
||||||
"#1 @ 1,3: 4x4",
|
"#1 @ 1,3: 4x4",
|
||||||
"#2 @ 3,1: 4x4",
|
"#2 @ 3,1: 4x4",
|
||||||
"#3 @ 5,5: 2x2",
|
"#3 @ 5,5: 2x2",
|
||||||
@@ -20,11 +20,11 @@ namespace AdventOfCode2018.Tests
|
|||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod()]
|
[TestMethod()]
|
||||||
public void ResolveDay03_Part2__Test()
|
public void ResolvePart2__Test()
|
||||||
{
|
{
|
||||||
Day03 day03 = new Day03();
|
Day03 day03 = new Day03();
|
||||||
|
|
||||||
string result = day03.ResolveDay03_Part2(new string[] {
|
string result = day03.ResolvePart2(new string[] {
|
||||||
"#1 @ 1,3: 4x4",
|
"#1 @ 1,3: 4x4",
|
||||||
"#2 @ 3,1: 4x4",
|
"#2 @ 3,1: 4x4",
|
||||||
"#3 @ 5,5: 2x2",
|
"#3 @ 5,5: 2x2",
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ namespace AdventOfCode2018
|
|||||||
|
|
||||||
public class Day01
|
public class Day01
|
||||||
{
|
{
|
||||||
public string ResolveDay01(string[] inputs)
|
public string ResolvePart1(string[] inputs)
|
||||||
{
|
{
|
||||||
int accumulator = 0;
|
int accumulator = 0;
|
||||||
foreach (string input in inputs)
|
foreach (string input in inputs)
|
||||||
@@ -83,7 +83,7 @@ namespace AdventOfCode2018
|
|||||||
return accumulator.ToString();
|
return accumulator.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public string ResolveDay01_Part2(string[] inputs)
|
public string ResolvePart2(string[] inputs)
|
||||||
{
|
{
|
||||||
int accumulator = 0;
|
int accumulator = 0;
|
||||||
List<int> accumulatorHistory = new List<int>();
|
List<int> accumulatorHistory = new List<int>();
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ namespace AdventOfCode2018
|
|||||||
return new Tuple<bool, bool>(hasPair, hasTriplet);
|
return new Tuple<bool, bool>(hasPair, hasTriplet);
|
||||||
}
|
}
|
||||||
|
|
||||||
public string ResolveDay02(string[] inputs)
|
public string ResolvePart1(string[] inputs)
|
||||||
{
|
{
|
||||||
int pairsCount = 0;
|
int pairsCount = 0;
|
||||||
int tripletsCount = 0;
|
int tripletsCount = 0;
|
||||||
@@ -101,7 +101,7 @@ namespace AdventOfCode2018
|
|||||||
return new Tuple<int, string>(diffCount, sb.ToString());
|
return new Tuple<int, string>(diffCount, sb.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
public string ResolveDay02_Part2(string[] inputs)
|
public string ResolvePart2(string[] inputs)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < (inputs.Length - 1); i++)
|
for (int i = 0; i < (inputs.Length - 1); i++)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ namespace AdventOfCode2018
|
|||||||
|
|
||||||
public class Day03
|
public class Day03
|
||||||
{
|
{
|
||||||
public string ResolveDay03(string[] inputs)
|
public string ResolvePart1(string[] inputs)
|
||||||
{
|
{
|
||||||
List<Claim> claims = inputs.Select(i => Claim.FromString(i)).ToList();
|
List<Claim> claims = inputs.Select(i => Claim.FromString(i)).ToList();
|
||||||
|
|
||||||
@@ -95,7 +95,7 @@ namespace AdventOfCode2018
|
|||||||
return overlappedArea.ToString();
|
return overlappedArea.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public string ResolveDay03_Part2(string[] inputs)
|
public string ResolvePart2(string[] inputs)
|
||||||
{
|
{
|
||||||
List<Claim> claims = inputs.Select(i => Claim.FromString(i)).ToList();
|
List<Claim> claims = inputs.Select(i => Claim.FromString(i)).ToList();
|
||||||
|
|
||||||
|
|||||||
@@ -14,9 +14,9 @@ namespace AdventOfCode2018
|
|||||||
// Resolve Day01
|
// Resolve Day01
|
||||||
Day01 day01 = new Day01();
|
Day01 day01 = new Day01();
|
||||||
string[] linesDay01 = File.ReadAllLines("inputs/Day01.txt");
|
string[] linesDay01 = File.ReadAllLines("inputs/Day01.txt");
|
||||||
string resultDay01 = day01.ResolveDay01(linesDay01);
|
string resultDay01 = day01.ResolvePart1(linesDay01);
|
||||||
Console.WriteLine("Day01 Result: {0}", resultDay01);
|
Console.WriteLine("Day01 Result: {0}", resultDay01);
|
||||||
string resultDay01Part2 = day01.ResolveDay01_Part2(linesDay01);
|
string resultDay01Part2 = day01.ResolvePart2(linesDay01);
|
||||||
Console.WriteLine("Day01_Part2 Result: {0}", resultDay01Part2);
|
Console.WriteLine("Day01_Part2 Result: {0}", resultDay01Part2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -25,9 +25,9 @@ namespace AdventOfCode2018
|
|||||||
// Resolve Day02
|
// Resolve Day02
|
||||||
Day02 day02 = new Day02();
|
Day02 day02 = new Day02();
|
||||||
string[] linesDay02 = File.ReadAllLines("inputs/Day02.txt");
|
string[] linesDay02 = File.ReadAllLines("inputs/Day02.txt");
|
||||||
string resultDay02 = day02.ResolveDay02(linesDay02);
|
string resultDay02 = day02.ResolvePart1(linesDay02);
|
||||||
Console.WriteLine("Day02 Result: {0}", resultDay02);
|
Console.WriteLine("Day02 Result: {0}", resultDay02);
|
||||||
string resultDay02Part2 = day02.ResolveDay02_Part2(linesDay02);
|
string resultDay02Part2 = day02.ResolvePart2(linesDay02);
|
||||||
Console.WriteLine("Day02_Part2 Result: {0}", resultDay02Part2);
|
Console.WriteLine("Day02_Part2 Result: {0}", resultDay02Part2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -36,9 +36,9 @@ namespace AdventOfCode2018
|
|||||||
// Resolve Day03
|
// Resolve Day03
|
||||||
Day03 day03 = new Day03();
|
Day03 day03 = new Day03();
|
||||||
string[] linesDay03 = File.ReadAllLines("inputs/Day03.txt");
|
string[] linesDay03 = File.ReadAllLines("inputs/Day03.txt");
|
||||||
string resultDay03 = day03.ResolveDay03(linesDay03);
|
string resultDay03 = day03.ResolvePart1(linesDay03);
|
||||||
Console.WriteLine("Day03 Result: {0}", resultDay03);
|
Console.WriteLine("Day03 Result: {0}", resultDay03);
|
||||||
string resultDay03Part2 = day03.ResolveDay03_Part2(linesDay03);
|
string resultDay03Part2 = day03.ResolvePart2(linesDay03);
|
||||||
Console.WriteLine("Day03_Part2 Result: {0}", resultDay03Part2);
|
Console.WriteLine("Day03_Part2 Result: {0}", resultDay03Part2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user