CreatureLib/tests/LibraryTests/CreatureTests.cpp

49 lines
1.7 KiB
C++
Raw Normal View History

2019-10-06 11:50:52 +00:00
#ifdef TESTS_BUILD
#include "../../extern/catch.hpp"
#include "../../src/Battling/Models/CreateCreature.hpp"
#include "../TestLibrary/TestLibrary.hpp"
2019-10-06 11:50:52 +00:00
using namespace CreatureLib::Library;
TEST_CASE("Create basic creature", "[Library]") {
auto library = TestLibrary::Get();
2019-10-06 11:50:52 +00:00
auto creature = CreateCreature(library, "testSpecies1", 1).Create();
delete creature;
}
TEST_CASE("Get creature species", "[Library]") {
auto library = TestLibrary::Get();
2019-10-06 11:50:52 +00:00
auto creature = CreateCreature(library, "testSpecies1", 1).Create();
REQUIRE(creature->GetSpecies()->GetName() == "testSpecies1"_cnc);
2019-10-06 11:50:52 +00:00
delete creature;
}
TEST_CASE("Get creature level", "[Library]") {
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;
}
TEST_CASE("Get creature variant when unset", "[Library]") {
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;
}
TEST_CASE("Get creature nickname when unset", "[Library]") {
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;
}
TEST_CASE("Increase creature stat boost", "[Library]") {
auto library = TestLibrary::Get();
auto creature = CreateCreature(library, "testSpecies1", 1).Create();
creature->ChangeStatBoost(CreatureLib::Library::Statistic::PhysicalAttack, 6);
REQUIRE(creature->GetStatBoost(CreatureLib::Library::Statistic::PhysicalAttack) == 6);
delete creature;
}
2019-10-06 11:50:52 +00:00
#endif