Add solution for "Day 24: Crossed Wires", part 1

This commit is contained in:
2025-06-26 20:41:18 +02:00
parent 958adde4a2
commit 4788a1b5ab
8 changed files with 309 additions and 0 deletions

View File

@@ -38,6 +38,7 @@ class TestContext
const std::string& expected2);
void runExamplePart1(std::unique_ptr<Solver<int64_t, int64_t>>&& solver, const int64_t expected);
void runExamplePart1(std::unique_ptr<Solver<std::string, int64_t>>&& solver, const std::string& expected);
void runExamplePart1(std::unique_ptr<Solver<int64_t, std::string>>&& solver, const int64_t expected);
void runExamplePart2(std::unique_ptr<Solver<int64_t, int64_t>>&& solver, const int64_t expected);
private:
template <typename T1, typename T2>

View File

@@ -41,6 +41,7 @@
#include <aoc/KeypadConundrum.hpp>
#include <aoc/MonkeyMarket.hpp>
#include <aoc/LanParty.hpp>
#include <aoc/CrossedWires.hpp>
#define REQUIRE_MESSAGE(cond, msg) if (!(cond)) { INFO(msg); REQUIRE(cond); }
@@ -413,3 +414,20 @@ TEST_CASE("[LanPartyTests]")
test.runExample(std::make_unique<LanParty>(), 7, "co,de,ka,ta");
}
}
TEST_CASE("[CrossedWiresTests]")
{
TestContext test;
SECTION("FullData")
{
test.runFull(std::make_unique<CrossedWires>(), 48508229772400, "");
}
SECTION("ExampleData")
{
test.runExamplePart1(std::make_unique<CrossedWires>(), 4);
}
SECTION("ExampleData2")
{
test.runExamplePart1(std::make_unique<CrossedWires>(2), 2024);
}
}

View File

@@ -55,6 +55,11 @@ void TestContext::runExamplePart1(std::unique_ptr<Solver<std::string, int64_t>>&
runPart1Generic(std::move(solver), expected, exampleInputPaths_);
}
void TestContext::runExamplePart1(std::unique_ptr<Solver<int64_t, std::string>>&& solver, const int64_t expected)
{
runPart1Generic(std::move(solver), expected, exampleInputPaths_);
}
void TestContext::runExamplePart2(std::unique_ptr<Solver<int64_t, int64_t>>&& solver, const int64_t expected)
{
runPart2Generic(std::move(solver), expected, exampleInputPaths_);