2019-12-29 14:29:52 +00:00
|
|
|
#ifdef TESTS_BUILD
|
|
|
|
#include "../../extern/catch.hpp"
|
|
|
|
#include "../../src/Library/Species/PokemonSpecies.hpp"
|
|
|
|
|
|
|
|
TEST_CASE("Able to create and destroy species", "library") {
|
|
|
|
auto species = new PkmnLib::Library::PokemonSpecies(
|
2020-02-27 17:59:15 +00:00
|
|
|
1, "foo"_cnc,
|
2020-02-28 18:51:50 +00:00
|
|
|
new PkmnLib::Library::PokemonForme("default"_cnc, 1.0f, 1.0f, 100, {0},
|
2020-04-06 18:03:44 +00:00
|
|
|
CreatureLib::Library::StatisticSet<uint16_t>(100, 100, 100, 100, 100, 100),
|
2020-02-28 18:51:50 +00:00
|
|
|
{"testAbility"_cnc}, {"testHiddenAbility"_cnc},
|
|
|
|
new CreatureLib::Library::LearnableAttacks(100)),
|
2020-08-08 16:41:27 +00:00
|
|
|
0.5f, "testGrowthRate"_cnc, 100, 100, {"testEggGroup"_cnc});
|
2019-12-29 14:29:52 +00:00
|
|
|
delete species;
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST_CASE("Able to get default forme", "library") {
|
|
|
|
auto species = new PkmnLib::Library::PokemonSpecies(
|
2020-02-27 17:59:15 +00:00
|
|
|
1, "foo"_cnc,
|
2020-02-28 18:51:50 +00:00
|
|
|
new PkmnLib::Library::PokemonForme("default"_cnc, 1.0f, 1.0f, 100, {0},
|
2020-04-06 18:03:44 +00:00
|
|
|
CreatureLib::Library::StatisticSet<uint16_t>(100, 100, 100, 100, 100, 100),
|
2020-02-28 18:51:50 +00:00
|
|
|
{"testAbility"_cnc}, {"testHiddenAbility"_cnc},
|
|
|
|
new CreatureLib::Library::LearnableAttacks(100)),
|
2020-08-08 16:41:27 +00:00
|
|
|
0.5f, "testGrowthRate"_cnc, 100, 100, {"testEggGroup"_cnc});
|
2019-12-29 14:29:52 +00:00
|
|
|
|
|
|
|
auto forme = species->GetDefaultForme();
|
|
|
|
REQUIRE(forme != nullptr);
|
|
|
|
|
|
|
|
delete species;
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST_CASE("Able to get default forme name", "library") {
|
|
|
|
auto species = new PkmnLib::Library::PokemonSpecies(
|
2020-02-27 17:59:15 +00:00
|
|
|
1, "foo"_cnc,
|
2020-02-28 18:51:50 +00:00
|
|
|
new PkmnLib::Library::PokemonForme("default"_cnc, 1.0f, 1.0f, 100, {0},
|
2020-04-06 18:03:44 +00:00
|
|
|
CreatureLib::Library::StatisticSet<uint16_t>(100, 100, 100, 100, 100, 100),
|
2020-02-28 18:51:50 +00:00
|
|
|
{"testAbility"_cnc}, {"testHiddenAbility"_cnc},
|
|
|
|
new CreatureLib::Library::LearnableAttacks(100)),
|
2020-08-08 16:41:27 +00:00
|
|
|
0.5f, "testGrowthRate"_cnc, 100, 100, {"testEggGroup"_cnc});
|
2019-12-29 14:29:52 +00:00
|
|
|
|
|
|
|
auto forme = species->GetDefaultForme();
|
|
|
|
REQUIRE(forme != nullptr);
|
|
|
|
REQUIRE(forme->GetName() == "default");
|
|
|
|
|
|
|
|
delete species;
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST_CASE("Able to get species name", "library") {
|
|
|
|
auto species = new PkmnLib::Library::PokemonSpecies(
|
2020-02-27 17:59:15 +00:00
|
|
|
1, "foo"_cnc,
|
2020-02-28 18:51:50 +00:00
|
|
|
new PkmnLib::Library::PokemonForme("default"_cnc, 1.0f, 1.0f, 100, {0},
|
2020-04-06 18:03:44 +00:00
|
|
|
CreatureLib::Library::StatisticSet<uint16_t>(100, 100, 100, 100, 100, 100),
|
2020-02-28 18:51:50 +00:00
|
|
|
{"testAbility"_cnc}, {"testHiddenAbility"_cnc},
|
|
|
|
new CreatureLib::Library::LearnableAttacks(100)),
|
2020-08-08 16:41:27 +00:00
|
|
|
0.5f, "testGrowthRate"_cnc, 100, 100, {"testEggGroup"_cnc});
|
2019-12-29 14:29:52 +00:00
|
|
|
|
|
|
|
REQUIRE(species->GetName() == "foo");
|
|
|
|
|
|
|
|
delete species;
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST_CASE("Able to get species id", "library") {
|
|
|
|
auto species = new PkmnLib::Library::PokemonSpecies(
|
2020-02-27 17:59:15 +00:00
|
|
|
1, "foo"_cnc,
|
2020-02-28 18:51:50 +00:00
|
|
|
new PkmnLib::Library::PokemonForme("default"_cnc, 1.0f, 1.0f, 100, {0},
|
2020-04-06 18:03:44 +00:00
|
|
|
CreatureLib::Library::StatisticSet<uint16_t>(100, 100, 100, 100, 100, 100),
|
2020-02-28 18:51:50 +00:00
|
|
|
{"testAbility"_cnc}, {"testHiddenAbility"_cnc},
|
|
|
|
new CreatureLib::Library::LearnableAttacks(100)),
|
2020-08-08 16:41:27 +00:00
|
|
|
0.5f, "testGrowthRate"_cnc, 100, 100, {"testEggGroup"_cnc});
|
2019-12-29 14:29:52 +00:00
|
|
|
|
|
|
|
REQUIRE(species->GetId() == 1);
|
|
|
|
|
|
|
|
delete species;
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST_CASE("Able to get species gender ratio", "library") {
|
|
|
|
auto species = new PkmnLib::Library::PokemonSpecies(
|
2020-02-27 17:59:15 +00:00
|
|
|
1, "foo"_cnc,
|
2020-02-28 18:51:50 +00:00
|
|
|
new PkmnLib::Library::PokemonForme("default"_cnc, 1.0f, 1.0f, 100, {0},
|
2020-04-06 18:03:44 +00:00
|
|
|
CreatureLib::Library::StatisticSet<uint16_t>(100, 100, 100, 100, 100, 100),
|
2020-02-28 18:51:50 +00:00
|
|
|
{"testAbility"_cnc}, {"testHiddenAbility"_cnc},
|
|
|
|
new CreatureLib::Library::LearnableAttacks(100)),
|
2020-08-08 16:41:27 +00:00
|
|
|
0.5f, "testGrowthRate"_cnc, 100, 100, {"testEggGroup"_cnc});
|
2019-12-29 14:29:52 +00:00
|
|
|
|
|
|
|
REQUIRE(species->GetGenderRate() == 0.5f);
|
|
|
|
|
|
|
|
delete species;
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST_CASE("Able to get species growth rate", "library") {
|
|
|
|
auto species = new PkmnLib::Library::PokemonSpecies(
|
2020-02-27 17:59:15 +00:00
|
|
|
1, "foo"_cnc,
|
2020-02-28 18:51:50 +00:00
|
|
|
new PkmnLib::Library::PokemonForme("default"_cnc, 1.0f, 1.0f, 100, {0},
|
2020-04-06 18:03:44 +00:00
|
|
|
CreatureLib::Library::StatisticSet<uint16_t>(100, 100, 100, 100, 100, 100),
|
2020-02-28 18:51:50 +00:00
|
|
|
{"testAbility"_cnc}, {"testHiddenAbility"_cnc},
|
|
|
|
new CreatureLib::Library::LearnableAttacks(100)),
|
2020-08-08 16:41:27 +00:00
|
|
|
0.5f, "testGrowthRate"_cnc, 100, 100, {"testEggGroup"_cnc});
|
2019-12-29 14:29:52 +00:00
|
|
|
|
|
|
|
REQUIRE(species->GetGrowthRate() == "testGrowthRate");
|
|
|
|
|
|
|
|
delete species;
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST_CASE("Able to get species capture rate", "library") {
|
|
|
|
auto species = new PkmnLib::Library::PokemonSpecies(
|
2020-02-27 17:59:15 +00:00
|
|
|
1, "foo"_cnc,
|
2020-02-28 18:51:50 +00:00
|
|
|
new PkmnLib::Library::PokemonForme("default"_cnc, 1.0f, 1.0f, 100, {0},
|
2020-04-06 18:03:44 +00:00
|
|
|
CreatureLib::Library::StatisticSet<uint16_t>(100, 100, 100, 100, 100, 100),
|
2020-02-28 18:51:50 +00:00
|
|
|
{"testAbility"_cnc}, {"testHiddenAbility"_cnc},
|
|
|
|
new CreatureLib::Library::LearnableAttacks(100)),
|
2020-08-08 16:41:27 +00:00
|
|
|
0.5f, "testGrowthRate"_cnc, 100, 100, {"testEggGroup"_cnc});
|
2019-12-29 14:29:52 +00:00
|
|
|
|
|
|
|
REQUIRE(species->GetCaptureRate() == 100);
|
|
|
|
|
|
|
|
delete species;
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST_CASE("Able to get species base happiness", "library") {
|
|
|
|
auto species = new PkmnLib::Library::PokemonSpecies(
|
2020-02-27 17:59:15 +00:00
|
|
|
1, "foo"_cnc,
|
2020-02-28 18:51:50 +00:00
|
|
|
new PkmnLib::Library::PokemonForme("default"_cnc, 1.0f, 1.0f, 100, {0},
|
2020-04-06 18:03:44 +00:00
|
|
|
CreatureLib::Library::StatisticSet<uint16_t>(100, 100, 100, 100, 100, 100),
|
2020-02-28 18:51:50 +00:00
|
|
|
{"testAbility"_cnc}, {"testHiddenAbility"_cnc},
|
|
|
|
new CreatureLib::Library::LearnableAttacks(100)),
|
2020-08-08 16:41:27 +00:00
|
|
|
0.5f, "testGrowthRate"_cnc, 100, 100, {"testEggGroup"_cnc});
|
2019-12-29 14:29:52 +00:00
|
|
|
|
|
|
|
REQUIRE(species->GetBaseHappiness() == 100);
|
|
|
|
|
|
|
|
delete species;
|
|
|
|
}
|
|
|
|
|
2020-01-02 12:45:39 +00:00
|
|
|
TEST_CASE("Able to set and get evolution", "library") {
|
|
|
|
auto species = new PkmnLib::Library::PokemonSpecies(
|
2020-02-27 17:59:15 +00:00
|
|
|
1, "foo"_cnc,
|
2020-02-28 18:51:50 +00:00
|
|
|
new PkmnLib::Library::PokemonForme("default"_cnc, 1.0f, 1.0f, 100, {0},
|
2020-04-06 18:03:44 +00:00
|
|
|
CreatureLib::Library::StatisticSet<uint16_t>(100, 100, 100, 100, 100, 100),
|
2020-02-28 18:51:50 +00:00
|
|
|
{"testAbility"_cnc}, {"testHiddenAbility"_cnc},
|
|
|
|
new CreatureLib::Library::LearnableAttacks(100)),
|
2020-08-08 16:41:27 +00:00
|
|
|
0.5f, "testGrowthRate"_cnc, 100, 100, {"testEggGroup"_cnc});
|
2020-01-02 12:45:39 +00:00
|
|
|
auto species2 = new PkmnLib::Library::PokemonSpecies(
|
2020-02-27 17:59:15 +00:00
|
|
|
2, "bar"_cnc,
|
2020-02-28 18:51:50 +00:00
|
|
|
new PkmnLib::Library::PokemonForme("default"_cnc, 1.0f, 1.0f, 100, {0},
|
2020-04-06 18:03:44 +00:00
|
|
|
CreatureLib::Library::StatisticSet<uint16_t>(100, 100, 100, 100, 100, 100),
|
2020-02-28 18:51:50 +00:00
|
|
|
{"testAbility"_cnc}, {"testHiddenAbility"_cnc},
|
|
|
|
new CreatureLib::Library::LearnableAttacks(100)),
|
2020-08-08 16:41:27 +00:00
|
|
|
0.5f, "testGrowthRate"_cnc, 100, 100, {"testEggGroup"_cnc});
|
2020-01-02 12:45:39 +00:00
|
|
|
|
|
|
|
species->AddEvolution(PkmnLib::Library::EvolutionData::CreateLevelEvolution(16, species2));
|
2020-06-02 18:37:21 +00:00
|
|
|
auto& evolutions = species->GetEvolutions();
|
2020-04-16 13:04:53 +00:00
|
|
|
REQUIRE(evolutions.Count() == 1);
|
2020-01-02 12:45:39 +00:00
|
|
|
auto evo = evolutions[0];
|
2020-04-16 12:25:20 +00:00
|
|
|
CHECK(evo->GetMethod() == PkmnLib::Library::EvolutionMethod::Level);
|
|
|
|
CHECK(evo->GetNewSpecies() == species2);
|
|
|
|
INFO(CreatureLib::Library::EffectParameterTypeHelper::ToString(evo->GetData(0)->GetType()));
|
|
|
|
CHECK(evo->GetData(0)->AsInt() == 16);
|
2020-01-02 12:45:39 +00:00
|
|
|
|
|
|
|
delete species;
|
|
|
|
delete species2;
|
|
|
|
}
|
2019-12-29 14:29:52 +00:00
|
|
|
|
|
|
|
#endif
|