make tests run again
This commit is contained in:
@@ -98,8 +98,7 @@ TEST_CASE("WaveSystem: generation starts at 0 and increments on push", "[wave]")
|
||||
|
||||
TEST_CASE("WaveSystem: Simulation pre-places HQ + 2 player + 2 enemy stations", "[wave]")
|
||||
{
|
||||
const GameConfig cfg = loadConfig();
|
||||
const Simulation sim(cfg, 42);
|
||||
const Simulation sim(loadConfig(), 42);
|
||||
|
||||
int hqCount = 0;
|
||||
int playerCount = 0;
|
||||
@@ -118,11 +117,10 @@ TEST_CASE("WaveSystem: Simulation pre-places HQ + 2 player + 2 enemy stations",
|
||||
|
||||
TEST_CASE("WaveSystem: HQ has correct initial HP from config", "[wave]")
|
||||
{
|
||||
const GameConfig cfg = loadConfig();
|
||||
const Simulation sim(cfg, 42);
|
||||
const Simulation sim(loadConfig(), 42);
|
||||
|
||||
const float expectedHp =
|
||||
static_cast<float>(cfg.stations.hq.hpFormula.evaluate(0.0));
|
||||
static_cast<float>(sim.config().stations.hq.hpFormula.evaluate(0.0));
|
||||
bool found = false;
|
||||
float actualHp = 0.0f;
|
||||
for (const Building& b : sim.buildings().allBuildings())
|
||||
@@ -141,8 +139,7 @@ TEST_CASE("WaveSystem: HQ has correct initial HP from config", "[wave]")
|
||||
|
||||
TEST_CASE("WaveSystem: HQ anchor is at asteroid right edge", "[wave]")
|
||||
{
|
||||
const GameConfig cfg = loadConfig();
|
||||
const Simulation sim(cfg, 42);
|
||||
const Simulation sim(loadConfig(), 42);
|
||||
|
||||
for (const Building& b : sim.buildings().allBuildings())
|
||||
{
|
||||
@@ -159,8 +156,7 @@ TEST_CASE("WaveSystem: HQ anchor is at asteroid right edge", "[wave]")
|
||||
|
||||
TEST_CASE("WaveSystem: player stations have weapon set", "[wave]")
|
||||
{
|
||||
const GameConfig cfg = loadConfig();
|
||||
const Simulation sim(cfg, 42);
|
||||
const Simulation sim(loadConfig(), 42);
|
||||
|
||||
int armedPlayerStations = 0;
|
||||
for (const Building& b : sim.buildings().allBuildings())
|
||||
@@ -178,8 +174,7 @@ TEST_CASE("WaveSystem: player stations have weapon set", "[wave]")
|
||||
|
||||
TEST_CASE("WaveSystem: enemy stations have weapon set", "[wave]")
|
||||
{
|
||||
const GameConfig cfg = loadConfig();
|
||||
const Simulation sim(cfg, 42);
|
||||
const Simulation sim(loadConfig(), 42);
|
||||
|
||||
int armedEnemyStations = 0;
|
||||
for (const Building& b : sim.buildings().allBuildings())
|
||||
@@ -201,8 +196,7 @@ TEST_CASE("WaveSystem: enemy stations have weapon set", "[wave]")
|
||||
|
||||
TEST_CASE("WaveSystem: enemy ships spawn after the initial gap elapses", "[wave]")
|
||||
{
|
||||
const GameConfig cfg = loadConfig();
|
||||
Simulation sim(cfg, 42);
|
||||
Simulation sim(loadConfig(), 42);
|
||||
|
||||
// The maximum gap is gapMaxSeconds = 45s → 1350 ticks.
|
||||
// Run 1500 ticks to guarantee at least one wave has triggered.
|
||||
@@ -226,8 +220,7 @@ TEST_CASE("WaveSystem: enemy ships spawn after the initial gap elapses", "[wave]
|
||||
|
||||
TEST_CASE("WaveSystem: only eligible ships (cost > 0) appear in waves", "[wave]")
|
||||
{
|
||||
const GameConfig cfg = loadConfig();
|
||||
Simulation sim(cfg, 42);
|
||||
Simulation sim(loadConfig(), 42);
|
||||
|
||||
// Run long enough for several waves.
|
||||
const int limit = static_cast<int>(secondsToTicks(120.0));
|
||||
@@ -251,8 +244,7 @@ TEST_CASE("WaveSystem: only eligible ships (cost > 0) appear in waves", "[wave]"
|
||||
|
||||
TEST_CASE("WaveSystem: destroying both enemy stations triggers a push", "[wave]")
|
||||
{
|
||||
const GameConfig cfg = loadConfig();
|
||||
Simulation sim(cfg, 42);
|
||||
Simulation sim(loadConfig(), 42);
|
||||
|
||||
// Damage both enemy stations to 0.
|
||||
sim.buildings().forEachBuilding([](Building& b)
|
||||
@@ -276,8 +268,7 @@ TEST_CASE("WaveSystem: destroying both enemy stations triggers a push", "[wave]"
|
||||
|
||||
TEST_CASE("WaveSystem: push emits exactly one BlueprintDropEvent", "[wave]")
|
||||
{
|
||||
const GameConfig cfg = loadConfig();
|
||||
Simulation sim(cfg, 42);
|
||||
Simulation sim(loadConfig(), 42);
|
||||
|
||||
sim.buildings().forEachBuilding([](Building& b)
|
||||
{
|
||||
@@ -295,8 +286,7 @@ TEST_CASE("WaveSystem: push emits exactly one BlueprintDropEvent", "[wave]")
|
||||
|
||||
TEST_CASE("WaveSystem: push blueprint drop awards a known ship id", "[wave]")
|
||||
{
|
||||
const GameConfig cfg = loadConfig();
|
||||
Simulation sim(cfg, 42);
|
||||
Simulation sim(loadConfig(), 42);
|
||||
|
||||
sim.buildings().forEachBuilding([](Building& b)
|
||||
{
|
||||
@@ -311,7 +301,7 @@ TEST_CASE("WaveSystem: push blueprint drop awards a known ship id", "[wave]")
|
||||
REQUIRE(events.size() == 1);
|
||||
|
||||
bool validId = false;
|
||||
for (const ShipDef& def : cfg.ships.ships)
|
||||
for (const ShipDef& def : sim.config().ships.ships)
|
||||
{
|
||||
if (def.id == events[0].blueprintId)
|
||||
{
|
||||
@@ -325,8 +315,7 @@ TEST_CASE("WaveSystem: push blueprint drop awards a known ship id", "[wave]")
|
||||
|
||||
TEST_CASE("WaveSystem: push places new enemy stations further right", "[wave]")
|
||||
{
|
||||
const GameConfig cfg = loadConfig();
|
||||
Simulation sim(cfg, 42);
|
||||
Simulation sim(loadConfig(), 42);
|
||||
|
||||
// Record the X position of the initial enemy stations.
|
||||
int initialX = std::numeric_limits<int>::min();
|
||||
|
||||
Reference in New Issue
Block a user