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();
|
2020-02-27 17:59:15 +00:00
|
|
|
lib->Insert("foo"_cnc,
|
2019-12-29 14:29:52 +00:00
|
|
|
new PkmnLib::Library::PokemonSpecies(
|
2020-02-27 17:59:15 +00:00
|
|
|
1, "foo"_cnc,
|
2019-12-29 14:29:52 +00:00
|
|
|
new PkmnLib::Library::PokemonForme(
|
2020-02-28 18:51:50 +00:00
|
|
|
"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), {"testAbility"_cnc},
|
2020-02-28 18:51:50 +00:00
|
|
|
{"testHiddenAbility"_cnc}, new CreatureLib::Library::LearnableAttacks(100)),
|
2020-02-27 17:59:15 +00:00
|
|
|
0.5f, "testGrowthRate"_cnc, 100, 100));
|
2019-12-29 14:29:52 +00:00
|
|
|
delete lib;
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST_CASE("Able to insert and retrieve from library", "library") {
|
|
|
|
auto lib = new PkmnLib::Library::SpeciesLibrary();
|
2020-02-27 17:59:15 +00:00
|
|
|
lib->Insert("foo"_cnc,
|
2019-12-29 14:29:52 +00:00
|
|
|
new PkmnLib::Library::PokemonSpecies(
|
2020-02-27 17:59:15 +00:00
|
|
|
1, "foo"_cnc,
|
2019-12-29 14:29:52 +00:00
|
|
|
new PkmnLib::Library::PokemonForme(
|
2020-02-28 18:51:50 +00:00
|
|
|
"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), {"testAbility"_cnc},
|
2020-02-28 18:51:50 +00:00
|
|
|
{"testHiddenAbility"_cnc}, new CreatureLib::Library::LearnableAttacks(100)),
|
2020-02-27 17:59:15 +00:00
|
|
|
0.5f, "testGrowthRate"_cnc, 100, 100));
|
|
|
|
auto val = lib->Get("foo"_cnc);
|
2019-12-29 14:29:52 +00:00
|
|
|
REQUIRE(val->GetName() == "foo");
|
|
|
|
delete lib;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|