Fixes memory leak in unit tests
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
2123a01151
commit
75d6100689
|
@ -8,29 +8,30 @@ using namespace PkmnLib::Battling;
|
||||||
|
|
||||||
TEST_CASE("Correct rounding for damage.") {
|
TEST_CASE("Correct rounding for damage.") {
|
||||||
auto lib = TestLibrary::GetLibrary();
|
auto lib = TestLibrary::GetLibrary();
|
||||||
auto mon1 = CreatePokemon(lib, "testCharizard"_cnc, 100)
|
auto mon1 = ArbUt::ScopedPtr(CreatePokemon(lib, "testCharizard"_cnc, 100)
|
||||||
.WithIndividualValues(31, 31, 31, 31, 31, 31)
|
.WithIndividualValues(31, 31, 31, 31, 31, 31)
|
||||||
.WithEffortValues(0, 0, 0, 0, 0, 0)
|
.WithEffortValues(0, 0, 0, 0, 0, 0)
|
||||||
.WithNature("neutralNature"_cnc)
|
.WithNature("neutralNature"_cnc)
|
||||||
.WithGender(CreatureLib::Library::Gender::Male)
|
.WithGender(CreatureLib::Library::Gender::Male)
|
||||||
.IsAllowedExperienceGain(false)
|
.IsAllowedExperienceGain(false)
|
||||||
.Build();
|
.Build());
|
||||||
auto mon2 = CreatePokemon(lib, "testVenusaur"_cnc, 100)
|
auto mon2 = ArbUt::ScopedPtr(CreatePokemon(lib, "testVenusaur"_cnc, 100)
|
||||||
.WithIndividualValues(31, 31, 31, 31, 31, 31)
|
.WithIndividualValues(31, 31, 31, 31, 31, 31)
|
||||||
.WithEffortValues(0, 0, 0, 0, 0, 0)
|
.WithEffortValues(0, 0, 0, 0, 0, 0)
|
||||||
.WithNature("neutralNature"_cnc)
|
.WithNature("neutralNature"_cnc)
|
||||||
.WithGender(CreatureLib::Library::Gender::Male)
|
.WithGender(CreatureLib::Library::Gender::Male)
|
||||||
.IsAllowedExperienceGain(false)
|
.IsAllowedExperienceGain(false)
|
||||||
.Build();
|
.Build());
|
||||||
|
|
||||||
auto move = PkmnLib::Library::MoveData("test", 0, PkmnLib::Library::MoveCategory::Physical, 55, 100, 10,
|
auto move = PkmnLib::Library::MoveData("test", 0, PkmnLib::Library::MoveCategory::Physical, 55, 100, 10,
|
||||||
CreatureLib::Library::AttackTarget::All, 0, nullptr, {});
|
CreatureLib::Library::AttackTarget::All, 0, nullptr, {});
|
||||||
|
|
||||||
auto attack = PkmnLib::Battling::LearnedMove(&move, CreatureLib::Battling::AttackLearnMethod::Unknown);
|
auto attack = PkmnLib::Battling::LearnedMove(&move, CreatureLib::Battling::AttackLearnMethod::Unknown);
|
||||||
|
|
||||||
auto executingAttack = CreatureLib::Battling::ExecutingAttack({mon2}, 1, mon1, &attack, &move, nullptr);
|
auto executingAttack =
|
||||||
|
CreatureLib::Battling::ExecutingAttack({mon2.GetValue()}, 1, mon1.GetValue(), &attack, &move, nullptr);
|
||||||
|
|
||||||
auto hit = executingAttack.GetHitData(mon2, 0);
|
auto hit = executingAttack.GetHitData(mon2.GetValue(), 0);
|
||||||
hit.SetBasePower(55);
|
hit.SetBasePower(55);
|
||||||
hit.SetEffectiveness(2.0f);
|
hit.SetEffectiveness(2.0f);
|
||||||
hit.SetCritical(0);
|
hit.SetCritical(0);
|
||||||
|
|
Loading…
Reference in New Issue