-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
110 changed files
with
4,708 additions
and
530 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
using Advent.Common.Settings; | ||
using Spectre.Console.Cli; | ||
|
||
namespace Advent.Tests.Commands; | ||
|
||
public class Day25CommandTests | ||
{ | ||
private readonly List<string> _arguments = []; | ||
private readonly IRemainingArguments _remaining = Substitute.For<IRemainingArguments>(); | ||
private readonly TestConsole console = new(); | ||
|
||
public Day25CommandTests() | ||
{ | ||
console.Profile.Capabilities.Interactive = true; | ||
} | ||
|
||
[Fact] | ||
public async Task Day25Command_Solves_Part1_Correctly() | ||
{ | ||
var mockReader = Substitute.For<IFileReader>(); | ||
mockReader | ||
.ReadInputAsync(Arg.Any<string>()) | ||
.Returns(Task.FromResult(TestData.Day25TestData)); | ||
|
||
var command = new Day25Command(mockReader, console); | ||
var result = await command.ExecuteAsync( | ||
new CommandContext(_arguments, _remaining, "day25", null), | ||
new AdventSettings { Part = "Part 1" } | ||
); | ||
result.Should().Be(0); | ||
console.Output.Should().Contain("Day 25 Part 1"); | ||
console.Output.Should().Contain("The answer is 3"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
using Advent.UseCases.Day25; | ||
|
||
namespace Advent.Tests.UseCases.Day25; | ||
|
||
public class Day25ParserTests | ||
{ | ||
[Fact] | ||
public void Parse_WhenInputIsValid_ReturnsDay25Input() | ||
{ | ||
// Arrange | ||
var expectedLocks = new List<GridData> | ||
{ | ||
new(["#####", ".####", ".####", ".####", ".#.#.", ".#...", "....."]), | ||
new(["#####", "##.##", ".#.##", "...##", "...#.", "...#.", "....."]) | ||
}; | ||
|
||
var expectedKeys = new List<GridData> | ||
{ | ||
new([".....", "#....", "#....", "#...#", "#.#.#", "#.###", "#####"]), | ||
new([".....", ".....", "#.#..", "###..", "###.#", "###.#", "#####"]), | ||
new([".....", ".....", ".....", "#....", "#.#..", "#.#.#", "#####"]) | ||
}; | ||
|
||
// Act | ||
(var locks, var keys) = Day25Parser.Parse(TestData.Day25TestData); | ||
|
||
// Assert | ||
locks.Should().HaveCount(2); | ||
locks.Should().BeEquivalentTo(expectedLocks); | ||
keys.Should().HaveCount(3); | ||
keys.Should().BeEquivalentTo(expectedKeys); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
using Advent.UseCases.Day25; | ||
|
||
namespace Advent.Tests.UseCases.Day25; | ||
|
||
public class Day25Part1SolverTests | ||
{ | ||
[Fact] | ||
public void Solve_WhenInputIsValid_ReturnsCorrectResult() | ||
{ | ||
// Arrange | ||
var input = Day25Parser.Parse(TestData.Day25TestData); | ||
var solver = new Day25Part1Solver(); | ||
|
||
// Act | ||
var result = solver.Solve(input); | ||
|
||
// Assert | ||
result.Should().Be("3"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.