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,15 +1,16 @@
#ifdef TESTS_BUILD
#include "../../extern/catch.hpp"
#include "../TestLibrary/TestLibrary.hpp"
#include "../../src/Battling/Models/BattleSide.hpp"
#include "../../src/Battling/Models/CreateCreature.hpp"
#include "../../src/Battling/TurnChoices/PassTurnChoice.hpp"
#include "../TestLibrary/TestLibrary.cpp"
using namespace CreatureLib::Battling;
TEST_CASE("Set Choice one-sized side", "[Battling]") {
auto side = BattleSide(0, nullptr, 1);
auto c = CreateCreature(GetLibrary(), "testSpecies1", 5).Create();
auto c = CreateCreature(TestLibrary::Get(), "testSpecies1", 5).Create();
side.SetCreature(c, 0);
auto choice = new PassTurnChoice(c);
side.SetChoice(choice);
@@ -19,7 +20,7 @@ TEST_CASE("Set Choice one-sized side", "[Battling]") {
TEST_CASE("Set Choice one-sized side, validate all choices set", "[Battling]") {
auto side = BattleSide(0, nullptr, 1);
auto c = CreateCreature(GetLibrary(), "testSpecies1", 5).Create();
auto c = CreateCreature(TestLibrary::Get(), "testSpecies1", 5).Create();
side.SetCreature(c, 0);
auto choice = new PassTurnChoice(c);
REQUIRE_FALSE(side.AllChoicesSet());
@@ -31,8 +32,8 @@ TEST_CASE("Set Choice one-sized side, validate all choices set", "[Battling]") {
TEST_CASE("Set Choice two-sized side", "[Battling]") {
auto side = BattleSide(0, nullptr, 2);
auto c1 = CreateCreature(GetLibrary(), "testSpecies1", 5).Create();
auto c2 = CreateCreature(GetLibrary(), "testSpecies1", 5).Create();
auto c1 = CreateCreature(TestLibrary::Get(), "testSpecies1", 5).Create();
auto c2 = CreateCreature(TestLibrary::Get(), "testSpecies1", 5).Create();
side.SetCreature(c1, 0);
side.SetCreature(c2, 1);
auto choice1 = new PassTurnChoice(c1);
@@ -47,8 +48,8 @@ TEST_CASE("Set Choice two-sized side", "[Battling]") {
TEST_CASE("Set Choice two-sized side, validate all choices set", "[Battling]") {
auto side = BattleSide(0, nullptr, 2);
auto c1 = CreateCreature(GetLibrary(), "testSpecies1", 5).Create();
auto c2 = CreateCreature(GetLibrary(), "testSpecies1", 5).Create();
auto c1 = CreateCreature(TestLibrary::Get(), "testSpecies1", 5).Create();
auto c2 = CreateCreature(TestLibrary::Get(), "testSpecies1", 5).Create();
side.SetCreature(c1, 0);
side.SetCreature(c2, 1);
auto choice1 = new PassTurnChoice(c1);

View File

@@ -1,9 +1,10 @@
#ifdef TESTS_BUILD
#include "../../extern/catch.hpp"
#include "../../src/Battling/Flow/TurnOrdering.hpp"
#include "../../src/Battling/TurnChoices/AttackTurnChoice.hpp"
#include "../../src/Battling/TurnChoices/PassTurnChoice.hpp"
#include "../TestLibrary/TestLibrary.cpp"
#include "../TestLibrary/TestLibrary.hpp"
using namespace CreatureLib;
using namespace CreatureLib::Battling;
@@ -26,7 +27,7 @@ TEST_CASE("Turn ordering: Attack before pass", "[Battling]") {
}
TEST_CASE("Turn ordering: High priority goes before no priority", "[Battling]") {
auto l = GetLibrary()->GetAttackLibrary();
auto l = TestLibrary::Get()->GetAttackLibrary();
auto a1 = new LearnedAttack(l->GetAttack("standard"), AttackLearnMethod::Unknown);
auto a2 = new LearnedAttack(l->GetAttack("highPriority"), AttackLearnMethod::Unknown);
auto choice1 = new AttackTurnChoice(nullptr, a1, CreatureIndex(0, 0));
@@ -48,7 +49,7 @@ TEST_CASE("Turn ordering: High priority goes before no priority", "[Battling]")
}
TEST_CASE("Turn ordering: Higher priority goes before high priority", "[Battling]") {
auto l = GetLibrary()->GetAttackLibrary();
auto l = TestLibrary::Get()->GetAttackLibrary();
auto a1 = new LearnedAttack(l->GetAttack("highPriority"), AttackLearnMethod::Unknown);
auto a2 = new LearnedAttack(l->GetAttack("higherPriority"), AttackLearnMethod::Unknown);
auto choice1 = new AttackTurnChoice(nullptr, a1, CreatureIndex(0, 0));
@@ -70,7 +71,7 @@ TEST_CASE("Turn ordering: Higher priority goes before high priority", "[Battling
}
TEST_CASE("Turn ordering: High priority goes before low priority", "[Battling]") {
auto l = GetLibrary()->GetAttackLibrary();
auto l = TestLibrary::Get()->GetAttackLibrary();
auto a1 = new LearnedAttack(l->GetAttack("lowPriority"), AttackLearnMethod::Unknown);
auto a2 = new LearnedAttack(l->GetAttack("higherPriority"), AttackLearnMethod::Unknown);
auto choice1 = new AttackTurnChoice(nullptr, a1, CreatureIndex(0, 0));
@@ -92,7 +93,7 @@ TEST_CASE("Turn ordering: High priority goes before low priority", "[Battling]")
}
TEST_CASE("Turn ordering: No priority goes before low priority", "[Battling]") {
auto l = GetLibrary()->GetAttackLibrary();
auto l = TestLibrary::Get()->GetAttackLibrary();
auto a1 = new LearnedAttack(l->GetAttack("lowPriority"), AttackLearnMethod::Unknown);
auto a2 = new LearnedAttack(l->GetAttack("standard"), AttackLearnMethod::Unknown);
auto choice1 = new AttackTurnChoice(nullptr, a1, CreatureIndex(0, 0));