diff options
author | Andrei Karas <akaras@inbox.ru> | 2017-09-12 18:47:07 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2017-09-12 18:47:07 +0300 |
commit | d88285ef4d2b624a0c6a8ef5c2e157ed0248838e (patch) | |
tree | 21c77124f72c023590f0d1b0426eb9357305201e | |
parent | 429a545dbd5d0fa992394cf7f4c83d5e972a14b2 (diff) | |
download | manaplus-d88285ef4d2b624a0c6a8ef5c2e157ed0248838e.tar.gz manaplus-d88285ef4d2b624a0c6a8ef5c2e157ed0248838e.tar.bz2 manaplus-d88285ef4d2b624a0c6a8ef5c2e157ed0248838e.tar.xz manaplus-d88285ef4d2b624a0c6a8ef5c2e157ed0248838e.zip |
Create logger in unit tests before other code.
This need because now sdl may raise error or assert almost at start.
40 files changed, 3 insertions, 340 deletions
diff --git a/src/maingui.cpp b/src/maingui.cpp index bb1abf5ae..fc3df1b98 100644 --- a/src/maingui.cpp +++ b/src/maingui.cpp @@ -52,6 +52,8 @@ PRAGMA48(GCC diagnostic pop) #endif // SDL_VERSIONNUM #ifdef UNITTESTS +#include "logger.h" + #include "utils/cpu.h" #include "utils/sdlhelper.h" #include "resources/dye/dyepalette.h" @@ -151,6 +153,7 @@ int mainGui(int argc, char *argv[]) int main(int argc, char *argv[]) { + logger = new Logger; SDL::initLogger(); VirtFs::init(argv[0]); Cpu::detect(); diff --git a/src/unittests/configuration.cc b/src/unittests/configuration.cc index cdb28eddb..03561ed42 100644 --- a/src/unittests/configuration.cc +++ b/src/unittests/configuration.cc @@ -23,12 +23,9 @@ #include "configuration.h" #include "configmanager.h" #include "dirs.h" -#include "logger.h" #include "listeners/configlistener.h" -#include "utils/delete2.h" - #include "debug.h" namespace @@ -48,8 +45,6 @@ namespace TEST_CASE("configuration tests", "configuration") { - logger = new Logger(); - Dirs::initRootDir(); Dirs::initHomeDir(); @@ -295,6 +290,4 @@ TEST_CASE("configuration tests", "configuration") REQUIRE(config.getStringValue(key) == "0"); REQUIRE(config.getBoolValue(key) == false); } - - delete2(logger); } diff --git a/src/unittests/endian.cc b/src/unittests/endian.cc index 3d0c66051..ef03a1c2d 100644 --- a/src/unittests/endian.cc +++ b/src/unittests/endian.cc @@ -22,8 +22,6 @@ #include "logger.h" -#include "utils/delete2.h" - PRAGMA48(GCC diagnostic push) PRAGMA48(GCC diagnostic ignored "-Wshadow") #include <SDL_endian.h> @@ -51,7 +49,6 @@ TEST_CASE("endian test", "") data.byteData[1] = 0x20; data.byteData[2] = 0x30; data.byteData[3] = 0x40; - logger = new Logger(); #if SDL_BYTEORDER == SDL_BIG_ENDIAN REQUIRE(data.dwordData == 0x10203040); logger->log("big endian detected"); @@ -60,6 +57,4 @@ TEST_CASE("endian test", "") REQUIRE(data.dwordData == 0x40302010); logger->log("little endian detected"); #endif // SDL_BYTEORDER == SDL_BIG_ENDIAN - - delete2(logger); } diff --git a/src/unittests/fs/files.cc b/src/unittests/fs/files.cc index f3a15b174..935a00f72 100644 --- a/src/unittests/fs/files.cc +++ b/src/unittests/fs/files.cc @@ -20,14 +20,12 @@ #include "unittests/unittests.h" -#include "logger.h" #include "fs/files.h" #include "fs/virtfs/fs.h" #include "fs/virtfs/tools.h" -#include "utils/delete2.h" #include "utils/stringutils.h" #include "resources/resourcemanager/resourcemanager.h" @@ -36,7 +34,6 @@ TEST_CASE("Files renameFile", "") { - logger = new Logger(); VirtFs::mountDirSilent("data", Append_false); VirtFs::mountDirSilent("../data", Append_false); @@ -68,13 +65,10 @@ TEST_CASE("Files renameFile", "") ResourceManager::deleteInstance(); VirtFs::unmountDirSilent("data"); VirtFs::unmountDirSilent("../data"); - delete2(logger); -// VirtFs::deinit(); } TEST_CASE("Files existsLocal", "") { - logger = new Logger(); VirtFs::mountDirSilent("data", Append_false); VirtFs::mountDirSilent("../data", Append_false); REQUIRE(Files::existsLocal(VirtFs::getPath("help/about.txt")) == true); @@ -83,13 +77,10 @@ TEST_CASE("Files existsLocal", "") ResourceManager::deleteInstance(); VirtFs::unmountDirSilent("data"); VirtFs::unmountDirSilent("../data"); - delete2(logger); -// VirtFs::deinit(); } TEST_CASE("Files loadTextFileString", "") { - logger = new Logger(); VirtFs::mountDirSilent("data", Append_false); VirtFs::mountDirSilent("../data", Append_false); REQUIRE(VirtFs::loadTextFileString("test/simplefile.txt") == @@ -97,13 +88,10 @@ TEST_CASE("Files loadTextFileString", "") ResourceManager::deleteInstance(); VirtFs::unmountDirSilent("data"); VirtFs::unmountDirSilent("../data"); - delete2(logger); -// VirtFs::deinit(); } TEST_CASE("Files loadTextFile", "") { - logger = new Logger(); VirtFs::mountDirSilent("data", Append_false); VirtFs::mountDirSilent("../data", Append_false); @@ -115,13 +103,10 @@ TEST_CASE("Files loadTextFile", "") ResourceManager::deleteInstance(); VirtFs::unmountDirSilent("data"); VirtFs::unmountDirSilent("../data"); - delete2(logger); -// VirtFs::deinit(); } TEST_CASE("Files saveTextFile", "") { - logger = new Logger(); VirtFs::mountDirSilent("data", Append_false); VirtFs::mountDirSilent("../data", Append_false); @@ -140,13 +125,10 @@ TEST_CASE("Files saveTextFile", "") ResourceManager::deleteInstance(); VirtFs::unmountDirSilent("data"); VirtFs::unmountDirSilent("../data"); - delete2(logger); -// VirtFs::deinit(); } TEST_CASE("Files copyFile1", "") { - logger = new Logger(); VirtFs::mountDirSilent("data", Append_false); VirtFs::mountDirSilent("../data", Append_false); @@ -172,13 +154,10 @@ TEST_CASE("Files copyFile1", "") ResourceManager::deleteInstance(); VirtFs::unmountDirSilent("data"); VirtFs::unmountDirSilent("../data"); - delete2(logger); -// VirtFs::deinit(); } TEST_CASE("Files loadTextFileLocal", "") { - logger = new Logger(); VirtFs::mountDirSilent("data", Append_false); VirtFs::mountDirSilent("../data", Append_false); @@ -196,13 +175,10 @@ TEST_CASE("Files loadTextFileLocal", "") ResourceManager::deleteInstance(); VirtFs::unmountDirSilent("data"); VirtFs::unmountDirSilent("../data"); - delete2(logger); -// VirtFs::deinit(); } TEST_CASE("Files getFilesInDir", "") { - logger = new Logger(); VirtFs::mountDirSilent("data", Append_false); VirtFs::mountDirSilent("../data", Append_false); @@ -228,6 +204,4 @@ TEST_CASE("Files getFilesInDir", "") ResourceManager::deleteInstance(); VirtFs::unmountDirSilent("data"); VirtFs::unmountDirSilent("../data"); - delete2(logger); -// VirtFs::deinit(); } diff --git a/src/unittests/fs/virtfs/throw.cc b/src/unittests/fs/virtfs/throw.cc index d510f47e0..9f0a18f32 100644 --- a/src/unittests/fs/virtfs/throw.cc +++ b/src/unittests/fs/virtfs/throw.cc @@ -28,7 +28,6 @@ #include "fs/virtfs/zipreader.h" #include "utils/checkutils.h" -#include "utils/delete2.h" #ifndef UNITTESTS_CATCH #include <algorithm> @@ -39,7 +38,6 @@ TEST_CASE("throw VirtFs1 exists1", "") { VirtFs::init("."); - logger = new Logger(); const bool dir1 = VirtFs::mountDirSilent("data/", Append_false); VirtFs::mountDirSilent("..\\data", @@ -64,13 +62,11 @@ TEST_CASE("throw VirtFs1 exists1", "") REQUIRE_THROWS(VirtFs::exists("test/../units.xml")); VirtFs::deinit(); - delete2(logger); } TEST_CASE("throw VirtFs1 exists2", "") { VirtFs::init("."); - logger = new Logger(); const bool dir1 = VirtFs::mountDirSilent2("data/", "test", Append_false); @@ -99,36 +95,27 @@ TEST_CASE("throw VirtFs1 exists2", "") REQUIRE_THROWS(VirtFs::exists("test/../units.xml")); VirtFs::deinit(); - delete2(logger); } TEST_CASE("throw Zip readCompressedFile", "") { - logger = new Logger(); SECTION("empty") { REQUIRE_THROWS(VirtFs::ZipReader::readCompressedFile(nullptr)); } - - delete2(logger); } TEST_CASE("throw Zip readFile", "") { - logger = new Logger(); - SECTION("empty") { REQUIRE_THROWS(VirtFs::ZipReader::readFile(nullptr)); } - - delete2(logger); } TEST_CASE("throw VirtFs1 unmount", "") { VirtFs::init("."); - logger = new Logger(); const std::string sep = dirSeparator; SECTION("simple 1") @@ -218,13 +205,10 @@ TEST_CASE("throw VirtFs1 unmount", "") } VirtFs::deinit(); - delete2(logger); } TEST_CASE("throw configuration tests", "configuration") { - logger = new Logger(); - Dirs::initRootDir(); Dirs::initHomeDir(); @@ -238,6 +222,4 @@ TEST_CASE("throw configuration tests", "configuration") REQUIRE_THROWS(config.getStringValue(key)); REQUIRE_THROWS(config.getBoolValue(key)); } - - delete2(logger); } diff --git a/src/unittests/fs/virtfs/virtfs.cc b/src/unittests/fs/virtfs/virtfs.cc index c31f0965e..64f93c8f4 100644 --- a/src/unittests/fs/virtfs/virtfs.cc +++ b/src/unittests/fs/virtfs/virtfs.cc @@ -27,7 +27,6 @@ #include "fs/virtfs/list.h" #include "utils/checkutils.h" -#include "utils/delete2.h" #include "utils/foreach.h" #ifndef UNITTESTS_CATCH @@ -57,7 +56,6 @@ TEST_CASE("VirtFs getUserDir", "") TEST_CASE("VirtFs exists1", "") { - logger = new Logger(); VirtFs::mountDirSilent("data", Append_false); VirtFs::mountDirSilent("../data", Append_false); @@ -93,12 +91,10 @@ TEST_CASE("VirtFs exists1", "") VirtFs::unmountDirSilent("data"); VirtFs::unmountDirSilent("../data"); - delete2(logger); } TEST_CASE("VirtFs exists2", "") { - logger = new Logger(); std::string name("data/test/test.zip"); std::string prefix; if (Files::existsLocal(name) == false) @@ -117,12 +113,10 @@ TEST_CASE("VirtFs exists2", "") REQUIRE(VirtFs::exists("units.xml2") == false); VirtFs::unmountZip(prefix + "data/test/test2.zip"); - delete2(logger); } TEST_CASE("VirtFs exists3", "") { - logger = new Logger(); std::string name("data/test/test.zip"); std::string prefix; if (Files::existsLocal(name) == false) @@ -145,12 +139,10 @@ TEST_CASE("VirtFs exists3", "") VirtFs::unmountZip(prefix + "data/test/test.zip"); VirtFs::unmountZip(prefix + "data/test/test2.zip"); - delete2(logger); } TEST_CASE("VirtFs exists4", "") { - logger = new Logger(); std::string name("data/test/test.zip"); std::string prefix; if (Files::existsLocal(name) == false) @@ -177,12 +169,10 @@ TEST_CASE("VirtFs exists4", "") VirtFs::unmountZip(prefix + "data/test/test.zip"); VirtFs::unmountDirSilent(prefix + "data/test"); - delete2(logger); } TEST_CASE("VirtFs exists5", "") { - logger = new Logger(); std::string name("data/test/test.zip"); std::string prefix; if (Files::existsLocal(name) == false) @@ -191,13 +181,10 @@ TEST_CASE("VirtFs exists5", "") const std::string realDir = getRealPath(prefix + "data"); logger->log("real dir: " + realDir); REQUIRE_FALSE(VirtFs::exists(realDir)); - - delete2(logger); } TEST_CASE("VirtFs exists6", "") { - logger = new Logger(); std::string name("data/test/test.zip"); std::string prefix; if (Files::existsLocal(name) == false) @@ -223,7 +210,6 @@ TEST_CASE("VirtFs exists6", "") VirtFs::unmountZip2(prefix + "data/test/test2.zip", "dir"); - delete2(logger); } static void removeTemp(StringVect &restrict list) @@ -265,8 +251,6 @@ static bool inList(const VirtFs::List *const list, TEST_CASE("VirtFs enumerateFiles1", "") { - logger = new Logger; - VirtFs::mountDirSilent("data", Append_false); VirtFs::mountDirSilent("../data", Append_false); @@ -301,13 +285,10 @@ TEST_CASE("VirtFs enumerateFiles1", "") VirtFs::unmountDirSilent("data"); VirtFs::unmountDirSilent("../data"); - delete2(logger); } TEST_CASE("VirtFs enumerateFiles2", "") { - logger = new Logger; - VirtFs::mountDirSilent("data/test/dir1", Append_false); VirtFs::mountDirSilent("../data/test/dir1", @@ -321,12 +302,10 @@ TEST_CASE("VirtFs enumerateFiles2", "") VirtFs::unmountDirSilent("data/test/dir1"); VirtFs::unmountDirSilent("../data/test/dir1"); - delete2(logger); } TEST_CASE("VirtFs enumerateFiles3", "") { - logger = new Logger; std::string name("data/test/test.zip"); std::string prefix; if (Files::existsLocal(name) == false) @@ -343,12 +322,10 @@ TEST_CASE("VirtFs enumerateFiles3", "") VirtFs::freeList(list); VirtFs::unmountZip(prefix + "data/test/test.zip"); - delete2(logger); } TEST_CASE("VirtFs enumerateFiles4", "") { - logger = new Logger; std::string name("data/test/test.zip"); std::string prefix; if (Files::existsLocal(name) == false) @@ -368,12 +345,10 @@ TEST_CASE("VirtFs enumerateFiles4", "") VirtFs::freeList(list); VirtFs::unmountZip(prefix + "data/test/test2.zip"); - delete2(logger); } TEST_CASE("VirtFs enumerateFiles5", "") { - logger = new Logger; std::string name("data/test/test.zip"); std::string prefix; if (Files::existsLocal(name) == false) @@ -396,12 +371,10 @@ TEST_CASE("VirtFs enumerateFiles5", "") VirtFs::unmountZip(prefix + "data/test/test2.zip"); VirtFs::unmountDirSilent(prefix + "data/test"); - delete2(logger); } TEST_CASE("VirtFs isDirectory1", "") { - logger = new Logger(); VirtFs::mountDirSilent("data", Append_false); VirtFs::mountDirSilent("../data", Append_false); @@ -454,12 +427,10 @@ TEST_CASE("VirtFs isDirectory1", "") VirtFs::unmountDirSilent("data"); VirtFs::unmountDirSilent("../data"); - delete2(logger); } TEST_CASE("VirtFs isDirectory2", "") { - logger = new Logger(); std::string name("data/test/test.zip"); std::string prefix; if (Files::existsLocal(name) == false) @@ -476,12 +447,10 @@ TEST_CASE("VirtFs isDirectory2", "") REQUIRE(VirtFs::isDirectory("test.txt") == false); VirtFs::unmountZip(prefix + "data/test/test2.zip"); - delete2(logger); } TEST_CASE("VirtFs isDirectory3", "") { - logger = new Logger(); std::string name("data/test/test.zip"); std::string prefix; if (Files::existsLocal(name) == false) @@ -503,12 +472,10 @@ TEST_CASE("VirtFs isDirectory3", "") VirtFs::unmountZip(prefix + "data/test/test2.zip"); VirtFs::unmountDir(prefix + "data"); - delete2(logger); } TEST_CASE("VirtFs openRead1", "") { - logger = new Logger(); VirtFs::mountDirSilent("data", Append_false); VirtFs::mountDirSilent("../data", Append_false); @@ -565,12 +532,10 @@ TEST_CASE("VirtFs openRead1", "") VirtFs::unmountDirSilent("data"); VirtFs::unmountDirSilent("../data"); - delete2(logger); } TEST_CASE("VirtFs openRead2", "") { - logger = new Logger(); std::string name("data/test/test.zip"); std::string prefix; if (Files::existsLocal(name) == false) @@ -593,12 +558,10 @@ TEST_CASE("VirtFs openRead2", "") VirtFs::close(file); VirtFs::unmountZip(prefix + "data/test/test2.zip"); - delete2(logger); } TEST_CASE("VirtFs openRead3", "") { - logger = new Logger(); std::string name("data/test/test.zip"); std::string prefix; if (Files::existsLocal(name) == false) @@ -628,12 +591,10 @@ TEST_CASE("VirtFs openRead3", "") VirtFs::unmountZip(prefix + "data/test/test2.zip"); VirtFs::unmountDir(prefix + "data/test"); - delete2(logger); } TEST_CASE("VirtFs getRealDir1", "") { - logger = new Logger(); const std::string sep = dirSeparator; REQUIRE(VirtFs::getRealDir(".").empty()); REQUIRE(VirtFs::getRealDir("..").empty()); @@ -719,12 +680,10 @@ TEST_CASE("VirtFs getRealDir1", "") VirtFs::unmountZip("data/test/test.zip"); else VirtFs::unmountZip("../data/test/test.zip"); - delete2(logger); } TEST_CASE("VirtFs getrealDir2", "") { - logger = new Logger(); const std::string sep = dirSeparator; std::string name("data/test/test.zip"); std::string prefix; @@ -749,12 +708,10 @@ TEST_CASE("VirtFs getrealDir2", "") VirtFs::unmountZip(prefix + "data/test/test2.zip"); VirtFs::unmountDir(prefix + "data/test"); VirtFs::unmountDir(prefix + "data"); - delete2(logger); } TEST_CASE("VirtFs getrealDir3", "") { - logger = new Logger(); const std::string sep = dirSeparator; std::string name("data/test/test.zip"); std::string prefix; @@ -780,12 +737,10 @@ TEST_CASE("VirtFs getrealDir3", "") VirtFs::unmountZip2(prefix + "data/test/test2.zip", "dir"); VirtFs::unmountDir(prefix + "data/test"); - delete2(logger); } TEST_CASE("VirtFs permitLinks1", "") { - logger = new Logger(); VirtFs::mountDirSilent("data", Append_false); VirtFs::mountDirSilent("../data", Append_false); @@ -813,12 +768,10 @@ TEST_CASE("VirtFs permitLinks1", "") VirtFs::unmountDirSilent("data"); VirtFs::unmountDirSilent("../data"); - delete2(logger); } TEST_CASE("VirtFs permitLinks2", "") { - logger = new Logger(); VirtFs::mountDirSilent2("data", "test", Append_false); @@ -852,12 +805,10 @@ TEST_CASE("VirtFs permitLinks2", "") "test"); VirtFs::unmountDirSilent2("../data", "test"); - delete2(logger); } TEST_CASE("VirtFs read1", "") { - logger = new Logger(); VirtFs::mountDirSilent("data", Append_false); VirtFs::mountDirSilent("../data", Append_false); @@ -888,12 +839,10 @@ TEST_CASE("VirtFs read1", "") VirtFs::unmountDirSilent("data"); VirtFs::unmountDirSilent("../data"); - delete2(logger); } TEST_CASE("VirtFs read2", "") { - logger = new Logger(); std::string name("data/test/test.zip"); std::string prefix; if (Files::existsLocal(name) == false) @@ -927,12 +876,10 @@ TEST_CASE("VirtFs read2", "") free(buffer); VirtFs::unmountZip(prefix + "data/test/test2.zip"); - delete2(logger); } TEST_CASE("VirtFs read3", "") { - logger = new Logger(); std::string name("data/test/test.zip"); std::string prefix; if (Files::existsLocal(name) == false) @@ -968,12 +915,10 @@ TEST_CASE("VirtFs read3", "") VirtFs::unmountZip(prefix + "data/test/test2.zip"); VirtFs::unmountDir(prefix + "data"); - delete2(logger); } TEST_CASE("VirtFs read4", "") { - logger = new Logger(); std::string name("data/test/test.zip"); std::string prefix; if (Files::existsLocal(name) == false) @@ -1009,12 +954,10 @@ TEST_CASE("VirtFs read4", "") VirtFs::unmountZip(prefix + "data/test/test5.zip"); VirtFs::unmountDir(prefix + "data/test"); - delete2(logger); } TEST_CASE("VirtFs read5", "") { - logger = new Logger(); std::string name("data/test/test.zip"); std::string prefix; if (Files::existsLocal(name) == false) @@ -1050,5 +993,4 @@ TEST_CASE("VirtFs read5", "") VirtFs::unmountZip(prefix + "data/test/test5.zip"); VirtFs::unmountDir(prefix + "data/test"); - delete2(logger); } diff --git a/src/unittests/fs/virtfs/virtfs1_enumerate.cc b/src/unittests/fs/virtfs/virtfs1_enumerate.cc index 1cbc5239b..4eb79e673 100644 --- a/src/unittests/fs/virtfs/virtfs1_enumerate.cc +++ b/src/unittests/fs/virtfs/virtfs1_enumerate.cc @@ -26,7 +26,6 @@ #include "fs/virtfs/list.h" #include "utils/checkutils.h" -#include "utils/delete2.h" #include "utils/foreach.h" #ifndef UNITTESTS_CATCH @@ -75,7 +74,6 @@ static bool inList(const VirtFs::List *const list, TEST_CASE("VirtFs1 enumerateFiles1", "") { VirtFs::init("."); - logger = new Logger; VirtFs::mountDirSilent("data", Append_false); @@ -114,13 +112,11 @@ TEST_CASE("VirtFs1 enumerateFiles1", "") VirtFs::unmountDirSilent("data"); VirtFs::unmountDirSilent("../data"); VirtFs::deinit(); - delete2(logger); } TEST_CASE("VirtFs1 enumerateFiles2", "") { VirtFs::init("."); - logger = new Logger; VirtFs::mountDirSilent("data/test/dir1", Append_false); @@ -135,13 +131,11 @@ TEST_CASE("VirtFs1 enumerateFiles2", "") REQUIRE_FALSE(inList(list, "file2.txt")); VirtFs::freeList(list); VirtFs::deinit(); - delete2(logger); } TEST_CASE("VirtFs1 enumerateFiles3", "") { VirtFs::init("."); - logger = new Logger; VirtFs::mountDirSilent("data/test/dir1", Append_false); @@ -159,13 +153,11 @@ TEST_CASE("VirtFs1 enumerateFiles3", "") REQUIRE(inList(list, "file2.txt")); VirtFs::freeList(list); VirtFs::deinit(); - delete2(logger); } TEST_CASE("VirtFsZip enumerateFiles4", "") { VirtFs::init("."); - logger = new Logger; std::string name("data/test/test.zip"); std::string prefix("data\\test/"); if (Files::existsLocal(name) == false) @@ -184,13 +176,11 @@ TEST_CASE("VirtFsZip enumerateFiles4", "") VirtFs::unmountZip(prefix + "test.zip"); VirtFs::deinit(); - delete2(logger); } TEST_CASE("VirtFsZip enumerateFiles5", "") { VirtFs::init("."); - logger = new Logger; std::string name("data/test/test.zip"); std::string prefix("data//test/"); if (Files::existsLocal(name) == false) @@ -220,13 +210,11 @@ TEST_CASE("VirtFsZip enumerateFiles5", "") VirtFs::unmountZip(prefix + "test.zip"); VirtFs::unmountZip(prefix + "test2.zip"); VirtFs::deinit(); - delete2(logger); } TEST_CASE("VirtFsZip enumerateFiles6", "") { VirtFs::init("."); - logger = new Logger; std::string name("data/test/test.zip"); std::string prefix("data\\test/"); if (Files::existsLocal(name) == false) @@ -244,13 +232,11 @@ TEST_CASE("VirtFsZip enumerateFiles6", "") VirtFs::unmountZip(prefix + "test.zip"); VirtFs::deinit(); - delete2(logger); } TEST_CASE("VirtFsZip enumerateFiles7", "") { VirtFs::init("."); - logger = new Logger; std::string name("data/test/test.zip"); std::string prefix("data\\test/"); if (Files::existsLocal(name) == false) @@ -271,13 +257,11 @@ TEST_CASE("VirtFsZip enumerateFiles7", "") VirtFs::unmountZip(prefix + "test2.zip"); VirtFs::deinit(); - delete2(logger); } TEST_CASE("VirtFsZip enumerateFiles8", "") { VirtFs::init("."); - logger = new Logger; std::string name("data/test/test.zip"); std::string prefix; if (Files::existsLocal(name) == false) @@ -303,13 +287,11 @@ TEST_CASE("VirtFsZip enumerateFiles8", "") VirtFs::unmountZip(prefix + "data/test/test2.zip"); VirtFs::unmountDir(prefix + "data/test"); VirtFs::deinit(); - delete2(logger); } TEST_CASE("VirtFsZip enumerateFiles9", "") { VirtFs::init("."); - logger = new Logger; std::string name("data/test/test.zip"); std::string prefix; if (Files::existsLocal(name) == false) @@ -333,13 +315,11 @@ TEST_CASE("VirtFsZip enumerateFiles9", "") VirtFs::unmountZip(prefix + "data/test/test2.zip"); VirtFs::unmountDir(prefix + "data/test"); VirtFs::deinit(); - delete2(logger); } TEST_CASE("VirtFsZip enumerateFiles10", "") { VirtFs::init("."); - logger = new Logger; std::string name("data/test/test.zip"); std::string prefix("data\\test/"); if (Files::existsLocal(name) == false) @@ -360,13 +340,11 @@ TEST_CASE("VirtFsZip enumerateFiles10", "") VirtFs::unmountZip2(prefix + "test.zip", "dir"); VirtFs::deinit(); - delete2(logger); } TEST_CASE("VirtFsZip enumerateFiles11", "") { VirtFs::init("."); - logger = new Logger; std::string name("data/test/test.zip"); std::string prefix("data\\test/"); if (Files::existsLocal(name) == false) @@ -387,13 +365,11 @@ TEST_CASE("VirtFsZip enumerateFiles11", "") VirtFs::unmountZip2(prefix + "test2.zip", "dir"); VirtFs::deinit(); - delete2(logger); } TEST_CASE("VirtFs1 enumerateFiles12", "") { VirtFs::init("."); - logger = new Logger; VirtFs::mountDirSilent2("data/test", "dir2", @@ -410,13 +386,11 @@ TEST_CASE("VirtFs1 enumerateFiles12", "") VirtFs::freeList(list); VirtFs::deinit(); - delete2(logger); } TEST_CASE("VirtFs1 enumerateFiles13", "") { VirtFs::init("."); - logger = new Logger; VirtFs::mountDirSilent2("data", "test", @@ -433,5 +407,4 @@ TEST_CASE("VirtFs1 enumerateFiles13", "") VirtFs::freeList(list); VirtFs::deinit(); - delete2(logger); } diff --git a/src/unittests/fs/virtfs/virtfs1_exists.cc b/src/unittests/fs/virtfs/virtfs1_exists.cc index 8f33d11d3..24f3e19f2 100644 --- a/src/unittests/fs/virtfs/virtfs1_exists.cc +++ b/src/unittests/fs/virtfs/virtfs1_exists.cc @@ -23,7 +23,6 @@ #include "fs/virtfs/fs.h" #include "utils/checkutils.h" -#include "utils/delete2.h" #ifndef UNITTESTS_CATCH #include <algorithm> @@ -34,7 +33,6 @@ TEST_CASE("VirtFs1 exists1", "") { VirtFs::init("."); - logger = new Logger(); const bool dir1 = VirtFs::mountDirSilent("data/", Append_false); VirtFs::mountDirSilent("..\\data", @@ -86,13 +84,11 @@ TEST_CASE("VirtFs1 exists1", "") REQUIRE(VirtFs::exists("units.xml/") == false); VirtFs::deinit(); - delete2(logger); } TEST_CASE("VirtFs1 exists2", "") { VirtFs::init("."); - logger = new Logger(); const bool dir1 = VirtFs::mountDirSilent2("data/", "test", Append_false); @@ -155,5 +151,4 @@ TEST_CASE("VirtFs1 exists2", "") REQUIRE(VirtFs::exists("file2.txt") == false); VirtFs::deinit(); - delete2(logger); } diff --git a/src/unittests/fs/virtfs/virtfs1_getrealdir.cc b/src/unittests/fs/virtfs/virtfs1_getrealdir.cc index ea0d3ccb0..ca58a993e 100644 --- a/src/unittests/fs/virtfs/virtfs1_getrealdir.cc +++ b/src/unittests/fs/virtfs/virtfs1_getrealdir.cc @@ -25,7 +25,6 @@ #include "fs/virtfs/fs.h" #include "utils/checkutils.h" -#include "utils/delete2.h" #ifndef UNITTESTS_CATCH #include <algorithm> @@ -36,7 +35,6 @@ TEST_CASE("VirtFs1 getRealDir1", "") { VirtFs::init("."); - logger = new Logger(); const std::string sep = dirSeparator; REQUIRE(VirtFs::getRealDir(".").empty()); REQUIRE(VirtFs::getRealDir("..").empty()); @@ -112,13 +110,11 @@ TEST_CASE("VirtFs1 getRealDir1", "") VirtFs::unmountDirSilent("data"); VirtFs::unmountDirSilent("../data"); VirtFs::deinit(); - delete2(logger); } TEST_CASE("VirtFs1 getRealDir2", "") { VirtFs::init("."); - logger = new Logger(); const std::string sep = dirSeparator; std::string name("data/test/test.zip"); std::string prefix("data" + sep + "test" + sep); @@ -155,13 +151,11 @@ TEST_CASE("VirtFs1 getRealDir2", "") VirtFs::unmountZip(prefix + "test2.zip"); VirtFs::deinit(); - delete2(logger); } TEST_CASE("VirtFs1 getRealDir3", "") { VirtFs::init("."); - logger = new Logger(); const std::string sep = dirSeparator; REQUIRE(VirtFs::getRealDir(".").empty()); REQUIRE(VirtFs::getRealDir("..").empty()); @@ -205,5 +199,4 @@ TEST_CASE("VirtFs1 getRealDir3", "") REQUIRE(VirtFs::getRealDir("zzz").empty()); VirtFs::deinit(); - delete2(logger); } diff --git a/src/unittests/fs/virtfs/virtfs1_mountdir.cc b/src/unittests/fs/virtfs/virtfs1_mountdir.cc index 6de4f68d9..a4a9dd648 100644 --- a/src/unittests/fs/virtfs/virtfs1_mountdir.cc +++ b/src/unittests/fs/virtfs/virtfs1_mountdir.cc @@ -24,7 +24,6 @@ #include "fs/virtfs/fs.h" #include "utils/checkutils.h" -#include "utils/delete2.h" #ifndef UNITTESTS_CATCH #include <algorithm> @@ -35,7 +34,6 @@ TEST_CASE("VirtFs1 mountDir", "") { VirtFs::init("."); - logger = new Logger(); const std::string sep = dirSeparator; SECTION("simple 1") { @@ -470,5 +468,4 @@ TEST_CASE("VirtFs1 mountDir", "") } VirtFs::deinit(); - delete2(logger); } diff --git a/src/unittests/fs/virtfs/virtfs1_mountzip.cc b/src/unittests/fs/virtfs/virtfs1_mountzip.cc index 66b1c4e19..5cd0cda17 100644 --- a/src/unittests/fs/virtfs/virtfs1_mountzip.cc +++ b/src/unittests/fs/virtfs/virtfs1_mountzip.cc @@ -26,7 +26,6 @@ #include "fs/virtfs/fs.h" #include "utils/checkutils.h" -#include "utils/delete2.h" #ifndef UNITTESTS_CATCH #include <algorithm> @@ -37,7 +36,6 @@ TEST_CASE("VirtFs1 mountZip", "") { VirtFs::init("."); - logger = new Logger(); std::string name("data/test/test.zip"); std::string prefix; const std::string sep = dirSeparator; @@ -328,5 +326,4 @@ TEST_CASE("VirtFs1 mountZip", "") } VirtFs::deinit(); - delete2(logger); } diff --git a/src/unittests/fs/virtfs/virtfs1_unmount.cc b/src/unittests/fs/virtfs/virtfs1_unmount.cc index 61204ef27..b1c7a1033 100644 --- a/src/unittests/fs/virtfs/virtfs1_unmount.cc +++ b/src/unittests/fs/virtfs/virtfs1_unmount.cc @@ -26,7 +26,6 @@ #include "fs/virtfs/fs.h" #include "utils/checkutils.h" -#include "utils/delete2.h" #ifndef UNITTESTS_CATCH #include <algorithm> @@ -37,7 +36,6 @@ TEST_CASE("VirtFs1 unmount", "") { VirtFs::init("."); - logger = new Logger(); std::string name("data/test/test.zip"); std::string prefix; const std::string sep = dirSeparator; @@ -376,5 +374,4 @@ TEST_CASE("VirtFs1 unmount", "") } VirtFs::deinit(); - delete2(logger); } diff --git a/src/unittests/fs/virtfs/virtfs2.cc b/src/unittests/fs/virtfs/virtfs2.cc index 8e578cc71..a1a1050aa 100644 --- a/src/unittests/fs/virtfs/virtfs2.cc +++ b/src/unittests/fs/virtfs/virtfs2.cc @@ -26,7 +26,6 @@ #include "fs/virtfs/rwops.h" #include "utils/checkutils.h" -#include "utils/delete2.h" #include "utils/foreach.h" #include "utils/stringutils.h" @@ -94,7 +93,6 @@ static void removeTemp(StringVect &restrict list) TEST_CASE("VirtFs2 isDirectory1", "") { VirtFs::init("."); - logger = new Logger(); std::string name("data/test/test.zip"); std::string prefix; if (Files::existsLocal(name) == false) @@ -152,13 +150,11 @@ TEST_CASE("VirtFs2 isDirectory1", "") VirtFs::unmountDirSilent(prefix + "data"); VirtFs::deinit(); - delete2(logger); } TEST_CASE("VirtFs2 isDirectory2", "") { VirtFs::init("."); - logger = new Logger(); std::string name("data/test/test.zip"); std::string prefix; if (Files::existsLocal(name) == false) @@ -237,13 +233,11 @@ TEST_CASE("VirtFs2 isDirectory2", "") VirtFs::unmountZip(prefix + "data/test/test.zip"); VirtFs::deinit(); - delete2(logger); } TEST_CASE("VirtFs2 isDirectory3", "") { VirtFs::init("."); - logger = new Logger(); std::string name("data/test/test.zip"); std::string prefix; if (Files::existsLocal(name) == false) @@ -269,13 +263,11 @@ TEST_CASE("VirtFs2 isDirectory3", "") VirtFs::unmountDirSilent2(prefix + "data", "test"); VirtFs::deinit(); - delete2(logger); } TEST_CASE("VirtFs2 isDirectory4", "") { VirtFs::init("."); - logger = new Logger(); std::string name("data/test/test.zip"); std::string prefix; if (Files::existsLocal(name) == false) @@ -306,13 +298,11 @@ TEST_CASE("VirtFs2 isDirectory4", "") VirtFs::unmountZip2(prefix + "data/test/test2.zip", "dir"); VirtFs::deinit(); - delete2(logger); } TEST_CASE("VirtFs2 openRead1", "") { VirtFs::init("."); - logger = new Logger(); std::string name("data/test/test.zip"); std::string prefix; if (Files::existsLocal(name) == false) @@ -370,13 +360,11 @@ TEST_CASE("VirtFs2 openRead1", "") VirtFs::unmountDir(prefix + "data"); VirtFs::deinit(); - delete2(logger); } TEST_CASE("VirtFs2 openRead2", "") { VirtFs::init("."); - logger = new Logger(); std::string name("data/test/test.zip"); std::string prefix("data/test/"); if (Files::existsLocal(name) == false) @@ -449,13 +437,11 @@ TEST_CASE("VirtFs2 openRead2", "") VirtFs::unmountZip(prefix + "test2.zip"); VirtFs::deinit(); - delete2(logger); } TEST_CASE("VirtFs2 openRead3", "") { VirtFs::init("."); - logger = new Logger(); std::string name("data/test/test.zip"); std::string prefix; if (Files::existsLocal(name) == false) @@ -527,13 +513,11 @@ TEST_CASE("VirtFs2 openRead3", "") VirtFs::unmountDir2(prefix + "data", "test"); VirtFs::deinit(); - delete2(logger); } TEST_CASE("VirtFs2 openRead4", "") { VirtFs::init("."); - logger = new Logger(); std::string name("data/test/test.zip"); std::string prefix("data/test/"); if (Files::existsLocal(name) == false) @@ -608,13 +592,11 @@ TEST_CASE("VirtFs2 openRead4", "") "dir"); VirtFs::deinit(); - delete2(logger); } TEST_CASE("VirtFs2 permitLinks", "") { VirtFs::init("."); - logger = new Logger(); std::string name("data/test/test.zip"); std::string prefix; if (Files::existsLocal(name) == false) @@ -647,13 +629,11 @@ TEST_CASE("VirtFs2 permitLinks", "") VirtFs::unmountDirSilent(prefix + "data"); VirtFs::deinit(); - delete2(logger); } TEST_CASE("VirtFs2 read1", "") { VirtFs::init("."); - logger = new Logger(); std::string name("data/test/test.zip"); std::string prefix; if (Files::existsLocal(name) == false) @@ -689,13 +669,11 @@ TEST_CASE("VirtFs2 read1", "") VirtFs::unmountDir(prefix + "data"); VirtFs::deinit(); - delete2(logger); } TEST_CASE("VirtFs2 read2", "") { VirtFs::init("."); - logger = new Logger(); std::string name("data/test/test.zip"); std::string prefix("data/test/"); if (Files::existsLocal(name) == false) @@ -820,14 +798,12 @@ TEST_CASE("VirtFs2 read2", "") free(buffer); VirtFs::unmountZip(prefix + "test2.zip"); VirtFs::deinit(); - delete2(logger); } TEST_CASE("VirtFs2 loadFile1", "") { VirtFs::init("."); int fileSize = 0; - logger = new Logger(); std::string name("data/test/test.zip"); std::string prefix; if (Files::existsLocal(name) == false) @@ -844,14 +820,12 @@ TEST_CASE("VirtFs2 loadFile1", "") VirtFs::unmountDir(prefix + "data"); VirtFs::deinit(); - delete2(logger); } TEST_CASE("VirtFs2 loadFile2", "") { VirtFs::init("."); int fileSize = 0; - logger = new Logger(); std::string name("data/test/test.zip"); std::string prefix; if (Files::existsLocal(name) == false) @@ -882,14 +856,12 @@ TEST_CASE("VirtFs2 loadFile2", "") VirtFs::unmountZip(prefix + "data/test/test2.zip"); VirtFs::deinit(); - delete2(logger); } TEST_CASE("VirtFs2 loadFile3", "") { VirtFs::init("."); int fileSize = 0; - logger = new Logger(); std::string name("data/test/test.zip"); std::string prefix; if (Files::existsLocal(name) == false) @@ -908,14 +880,12 @@ TEST_CASE("VirtFs2 loadFile3", "") VirtFs::unmountDir2(prefix + "data", "test"); VirtFs::deinit(); - delete2(logger); } TEST_CASE("VirtFs2 loadFile4", "") { VirtFs::init("."); int fileSize = 0; - logger = new Logger(); std::string name("data/test/test.zip"); std::string prefix; if (Files::existsLocal(name) == false) @@ -948,13 +918,11 @@ TEST_CASE("VirtFs2 loadFile4", "") VirtFs::unmountZip2(prefix + "data/test/test2.zip", "dir2"); VirtFs::deinit(); - delete2(logger); } TEST_CASE("VirtFs2 rwops_read1", "") { VirtFs::init("."); - logger = new Logger(); std::string name("data/test/test.zip"); std::string prefix; if (Files::existsLocal(name) == false) @@ -990,13 +958,11 @@ TEST_CASE("VirtFs2 rwops_read1", "") VirtFs::unmountDir(prefix + "data"); VirtFs::deinit(); - delete2(logger); } TEST_CASE("VirtFs2 rwops_read2", "") { VirtFs::init("."); - logger = new Logger(); std::string name("data/test/test.zip"); std::string prefix("data/test/"); if (Files::existsLocal(name) == false) @@ -1163,13 +1129,11 @@ TEST_CASE("VirtFs2 rwops_read2", "") free(buffer); VirtFs::unmountZip(prefix + "test2.zip"); VirtFs::deinit(); - delete2(logger); } TEST_CASE("VirtFs2 rwops_read3", "") { VirtFs::init("."); - logger = new Logger(); std::string name("data/test/test.zip"); std::string prefix; if (Files::existsLocal(name) == false) @@ -1336,13 +1300,11 @@ TEST_CASE("VirtFs2 rwops_read3", "") free(buffer); VirtFs::unmountDir(prefix + "data"); VirtFs::deinit(); - delete2(logger); } TEST_CASE("VirtFs2 getFiles zip1", "") { VirtFs::init("."); - logger = new Logger(); std::string name("data/test/test.zip"); std::string prefix; if (Files::existsLocal(name) == false) @@ -1367,13 +1329,11 @@ TEST_CASE("VirtFs2 getFiles zip1", "") VirtFs::unmountZip(prefix + "data/test/test2.zip"); VirtFs::deinit(); - delete2(logger); } TEST_CASE("VirtFs2 getFiles zip2", "") { VirtFs::init("."); - logger = new Logger(); std::string name("data/test/test.zip"); std::string prefix; if (Files::existsLocal(name) == false) @@ -1398,13 +1358,11 @@ TEST_CASE("VirtFs2 getFiles zip2", "") VirtFs::unmountZip2(prefix + "data/test/test2.zip", "dir"); VirtFs::deinit(); - delete2(logger); } TEST_CASE("VirtFs2 getDirs1", "") { VirtFs::init("."); - logger = new Logger(); std::string name("data/test/test.zip"); std::string prefix; if (Files::existsLocal(name) == false) @@ -1425,13 +1383,11 @@ TEST_CASE("VirtFs2 getDirs1", "") VirtFs::unmountZip(prefix + "data/test/test2.zip"); VirtFs::deinit(); - delete2(logger); } TEST_CASE("VirtFs2 getDirs2", "") { VirtFs::init("."); - logger = new Logger(); std::string name("data/test/test.zip"); std::string prefix; if (Files::existsLocal(name) == false) @@ -1473,13 +1429,11 @@ TEST_CASE("VirtFs2 getDirs2", "") } VirtFs::deinit(); - delete2(logger); } TEST_CASE("VirtFs2 getDirs3", "") { VirtFs::init("."); - logger = new Logger(); std::string name("data/test/test.zip"); std::string prefix; if (Files::existsLocal(name) == false) @@ -1502,13 +1456,11 @@ TEST_CASE("VirtFs2 getDirs3", "") VirtFs::unmountZip2(prefix + "data/test/test2.zip", "dir"); VirtFs::deinit(); - delete2(logger); } TEST_CASE("VirtFs2 getDirs4", "") { VirtFs::init("."); - logger = new Logger(); std::string name("data/test/test.zip"); std::string prefix; if (Files::existsLocal(name) == false) @@ -1534,13 +1486,11 @@ TEST_CASE("VirtFs2 getDirs4", "") } VirtFs::deinit(); - delete2(logger); } TEST_CASE("VirtFs2 getFilesWithDir1", "") { VirtFs::init("."); - logger = new Logger(); std::string name("data/test/test.zip"); std::string prefix; if (Files::existsLocal(name) == false) @@ -1572,13 +1522,11 @@ TEST_CASE("VirtFs2 getFilesWithDir1", "") VirtFs::unmountZip(prefix + "data/test/test2.zip"); VirtFs::deinit(); - delete2(logger); } TEST_CASE("VirtFs2 getFilesWithDir2", "") { VirtFs::init("."); - logger = new Logger(); std::string name("data/test/test.zip"); std::string prefix; if (Files::existsLocal(name) == false) @@ -1622,13 +1570,11 @@ TEST_CASE("VirtFs2 getFilesWithDir2", "") } VirtFs::deinit(); - delete2(logger); } TEST_CASE("VirtFs2 getFilesWithDir3", "") { VirtFs::init("."); - logger = new Logger(); std::string name("data/test/test.zip"); std::string prefix; if (Files::existsLocal(name) == false) @@ -1654,13 +1600,11 @@ TEST_CASE("VirtFs2 getFilesWithDir3", "") VirtFs::unmountZip2(prefix + "data/test/test2.zip", "dir"); VirtFs::deinit(); - delete2(logger); } TEST_CASE("VirtFs2 getFilesWithDir4", "") { VirtFs::init("."); - logger = new Logger(); std::string name("data/test/test.zip"); std::string prefix; if (Files::existsLocal(name) == false) @@ -1696,5 +1640,4 @@ TEST_CASE("VirtFs2 getFilesWithDir4", "") } VirtFs::deinit(); - delete2(logger); } diff --git a/src/unittests/fs/virtfs/zip.cc b/src/unittests/fs/virtfs/zip.cc index 50e0b2672..17491835e 100644 --- a/src/unittests/fs/virtfs/zip.cc +++ b/src/unittests/fs/virtfs/zip.cc @@ -29,15 +29,12 @@ #include "fs/virtfs/zipreader.h" #include "fs/virtfs/ziplocalheader.h" -#include "utils/delete2.h" - #include "debug.h" extern const char *dirSeparator; TEST_CASE("Zip readArchiveInfo", "") { - logger = new Logger(); std::string name("data/test/test.zip"); std::string prefix; const std::string sep = dirSeparator; @@ -166,13 +163,10 @@ TEST_CASE("Zip readArchiveInfo", "") delete entry; } - - delete2(logger); } TEST_CASE("Zip readCompressedFile", "") { - logger = new Logger(); std::string name("data/test/test.zip"); std::string prefix; if (Files::existsLocal(name) == false) @@ -196,13 +190,10 @@ TEST_CASE("Zip readCompressedFile", "") delete [] buf; delete entry; } - - delete2(logger); } TEST_CASE("Zip readFile", "") { - logger = new Logger(); std::string name("data/test/test.zip"); std::string prefix; if (Files::existsLocal(name) == false) @@ -289,6 +280,4 @@ TEST_CASE("Zip readFile", "") } delete entry; } - - delete2(logger); } diff --git a/src/unittests/gui/widgets/browserbox.cc b/src/unittests/gui/widgets/browserbox.cc index 7e4689707..88f2f8b92 100644 --- a/src/unittests/gui/widgets/browserbox.cc +++ b/src/unittests/gui/widgets/browserbox.cc @@ -50,7 +50,6 @@ TEST_CASE("BrowserBox tests", "browserbox") setEnv("SDL_VIDEODRIVER", "dummy"); client = new Client; - logger = new Logger(); VirtFs::mountDirSilent("data", Append_false); VirtFs::mountDirSilent("../data", Append_false); @@ -186,6 +185,4 @@ TEST_CASE("BrowserBox tests", "browserbox") delete2(client); VirtFs::unmountDirSilent("data"); VirtFs::unmountDirSilent("../data"); - delete2(logger); -// VirtFs::deinit(); } diff --git a/src/unittests/gui/windowmanager.cc b/src/unittests/gui/windowmanager.cc index 108ae18d0..bed0de6a1 100644 --- a/src/unittests/gui/windowmanager.cc +++ b/src/unittests/gui/windowmanager.cc @@ -146,7 +146,6 @@ TEST_CASE("Windows tests", "windowmanager") client = new Client; XML::initXML(); SDL_Init(SDL_INIT_VIDEO); - logger = new Logger(); ResourceManager::deleteInstance(); ResourceManager::cleanOrphans(true); VirtFs::mountDirSilent("data", Append_false); @@ -819,9 +818,6 @@ TEST_CASE("Windows tests", "windowmanager") VirtFs::unmountDirSilent("../data"); VirtFs::unmountDirSilent("data/test"); VirtFs::unmountDirSilent("../data/test"); - delete2(logger); - -// VirtFs::deinit(); } TEST_CASE("WindowManager", "create windows") @@ -831,7 +827,6 @@ TEST_CASE("WindowManager", "create windows") client = new Client; XML::initXML(); SDL_Init(SDL_INIT_VIDEO); - logger = new Logger(); ResourceManager::deleteInstance(); ResourceManager::cleanOrphans(true); VirtFs::mountDirSilent("data", Append_false); @@ -977,7 +972,4 @@ TEST_CASE("WindowManager", "create windows") VirtFs::unmountDirSilent("../data"); VirtFs::unmountDirSilent("data/test"); VirtFs::unmountDirSilent("../data/test"); - delete2(logger); - -// VirtFs::deinit(); } diff --git a/src/unittests/integrity.cc b/src/unittests/integrity.cc index a750959dc..e45eb9f4e 100644 --- a/src/unittests/integrity.cc +++ b/src/unittests/integrity.cc @@ -114,7 +114,6 @@ TEST_CASE("integrity tests", "integrity") client = new Client; XML::initXML(); SDL_Init(SDL_INIT_VIDEO); - logger = new Logger(); std::string name("data/test/test.zip"); std::string prefix; if (Files::existsLocal(name) == false) @@ -358,7 +357,4 @@ TEST_CASE("integrity tests", "integrity") VirtFs::unmountDirSilent("data"); VirtFs::unmountDirSilent("../data"); - - delete2(logger); -// VirtFs::deinit(); } diff --git a/src/unittests/resources/dye/dye.cc b/src/unittests/resources/dye/dye.cc index 499e570ea..ada0f5d40 100644 --- a/src/unittests/resources/dye/dye.cc +++ b/src/unittests/resources/dye/dye.cc @@ -1958,7 +1958,6 @@ TEST_CASE("Dye real dye", "") client = new Client; SDL_Init(SDL_INIT_VIDEO); - logger = new Logger(); VirtFs::mountDirSilent("data", Append_false); VirtFs::mountDirSilent("../data", Append_false); VirtFs::mountDirSilent("data/test", Append_false); @@ -2012,6 +2011,4 @@ TEST_CASE("Dye real dye", "") VirtFs::unmountDirSilent("../data"); VirtFs::unmountDirSilent("data/test"); VirtFs::unmountDirSilent("../data/test"); - delete2(logger); -// VirtFs::deinit(); } diff --git a/src/unittests/resources/dye/dyepalette.cc b/src/unittests/resources/dye/dyepalette.cc index 7c49f02c1..47f7266a4 100644 --- a/src/unittests/resources/dye/dyepalette.cc +++ b/src/unittests/resources/dye/dyepalette.cc @@ -60,7 +60,6 @@ TEST_CASE("DyePalette tests", "") client = new Client; XML::initXML(); SDL_Init(SDL_INIT_VIDEO); - logger = new Logger(); VirtFs::mountDirSilent("data", Append_false); VirtFs::mountDirSilent("../data", Append_false); VirtFs::mountDirSilent("data/test", Append_false); @@ -397,6 +396,4 @@ TEST_CASE("DyePalette tests", "") VirtFs::unmountDirSilent("../data"); VirtFs::unmountDirSilent("data/test"); VirtFs::unmountDirSilent("../data/test"); - delete2(logger); -// VirtFs::deinit(); } diff --git a/src/unittests/resources/map/maplayer/draw.cc b/src/unittests/resources/map/maplayer/draw.cc index 5e6cfdddf..9b946b0c9 100644 --- a/src/unittests/resources/map/maplayer/draw.cc +++ b/src/unittests/resources/map/maplayer/draw.cc @@ -34,8 +34,6 @@ TEST_CASE("MapLayer draw", "") { - logger = new Logger; - Dirs::initRootDir(); Dirs::initHomeDir(); diff --git a/src/unittests/resources/map/maplayer/drawfringenormal.cc b/src/unittests/resources/map/maplayer/drawfringenormal.cc index 4ec72484b..15990d5f6 100644 --- a/src/unittests/resources/map/maplayer/drawfringenormal.cc +++ b/src/unittests/resources/map/maplayer/drawfringenormal.cc @@ -54,7 +54,6 @@ TEST_CASE("MapLayer drawFringe normal", "") { setEnv("SDL_VIDEODRIVER", "dummy"); - logger = new Logger; VirtFs::mountDirSilent("data", Append_false); VirtFs::mountDirSilent("../data", Append_false); @@ -526,5 +525,4 @@ TEST_CASE("MapLayer drawFringe normal", "") ResourceManager::deleteInstance(); VirtFs::unmountDirSilent("data"); VirtFs::unmountDirSilent("../data"); - delete2(logger); } diff --git a/src/unittests/resources/map/maplayer/drawfringesimple.cc b/src/unittests/resources/map/maplayer/drawfringesimple.cc index 8c3457e8f..e910a5702 100644 --- a/src/unittests/resources/map/maplayer/drawfringesimple.cc +++ b/src/unittests/resources/map/maplayer/drawfringesimple.cc @@ -51,7 +51,6 @@ TEST_CASE("MapLayer drawFringe simple", "") { setEnv("SDL_VIDEODRIVER", "dummy"); - logger = new Logger; VirtFs::mountDirSilent("data", Append_false); VirtFs::mountDirSilent("../data", Append_false); @@ -504,5 +503,4 @@ TEST_CASE("MapLayer drawFringe simple", "") ResourceManager::deleteInstance(); VirtFs::unmountDirSilent("data"); VirtFs::unmountDirSilent("../data"); - delete2(logger); } diff --git a/src/unittests/resources/map/maplayer/drawspeciallayer1.cc b/src/unittests/resources/map/maplayer/drawspeciallayer1.cc index 2927deb48..0940e4279 100644 --- a/src/unittests/resources/map/maplayer/drawspeciallayer1.cc +++ b/src/unittests/resources/map/maplayer/drawspeciallayer1.cc @@ -31,7 +31,6 @@ #include "unittests/render/mockgraphics.h" -#include "utils/delete2.h" #include "utils/env.h" #include "resources/resourcemanager/resourcemanager.h" @@ -48,7 +47,6 @@ TEST_CASE("MapLayer drawSpecialLayer (specialLayer)", "") { setEnv("SDL_VIDEODRIVER", "dummy"); - logger = new Logger; VirtFs::mountDirSilent("data", Append_false); VirtFs::mountDirSilent("../data", Append_false); @@ -394,5 +392,4 @@ TEST_CASE("MapLayer drawSpecialLayer (specialLayer)", "") ResourceManager::deleteInstance(); VirtFs::unmountDirSilent("data"); VirtFs::unmountDirSilent("../data"); - delete2(logger); } diff --git a/src/unittests/resources/map/maplayer/drawspeciallayer2.cc b/src/unittests/resources/map/maplayer/drawspeciallayer2.cc index ec101a099..8aa0ccf8b 100644 --- a/src/unittests/resources/map/maplayer/drawspeciallayer2.cc +++ b/src/unittests/resources/map/maplayer/drawspeciallayer2.cc @@ -31,7 +31,6 @@ #include "unittests/render/mockgraphics.h" -#include "utils/delete2.h" #include "utils/env.h" #include "resources/resourcemanager/resourcemanager.h" @@ -48,7 +47,6 @@ TEST_CASE("MapLayer drawSpecialLayer (tempLayer)", "") { setEnv("SDL_VIDEODRIVER", "dummy"); - logger = new Logger; VirtFs::mountDirSilent("data", Append_false); VirtFs::mountDirSilent("../data", Append_false); @@ -400,5 +398,4 @@ TEST_CASE("MapLayer drawSpecialLayer (tempLayer)", "") ResourceManager::deleteInstance(); VirtFs::unmountDirSilent("data"); VirtFs::unmountDirSilent("../data"); - delete2(logger); } diff --git a/src/unittests/resources/map/maplayer/getemptytiledrawwidth.cc b/src/unittests/resources/map/maplayer/getemptytiledrawwidth.cc index 679a09271..a5378ce86 100644 --- a/src/unittests/resources/map/maplayer/getemptytiledrawwidth.cc +++ b/src/unittests/resources/map/maplayer/getemptytiledrawwidth.cc @@ -22,9 +22,6 @@ #include "configmanager.h" #include "dirs.h" -#include "logger.h" - -#include "utils/delete2.h" #include "resources/image/image.h" @@ -34,8 +31,6 @@ TEST_CASE("MapLayer getEmptyTileDrawWidth", "") { - logger = new Logger; - Dirs::initRootDir(); Dirs::initHomeDir(); @@ -164,5 +159,4 @@ TEST_CASE("MapLayer getEmptyTileDrawWidth", "") delete img1; delete img2; delete img3; - delete2(logger); } diff --git a/src/unittests/resources/map/maplayer/gettiledrawwidth.cc b/src/unittests/resources/map/maplayer/gettiledrawwidth.cc index 53fde8f49..121e14530 100644 --- a/src/unittests/resources/map/maplayer/gettiledrawwidth.cc +++ b/src/unittests/resources/map/maplayer/gettiledrawwidth.cc @@ -22,9 +22,6 @@ #include "configmanager.h" #include "dirs.h" -#include "logger.h" - -#include "utils/delete2.h" #include "resources/image/image.h" @@ -34,8 +31,6 @@ TEST_CASE("MapLayer getTileDrawWidth", "") { - logger = new Logger; - Dirs::initRootDir(); Dirs::initHomeDir(); @@ -401,5 +396,4 @@ TEST_CASE("MapLayer getTileDrawWidth", "") delete img1; delete img2; delete img3; - delete2(logger); } diff --git a/src/unittests/resources/map/maplayer/updatecache.cc b/src/unittests/resources/map/maplayer/updatecache.cc index 3cf7e8981..eaff5ac5d 100644 --- a/src/unittests/resources/map/maplayer/updatecache.cc +++ b/src/unittests/resources/map/maplayer/updatecache.cc @@ -22,9 +22,6 @@ #include "configmanager.h" #include "dirs.h" -#include "logger.h" - -#include "utils/delete2.h" #include "resources/image/image.h" @@ -34,8 +31,6 @@ TEST_CASE("MapLayer updateCache", "") { - logger = new Logger; - Dirs::initRootDir(); Dirs::initHomeDir(); @@ -401,5 +396,4 @@ TEST_CASE("MapLayer updateCache", "") delete img1; delete img2; delete img3; - delete2(logger); } diff --git a/src/unittests/resources/map/maplayer/updateconditiontiles.cc b/src/unittests/resources/map/maplayer/updateconditiontiles.cc index 73ed58108..f9b7cffc2 100644 --- a/src/unittests/resources/map/maplayer/updateconditiontiles.cc +++ b/src/unittests/resources/map/maplayer/updateconditiontiles.cc @@ -22,12 +22,9 @@ #include "configmanager.h" #include "dirs.h" -#include "logger.h" #include "enums/resources/map/blockmask.h" -#include "utils/delete2.h" - #include "resources/image/image.h" #include "resources/map/map.h" @@ -37,8 +34,6 @@ TEST_CASE("MapLayer updateConditionTiles", "") { - logger = new Logger; - Dirs::initRootDir(); Dirs::initHomeDir(); @@ -233,5 +228,4 @@ TEST_CASE("MapLayer updateConditionTiles", "") delete map; delete img1; - delete2(logger); } diff --git a/src/unittests/resources/map/speciallayer.cc b/src/unittests/resources/map/speciallayer.cc index 49b50c932..f2de1db43 100644 --- a/src/unittests/resources/map/speciallayer.cc +++ b/src/unittests/resources/map/speciallayer.cc @@ -51,7 +51,6 @@ TEST_CASE("SpecialLayer updateCache", "") { setEnv("SDL_VIDEODRIVER", "dummy"); - logger = new Logger; client = new Client; VirtFs::mountDirSilent("data", Append_false); VirtFs::mountDirSilent("../data", Append_false); @@ -285,5 +284,4 @@ TEST_CASE("SpecialLayer updateCache", "") delete2(client); VirtFs::unmountDirSilent("data"); VirtFs::unmountDirSilent("../data"); - delete2(logger); } diff --git a/src/unittests/resources/resourcemanager/resourcemanager.cc b/src/unittests/resources/resourcemanager/resourcemanager.cc index 66656558b..9552089fd 100644 --- a/src/unittests/resources/resourcemanager/resourcemanager.cc +++ b/src/unittests/resources/resourcemanager/resourcemanager.cc @@ -97,7 +97,6 @@ TEST_CASE("resourcemanager", "resourcemanager") client = new Client; XML::initXML(); SDL_Init(SDL_INIT_VIDEO); - logger = new Logger(); VirtFs::mountDirSilent("data", Append_false); VirtFs::mountDirSilent("../data", Append_false); @@ -690,6 +689,4 @@ TEST_CASE("resourcemanager", "resourcemanager") delete2(client); VirtFs::unmountDirSilent("data"); VirtFs::unmountDirSilent("../data"); - delete2(logger); -// VirtFs::deinit(); } diff --git a/src/unittests/resources/sdlimagehelper.cc b/src/unittests/resources/sdlimagehelper.cc index e76e6f26d..1208a5ef2 100644 --- a/src/unittests/resources/sdlimagehelper.cc +++ b/src/unittests/resources/sdlimagehelper.cc @@ -75,7 +75,6 @@ TEST_CASE("sdlimagehelper combineSurface", "") setEnv("SDL_VIDEODRIVER", "dummy"); client = new Client; - logger = new Logger(); VirtFs::mountDirSilent("data", Append_false); VirtFs::mountDirSilent("../data", Append_false); @@ -553,7 +552,6 @@ TEST_CASE("sdlimagehelper combineSurface", "") delete2(client); VirtFs::unmountDirSilent("data"); VirtFs::unmountDirSilent("../data"); - delete2(logger); } #endif // SDL_BYTEORDER == SDL_LIL_ENDIAN diff --git a/src/unittests/resources/sprite/animatedsprite.cc b/src/unittests/resources/sprite/animatedsprite.cc index 0dab6d9cd..3d778b403 100644 --- a/src/unittests/resources/sprite/animatedsprite.cc +++ b/src/unittests/resources/sprite/animatedsprite.cc @@ -64,7 +64,6 @@ TEST_CASE("AnimatedSprite tests", "animatedsprite") client = new Client; XML::initXML(); SDL_Init(SDL_INIT_VIDEO); - logger = new Logger(); VirtFs::mountDirSilent("data", Append_false); VirtFs::mountDirSilent("../data", Append_false); mainGraphics = new SDLGraphics; @@ -195,6 +194,4 @@ TEST_CASE("AnimatedSprite tests", "animatedsprite") delete2(client); VirtFs::unmountDirSilent("data"); VirtFs::unmountDirSilent("../data"); - delete2(logger); -// VirtFs::deinit(); } diff --git a/src/unittests/sdl.cc b/src/unittests/sdl.cc index eaf744329..3994ea7f4 100644 --- a/src/unittests/sdl.cc +++ b/src/unittests/sdl.cc @@ -61,7 +61,6 @@ TEST_CASE("sdl tests", "sdl") client = new Client; XML::initXML(); SDL_Init(SDL_INIT_VIDEO); - logger = new Logger(); std::string name("data/test/test.zip"); std::string prefix; if (Files::existsLocal(name) == false) @@ -403,6 +402,4 @@ TEST_CASE("sdl tests", "sdl") VirtFs::unmountDirSilent("data"); VirtFs::unmountDirSilent("../data"); - delete2(logger); -// VirtFs::deinit(); } diff --git a/src/unittests/utils/chatutils.cc b/src/unittests/utils/chatutils.cc index f0a72af26..56e08a8ce 100644 --- a/src/unittests/utils/chatutils.cc +++ b/src/unittests/utils/chatutils.cc @@ -60,7 +60,6 @@ TEST_CASE("chatutils replaceVars", "") client = new Client; XML::initXML(); SDL_Init(SDL_INIT_VIDEO); - logger = new Logger(); VirtFs::mountDirSilent("data", Append_false); VirtFs::mountDirSilent("../data", Append_false); imageHelper = new SDLImageHelper(); @@ -255,8 +254,6 @@ TEST_CASE("chatutils replaceVars", "") delete2(client); VirtFs::unmountDirSilent("data"); VirtFs::unmountDirSilent("../data"); - delete2(logger); -// VirtFs::deinit(); } TEST_CASE("chatutils textToMe", "") diff --git a/src/unittests/utils/checkutils.cc b/src/unittests/utils/checkutils.cc index c54dcf9fc..5cfec4e83 100644 --- a/src/unittests/utils/checkutils.cc +++ b/src/unittests/utils/checkutils.cc @@ -21,7 +21,6 @@ #include "unittests/unittests.h" #include "utils/checkutils.h" -#include "utils/delete2.h" #include "debug.h" @@ -83,8 +82,6 @@ static bool testFailAlways2() TEST_CASE("CheckUtils", "") { - logger = new Logger; - SECTION("reportFalse") { REQUIRE(reportFalseReal(false) == false); @@ -174,6 +171,4 @@ PRAGMA4(GCC diagnostic pop) testReturnNullptrV(reinterpret_cast<void*>(1)); REQUIRE(flag == true); } - - delete2(logger); } diff --git a/src/unittests/utils/dumplibs.cc b/src/unittests/utils/dumplibs.cc index 35b80c710..e5797d45f 100644 --- a/src/unittests/utils/dumplibs.cc +++ b/src/unittests/utils/dumplibs.cc @@ -20,9 +20,6 @@ #include "unittests/unittests.h" -#include "logger.h" - -#include "utils/delete2.h" #include "utils/stringutils.h" PRAGMA48(GCC diagnostic push) @@ -42,8 +39,6 @@ PRAGMA48(GCC diagnostic pop) TEST_CASE("dumplibs tests", "") { - logger = new Logger(); - SECTION("zlib") { const std::string build = ZLIB_VERSION; @@ -140,6 +135,4 @@ TEST_CASE("dumplibs tests", "") REQUIRE(build == link); } - - delete2(logger); } diff --git a/src/unittests/utils/stringutils.cc b/src/unittests/utils/stringutils.cc index 128b07078..e69ebecba 100644 --- a/src/unittests/utils/stringutils.cc +++ b/src/unittests/utils/stringutils.cc @@ -21,13 +21,11 @@ #include "unittests/unittests.h" #include "configuration.h" -#include "logger.h" #include "const/utils/utf8.h" #include "fs/virtfs/fs.h" -#include "utils/delete2.h" #include "utils/dtor.h" #include "resources/iteminfo.h" @@ -1486,7 +1484,6 @@ TEST_CASE("stringuntils timeDiffToString", "") TEST_CASE("stringuntils replaceItemLinks", "") { - logger = new Logger(); VirtFs::mountDirSilent("data", Append_false); VirtFs::mountDirSilent("../data", Append_false); VirtFs::mountDirSilent("data/test", Append_false); @@ -1715,6 +1712,4 @@ TEST_CASE("stringuntils replaceItemLinks", "") VirtFs::unmountDirSilent("../data"); VirtFs::unmountDirSilent("data/test"); VirtFs::unmountDirSilent("../data/test"); - delete2(logger); -// VirtFs::deinit(); } diff --git a/src/unittests/utils/translation/poparser.cc b/src/unittests/utils/translation/poparser.cc index 84c993112..cfa0cbb30 100644 --- a/src/unittests/utils/translation/poparser.cc +++ b/src/unittests/utils/translation/poparser.cc @@ -50,7 +50,6 @@ TEST_CASE("PoParser tests", "PoParser") setEnv("SDL_VIDEODRIVER", "dummy"); client = new Client; - logger = new Logger(); VirtFs::mountDirSilent("data", Append_false); VirtFs::mountDirSilent("../data", Append_false); @@ -133,6 +132,4 @@ TEST_CASE("PoParser tests", "PoParser") delete2(client); VirtFs::unmountDirSilent("data"); VirtFs::unmountDirSilent("../data"); - delete2(logger); -// VirtFs::deinit(); } diff --git a/src/unittests/utils/xml.cc b/src/unittests/utils/xml.cc index f27b65597..6f380cfaf 100644 --- a/src/unittests/utils/xml.cc +++ b/src/unittests/utils/xml.cc @@ -49,19 +49,16 @@ TEST_CASE("xml test1", "") { - logger = new Logger(); REQUIRE(client == nullptr); REQUIRE(gui == nullptr); ResourceManager::cleanOrphans(true); ResourceManager::deleteInstance(); - delete2(logger); } TEST_CASE("xml doc", "") { setEnv("SDL_VIDEODRIVER", "dummy"); - logger = new Logger(); client = new Client; XML::initXML(); VirtFs::mountDirSilent("data", Append_false); @@ -385,16 +382,11 @@ TEST_CASE("xml doc", "") ResourceManager::deleteInstance(); VirtFs::unmountDirSilent("data"); VirtFs::unmountDirSilent("../data"); - - delete2(logger); -// VirtFs::deinit(); } TEST_CASE("xml test2", "") { - logger = new Logger(); REQUIRE(gui == nullptr); ResourceManager::cleanOrphans(true); ResourceManager::deleteInstance(); - delete2(logger); } diff --git a/src/unittests/utils/xmlutils.cc b/src/unittests/utils/xmlutils.cc index bff998057..e665cb6e5 100644 --- a/src/unittests/utils/xmlutils.cc +++ b/src/unittests/utils/xmlutils.cc @@ -51,7 +51,6 @@ TEST_CASE("xmlutils readXmlIntVector 1", "") client = new Client; XML::initXML(); - logger = new Logger(); VirtFs::mountDirSilent("data", Append_false); VirtFs::mountDirSilent("../data", Append_false); @@ -102,8 +101,6 @@ TEST_CASE("xmlutils readXmlIntVector 1", "") ResourceManager::deleteInstance(); VirtFs::unmountDirSilent("data"); VirtFs::unmountDirSilent("../data"); - delete2(logger); -// VirtFs::deinit(); } TEST_CASE("xmlutils readXmlStringMap 1", "") @@ -112,7 +109,6 @@ TEST_CASE("xmlutils readXmlStringMap 1", "") client = new Client; XML::initXML(); - logger = new Logger(); VirtFs::mountDirSilent("data", Append_false); VirtFs::mountDirSilent("../data", Append_false); @@ -162,8 +158,6 @@ TEST_CASE("xmlutils readXmlStringMap 1", "") ResourceManager::deleteInstance(); VirtFs::unmountDirSilent("data"); VirtFs::unmountDirSilent("../data"); - delete2(logger); -// VirtFs::deinit(); } TEST_CASE("xmlutils readXmlIntMap 1", "") @@ -172,7 +166,6 @@ TEST_CASE("xmlutils readXmlIntMap 1", "") client = new Client; XML::initXML(); - logger = new Logger(); VirtFs::mountDirSilent("data", Append_false); VirtFs::mountDirSilent("../data", Append_false); VirtFs::mountDirSilent("data/test", Append_false); @@ -226,6 +219,4 @@ TEST_CASE("xmlutils readXmlIntMap 1", "") VirtFs::unmountDirSilent("../data/test"); VirtFs::unmountDirSilent("data"); VirtFs::unmountDirSilent("../data"); - delete2(logger); -// VirtFs::deinit(); } |