MCPcopy Create free account
hub / github.com/boostorg/filesystem / test_copy_dir_recursive

Function test_copy_dir_recursive

test/copy_test.cpp:178–206  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

176}
177
178void test_copy_dir_recursive(fs::path const& root_dir)
179{
180 std::cout << "test_copy_dir_recursive" << std::endl;
181
182 fs::path target_dir = fs::unique_path();
183
184 fs::copy(root_dir, target_dir, fs::copy_options::recursive);
185
186 directory_tree tree = collect_directory_tree(target_dir);
187
188 BOOST_TEST_EQ(tree.size(), 9u);
189 BOOST_TEST(tree.find("f1") != tree.end());
190 BOOST_TEST(tree.find("f2") != tree.end());
191 BOOST_TEST(tree.find("d1") != tree.end());
192 BOOST_TEST(tree.find(fs::path("d1") / "f1") != tree.end());
193 BOOST_TEST(tree.find(fs::path("d1") / "d1") != tree.end());
194 BOOST_TEST(tree.find(fs::path("d1") / "d1" / "f1") != tree.end());
195 BOOST_TEST(tree.find(fs::path("d1") / "d2") != tree.end());
196 BOOST_TEST(tree.find("d2") != tree.end());
197 BOOST_TEST(tree.find(fs::path("d2") / "f1") != tree.end());
198
199 verify_file(target_dir / "f1", "f1");
200 verify_file(target_dir / "f2", "f2");
201 verify_file(target_dir / "d1/f1", "d1f1");
202 verify_file(target_dir / "d1/d1/f1", "d1d1f1");
203 verify_file(target_dir / "d2/f1", "d2f1");
204
205 fs::remove_all(target_dir);
206}
207
208void test_copy_dir_recursive_tree(fs::path const& root_dir)
209{

Callers 1

mainFunction · 0.85

Calls 8

collect_directory_treeFunction · 0.85
pathFunction · 0.70
verify_fileFunction · 0.70
unique_pathFunction · 0.50
copyFunction · 0.50
remove_allFunction · 0.50
sizeMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected