2019-10-06 11:50:52 +00:00
|
|
|
#ifdef TESTS_BUILD
|
2019-12-07 12:45:44 +00:00
|
|
|
#include "../../extern/catch.hpp"
|
2019-10-24 11:37:55 +00:00
|
|
|
#include "../../src/Battling/Models/CreateCreature.hpp"
|
2019-12-07 12:45:44 +00:00
|
|
|
#include "../TestLibrary/TestLibrary.hpp"
|
2019-10-06 11:50:52 +00:00
|
|
|
|
|
|
|
using namespace CreatureLib::Library;
|
2019-11-28 11:55:22 +00:00
|
|
|
TEST_CASE("Create basic creature", "[Library]") {
|
2019-12-07 12:45:44 +00:00
|
|
|
auto library = TestLibrary::Get();
|
2019-10-06 11:50:52 +00:00
|
|
|
auto creature = CreateCreature(library, "testSpecies1", 1).Create();
|
|
|
|
delete creature;
|
|
|
|
}
|
|
|
|
|
2019-11-28 11:55:22 +00:00
|
|
|
TEST_CASE("Get creature species", "[Library]") {
|
2019-12-07 12:45:44 +00:00
|
|
|
auto library = TestLibrary::Get();
|
2019-10-06 11:50:52 +00:00
|
|
|
auto creature = CreateCreature(library, "testSpecies1", 1).Create();
|
|
|
|
REQUIRE(creature->GetSpecies()->GetName() == "testSpecies1");
|
|
|
|
delete creature;
|
|
|
|
}
|
|
|
|
|
2019-11-28 11:55:22 +00:00
|
|
|
TEST_CASE("Get creature level", "[Library]") {
|
2019-12-07 12:45:44 +00:00
|
|
|
auto library = TestLibrary::Get();
|
2019-10-06 11:50:52 +00:00
|
|
|
auto creature = CreateCreature(library, "testSpecies1", 1).Create();
|
|
|
|
REQUIRE(creature->GetLevel() == 1);
|
|
|
|
delete creature;
|
|
|
|
}
|
|
|
|
|
2019-11-28 11:55:22 +00:00
|
|
|
TEST_CASE("Get creature variant when unset", "[Library]") {
|
2019-12-07 12:45:44 +00:00
|
|
|
auto library = TestLibrary::Get();
|
2019-10-06 11:50:52 +00:00
|
|
|
auto creature = CreateCreature(library, "testSpecies1", 1).Create();
|
|
|
|
REQUIRE(creature->GetVariant()->GetName() == "default");
|
|
|
|
delete creature;
|
|
|
|
}
|
|
|
|
|
2019-11-28 11:55:22 +00:00
|
|
|
TEST_CASE("Get creature nickname when unset", "[Library]") {
|
2019-12-07 12:45:44 +00:00
|
|
|
auto library = TestLibrary::Get();
|
2019-10-06 11:50:52 +00:00
|
|
|
auto creature = CreateCreature(library, "testSpecies1", 1).Create();
|
|
|
|
REQUIRE(creature->GetNickname() == "testSpecies1");
|
|
|
|
delete creature;
|
|
|
|
}
|
|
|
|
|
2019-11-28 11:55:22 +00:00
|
|
|
TEST_CASE("Get creature stat potentials when unset", "[Library]") {
|
2019-12-07 12:45:44 +00:00
|
|
|
auto library = TestLibrary::Get();
|
2019-10-06 11:50:52 +00:00
|
|
|
auto creature = CreateCreature(library, "testSpecies1", 1).Create();
|
|
|
|
auto potentials = creature->GetStatPotential();
|
|
|
|
REQUIRE(potentials.GetHealth() == 0);
|
|
|
|
REQUIRE(potentials.GetPhysicalAttack() == 0);
|
|
|
|
REQUIRE(potentials.GetPhysicalDefense() == 0);
|
|
|
|
REQUIRE(potentials.GetMagicalAttack() == 0);
|
|
|
|
REQUIRE(potentials.GetMagicalDefense() == 0);
|
|
|
|
REQUIRE(potentials.GetSpeed() == 0);
|
|
|
|
delete creature;
|
|
|
|
}
|
|
|
|
|
2019-11-28 11:55:22 +00:00
|
|
|
TEST_CASE("Get creature stat experience when unset", "[Library]") {
|
2019-12-07 12:45:44 +00:00
|
|
|
auto library = TestLibrary::Get();
|
2019-10-06 11:50:52 +00:00
|
|
|
auto creature = CreateCreature(library, "testSpecies1", 1).Create();
|
|
|
|
auto experiences = creature->GetStatExperience();
|
|
|
|
REQUIRE(experiences.GetHealth() == 0);
|
|
|
|
REQUIRE(experiences.GetPhysicalAttack() == 0);
|
|
|
|
REQUIRE(experiences.GetPhysicalDefense() == 0);
|
|
|
|
REQUIRE(experiences.GetMagicalAttack() == 0);
|
|
|
|
REQUIRE(experiences.GetMagicalDefense() == 0);
|
|
|
|
REQUIRE(experiences.GetSpeed() == 0);
|
|
|
|
delete creature;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|