PkmnLib/tests/PokemonTests/ExperienceGainTests.cpp

19 lines
708 B
C++
Raw Normal View History

2020-05-20 14:05:52 +00:00
#ifdef TESTS_BUILD
#include "../../extern/doctest.hpp"
2020-05-20 14:05:52 +00:00
#include "../../src/Battling/Library/ExperienceLibrary.hpp"
#include "../../src/Battling/Pokemon/CreatePokemon.hpp"
#include "../TestLibrary/TestLibrary.hpp"
using namespace PkmnLib::Battling;
TEST_CASE("Basic Experience gain test") {
2020-05-20 14:05:52 +00:00
auto lib = TestLibrary::GetLibrary();
auto mon1 = CreatePokemon(lib, "testSpecies"_cnc, 55).Build();
auto initialExp = mon1->GetExperience();
auto mon2 = CreatePokemon(lib, "testSpecies2"_cnc, 62).Build();
2020-05-27 15:26:25 +00:00
auto& expLib = lib->GetExperienceLibrary();
2020-05-20 14:05:52 +00:00
expLib->HandleExperienceGain(mon2, {mon1});
REQUIRE(mon1->GetExperience() - initialExp == 4339);
2020-05-20 15:23:25 +00:00
delete mon1;
delete mon2;
2020-05-20 14:05:52 +00:00
}
#endif