summaryrefslogtreecommitdiff
path: root/src/fs/virtfs
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-06-08 01:22:43 +0300
committerAndrei Karas <akaras@inbox.ru>2017-06-08 01:22:43 +0300
commit34a83475636164cf43551d9ec83ec30da5a7e7f2 (patch)
treec6b3e22f789422e06a96c2ca87dd94fc61eb1dd1 /src/fs/virtfs
parentaf4fcff19a986990d58c50c62bc498690c8293b8 (diff)
downloadmanaverse-34a83475636164cf43551d9ec83ec30da5a7e7f2.tar.gz
manaverse-34a83475636164cf43551d9ec83ec30da5a7e7f2.tar.bz2
manaverse-34a83475636164cf43551d9ec83ec30da5a7e7f2.tar.xz
manaverse-34a83475636164cf43551d9ec83ec30da5a7e7f2.zip
Replace size() to empty() where is possible
Diffstat (limited to 'src/fs/virtfs')
-rw-r--r--src/fs/virtfs/fs.cpp2
-rw-r--r--src/fs/virtfs/virtfs1_unittest.cc144
-rw-r--r--src/fs/virtfs/virtfs_unittest.cc16
-rw-r--r--src/fs/virtfs/zip_unittest.cc2
4 files changed, 82 insertions, 82 deletions
diff --git a/src/fs/virtfs/fs.cpp b/src/fs/virtfs/fs.cpp
index 8a708a9fa..b4847ad13 100644
--- a/src/fs/virtfs/fs.cpp
+++ b/src/fs/virtfs/fs.cpp
@@ -682,7 +682,7 @@ namespace VirtFs
FsEntry *const entry = *it;
if (entry->root == oldDir &&
entry->type == FsEntryType::Zip &&
- entry->subDir == std::string())
+ entry->subDir.empty())
{
ZipEntry *const zipEntry = static_cast<ZipEntry*>(
entry);
diff --git a/src/fs/virtfs/virtfs1_unittest.cc b/src/fs/virtfs/virtfs1_unittest.cc
index 87ecd1671..4bec32e5b 100644
--- a/src/fs/virtfs/virtfs1_unittest.cc
+++ b/src/fs/virtfs/virtfs1_unittest.cc
@@ -71,7 +71,7 @@ TEST_CASE("VirtFs1 mountDir", "")
nullptr);
REQUIRE(VirtFs::getEntries().size() == 1);
REQUIRE(VirtFs::getEntries()[0]->root == "dir1" + sep);
- REQUIRE(VirtFs::getEntries()[0]->subDir == std::string());
+ REQUIRE(VirtFs::getEntries()[0]->subDir.empty());
REQUIRE(VirtFs::getEntries()[0]->type == FsEntryType::Dir);
REQUIRE(static_cast<VirtFs::DirEntry*>(
VirtFs::getEntries()[0])->userDir == "dir1");
@@ -89,7 +89,7 @@ TEST_CASE("VirtFs1 mountDir", "")
nullptr);
REQUIRE(VirtFs::getEntries().size() == 1);
REQUIRE(VirtFs::getEntries()[0]->root == "dir1" + sep);
- REQUIRE(VirtFs::getEntries()[0]->subDir == std::string());
+ REQUIRE(VirtFs::getEntries()[0]->subDir.empty());
REQUIRE(VirtFs::getEntries()[0]->type == FsEntryType::Dir);
REQUIRE(static_cast<VirtFs::DirEntry*>(
VirtFs::getEntries()[0])->userDir == "dir1" + sep);
@@ -114,8 +114,8 @@ TEST_CASE("VirtFs1 mountDir", "")
REQUIRE(VirtFs::getEntries()[1]->root == "dir1" + sep);
REQUIRE(VirtFs::getEntries()[0]->type == FsEntryType::Dir);
REQUIRE(VirtFs::getEntries()[1]->type == FsEntryType::Dir);
- REQUIRE(VirtFs::getEntries()[0]->subDir == std::string());
- REQUIRE(VirtFs::getEntries()[1]->subDir == std::string());
+ REQUIRE(VirtFs::getEntries()[0]->subDir.empty());
+ REQUIRE(VirtFs::getEntries()[1]->subDir.empty());
REQUIRE(static_cast<VirtFs::DirEntry*>(
VirtFs::getEntries()[0])->userDir == "dir2");
REQUIRE(static_cast<VirtFs::DirEntry*>(
@@ -139,8 +139,8 @@ TEST_CASE("VirtFs1 mountDir", "")
REQUIRE(VirtFs::getEntries()[1]->root == "dir2" + sep);
REQUIRE(VirtFs::getEntries()[0]->type == FsEntryType::Dir);
REQUIRE(VirtFs::getEntries()[1]->type == FsEntryType::Dir);
- REQUIRE(VirtFs::getEntries()[0]->subDir == std::string());
- REQUIRE(VirtFs::getEntries()[1]->subDir == std::string());
+ REQUIRE(VirtFs::getEntries()[0]->subDir.empty());
+ REQUIRE(VirtFs::getEntries()[1]->subDir.empty());
REQUIRE(static_cast<VirtFs::DirEntry*>(
VirtFs::getEntries()[0])->userDir == "dir1" + sep);
REQUIRE(static_cast<VirtFs::DirEntry*>(
@@ -170,9 +170,9 @@ TEST_CASE("VirtFs1 mountDir", "")
REQUIRE(VirtFs::getEntries()[0]->type == FsEntryType::Dir);
REQUIRE(VirtFs::getEntries()[1]->type == FsEntryType::Dir);
REQUIRE(VirtFs::getEntries()[2]->type == FsEntryType::Dir);
- REQUIRE(VirtFs::getEntries()[0]->subDir == std::string());
- REQUIRE(VirtFs::getEntries()[1]->subDir == std::string());
- REQUIRE(VirtFs::getEntries()[2]->subDir == std::string());
+ REQUIRE(VirtFs::getEntries()[0]->subDir.empty());
+ REQUIRE(VirtFs::getEntries()[1]->subDir.empty());
+ REQUIRE(VirtFs::getEntries()[2]->subDir.empty());
REQUIRE(static_cast<VirtFs::DirEntry*>(
VirtFs::getEntries()[0])->userDir == "dir1");
REQUIRE(static_cast<VirtFs::DirEntry*>(
@@ -204,9 +204,9 @@ TEST_CASE("VirtFs1 mountDir", "")
REQUIRE(VirtFs::getEntries()[0]->type == FsEntryType::Dir);
REQUIRE(VirtFs::getEntries()[1]->type == FsEntryType::Dir);
REQUIRE(VirtFs::getEntries()[2]->type == FsEntryType::Dir);
- REQUIRE(VirtFs::getEntries()[0]->subDir == std::string());
- REQUIRE(VirtFs::getEntries()[1]->subDir == std::string());
- REQUIRE(VirtFs::getEntries()[2]->subDir == std::string());
+ REQUIRE(VirtFs::getEntries()[0]->subDir.empty());
+ REQUIRE(VirtFs::getEntries()[1]->subDir.empty());
+ REQUIRE(VirtFs::getEntries()[2]->subDir.empty());
REQUIRE(static_cast<VirtFs::DirEntry*>(
VirtFs::getEntries()[0])->userDir == "dir3" + sep + "test");
REQUIRE(static_cast<VirtFs::DirEntry*>(
@@ -226,7 +226,7 @@ TEST_CASE("VirtFs1 mountDir", "")
nullptr);
REQUIRE(VirtFs::getEntries().size() == 1);
REQUIRE(VirtFs::getEntries()[0]->root == "dir1" + sep);
- REQUIRE(VirtFs::getEntries()[0]->subDir == std::string());
+ REQUIRE(VirtFs::getEntries()[0]->subDir.empty());
REQUIRE(VirtFs::getEntries()[0]->type == FsEntryType::Dir);
REQUIRE(static_cast<VirtFs::DirEntry*>(
VirtFs::getEntries()[0])->userDir == "dir1");
@@ -419,7 +419,7 @@ TEST_CASE("VirtFs1 mountDir", "")
nullptr);
REQUIRE(VirtFs::getEntries().size() == 2);
REQUIRE(VirtFs::getEntries()[0]->root == "dir1" + sep);
- REQUIRE(VirtFs::getEntries()[0]->subDir == std::string());
+ REQUIRE(VirtFs::getEntries()[0]->subDir.empty());
REQUIRE(VirtFs::getEntries()[0]->type == FsEntryType::Dir);
REQUIRE(VirtFs::getEntries()[1]->root == "dir1" + sep);
REQUIRE(VirtFs::getEntries()[1]->subDir == "dir2" + sep);
@@ -453,7 +453,7 @@ TEST_CASE("VirtFs1 mountDir", "")
nullptr);
REQUIRE(VirtFs::getEntries().size() == 2);
REQUIRE(VirtFs::getEntries()[0]->root == "dir1" + sep);
- REQUIRE(VirtFs::getEntries()[0]->subDir == std::string());
+ REQUIRE(VirtFs::getEntries()[0]->subDir.empty());
REQUIRE(VirtFs::getEntries()[0]->type == FsEntryType::Dir);
REQUIRE(VirtFs::getEntries()[1]->root == "dir1" + sep);
REQUIRE(VirtFs::getEntries()[1]->subDir == "dir2" + sep);
@@ -466,7 +466,7 @@ TEST_CASE("VirtFs1 mountDir", "")
REQUIRE(VirtFs::unmountDirSilent2("dir1", "dir2"));
REQUIRE(VirtFs::getEntries().size() == 1);
REQUIRE(VirtFs::getEntries()[0]->root == "dir1" + sep);
- REQUIRE(VirtFs::getEntries()[0]->subDir == std::string());
+ REQUIRE(VirtFs::getEntries()[0]->subDir.empty());
REQUIRE(VirtFs::getEntries()[0]->type == FsEntryType::Dir);
REQUIRE(static_cast<VirtFs::DirEntry*>(
VirtFs::getEntries()[0])->userDir == "dir1");
@@ -485,7 +485,7 @@ TEST_CASE("VirtFs1 mountDir", "")
nullptr);
REQUIRE(VirtFs::getEntries().size() == 1);
REQUIRE(VirtFs::getEntries()[0]->root == "dir1" + sep);
- REQUIRE(VirtFs::getEntries()[0]->subDir == std::string());
+ REQUIRE(VirtFs::getEntries()[0]->subDir.empty());
REQUIRE(VirtFs::getEntries()[0]->type == FsEntryType::Dir);
REQUIRE(static_cast<VirtFs::DirEntry*>(
VirtFs::getEntries()[0])->userDir == "dir1");
@@ -518,7 +518,7 @@ TEST_CASE("VirtFs1 mountZip", "")
REQUIRE(VirtFs::getEntries().size() == 1);
REQUIRE(VirtFs::getEntries()[0]->root ==
prefix + "data" + sep + "test" + sep + "test.zip");
- REQUIRE(VirtFs::getEntries()[0]->subDir == std::string());
+ REQUIRE(VirtFs::getEntries()[0]->subDir.empty());
REQUIRE(VirtFs::getEntries()[0]->type == FsEntryType::Zip);
}
@@ -538,11 +538,11 @@ TEST_CASE("VirtFs1 mountZip", "")
REQUIRE(VirtFs::getEntries()[0]->root ==
prefix + "data" + sep + "test" + sep + "test2.zip");
REQUIRE(VirtFs::getEntries()[0]->type == FsEntryType::Zip);
- REQUIRE(VirtFs::getEntries()[0]->subDir == std::string());
+ REQUIRE(VirtFs::getEntries()[0]->subDir.empty());
REQUIRE(VirtFs::getEntries()[1]->root ==
prefix + "data" + sep + "test" + sep + "test.zip");
REQUIRE(VirtFs::getEntries()[1]->type == FsEntryType::Zip);
- REQUIRE(VirtFs::getEntries()[1]->subDir == std::string());
+ REQUIRE(VirtFs::getEntries()[1]->subDir.empty());
}
SECTION("simple 3")
@@ -561,11 +561,11 @@ TEST_CASE("VirtFs1 mountZip", "")
REQUIRE(VirtFs::getEntries()[0]->root ==
prefix + "data" + sep + "test" + sep + "test.zip");
REQUIRE(VirtFs::getEntries()[0]->type == FsEntryType::Zip);
- REQUIRE(VirtFs::getEntries()[0]->subDir == std::string());
+ REQUIRE(VirtFs::getEntries()[0]->subDir.empty());
REQUIRE(VirtFs::getEntries()[1]->root ==
prefix + "data" + sep + "test" + sep + "test2.zip");
REQUIRE(VirtFs::getEntries()[1]->type == FsEntryType::Zip);
- REQUIRE(VirtFs::getEntries()[1]->subDir == std::string());
+ REQUIRE(VirtFs::getEntries()[1]->subDir.empty());
}
SECTION("simple 4")
@@ -589,15 +589,15 @@ TEST_CASE("VirtFs1 mountZip", "")
REQUIRE(VirtFs::getEntries()[0]->root ==
prefix + "data" + sep + "test" + sep + "test2.zip");
REQUIRE(VirtFs::getEntries()[0]->type == FsEntryType::Zip);
- REQUIRE(VirtFs::getEntries()[0]->subDir == std::string());
+ REQUIRE(VirtFs::getEntries()[0]->subDir.empty());
REQUIRE(VirtFs::getEntries()[1]->root ==
prefix + "data" + sep + "test" + sep + "");
REQUIRE(VirtFs::getEntries()[1]->type == FsEntryType::Dir);
- REQUIRE(VirtFs::getEntries()[1]->subDir == std::string());
+ REQUIRE(VirtFs::getEntries()[1]->subDir.empty());
REQUIRE(VirtFs::getEntries()[2]->root ==
prefix + "data" + sep + "test" + sep + "test.zip");
REQUIRE(VirtFs::getEntries()[2]->type == FsEntryType::Zip);
- REQUIRE(VirtFs::getEntries()[2]->subDir == std::string());
+ REQUIRE(VirtFs::getEntries()[2]->subDir.empty());
}
SECTION("simple 5")
@@ -621,15 +621,15 @@ TEST_CASE("VirtFs1 mountZip", "")
REQUIRE(VirtFs::getEntries()[0]->root ==
prefix + "data" + sep + "test" + sep + "");
REQUIRE(VirtFs::getEntries()[0]->type == FsEntryType::Dir);
- REQUIRE(VirtFs::getEntries()[0]->subDir == std::string());
+ REQUIRE(VirtFs::getEntries()[0]->subDir.empty());
REQUIRE(VirtFs::getEntries()[1]->root ==
prefix + "data" + sep + "test" + sep + "test.zip");
REQUIRE(VirtFs::getEntries()[1]->type == FsEntryType::Zip);
- REQUIRE(VirtFs::getEntries()[1]->subDir == std::string());
+ REQUIRE(VirtFs::getEntries()[1]->subDir.empty());
REQUIRE(VirtFs::getEntries()[2]->root ==
prefix + "data" + sep + "test" + sep + "test2.zip");
REQUIRE(VirtFs::getEntries()[2]->type == FsEntryType::Zip);
- REQUIRE(VirtFs::getEntries()[2]->subDir == std::string());
+ REQUIRE(VirtFs::getEntries()[2]->subDir.empty());
}
SECTION("subDir 1")
@@ -784,7 +784,7 @@ TEST_CASE("VirtFs1 mountZip", "")
REQUIRE(VirtFs::getEntries().size() == 1);
REQUIRE(VirtFs::getEntries()[0]->root ==
prefix + "data" + sep + "test" + sep + "test.zip");
- REQUIRE(VirtFs::getEntries()[0]->subDir == std::string());
+ REQUIRE(VirtFs::getEntries()[0]->subDir.empty());
REQUIRE(VirtFs::getEntries()[0]->type == FsEntryType::Zip);
}
@@ -829,24 +829,24 @@ TEST_CASE("VirtFs1 unmount", "")
REQUIRE(VirtFs::unmountDir("dir1"));
REQUIRE(VirtFs::getEntries().size() == 2);
REQUIRE(VirtFs::getEntries()[0]->root == "dir3" + sep);
- REQUIRE(VirtFs::getEntries()[0]->subDir == std::string());
+ REQUIRE(VirtFs::getEntries()[0]->subDir.empty());
REQUIRE(VirtFs::getEntries()[0]->type == FsEntryType::Dir);
REQUIRE(static_cast<VirtFs::DirEntry*>(
VirtFs::getEntries()[0])->userDir == "dir3");
REQUIRE(VirtFs::getEntries()[1]->root == "dir2" + sep + "dir3" + sep);
- REQUIRE(VirtFs::getEntries()[0]->subDir == std::string());
+ REQUIRE(VirtFs::getEntries()[0]->subDir.empty());
REQUIRE(VirtFs::getEntries()[0]->type == FsEntryType::Dir);
REQUIRE(static_cast<VirtFs::DirEntry*>(
VirtFs::getEntries()[1])->userDir == "dir2" + sep + "dir3");
REQUIRE_THROWS(VirtFs::unmountDir("dir1"));
REQUIRE(VirtFs::getEntries().size() == 2);
REQUIRE(VirtFs::getEntries()[0]->root == "dir3" + sep);
- REQUIRE(VirtFs::getEntries()[0]->subDir == std::string());
+ REQUIRE(VirtFs::getEntries()[0]->subDir.empty());
REQUIRE(VirtFs::getEntries()[0]->type == FsEntryType::Dir);
REQUIRE(static_cast<VirtFs::DirEntry*>(
VirtFs::getEntries()[0])->userDir == "dir3");
REQUIRE(VirtFs::getEntries()[1]->root == "dir2" + sep + "dir3" + sep);
- REQUIRE(VirtFs::getEntries()[0]->subDir == std::string());
+ REQUIRE(VirtFs::getEntries()[0]->subDir.empty());
REQUIRE(VirtFs::getEntries()[0]->type == FsEntryType::Dir);
REQUIRE(static_cast<VirtFs::DirEntry*>(
VirtFs::getEntries()[1])->userDir == "dir2" + sep + "dir3");
@@ -854,7 +854,7 @@ TEST_CASE("VirtFs1 unmount", "")
REQUIRE_THROWS(VirtFs::unmountDir("dir2/dir3" + sep));
REQUIRE(VirtFs::getEntries().size() == 1);
REQUIRE(VirtFs::getEntries()[0]->root == "dir3" + sep);
- REQUIRE(VirtFs::getEntries()[0]->subDir == std::string());
+ REQUIRE(VirtFs::getEntries()[0]->subDir.empty());
REQUIRE(VirtFs::getEntries()[0]->type == FsEntryType::Dir);
REQUIRE(static_cast<VirtFs::DirEntry*>(
VirtFs::getEntries()[0])->userDir == "dir3");
@@ -866,18 +866,18 @@ TEST_CASE("VirtFs1 unmount", "")
Append_true));
REQUIRE(VirtFs::getEntries().size() == 1);
REQUIRE(VirtFs::getEntries()[0]->root == "dir1" + sep);
- REQUIRE(VirtFs::getEntries()[0]->subDir == std::string());
+ REQUIRE(VirtFs::getEntries()[0]->subDir.empty());
REQUIRE(VirtFs::getEntries()[0]->type == FsEntryType::Dir);
REQUIRE(static_cast<VirtFs::DirEntry*>(
VirtFs::getEntries()[0])->userDir == "dir1");
REQUIRE_THROWS(VirtFs::unmountDir("dir2"));
REQUIRE(VirtFs::unmountDir("dir1"));
- REQUIRE(VirtFs::getEntries().size() == 0);
+ REQUIRE(VirtFs::getEntries().empty());
REQUIRE(VirtFs::mountDirSilentTest("dir1",
Append_true));
REQUIRE(VirtFs::getEntries().size() == 1);
REQUIRE(VirtFs::getEntries()[0]->root == "dir1" + sep);
- REQUIRE(VirtFs::getEntries()[0]->subDir == std::string());
+ REQUIRE(VirtFs::getEntries()[0]->subDir.empty());
REQUIRE(VirtFs::getEntries()[0]->type == FsEntryType::Dir);
REQUIRE(static_cast<VirtFs::DirEntry*>(
VirtFs::getEntries()[0])->userDir == "dir1");
@@ -898,11 +898,11 @@ TEST_CASE("VirtFs1 unmount", "")
REQUIRE(VirtFs::getEntries().size() == 2);
REQUIRE(VirtFs::getEntries()[0]->root ==
prefix + "data" + sep + "test" + sep + "test.zip");
- REQUIRE(VirtFs::getEntries()[0]->subDir == std::string());
+ REQUIRE(VirtFs::getEntries()[0]->subDir.empty());
REQUIRE(VirtFs::getEntries()[0]->type == FsEntryType::Zip);
REQUIRE(VirtFs::getEntries()[1]->root ==
prefix + "data" + sep + "test" + sep + "test2.zip");
- REQUIRE(VirtFs::getEntries()[1]->subDir == std::string());
+ REQUIRE(VirtFs::getEntries()[1]->subDir.empty());
REQUIRE(VirtFs::getEntries()[1]->type == FsEntryType::Zip);
VirtFs::unmountZip(prefix + "data/test/test.zip");
@@ -915,7 +915,7 @@ TEST_CASE("VirtFs1 unmount", "")
REQUIRE(VirtFs::getEntries().size() == 1);
REQUIRE(VirtFs::getEntries()[0]->root ==
prefix + "data" + sep + "test" + sep + "test2.zip");
- REQUIRE(VirtFs::getEntries()[0]->subDir == std::string());
+ REQUIRE(VirtFs::getEntries()[0]->subDir.empty());
REQUIRE(VirtFs::getEntries()[0]->type == FsEntryType::Zip);
}
@@ -940,15 +940,15 @@ TEST_CASE("VirtFs1 unmount", "")
REQUIRE(VirtFs::getEntries().size() == 3);
REQUIRE(VirtFs::getEntries()[0]->root ==
prefix + "data" + sep + "test" + sep + "test2.zip");
- REQUIRE(VirtFs::getEntries()[0]->subDir == std::string());
+ REQUIRE(VirtFs::getEntries()[0]->subDir.empty());
REQUIRE(VirtFs::getEntries()[0]->type == FsEntryType::Zip);
REQUIRE(VirtFs::getEntries()[1]->root ==
prefix + "data" + sep + "test" + sep);
- REQUIRE(VirtFs::getEntries()[1]->subDir == std::string());
+ REQUIRE(VirtFs::getEntries()[1]->subDir.empty());
REQUIRE(VirtFs::getEntries()[1]->type == FsEntryType::Dir);
REQUIRE(VirtFs::getEntries()[2]->root ==
prefix + "data" + sep + "test" + sep + "test.zip");
- REQUIRE(VirtFs::getEntries()[2]->subDir == std::string());
+ REQUIRE(VirtFs::getEntries()[2]->subDir.empty());
REQUIRE(VirtFs::getEntries()[2]->type == FsEntryType::Zip);
VirtFs::unmountZip(prefix + "data/test/test.zip");
@@ -964,11 +964,11 @@ TEST_CASE("VirtFs1 unmount", "")
REQUIRE(VirtFs::getEntries().size() == 2);
REQUIRE(VirtFs::getEntries()[0]->root ==
prefix + "data" + sep + "test" + sep + "test2.zip");
- REQUIRE(VirtFs::getEntries()[0]->subDir == std::string());
+ REQUIRE(VirtFs::getEntries()[0]->subDir.empty());
REQUIRE(VirtFs::getEntries()[0]->type == FsEntryType::Zip);
REQUIRE(VirtFs::getEntries()[1]->root ==
prefix + "data" + sep + "test" + sep);
- REQUIRE(VirtFs::getEntries()[1]->subDir == std::string());
+ REQUIRE(VirtFs::getEntries()[1]->subDir.empty());
REQUIRE(VirtFs::getEntries()[1]->type == FsEntryType::Dir);
}
@@ -1009,7 +1009,7 @@ TEST_CASE("VirtFs1 unmount", "")
REQUIRE(static_cast<VirtFs::DirEntry*>(
VirtFs::getEntries()[0])->userDir == "dir3");
REQUIRE(VirtFs::getEntries()[1]->root == "dir2" + sep + "dir3" + sep);
- REQUIRE(VirtFs::getEntries()[1]->subDir == std::string());
+ REQUIRE(VirtFs::getEntries()[1]->subDir.empty());
REQUIRE(VirtFs::getEntries()[1]->type == FsEntryType::Dir);
REQUIRE(static_cast<VirtFs::DirEntry*>(
VirtFs::getEntries()[1])->userDir == "dir2" + sep + "dir3");
@@ -1021,7 +1021,7 @@ TEST_CASE("VirtFs1 unmount", "")
REQUIRE(static_cast<VirtFs::DirEntry*>(
VirtFs::getEntries()[0])->userDir == "dir3");
REQUIRE(VirtFs::getEntries()[1]->root == "dir2" + sep + "dir3" + sep);
- REQUIRE(VirtFs::getEntries()[1]->subDir == std::string());
+ REQUIRE(VirtFs::getEntries()[1]->subDir.empty());
REQUIRE(VirtFs::getEntries()[1]->type == FsEntryType::Dir);
REQUIRE(static_cast<VirtFs::DirEntry*>(
VirtFs::getEntries()[1])->userDir == "dir2" + sep + "dir3");
@@ -1049,7 +1049,7 @@ TEST_CASE("VirtFs1 unmount", "")
REQUIRE_THROWS(VirtFs::unmountDir("dir2"));
REQUIRE_THROWS(VirtFs::unmountDir("dir1"));
REQUIRE(VirtFs::unmountDir2("dir1", "dir2"));
- REQUIRE(VirtFs::getEntries().size() == 0);
+ REQUIRE(VirtFs::getEntries().empty());
REQUIRE(VirtFs::mountDirSilentTest2("dir1",
"dir3",
Append_true));
@@ -1324,8 +1324,8 @@ TEST_CASE("VirtFs1 getRealDir1", "")
VirtFs::init(".");
logger = new Logger();
const std::string sep = dirSeparator;
- REQUIRE(VirtFs::getRealDir(".") == "");
- REQUIRE(VirtFs::getRealDir("..") == "");
+ REQUIRE(VirtFs::getRealDir(".").empty());
+ REQUIRE(VirtFs::getRealDir("..").empty());
const bool dir1 = VirtFs::mountDirSilent("data",
Append_false);
REQUIRE((dir1 || VirtFs::mountDirSilent("../data",
@@ -1350,7 +1350,7 @@ TEST_CASE("VirtFs1 getRealDir1", "")
REQUIRE(VirtFs::getRealDir("test//test.txt") ==
"../data");
}
- REQUIRE(VirtFs::getRealDir("zzz") == "");
+ REQUIRE(VirtFs::getRealDir("zzz").empty());
VirtFs::mountDirSilent("data/test",
Append_false);
@@ -1376,7 +1376,7 @@ TEST_CASE("VirtFs1 getRealDir1", "")
REQUIRE(VirtFs::getRealDir("test.txt") ==
".." + sep + "data" + sep + "test");
}
- REQUIRE(VirtFs::getRealDir("zzz") == "");
+ REQUIRE(VirtFs::getRealDir("zzz").empty());
VirtFs::unmountDirSilent("data/test");
VirtFs::unmountDirSilent("../data/test");
@@ -1393,7 +1393,7 @@ TEST_CASE("VirtFs1 getRealDir1", "")
REQUIRE(VirtFs::getRealDir("test/test.txt") ==
".." + sep + "data");
}
- REQUIRE(VirtFs::getRealDir("zzz") == "");
+ REQUIRE(VirtFs::getRealDir("zzz").empty());
VirtFs::unmountDirSilent("data");
VirtFs::unmountDirSilent("../data");
@@ -1413,13 +1413,13 @@ TEST_CASE("VirtFs1 getRealDir2", "")
VirtFs::mountZip(prefix + "test2.zip",
Append_false);
- REQUIRE(VirtFs::getRealDir(".") == "");
- REQUIRE(VirtFs::getRealDir("..") == "");
+ REQUIRE(VirtFs::getRealDir(".").empty());
+ REQUIRE(VirtFs::getRealDir("..").empty());
REQUIRE(VirtFs::getRealDir("test.txt") == prefix + "test2.zip");
REQUIRE(VirtFs::getRealDir("dir/1") == prefix + "test2.zip");
REQUIRE(VirtFs::getRealDir("dir\\dye.png") ==
prefix + "test2.zip");
- REQUIRE(VirtFs::getRealDir("zzz") == "");
+ REQUIRE(VirtFs::getRealDir("zzz").empty());
VirtFs::mountZip(prefix + "test.zip",
Append_false);
@@ -1429,15 +1429,15 @@ TEST_CASE("VirtFs1 getRealDir2", "")
prefix + "test.zip");
REQUIRE(VirtFs::getRealDir("dir\\\\brimmedhat.png") ==
prefix + "test.zip");
- REQUIRE(VirtFs::getRealDir("zzz") == "");
+ REQUIRE(VirtFs::getRealDir("zzz").empty());
VirtFs::unmountZip(prefix + "test.zip");
- REQUIRE(VirtFs::getRealDir("dir/brimmedhat.png") == "");
+ REQUIRE(VirtFs::getRealDir("dir/brimmedhat.png").empty());
REQUIRE(VirtFs::getRealDir("test.txt") == prefix + "test2.zip");
REQUIRE(VirtFs::getRealDir("dir//dye.png") ==
prefix + "test2.zip");
- REQUIRE(VirtFs::getRealDir("zzz") == "");
+ REQUIRE(VirtFs::getRealDir("zzz").empty());
VirtFs::unmountZip(prefix + "test2.zip");
VirtFs::deinit();
@@ -1449,15 +1449,15 @@ TEST_CASE("VirtFs1 getRealDir3", "")
VirtFs::init(".");
logger = new Logger();
const std::string sep = dirSeparator;
- REQUIRE(VirtFs::getRealDir(".") == "");
- REQUIRE(VirtFs::getRealDir("..") == "");
+ REQUIRE(VirtFs::getRealDir(".").empty());
+ REQUIRE(VirtFs::getRealDir("..").empty());
const bool dir1 = VirtFs::mountDirSilent2("data",
"test",
Append_false);
REQUIRE((dir1 || VirtFs::mountDirSilent2("../data",
"test",
Append_false)) == true);
- REQUIRE(VirtFs::getRealDir("file1.txt") == "");
+ REQUIRE(VirtFs::getRealDir("file1.txt").empty());
if (dir1 == true)
{
REQUIRE(VirtFs::getRealDir("dir1") == "data");
@@ -1468,7 +1468,7 @@ TEST_CASE("VirtFs1 getRealDir3", "")
REQUIRE(VirtFs::getRealDir("dir1") == ".." + sep + "data");
REQUIRE(VirtFs::getRealDir("simplefile.txt") == ".." + sep + "data");
}
- REQUIRE(VirtFs::getRealDir("zzz") == "");
+ REQUIRE(VirtFs::getRealDir("zzz").empty());
VirtFs::mountDirSilent2("data/test",
"dir2",
@@ -1476,7 +1476,7 @@ TEST_CASE("VirtFs1 getRealDir3", "")
VirtFs::mountDirSilent2("../data/test",
"dir2",
Append_false);
- REQUIRE(VirtFs::getRealDir("dir") == "");
+ REQUIRE(VirtFs::getRealDir("dir").empty());
if (dir1 == true)
{
REQUIRE(VirtFs::getRealDir("file1.txt") == "data" + sep + "test");
@@ -1488,7 +1488,7 @@ TEST_CASE("VirtFs1 getRealDir3", "")
".." + sep + "data" + sep + "test");
REQUIRE(VirtFs::getRealDir("simplefile.txt") == ".." + sep + "data");
}
- REQUIRE(VirtFs::getRealDir("zzz") == "");
+ REQUIRE(VirtFs::getRealDir("zzz").empty());
VirtFs::deinit();
delete2(logger);
@@ -1559,7 +1559,7 @@ TEST_CASE("VirtFs1 enumerateFiles1", "")
VirtFs::permitLinks(true);
list = VirtFs::enumerateFiles("test/units.xml");
- REQUIRE(list->names.size() == 0);
+ REQUIRE(list->names.empty());
VirtFs::freeList(list);
VirtFs::permitLinks(false);
@@ -3224,7 +3224,7 @@ TEST_CASE("VirtFs1 getDirs1", "")
list.clear();
VirtFs::getDirs("dir2", list);
- REQUIRE(list.size() == 0);
+ REQUIRE(list.empty());
VirtFs::unmountZip(prefix + "data/test/test2.zip");
VirtFs::deinit();
@@ -3253,7 +3253,7 @@ TEST_CASE("VirtFs1 getDirs2", "")
list.clear();
VirtFs::getDirs("dir1", list);
- REQUIRE(list.size() == 0);
+ REQUIRE(list.empty());
VirtFs::unmountDir(prefix + "data/test");
}
@@ -3300,7 +3300,7 @@ TEST_CASE("VirtFs1 getDirs3", "")
list.clear();
VirtFs::getDirs("1", list);
- REQUIRE(list.size() == 0);
+ REQUIRE(list.empty());
VirtFs::unmountZip2(prefix + "data/test/test2.zip",
"dir");
@@ -3330,7 +3330,7 @@ TEST_CASE("VirtFs1 getDirs4", "")
list.clear();
VirtFs::getDirs("dir1", list);
- REQUIRE(list.size() == 0);
+ REQUIRE(list.empty());
VirtFs::unmountDir2(prefix + "data",
"test");
@@ -3405,7 +3405,7 @@ TEST_CASE("VirtFs1 getFilesWithDir2", "")
VirtFs::getFilesWithDir("music", list);
REQUIRE(list.size() <= 5);
- REQUIRE(list.size() >= 1);
+ REQUIRE(!list.empty());
REQUIRE(inList(list, "music", "keprohm.ogg"));
list.clear();
@@ -3490,7 +3490,7 @@ TEST_CASE("VirtFs1 getFilesWithDir4", "")
VirtFs::getFilesWithDir("dir1", list);
REQUIRE(list.size() <= 6);
- REQUIRE(list.size() >= 1);
+ REQUIRE(!list.empty());
REQUIRE(inList(list, "dir1", "file1.txt"));
list.clear();
diff --git a/src/fs/virtfs/virtfs_unittest.cc b/src/fs/virtfs/virtfs_unittest.cc
index 705f68ad8..3305c0264 100644
--- a/src/fs/virtfs/virtfs_unittest.cc
+++ b/src/fs/virtfs/virtfs_unittest.cc
@@ -295,7 +295,7 @@ TEST_CASE("VirtFs enumerateFiles1", "")
list = VirtFs::enumerateFiles("test/units.xml");
removeTemp(list->names);
- REQUIRE(list->names.size() == 0);
+ REQUIRE(list->names.empty());
VirtFs::freeList(list);
VirtFs::unmountDirSilent("data");
@@ -634,8 +634,8 @@ TEST_CASE("VirtFs getRealDir1", "")
{
logger = new Logger();
const std::string sep = dirSeparator;
- REQUIRE(VirtFs::getRealDir(".") == "");
- REQUIRE(VirtFs::getRealDir("..") == "");
+ REQUIRE(VirtFs::getRealDir(".").empty());
+ REQUIRE(VirtFs::getRealDir("..").empty());
const bool dir1 = VirtFs::mountDirSilent("data", Append_false);
REQUIRE((dir1 || VirtFs::mountDirSilent("../data", Append_false))
== true);
@@ -651,7 +651,7 @@ TEST_CASE("VirtFs getRealDir1", "")
REQUIRE(VirtFs::getRealDir("test/test.txt") ==
"../data");
}
- REQUIRE(VirtFs::getRealDir("zzz") == "");
+ REQUIRE(VirtFs::getRealDir("zzz").empty());
VirtFs::mountDirSilent("data/test", Append_false);
VirtFs::mountDirSilent("../data/test", Append_false);
@@ -671,7 +671,7 @@ TEST_CASE("VirtFs getRealDir1", "")
REQUIRE(VirtFs::getRealDir("test.txt") ==
".." + sep + "data" + sep + "test");
}
- REQUIRE(VirtFs::getRealDir("zzz") == "");
+ REQUIRE(VirtFs::getRealDir("zzz").empty());
if (dir1 == true)
{
@@ -710,7 +710,7 @@ TEST_CASE("VirtFs getRealDir1", "")
".." + sep + "data" + sep + "test" + sep + "test.zip");
}
REQUIRE(VirtFs::exists("dir/hide.png"));
- REQUIRE(VirtFs::getRealDir("zzz") == "");
+ REQUIRE(VirtFs::getRealDir("zzz").empty());
VirtFs::unmountDirSilent("data");
VirtFs::unmountDirSilent("../data");
@@ -734,7 +734,7 @@ TEST_CASE("VirtFs getrealDir2", "")
VirtFs::mountDir(prefix + "data/test", Append_false);
VirtFs::mountDir(prefix + "data", Append_false);
- REQUIRE(VirtFs::getRealDir("zzz") == "");
+ REQUIRE(VirtFs::getRealDir("zzz").empty());
REQUIRE(VirtFs::getRealDir("dir1/file1.txt") ==
prefix + "data" + sep + "test");
@@ -765,7 +765,7 @@ TEST_CASE("VirtFs getrealDir3", "")
Append_false);
VirtFs::mountDir(prefix + "data/test", Append_false);
- REQUIRE(VirtFs::getRealDir("zzz") == "");
+ REQUIRE(VirtFs::getRealDir("zzz").empty());
REQUIRE(VirtFs::getRealDir("dir1/file1.txt") ==
prefix + "data" + sep + "test");
diff --git a/src/fs/virtfs/zip_unittest.cc b/src/fs/virtfs/zip_unittest.cc
index 52629d482..0aa26595f 100644
--- a/src/fs/virtfs/zip_unittest.cc
+++ b/src/fs/virtfs/zip_unittest.cc
@@ -162,7 +162,7 @@ TEST_CASE("Zip readArchiveInfo", "")
REQUIRE(VirtFs::ZipReader::readArchiveInfo(entry));
REQUIRE(entry->root == name);
- REQUIRE(headers.size() == 0);
+ REQUIRE(headers.empty());
delete entry;
}