use expression body for test methods
This commit is contained in:
parent
ea131cb284
commit
2103805f95
|
@ -11,7 +11,7 @@ public class Test2015
|
|||
[DataRow(typeof(Day03), "2081", "2341")]
|
||||
[DataRow(typeof(Day04), "346386", "9958218")]
|
||||
[DataRow(typeof(Day05), "258", "53")]
|
||||
// [DataRow(typeof(Day06), "543903", "14687245")]
|
||||
[DataRow(typeof(Day06), "543903", "14687245")]
|
||||
[DataRow(typeof(Day07), "3176", "14710")]
|
||||
[DataRow(typeof(Day08), "1342", "2074")]
|
||||
[DataRow(typeof(Day09), "117", "909")]
|
||||
|
@ -27,12 +27,12 @@ public class Test2015
|
|||
[DataRow(typeof(Day19), "576", "207")]
|
||||
[DataRow(typeof(Day20), "665280", "705600")]
|
||||
[DataRow(typeof(Day21), "78", "148")]
|
||||
// [DataRow(typeof(Day22), "", "")]
|
||||
[DataRow(typeof(Day23), "255", "334")]
|
||||
// [DataRow(typeof(Day24), "", "")]
|
||||
[DataRow(typeof(Day25), "9132360", "")]
|
||||
public void CheckAllDays(Type dayType, string part1, string part2)
|
||||
{
|
||||
public void CheckAllDays(Type dayType, string part1, string part2) =>
|
||||
Common.CheckDay(dayType, part1, part2);
|
||||
}
|
||||
|
||||
[DataTestMethod]
|
||||
[DataRow(typeof(Day01), "-1", "5")]
|
||||
|
@ -48,8 +48,6 @@ public class Test2015
|
|||
[DataRow(typeof(Day13), "330", "286")]
|
||||
[DataRow(typeof(Day15), "62842880", "57600000")]
|
||||
[DataRow(typeof(Day19), "4", "2")]
|
||||
public void CheckTestInputs(Type dayType, string part1, string part2)
|
||||
{
|
||||
public void CheckTestInputs(Type dayType, string part1, string part2) =>
|
||||
Common.CheckDay(dayType, part1, part2, true);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,17 +10,14 @@ public class Test2016
|
|||
[DataRow(typeof(Day02), "76792", "A7AC3")]
|
||||
[DataRow(typeof(Day03), "993", "1849")]
|
||||
[DataRow(typeof(Day04), "361724", "482")]
|
||||
[DataRow(typeof(Day05), "F77A0E6E", "999828EC")]
|
||||
public void CheckAllDays(Type dayType, string part1, string part2)
|
||||
{
|
||||
//[DataRow(typeof(Day05), "F77A0E6E", "999828EC")] // TODO: optimize day 5
|
||||
public void CheckAllDays(Type dayType, string part1, string part2) =>
|
||||
Common.CheckDay(dayType, part1, part2);
|
||||
}
|
||||
|
||||
[DataTestMethod]
|
||||
[DataRow(typeof(Day02), "1985", "5DB3")]
|
||||
[DataRow(typeof(Day05), "18F47A30", "05ACE8E3")]
|
||||
public void CheckTestInputs(Type dayType, string part1, string part2)
|
||||
{
|
||||
//[DataRow(typeof(Day05), "18F47A30", "05ACE8E3")]
|
||||
[DataRow(typeof(Day06), "easter", "")]
|
||||
public void CheckTestInputs(Type dayType, string part1, string part2) =>
|
||||
Common.CheckDay(dayType, part1, part2, true);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,8 +7,6 @@ public class Test2017
|
|||
{
|
||||
[DataTestMethod]
|
||||
[DataRow(typeof(Day01), "", "")]
|
||||
public void CheckAllDays(Type dayType, string part1, string part2)
|
||||
{
|
||||
public void CheckAllDays(Type dayType, string part1, string part2) =>
|
||||
Common.CheckDay(dayType, part1, part2);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,8 +9,6 @@ public class Test2018
|
|||
[DataRow(typeof(Day01), "582", "488")]
|
||||
[DataRow(typeof(Day02), "5166", "cypueihajytordkgzxfqplbwn")]
|
||||
[DataRow(typeof(Day03), "119551", "1124")]
|
||||
public void CheckAllDays(Type dayType, string part1, string part2)
|
||||
{
|
||||
public void CheckAllDays(Type dayType, string part1, string part2) =>
|
||||
Common.CheckDay(dayType, part1, part2);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -49,8 +49,6 @@ public class Test2019
|
|||
[DataRow(typeof(Day23), "23626", "19019")]
|
||||
//[DataRow(typeof(Day24), "", "")]
|
||||
//[DataRow(typeof(Day25), "", "")]
|
||||
public void CheckAllDays(Type dayType, string part1, string part2)
|
||||
{
|
||||
public void CheckAllDays(Type dayType, string part1, string part2) =>
|
||||
Common.CheckDay(dayType, part1, part2);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,8 +31,6 @@ public class Test2020
|
|||
[DataRow(typeof(Day23), "36542897", "562136730660")]
|
||||
[DataRow(typeof(Day24), "282", "3445")]
|
||||
[DataRow(typeof(Day25), "11707042", "")]
|
||||
public void CheckAllDays(Type dayType, string part1, string part2)
|
||||
{
|
||||
public void CheckAllDays(Type dayType, string part1, string part2) =>
|
||||
Common.CheckDay(dayType, part1, part2);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,21 +6,21 @@ namespace AOC.Test;
|
|||
public class Test2021
|
||||
{
|
||||
private const string Day13Actual = """
|
||||
████▒███▒▒████▒▒██▒▒█▒▒█▒▒██▒▒█▒▒█▒█▒▒█
|
||||
█▒▒▒▒█▒▒█▒▒▒▒█▒█▒▒█▒█▒█▒▒█▒▒█▒█▒▒█▒█▒▒█
|
||||
███▒▒█▒▒█▒▒▒█▒▒█▒▒▒▒██▒▒▒█▒▒▒▒████▒█▒▒█
|
||||
█▒▒▒▒███▒▒▒█▒▒▒█▒██▒█▒█▒▒█▒▒▒▒█▒▒█▒█▒▒█
|
||||
█▒▒▒▒█▒▒▒▒█▒▒▒▒█▒▒█▒█▒█▒▒█▒▒█▒█▒▒█▒█▒▒█
|
||||
████▒█▒▒▒▒████▒▒███▒█▒▒█▒▒██▒▒█▒▒█▒▒██▒
|
||||
""";
|
||||
████▒███▒▒████▒▒██▒▒█▒▒█▒▒██▒▒█▒▒█▒█▒▒█
|
||||
█▒▒▒▒█▒▒█▒▒▒▒█▒█▒▒█▒█▒█▒▒█▒▒█▒█▒▒█▒█▒▒█
|
||||
███▒▒█▒▒█▒▒▒█▒▒█▒▒▒▒██▒▒▒█▒▒▒▒████▒█▒▒█
|
||||
█▒▒▒▒███▒▒▒█▒▒▒█▒██▒█▒█▒▒█▒▒▒▒█▒▒█▒█▒▒█
|
||||
█▒▒▒▒█▒▒▒▒█▒▒▒▒█▒▒█▒█▒█▒▒█▒▒█▒█▒▒█▒█▒▒█
|
||||
████▒█▒▒▒▒████▒▒███▒█▒▒█▒▒██▒▒█▒▒█▒▒██▒
|
||||
""";
|
||||
|
||||
private const string Day13Test = """
|
||||
█████
|
||||
█▒▒▒█
|
||||
█▒▒▒█
|
||||
█▒▒▒█
|
||||
█████
|
||||
""";
|
||||
█████
|
||||
█▒▒▒█
|
||||
█▒▒▒█
|
||||
█▒▒▒█
|
||||
█████
|
||||
""";
|
||||
|
||||
[DataTestMethod]
|
||||
[DataRow(typeof(Day01), "1616", "1645")]
|
||||
|
@ -48,10 +48,8 @@ public class Test2021
|
|||
[DataRow(typeof(Day23), "15365", "52055")]
|
||||
[DataRow(typeof(Day24), "99299513899971", "93185111127911")]
|
||||
[DataRow(typeof(Day25), "417", "")]
|
||||
public void CheckAllDays(Type dayType, string part1, string part2)
|
||||
{
|
||||
public void CheckAllDays(Type dayType, string part1, string part2) =>
|
||||
Common.CheckDay(dayType, part1, part2);
|
||||
}
|
||||
|
||||
[DataTestMethod]
|
||||
[DataRow(typeof(Day01), "7", "5")]
|
||||
|
@ -78,8 +76,6 @@ public class Test2021
|
|||
[DataRow(typeof(Day22), "590784", "39769202357779")]
|
||||
[DataRow(typeof(Day23), "12521", "44169")]
|
||||
[DataRow(typeof(Day25), "58", "")]
|
||||
public void CheckTestInputs(Type dayType, string part1, string part2)
|
||||
{
|
||||
public void CheckTestInputs(Type dayType, string part1, string part2) =>
|
||||
Common.CheckDay(dayType, part1, part2, true);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -37,10 +37,8 @@ public class Test2022
|
|||
[DataRow(typeof(Day12), "352", "345")]
|
||||
[DataRow(typeof(Day13), "5682", "20304")]
|
||||
[DataRow(typeof(Day14), "674", "24958")]
|
||||
public void CheckAllDays(Type dayType, string part1, string part2)
|
||||
{
|
||||
public void CheckAllDays(Type dayType, string part1, string part2) =>
|
||||
Common.CheckDay(dayType, part1, part2);
|
||||
}
|
||||
|
||||
[DataTestMethod]
|
||||
[DataRow(typeof(Day01), "24000", "45000")]
|
||||
|
@ -58,8 +56,6 @@ public class Test2022
|
|||
[DataRow(typeof(Day13), "13", "140")]
|
||||
[DataRow(typeof(Day14), "24", "93")]
|
||||
[DataRow(typeof(Day15), "", "")]
|
||||
public void CheckTestInputs(Type dayType, string part1, string part2)
|
||||
{
|
||||
public void CheckTestInputs(Type dayType, string part1, string part2) =>
|
||||
Common.CheckDay(dayType, part1, part2, true);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,8 +7,6 @@ public class Test2023
|
|||
{
|
||||
[DataTestMethod]
|
||||
[DataRow(typeof(Day01), "", "")]
|
||||
public void CheckAllDays(Type dayType, string part1, string part2)
|
||||
{
|
||||
public void CheckAllDays(Type dayType, string part1, string part2) =>
|
||||
Common.CheckDay(dayType, part1, part2);
|
||||
}
|
||||
}
|
|
@ -11,14 +11,16 @@ public sealed class Day23() : Day(2015, 23, "Opening the Turing Lock")
|
|||
|
||||
private int RunOperations(int initialA = 0, int initialB = 0)
|
||||
{
|
||||
Dictionary<char, int> registers = new();
|
||||
registers['a'] = initialA;
|
||||
registers['b'] = initialB;
|
||||
Dictionary<char, int> registers = new()
|
||||
{
|
||||
['a'] = initialA,
|
||||
['b'] = initialB
|
||||
};
|
||||
|
||||
var input = Input.ToList();
|
||||
for (var i = 0; i < input.Count;)
|
||||
{
|
||||
switch (input[i][0..3])
|
||||
switch (input[i][..3])
|
||||
{
|
||||
case "hlf":
|
||||
registers[input[i++][4]] /= 2;
|
||||
|
|
|
@ -37,8 +37,7 @@ public sealed class Day05() : Day(2016, 5, "How About a Nice Game of Chess?")
|
|||
{
|
||||
var s = Input.First();
|
||||
var answer = new char[8];
|
||||
var index = 0;
|
||||
var found = 0;
|
||||
int index = 0, found = 0;
|
||||
|
||||
while (true)
|
||||
{
|
||||
|
|
|
@ -3,7 +3,7 @@ namespace AOC2016;
|
|||
/// <summary>
|
||||
/// Day 6: <a href="https://adventofcode.com/2016/day/6"/>
|
||||
/// </summary>
|
||||
public sealed class Day06() : Day(2016, 6, "Puzzle Name")
|
||||
public sealed class Day06() : Day(2016, 6, "Signals and Noise")
|
||||
{
|
||||
public override void ProcessInput()
|
||||
{
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
eedadn
|
||||
drvtee
|
||||
eandsr
|
||||
raavrd
|
||||
atevrs
|
||||
tsrnev
|
||||
sdttsa
|
||||
rasrtv
|
||||
nssdts
|
||||
ntnada
|
||||
svetve
|
||||
tesnvt
|
||||
vntsnd
|
||||
vrdear
|
||||
dvrsen
|
||||
enarar
|
|
@ -28,8 +28,5 @@
|
|||
<ItemGroup>
|
||||
<PackageReference Include="morelinq" Version="4.0.0" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="input2023\" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
Loading…
Reference in New Issue