From d684e1087bca633f81f32472acea724515b0e718 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 8 Jul 2017 01:11:01 +0300 Subject: Split virtfs1_unittests.cc into many files for reduce memory usage. --- src/unittests/fs/virtfs/virtfs2_unittest.cc | 61 +++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) (limited to 'src/unittests/fs/virtfs/virtfs2_unittest.cc') 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("."); -- cgit v1.2.3-70-g09d2