PkmnLib/tests/LibraryTests/NatureLibraryTests.cpp

32 lines
1.0 KiB
C++

#ifdef TESTS_BUILD
#include "../../extern/catch.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", "library") {
auto lib = new NatureLibrary();
delete lib;
}
TEST_CASE("Able to insert into nature library", "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", "library") {
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