diff options
| author | Carl Hetherington <cth@carlh.net> | 2022-04-24 21:39:42 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2022-04-24 21:39:42 +0200 |
| commit | c1d782e29c4fd0ae6de7a3c5b0f47833580293bd (patch) | |
| tree | d90ff8554a2a04d60966ab928708187053610228 /test | |
| parent | 232e17ff2944d4e0dca311be9b1bc703055d71b4 (diff) | |
wip: add AssetMap and fix everything up.dcp-editor
Diffstat (limited to 'test')
| -rw-r--r-- | test/util_test.cc | 38 |
1 files changed, 27 insertions, 11 deletions
diff --git a/test/util_test.cc b/test/util_test.cc index 8ca7df44..092769c8 100644 --- a/test/util_test.cc +++ b/test/util_test.cc @@ -93,42 +93,58 @@ BOOST_AUTO_TEST_CASE (content_kind_test) /** Test dcp::relative_to_root */ BOOST_AUTO_TEST_CASE (relative_to_root_test) { + using namespace boost::filesystem; + + path const base = "build/test/relative_to_root_test"; + { - boost::filesystem::path root = "a"; + path root = base / "a"; root /= "b"; - boost::filesystem::path file = "a"; + path file = base / "a"; file /= "b"; file /= "c"; - boost::optional<boost::filesystem::path> rel = dcp::relative_to_root (root, file); + boost::system::error_code ec; + create_directories(root, ec); + create_directories(file, ec); + + auto rel = dcp::relative_to_root (root, file); BOOST_CHECK (rel); - BOOST_CHECK_EQUAL (rel.get(), boost::filesystem::path ("c")); + BOOST_CHECK_EQUAL (rel.get(), path("c")); } { - boost::filesystem::path root = "a"; + path root = "a"; root /= "b"; root /= "c"; - boost::filesystem::path file = "a"; + path file = "a"; file /= "b"; - boost::optional<boost::filesystem::path> rel = dcp::relative_to_root (root, file); + boost::system::error_code ec; + create_directories(root, ec); + create_directories(file, ec); + + auto rel = dcp::relative_to_root (root, file); BOOST_CHECK (!rel); } { - boost::filesystem::path root = "a"; + path root = "a"; - boost::filesystem::path file = "a"; + path file = "a"; file /= "b"; file /= "c"; - boost::optional<boost::filesystem::path> rel = dcp::relative_to_root (root, file); + boost::system::error_code ec; + create_directories(root, ec); + create_directories(file, ec); + + auto rel = dcp::relative_to_root (root, file); BOOST_CHECK (rel); - boost::filesystem::path check = "b"; + path check = "b"; check /= "c"; BOOST_CHECK_EQUAL (rel.get(), check); } |
