Files
advent-of-code-2024/16/ReindeerMaze.Tests/PuzzleSolverTests.cs
T

62 lines
1.5 KiB
C#
Raw Normal View History

2024-12-17 01:24:25 -06:00
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);
}