Update to newer Arbutils version.
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2020-05-26 18:31:06 +02:00
parent d746b3ecce
commit 25f65eb47b
68 changed files with 334 additions and 354 deletions

View File

@@ -9,11 +9,11 @@ using namespace CreatureLib::Battling;
class TestScript : public Script {
private:
ConstString _name;
ArbUt::CaseInsensitiveConstString _name;
public:
explicit TestScript(std::string name) : _name(std::move(name)){};
const ConstString& GetName() const noexcept override { return _name; }
const ArbUt::CaseInsensitiveConstString& GetName() const noexcept override { return _name; }
void TestMethod(int& runCount) { runCount++; }
};
@@ -21,7 +21,7 @@ public:
TEST_CASE("Script Aggregator properly iterates containing script.", "[Battling, Scripting]") {
Script* script = new TestScript("test");
auto ran = 0;
auto vec = Arbutils::Collections::List<ScriptWrapper>{ScriptWrapper::FromScript(&script)};
auto vec = ArbUt::List<ScriptWrapper>{ScriptWrapper::FromScript(&script)};
auto aggr = ScriptAggregator(vec);
while (aggr.HasNext()) {
auto next = aggr.GetNext();
@@ -37,8 +37,8 @@ TEST_CASE("Script Aggregator properly iterates multiple scripts.", "[Battling, S
Script* script2 = new TestScript("test2");
Script* script3 = new TestScript("test3");
auto ran = 0;
auto vec = Arbutils::Collections::List<ScriptWrapper>{
ScriptWrapper::FromScript(&script), ScriptWrapper::FromScript(&script2), ScriptWrapper::FromScript(&script3)};
auto vec = ArbUt::List<ScriptWrapper>{ScriptWrapper::FromScript(&script), ScriptWrapper::FromScript(&script2),
ScriptWrapper::FromScript(&script3)};
auto aggr = ScriptAggregator(vec);
while (aggr.HasNext()) {
auto next = aggr.GetNext();
@@ -60,7 +60,7 @@ TEST_CASE("Script Aggregator properly iterates Script Set.", "[Battling, Scripti
set.Add(script);
set.Add(script2);
set.Add(script3);
auto vec = Arbutils::Collections::List<ScriptWrapper>{ScriptWrapper::FromSet(&set)};
auto vec = ArbUt::List<ScriptWrapper>{ScriptWrapper::FromSet(&set)};
auto aggr = ScriptAggregator(vec);
while (aggr.HasNext()) {
auto next = aggr.GetNextNotNull();
@@ -78,8 +78,7 @@ TEST_CASE("Script Aggregator properly iterates data of Script Set and Script.",
auto set = ScriptSet();
set.Add(script2);
set.Add(script3);
auto vec =
Arbutils::Collections::List<ScriptWrapper>{ScriptWrapper::FromSet(&set), ScriptWrapper::FromScript(&script)};
auto vec = ArbUt::List<ScriptWrapper>{ScriptWrapper::FromSet(&set), ScriptWrapper::FromScript(&script)};
auto aggr = ScriptAggregator(vec);
while (aggr.HasNext()) {
auto next = aggr.GetNextNotNull();
@@ -98,8 +97,7 @@ TEST_CASE("Script Aggregator properly iterates data of Script and Script Set.",
auto set = ScriptSet();
set.Add(script2);
set.Add(script3);
auto vec =
Arbutils::Collections::List<ScriptWrapper>{ScriptWrapper::FromScript(&script), ScriptWrapper::FromSet(&set)};
auto vec = ArbUt::List<ScriptWrapper>{ScriptWrapper::FromScript(&script), ScriptWrapper::FromSet(&set)};
auto aggr = ScriptAggregator(vec);
while (aggr.HasNext()) {
auto next = aggr.GetNextNotNull();
@@ -119,8 +117,8 @@ TEST_CASE("Script Aggregator properly iterates data of Script, Script Set and Sc
auto set = ScriptSet();
set.Add(script2);
set.Add(script3);
auto vec = Arbutils::Collections::List<ScriptWrapper>{
ScriptWrapper::FromScript(&script), ScriptWrapper::FromSet(&set), ScriptWrapper::FromScript(&script4)};
auto vec = ArbUt::List<ScriptWrapper>{ScriptWrapper::FromScript(&script), ScriptWrapper::FromSet(&set),
ScriptWrapper::FromScript(&script4)};
auto aggr = ScriptAggregator(vec);
while (aggr.HasNext()) {
auto next = aggr.GetNextNotNull();
@@ -134,7 +132,7 @@ TEST_CASE("Script Aggregator properly iterates data of Script, Script Set and Sc
TEST_CASE("Script Aggregator properly iterates when empty.", "[Battling, Scripting]") {
auto ran = 0;
auto vec = Arbutils::Collections::List<ScriptWrapper>{};
auto vec = ArbUt::List<ScriptWrapper>{};
auto aggr = ScriptAggregator(vec);
while (aggr.HasNext()) {
throw CreatureException("Aggregator returned a script, but should have been empty.");
@@ -145,7 +143,7 @@ TEST_CASE("Script Aggregator properly iterates when empty.", "[Battling, Scripti
TEST_CASE("Script Aggregator properly iterates empty Script Set.", "[Battling, Scripting]") {
auto ran = 0;
auto set = ScriptSet();
auto vec = Arbutils::Collections::List<ScriptWrapper>{ScriptWrapper::FromSet(&set)};
auto vec = ArbUt::List<ScriptWrapper>{ScriptWrapper::FromSet(&set)};
auto aggr = ScriptAggregator(vec);
while (aggr.HasNext()) {
auto next = aggr.GetNext();

View File

@@ -9,11 +9,11 @@ using namespace CreatureLib::Battling;
class TestScript : public Script {
private:
ConstString _name;
ArbUt::CaseInsensitiveConstString _name;
public:
explicit TestScript(std::string name) : _name(std::move(name)){};
const ConstString& GetName() const noexcept override { return _name; }
const ArbUt::CaseInsensitiveConstString& GetName() const noexcept override { return _name; }
};
TEST_CASE("Empty script set count == 0", "[Battling, Scripting]") {

View File

@@ -10,11 +10,11 @@ using namespace CreatureLib::Battling;
class TestScript : public Script {
private:
ConstString _name;
ArbUt::CaseInsensitiveConstString _name;
public:
explicit TestScript(std::string name) : _name(std::move(name)){};
const ConstString& GetName() const noexcept override { return _name; }
const ArbUt::CaseInsensitiveConstString& GetName() const noexcept override { return _name; }
void TestMethod(int& runCount) { runCount++; }
};
@@ -25,7 +25,7 @@ public:
protected:
size_t ScriptCount() const override { return 1; }
void GetActiveScripts(Arbutils::Collections::List<ScriptWrapper>& scripts) override {
void GetActiveScripts(ArbUt::List<ScriptWrapper>& scripts) override {
scripts.Append(ScriptWrapper::FromScript(&ScriptPtr));
}
};
@@ -36,7 +36,7 @@ public:
protected:
size_t ScriptCount() const override { return 1; }
void GetActiveScripts(Arbutils::Collections::List<ScriptWrapper>& scripts) override {
void GetActiveScripts(ArbUt::List<ScriptWrapper>& scripts) override {
scripts.Append(ScriptWrapper::FromSet(&Set));
}
};

View File

@@ -16,7 +16,7 @@ TEST_CASE("Turn ordering: Attack before pass", "[Battling]") {
auto choice1 = new PassTurnChoice(nullptr);
auto choice2 = new AttackTurnChoice(nullptr, &learnedAttack, CreatureIndex(0, 0));
auto vec = std::vector<BaseTurnChoice*>{choice1, choice2};
auto rand = Arbutils::Random();
auto rand = ArbUt::Random();
TurnOrdering::OrderChoices(vec, rand);
CHECK(vec[0] == choice2);
CHECK(vec[1] == choice1);
@@ -36,7 +36,7 @@ TEST_CASE("Turn ordering: High priority goes before no priority", "[Battling]")
auto choice1 = new AttackTurnChoice(nullptr, a1, CreatureIndex(0, 0));
auto choice2 = new AttackTurnChoice(nullptr, a2, CreatureIndex(0, 0));
auto vec = std::vector<BaseTurnChoice*>{choice1, choice2};
auto rand = Arbutils::Random();
auto rand = ArbUt::Random();
TurnOrdering::OrderChoices(vec, rand);
CHECK(vec[0] == choice2);
CHECK(vec[1] == choice1);
@@ -58,7 +58,7 @@ TEST_CASE("Turn ordering: Higher priority goes before high priority", "[Battling
auto choice1 = new AttackTurnChoice(nullptr, a1, CreatureIndex(0, 0));
auto choice2 = new AttackTurnChoice(nullptr, a2, CreatureIndex(0, 0));
auto vec = std::vector<BaseTurnChoice*>{choice1, choice2};
auto rand = Arbutils::Random();
auto rand = ArbUt::Random();
TurnOrdering::OrderChoices(vec, rand);
CHECK(vec[0] == choice2);
CHECK(vec[1] == choice1);
@@ -80,7 +80,7 @@ TEST_CASE("Turn ordering: High priority goes before low priority", "[Battling]")
auto choice1 = new AttackTurnChoice(nullptr, a1, CreatureIndex(0, 0));
auto choice2 = new AttackTurnChoice(nullptr, a2, CreatureIndex(0, 0));
auto vec = std::vector<BaseTurnChoice*>{choice1, choice2};
auto rand = Arbutils::Random();
auto rand = ArbUt::Random();
TurnOrdering::OrderChoices(vec, rand);
CHECK(vec[0] == choice2);
CHECK(vec[1] == choice1);
@@ -102,7 +102,7 @@ TEST_CASE("Turn ordering: No priority goes before low priority", "[Battling]") {
auto choice1 = new AttackTurnChoice(nullptr, a1, CreatureIndex(0, 0));
auto choice2 = new AttackTurnChoice(nullptr, a2, CreatureIndex(0, 0));
auto vec = std::vector<BaseTurnChoice*>{choice1, choice2};
auto rand = Arbutils::Random();
auto rand = ArbUt::Random();
TurnOrdering::OrderChoices(vec, rand);
CHECK(vec[0] == choice2);
CHECK(vec[1] == choice1);