Initial support for ordering choices and getting them ready for execution.
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
26
tests/BattleTests/TurnOrderTests.cpp
Normal file
26
tests/BattleTests/TurnOrderTests.cpp
Normal file
@@ -0,0 +1,26 @@
|
||||
#ifdef TESTS_BUILD
|
||||
|
||||
#include "../TestLibrary/TestLibrary.cpp"
|
||||
#include "../../src/Battling/TurnChoices/PassTurnChoice.hpp"
|
||||
#include "../../src/Battling/TurnChoices/AttackTurnChoice.hpp"
|
||||
#include "../../src/Battling/Flow/TurnOrdering.hpp"
|
||||
|
||||
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);
|
||||
CHECK(vec[0] == choice2);
|
||||
CHECK(vec[1] == choice1);
|
||||
vec = std::vector<const BaseTurnChoice*>{choice2, choice1};
|
||||
TurnOrdering::OrderChoices(vec);
|
||||
CHECK(vec[0] == choice2);
|
||||
CHECK(vec[1] == choice1);
|
||||
|
||||
delete choice1;
|
||||
delete choice2;
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user