2019-12-31 09:39:20 +00:00
|
|
|
#ifdef TESTS_BUILD
|
2022-02-11 11:17:27 +00:00
|
|
|
#include <doctest.h>
|
2019-12-31 09:39:20 +00:00
|
|
|
#include "../../src/Library/Natures/NatureLibrary.hpp"
|
|
|
|
#include "../../src/Library/Statistic.hpp"
|
|
|
|
|
|
|
|
using namespace PkmnLib::Library;
|
|
|
|
|
2020-09-29 16:04:06 +00:00
|
|
|
TEST_CASE("Able to create and delete nature library") {
|
2019-12-31 09:39:20 +00:00
|
|
|
auto lib = new NatureLibrary();
|
|
|
|
delete lib;
|
|
|
|
}
|
|
|
|
|
2020-09-29 16:04:06 +00:00
|
|
|
TEST_CASE("Able to insert into nature library") {
|
2019-12-31 09:39:20 +00:00
|
|
|
auto lib = new NatureLibrary();
|
2020-04-17 16:39:04 +00:00
|
|
|
lib->LoadNature("testNature"_cnc, new Nature(Statistic::PhysicalAttack, Statistic::Speed));
|
2019-12-31 09:39:20 +00:00
|
|
|
delete lib;
|
|
|
|
}
|
|
|
|
|
2020-09-29 16:04:06 +00:00
|
|
|
TEST_CASE("Able to retrieve nature by name") {
|
2019-12-31 09:39:20 +00:00
|
|
|
auto lib = new NatureLibrary();
|
2020-04-17 16:39:04 +00:00
|
|
|
lib->LoadNature("testNature"_cnc, new Nature(Statistic::PhysicalAttack, Statistic::Speed));
|
2019-12-31 09:39:20 +00:00
|
|
|
|
2020-04-17 16:20:48 +00:00
|
|
|
auto nature = lib->GetNatureByName("testNature"_cnc);
|
2020-04-17 16:39:04 +00:00
|
|
|
REQUIRE(nature->GetIncreasedStat() == Statistic::PhysicalAttack);
|
|
|
|
REQUIRE(nature->GetDecreasedStat() == Statistic::Speed);
|
|
|
|
REQUIRE(nature->GetIncreaseModifier() == 1.1f);
|
|
|
|
REQUIRE(nature->GetDecreaseModifier() == 0.9f);
|
2019-12-31 09:39:20 +00:00
|
|
|
|
|
|
|
delete lib;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|