diff options
Diffstat (limited to 'test/util_test.cc')
| -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); } |
