More defensive programming.
Some checks failed
continuous-integration/drone/push Build is failing

Signed-off-by: Deukhoofd <Deukhoofd@gmail.com>
This commit is contained in:
2020-08-30 13:14:33 +02:00
parent 32f75f4a47
commit 3233daf9ab
5 changed files with 60 additions and 25 deletions

View File

@@ -17,11 +17,11 @@ TEST_CASE("Turn ordering: Attack before pass", "[Battling]") {
auto choice2 = std::make_shared<AttackTurnChoice>(nullptr, &learnedAttack, CreatureIndex(0, 0));
auto vec = std::vector<std::shared_ptr<BaseTurnChoice>>{choice1, choice2};
auto rand = ArbUt::Random();
TurnOrdering::OrderChoices(vec, rand);
TurnOrdering::OrderChoices(vec);
CHECK(vec[0] == choice2);
CHECK(vec[1] == choice1);
vec = std::vector<std::shared_ptr<BaseTurnChoice>>{choice2, choice1};
TurnOrdering::OrderChoices(vec, rand);
TurnOrdering::OrderChoices(vec);
CHECK(vec[0] == choice2);
CHECK(vec[1] == choice1);
}
@@ -34,11 +34,11 @@ TEST_CASE("Turn ordering: High priority goes before no priority", "[Battling]")
auto choice2 = std::make_shared<AttackTurnChoice>(nullptr, a2, CreatureIndex(0, 0));
auto vec = std::vector<std::shared_ptr<BaseTurnChoice>>{choice1, choice2};
auto rand = ArbUt::Random();
TurnOrdering::OrderChoices(vec, rand);
TurnOrdering::OrderChoices(vec);
CHECK(vec[0] == choice2);
CHECK(vec[1] == choice1);
vec = std::vector<std::shared_ptr<BaseTurnChoice>>{choice2, choice1};
TurnOrdering::OrderChoices(vec, rand);
TurnOrdering::OrderChoices(vec);
CHECK(vec[0] == choice2);
CHECK(vec[1] == choice1);
@@ -54,11 +54,11 @@ TEST_CASE("Turn ordering: Higher priority goes before high priority", "[Battling
auto choice2 = std::make_shared<AttackTurnChoice>(nullptr, a2, CreatureIndex(0, 0));
auto vec = std::vector<std::shared_ptr<BaseTurnChoice>>{choice1, choice2};
auto rand = ArbUt::Random();
TurnOrdering::OrderChoices(vec, rand);
TurnOrdering::OrderChoices(vec);
CHECK(vec[0] == choice2);
CHECK(vec[1] == choice1);
vec = std::vector<std::shared_ptr<BaseTurnChoice>>{choice2, choice1};
TurnOrdering::OrderChoices(vec, rand);
TurnOrdering::OrderChoices(vec);
CHECK(vec[0] == choice2);
CHECK(vec[1] == choice1);
delete a1;
@@ -73,11 +73,11 @@ TEST_CASE("Turn ordering: High priority goes before low priority", "[Battling]")
auto choice2 = std::make_shared<AttackTurnChoice>(nullptr, a2, CreatureIndex(0, 0));
auto vec = std::vector<std::shared_ptr<BaseTurnChoice>>{choice1, choice2};
auto rand = ArbUt::Random();
TurnOrdering::OrderChoices(vec, rand);
TurnOrdering::OrderChoices(vec);
CHECK(vec[0] == choice2);
CHECK(vec[1] == choice1);
vec = std::vector<std::shared_ptr<BaseTurnChoice>>{choice2, choice1};
TurnOrdering::OrderChoices(vec, rand);
TurnOrdering::OrderChoices(vec);
CHECK(vec[0] == choice2);
CHECK(vec[1] == choice1);
@@ -93,11 +93,11 @@ TEST_CASE("Turn ordering: No priority goes before low priority", "[Battling]") {
auto choice2 = std::make_shared<AttackTurnChoice>(nullptr, a2, CreatureIndex(0, 0));
auto vec = std::vector<std::shared_ptr<BaseTurnChoice>>{choice1, choice2};
auto rand = ArbUt::Random();
TurnOrdering::OrderChoices(vec, rand);
TurnOrdering::OrderChoices(vec);
CHECK(vec[0] == choice2);
CHECK(vec[1] == choice1);
vec = std::vector<std::shared_ptr<BaseTurnChoice>>{choice2, choice1};
TurnOrdering::OrderChoices(vec, rand);
TurnOrdering::OrderChoices(vec);
CHECK(vec[0] == choice2);
CHECK(vec[1] == choice1);