Add TestContext::runGeneric() template function (and variants)
This commit is contained in:
@@ -15,65 +15,40 @@
|
||||
|
||||
#include <aocTests/TestContext.hpp>
|
||||
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
|
||||
#include <aoc/framework/SolverEngine.hpp>
|
||||
|
||||
void TestContext::run(const std::unique_ptr<Solver<long long, long long>>&& solver, const long long expected1,
|
||||
const long long expected2, const std::vector<std::string>& inputPaths)
|
||||
void TestContext::run(std::unique_ptr<Solver<long long, long long>>&& solver, const long long& expected1,
|
||||
const long long& expected2, const std::vector<std::string>& inputPaths)
|
||||
{
|
||||
SolverEngine solverEngine{ inputPaths };
|
||||
solverEngine.run(*solver);
|
||||
|
||||
REQUIRE(expected1 == solver->getResultPart1());
|
||||
REQUIRE(expected2 == solver->getResultPart2());
|
||||
runGeneric(std::move(solver), expected1, expected2, inputPaths);
|
||||
}
|
||||
|
||||
void TestContext::run(const std::unique_ptr<Solver<long long, std::string>>&& solver, const long long expected1,
|
||||
const std::string expected2, const std::vector<std::string>& inputPaths)
|
||||
void TestContext::run(std::unique_ptr<Solver<long long, std::string>>&& solver, const long long& expected1,
|
||||
const std::string& expected2, const std::vector<std::string>& inputPaths)
|
||||
{
|
||||
SolverEngine solverEngine{ inputPaths };
|
||||
solverEngine.run(*solver);
|
||||
|
||||
REQUIRE(expected1 == solver->getResultPart1());
|
||||
REQUIRE(expected2 == solver->getResultPart2());
|
||||
runGeneric(std::move(solver), expected1, expected2, inputPaths);
|
||||
}
|
||||
|
||||
void TestContext::run(const std::unique_ptr<Solver<std::string, long long>>&& solver, const std::string expected1,
|
||||
const long long expected2, const std::vector<std::string>& inputPaths)
|
||||
void TestContext::run(std::unique_ptr<Solver<std::string, long long>>&& solver, const std::string& expected1,
|
||||
const long long& expected2, const std::vector<std::string>& inputPaths)
|
||||
{
|
||||
SolverEngine solverEngine{ inputPaths };
|
||||
solverEngine.run(*solver);
|
||||
|
||||
REQUIRE(expected1 == solver->getResultPart1());
|
||||
REQUIRE(expected2 == solver->getResultPart2());
|
||||
runGeneric(std::move(solver), expected1, expected2, inputPaths);
|
||||
}
|
||||
|
||||
void TestContext::runPart1(const std::unique_ptr<Solver<long long, long long>>&& solver, const long long expected,
|
||||
void TestContext::runPart1(std::unique_ptr<Solver<long long, long long>>&& solver, const long long& expected,
|
||||
const std::vector<std::string>& inputPaths)
|
||||
{
|
||||
SolverEngine solverEngine{ inputPaths };
|
||||
solverEngine.run(*solver);
|
||||
|
||||
REQUIRE(expected == solver->getResultPart1());
|
||||
runPart1Generic(std::move(solver), expected, inputPaths);
|
||||
}
|
||||
|
||||
void TestContext::runPart1(const std::unique_ptr<Solver<std::string, long long>>&& solver, const std::string expected,
|
||||
void TestContext::runPart1(std::unique_ptr<Solver<std::string, long long>>&& solver, const std::string& expected,
|
||||
const std::vector<std::string>& inputPaths)
|
||||
{
|
||||
SolverEngine solverEngine{ inputPaths };
|
||||
solverEngine.run(*solver);
|
||||
|
||||
REQUIRE(expected == solver->getResultPart1());
|
||||
runPart1Generic(std::move(solver), expected, inputPaths);
|
||||
}
|
||||
|
||||
void TestContext::runPart2(const std::unique_ptr<Solver<long long, long long>>&& solver, const long long expected,
|
||||
void TestContext::runPart2(std::unique_ptr<Solver<long long, long long>>&& solver, const long long& expected,
|
||||
const std::vector<std::string>& inputPaths)
|
||||
{
|
||||
SolverEngine solverEngine{ inputPaths };
|
||||
solverEngine.run(*solver);
|
||||
|
||||
REQUIRE(expected == solver->getResultPart2());
|
||||
runPart2Generic(std::move(solver), expected, inputPaths);
|
||||
}
|
||||
|
||||
std::vector<std::string> TestContext::getInputPaths() const
|
||||
|
||||
Reference in New Issue
Block a user