Reworks test suite, tweaks to Cmake config for Windows.
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
2019-12-07 13:45:44 +01:00
parent 8897f2282f
commit 0483e635ea
10 changed files with 90 additions and 68 deletions

View File

@@ -1,44 +1,45 @@
#ifdef TESTS_BUILD
#include "../../extern/catch.hpp"
#include "../../src/Battling/Models/CreateCreature.hpp"
#include "../TestLibrary/TestLibrary.cpp"
#include "../TestLibrary/TestLibrary.hpp"
using namespace CreatureLib::Library;
TEST_CASE("Create basic creature", "[Library]") {
auto library = GetLibrary();
auto library = TestLibrary::Get();
auto creature = CreateCreature(library, "testSpecies1", 1).Create();
delete creature;
}
TEST_CASE("Get creature species", "[Library]") {
auto library = GetLibrary();
auto library = TestLibrary::Get();
auto creature = CreateCreature(library, "testSpecies1", 1).Create();
REQUIRE(creature->GetSpecies()->GetName() == "testSpecies1");
delete creature;
}
TEST_CASE("Get creature level", "[Library]") {
auto library = GetLibrary();
auto library = TestLibrary::Get();
auto creature = CreateCreature(library, "testSpecies1", 1).Create();
REQUIRE(creature->GetLevel() == 1);
delete creature;
}
TEST_CASE("Get creature variant when unset", "[Library]") {
auto library = GetLibrary();
auto library = TestLibrary::Get();
auto creature = CreateCreature(library, "testSpecies1", 1).Create();
REQUIRE(creature->GetVariant()->GetName() == "default");
delete creature;
}
TEST_CASE("Get creature nickname when unset", "[Library]") {
auto library = GetLibrary();
auto library = TestLibrary::Get();
auto creature = CreateCreature(library, "testSpecies1", 1).Create();
REQUIRE(creature->GetNickname() == "testSpecies1");
delete creature;
}
TEST_CASE("Get creature stat potentials when unset", "[Library]") {
auto library = GetLibrary();
auto library = TestLibrary::Get();
auto creature = CreateCreature(library, "testSpecies1", 1).Create();
auto potentials = creature->GetStatPotential();
REQUIRE(potentials.GetHealth() == 0);
@@ -51,7 +52,7 @@ TEST_CASE("Get creature stat potentials when unset", "[Library]") {
}
TEST_CASE("Get creature stat experience when unset", "[Library]") {
auto library = GetLibrary();
auto library = TestLibrary::Get();
auto creature = CreateCreature(library, "testSpecies1", 1).Create();
auto experiences = creature->GetStatExperience();
REQUIRE(experiences.GetHealth() == 0);

View File

@@ -2,36 +2,35 @@
#define CATCH_CONFIG_MAIN
#include "../../extern/catch.hpp"
#include "../TestLibrary/TestLibrary.cpp"
#include "../TestLibrary/TestLibrary.hpp"
TEST_CASE("Can Create Species Library", "[Library]") {
auto l = BuildSpeciesLibrary();
auto l = TestLibrary::BuildSpeciesLibrary();
REQUIRE(l != nullptr);
delete l;
}
TEST_CASE("Can Create Attack Library", "[Library]") {
auto l = BuildAttackLibrary();
auto l = TestLibrary::BuildAttackLibrary();
REQUIRE(l != nullptr);
delete l;
}
TEST_CASE("Can Create Item Library", "[Library]") {
auto l = BuildItemLibrary();
auto l = TestLibrary::BuildItemLibrary();
REQUIRE(l != nullptr);
delete l;
}
TEST_CASE("Can Create Growthrate Library", "[Library]") {
auto l = BuildGrowthRateLibrary();
TEST_CASE("Can Create Growth Rate Library", "[Library]") {
auto l = TestLibrary::BuildGrowthRateLibrary();
REQUIRE(l != nullptr);
delete l;
}
TEST_CASE("Can Create Data Library", "[Library]") {
auto l = BuildLibrary();
auto l = TestLibrary::Get();
REQUIRE(l != nullptr);
delete l;
}
#endif