PkmnLib/tests/LibraryTests/NatureLibraryTests.cpp

32 lines
1000 B
C++

#ifdef TESTS_BUILD
#include "../../extern/doctest.hpp"
#include "../../src/Library/Natures/NatureLibrary.hpp"
#include "../../src/Library/Statistic.hpp"
using namespace PkmnLib::Library;
TEST_CASE("Able to create and delete nature library") {
auto lib = new NatureLibrary();
delete lib;
}
TEST_CASE("Able to insert into nature library") {
auto lib = new NatureLibrary();
lib->LoadNature("testNature"_cnc, new Nature(Statistic::PhysicalAttack, Statistic::Speed));
delete lib;
}
TEST_CASE("Able to retrieve nature by name") {
auto lib = new NatureLibrary();
lib->LoadNature("testNature"_cnc, new Nature(Statistic::PhysicalAttack, Statistic::Speed));
auto nature = lib->GetNatureByName("testNature"_cnc);
REQUIRE(nature->GetIncreasedStat() == Statistic::PhysicalAttack);
REQUIRE(nature->GetDecreasedStat() == Statistic::Speed);
REQUIRE(nature->GetIncreaseModifier() == 1.1f);
REQUIRE(nature->GetDecreaseModifier() == 0.9f);
delete lib;
}
#endif