CreatureLib/tests/BattleTests/CreatureTests.cpp

57 lines
1.9 KiB
C++
Raw Normal View History

2019-10-06 11:50:52 +00:00
#ifdef TESTS_BUILD
#include "../../extern/doctest.hpp"
#include "../../src/Battling/Models/CreateCreature.hpp"
#include "../TestLibrary/TestLibrary.hpp"
2019-10-06 11:50:52 +00:00
2020-04-10 18:09:15 +00:00
using namespace CreatureLib::Battling;
TEST_CASE("Create basic creature") {
auto library = TestLibrary::Get();
auto creature = CreateCreature(library, "testSpecies1"_cnc, 1).Create();
2019-10-06 11:50:52 +00:00
delete creature;
}
TEST_CASE("Get creature species") {
auto library = TestLibrary::Get();
auto creature = CreateCreature(library, "testSpecies1"_cnc, 1).Create();
REQUIRE(creature->GetSpecies()->GetName() == "testSpecies1"_cnc);
2019-10-06 11:50:52 +00:00
delete creature;
}
TEST_CASE("Get creature level") {
auto library = TestLibrary::Get();
auto creature = CreateCreature(library, "testSpecies1"_cnc, 1).Create();
2019-10-06 11:50:52 +00:00
REQUIRE(creature->GetLevel() == 1);
delete creature;
}
TEST_CASE("Get creature variant when unset") {
auto library = TestLibrary::Get();
auto creature = CreateCreature(library, "testSpecies1"_cnc, 1).Create();
2019-10-06 11:50:52 +00:00
REQUIRE(creature->GetVariant()->GetName() == "default");
delete creature;
}
TEST_CASE("Get creature nickname when unset") {
auto library = TestLibrary::Get();
auto creature = CreateCreature(library, "testSpecies1"_cnc, 1).WithNickname("foo").Create();
REQUIRE(creature->GetNickname() == "foo");
2019-10-06 11:50:52 +00:00
delete creature;
}
TEST_CASE("Increase creature stat boost") {
auto library = TestLibrary::Get();
auto creature = CreateCreature(library, "testSpecies1"_cnc, 1).Create();
creature->ChangeStatBoost(CreatureLib::Library::Statistic::PhysicalAttack, 6);
REQUIRE(creature->GetStatBoost(CreatureLib::Library::Statistic::PhysicalAttack) == 6);
delete creature;
}
TEST_CASE("Override Creature talent") {
2020-08-01 08:27:46 +00:00
auto library = TestLibrary::Get();
auto creature = CreateCreature(library, "testSpecies1"_cnc, 1).Create();
creature->OverrideActiveTalent("foobar");
REQUIRE(creature->GetActiveTalent() == "foobar");
delete creature;
}
2019-10-06 11:50:52 +00:00
#endif