diff options
author | Andrei Karas <akaras@inbox.ru> | 2017-02-14 22:41:07 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2017-02-14 22:41:07 +0300 |
commit | 56d6454ba617d1dcddbbaa21e2066a7db0caee75 (patch) | |
tree | 5012e55f393db2d62b40eb64142fa4317b16c571 /src/utils/files_unittest.cc | |
parent | bdec92381ef60cd027292ed63e254e8de70028d9 (diff) | |
download | plus-56d6454ba617d1dcddbbaa21e2066a7db0caee75.tar.gz plus-56d6454ba617d1dcddbbaa21e2066a7db0caee75.tar.bz2 plus-56d6454ba617d1dcddbbaa21e2066a7db0caee75.tar.xz plus-56d6454ba617d1dcddbbaa21e2066a7db0caee75.zip |
Move some virtfs replated functions from files.cpp into virtfstools.cpp
Diffstat (limited to 'src/utils/files_unittest.cc')
-rw-r--r-- | src/utils/files_unittest.cc | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/src/utils/files_unittest.cc b/src/utils/files_unittest.cc index 71e6e89c7..ae2e69a99 100644 --- a/src/utils/files_unittest.cc +++ b/src/utils/files_unittest.cc @@ -24,6 +24,7 @@ #include "logger.h" #include "utils/virtfs.h" +#include "utils/virtfstools.h" #include "resources/resourcemanager/resourcemanager.h" @@ -73,9 +74,9 @@ TEST_CASE("Files existsLocal") ResourceManager::init(); VirtFs::addDirToSearchPath("data", Append_false); VirtFs::addDirToSearchPath("../data", Append_false); - REQUIRE(Files::existsLocal(Files::getPath("help/about.txt")) == true); - REQUIRE_FALSE(Files::existsLocal(Files::getPath("help/about1.txt"))); - REQUIRE_FALSE(Files::existsLocal(Files::getPath("help1/about.txt"))); + REQUIRE(Files::existsLocal(VirtFs::getPath("help/about.txt")) == true); + REQUIRE_FALSE(Files::existsLocal(VirtFs::getPath("help/about1.txt"))); + REQUIRE_FALSE(Files::existsLocal(VirtFs::getPath("help1/about.txt"))); ResourceManager::deleteInstance(); // VirtFs::deinit(); } @@ -87,7 +88,7 @@ TEST_CASE("Files loadTextFileString") ResourceManager::init(); VirtFs::addDirToSearchPath("data", Append_false); VirtFs::addDirToSearchPath("../data", Append_false); - REQUIRE(Files::loadTextFileString("test/simplefile.txt") == + REQUIRE(VirtFs::loadTextFileString("test/simplefile.txt") == "this is test \nfile."); ResourceManager::deleteInstance(); // VirtFs::deinit(); @@ -102,7 +103,7 @@ TEST_CASE("Files loadTextFile") VirtFs::addDirToSearchPath("../data", Append_false); StringVect lines; - Files::loadTextFile("test/simplefile.txt", lines); + VirtFs::loadTextFile("test/simplefile.txt", lines); REQUIRE(lines.size() == 2); REQUIRE(lines[0] == "this is test "); REQUIRE(lines[1] == "file."); @@ -118,10 +119,10 @@ TEST_CASE("Files saveTextFile") VirtFs::addDirToSearchPath("data", Append_false); VirtFs::addDirToSearchPath("../data", Append_false); - const std::string dir = Files::getPath("test"); + const std::string dir = VirtFs::getPath("test"); REQUIRE(dir.size() > 0); Files::saveTextFile(dir, "tempfile.txt", "test line\ntext line2"); - std::string data = Files::loadTextFileString("test/tempfile.txt"); + std::string data = VirtFs::loadTextFileString("test/tempfile.txt"); ::remove((dir + "/tempfile.txt").c_str()); REQUIRE(data == "test line\ntext line2\n"); ResourceManager::deleteInstance(); @@ -137,14 +138,14 @@ TEST_CASE("Files getFilesInDir") VirtFs::addDirToSearchPath("../data", Append_false); StringVect list; - Files::getFilesInDir("test", + VirtFs::getFilesInDir("test", list, ".gpl"); REQUIRE(list.size() == 1); REQUIRE(list[0] == "test/palette.gpl"); list.clear(); - Files::getFilesInDir("perserver/default", + VirtFs::getFilesInDir("perserver/default", list, ".xml"); REQUIRE(list.size() == 5); |