feat: solved day 16 part 1

This commit is contained in:
Stevan Freeborn
2024-12-17 01:24:25 -06:00
parent 8e64d65e7d
commit 1ff5b50840
2 changed files with 159 additions and 14 deletions
@@ -0,0 +1,62 @@
namespace ReindeerMaze.Tests;
public class PuzzleSolverTests
{
[Test]
[MethodDataSource(nameof(SolveTestCases))]
public async Task Solve_WhenCalledWithInput_ItShouldReturnExpectedValue(SolveTestCase testCase)
{
var result = PuzzleSolver.Solve(testCase.Input);
await Assert.That(result).IsEqualTo(testCase.ExpectedValue);
}
public static IEnumerable<Func<SolveTestCase>> SolveTestCases()
{
yield return () => new(
[
"###############",
"#.......#....E#",
"#.#.###.#.###.#",
"#.....#.#...#.#",
"#.###.#####.#.#",
"#.#.#.......#.#",
"#.#.#####.###.#",
"#...........#.#",
"###.#.#####.#.#",
"#...#.....#.#.#",
"#.#.#.###.#.#.#",
"#.....#...#.#.#",
"#.###.#.#.#.#.#",
"#S..#.....#...#",
"###############",
],
7036
);
yield return () => new(
[
"#################",
"#...#...#...#..E#",
"#.#.#.#.#.#.#.#.#",
"#.#.#.#...#...#.#",
"#.#.#.#.###.#.#.#",
"#...#.#.#.....#.#",
"#.#.#.#.#.#####.#",
"#.#...#.#.#.....#",
"#.#.#####.#.###.#",
"#.#.#.......#...#",
"#.#.###.#####.###",
"#.#.#...#.....#.#",
"#.#.#.#####.###.#",
"#.#.#.........#.#",
"#.#.#.#########.#",
"#S#.............#",
"#################",
],
11048
);
}
public record SolveTestCase(string[] Input, int ExpectedValue);
}