feat: solved day 16 part 2
This commit is contained in:
@@ -2,11 +2,26 @@
|
||||
|
||||
public class PuzzleSolverTests
|
||||
{
|
||||
private async Task<string[]> GetPuzzleInput()
|
||||
{
|
||||
return await File.ReadAllLinesAsync(Path.Combine(AppContext.BaseDirectory, "INPUT.txt"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task PartOneSolution_WhenCalledWithInput_ItShouldReturnExpectedValue()
|
||||
{
|
||||
var input = await GetPuzzleInput();
|
||||
|
||||
var result = PuzzleSolver.Solve(input);
|
||||
|
||||
await Assert.That(result).IsEqualTo(90460);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[MethodDataSource(nameof(SolveTestCases))]
|
||||
public async Task Solve_WhenCalledWithInput_ItShouldReturnExpectedValue(SolveTestCase testCase)
|
||||
{
|
||||
var result = PuzzleSolver.Solve(testCase.Input);
|
||||
var result = PuzzleSolver.Solve(testCase.Input, testCase.IsPart2);
|
||||
|
||||
await Assert.That(result).IsEqualTo(testCase.ExpectedValue);
|
||||
}
|
||||
@@ -30,7 +45,8 @@ public class PuzzleSolverTests
|
||||
"#.###.#.#.#.#.#",
|
||||
"#S..#.....#...#",
|
||||
"###############",
|
||||
],
|
||||
],
|
||||
false,
|
||||
7036
|
||||
);
|
||||
|
||||
@@ -54,9 +70,56 @@ public class PuzzleSolverTests
|
||||
"#S#.............#",
|
||||
"#################",
|
||||
],
|
||||
false,
|
||||
11048
|
||||
);
|
||||
|
||||
yield return () => new(
|
||||
[
|
||||
"###############",
|
||||
"#.......#....E#",
|
||||
"#.#.###.#.###.#",
|
||||
"#.....#.#...#.#",
|
||||
"#.###.#####.#.#",
|
||||
"#.#.#.......#.#",
|
||||
"#.#.#####.###.#",
|
||||
"#...........#.#",
|
||||
"###.#.#####.#.#",
|
||||
"#...#.....#.#.#",
|
||||
"#.#.#.###.#.#.#",
|
||||
"#.....#...#.#.#",
|
||||
"#.###.#.#.#.#.#",
|
||||
"#S..#.....#...#",
|
||||
"###############",
|
||||
],
|
||||
true,
|
||||
45
|
||||
);
|
||||
|
||||
yield return () => new(
|
||||
[
|
||||
"#################",
|
||||
"#...#...#...#..E#",
|
||||
"#.#.#.#.#.#.#.#.#",
|
||||
"#.#.#.#...#...#.#",
|
||||
"#.#.#.#.###.#.#.#",
|
||||
"#...#.#.#.....#.#",
|
||||
"#.#.#.#.#.#####.#",
|
||||
"#.#...#.#.#.....#",
|
||||
"#.#.#####.#.###.#",
|
||||
"#.#.#.......#...#",
|
||||
"#.#.###.#####.###",
|
||||
"#.#.#...#.....#.#",
|
||||
"#.#.#.#####.###.#",
|
||||
"#.#.#.........#.#",
|
||||
"#.#.#.#########.#",
|
||||
"#S#.............#",
|
||||
"#################",
|
||||
],
|
||||
true,
|
||||
64
|
||||
);
|
||||
}
|
||||
|
||||
public record SolveTestCase(string[] Input, int ExpectedValue);
|
||||
public record SolveTestCase(string[] Input, bool IsPart2, int ExpectedValue);
|
||||
}
|
||||
Reference in New Issue
Block a user