2019-12-29 14:29:52 +00:00
|
|
|
#ifdef TESTS_BUILD
|
|
|
|
#define CATCH_CONFIG_MAIN
|
|
|
|
#include "../../extern/catch.hpp"
|
|
|
|
#include "../../src/Library/Species/SpeciesLibrary.hpp"
|
|
|
|
|
|
|
|
TEST_CASE("Able to build and destroy empty library", "library") {
|
|
|
|
auto lib = new PkmnLib::Library::SpeciesLibrary();
|
|
|
|
delete lib;
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST_CASE("Able to build, destroy and insert library", "library") {
|
|
|
|
auto lib = new PkmnLib::Library::SpeciesLibrary();
|
|
|
|
lib->LoadSpecies("foo",
|
|
|
|
new PkmnLib::Library::PokemonSpecies(
|
|
|
|
1, "foo",
|
|
|
|
new PkmnLib::Library::PokemonForme(
|
|
|
|
"default", 1.0f, 1.0f, 100, {0},
|
|
|
|
CreatureLib::Core::StatisticSet<uint16_t>(100, 100, 100, 100, 100, 100), {"testAbility"},
|
|
|
|
{"testHiddenAbility"}, new CreatureLib::Library::LearnableAttacks(100)),
|
|
|
|
0.5f, "testGrowthRate", 100, 100));
|
|
|
|
delete lib;
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST_CASE("Able to insert and retrieve from library", "library") {
|
|
|
|
auto lib = new PkmnLib::Library::SpeciesLibrary();
|
|
|
|
lib->LoadSpecies("foo",
|
|
|
|
new PkmnLib::Library::PokemonSpecies(
|
|
|
|
1, "foo",
|
|
|
|
new PkmnLib::Library::PokemonForme(
|
|
|
|
"default", 1.0f, 1.0f, 100, {0},
|
|
|
|
CreatureLib::Core::StatisticSet<uint16_t>(100, 100, 100, 100, 100, 100), {"testAbility"},
|
|
|
|
{"testHiddenAbility"}, new CreatureLib::Library::LearnableAttacks(100)),
|
|
|
|
0.5f, "testGrowthRate", 100, 100));
|
2019-12-31 12:51:42 +00:00
|
|
|
auto val = lib->GetPkmnSpecies("foo");
|
2019-12-29 14:29:52 +00:00
|
|
|
REQUIRE(val->GetName() == "foo");
|
|
|
|
delete lib;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|