Support for packing party.
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
Signed-off-by: Deukhoofd <Deukhoofd@gmail.com>
This commit is contained in:
46
tests/BattleTests/CreaturePartyTests.cpp
Normal file
46
tests/BattleTests/CreaturePartyTests.cpp
Normal file
@@ -0,0 +1,46 @@
|
||||
#ifdef TESTS_BUILD
|
||||
#include "../../extern/catch.hpp"
|
||||
#include "../../src/Battling/Models/CreateCreature.hpp"
|
||||
#include "../../src/Battling/Models/CreatureParty.hpp"
|
||||
#include "../TestLibrary/TestLibrary.hpp"
|
||||
|
||||
using namespace CreatureLib::Battling;
|
||||
|
||||
TEST_CASE("Pack party tests with single creature", "[Library]") {
|
||||
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);
|
||||
}
|
||||
|
||||
TEST_CASE("Pack party tests with two creatures", "[Library]") {
|
||||
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
|
||||
Reference in New Issue
Block a user