Replace most collections with Arbutils collections for more safety.
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -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 = std::vector<ScriptWrapper>{&script};
|
||||
auto vec = Arbutils::Collections::List<ScriptWrapper>{&script};
|
||||
auto aggr = ScriptAggregator(vec);
|
||||
while (aggr.HasNext()) {
|
||||
auto next = aggr.GetNext();
|
||||
@@ -37,7 +37,7 @@ 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 = std::vector<ScriptWrapper>{&script, &script2, &script3};
|
||||
auto vec = Arbutils::Collections::List<ScriptWrapper>{&script, &script2, &script3};
|
||||
auto aggr = ScriptAggregator(vec);
|
||||
while (aggr.HasNext()) {
|
||||
auto next = aggr.GetNext();
|
||||
@@ -59,7 +59,7 @@ TEST_CASE("Script Aggregator properly iterates Script Set.", "[Battling, Scripti
|
||||
set.Add(script);
|
||||
set.Add(script2);
|
||||
set.Add(script3);
|
||||
auto vec = std::vector<ScriptWrapper>{&set};
|
||||
auto vec = Arbutils::Collections::List<ScriptWrapper>{&set};
|
||||
auto aggr = ScriptAggregator(vec);
|
||||
while (aggr.HasNext()) {
|
||||
auto next = aggr.GetNext();
|
||||
@@ -77,7 +77,7 @@ TEST_CASE("Script Aggregator properly iterates data of Script Set and Script.",
|
||||
auto set = ScriptSet();
|
||||
set.Add(script2);
|
||||
set.Add(script3);
|
||||
auto vec = std::vector<ScriptWrapper>{&set, &script};
|
||||
auto vec = Arbutils::Collections::List<ScriptWrapper>{&set, &script};
|
||||
auto aggr = ScriptAggregator(vec);
|
||||
while (aggr.HasNext()) {
|
||||
auto next = aggr.GetNext();
|
||||
@@ -96,7 +96,7 @@ TEST_CASE("Script Aggregator properly iterates data of Script and Script Set.",
|
||||
auto set = ScriptSet();
|
||||
set.Add(script2);
|
||||
set.Add(script3);
|
||||
auto vec = std::vector<ScriptWrapper>{&script, &set};
|
||||
auto vec = Arbutils::Collections::List<ScriptWrapper>{&script, &set};
|
||||
auto aggr = ScriptAggregator(vec);
|
||||
while (aggr.HasNext()) {
|
||||
auto next = aggr.GetNext();
|
||||
@@ -116,7 +116,7 @@ TEST_CASE("Script Aggregator properly iterates data of Script, Script Set and Sc
|
||||
auto set = ScriptSet();
|
||||
set.Add(script2);
|
||||
set.Add(script3);
|
||||
auto vec = std::vector<ScriptWrapper>{&script, &set, &script4};
|
||||
auto vec = Arbutils::Collections::List<ScriptWrapper>{&script, &set, &script4};
|
||||
auto aggr = ScriptAggregator(vec);
|
||||
while (aggr.HasNext()) {
|
||||
auto next = aggr.GetNext();
|
||||
@@ -130,7 +130,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 = std::vector<ScriptWrapper>{};
|
||||
auto vec = Arbutils::Collections::List<ScriptWrapper>{};
|
||||
auto aggr = ScriptAggregator(vec);
|
||||
while (aggr.HasNext()) {
|
||||
throw CreatureException("Aggregator returned a script, but should have been empty.");
|
||||
@@ -141,7 +141,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 = std::vector<ScriptWrapper>{&set};
|
||||
auto vec = Arbutils::Collections::List<ScriptWrapper>{&set};
|
||||
auto aggr = ScriptAggregator(vec);
|
||||
while (aggr.HasNext()) {
|
||||
auto next = aggr.GetNext();
|
||||
|
||||
@@ -33,7 +33,7 @@ TEST_CASE("Add script to script set, then retrieve it", "[Battling, Scripting]")
|
||||
auto s = new TestScript("foobar");
|
||||
set.Add(s);
|
||||
REQUIRE(set.Count() == 1);
|
||||
auto get = set.GetIterator()->at(0);
|
||||
auto get = set.GetIterator()->At(0);
|
||||
REQUIRE(get->GetName() == "foobar");
|
||||
}
|
||||
|
||||
@@ -53,8 +53,8 @@ TEST_CASE("Add two scripts to script set, then retrieve them", "[Battling, Scrip
|
||||
set.Add(s);
|
||||
set.Add(s2);
|
||||
REQUIRE(set.Count() == 2);
|
||||
auto get1 = set.GetIterator()->at(0);
|
||||
auto get2 = set.GetIterator()->at(1);
|
||||
auto get1 = set.GetIterator()->At(0);
|
||||
auto get2 = set.GetIterator()->At(1);
|
||||
REQUIRE(get1->GetName() == "foobar");
|
||||
REQUIRE(get2->GetName() == "foobar2");
|
||||
}
|
||||
@@ -67,7 +67,7 @@ TEST_CASE("Add script to script set, then remove it", "[Battling, Scripting]") {
|
||||
set.Remove("foobar"_cnc);
|
||||
REQUIRE(set.Count() == 0);
|
||||
auto it = set.GetIterator();
|
||||
REQUIRE(it->empty());
|
||||
REQUIRE(it->Count() == 0);
|
||||
}
|
||||
|
||||
TEST_CASE("Add two scripts to script set, then remove them", "[Battling, Scripting]") {
|
||||
@@ -80,7 +80,7 @@ TEST_CASE("Add two scripts to script set, then remove them", "[Battling, Scripti
|
||||
set.Remove("foobar"_cnc);
|
||||
REQUIRE(set.Count() == 1);
|
||||
auto it = set.GetIterator();
|
||||
REQUIRE(it->at(0)->GetName() == "foobar2");
|
||||
REQUIRE(it->At(0)->GetName() == "foobar2");
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -24,7 +24,7 @@ public:
|
||||
Script* ScriptPtr = nullptr;
|
||||
|
||||
protected:
|
||||
void GetActiveScripts(std::vector<ScriptWrapper>& scripts) override { scripts.emplace_back(&ScriptPtr); }
|
||||
void GetActiveScripts(Arbutils::Collections::List<ScriptWrapper>& scripts) override { scripts.Append(&ScriptPtr); }
|
||||
};
|
||||
|
||||
class ScriptSourceWithScriptSet : public ScriptSource {
|
||||
@@ -32,7 +32,7 @@ public:
|
||||
ScriptSet Set;
|
||||
|
||||
protected:
|
||||
void GetActiveScripts(std::vector<ScriptWrapper>& scripts) override { scripts.emplace_back(&Set); }
|
||||
void GetActiveScripts(Arbutils::Collections::List<ScriptWrapper>& scripts) override { scripts.Append(&Set); }
|
||||
};
|
||||
|
||||
TEST_CASE("Script source with unset script ptr.", "[Battling, Scripting]") {
|
||||
|
||||
Reference in New Issue
Block a user