Compare commits

..
Author SHA1 Message Date
admin bfc32e8068 Use direct vector declarations in library tests 2026-06-23 12:56:41 -07:00
10 changed files with 16 additions and 16 deletions
@@ -49,7 +49,7 @@ auto AddPlayerInfo(
-> flatbuffers::Offset<net::eagle0::shardok::storage::fb::PlayerInfo> {
const auto victoryConditionsOffset = fbb.CreateVector(victoryConditions);
std::vector<net::eagle0::shardok::storage::fb::AlliedPlayer> alliesVec;
auto alliesVec = std::vector<net::eagle0::shardok::storage::fb::AlliedPlayer>();
for (int pid : allyPids) { alliesVec.emplace_back(pid); }
const auto alliesOffset = fbb.CreateVectorOfStructs(alliesVec);
@@ -87,7 +87,7 @@ static auto GameWithUnitTs(
endGameCondition.mutate_victory_details(
net::eagle0::shardok::storage::fb::VictoryCondition_UNKNOWN_VICTORY_CONDITION);
std::vector<PlayerId> winningIdsVec{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1};
auto winningIdsVec = std::vector<PlayerId>{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1};
auto winningIdsOff = fbb.CreateVector(winningIdsVec);
auto statusB = net::eagle0::shardok::storage::fb::GameStatusBuilder(fbb);
statusB.add_state(
@@ -32,7 +32,7 @@ TEST_F(ZoneOfControlCalculatorTests, AttackOrientation_noAlliesPresent_isFrontal
auto attOff = AddGenericUnit(0, 0, Coords(2, 2));
auto defOff = AddGenericUnit(1, 1, Coords(2, 1));
auto unitsVec = std::vector<Unit>{attOff, defOff};
std::vector<Unit> unitsVec{attOff, defOff};
auto unitsOff = fbb.CreateVectorOfSortedStructs(&unitsVec);
fbb.Finish(unitsOff);
@@ -57,7 +57,7 @@ TEST_F(ZoneOfControlCalculatorTests, AttackOrientation_alliesNotFlanking_isFront
auto allyOff = AddGenericUnit(0, 1, Coords(1, 1));
auto defOff = AddGenericUnit(1, 2, Coords(2, 1));
auto unitsVec = std::vector<Unit>{attOff, allyOff, defOff};
std::vector<Unit> unitsVec{attOff, allyOff, defOff};
auto unitsOff = fbb.CreateVectorOfSortedStructs(&unitsVec);
fbb.Finish(unitsOff);
@@ -85,7 +85,7 @@ TEST_F(ZoneOfControlCalculatorTests, AttackOrientation_flankingLeft_isFlanking)
auto allyOff = AddGenericUnit(0, 1, Coords(3, 0));
auto defOff = AddGenericUnit(1, 2, Coords(2, 1));
auto unitsVec = std::vector<Unit>{attOff, allyOff, defOff};
std::vector<Unit> unitsVec{attOff, allyOff, defOff};
auto unitsOff = fbb.CreateVectorOfSortedStructs(&unitsVec);
fbb.Finish(unitsOff);
@@ -113,7 +113,7 @@ TEST_F(ZoneOfControlCalculatorTests, AttackOrientation_flankingRight_isFlanking)
auto allyOff = AddGenericUnit(0, 1, Coords(1, 0));
auto defOff = AddGenericUnit(1, 2, Coords(2, 1));
auto unitsVec = std::vector<Unit>{attOff, allyOff, defOff};
std::vector<Unit> unitsVec{attOff, allyOff, defOff};
auto unitsOff = fbb.CreateVectorOfSortedStructs(&unitsVec);
fbb.Finish(unitsOff);
@@ -141,7 +141,7 @@ TEST_F(ZoneOfControlCalculatorTests, AttackOrientation_rear_isRear) {
auto allyOff = AddGenericUnit(0, 1, Coords(2, 0));
auto defOff = AddGenericUnit(1, 2, Coords(2, 1));
auto unitsVec = std::vector<Unit>{attOff, allyOff, defOff};
std::vector<Unit> unitsVec{attOff, allyOff, defOff};
auto unitsOff = fbb.CreateVectorOfSortedStructs(&unitsVec);
fbb.Finish(unitsOff);
@@ -179,7 +179,7 @@ TEST_F(ZoneOfControlCalculatorTests, LowMorale_doesntExertZoc) {
auto allyOff = AddGenericUnit(0, 1, Coords(3, 0));
auto defOff = AddGenericUnit(1, 2, Coords(2, 1));
auto unitsVec = std::vector<Unit>{attOff, allyOff, defOff};
std::vector<Unit> unitsVec{attOff, allyOff, defOff};
auto unitsOff = fbb.CreateVectorOfSortedStructs(&unitsVec);
fbb.Finish(unitsOff);
@@ -22,7 +22,7 @@ private:
auto attacker1Off = AddGenericUnit(0, 0, reserveLocation);
auto attacker2Off = AddGenericUnit(0, 1, reserveLocation);
auto defenderOff = AddGenericUnit(1, 2, reserveLocation);
auto vec = std::vector<Unit>{attacker1Off, attacker2Off, defenderOff};
std::vector<Unit> vec{attacker1Off, attacker2Off, defenderOff};
auto unitsOff = fbb.CreateVectorOfSortedStructs(&vec);
auto hexMap = AddHexMap(fbb, MAP_WITH_STARTING_POSITIONS_FB);
@@ -24,7 +24,7 @@ class ActionResultApplierTest : public ::testing::Test {
auto undeadOffset = AddGenericUndead(0, 1, Coords(-1, -1));
auto unit2Offset = AddGenericUnit(0, 2, Coords(4, 4));
auto unitsVec = std::vector<Unit>{unit1Offset, undeadOffset, unit2Offset};
std::vector<Unit> unitsVec{unit1Offset, undeadOffset, unit2Offset};
auto unitsOffset = fbb.CreateVectorOfSortedStructs(&unitsVec);
std::vector<UnitId> possibleChargees(8, -1);
@@ -26,7 +26,7 @@ class BraveWaterCommandFactoryTest : public ::testing::Test {
fbb.ForceDefaults(true);
auto actorOffset = AddGenericUnit(1, 0, position);
auto unitsVec = std::vector<Unit>{actorOffset};
std::vector<Unit> unitsVec{actorOffset};
auto unitsOffset = fbb.CreateVectorOfSortedStructs(&unitsVec);
fbb.Finish(unitsOffset);
@@ -114,7 +114,7 @@ TEST_F(BraveWaterCommandFactoryTest, cannotBraveIntoAnotherUnit) {
auto actorOffset = AddGenericUnit(1, 0, position);
auto anotherOffset = AddGenericUnit(0, 1, Coords(4, 2));
auto unitsVec = std::vector<Unit>{actorOffset, anotherOffset};
std::vector<Unit> unitsVec{actorOffset, anotherOffset};
auto unitsOffset = fbb.CreateVectorOfSortedStructs(&unitsVec);
fbb.Finish(unitsOffset);
@@ -19,7 +19,7 @@ class BlowBridgeCommandTest : public ::testing::Test {
flatbuffers::FlatBufferBuilder fbb;
fbb.ForceDefaults(true);
Unit actorUnit = AddGenericUnit(0, 0, bridgePosition);
auto unitsVec = std::vector<Unit>{actorUnit};
std::vector<Unit> unitsVec{actorUnit};
auto unitsOff = fbb.CreateVectorOfSortedStructs(&unitsVec);
GameStateBuilder gsb(fbb);
@@ -19,7 +19,7 @@ class BuildBridgeCommandTest : public ::testing::Test {
flatbuffers::FlatBufferBuilder fbb;
fbb.ForceDefaults(true);
Unit actorUnit = AddGenericUnit(0, 0, Coords(3, 1));
auto unitsVec = std::vector<Unit>{actorUnit};
std::vector<Unit> unitsVec{actorUnit};
auto unitsOff = fbb.CreateVectorOfSortedStructs(&unitsVec);
GameStateBuilder gsb(fbb);
@@ -21,7 +21,7 @@ class FleeCommandTest : public ::testing::Test {
flatbuffers::FlatBufferBuilder fbb;
fbb.ForceDefaults(true);
auto unitOff = AddGenericUnit(0, 0, Coords(3, 3));
auto unitVec = std::vector<Unit>{unitOff};
std::vector<Unit> unitVec{unitOff};
auto unitsOffset = fbb.CreateVectorOfSortedStructs(&unitVec);
GameStateBuilder gsb(fbb);
@@ -32,7 +32,7 @@ class HexMapUtilsTest : public ::testing::Test {
auto enemyUnitOffset = AddGenericUnit(enemyPlayerId, 2, Coords(1, 1));
auto hiddenEnemyOffset = AddGenericUnit(enemyPlayerId, 3, Coords(1, 2));
std::vector<Unit> unitsVec{
auto unitsVec = std::vector<Unit>{
ownUnitOffset,
alliedUnitOffset,
enemyUnitOffset,