Use unique pointers in scriptset.
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2020-06-02 15:03:31 +02:00
parent 23e2bc73bc
commit 1ef50fd3a6
7 changed files with 22 additions and 25 deletions

View File

@@ -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");
}
@@ -66,8 +66,8 @@ TEST_CASE("Add script to script set, then remove it", "[Battling, Scripting]") {
REQUIRE(set.Count() == 1);
set.Remove("foobar"_cnc.GetHash());
REQUIRE(set.Count() == 0);
auto it = set.GetIterator();
REQUIRE(it->Count() == 0);
auto& it = set.GetIterator();
REQUIRE(it.Count() == 0);
}
TEST_CASE("Add two scripts to script set, then remove them", "[Battling, Scripting]") {
@@ -79,8 +79,8 @@ TEST_CASE("Add two scripts to script set, then remove them", "[Battling, Scripti
REQUIRE(set.Count() == 2);
set.Remove("foobar"_cnc.GetHash());
REQUIRE(set.Count() == 1);
auto it = set.GetIterator();
REQUIRE(it->At(0)->GetName() == "foobar2");
auto& it = set.GetIterator();
REQUIRE(it.At(0)->GetName() == "foobar2");
}
#endif