share one loadTestConfig() helper across the tests

This commit is contained in:
2026-08-03 21:05:28 +02:00
parent 594c3b93c5
commit 1150985c1f
22 changed files with 247 additions and 308 deletions

View File

@@ -16,6 +16,7 @@
#include "GameConfig.h"
#include "ReplayRecorder.h"
#include "Simulation.h"
#include "TestConfig.h"
namespace
{
@@ -144,7 +145,7 @@ TEST_CASE("ReplayRecorder writes a well-formed file", "[replay]")
TEST_CASE("CommandManager records commands and an initial checksum on drain", "[replay]")
{
Simulation sim(ConfigLoader::loadFromDirectory(CONFIG_DIR), 7u);
Simulation sim(loadTestConfig(), 7u);
CommandManager manager(sim);
std::unique_ptr<ReplayRecorder> recorder =
@@ -187,7 +188,7 @@ TEST_CASE("ReplayRecorder startNewRun rolls to a new file", "[replay]")
TEST_CASE("CommandManager rolls the replay file on a Reset command", "[replay]")
{
Simulation sim(ConfigLoader::loadFromDirectory(CONFIG_DIR), 1u);
Simulation sim(loadTestConfig(), 1u);
CommandManager manager(sim);
std::unique_ptr<ReplayRecorder> recorder =
@@ -197,7 +198,7 @@ TEST_CASE("CommandManager rolls the replay file on a Reset command", "[replay]")
const std::string firstPath = recorderPtr->getCurrentFilePath();
std::shared_ptr<ResetCommand> reset = std::make_shared<ResetCommand>();
reset->config = std::make_shared<GameConfig>(ConfigLoader::loadFromDirectory(CONFIG_DIR));
reset->config = std::make_shared<GameConfig>(loadTestConfig());
reset->seed = 999u;
manager.enqueue(reset);
manager.drain();