2019-10-29 10:19:25 +00:00
|
|
|
#ifdef TESTS_BUILD
|
|
|
|
|
|
|
|
#include "../TestLibrary/TestLibrary.cpp"
|
|
|
|
#include "../../src/Battling/Models/BattleSide.hpp"
|
|
|
|
#include "../../src/Battling/Models/CreateCreature.hpp"
|
|
|
|
#include "../../src/Battling/TurnChoices/PassTurnChoice.hpp"
|
|
|
|
|
|
|
|
using namespace CreatureLib::Battling;
|
|
|
|
|
|
|
|
TEST_CASE( "Set Choice one-sized side", "[Battling]" ) {
|
2019-11-10 13:32:05 +00:00
|
|
|
auto side = BattleSide(nullptr, 1);
|
2019-10-29 10:19:25 +00:00
|
|
|
auto c = CreateCreature(GetLibrary(), "testSpecies1", 5).Create();
|
|
|
|
side.SetCreature(c, 0);
|
|
|
|
auto choice = new PassTurnChoice(c);
|
|
|
|
side.SetChoice(choice);
|
|
|
|
delete choice;
|
|
|
|
delete c;
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST_CASE( "Set Choice one-sized side, validate all choices set", "[Battling]" ) {
|
2019-11-10 13:32:05 +00:00
|
|
|
auto side = BattleSide(nullptr, 1);
|
2019-10-29 10:19:25 +00:00
|
|
|
auto c = CreateCreature(GetLibrary(), "testSpecies1", 5).Create();
|
|
|
|
side.SetCreature(c, 0);
|
|
|
|
auto choice = new PassTurnChoice(c);
|
|
|
|
REQUIRE_FALSE(side.AllChoicesSet());
|
|
|
|
side.SetChoice(choice);
|
|
|
|
REQUIRE(side.AllChoicesSet());
|
|
|
|
delete choice;
|
|
|
|
delete c;
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST_CASE( "Set Choice two-sized side", "[Battling]" ) {
|
2019-11-10 13:32:05 +00:00
|
|
|
auto side = BattleSide(nullptr, 2);
|
2019-10-29 10:19:25 +00:00
|
|
|
auto c1 = CreateCreature(GetLibrary(), "testSpecies1", 5).Create();
|
|
|
|
auto c2 = CreateCreature(GetLibrary(), "testSpecies1", 5).Create();
|
|
|
|
side.SetCreature(c1, 0);
|
|
|
|
side.SetCreature(c2, 1);
|
|
|
|
auto choice1 = new PassTurnChoice(c1);
|
|
|
|
auto choice2 = new PassTurnChoice(c2);
|
|
|
|
side.SetChoice(choice1);
|
|
|
|
side.SetChoice(choice2);
|
|
|
|
delete choice1;
|
|
|
|
delete choice2;
|
|
|
|
delete c1;
|
|
|
|
delete c2;
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST_CASE( "Set Choice two-sized side, validate all choices set", "[Battling]" ) {
|
2019-11-10 13:32:05 +00:00
|
|
|
auto side = BattleSide(nullptr, 2);
|
2019-10-29 10:19:25 +00:00
|
|
|
auto c1 = CreateCreature(GetLibrary(), "testSpecies1", 5).Create();
|
|
|
|
auto c2 = CreateCreature(GetLibrary(), "testSpecies1", 5).Create();
|
|
|
|
side.SetCreature(c1, 0);
|
|
|
|
side.SetCreature(c2, 1);
|
|
|
|
auto choice1 = new PassTurnChoice(c1);
|
|
|
|
auto choice2 = new PassTurnChoice(c2);
|
|
|
|
REQUIRE_FALSE(side.AllChoicesSet());
|
|
|
|
side.SetChoice(choice1);
|
|
|
|
REQUIRE_FALSE(side.AllChoicesSet());
|
|
|
|
side.SetChoice(choice2);
|
|
|
|
REQUIRE(side.AllChoicesSet());
|
|
|
|
delete choice1;
|
|
|
|
delete choice2;
|
|
|
|
delete c1;
|
|
|
|
delete c2;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|