2020-08-10 15:37:30 +00:00
|
|
|
#ifdef TESTS_BUILD
|
2020-09-25 10:43:08 +00:00
|
|
|
#include "../../extern/doctest.hpp"
|
2020-08-10 15:37:30 +00:00
|
|
|
#include "../../src/Battling/Models/CreateCreature.hpp"
|
|
|
|
#include "../../src/Battling/Models/CreatureParty.hpp"
|
|
|
|
#include "../TestLibrary/TestLibrary.hpp"
|
|
|
|
|
|
|
|
using namespace CreatureLib::Battling;
|
|
|
|
|
2020-09-25 10:43:08 +00:00
|
|
|
TEST_CASE("Pack party tests with single creature") {
|
2020-08-10 15:37:30 +00:00
|
|
|
auto library = TestLibrary::Get();
|
|
|
|
auto creature = CreateCreature(library, "testSpecies1"_cnc, 1).Create();
|
|
|
|
auto party = CreatureParty(6);
|
|
|
|
party.SwapInto(1, creature);
|
|
|
|
REQUIRE(party.GetAtIndex(1) == creature);
|
|
|
|
party.PackParty();
|
|
|
|
REQUIRE(party.GetAtIndex(0) == creature);
|
|
|
|
REQUIRE(party.GetAtIndex(1) == nullptr);
|
|
|
|
|
|
|
|
party.Switch(0, 5);
|
|
|
|
REQUIRE(party.GetAtIndex(0) == nullptr);
|
|
|
|
REQUIRE(party.GetAtIndex(5) == creature);
|
|
|
|
party.PackParty();
|
|
|
|
REQUIRE(party.GetAtIndex(0) == creature);
|
|
|
|
REQUIRE(party.GetAtIndex(1) == nullptr);
|
|
|
|
REQUIRE(party.GetAtIndex(2) == nullptr);
|
|
|
|
REQUIRE(party.GetAtIndex(3) == nullptr);
|
|
|
|
REQUIRE(party.GetAtIndex(4) == nullptr);
|
|
|
|
REQUIRE(party.GetAtIndex(5) == nullptr);
|
|
|
|
}
|
|
|
|
|
2020-09-25 10:43:08 +00:00
|
|
|
TEST_CASE("Pack party tests with two creatures") {
|
2020-08-10 15:37:30 +00:00
|
|
|
auto library = TestLibrary::Get();
|
|
|
|
auto creature1 = CreateCreature(library, "testSpecies1"_cnc, 1).Create();
|
|
|
|
auto creature2 = CreateCreature(library, "testSpecies1"_cnc, 1).Create();
|
|
|
|
auto party = CreatureParty(6);
|
|
|
|
party.SwapInto(1, creature1);
|
|
|
|
party.SwapInto(5, creature2);
|
|
|
|
|
|
|
|
REQUIRE(party.GetAtIndex(1) == creature1);
|
|
|
|
REQUIRE(party.GetAtIndex(5) == creature2);
|
|
|
|
party.PackParty();
|
|
|
|
REQUIRE(party.GetAtIndex(0) == creature1);
|
|
|
|
REQUIRE(party.GetAtIndex(1) == creature2);
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|