summaryrefslogtreecommitdiff
path: root/src/unittests/fs/virtfs/virtfs2_unittest.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/unittests/fs/virtfs/virtfs2_unittest.cc')
-rw-r--r--src/unittests/fs/virtfs/virtfs2_unittest.cc61
1 files changed, 61 insertions, 0 deletions
diff --git a/src/unittests/fs/virtfs/virtfs2_unittest.cc b/src/unittests/fs/virtfs/virtfs2_unittest.cc
index def3f1783..86d932655 100644
--- a/src/unittests/fs/virtfs/virtfs2_unittest.cc
+++ b/src/unittests/fs/virtfs/virtfs2_unittest.cc
@@ -43,6 +43,67 @@ PRAGMA48(GCC diagnostic pop)
#include "debug.h"
+static bool inList(const VirtFs::List *const list,
+ const std::string &name)
+{
+ FOR_EACH (StringVectCIter, it, list->names)
+ {
+ if (*it == name)
+ return true;
+ }
+ return false;
+}
+
+static bool inList(StringVect list,
+ const std::string &name)
+{
+ FOR_EACH (StringVectCIter, it, list)
+ {
+ if (*it == name)
+ return true;
+ }
+ return false;
+}
+
+static bool inList(StringVect list,
+ const std::string &dir,
+ const std::string &name)
+{
+ const std::string path = pathJoin(dir, name);
+ FOR_EACH (StringVectCIter, it, list)
+ {
+ if (*it == path)
+ return true;
+ }
+ return false;
+}
+
+static void removeTemp(StringVect &restrict list)
+{
+ int cnt = 0;
+ std::sort(list.begin(), list.end());
+
+ FOR_EACH (StringVectIter, it, list)
+ {
+ if (*it != "serverlistplus.xml.part")
+ {
+ logger->log("file: %d %s",
+ cnt,
+ (*it).c_str());
+ cnt ++;
+ }
+ }
+
+ FOR_EACH (StringVectIter, it, list)
+ {
+ if (*it == "serverlistplus.xml.part")
+ {
+ list.erase(it);
+ return;
+ }
+ }
+}
+
TEST_CASE("VirtFs2 isDirectory1", "")
{
VirtFs::init(".");