Compare commits

..
Author SHA1 Message Date
admin 580828a97c Use direct vector declarations in AI tests 2026-06-23 12:46:57 -07:00
6 changed files with 21 additions and 21 deletions
@@ -23,7 +23,7 @@ class AIAttackGroupsTest : public ::testing::Test {
flatbuffers::FlatBufferBuilder fbb;
fbb.ForceDefaults(true);
auto unitsVec = std::vector<Unit>{
std::vector<Unit> unitsVec{
AddGenericUnit(0, 0, Coords(0, 0)),
AddGenericUnit(0, 1, Coords(0, 1)),
AddGenericUnit(0, 2, Coords(5, 0)),
@@ -287,4 +287,4 @@ TEST_F(AIAttackGroupsTest, targetPriorities_assignHighestPowerFirst) {
.target = Coords(0, 5),
.attackLocations = upperRightAttackLocations}}),
tpls[2].priorityOrder);
}
}
@@ -20,7 +20,7 @@ class AIAttackerStrategySelectorTest : public ::testing::Test {
flatbuffers::FlatBufferBuilder fbb;
fbb.ForceDefaults(true);
auto unitsVec = std::vector<Unit>{
std::vector<Unit> unitsVec{
AddGenericUnit(0, 0, Coords(5, 0)),
AddGenericUnit(0, 1, Coords(4, 0)),
AddGenericUnit(0, 2, Coords(5, 5)),
@@ -21,7 +21,7 @@ class AIStrategySelectorTest : public ::testing::Test {
flatbuffers::FlatBufferBuilder fbb;
fbb.ForceDefaults(true);
auto unitsVec = std::vector<Unit>{
std::vector<Unit> unitsVec{
AddGenericUnit(0, 0, Coords(5, 0)),
AddGenericUnit(0, 1, Coords(4, 0)),
AddGenericUnit(0, 2, Coords(5, 5)),
@@ -291,4 +291,4 @@ TEST_F(AIStrategySelectorTest,
return GetGameSettings()->GetGetter().GetBattalionType(typeId);
})
.strategyType);
}
}
@@ -17,7 +17,7 @@ class AIScoreUtilitiesTest : public ::testing::Test {
flatbuffers::FlatBufferBuilder fbb;
fbb.ForceDefaults(true);
auto unitsVec = std::vector<Unit>{
std::vector<Unit> unitsVec{
AddGenericUnit(0, 0, Coords(5, 0)),
AddGenericUnit(0, 1, Coords(4, 0)),
AddGenericUnit(0, 2, Coords(5, 5)),
@@ -26,7 +26,7 @@ class AIWaterCrossingCalculatorTest : public ::testing::Test {
flatbuffers::FlatBufferBuilder fbb;
fbb.ForceDefaults(true);
auto unitsVec = std::vector<Unit>{
std::vector<Unit> unitsVec{
AddGenericUnit(0, 0, Coords(5, 0)),
AddGenericUnit(0, 1, Coords(4, 0))};
@@ -157,7 +157,7 @@ TEST_F(MeleeActionTests, Execute_givesDamageBasedOnBattalionTypeInfo) {
PercentileRollOdds ambushOdds = MakeOdds(0);
std::vector<double> rolls{ambushRoll, attackerRoll, defenderRoll};
auto rolls = std::vector<double>{ambushRoll, attackerRoll, defenderRoll};
auto generator = SequenceRandomGenerator::WithSequence(rolls);
for (int size = 0; size <= 1000; size += 100) {
@@ -205,7 +205,7 @@ TEST_F(MeleeActionTests, Execute_givesDamageBasedOnBattalionTypeInfo) {
}
TEST_F(MeleeActionTests, Execute_normalPlayers_increasesOpponentKnowledge) {
const std::vector<double> rolls{0, 50, 50};
const auto rolls = std::vector<double>{0, 50, 50};
const auto generator = SequenceRandomGenerator::WithSequence(rolls);
attacker->mutable_opponent_knowledge()->Mutate(1, 51);
@@ -238,7 +238,7 @@ TEST_F(MeleeActionTests, Execute_normalPlayers_increasesOpponentKnowledge) {
}
TEST_F(MeleeActionTests, Execute_lledUnit_increasesOpponentKnowledge) {
const std::vector<double> rolls{0.0, 0.50, 0.50};
const auto rolls = std::vector<double>{0.0, 0.50, 0.50};
const auto generator = SequenceRandomGenerator::WithSequence(rolls);
attacker->mutable_opponent_knowledge()->Mutate(1, 51);
@@ -272,7 +272,7 @@ TEST_F(MeleeActionTests, Execute_lledUnit_increasesOpponentKnowledge) {
}
TEST_F(MeleeActionTests, Execute_givesAttackerStrengthXp) {
const std::vector<double> rolls{0.0, 0.50, 0.50};
const auto rolls = std::vector<double>{0.0, 0.50, 0.50};
const auto generator = SequenceRandomGenerator::WithSequence(rolls);
attackerWithHero->mutable_attached_hero().mutate_strength_xp(57);
@@ -297,7 +297,7 @@ TEST_F(MeleeActionTests, Execute_givesAttackerStrengthXp) {
}
TEST_F(MeleeActionTests, Execute_givesDefenderStrengthXp) {
const std::vector<double> rolls{0.0, 0.50, 0.50};
const auto rolls = std::vector<double>{0.0, 0.50, 0.50};
const auto generator = SequenceRandomGenerator::WithSequence(rolls);
defenderWithHero->mutable_attached_hero().mutate_strength_xp(12);
@@ -322,7 +322,7 @@ TEST_F(MeleeActionTests, Execute_givesDefenderStrengthXp) {
}
TEST_F(MeleeActionTests, ExecuteWithOutAmbush_givesNoAttackerAgilityXp) {
const std::vector<double> rolls{0.0, 0.50, 0.50};
const auto rolls = std::vector<double>{0.0, 0.50, 0.50};
const auto generator = SequenceRandomGenerator::WithSequence(rolls);
attackerWithHero->mutable_attached_hero().mutate_agility_xp(88);
@@ -347,7 +347,7 @@ TEST_F(MeleeActionTests, ExecuteWithOutAmbush_givesNoAttackerAgilityXp) {
}
TEST_F(MeleeActionTests, ExecuteWithAmbush_givesAttackerAgilityXp) {
const std::vector<double> rolls{0.0, 0.50, 0.50};
const auto rolls = std::vector<double>{0.0, 0.50, 0.50};
const auto generator = SequenceRandomGenerator::WithSequence(rolls);
attackerWithHero->mutate_hidden(true);
@@ -373,7 +373,7 @@ TEST_F(MeleeActionTests, ExecuteWithAmbush_givesAttackerAgilityXp) {
}
TEST_F(MeleeActionTests, Execute_hiddenAttacker_unhides) {
const std::vector<double> rolls{0.0, 0.50, 0.50};
const auto rolls = std::vector<double>{0.0, 0.50, 0.50};
const auto generator = SequenceRandomGenerator::WithSequence(rolls);
attackerWithHero->mutate_hidden(true);
@@ -398,7 +398,7 @@ TEST_F(MeleeActionTests, Execute_hiddenAttacker_unhides) {
}
TEST_F(MeleeActionTests, Execute_hiddenAttackerLowRoll_ambushes) {
const std::vector<double> rolls{0.25, 0.50, 0.50};
const auto rolls = std::vector<double>{0.25, 0.50, 0.50};
const auto generator = SequenceRandomGenerator::WithSequence(rolls);
attackerWithHero->mutate_hidden(true);
@@ -419,7 +419,7 @@ TEST_F(MeleeActionTests, Execute_hiddenAttackerLowRoll_ambushes) {
}
TEST_F(MeleeActionTests, Execute_hiddenAttackerLowRoll_intoCastle_noAmbush) {
const std::vector<double> rolls{0.25, 0.50, 0.50};
const auto rolls = std::vector<double>{0.25, 0.50, 0.50};
const auto generator = SequenceRandomGenerator::WithSequence(rolls);
attacker->mutate_hidden(true);
@@ -444,7 +444,7 @@ TEST_F(MeleeActionTests, Execute_hiddenAttackerLowRoll_intoCastle_noAmbush) {
}
TEST_F(MeleeActionTests, Execute_hiddenAttackerLowRoll_stunsDefender) {
const std::vector<double> rolls{0.25, 0.50, 0.50};
const auto rolls = std::vector<double>{0.25, 0.50, 0.50};
const auto generator = SequenceRandomGenerator::WithSequence(rolls);
attacker->mutate_hidden(true);
@@ -467,7 +467,7 @@ TEST_F(MeleeActionTests, Execute_hiddenAttackerLowRoll_stunsDefender) {
}
TEST_F(MeleeActionTests, Execute_hiddenAttackerHighRoll_noAmbush) {
const std::vector<double> rolls{0.75, 0.50, 0.50};
const auto rolls = std::vector<double>{0.75, 0.50, 0.50};
const auto generator = SequenceRandomGenerator::WithSequence(rolls);
attacker->mutate_hidden(true);
@@ -491,7 +491,7 @@ TEST_F(MeleeActionTests, Execute_hiddenAttackerHighRoll_noAmbush) {
}
TEST_F(MeleeActionTests, Execute_onStunnedDefender_doesMoreDamage) {
std::vector<double> rolls{0.75, 0.50, 0.50};
auto rolls = std::vector<double>{0.75, 0.50, 0.50};
auto generator = SequenceRandomGenerator::WithSequence(rolls);
GetGameSettingsSetter().SetDouble(kSettingsKeys.damageReceivedMultiplierFromStun, 1.25);
@@ -533,7 +533,7 @@ TEST_F(MeleeActionTests, Execute_onStunnedDefender_doesMoreDamage) {
}
TEST_F(MeleeActionTests, Execute_onFortifiedDefender_doesLessDamage) {
std::vector<double> rolls{0.75, 0.50, 0.50};
auto rolls = std::vector<double>{0.75, 0.50, 0.50};
auto generator = SequenceRandomGenerator::WithSequence(rolls);
GetGameSettingsSetter().SetDouble(kSettingsKeys.fortifyDamageTakenMultiplier, 0.9);