#ifdef TESTS_BUILD #include "../../extern/doctest.hpp" #include "../../src/Library/Species/PokemonSpecies.hpp" TEST_CASE("Able to create and destroy species") { auto species = new PkmnLib::Library::PokemonSpecies( 1, "foo"_cnc, new PkmnLib::Library::PokemonForme("default"_cnc, 1.0f, 1.0f, 100, {0}, CreatureLib::Library::StatisticSet(100, 100, 100, 100, 100, 100), {"testAbility"_cnc}, {"testHiddenAbility"_cnc}, new PkmnLib::Library::LearnableMoves(100)), 0.5f, "testGrowthRate"_cnc, 100, 100, {"testEggGroup"_cnc}); delete species; } TEST_CASE("Able to get default forme") { auto species = new PkmnLib::Library::PokemonSpecies( 1, "foo"_cnc, new PkmnLib::Library::PokemonForme("default"_cnc, 1.0f, 1.0f, 100, {0}, CreatureLib::Library::StatisticSet(100, 100, 100, 100, 100, 100), {"testAbility"_cnc}, {"testHiddenAbility"_cnc}, new PkmnLib::Library::LearnableMoves(100)), 0.5f, "testGrowthRate"_cnc, 100, 100, {"testEggGroup"_cnc}); [[maybe_unused]] auto forme = species->GetDefaultForme(); delete species; } TEST_CASE("Able to get default forme name") { auto species = new PkmnLib::Library::PokemonSpecies( 1, "foo"_cnc, new PkmnLib::Library::PokemonForme("default"_cnc, 1.0f, 1.0f, 100, {0}, CreatureLib::Library::StatisticSet(100, 100, 100, 100, 100, 100), {"testAbility"_cnc}, {"testHiddenAbility"_cnc}, new PkmnLib::Library::LearnableMoves(100)), 0.5f, "testGrowthRate"_cnc, 100, 100, {"testEggGroup"_cnc}); auto forme = species->GetDefaultForme(); REQUIRE(forme->GetName() == "default"); delete species; } TEST_CASE("Able to get species name") { auto species = new PkmnLib::Library::PokemonSpecies( 1, "foo"_cnc, new PkmnLib::Library::PokemonForme("default"_cnc, 1.0f, 1.0f, 100, {0}, CreatureLib::Library::StatisticSet(100, 100, 100, 100, 100, 100), {"testAbility"_cnc}, {"testHiddenAbility"_cnc}, new PkmnLib::Library::LearnableMoves(100)), 0.5f, "testGrowthRate"_cnc, 100, 100, {"testEggGroup"_cnc}); REQUIRE(species->GetName() == "foo"); delete species; } TEST_CASE("Able to get species id") { auto species = new PkmnLib::Library::PokemonSpecies( 1, "foo"_cnc, new PkmnLib::Library::PokemonForme("default"_cnc, 1.0f, 1.0f, 100, {0}, CreatureLib::Library::StatisticSet(100, 100, 100, 100, 100, 100), {"testAbility"_cnc}, {"testHiddenAbility"_cnc}, new PkmnLib::Library::LearnableMoves(100)), 0.5f, "testGrowthRate"_cnc, 100, 100, {"testEggGroup"_cnc}); REQUIRE(species->GetId() == 1); delete species; } TEST_CASE("Able to get species gender ratio") { auto species = new PkmnLib::Library::PokemonSpecies( 1, "foo"_cnc, new PkmnLib::Library::PokemonForme("default"_cnc, 1.0f, 1.0f, 100, {0}, CreatureLib::Library::StatisticSet(100, 100, 100, 100, 100, 100), {"testAbility"_cnc}, {"testHiddenAbility"_cnc}, new PkmnLib::Library::LearnableMoves(100)), 0.5f, "testGrowthRate"_cnc, 100, 100, {"testEggGroup"_cnc}); REQUIRE(species->GetGenderRate() == 0.5f); delete species; } TEST_CASE("Able to get species growth rate") { auto species = new PkmnLib::Library::PokemonSpecies( 1, "foo"_cnc, new PkmnLib::Library::PokemonForme("default"_cnc, 1.0f, 1.0f, 100, {0}, CreatureLib::Library::StatisticSet(100, 100, 100, 100, 100, 100), {"testAbility"_cnc}, {"testHiddenAbility"_cnc}, new PkmnLib::Library::LearnableMoves(100)), 0.5f, "testGrowthRate"_cnc, 100, 100, {"testEggGroup"_cnc}); REQUIRE(species->GetGrowthRate() == "testGrowthRate"); delete species; } TEST_CASE("Able to get species capture rate") { auto species = new PkmnLib::Library::PokemonSpecies( 1, "foo"_cnc, new PkmnLib::Library::PokemonForme("default"_cnc, 1.0f, 1.0f, 100, {0}, CreatureLib::Library::StatisticSet(100, 100, 100, 100, 100, 100), {"testAbility"_cnc}, {"testHiddenAbility"_cnc}, new PkmnLib::Library::LearnableMoves(100)), 0.5f, "testGrowthRate"_cnc, 100, 100, {"testEggGroup"_cnc}); REQUIRE(species->GetCaptureRate() == 100); delete species; } TEST_CASE("Able to get species base happiness") { auto species = new PkmnLib::Library::PokemonSpecies( 1, "foo"_cnc, new PkmnLib::Library::PokemonForme("default"_cnc, 1.0f, 1.0f, 100, {0}, CreatureLib::Library::StatisticSet(100, 100, 100, 100, 100, 100), {"testAbility"_cnc}, {"testHiddenAbility"_cnc}, new PkmnLib::Library::LearnableMoves(100)), 0.5f, "testGrowthRate"_cnc, 100, 100, {"testEggGroup"_cnc}); REQUIRE(species->GetBaseHappiness() == 100); delete species; } TEST_CASE("Able to set and get evolution") { auto species = new PkmnLib::Library::PokemonSpecies( 1, "foo"_cnc, new PkmnLib::Library::PokemonForme("default"_cnc, 1.0f, 1.0f, 100, {0}, CreatureLib::Library::StatisticSet(100, 100, 100, 100, 100, 100), {"testAbility"_cnc}, {"testHiddenAbility"_cnc}, new PkmnLib::Library::LearnableMoves(100)), 0.5f, "testGrowthRate"_cnc, 100, 100, {"testEggGroup"_cnc}); auto species2 = new PkmnLib::Library::PokemonSpecies( 2, "bar"_cnc, new PkmnLib::Library::PokemonForme("default"_cnc, 1.0f, 1.0f, 100, {0}, CreatureLib::Library::StatisticSet(100, 100, 100, 100, 100, 100), {"testAbility"_cnc}, {"testHiddenAbility"_cnc}, new PkmnLib::Library::LearnableMoves(100)), 0.5f, "testGrowthRate"_cnc, 100, 100, {"testEggGroup"_cnc}); species->AddEvolution(PkmnLib::Library::EvolutionData::CreateLevelEvolution(16, species2)); auto& evolutions = species->GetEvolutions(); REQUIRE(evolutions.Count() == 1); auto evo = evolutions[0]; CHECK(evo->GetMethod() == PkmnLib::Library::EvolutionMethod::Level); CHECK(evo->GetNewSpecies() == species2); INFO(CreatureLib::Library::EffectParameterTypeHelper::ToString(evo->GetDataAt(0)->GetType())); CHECK(evo->GetDataAt(0)->AsInt() == 16); delete species; delete species2; } #endif