Compare commits

..
Author SHA1 Message Date
admin 58910afa1c Use pre-increment in library tests 2026-06-23 13:11:57 -07:00
4 changed files with 13 additions and 13 deletions
@@ -120,7 +120,7 @@ TEST_F(ShardokMCTSAITest, SearchDoesNotCrash) {
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(net::eagle0::shardok::storage::fb::GameStatus_::State_GAME_RUNNING);
@@ -188,7 +188,7 @@ TEST_F(ShardokMCTSAITest, PrefersArcheryOverEndTurn) {
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(net::eagle0::shardok::storage::fb::GameStatus_::State_GAME_RUNNING);
@@ -344,7 +344,7 @@ TEST_F(ShardokMCTSAITest, PrefersArcheryOverEndTurnWithZeroFlips) {
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(net::eagle0::shardok::storage::fb::GameStatus_::State_GAME_RUNNING);
@@ -453,7 +453,7 @@ TEST_F(ShardokMCTSAITest, ArcheryThenEndTurnScoresBetterThanEndTurnAlone) {
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(net::eagle0::shardok::storage::fb::GameStatus_::State_GAME_RUNNING);
@@ -638,7 +638,7 @@ TEST_F(ShardokMCTSAITest, MinimaxOpponentDamageLowersLookahead) {
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(net::eagle0::shardok::storage::fb::GameStatus_::State_GAME_RUNNING);
@@ -842,7 +842,7 @@ TEST_F(ShardokMCTSAITest, DoesNotPreferStartFireWhenNotBeneficial) {
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(net::eagle0::shardok::storage::fb::GameStatus_::State_GAME_RUNNING);
@@ -1041,7 +1041,7 @@ TEST_F(ShardokMCTSAITest, LowProbabilityStartFireWithRain) {
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(net::eagle0::shardok::storage::fb::GameStatus_::State_GAME_RUNNING);
@@ -1190,7 +1190,7 @@ TEST_F(ShardokMCTSAITest, DemonstrateStartFireCostBenefitImbalance) {
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(net::eagle0::shardok::storage::fb::GameStatus_::State_GAME_RUNNING);
@@ -1385,7 +1385,7 @@ TEST_F(ShardokMCTSAITest, InvestigateStartFireVsEndTurnScoring) {
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(net::eagle0::shardok::storage::fb::GameStatus_::State_GAME_RUNNING);
@@ -67,7 +67,7 @@ void EXPECT_CONTAINS(const VecT& vec, const T& obj) {
template<class VecT, class F>
auto CHECK_NOCONTAINS_WHERE(const VecT& vec, F where) -> bool {
for (size_t i = 0; i < vec.size(); i++) {
for (size_t i = 0; i < vec.size(); ++i) {
if (where(vec[i])) {
std::cout << "Found at index " << i << '\n';
return false;
@@ -18,7 +18,7 @@ TEST(PercentileRollOddsTests, singleStat_returnsExpected) {
const std::vector<double> expectedBonuses =
{-25.0, -12.8, -3.125, -0.2, 0.0, 0.2, 3.125, 12.8, 25.0, 28.1216};
for (size_t i = 0; i < stats.size(); i++) {
for (size_t i = 0; i < stats.size(); ++i) {
EXPECT_DOUBLE_EQ(expectedBonuses[i], BonusFromStat(stats[i]));
}
}
@@ -85,7 +85,7 @@ TEST_F(UnitTests, giveCasualties_raisesMorale) {
}
TEST_F(UnitTests, Vigor_changesActionPoints) {
for (int i = 1; i < 100; i++) {
for (int i = 1; i < 100; ++i) {
Unit ui1 = GetUnitT1();
ui1.mutable_attached_hero().mutate_vigor(i);
ui1.mutable_battalion().mutate_morale(50);
@@ -115,7 +115,7 @@ TEST_F(UnitTests, MaxVigor_elevenActionPoints) {
}
TEST_F(UnitTests, Morale_changesActionPoints) {
for (int i = 1; i < 100; i++) {
for (int i = 1; i < 100; ++i) {
Unit ui1 = GetUnitT1();
ui1.mutable_attached_hero().mutate_vigor(50);
ui1.mutable_battalion().mutate_morale(i);