summaryrefslogtreecommitdiff
path: root/src/fs/virtfs/virtfs1_unittest.cc
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-04-24 17:04:47 +0300
committerAndrei Karas <akaras@inbox.ru>2017-04-24 17:04:47 +0300
commitd1b635ebf238fac5911fde8982d067ee4ffffe3a (patch)
tree788b6c6733550f5a54d5b3552a909a141af1223c /src/fs/virtfs/virtfs1_unittest.cc
parent0835e09ee3a6c83ffa01454f2c05597e6195b07d (diff)
downloadmanaverse-d1b635ebf238fac5911fde8982d067ee4ffffe3a.tar.gz
manaverse-d1b635ebf238fac5911fde8982d067ee4ffffe3a.tar.bz2
manaverse-d1b635ebf238fac5911fde8982d067ee4ffffe3a.tar.xz
manaverse-d1b635ebf238fac5911fde8982d067ee4ffffe3a.zip
Improve VirtFs::getDirs.
Diffstat (limited to 'src/fs/virtfs/virtfs1_unittest.cc')
-rw-r--r--src/fs/virtfs/virtfs1_unittest.cc77
1 files changed, 76 insertions, 1 deletions
diff --git a/src/fs/virtfs/virtfs1_unittest.cc b/src/fs/virtfs/virtfs1_unittest.cc
index a267f2b5a..23255e0c5 100644
--- a/src/fs/virtfs/virtfs1_unittest.cc
+++ b/src/fs/virtfs/virtfs1_unittest.cc
@@ -1935,13 +1935,88 @@ TEST_CASE("VirtFs1 getFiles zip")
list.clear();
VirtFs::getFiles("dir2", list);
+ REQUIRE(list.size() == 4);
REQUIRE(inList(list, "hide.png"));
REQUIRE(inList(list, "paths.xml"));
REQUIRE(inList(list, "test.txt"));
REQUIRE(inList(list, "units.xml"));
- REQUIRE(list.size() == 4);
VirtFs::unmountZip(prefix + "data/test/test2.zip");
VirtFs::deinit();
delete2(logger);
}
+
+TEST_CASE("VirtFs1 getDirs1")
+{
+ VirtFs::init(".");
+ logger = new Logger();
+ std::string name("data/test/test.zip");
+ std::string prefix;
+ if (Files::existsLocal(name) == false)
+ prefix = "../" + prefix;
+
+ VirtFs::mountZip(prefix + "data/test/test2.zip",
+ Append_false);
+
+ StringVect list;
+ VirtFs::getDirs("dir", list);
+ REQUIRE(list.size() == 2);
+ REQUIRE(inList(list, "1"));
+ REQUIRE(inList(list, "gpl"));
+ list.clear();
+
+ VirtFs::getDirs("dir2", list);
+ REQUIRE(list.size() == 0);
+
+ VirtFs::unmountZip(prefix + "data/test/test2.zip");
+ VirtFs::deinit();
+ delete2(logger);
+}
+
+TEST_CASE("VirtFs1 getDirs2")
+{
+ VirtFs::init(".");
+ logger = new Logger();
+ std::string name("data/test/test.zip");
+ std::string prefix;
+ if (Files::existsLocal(name) == false)
+ prefix = "../" + prefix;
+ StringVect list;
+
+ SECTION("dir1")
+ {
+ VirtFs::mountDir(prefix + "data/test",
+ Append_false);
+
+ VirtFs::getDirs("/", list);
+// REQUIRE(list.size() == 2);
+ REQUIRE(inList(list, "dir1"));
+ REQUIRE(inList(list, "dir2"));
+ list.clear();
+
+ VirtFs::getDirs("dir1", list);
+ REQUIRE(list.size() == 0);
+
+ VirtFs::unmountDir(prefix + "data/test");
+ }
+
+ SECTION("dir2")
+ {
+ VirtFs::mountDir(prefix + "data",
+ Append_false);
+
+ VirtFs::getDirs("sfx", list);
+ REQUIRE(inList(list, "system"));
+ list.clear();
+
+ VirtFs::getDirs("evol", list);
+ REQUIRE(list.size() == 2);
+ REQUIRE(inList(list, "icons"));
+ REQUIRE(inList(list, "images"));
+
+ VirtFs::unmountDir(prefix + "data");
+ }
+
+ VirtFs::deinit();
+ delete2(logger);
+}