share one loadTestConfig() helper across the tests
This commit is contained in:
@@ -5,11 +5,7 @@
|
||||
#include "Simulation.h"
|
||||
#include "Tick.h"
|
||||
#include "TickDriver.h"
|
||||
|
||||
static GameConfig loadConfig()
|
||||
{
|
||||
return ConfigLoader::loadFromDirectory(CONFIG_DIR);
|
||||
}
|
||||
#include "TestConfig.h"
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Simulation
|
||||
@@ -17,14 +13,14 @@ static GameConfig loadConfig()
|
||||
|
||||
TEST_CASE("Simulation::currentTick starts at 0", "[simulation]")
|
||||
{
|
||||
const Simulation sim(loadConfig());
|
||||
const Simulation sim(loadTestConfig());
|
||||
|
||||
REQUIRE(sim.getCurrentTick() == 0);
|
||||
}
|
||||
|
||||
TEST_CASE("Simulation::tick increments currentTick by 1", "[simulation]")
|
||||
{
|
||||
Simulation sim(loadConfig());
|
||||
Simulation sim(loadTestConfig());
|
||||
|
||||
sim.tick();
|
||||
|
||||
@@ -33,7 +29,7 @@ TEST_CASE("Simulation::tick increments currentTick by 1", "[simulation]")
|
||||
|
||||
TEST_CASE("Simulation::tick 10 times yields currentTick == 10", "[simulation]")
|
||||
{
|
||||
Simulation sim(loadConfig());
|
||||
Simulation sim(loadTestConfig());
|
||||
|
||||
for (int i = 0; i < 10; ++i)
|
||||
{
|
||||
@@ -45,14 +41,14 @@ TEST_CASE("Simulation::tick 10 times yields currentTick == 10", "[simulation]")
|
||||
|
||||
TEST_CASE("Simulation::drainBeamFiredEvents returns empty initially", "[simulation]")
|
||||
{
|
||||
Simulation sim(loadConfig());
|
||||
Simulation sim(loadTestConfig());
|
||||
|
||||
REQUIRE(sim.drainBeamFiredEvents().empty());
|
||||
}
|
||||
|
||||
TEST_CASE("Simulation::drainBeamFiredEvents clears queue on drain", "[simulation]")
|
||||
{
|
||||
Simulation sim(loadConfig());
|
||||
Simulation sim(loadTestConfig());
|
||||
|
||||
// First drain: empty.
|
||||
sim.drainBeamFiredEvents();
|
||||
@@ -63,7 +59,7 @@ TEST_CASE("Simulation::drainBeamFiredEvents clears queue on drain", "[simulation
|
||||
|
||||
TEST_CASE("Simulation::hasSchematicChoicesPending returns false initially", "[simulation]")
|
||||
{
|
||||
Simulation sim(loadConfig());
|
||||
Simulation sim(loadTestConfig());
|
||||
|
||||
REQUIRE_FALSE(sim.hasSchematicChoicesPending());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user