Fully handle turn ordering
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2019-10-31 12:31:31 +01:00
parent 972af35ecf
commit 42c1623985
6 changed files with 43 additions and 10 deletions

View File

@@ -5,17 +5,19 @@
#include "../../src/Battling/TurnChoices/AttackTurnChoice.hpp"
#include "../../src/Battling/Flow/TurnOrdering.hpp"
using namespace CreatureLib;
using namespace CreatureLib::Battling;
TEST_CASE( "Turn ordering: Attack before pass", "[Battling]" ) {
auto choice1 = new PassTurnChoice(nullptr);
auto choice2 = new AttackTurnChoice(nullptr, nullptr);
auto vec = std::vector<const BaseTurnChoice*>{choice1, choice2};
TurnOrdering::OrderChoices(vec);
auto rand = Core::Random();
TurnOrdering::OrderChoices(vec,rand);
CHECK(vec[0] == choice2);
CHECK(vec[1] == choice1);
vec = std::vector<const BaseTurnChoice*>{choice2, choice1};
TurnOrdering::OrderChoices(vec);
TurnOrdering::OrderChoices(vec,rand);
CHECK(vec[0] == choice2);
CHECK(vec[1] == choice1);