PkmnLib/tests/LibraryTests/SpeciesLibraryTests.cpp

39 lines
1.7 KiB
C++
Raw Normal View History

2019-12-29 14:29:52 +00:00
#ifdef TESTS_BUILD
#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN
#include "../../extern/doctest.hpp"
2019-12-29 14:29:52 +00:00
#include "../../src/Library/Species/SpeciesLibrary.hpp"
TEST_CASE("Able to build and destroy empty library") {
2019-12-29 14:29:52 +00:00
auto lib = new PkmnLib::Library::SpeciesLibrary();
delete lib;
}
TEST_CASE("Able to build, destroy and insert library") {
2019-12-29 14:29:52 +00:00
auto lib = new PkmnLib::Library::SpeciesLibrary();
2020-08-30 11:53:15 +00:00
lib->Insert("foo"_cnc.GetHash(),
2020-04-28 12:48:56 +00:00
new PkmnLib::Library::PokemonSpecies(
1, "foo"_cnc,
new PkmnLib::Library::PokemonForme(
"default"_cnc, 1.0f, 1.0f, 100, {0},
CreatureLib::Library::StatisticSet<uint16_t>(100, 100, 100, 100, 100, 100), {"testAbility"_cnc},
2020-08-17 16:23:25 +00:00
{"testHiddenAbility"_cnc}, new PkmnLib::Library::LearnableMoves(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 lib;
}
TEST_CASE("Able to insert and retrieve from library") {
2019-12-29 14:29:52 +00:00
auto lib = new PkmnLib::Library::SpeciesLibrary();
2020-08-30 11:53:15 +00:00
lib->Insert("foo"_cnc.GetHash(),
2020-04-28 12:48:56 +00:00
new PkmnLib::Library::PokemonSpecies(
1, "foo"_cnc,
new PkmnLib::Library::PokemonForme(
"default"_cnc, 1.0f, 1.0f, 100, {0},
CreatureLib::Library::StatisticSet<uint16_t>(100, 100, 100, 100, 100, 100), {"testAbility"_cnc},
2020-08-17 16:23:25 +00:00
{"testHiddenAbility"_cnc}, new PkmnLib::Library::LearnableMoves(100)),
2020-08-08 16:41:27 +00:00
0.5f, "testGrowthRate"_cnc, 100, 100, {"testEggGroup"_cnc}));
auto val = lib->Get("foo"_cnc);
2019-12-29 14:29:52 +00:00
REQUIRE(val->GetName() == "foo");
delete lib;
}
#endif