diff --git a/01/Trebuchet.Tests/GlobalUsings.cs b/01/Trebuchet.Tests/GlobalUsings.cs
index 2d5b473..d6f0167 100644
--- a/01/Trebuchet.Tests/GlobalUsings.cs
+++ b/01/Trebuchet.Tests/GlobalUsings.cs
@@ -1,3 +1,3 @@
global using FluentAssertions;
-global using Xunit;
+global using Xunit;
\ No newline at end of file
diff --git a/01/Trebuchet/Program.cs b/01/Trebuchet/Program.cs
index d90bb99..46e5e1d 100644
--- a/01/Trebuchet/Program.cs
+++ b/01/Trebuchet/Program.cs
@@ -9,16 +9,16 @@ public class Program
if (args.Length is 0)
{
Console.WriteLine("Please provide a path to the input file.");
- return 1;
+ return -1;
}
if (File.Exists(args[0]) is false)
{
Console.WriteLine("The provided file does not exist.");
- return 2;
+ return -2;
}
- IPuzzleSolver puzzleSolver = args.Length > 1 && args[1] == "2"
+ IPuzzleSolver puzzleSolver = args.Length > 1 && args[1] == "part2"
? new PartTwoPuzzleSolver()
: new PartOnePuzzleSolver();
@@ -27,7 +27,7 @@ public class Program
Console.WriteLine($"The sum of all calibration values is {result}.");
- return 0;
+ return result;
}
}
diff --git a/02/CubeConundrum.Tests/GlobalUsings.cs b/02/CubeConundrum.Tests/GlobalUsings.cs
index 2d5b473..d6f0167 100644
--- a/02/CubeConundrum.Tests/GlobalUsings.cs
+++ b/02/CubeConundrum.Tests/GlobalUsings.cs
@@ -1,3 +1,3 @@
global using FluentAssertions;
-global using Xunit;
+global using Xunit;
\ No newline at end of file
diff --git a/02/CubeConundrum/Program.cs b/02/CubeConundrum/Program.cs
index c9558a4..30fd144 100644
--- a/02/CubeConundrum/Program.cs
+++ b/02/CubeConundrum/Program.cs
@@ -26,7 +26,14 @@ public class Program
? puzzleSolver.SumGameMinimumPowers(games)
: puzzleSolver.SumPossibleGameIds(games);
- Console.WriteLine($"The sum of all possible game ids is {result}.");
+ if (args.Length > 1 && args[1] == "part2")
+ {
+ Console.WriteLine($"The sum of the minimum powers of all games is {result}.");
+ }
+ else
+ {
+ Console.WriteLine($"The sum of all possible game ids is {result}.");
+ }
return result;
}
diff --git a/03/GearRatios.Tests/GearRatios.Tests.csproj b/03/GearRatios.Tests/GearRatios.Tests.csproj
new file mode 100644
index 0000000..d3b6c47
--- /dev/null
+++ b/03/GearRatios.Tests/GearRatios.Tests.csproj
@@ -0,0 +1,30 @@
+
+
+
+ net8.0
+ enable
+ enable
+
+ false
+ true
+
+
+
+
+
+
+
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+ all
+
+
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+ all
+
+
+
+
+
+
+
+
diff --git a/03/GearRatios.Tests/GlobalUsings.cs b/03/GearRatios.Tests/GlobalUsings.cs
new file mode 100644
index 0000000..2d5b473
--- /dev/null
+++ b/03/GearRatios.Tests/GlobalUsings.cs
@@ -0,0 +1,3 @@
+global using FluentAssertions;
+
+global using Xunit;
diff --git a/03/GearRatios.Tests/LineTests.cs b/03/GearRatios.Tests/LineTests.cs
new file mode 100644
index 0000000..ff23f80
--- /dev/null
+++ b/03/GearRatios.Tests/LineTests.cs
@@ -0,0 +1,353 @@
+namespace GearRatios.Test;
+
+public class LineTests
+{
+ [Theory, MemberData(nameof(TestData.LineData), MemberType = typeof(TestData))]
+ public void Parse_GivenLine_ItShouldParseExpectedValues(string line, Line expected)
+ {
+ var actual = Line.Parse(line);
+ actual.Should().BeEquivalentTo(expected);
+ }
+
+ [Theory, MemberData(nameof(TestData.PartNumberData), MemberType = typeof(TestData))]
+ public void GetPartNumbers_GivenLine_ItShouldReturnExpectedValues(Line currentLine, Line? prevLine, Line? nextLine, List expected)
+ {
+ var actual = currentLine.GetPartNumbers(prevLine, nextLine);
+ actual.Should().BeEquivalentTo(expected);
+ }
+
+ [Theory, MemberData(nameof(TestData.GearData), MemberType = typeof(TestData))]
+ public void GetGearRatios_GivenLine_ItShouldReturnExpectedValues(Line currentLine, Line? prevLine, Line? nextLine, List expected)
+ {
+ var actual = currentLine.GetGearRatios(prevLine, nextLine);
+ actual.Should().BeEquivalentTo(expected);
+ }
+
+
+ public static class TestData
+ {
+ public static IEnumerable