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 /src/unittests/fs | |
parent | 429a545dbd5d0fa992394cf7f4c83d5e972a14b2 (diff) | |
download | manaverse-d88285ef4d2b624a0c6a8ef5c2e157ed0248838e.tar.gz manaverse-d88285ef4d2b624a0c6a8ef5c2e157ed0248838e.tar.bz2 manaverse-d88285ef4d2b624a0c6a8ef5c2e157ed0248838e.tar.xz manaverse-d88285ef4d2b624a0c6a8ef5c2e157ed0248838e.zip |
Create logger in unit tests before other code.
This need because now sdl may raise error or assert almost at start.
Diffstat (limited to 'src/unittests/fs')
-rw-r--r-- | src/unittests/fs/files.cc | 26 | ||||
-rw-r--r-- | src/unittests/fs/virtfs/throw.cc | 18 | ||||
-rw-r--r-- | src/unittests/fs/virtfs/virtfs.cc | 58 | ||||
-rw-r--r-- | src/unittests/fs/virtfs/virtfs1_enumerate.cc | 27 | ||||
-rw-r--r-- | src/unittests/fs/virtfs/virtfs1_exists.cc | 5 | ||||
-rw-r--r-- | src/unittests/fs/virtfs/virtfs1_getrealdir.cc | 7 | ||||
-rw-r--r-- | src/unittests/fs/virtfs/virtfs1_mountdir.cc | 3 | ||||
-rw-r--r-- | src/unittests/fs/virtfs/virtfs1_mountzip.cc | 3 | ||||
-rw-r--r-- | src/unittests/fs/virtfs/virtfs1_unmount.cc | 3 | ||||
-rw-r--r-- | src/unittests/fs/virtfs/virtfs2.cc | 57 | ||||
-rw-r--r-- | src/unittests/fs/virtfs/zip.cc | 11 |
11 files changed, 0 insertions, 218 deletions
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); } |