diff options
author | Andrei Karas <akaras@inbox.ru> | 2017-10-10 22:14:45 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2017-10-10 22:15:57 +0300 |
commit | aa3f63fd497558a02feb3ddbc44f31eac091f39b (patch) | |
tree | 0e28b9b1f0501dd8be9e1a38db4ec1777fa3fbfa /src/unittests/fs/virtfs/throw.cc | |
parent | 7c10a6b61e9d06a4ae9cc9f942dfacb6fcfd9d3d (diff) | |
download | plus-aa3f63fd497558a02feb3ddbc44f31eac091f39b.tar.gz plus-aa3f63fd497558a02feb3ddbc44f31eac091f39b.tar.bz2 plus-aa3f63fd497558a02feb3ddbc44f31eac091f39b.tar.xz plus-aa3f63fd497558a02feb3ddbc44f31eac091f39b.zip |
Remove most unused files.
Diffstat (limited to 'src/unittests/fs/virtfs/throw.cc')
-rw-r--r-- | src/unittests/fs/virtfs/throw.cc | 225 |
1 files changed, 0 insertions, 225 deletions
diff --git a/src/unittests/fs/virtfs/throw.cc b/src/unittests/fs/virtfs/throw.cc deleted file mode 100644 index 9f0a18f32..000000000 --- a/src/unittests/fs/virtfs/throw.cc +++ /dev/null @@ -1,225 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2016-2017 The ManaPlus Developers - * - * This file is part of The ManaPlus Client. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -#include "unittests/unittests.h" - -#include "configmanager.h" -#include "configuration.h" -#include "dirs.h" - -#include "fs/virtfs/fs.h" -#include "fs/virtfs/zipreader.h" - -#include "utils/checkutils.h" - -#ifndef UNITTESTS_CATCH -#include <algorithm> -#endif // UNITTESTS_CATCH - -#include "debug.h" - -TEST_CASE("throw VirtFs1 exists1", "") -{ - VirtFs::init("."); - const bool dir1 = VirtFs::mountDirSilent("data/", - Append_false); - VirtFs::mountDirSilent("..\\data", - Append_false); - - if (dir1 == true) - { - VirtFs::mountDir("data//test", - Append_false); - } - else - { - VirtFs::mountDirSilent("..//data\\test", - Append_false); - } - - if (dir1 == true) - VirtFs::unmountDirSilent("data/test"); - else - VirtFs::unmountDirSilent("../data/test"); - - REQUIRE_THROWS(VirtFs::exists("test/../units.xml")); - - VirtFs::deinit(); -} - -TEST_CASE("throw VirtFs1 exists2", "") -{ - VirtFs::init("."); - const bool dir1 = VirtFs::mountDirSilent2("data/", - "test", - Append_false); - VirtFs::mountDirSilent2("..\\data", - "test", - Append_false); - - if (dir1 == true) - { - VirtFs::mountDir2("data//test", - "dir2", - Append_false); - } - else - { - VirtFs::mountDirSilent2("..//data\\test", - "dir2", - Append_false); - } - - if (dir1 == true) - VirtFs::unmountDirSilent2("data/test", "dir2"); - else - VirtFs::unmountDirSilent2("../data/test", "dir2"); - - REQUIRE_THROWS(VirtFs::exists("test/../units.xml")); - - VirtFs::deinit(); -} - -TEST_CASE("throw Zip readCompressedFile", "") -{ - SECTION("empty") - { - REQUIRE_THROWS(VirtFs::ZipReader::readCompressedFile(nullptr)); - } -} - -TEST_CASE("throw Zip readFile", "") -{ - SECTION("empty") - { - REQUIRE_THROWS(VirtFs::ZipReader::readFile(nullptr)); - } -} - -TEST_CASE("throw VirtFs1 unmount", "") -{ - VirtFs::init("."); - const std::string sep = dirSeparator; - - SECTION("simple 1") - { - REQUIRE_THROWS(VirtFs::unmountDir("dir1")); - REQUIRE_THROWS(VirtFs::unmountDir("dir1/")); - } - - SECTION("simple 2") - { - REQUIRE(VirtFs::mountDirSilentTest("dir1", - Append_true)); - REQUIRE_THROWS(VirtFs::unmountDir("dir2")); - REQUIRE(VirtFs::unmountDir("dir1")); - } - - SECTION("simple 3") - { - REQUIRE(VirtFs::mountDirSilentTest("dir1", - Append_true)); - REQUIRE(VirtFs::mountDirSilentTest("dir2//dir3", - Append_true)); - REQUIRE(VirtFs::mountDirSilentTest("dir3", - Append_false)); - REQUIRE_THROWS(VirtFs::unmountDir("dir2")); - REQUIRE(VirtFs::unmountDir("dir1")); - REQUIRE_THROWS(VirtFs::unmountDir("dir1")); - REQUIRE(VirtFs::unmountDir("dir2/dir3")); - REQUIRE_THROWS(VirtFs::unmountDir("dir2/dir3" + sep)); - } - - SECTION("simple 4") - { - REQUIRE(VirtFs::mountDirSilentTest("dir1", - Append_true)); - REQUIRE_THROWS(VirtFs::unmountDir("dir2")); - REQUIRE(VirtFs::unmountDir("dir1")); - REQUIRE(VirtFs::mountDirSilentTest("dir1", - Append_true)); - } - - SECTION("subDir 1") - { - REQUIRE_THROWS(VirtFs::unmountDir2("dir1", "dir1")); - REQUIRE_THROWS(VirtFs::unmountDir2("dir1/", "dir1/")); - } - - SECTION("subDir 2") - { - REQUIRE(VirtFs::mountDirSilentTest2("dir1", - "dir2", - Append_true)); - REQUIRE_THROWS(VirtFs::unmountDir("dir1")); - REQUIRE_THROWS(VirtFs::unmountDir("dir2")); - REQUIRE(VirtFs::unmountDir2("dir1", "dir2")); - } - - SECTION("subDir 3") - { - REQUIRE(VirtFs::mountDirSilentTest2("dir1", - "dir2", - Append_true)); - REQUIRE(VirtFs::mountDirSilentTest("dir2//dir3", - Append_true)); - REQUIRE(VirtFs::mountDirSilentTest2("dir3", - "dir4", - Append_false)); - REQUIRE_THROWS(VirtFs::unmountDir("dir2")); - REQUIRE_THROWS(VirtFs::unmountDir2("dir1", "dir1")); - REQUIRE(VirtFs::unmountDir2("dir1", "dir2")); - REQUIRE_THROWS(VirtFs::unmountDir("dir1")); - REQUIRE(VirtFs::unmountDir("dir2/dir3")); - REQUIRE_THROWS(VirtFs::unmountDir("dir2/dir3" + sep)); - } - - SECTION("subDir 4") - { - REQUIRE(VirtFs::mountDirSilentTest2("dir1", - "dir2", - Append_true)); - REQUIRE_THROWS(VirtFs::unmountDir("dir2")); - REQUIRE_THROWS(VirtFs::unmountDir("dir1")); - REQUIRE(VirtFs::unmountDir2("dir1", "dir2")); - REQUIRE(VirtFs::mountDirSilentTest2("dir1", - "dir3", - Append_true)); - } - - VirtFs::deinit(); -} - -TEST_CASE("throw configuration tests", "configuration") -{ - Dirs::initRootDir(); - Dirs::initHomeDir(); - - ConfigManager::initConfiguration(); - - SECTION("configuration undefined") - { - const char *const key = "nonsetvalue"; - REQUIRE_THROWS(config.getIntValue(key)); - REQUIRE_THROWS(config.getFloatValue(key)); - REQUIRE_THROWS(config.getStringValue(key)); - REQUIRE_THROWS(config.getBoolValue(key)); - } -} |