diff options
author | Andrei Karas <akaras@inbox.ru> | 2017-07-08 01:11:01 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2017-07-08 01:30:47 +0300 |
commit | d684e1087bca633f81f32472acea724515b0e718 (patch) | |
tree | 0c47f0c0e695359d422228a008beac7424d68791 /src/unittests/fs/virtfs/virtfs2_unittest.cc | |
parent | c5a777d78b5eb4a829bb7aec76d7ce629f810bb8 (diff) | |
download | plus-d684e1087bca633f81f32472acea724515b0e718.tar.gz plus-d684e1087bca633f81f32472acea724515b0e718.tar.bz2 plus-d684e1087bca633f81f32472acea724515b0e718.tar.xz plus-d684e1087bca633f81f32472acea724515b0e718.zip |
Split virtfs1_unittests.cc into many files for reduce memory usage.
Diffstat (limited to 'src/unittests/fs/virtfs/virtfs2_unittest.cc')
-rw-r--r-- | src/unittests/fs/virtfs/virtfs2_unittest.cc | 61 |
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("."); |