Commit 2ee3cccf authored by GILLES Sebastien's avatar GILLES Sebastien

#1480 Add test about creating in one command several layers of...

#1480 Add test about creating in one command several layers of subdirectories... and fix the function so that the functionality actually works!
parent 9bbd76de
......@@ -237,6 +237,32 @@ BOOST_FIXTURE_TEST_CASE(subdirectory_not_existing, fixture)
}
BOOST_FIXTURE_TEST_CASE(many_subdirectories, fixture)
{
decltype(auto) mpi = GetMpi();
decltype(auto) environment = Utilities::Environment::CreateOrGetInstance(__FILE__, __LINE__);
decltype(auto) test_dir = environment.GetEnvironmentVariable("MOREFEM_TEST_OUTPUT_DIR", __FILE__, __LINE__);
const std::string directory_test = test_dir + "/directory_test/";
FilesystemNS::Directory directory(mpi,
directory_test,
FilesystemNS::behaviour::overwrite,
__FILE__, __LINE__);
// Throw because it doesn't exist and behaviour is read.
FilesystemNS::Directory subdirectory(directory,
std::vector<std::string> { "Subfolder", "Subsubfolder", "Subsubsubfolder" },
__FILE__, __LINE__);
BOOST_CHECK_EQUAL(subdirectory.GetPath(), directory_test + "/Rank_" + std::to_string(mpi.GetRank<int>())
+ "/Subfolder/Subsubfolder/Subsubsubfolder/");
BOOST_CHECK(FilesystemNS::Folder::DoExist(subdirectory));
}
PRAGMA_DIAGNOSTIC(pop)
......
......@@ -48,7 +48,7 @@ namespace MoReFEM::FilesystemNS
std::ostringstream oconv;
oconv << parent_directory.GetPath();
Utilities::PrintContainer<>::Do(subdirectories, oconv, '/');
Utilities::PrintContainer<>::Do(subdirectories, oconv, '/', "", "");
oconv << '/';
path_ = oconv.str();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment