Switch unit test library from Catch2 to DocTest.
Some checks failed
continuous-integration/drone/push Build is failing

Signed-off-by: Deukhoofd <Deukhoofd@gmail.com>
This commit is contained in:
2020-09-25 12:43:08 +02:00
parent 5b10dac514
commit 5970dc5d90
18 changed files with 6052 additions and 16802 deletions

View File

@@ -1,7 +1,7 @@
#ifdef TESTS_BUILD
#include <utility>
#include "../../../extern/catch.hpp"
#include "../../../extern/doctest.hpp"
#include "../../../src/Battling/ScriptHandling/ScriptAggregator.hpp"
using namespace CreatureLib;
@@ -18,7 +18,7 @@ public:
void TestMethod(int& runCount) { runCount++; }
};
TEST_CASE("Script Aggregator properly iterates containing script.", "[Battling, Scripting]") {
TEST_CASE("Script Aggregator properly iterates containing script.") {
auto script = std::make_unique<TestScript>("test");
auto ran = 0;
auto vec =
@@ -32,7 +32,7 @@ TEST_CASE("Script Aggregator properly iterates containing script.", "[Battling,
CHECK(ran == 1);
}
TEST_CASE("Script Aggregator properly iterates multiple scripts.", "[Battling, Scripting]") {
TEST_CASE("Script Aggregator properly iterates multiple scripts.") {
auto script = std::make_unique<TestScript>("test");
auto script2 = std::make_unique<TestScript>("test2");
auto script3 = std::make_unique<TestScript>("test3");
@@ -50,7 +50,7 @@ TEST_CASE("Script Aggregator properly iterates multiple scripts.", "[Battling, S
CHECK(ran == 3);
}
TEST_CASE("Script Aggregator properly iterates Script Set.", "[Battling, Scripting]") {
TEST_CASE("Script Aggregator properly iterates Script Set.") {
Script* script = new TestScript("test");
Script* script2 = new TestScript("test2");
Script* script3 = new TestScript("test3");
@@ -69,7 +69,7 @@ TEST_CASE("Script Aggregator properly iterates Script Set.", "[Battling, Scripti
CHECK(ran == 3);
}
TEST_CASE("Script Aggregator properly iterates data of Script Set and Script.", "[Battling, Scripting]") {
TEST_CASE("Script Aggregator properly iterates data of Script Set and Script.") {
auto script = std::make_unique<TestScript>("test");
Script* script2 = new TestScript("test2");
Script* script3 = new TestScript("test3");
@@ -88,7 +88,7 @@ TEST_CASE("Script Aggregator properly iterates data of Script Set and Script.",
CHECK(ran == 3);
}
TEST_CASE("Script Aggregator properly iterates data of Script and Script Set.", "[Battling, Scripting]") {
TEST_CASE("Script Aggregator properly iterates data of Script and Script Set.") {
auto script = std::make_unique<TestScript>("test");
Script* script2 = new TestScript("test2");
Script* script3 = new TestScript("test3");
@@ -107,7 +107,7 @@ TEST_CASE("Script Aggregator properly iterates data of Script and Script Set.",
CHECK(ran == 3);
}
TEST_CASE("Script Aggregator properly iterates data of Script, Script Set and Script.", "[Battling, Scripting]") {
TEST_CASE("Script Aggregator properly iterates data of Script, Script Set and Script.") {
auto script = std::make_unique<TestScript>("test");
Script* script2 = new TestScript("test2");
Script* script3 = new TestScript("test3");
@@ -128,7 +128,7 @@ TEST_CASE("Script Aggregator properly iterates data of Script, Script Set and Sc
CHECK(ran == 4);
}
TEST_CASE("Script Aggregator properly iterates when empty.", "[Battling, Scripting]") {
TEST_CASE("Script Aggregator properly iterates when empty.") {
auto ran = 0;
auto vec = ArbUt::List<ScriptWrapper>{};
auto aggr = ScriptAggregator(vec);
@@ -138,7 +138,7 @@ TEST_CASE("Script Aggregator properly iterates when empty.", "[Battling, Scripti
CHECK(ran == 0);
}
TEST_CASE("Script Aggregator properly iterates empty Script Set.", "[Battling, Scripting]") {
TEST_CASE("Script Aggregator properly iterates empty Script Set.") {
auto ran = 0;
auto set = ScriptSet();
auto vec = ArbUt::List<ScriptWrapper>{ScriptWrapper::FromSet(&set)};

View File

@@ -1,7 +1,7 @@
#ifdef TESTS_BUILD
#include <utility>
#include "../../../extern/catch.hpp"
#include "../../../extern/doctest.hpp"
#include "../../../src/Battling/ScriptHandling/ScriptSet.hpp"
using namespace CreatureLib;
@@ -16,19 +16,19 @@ public:
const ArbUt::StringView& GetName() const noexcept override { return _name; }
};
TEST_CASE("Empty script set count == 0", "[Battling, Scripting]") {
TEST_CASE("Empty script set count == 0") {
auto set = ScriptSet();
REQUIRE(set.Count() == 0);
}
TEST_CASE("Add script to script set", "[Battling, Scripting]") {
TEST_CASE("Add script to script set") {
auto set = ScriptSet();
auto s = new TestScript("foobar");
set.Add(s);
REQUIRE(set.Count() == 1);
}
TEST_CASE("Add script to script set, then retrieve it", "[Battling, Scripting]") {
TEST_CASE("Add script to script set, then retrieve it") {
auto set = ScriptSet();
auto s = new TestScript("foobar");
set.Add(s);
@@ -37,7 +37,7 @@ TEST_CASE("Add script to script set, then retrieve it", "[Battling, Scripting]")
REQUIRE(get->GetName() == "foobar");
}
TEST_CASE("Add two scripts to script set", "[Battling, Scripting]") {
TEST_CASE("Add two scripts to script set") {
auto set = ScriptSet();
auto s = new TestScript("foobar");
auto s2 = new TestScript("foobar2");
@@ -46,7 +46,7 @@ TEST_CASE("Add two scripts to script set", "[Battling, Scripting]") {
REQUIRE(set.Count() == 2);
}
TEST_CASE("Add two scripts to script set, then retrieve them", "[Battling, Scripting]") {
TEST_CASE("Add two scripts to script set, then retrieve them") {
auto set = ScriptSet();
auto s = new TestScript("foobar");
auto s2 = new TestScript("foobar2");
@@ -59,7 +59,7 @@ TEST_CASE("Add two scripts to script set, then retrieve them", "[Battling, Scrip
REQUIRE(get2->GetName() == "foobar2");
}
TEST_CASE("Add script to script set, then remove it", "[Battling, Scripting]") {
TEST_CASE("Add script to script set, then remove it") {
auto set = ScriptSet();
auto s = new TestScript("foobar");
set.Add(s);
@@ -70,7 +70,7 @@ TEST_CASE("Add script to script set, then remove it", "[Battling, Scripting]") {
REQUIRE(it.Count() == 0);
}
TEST_CASE("Add two scripts to script set, then remove them", "[Battling, Scripting]") {
TEST_CASE("Add two scripts to script set, then remove them") {
auto set = ScriptSet();
auto s = new TestScript("foobar");
auto s2 = new TestScript("foobar2");

View File

@@ -1,9 +1,7 @@
#ifdef TESTS_BUILD
#include "../../../src/Battling/ScriptHandling/ScriptSource.hpp"
#include <utility>
#include "../../../extern/catch.hpp"
#include "../../../src/Battling/ScriptHandling/ScriptAggregator.hpp"
#include "../../../extern/doctest.hpp"
using namespace CreatureLib;
using namespace CreatureLib::Battling;
@@ -41,13 +39,13 @@ protected:
}
};
TEST_CASE("Script source with unset script ptr.", "[Battling, Scripting]") {
TEST_CASE("Script source with unset script ptr.") {
auto source = ScriptSourceWithScriptPtr();
auto scripts = source.GetScriptIterator();
REQUIRE_FALSE(scripts.HasNext());
}
TEST_CASE("Script source with script ptr being set.", "[Battling, Scripting]") {
TEST_CASE("Script source with script ptr being set.") {
auto source = ScriptSourceWithScriptPtr();
source.ScriptPtr = std::make_unique<TestScript>("foobar");
auto scripts = source.GetScriptIterator();
@@ -55,7 +53,7 @@ TEST_CASE("Script source with script ptr being set.", "[Battling, Scripting]") {
CHECK(first != nullptr);
}
TEST_CASE("Script source with script ptr being set after first iteration.", "[Battling, Scripting]") {
TEST_CASE("Script source with script ptr being set after first iteration.") {
auto source = ScriptSourceWithScriptPtr();
auto scripts = source.GetScriptIterator();
REQUIRE_FALSE(scripts.HasNext());
@@ -65,14 +63,14 @@ TEST_CASE("Script source with script ptr being set after first iteration.", "[Ba
CHECK(first != nullptr);
}
TEST_CASE("Script source with empty script set.", "[Battling, Scripting]") {
TEST_CASE("Script source with empty script set.") {
auto source = ScriptSourceWithScriptSet();
auto scripts = source.GetScriptIterator();
scripts.Reset();
REQUIRE_FALSE(scripts.HasNext());
}
TEST_CASE("Script source with single item script set.", "[Battling, Scripting]") {
TEST_CASE("Script source with single item script set.") {
auto source = ScriptSourceWithScriptSet();
auto s = new TestScript("foobar");
source.Set.Add(s);
@@ -82,7 +80,7 @@ TEST_CASE("Script source with single item script set.", "[Battling, Scripting]")
CHECK(first->GetName() == "foobar");
}
TEST_CASE("Script source with multiple item script set.", "[Battling, Scripting]") {
TEST_CASE("Script source with multiple item script set.") {
auto source = ScriptSourceWithScriptSet();
auto s = new TestScript("foobar");
auto s2 = new TestScript("foobar2");