Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r76742 - in branches/release: boost boost/filesystem boost/filesystem/v3 libs/filesystem libs/filesystem/v3/doc libs/filesystem/v3/src libs/filesystem/v3/test libs/filesystem/v3/test/msvc10
From: bdawes_at_[hidden]
Date: 2012-01-28 09:40:17


Author: bemandawes
Date: 2012-01-28 09:40:16 EST (Sat, 28 Jan 2012)
New Revision: 76742
URL: http://svn.boost.org/trac/boost/changeset/76742

Log:
Merge filesystem bug fixes
Properties modified:
   branches/release/boost/filesystem/ (props changed)
   branches/release/boost/filesystem.hpp (props changed)
   branches/release/libs/filesystem/ (props changed)
Text files modified:
   branches/release/boost/filesystem/v3/operations.hpp | 50 +
   branches/release/boost/filesystem/v3/path.hpp | 48 +
   branches/release/boost/filesystem/v3/path_traits.hpp | 2
   branches/release/libs/filesystem/v3/doc/release_history.html | 32 +
   branches/release/libs/filesystem/v3/src/operations.cpp | 12
   branches/release/libs/filesystem/v3/src/path.cpp | 39 +
   branches/release/libs/filesystem/v3/test/msvc10/filesystem-v3.sln | 16
   branches/release/libs/filesystem/v3/test/operations_test.cpp | 14
   branches/release/libs/filesystem/v3/test/path_test.cpp | 927 +++++++++++++++++++++------------------
   9 files changed, 669 insertions(+), 471 deletions(-)

Modified: branches/release/boost/filesystem/v3/operations.hpp
==============================================================================
--- branches/release/boost/filesystem/v3/operations.hpp (original)
+++ branches/release/boost/filesystem/v3/operations.hpp 2012-01-28 09:40:16 EST (Sat, 28 Jan 2012)
@@ -765,23 +765,43 @@
     {
       if ((m_options & symlink_option::_detail_no_push) == symlink_option::_detail_no_push)
         m_options &= ~symlink_option::_detail_no_push;
- else if (is_directory(m_stack.top()->status())
- && (!is_symlink(m_stack.top()->symlink_status())
- || (m_options & symlink_option::recurse) == symlink_option::recurse))
+
+ else
       {
- if (ec == 0)
- m_stack.push(directory_iterator(m_stack.top()->path()));
- else
- {
- m_stack.push(directory_iterator(m_stack.top()->path(), *ec));
- if (*ec) return;
- }
- if (m_stack.top() != directory_iterator())
- {
- ++m_level;
+ // Logic for following predicate was contributed by Daniel Aarno to handle cyclic
+ // symlinks correctly and efficiently, fixing ticket #5652.
+ // if (((m_options & symlink_option::recurse) == symlink_option::recurse
+ // || !is_symlink(m_stack.top()->symlink_status()))
+ // && is_directory(m_stack.top()->status())) ...
+ // The predicate code has since been rewritten to pass error_code arguments,
+ // per ticket #5653.
+ bool or_pred = (m_options & symlink_option::recurse) == symlink_option::recurse
+ || (ec == 0 ? !is_symlink(m_stack.top()->symlink_status())
+ : !is_symlink(m_stack.top()->symlink_status(*ec)));
+ if (ec != 0 && *ec)
+ return;
+ bool and_pred = or_pred && (ec == 0 ? is_directory(m_stack.top()->status())
+ : is_directory(m_stack.top()->status(*ec)));
+ if (ec != 0 && *ec)
           return;
+
+ if (and_pred)
+ {
+ if (ec == 0)
+ m_stack.push(directory_iterator(m_stack.top()->path()));
+ else
+ {
+ m_stack.push(directory_iterator(m_stack.top()->path(), *ec));
+ if (*ec)
+ return;
+ }
+ if (m_stack.top() != directory_iterator())
+ {
+ ++m_level;
+ return;
+ }
+ m_stack.pop();
         }
- m_stack.pop();
       }
 
       while (!m_stack.empty() && ++m_stack.top() == directory_iterator())
@@ -858,6 +878,8 @@
       BOOST_ASSERT_MSG(m_imp.get(),
         "increment() on end recursive_directory_iterator");
       m_imp->increment(&ec);
+ if (m_imp->m_stack.empty())
+ m_imp.reset(); // done, so make end iterator
       return *this;
     }
 

Modified: branches/release/boost/filesystem/v3/path.hpp
==============================================================================
--- branches/release/boost/filesystem/v3/path.hpp (original)
+++ branches/release/boost/filesystem/v3/path.hpp 2012-01-28 09:40:16 EST (Sat, 28 Jan 2012)
@@ -183,6 +183,12 @@
       return *this;
     }
 
+ path& operator=(const value_type* ptr) // required in case ptr overlaps *this
+ {
+ m_pathname = ptr;
+ return *this;
+ }
+
     template <class Source>
       typename boost::enable_if<path_traits::is_pathable<
         typename boost::decay<Source>::type>, path&>::type
@@ -193,6 +199,12 @@
       return *this;
     }
 
+ path& assign(const value_type* ptr, const codecvt_type&) // required in case ptr overlaps *this
+ {
+ m_pathname = ptr;
+ return *this;
+ }
+
     template <class Source>
     path& assign(Source const& source, const codecvt_type& cvt)
     {
@@ -227,6 +239,8 @@
 
     path& operator/=(const path& p);
 
+ path& operator/=(const value_type* ptr);
+
     template <class Source>
       typename boost::enable_if<path_traits::is_pathable<
         typename boost::decay<Source>::type>, path&>::type
@@ -235,6 +249,12 @@
       return append(source, codecvt());
     }
 
+ path& append(const value_type* ptr, const codecvt_type&) // required in case ptr overlaps *this
+ {
+ this->operator/=(ptr);
+ return *this;
+ }
+
     template <class Source>
     path& append(Source const& source, const codecvt_type& cvt);
 
@@ -378,6 +398,16 @@
     }
     bool is_relative() const { return !is_absolute(); }
 
+ // ----- iterators -----
+
+ class iterator;
+ typedef iterator const_iterator;
+
+ iterator begin() const;
+ iterator end() const;
+
+ // ----- static members -----
+
     // ----- imbue -----
 
     static std::locale imbue(const std::locale& loc);
@@ -389,14 +419,6 @@
       return *wchar_t_codecvt_facet();
     }
 
- // ----- iterators -----
-
- class iterator;
- typedef iterator const_iterator;
-
- iterator begin() const;
- iterator end() const;
-
     // ----- deprecated functions -----
 
 # if defined(BOOST_FILESYSTEM_DEPRECATED) && defined(BOOST_FILESYSTEM_NO_DEPRECATED)
@@ -650,14 +672,14 @@
   }
 
   template <class Source>
- path& path::append(Source const & source, const codecvt_type& cvt)
+ path& path::append(Source const& source, const codecvt_type& cvt)
   {
     if (path_traits::empty(source))
       return *this;
- string_type::size_type sep_pos(m_append_separator_if_needed());
- path_traits::dispatch(source, m_pathname, cvt);
- if (sep_pos)
- m_erase_redundant_separator(sep_pos);
+ string_type::size_type sep_pos(m_append_separator_if_needed());
+ path_traits::dispatch(source, m_pathname, cvt);
+ if (sep_pos)
+ m_erase_redundant_separator(sep_pos);
     return *this;
   }
 

Modified: branches/release/boost/filesystem/v3/path_traits.hpp
==============================================================================
--- branches/release/boost/filesystem/v3/path_traits.hpp (original)
+++ branches/release/boost/filesystem/v3/path_traits.hpp 2012-01-28 09:40:16 EST (Sat, 28 Jan 2012)
@@ -164,7 +164,7 @@
     to += from;
   }
 
- // Source dispatch
+ // Source dispatch -----------------------------------------------------------------//
 
   // contiguous containers
   template <class U> inline

Modified: branches/release/libs/filesystem/v3/doc/release_history.html
==============================================================================
--- branches/release/libs/filesystem/v3/doc/release_history.html (original)
+++ branches/release/libs/filesystem/v3/doc/release_history.html 2012-01-28 09:40:16 EST (Sat, 28 Jan 2012)
@@ -36,6 +36,36 @@
   </tr>
 </table>
 
+<h2>1.49.0</h2>
+<ul>
+ <li>Fix #3714,
+ Added test cases and fixes for class path errors when assignment or append
+ used self or portion of self as source. </li>
+ <li>Fix #4889,
+ #6320, Locale codecvt_facet not thread safe on Windows. Move
+ Windows, Mac OS X, locale and codecvt facet back to namespace scope. POSIX
+ except OS X uses local static initialization (IE lazy) to ensure exceptions
+ are catchable if environmental variables are misconfigured and to avoid use of
+ locale(&quot;&quot;) if not actually used.</li>
+ <li>Fix #5652,
+ recursive_directory_iterator fails on cyclic symbolic links. Thanks to Daniel
+ Aarno for the patch.</li>
+ <li>Fix #5653,
+ recursive_directory_iterator(error_code) can still throw filesystem_error.</li>
+ <li>Fix #5900, directory_iterator
+ access violation on Windows if error is thrown. Thanks to Andreas Eckleder for the patch.</li>
+ <li>Fix <a href="https://svn.boost.org/trac/boost/ticket/5900#comment:2">#5900
+ comment 2</a>, a bug in director_iterator construction with error_code argument that
+ caused increment to be called without the ec argument being passed.</li>
+ <li>Fix #5989 by cleaning up test suite path_test.cpp code even
+ though the ticket itself was not a defect, and clarifying docs; iteration over a path yields
+ generic format.</li>
+ <li>Fix #5592, Change Windows codecvt processing from CP_THREAD_ACP to CP_ACP.</li>
+ <li>Operations function fixes for PGI compiler, thanks to Noel Belcourt.</li>
+ <li>Relax permissions test to reflect reality, particularly on the Sandia test
+ platforms.</li>
+</ul>
+
 <h2>1.48.0</h2>
 <ul>
   <li>Added operational function canonical(),
@@ -88,7 +118,7 @@
 </ul>
 <hr>
 <p>Revised
-<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->03 October, 2011<!--webbot bot="Timestamp" endspan i-checksum="38359" --></p>
+<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->24 January, 2012<!--webbot bot="Timestamp" endspan i-checksum="38510" --></p>
 <p>© Copyright Beman Dawes, 2011</p>
 <p> Use, modification, and distribution are subject to the Boost Software
 License, Version 1.0. See <a href="http://www.boost.org/LICENSE_1_0.txt">

Modified: branches/release/libs/filesystem/v3/src/operations.cpp
==============================================================================
--- branches/release/libs/filesystem/v3/src/operations.cpp (original)
+++ branches/release/libs/filesystem/v3/src/operations.cpp 2012-01-28 09:40:16 EST (Sat, 28 Jan 2012)
@@ -502,7 +502,10 @@
       || errval == ERROR_BAD_NETPATH; // "//nosuch" on Win32
   }
 
-#if defined(_MSC_VER) || (defined(__GLIBCXX__) && __GLIBCXX__ >= 20110325)
+// some distributions of mingw as early as GLIBCXX__ 20110325 have _stricmp, but the
+// offical 4.6.2 release with __GLIBCXX__ 20111026 doesn't. Play it safe for now, and
+// only use _stricmp if _MSC_VER is defined
+#if defined(_MSC_VER) // || (defined(__GLIBCXX__) && __GLIBCXX__ >= 20110325)
 # define BOOST_FILESYSTEM_STRICMP _stricmp
 #else
 # define BOOST_FILESYSTEM_STRICMP strcmp
@@ -2146,7 +2149,7 @@
         && (filename.size()== 1
           || (filename[1] == dot
             && filename.size()== 2)))
- { it.increment(); }
+ { it.increment(*ec); }
     }
   }
 
@@ -2168,13 +2171,14 @@
 # endif
         filename, file_stat, symlink_file_stat);
 
- if (temp_ec)
+ if (temp_ec) // happens if filesystem is corrupt, such as on a damaged optical disc
       {
+ path error_path(it.m_imp->dir_entry.path().parent_path()); // fix ticket #5900
         it.m_imp.reset();
         if (ec == 0)
           BOOST_FILESYSTEM_THROW(
             filesystem_error("boost::filesystem::directory_iterator::operator++",
- it.m_imp->dir_entry.path().parent_path(),
+ error_path,
               error_code(BOOST_ERRNO, system_category())));
         ec->assign(BOOST_ERRNO, system_category());
         return;

Modified: branches/release/libs/filesystem/v3/src/path.cpp
==============================================================================
--- branches/release/libs/filesystem/v3/src/path.cpp (original)
+++ branches/release/libs/filesystem/v3/src/path.cpp 2012-01-28 09:40:16 EST (Sat, 28 Jan 2012)
@@ -145,13 +145,44 @@
 namespace filesystem3
 {
 
- path & path::operator/=(const path & p)
+ path& path::operator/=(const path& p)
   {
     if (p.empty())
       return *this;
- if (!is_separator(*p.m_pathname.begin()))
- m_append_separator_if_needed();
- m_pathname += p.m_pathname;
+ if (this == &p) // self-append
+ {
+ path rhs(p);
+ if (!is_separator(rhs.m_pathname[0]))
+ m_append_separator_if_needed();
+ m_pathname += rhs.m_pathname;
+ }
+ else
+ {
+ if (!is_separator(*p.m_pathname.begin()))
+ m_append_separator_if_needed();
+ m_pathname += p.m_pathname;
+ }
+ return *this;
+ }
+
+ path& path::operator/=(const value_type* ptr)
+ {
+ if (!*ptr)
+ return *this;
+ if (ptr >= m_pathname.data()
+ && ptr < m_pathname.data() + m_pathname.size()) // overlapping source
+ {
+ path rhs(ptr);
+ if (!is_separator(rhs.m_pathname[0]))
+ m_append_separator_if_needed();
+ m_pathname += rhs.m_pathname;
+ }
+ else
+ {
+ if (!is_separator(*ptr))
+ m_append_separator_if_needed();
+ m_pathname += ptr;
+ }
     return *this;
   }
 

Modified: branches/release/libs/filesystem/v3/test/msvc10/filesystem-v3.sln
==============================================================================
--- branches/release/libs/filesystem/v3/test/msvc10/filesystem-v3.sln (original)
+++ branches/release/libs/filesystem/v3/test/msvc10/filesystem-v3.sln 2012-01-28 09:40:16 EST (Sat, 28 Jan 2012)
@@ -73,7 +73,9 @@
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "locale_info", "locale_info\locale_info.vcxproj", "{3667C35E-78D5-43D4-AAC2-349145E4341D}"
 EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ticket_5850", "ticket_5850\ticket_5850.vcxproj", "{B1FA4137-7B08-4113-9EC0-F3BAFEFBE2B7}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "thread_test", "thread_test\thread_test.vcxproj", "{20E2805D-9634-46CE-B979-21CCBBD16EA3}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "symlinked_cpp", "symlinked_cpp\symlinked_cpp.vcxproj", "{E37919AE-1A38-4E61-8E5E-FE4F981C6BFD}"
         ProjectSection(ProjectDependencies) = postProject
                 {F94CCADD-A90B-480C-A304-C19D015D36B1} = {F94CCADD-A90B-480C-A304-C19D015D36B1}
                 {FFD738F7-96F0-445C-81EA-551665EF53D1} = {FFD738F7-96F0-445C-81EA-551665EF53D1}
@@ -173,10 +175,14 @@
                 {3667C35E-78D5-43D4-AAC2-349145E4341D}.Debug|Win32.Build.0 = Debug|Win32
                 {3667C35E-78D5-43D4-AAC2-349145E4341D}.Release|Win32.ActiveCfg = Release|Win32
                 {3667C35E-78D5-43D4-AAC2-349145E4341D}.Release|Win32.Build.0 = Release|Win32
- {B1FA4137-7B08-4113-9EC0-F3BAFEFBE2B7}.Debug|Win32.ActiveCfg = Debug|Win32
- {B1FA4137-7B08-4113-9EC0-F3BAFEFBE2B7}.Debug|Win32.Build.0 = Debug|Win32
- {B1FA4137-7B08-4113-9EC0-F3BAFEFBE2B7}.Release|Win32.ActiveCfg = Release|Win32
- {B1FA4137-7B08-4113-9EC0-F3BAFEFBE2B7}.Release|Win32.Build.0 = Release|Win32
+ {20E2805D-9634-46CE-B979-21CCBBD16EA3}.Debug|Win32.ActiveCfg = Debug|Win32
+ {20E2805D-9634-46CE-B979-21CCBBD16EA3}.Debug|Win32.Build.0 = Debug|Win32
+ {20E2805D-9634-46CE-B979-21CCBBD16EA3}.Release|Win32.ActiveCfg = Release|Win32
+ {20E2805D-9634-46CE-B979-21CCBBD16EA3}.Release|Win32.Build.0 = Release|Win32
+ {E37919AE-1A38-4E61-8E5E-FE4F981C6BFD}.Debug|Win32.ActiveCfg = Debug|Win32
+ {E37919AE-1A38-4E61-8E5E-FE4F981C6BFD}.Debug|Win32.Build.0 = Debug|Win32
+ {E37919AE-1A38-4E61-8E5E-FE4F981C6BFD}.Release|Win32.ActiveCfg = Release|Win32
+ {E37919AE-1A38-4E61-8E5E-FE4F981C6BFD}.Release|Win32.Build.0 = Release|Win32
         EndGlobalSection
         GlobalSection(SolutionProperties) = preSolution
                 HideSolutionNode = FALSE

Modified: branches/release/libs/filesystem/v3/test/operations_test.cpp
==============================================================================
--- branches/release/libs/filesystem/v3/test/operations_test.cpp (original)
+++ branches/release/libs/filesystem/v3/test/operations_test.cpp 2012-01-28 09:40:16 EST (Sat, 28 Jan 2012)
@@ -614,6 +614,20 @@
     BOOST_TEST(walk_tree(false) == 1);
     if (create_symlink_ok)
       BOOST_TEST(walk_tree(true) > 1);
+
+ // test iterator increment with error_code argument
+ boost::system::error_code ec;
+ int d1f1_count = 0;
+ for (fs::recursive_directory_iterator it (dir, fs::symlink_option::no_recurse);
+ it != fs::recursive_directory_iterator();
+ it.increment(ec))
+ {
+ if (it->path().filename() == "d1f1")
+ ++d1f1_count;
+ }
+ BOOST_TEST(!ec);
+ BOOST_TEST(d1f1_count == 1);
+
     cout << " recursive_directory_iterator_tests complete" << endl;
   }
 

Modified: branches/release/libs/filesystem/v3/test/path_test.cpp
==============================================================================
--- branches/release/libs/filesystem/v3/test/path_test.cpp (original)
+++ branches/release/libs/filesystem/v3/test/path_test.cpp 2012-01-28 09:40:16 EST (Sat, 28 Jan 2012)
@@ -19,8 +19,23 @@
 // //
 // The class path relational operators (==, !=, <, etc.) on Windows treat slash and //
 // backslash as equal. Thus any tests on Windows where the difference between slash //
-// and backslash is significant should compare based on native observers rather than //
-// directly on path objects. //
+// and backslash is significant should compare strings rather than paths. //
+// //
+// BOOST_TEST(path == path) // '\\' and '/' are equal //
+// BOOST_TEST(path == convertable to string) // '\\' and '/' are equal //
+// PATH_TEST_EQ(path, path) // '\\' and '/' are equal //
+// //
+// BOOST_TEST(path.string() == path.string()) // '\\' and '/' are not equal //
+// BOOST_TEST(path.string() == //
+// convertable to string) // '\\' and '/' are not equal //
+// PATH_TEST_EQ(path.string(), //
+// convertable to string) // '\\' and '/' are not equal //
+// //
+// The last of these is often what is needed, so the PATH_TEST_EQ macro is provided. //
+// It converts its first argument to a path, and then performs a .string() on it, //
+// eliminating much boilerplate .string() or even path(...).string() code. //
+// //
+// PATH_TEST_EQ(path, convertable to string) // '\\' and '/' are not equal //
 // //
 //--------------------------------------------------------------------------------------//
 
@@ -57,8 +72,13 @@
 #include <boost/detail/lightweight_test.hpp>
 #include <boost/detail/lightweight_main.hpp>
 
-#define PATH_CHECK(a, b) check(a, b, __FILE__, __LINE__)
-#define CHECK_EQUAL(a,b) check_equal(a, b, __FILE__, __LINE__)
+#ifdef BOOST_WINDOWS_API
+# define BOOST_DIR_SEP "\\"
+#else
+# define BOOST_DIR_SEP "/"
+#endif
+
+#define PATH_TEST_EQ(a, b) check(a, b, __FILE__, __LINE__)
 
 namespace
 {
@@ -71,25 +91,13 @@
       return;
 
     std::cout << file
- << '(' << line << "): source: \"" << source
+ << '(' << line << "): source: \"" << source.string()
               << "\" != expected: \"" << expected
               << "\"" << std::endl;
 
     ++::boost::detail::test_errors();
   }
 
- void check_equal(const fs::path & source,
- const std::string & expected, const char* file, int line)
- {
- if (source == expected) return;
-
- ++::boost::detail::test_errors();
-
- std::cout << file << '(' << line << "): source: \"" << source
- << "\" != expected: \"" << expected
- << "\"" << std::endl;
- }
-
   path p1("fe/fi/fo/fum");
   path p2(p1);
   path p3;
@@ -161,9 +169,9 @@
 
     itr_ck = "/";
     itr = itr_ck.begin();
- BOOST_TEST(*itr == std::string("/"));
+ BOOST_TEST(itr->string() == "/");
     BOOST_TEST(++itr == itr_ck.end());
- BOOST_TEST(*--itr == std::string("/"));
+ BOOST_TEST((--itr)->string() == "/");
 
     itr_ck = "foo";
     BOOST_TEST(*itr_ck.begin() == std::string("foo"));
@@ -172,7 +180,7 @@
     BOOST_TEST(boost::prior(itr_ck.end()) == itr_ck.begin());
 
     itr_ck = path("/foo");
- BOOST_TEST(*itr_ck.begin() == std::string("/"));
+ BOOST_TEST((itr_ck.begin())->string() == "/");
     BOOST_TEST(*boost::next(itr_ck.begin()) == std::string("foo"));
     BOOST_TEST(boost::next(boost::next(itr_ck.begin())) == itr_ck.end());
     BOOST_TEST(boost::next(itr_ck.begin()) == boost::prior(itr_ck.end()));
@@ -182,121 +190,139 @@
 
     itr_ck = "/foo/bar";
     itr = itr_ck.begin();
- BOOST_TEST(*itr == std::string("/"));
+ BOOST_TEST(itr->string() == "/");
     BOOST_TEST(*++itr == std::string("foo"));
     BOOST_TEST(*++itr == std::string("bar"));
     BOOST_TEST(++itr == itr_ck.end());
- CHECK_EQUAL(*--itr, "bar");
- CHECK_EQUAL(*--itr, "foo");
- CHECK_EQUAL(*--itr, "/");
+ PATH_TEST_EQ(*--itr, "bar");
+ PATH_TEST_EQ(*--itr, "foo");
+ PATH_TEST_EQ(*--itr, "/");
 
     itr_ck = "../f"; // previously failed due to short name bug
     itr = itr_ck.begin();
- CHECK_EQUAL(*itr, "..");
- CHECK_EQUAL(*++itr, "f");
+ PATH_TEST_EQ(itr->string(), "..");
+ PATH_TEST_EQ(*++itr, "f");
     BOOST_TEST(++itr == itr_ck.end());
- CHECK_EQUAL(*--itr, "f");
- CHECK_EQUAL(*--itr, "..");
+ PATH_TEST_EQ(*--itr, "f");
+ PATH_TEST_EQ(*--itr, "..");
 
     // POSIX says treat "/foo/bar/" as "/foo/bar/."
     itr_ck = "/foo/bar/";
     itr = itr_ck.begin();
- CHECK_EQUAL(*itr, "/");
- CHECK_EQUAL(*++itr, "foo");
- CHECK_EQUAL(*++itr, "bar");
- CHECK_EQUAL(*++itr, ".");
+ PATH_TEST_EQ(itr->string(), "/");
+ PATH_TEST_EQ(*++itr, "foo");
+ PATH_TEST_EQ(*++itr, "bar");
+ PATH_TEST_EQ(*++itr, ".");
     BOOST_TEST(++itr == itr_ck.end());
- CHECK_EQUAL(*--itr, ".");
- CHECK_EQUAL(*--itr, "bar");
- CHECK_EQUAL(*--itr, "foo");
- CHECK_EQUAL(*--itr, "/");
+ PATH_TEST_EQ(*--itr, ".");
+ PATH_TEST_EQ(*--itr, "bar");
+ PATH_TEST_EQ(*--itr, "foo");
+ PATH_TEST_EQ(*--itr, "/");
 
     // POSIX says treat "/f/b/" as "/f/b/."
     itr_ck = "/f/b/";
     itr = itr_ck.begin();
- CHECK_EQUAL(*itr, "/");
- CHECK_EQUAL(*++itr, "f");
- CHECK_EQUAL(*++itr, "b");
- CHECK_EQUAL(*++itr, ".");
+ PATH_TEST_EQ(itr->string(), "/");
+ PATH_TEST_EQ(*++itr, "f");
+ PATH_TEST_EQ(*++itr, "b");
+ PATH_TEST_EQ(*++itr, ".");
     BOOST_TEST(++itr == itr_ck.end());
- CHECK_EQUAL(*--itr, ".");
- CHECK_EQUAL(*--itr, "b");
- CHECK_EQUAL(*--itr, "f");
- CHECK_EQUAL(*--itr, "/");
+ PATH_TEST_EQ(*--itr, ".");
+ PATH_TEST_EQ(*--itr, "b");
+ PATH_TEST_EQ(*--itr, "f");
+ PATH_TEST_EQ(*--itr, "/");
 
     itr_ck = "//net";
     itr = itr_ck.begin();
     // two leading slashes are permitted by POSIX (as implementation defined),
     // while for Windows it is always well defined (as a network name)
- CHECK_EQUAL(*itr, "//net");
+ PATH_TEST_EQ(itr->string(), "//net");
     BOOST_TEST(++itr == itr_ck.end());
- CHECK_EQUAL(*--itr, "//net");
+ PATH_TEST_EQ(*--itr, "//net");
 
     itr_ck = "//net/";
     itr = itr_ck.begin();
- CHECK_EQUAL(*itr, "//net");
- CHECK_EQUAL(*++itr, "/");
+ PATH_TEST_EQ(itr->string(), "//net");
+ PATH_TEST_EQ(*++itr, "/");
     BOOST_TEST(++itr == itr_ck.end());
- CHECK_EQUAL(*--itr, "/");
- CHECK_EQUAL(*--itr, "//net");
+ PATH_TEST_EQ(*--itr, "/");
+ PATH_TEST_EQ(*--itr, "//net");
 
     itr_ck = "//foo///bar///";
     itr = itr_ck.begin();
- CHECK_EQUAL(*itr, "//foo");
- CHECK_EQUAL(*++itr, "/");
- CHECK_EQUAL(*++itr, "bar");
- CHECK_EQUAL(*++itr, ".");
+ PATH_TEST_EQ(itr->string(), "//foo");
+ PATH_TEST_EQ(*++itr, "/");
+ PATH_TEST_EQ(*++itr, "bar");
+ PATH_TEST_EQ(*++itr, ".");
     BOOST_TEST(++itr == itr_ck.end());
- CHECK_EQUAL(*--itr, ".");
- CHECK_EQUAL(*--itr, "bar");
- CHECK_EQUAL(*--itr, "/");
- CHECK_EQUAL(*--itr, "//foo");
+ PATH_TEST_EQ(*--itr, ".");
+ PATH_TEST_EQ(*--itr, "bar");
+ PATH_TEST_EQ(*--itr, "/");
+ PATH_TEST_EQ(*--itr, "//foo");
 
     itr_ck = "///foo///bar///";
     itr = itr_ck.begin();
     // three or more leading slashes are to be treated as a single slash
- CHECK_EQUAL(*itr, "/");
- CHECK_EQUAL(*++itr, "foo");
- CHECK_EQUAL(*++itr, "bar");
- CHECK_EQUAL(*++itr, ".");
+ PATH_TEST_EQ(itr->string(), "/");
+ PATH_TEST_EQ(*++itr, "foo");
+ PATH_TEST_EQ(*++itr, "bar");
+ PATH_TEST_EQ(*++itr, ".");
     BOOST_TEST(++itr == itr_ck.end());
- CHECK_EQUAL(*--itr, ".");
- CHECK_EQUAL(*--itr, "bar");
- CHECK_EQUAL(*--itr, "foo");
- CHECK_EQUAL(*--itr, "/");
+ PATH_TEST_EQ(*--itr, ".");
+ PATH_TEST_EQ(*--itr, "bar");
+ PATH_TEST_EQ(*--itr, "foo");
+ PATH_TEST_EQ(*--itr, "/");
 
     if (platform == "Windows")
     {
       itr_ck = "c:/";
       itr = itr_ck.begin();
- CHECK_EQUAL(*itr, "c:");
- CHECK_EQUAL(*++itr, "/");
+ PATH_TEST_EQ(itr->string(), "c:");
+ PATH_TEST_EQ(*++itr, std::string("/"));
       BOOST_TEST(++itr == itr_ck.end());
- CHECK_EQUAL(*--itr, "/");
- CHECK_EQUAL(*--itr, "c:");
+ PATH_TEST_EQ(*--itr, "/");
+ PATH_TEST_EQ(*--itr, "c:");
 
- itr_ck = "c:\\foo";
+ itr_ck = "c:\\";
+ itr = itr_ck.begin();
+ PATH_TEST_EQ(itr->string(), "c:");
+ PATH_TEST_EQ(*++itr, "/"); // test that iteration returns generic format
+ BOOST_TEST(++itr == itr_ck.end());
+ PATH_TEST_EQ(*--itr, "/"); // test that iteration returns generic format
+ PATH_TEST_EQ(*--itr, "c:");
+
+ itr_ck = "c:/foo";
       itr = itr_ck.begin();
       BOOST_TEST(*itr == std::string("c:"));
       BOOST_TEST(*++itr == std::string("/"));
       BOOST_TEST(*++itr == std::string("foo"));
       BOOST_TEST(++itr == itr_ck.end());
       BOOST_TEST(*--itr == std::string("foo"));
- BOOST_TEST(*--itr == std::string("/"));
+ BOOST_TEST((--itr)->string() == "/");
+ BOOST_TEST(*--itr == std::string("c:"));
+
+ itr_ck = "c:\\foo";
+ itr = itr_ck.begin();
+ BOOST_TEST(*itr == std::string("c:"));
+ BOOST_TEST(*++itr == std::string("\\"));
+ BOOST_TEST(*++itr == std::string("foo"));
+ BOOST_TEST(++itr == itr_ck.end());
+ BOOST_TEST(*--itr == std::string("foo"));
+ BOOST_TEST(*--itr == std::string("\\"));
       BOOST_TEST(*--itr == std::string("c:"));
 
       itr_ck = "\\\\\\foo\\\\\\bar\\\\\\";
       itr = itr_ck.begin();
       // three or more leading slashes are to be treated as a single slash
- CHECK_EQUAL(*itr, "/");
- CHECK_EQUAL(*++itr, "foo");
- CHECK_EQUAL(*++itr, "bar");
- CHECK_EQUAL(*++itr, ".");
+ PATH_TEST_EQ(itr->string(), "/");
+ PATH_TEST_EQ(*++itr, "foo");
+ PATH_TEST_EQ(*++itr, "bar");
+ PATH_TEST_EQ(*++itr, ".");
       BOOST_TEST(++itr == itr_ck.end());
- CHECK_EQUAL(*--itr, ".");
- CHECK_EQUAL(*--itr, "bar");
- CHECK_EQUAL(*--itr, "foo");
- CHECK_EQUAL(*--itr, "/");
+ PATH_TEST_EQ(*--itr, ".");
+ PATH_TEST_EQ(*--itr, "bar");
+ PATH_TEST_EQ(*--itr, "foo");
+ PATH_TEST_EQ(*--itr, "/");
 
       itr_ck = "c:foo";
       itr = itr_ck.begin();
@@ -355,12 +381,12 @@
       BOOST_TEST(*prior(itr_ck.end()) == std::string("//net"));
 
       itr_ck = path("//net/");
- CHECK_EQUAL(*itr_ck.begin(), "//net");
- CHECK_EQUAL(*next(itr_ck.begin()), "/");
+ PATH_TEST_EQ(itr_ck.begin()->string(), "//net");
+ PATH_TEST_EQ(next(itr_ck.begin())->string(), "/");
       BOOST_TEST(next(next(itr_ck.begin())) == itr_ck.end());
       BOOST_TEST(prior(prior(itr_ck.end())) == itr_ck.begin());
- CHECK_EQUAL(*prior(itr_ck.end()), "/");
- CHECK_EQUAL(*prior(prior(itr_ck.end())), "//net");
+ PATH_TEST_EQ(prior(itr_ck.end())->string(), "/");
+ PATH_TEST_EQ(prior(prior(itr_ck.end()))->string(), "//net");
 
       itr_ck = path("//net/foo");
       BOOST_TEST(*itr_ck.begin() == std::string("//net"));
@@ -382,7 +408,7 @@
     {
       itr_ck = "///";
       itr = itr_ck.begin();
- CHECK_EQUAL(*itr, "/");
+ PATH_TEST_EQ(itr->string(), "/");
       BOOST_TEST(++itr == itr_ck.end());
     }
   }
@@ -421,8 +447,8 @@
     BOOST_TEST(b.string() == "b");
 
     // probe operator /
- PATH_CHECK(path("") / ".", ".");
- PATH_CHECK(path("") / "..", "..");
+ PATH_TEST_EQ(path("") / ".", ".");
+ PATH_TEST_EQ(path("") / "..", "..");
     if (platform == "Windows")
     {
       BOOST_TEST(path("foo\\bar") == "foo/bar");
@@ -431,93 +457,93 @@
       BOOST_TEST((bcs / a).native() == path("b\\a").native());
       BOOST_TEST((b / as).native() == path("b\\a").native());
       BOOST_TEST((b / acs).native() == path("b\\a").native());
- PATH_CHECK(path("a") / "b", "a\\b");
- PATH_CHECK(path("..") / "", "..");
- PATH_CHECK(path("foo") / path("bar"), "foo\\bar"); // path arg
- PATH_CHECK(path("foo") / "bar", "foo\\bar"); // const char* arg
- PATH_CHECK(path("foo") / path("woo/bar").filename(), "foo\\bar"); // const std::string & arg
- PATH_CHECK("foo" / path("bar"), "foo\\bar");
- PATH_CHECK(path("..") / ".." , "..\\..");
- PATH_CHECK(path("/") / ".." , "/..");
- PATH_CHECK(path("/..") / ".." , "/..\\..");
- PATH_CHECK(path("..") / "foo" , "..\\foo");
- PATH_CHECK(path("foo") / ".." , "foo\\..");
- PATH_CHECK(path("..") / "f" , "..\\f");
- PATH_CHECK(path("/..") / "f" , "/..\\f");
- PATH_CHECK(path("f") / ".." , "f\\..");
- PATH_CHECK(path("foo") / ".." / ".." , "foo\\..\\..");
- PATH_CHECK(path("foo") / ".." / ".." / ".." , "foo\\..\\..\\..");
- PATH_CHECK(path("f") / ".." / "b" , "f\\..\\b");
- PATH_CHECK(path("foo") / ".." / "bar" , "foo\\..\\bar");
- PATH_CHECK(path("foo") / "bar" / ".." , "foo\\bar\\..");
- PATH_CHECK(path("foo") / "bar" / ".." / "..", "foo\\bar\\..\\..");
- PATH_CHECK(path("foo") / "bar" / ".." / "blah", "foo\\bar\\..\\blah");
- PATH_CHECK(path("f") / "b" / ".." , "f\\b\\..");
- PATH_CHECK(path("f") / "b" / ".." / "a", "f\\b\\..\\a");
- PATH_CHECK(path("foo") / "bar" / "blah" / ".." / "..", "foo\\bar\\blah\\..\\..");
- PATH_CHECK(path("foo") / "bar" / "blah" / ".." / ".." / "bletch", "foo\\bar\\blah\\..\\..\\bletch");
-
- PATH_CHECK(path(".") / "foo", ".\\foo");
- PATH_CHECK(path(".") / "..", ".\\..");
- PATH_CHECK(path("foo") / ".", "foo\\.");
- PATH_CHECK(path("..") / ".", "..\\.");
- PATH_CHECK(path(".") / ".", ".\\.");
- PATH_CHECK(path(".") / "." / ".", ".\\.\\.");
- PATH_CHECK(path(".") / "foo" / ".", ".\\foo\\.");
- PATH_CHECK(path("foo") / "." / "bar", "foo\\.\\bar");
- PATH_CHECK(path("foo") / "." / ".", "foo\\.\\.");
- PATH_CHECK(path("foo") / "." / "..", "foo\\.\\..");
- PATH_CHECK(path(".") / "." / "..", ".\\.\\..");
- PATH_CHECK(path(".") / ".." / ".", ".\\..\\.");
- PATH_CHECK(path("..") / "." / ".", "..\\.\\.");
+ PATH_TEST_EQ(path("a") / "b", "a\\b");
+ PATH_TEST_EQ(path("..") / "", "..");
+ PATH_TEST_EQ(path("foo") / path("bar"), "foo\\bar"); // path arg
+ PATH_TEST_EQ(path("foo") / "bar", "foo\\bar"); // const char* arg
+ PATH_TEST_EQ(path("foo") / path("woo/bar").filename(), "foo\\bar"); // const std::string & arg
+ PATH_TEST_EQ("foo" / path("bar"), "foo\\bar");
+ PATH_TEST_EQ(path("..") / ".." , "..\\..");
+ PATH_TEST_EQ(path("/") / ".." , "/..");
+ PATH_TEST_EQ(path("/..") / ".." , "/..\\..");
+ PATH_TEST_EQ(path("..") / "foo" , "..\\foo");
+ PATH_TEST_EQ(path("foo") / ".." , "foo\\..");
+ PATH_TEST_EQ(path("..") / "f" , "..\\f");
+ PATH_TEST_EQ(path("/..") / "f" , "/..\\f");
+ PATH_TEST_EQ(path("f") / ".." , "f\\..");
+ PATH_TEST_EQ(path("foo") / ".." / ".." , "foo\\..\\..");
+ PATH_TEST_EQ(path("foo") / ".." / ".." / ".." , "foo\\..\\..\\..");
+ PATH_TEST_EQ(path("f") / ".." / "b" , "f\\..\\b");
+ PATH_TEST_EQ(path("foo") / ".." / "bar" , "foo\\..\\bar");
+ PATH_TEST_EQ(path("foo") / "bar" / ".." , "foo\\bar\\..");
+ PATH_TEST_EQ(path("foo") / "bar" / ".." / "..", "foo\\bar\\..\\..");
+ PATH_TEST_EQ(path("foo") / "bar" / ".." / "blah", "foo\\bar\\..\\blah");
+ PATH_TEST_EQ(path("f") / "b" / ".." , "f\\b\\..");
+ PATH_TEST_EQ(path("f") / "b" / ".." / "a", "f\\b\\..\\a");
+ PATH_TEST_EQ(path("foo") / "bar" / "blah" / ".." / "..", "foo\\bar\\blah\\..\\..");
+ PATH_TEST_EQ(path("foo") / "bar" / "blah" / ".." / ".." / "bletch", "foo\\bar\\blah\\..\\..\\bletch");
+
+ PATH_TEST_EQ(path(".") / "foo", ".\\foo");
+ PATH_TEST_EQ(path(".") / "..", ".\\..");
+ PATH_TEST_EQ(path("foo") / ".", "foo\\.");
+ PATH_TEST_EQ(path("..") / ".", "..\\.");
+ PATH_TEST_EQ(path(".") / ".", ".\\.");
+ PATH_TEST_EQ(path(".") / "." / ".", ".\\.\\.");
+ PATH_TEST_EQ(path(".") / "foo" / ".", ".\\foo\\.");
+ PATH_TEST_EQ(path("foo") / "." / "bar", "foo\\.\\bar");
+ PATH_TEST_EQ(path("foo") / "." / ".", "foo\\.\\.");
+ PATH_TEST_EQ(path("foo") / "." / "..", "foo\\.\\..");
+ PATH_TEST_EQ(path(".") / "." / "..", ".\\.\\..");
+ PATH_TEST_EQ(path(".") / ".." / ".", ".\\..\\.");
+ PATH_TEST_EQ(path("..") / "." / ".", "..\\.\\.");
     }
     else // POSIX
     {
- BOOST_TEST((b / a).string() == "b/a");
- BOOST_TEST((bs / a).string() == "b/a");
- BOOST_TEST((bcs / a).string() == "b/a");
- BOOST_TEST((b / as).string() == "b/a");
- BOOST_TEST((b / acs).string() == "b/a");
- PATH_CHECK(path("a") / "b", "a/b");
- PATH_CHECK(path("..") / "", "..");
- PATH_CHECK(path("") / "..", "..");
- PATH_CHECK(path("foo") / path("bar"), "foo/bar"); // path arg
- PATH_CHECK(path("foo") / "bar", "foo/bar"); // const char* arg
- PATH_CHECK(path("foo") / path("woo/bar").filename(), "foo/bar"); // const std::string & arg
- PATH_CHECK("foo" / path("bar"), "foo/bar");
- PATH_CHECK(path("..") / ".." , "../..");
- PATH_CHECK(path("/") / ".." , "/..");
- PATH_CHECK(path("/..") / ".." , "/../..");
- PATH_CHECK(path("..") / "foo" , "../foo");
- PATH_CHECK(path("foo") / ".." , "foo/..");
- PATH_CHECK(path("..") / "f" , "../f");
- PATH_CHECK(path("/..") / "f" , "/../f");
- PATH_CHECK(path("f") / ".." , "f/..");
- PATH_CHECK(path("foo") / ".." / ".." , "foo/../..");
- PATH_CHECK(path("foo") / ".." / ".." / ".." , "foo/../../..");
- PATH_CHECK(path("f") / ".." / "b" , "f/../b");
- PATH_CHECK(path("foo") / ".." / "bar" , "foo/../bar");
- PATH_CHECK(path("foo") / "bar" / ".." , "foo/bar/..");
- PATH_CHECK(path("foo") / "bar" / ".." / "..", "foo/bar/../..");
- PATH_CHECK(path("foo") / "bar" / ".." / "blah", "foo/bar/../blah");
- PATH_CHECK(path("f") / "b" / ".." , "f/b/..");
- PATH_CHECK(path("f") / "b" / ".." / "a", "f/b/../a");
- PATH_CHECK(path("foo") / "bar" / "blah" / ".." / "..", "foo/bar/blah/../..");
- PATH_CHECK(path("foo") / "bar" / "blah" / ".." / ".." / "bletch", "foo/bar/blah/../../bletch");
-
- PATH_CHECK(path(".") / "foo", "./foo");
- PATH_CHECK(path(".") / "..", "./..");
- PATH_CHECK(path("foo") / ".", "foo/.");
- PATH_CHECK(path("..") / ".", "../.");
- PATH_CHECK(path(".") / ".", "./.");
- PATH_CHECK(path(".") / "." / ".", "././.");
- PATH_CHECK(path(".") / "foo" / ".", "./foo/.");
- PATH_CHECK(path("foo") / "." / "bar", "foo/./bar");
- PATH_CHECK(path("foo") / "." / ".", "foo/./.");
- PATH_CHECK(path("foo") / "." / "..", "foo/./..");
- PATH_CHECK(path(".") / "." / "..", "././..");
- PATH_CHECK(path(".") / ".." / ".", "./../.");
- PATH_CHECK(path("..") / "." / ".", ".././.");
+ PATH_TEST_EQ(b / a, "b/a");
+ PATH_TEST_EQ(bs / a, "b/a");
+ PATH_TEST_EQ(bcs / a, "b/a");
+ PATH_TEST_EQ(b / as, "b/a");
+ PATH_TEST_EQ(b / acs, "b/a");
+ PATH_TEST_EQ(path("a") / "b", "a/b");
+ PATH_TEST_EQ(path("..") / "", "..");
+ PATH_TEST_EQ(path("") / "..", "..");
+ PATH_TEST_EQ(path("foo") / path("bar"), "foo/bar"); // path arg
+ PATH_TEST_EQ(path("foo") / "bar", "foo/bar"); // const char* arg
+ PATH_TEST_EQ(path("foo") / path("woo/bar").filename(), "foo/bar"); // const std::string & arg
+ PATH_TEST_EQ("foo" / path("bar"), "foo/bar");
+ PATH_TEST_EQ(path("..") / ".." , "../..");
+ PATH_TEST_EQ(path("/") / ".." , "/..");
+ PATH_TEST_EQ(path("/..") / ".." , "/../..");
+ PATH_TEST_EQ(path("..") / "foo" , "../foo");
+ PATH_TEST_EQ(path("foo") / ".." , "foo/..");
+ PATH_TEST_EQ(path("..") / "f" , "../f");
+ PATH_TEST_EQ(path("/..") / "f" , "/../f");
+ PATH_TEST_EQ(path("f") / ".." , "f/..");
+ PATH_TEST_EQ(path("foo") / ".." / ".." , "foo/../..");
+ PATH_TEST_EQ(path("foo") / ".." / ".." / ".." , "foo/../../..");
+ PATH_TEST_EQ(path("f") / ".." / "b" , "f/../b");
+ PATH_TEST_EQ(path("foo") / ".." / "bar" , "foo/../bar");
+ PATH_TEST_EQ(path("foo") / "bar" / ".." , "foo/bar/..");
+ PATH_TEST_EQ(path("foo") / "bar" / ".." / "..", "foo/bar/../..");
+ PATH_TEST_EQ(path("foo") / "bar" / ".." / "blah", "foo/bar/../blah");
+ PATH_TEST_EQ(path("f") / "b" / ".." , "f/b/..");
+ PATH_TEST_EQ(path("f") / "b" / ".." / "a", "f/b/../a");
+ PATH_TEST_EQ(path("foo") / "bar" / "blah" / ".." / "..", "foo/bar/blah/../..");
+ PATH_TEST_EQ(path("foo") / "bar" / "blah" / ".." / ".." / "bletch", "foo/bar/blah/../../bletch");
+
+ PATH_TEST_EQ(path(".") / "foo", "./foo");
+ PATH_TEST_EQ(path(".") / "..", "./..");
+ PATH_TEST_EQ(path("foo") / ".", "foo/.");
+ PATH_TEST_EQ(path("..") / ".", "../.");
+ PATH_TEST_EQ(path(".") / ".", "./.");
+ PATH_TEST_EQ(path(".") / "." / ".", "././.");
+ PATH_TEST_EQ(path(".") / "foo" / ".", "./foo/.");
+ PATH_TEST_EQ(path("foo") / "." / "bar", "foo/./bar");
+ PATH_TEST_EQ(path("foo") / "." / ".", "foo/./.");
+ PATH_TEST_EQ(path("foo") / "." / "..", "foo/./..");
+ PATH_TEST_EQ(path(".") / "." / "..", "././..");
+ PATH_TEST_EQ(path(".") / ".." / ".", "./../.");
+ PATH_TEST_EQ(path("..") / "." / ".", ".././.");
     }
 
     // probe operator <
@@ -718,7 +744,7 @@
     p = q = "";
     BOOST_TEST(p.relative_path().string() == "");
     BOOST_TEST(p.parent_path().string() == "");
- BOOST_TEST_EQ(q.remove_filename().string(), p.parent_path().string());
+ PATH_TEST_EQ(q.remove_filename().string(), p.parent_path().string());
     BOOST_TEST(p.filename() == "");
     BOOST_TEST(p.stem() == "");
     BOOST_TEST(p.extension() == "");
@@ -738,7 +764,7 @@
     p = q = "/";
     BOOST_TEST(p.relative_path().string() == "");
     BOOST_TEST(p.parent_path().string() == "");
- BOOST_TEST_EQ(q.remove_filename().string(), p.parent_path().string());
+ PATH_TEST_EQ(q.remove_filename().string(), p.parent_path().string());
     BOOST_TEST(p.filename() == "/");
     BOOST_TEST(p.stem() == "/");
     BOOST_TEST(p.extension() == "");
@@ -759,15 +785,15 @@
       BOOST_TEST(!p.is_absolute());
 
     p = q = "//";
- CHECK_EQUAL(p.relative_path().string(), "");
- CHECK_EQUAL(p.parent_path().string(), "");
- BOOST_TEST_EQ(q.remove_filename().string(), p.parent_path().string());
- CHECK_EQUAL(p.filename(), "//");
- CHECK_EQUAL(p.stem(), "//");
- CHECK_EQUAL(p.extension(), "");
- CHECK_EQUAL(p.root_name(), "//");
- CHECK_EQUAL(p.root_directory(), "");
- CHECK_EQUAL(p.root_path().string(), "//");
+ PATH_TEST_EQ(p.relative_path().string(), "");
+ PATH_TEST_EQ(p.parent_path().string(), "");
+ PATH_TEST_EQ(q.remove_filename().string(), p.parent_path().string());
+ PATH_TEST_EQ(p.filename(), "//");
+ PATH_TEST_EQ(p.stem(), "//");
+ PATH_TEST_EQ(p.extension(), "");
+ PATH_TEST_EQ(p.root_name(), "//");
+ PATH_TEST_EQ(p.root_directory(), "");
+ PATH_TEST_EQ(p.root_path().string(), "//");
     BOOST_TEST(p.has_root_path());
     BOOST_TEST(p.has_root_name());
     BOOST_TEST(!p.has_root_directory());
@@ -779,15 +805,15 @@
     BOOST_TEST(!p.is_absolute());
 
     p = q = "///";
- CHECK_EQUAL(p.relative_path().string(), "");
- CHECK_EQUAL(p.parent_path().string(), "");
- BOOST_TEST_EQ(q.remove_filename().string(), p.parent_path().string());
- CHECK_EQUAL(p.filename(), "/");
- CHECK_EQUAL(p.stem(), "/");
- CHECK_EQUAL(p.extension(), "");
- CHECK_EQUAL(p.root_name(), "");
- CHECK_EQUAL(p.root_directory(), "/");
- CHECK_EQUAL(p.root_path().string(), "/");
+ PATH_TEST_EQ(p.relative_path().string(), "");
+ PATH_TEST_EQ(p.parent_path().string(), "");
+ PATH_TEST_EQ(q.remove_filename().string(), p.parent_path().string());
+ PATH_TEST_EQ(p.filename(), "/");
+ PATH_TEST_EQ(p.stem(), "/");
+ PATH_TEST_EQ(p.extension(), "");
+ PATH_TEST_EQ(p.root_name(), "");
+ PATH_TEST_EQ(p.root_directory(), "/");
+ PATH_TEST_EQ(p.root_path().string(), "/");
     BOOST_TEST(p.has_root_path());
     BOOST_TEST(!p.has_root_name());
     BOOST_TEST(p.has_root_directory());
@@ -804,7 +830,7 @@
     p = q = ".";
     BOOST_TEST(p.relative_path().string() == ".");
     BOOST_TEST(p.parent_path().string() == "");
- BOOST_TEST_EQ(q.remove_filename().string(), p.parent_path().string());
+ PATH_TEST_EQ(q.remove_filename().string(), p.parent_path().string());
     BOOST_TEST(p.filename() == ".");
     BOOST_TEST(p.stem() == ".");
     BOOST_TEST(p.extension() == "");
@@ -824,7 +850,7 @@
     p = q = "..";
     BOOST_TEST(p.relative_path().string() == "..");
     BOOST_TEST(p.parent_path().string() == "");
- BOOST_TEST_EQ(q.remove_filename().string(), p.parent_path().string());
+ PATH_TEST_EQ(q.remove_filename().string(), p.parent_path().string());
     BOOST_TEST(p.filename() == "..");
     BOOST_TEST(p.stem() == "..");
     BOOST_TEST(p.extension() == "");
@@ -844,7 +870,7 @@
     p = q = "foo";
     BOOST_TEST(p.relative_path().string() == "foo");
     BOOST_TEST(p.parent_path().string() == "");
- BOOST_TEST_EQ(q.remove_filename().string(), p.parent_path().string());
+ PATH_TEST_EQ(q.remove_filename().string(), p.parent_path().string());
     BOOST_TEST(p.filename() == "foo");
     BOOST_TEST(p.stem() == "foo");
     BOOST_TEST(p.extension() == "");
@@ -862,15 +888,15 @@
     BOOST_TEST(!p.is_absolute());
 
     p = q = "/foo";
- CHECK_EQUAL(p.relative_path().string(), "foo");
- CHECK_EQUAL(p.parent_path().string(), "/");
- BOOST_TEST_EQ(q.remove_filename().string(), p.parent_path().string());
- CHECK_EQUAL(p.filename(), "foo");
- CHECK_EQUAL(p.stem(), "foo");
- CHECK_EQUAL(p.extension(), "");
- CHECK_EQUAL(p.root_name(), "");
- CHECK_EQUAL(p.root_directory(), "/");
- CHECK_EQUAL(p.root_path().string(), "/");
+ PATH_TEST_EQ(p.relative_path().string(), "foo");
+ PATH_TEST_EQ(p.parent_path().string(), "/");
+ PATH_TEST_EQ(q.remove_filename().string(), p.parent_path().string());
+ PATH_TEST_EQ(p.filename(), "foo");
+ PATH_TEST_EQ(p.stem(), "foo");
+ PATH_TEST_EQ(p.extension(), "");
+ PATH_TEST_EQ(p.root_name(), "");
+ PATH_TEST_EQ(p.root_directory(), "/");
+ PATH_TEST_EQ(p.root_path().string(), "/");
     BOOST_TEST(p.has_root_path());
     BOOST_TEST(!p.has_root_name());
     BOOST_TEST(p.has_root_directory());
@@ -885,15 +911,15 @@
       BOOST_TEST(!p.is_absolute());
 
     p = q = "/foo/";
- CHECK_EQUAL(p.relative_path().string(), "foo/");
- CHECK_EQUAL(p.parent_path().string(), "/foo");
- BOOST_TEST_EQ(q.remove_filename().string(), p.parent_path().string());
- CHECK_EQUAL(p.filename(), ".");
- CHECK_EQUAL(p.stem(), ".");
- CHECK_EQUAL(p.extension(), "");
- CHECK_EQUAL(p.root_name(), "");
- CHECK_EQUAL(p.root_directory(), "/");
- CHECK_EQUAL(p.root_path().string(), "/");
+ PATH_TEST_EQ(p.relative_path().string(), "foo/");
+ PATH_TEST_EQ(p.parent_path().string(), "/foo");
+ PATH_TEST_EQ(q.remove_filename().string(), p.parent_path().string());
+ PATH_TEST_EQ(p.filename(), ".");
+ PATH_TEST_EQ(p.stem(), ".");
+ PATH_TEST_EQ(p.extension(), "");
+ PATH_TEST_EQ(p.root_name(), "");
+ PATH_TEST_EQ(p.root_directory(), "/");
+ PATH_TEST_EQ(p.root_path().string(), "/");
     BOOST_TEST(p.has_root_path());
     BOOST_TEST(!p.has_root_name());
     BOOST_TEST(p.has_root_directory());
@@ -908,13 +934,13 @@
       BOOST_TEST(!p.is_absolute());
 
     p = q = "///foo";
- CHECK_EQUAL(p.relative_path().string(), "foo");
- CHECK_EQUAL(p.parent_path().string(), "/");
- BOOST_TEST_EQ(q.remove_filename().string(), p.parent_path().string());
- CHECK_EQUAL(p.filename(), "foo");
- CHECK_EQUAL(p.root_name(), "");
- CHECK_EQUAL(p.root_directory(), "/");
- CHECK_EQUAL(p.root_path().string(), "/");
+ PATH_TEST_EQ(p.relative_path().string(), "foo");
+ PATH_TEST_EQ(p.parent_path().string(), "/");
+ PATH_TEST_EQ(q.remove_filename().string(), p.parent_path().string());
+ PATH_TEST_EQ(p.filename(), "foo");
+ PATH_TEST_EQ(p.root_name(), "");
+ PATH_TEST_EQ(p.root_directory(), "/");
+ PATH_TEST_EQ(p.root_path().string(), "/");
     BOOST_TEST(p.has_root_path());
     BOOST_TEST(!p.has_root_name());
     BOOST_TEST(p.has_root_directory());
@@ -929,7 +955,7 @@
     p = q = "foo/bar";
     BOOST_TEST(p.relative_path().string() == "foo/bar");
     BOOST_TEST(p.parent_path().string() == "foo");
- BOOST_TEST_EQ(q.remove_filename().string(), p.parent_path().string());
+ PATH_TEST_EQ(q.remove_filename().string(), p.parent_path().string());
     BOOST_TEST(p.filename() == "bar");
     BOOST_TEST(p.stem() == "bar");
     BOOST_TEST(p.extension() == "");
@@ -949,7 +975,7 @@
     p = q = "../foo";
     BOOST_TEST(p.relative_path().string() == "../foo");
     BOOST_TEST(p.parent_path().string() == "..");
- BOOST_TEST_EQ(q.remove_filename().string(), p.parent_path().string());
+ PATH_TEST_EQ(q.remove_filename().string(), p.parent_path().string());
     BOOST_TEST(p.filename() == "foo");
     BOOST_TEST(p.root_name() == "");
     BOOST_TEST(p.root_directory() == "");
@@ -963,13 +989,13 @@
     BOOST_TEST(!p.is_absolute());
 
     p = q = "..///foo";
- CHECK_EQUAL(p.relative_path().string(), "..///foo");
- CHECK_EQUAL(p.parent_path().string(), "..");
- BOOST_TEST_EQ(q.remove_filename().string(), p.parent_path().string());
- CHECK_EQUAL(p.filename(), "foo");
- CHECK_EQUAL(p.root_name(), "");
- CHECK_EQUAL(p.root_directory(), "");
- CHECK_EQUAL(p.root_path().string(), "");
+ PATH_TEST_EQ(p.relative_path().string(), "..///foo");
+ PATH_TEST_EQ(p.parent_path().string(), "..");
+ PATH_TEST_EQ(q.remove_filename().string(), p.parent_path().string());
+ PATH_TEST_EQ(p.filename(), "foo");
+ PATH_TEST_EQ(p.root_name(), "");
+ PATH_TEST_EQ(p.root_directory(), "");
+ PATH_TEST_EQ(p.root_path().string(), "");
     BOOST_TEST(!p.has_root_path());
     BOOST_TEST(!p.has_root_name());
     BOOST_TEST(!p.has_root_directory());
@@ -981,7 +1007,7 @@
     p = q = "/foo/bar";
     BOOST_TEST(p.relative_path().string() == "foo/bar");
     BOOST_TEST(p.parent_path().string() == "/foo");
- BOOST_TEST_EQ(q.remove_filename().string(), p.parent_path().string());
+ PATH_TEST_EQ(q.remove_filename().string(), p.parent_path().string());
     BOOST_TEST(p.filename() == "bar");
     BOOST_TEST(p.root_name() == "");
     BOOST_TEST(p.root_directory() == "/");
@@ -999,19 +1025,19 @@
 
     // Both POSIX and Windows allow two leading slashs
     // (POSIX meaning is implementation defined)
- PATH_CHECK(path("//resource"), "//resource");
- PATH_CHECK(path("//resource/"), "//resource/");
- PATH_CHECK(path("//resource/foo"), "//resource/foo");
+ PATH_TEST_EQ(path("//resource"), "//resource");
+ PATH_TEST_EQ(path("//resource/"), "//resource/");
+ PATH_TEST_EQ(path("//resource/foo"), "//resource/foo");
 
     p = q = path("//net");
- CHECK_EQUAL(p.string(), "//net");
- CHECK_EQUAL(p.relative_path().string(), "");
- BOOST_TEST_EQ(q.remove_filename().string(), p.parent_path().string());
- CHECK_EQUAL(p.parent_path().string(), "");
- CHECK_EQUAL(p.filename(), "//net");
- CHECK_EQUAL(p.root_name(), "//net");
- CHECK_EQUAL(p.root_directory(), "");
- CHECK_EQUAL(p.root_path().string(), "//net");
+ PATH_TEST_EQ(p.string(), "//net");
+ PATH_TEST_EQ(p.relative_path().string(), "");
+ PATH_TEST_EQ(q.remove_filename().string(), p.parent_path().string());
+ PATH_TEST_EQ(p.parent_path().string(), "");
+ PATH_TEST_EQ(p.filename(), "//net");
+ PATH_TEST_EQ(p.root_name(), "//net");
+ PATH_TEST_EQ(p.root_directory(), "");
+ PATH_TEST_EQ(p.root_path().string(), "//net");
     BOOST_TEST(p.has_root_path());
     BOOST_TEST(p.has_root_name());
     BOOST_TEST(!p.has_root_directory());
@@ -1023,7 +1049,7 @@
     p = q = path("//net/");
     BOOST_TEST(p.relative_path().string() == "");
     BOOST_TEST(p.parent_path().string() == "//net");
- BOOST_TEST_EQ(q.remove_filename().string(), p.parent_path().string());
+ PATH_TEST_EQ(q.remove_filename().string(), p.parent_path().string());
     BOOST_TEST(p.filename() == "/");
     BOOST_TEST(p.root_name() == "//net");
     BOOST_TEST(p.root_directory() == "/");
@@ -1039,7 +1065,7 @@
     p = q = path("//net/foo");
     BOOST_TEST(p.relative_path().string() == "foo");
     BOOST_TEST(p.parent_path().string() == "//net/");
- BOOST_TEST_EQ(q.remove_filename().string(), p.parent_path().string());
+ PATH_TEST_EQ(q.remove_filename().string(), p.parent_path().string());
     BOOST_TEST(p.filename() == "foo");
     BOOST_TEST(p.root_name() == "//net");
     BOOST_TEST(p.root_directory() == "/");
@@ -1053,13 +1079,13 @@
     BOOST_TEST(p.is_absolute());
 
     p = q = path("//net///foo");
- CHECK_EQUAL(p.relative_path().string(), "foo");
- CHECK_EQUAL(p.parent_path().string(), "//net/");
- BOOST_TEST_EQ(q.remove_filename().string(), p.parent_path().string());
- CHECK_EQUAL(p.filename(), "foo");
- CHECK_EQUAL(p.root_name(), "//net");
- CHECK_EQUAL(p.root_directory(), "/");
- CHECK_EQUAL(p.root_path().string(), "//net/");
+ PATH_TEST_EQ(p.relative_path().string(), "foo");
+ PATH_TEST_EQ(p.parent_path().string(), "//net/");
+ PATH_TEST_EQ(q.remove_filename().string(), p.parent_path().string());
+ PATH_TEST_EQ(p.filename(), "foo");
+ PATH_TEST_EQ(p.root_name(), "//net");
+ PATH_TEST_EQ(p.root_directory(), "/");
+ PATH_TEST_EQ(p.root_path().string(), "//net/");
     BOOST_TEST(p.has_root_path());
     BOOST_TEST(p.has_root_name());
     BOOST_TEST(p.has_root_directory());
@@ -1074,7 +1100,7 @@
       //p = q = L"\\\\?\\";
       //BOOST_TEST(p.relative_path().string() == "");
       //BOOST_TEST(p.parent_path().string() == "");
- //BOOST_TEST_EQ(q.remove_filename().string(), p.parent_path().string());
+ //PATH_TEST_EQ(q.remove_filename().string(), p.parent_path().string());
       //BOOST_TEST(p.filename() == "");
       //BOOST_TEST(p.stem() == "");
       //BOOST_TEST(p.extension() == "");
@@ -1094,7 +1120,7 @@
       p = q = path("c:");
       BOOST_TEST(p.relative_path().string() == "");
       BOOST_TEST(p.parent_path().string() == "");
- BOOST_TEST_EQ(q.remove_filename().string(), p.parent_path().string());
+ PATH_TEST_EQ(q.remove_filename().string(), p.parent_path().string());
       BOOST_TEST(p.filename() == "c:");
       BOOST_TEST(p.root_name() == "c:");
       BOOST_TEST(p.root_directory() == "");
@@ -1110,7 +1136,7 @@
       //p = q = path(L"\\\\?\\c:");
       //BOOST_TEST(p.relative_path().string() == "");
       //BOOST_TEST(p.parent_path().string() == "");
- //BOOST_TEST_EQ(q.remove_filename().string(), p.parent_path().string());
+ //PATH_TEST_EQ(q.remove_filename().string(), p.parent_path().string());
       //BOOST_TEST(p.filename() == "c:");
       //BOOST_TEST(p.root_name() == "c:");
       //BOOST_TEST(p.root_directory() == "");
@@ -1126,7 +1152,7 @@
       p = q = path("c:foo");
       BOOST_TEST(p.relative_path().string() == "foo");
       BOOST_TEST(p.parent_path().string() == "c:");
- BOOST_TEST_EQ(q.remove_filename().string(), p.parent_path().string());
+ PATH_TEST_EQ(q.remove_filename().string(), p.parent_path().string());
       BOOST_TEST(p.filename() == "foo");
       BOOST_TEST(p.root_name() == "c:");
       BOOST_TEST(p.root_directory() == "");
@@ -1142,7 +1168,7 @@
       //p = q = path(L"\\\\?\\c:foo");
       //BOOST_TEST(p.relative_path().string() == "foo");
       //BOOST_TEST(p.parent_path().string() == "c:");
- //BOOST_TEST_EQ(q.remove_filename().string(), p.parent_path().string());
+ //PATH_TEST_EQ(q.remove_filename().string(), p.parent_path().string());
       //BOOST_TEST(p.filename() == "foo");
       //BOOST_TEST(p.root_name() == "c:");
       //BOOST_TEST(p.root_directory() == "");
@@ -1158,7 +1184,7 @@
       p = q = path("c:/");
       BOOST_TEST(p.relative_path().string() == "");
       BOOST_TEST(p.parent_path().string() == "c:");
- BOOST_TEST_EQ(q.remove_filename().string(), p.parent_path().string());
+ PATH_TEST_EQ(q.remove_filename().string(), p.parent_path().string());
       BOOST_TEST(p.filename() == "/");
       BOOST_TEST(p.root_name() == "c:");
       BOOST_TEST(p.root_directory() == "/");
@@ -1174,7 +1200,7 @@
       p = q = path("c:..");
       BOOST_TEST(p.relative_path().string() == "..");
       BOOST_TEST(p.parent_path().string() == "c:");
- BOOST_TEST_EQ(q.remove_filename().string(), p.parent_path().string());
+ PATH_TEST_EQ(q.remove_filename().string(), p.parent_path().string());
       BOOST_TEST(p.filename() == "..");
       BOOST_TEST(p.root_name() == "c:");
       BOOST_TEST(p.root_directory() == "");
@@ -1188,13 +1214,13 @@
       BOOST_TEST(!p.is_absolute());
 
       p = q = path("c:/foo");
- CHECK_EQUAL(p.relative_path().string(), "foo");
- CHECK_EQUAL(p.parent_path().string(), "c:/");
- BOOST_TEST_EQ(q.remove_filename().string(), p.parent_path().string());
- CHECK_EQUAL(p.filename(), "foo");
- CHECK_EQUAL(p.root_name(), "c:");
- CHECK_EQUAL(p.root_directory(), "/");
- CHECK_EQUAL(p.root_path().string(), "c:/");
+ PATH_TEST_EQ(p.relative_path().string(), "foo");
+ PATH_TEST_EQ(p.parent_path().string(), "c:/");
+ PATH_TEST_EQ(q.remove_filename().string(), p.parent_path().string());
+ PATH_TEST_EQ(p.filename(), "foo");
+ PATH_TEST_EQ(p.root_name(), "c:");
+ PATH_TEST_EQ(p.root_directory(), "/");
+ PATH_TEST_EQ(p.root_path().string(), "c:/");
       BOOST_TEST(p.has_root_path());
       BOOST_TEST(p.has_root_name());
       BOOST_TEST(p.has_root_directory());
@@ -1204,13 +1230,13 @@
       BOOST_TEST(p.is_absolute());
 
       p = q = path("c://foo");
- CHECK_EQUAL(p.relative_path().string(), "foo");
- CHECK_EQUAL(p.parent_path().string(), "c:/");
- BOOST_TEST_EQ(q.remove_filename().string(), p.parent_path().string());
- CHECK_EQUAL(p.filename(), "foo");
- CHECK_EQUAL(p.root_name(), "c:");
- CHECK_EQUAL(p.root_directory(), "/");
- CHECK_EQUAL(p.root_path().string(), "c:/");
+ PATH_TEST_EQ(p.relative_path().string(), "foo");
+ PATH_TEST_EQ(p.parent_path().string(), "c:/");
+ PATH_TEST_EQ(q.remove_filename().string(), p.parent_path().string());
+ PATH_TEST_EQ(p.filename(), "foo");
+ PATH_TEST_EQ(p.root_name(), "c:");
+ PATH_TEST_EQ(p.root_directory(), "/");
+ PATH_TEST_EQ(p.root_path().string(), "c:/");
       BOOST_TEST(p.has_root_path());
       BOOST_TEST(p.has_root_name());
       BOOST_TEST(p.has_root_directory());
@@ -1220,13 +1246,13 @@
       BOOST_TEST(p.is_absolute());
 
       p = q = path("c:\\foo\\bar");
- CHECK_EQUAL(p.relative_path().string(), "foo\\bar");
- CHECK_EQUAL(p.parent_path().string(), "c:\\foo");
- BOOST_TEST_EQ(q.remove_filename().string(), p.parent_path().string());
- CHECK_EQUAL(p.filename(), "bar");
- CHECK_EQUAL(p.root_name(), "c:");
- CHECK_EQUAL(p.root_directory(), "\\");
- CHECK_EQUAL(p.root_path().string(), "c:\\");
+ PATH_TEST_EQ(p.relative_path().string(), "foo\\bar");
+ PATH_TEST_EQ(p.parent_path().string(), "c:\\foo");
+ PATH_TEST_EQ(q.remove_filename().string(), p.parent_path().string());
+ PATH_TEST_EQ(p.filename(), "bar");
+ PATH_TEST_EQ(p.root_name(), "c:");
+ PATH_TEST_EQ(p.root_directory(), "\\");
+ PATH_TEST_EQ(p.root_path().string(), "c:\\");
       BOOST_TEST(p.has_root_path());
       BOOST_TEST(p.has_root_name());
       BOOST_TEST(p.has_root_directory());
@@ -1238,7 +1264,7 @@
       p = q = path("prn:");
       BOOST_TEST(p.relative_path().string() == "");
       BOOST_TEST(p.parent_path().string() == "");
- BOOST_TEST_EQ(q.remove_filename().string(), p.parent_path().string());
+ PATH_TEST_EQ(q.remove_filename().string(), p.parent_path().string());
       BOOST_TEST(p.filename() == "prn:");
       BOOST_TEST(p.root_name() == "prn:");
       BOOST_TEST(p.root_directory() == "");
@@ -1252,13 +1278,13 @@
       BOOST_TEST(!p.is_absolute());
 
       p = q = path("\\\\net\\\\\\foo");
- CHECK_EQUAL(p.relative_path().string(), "foo");
- CHECK_EQUAL(p.parent_path().string(), "\\\\net\\");
- BOOST_TEST_EQ(q.remove_filename().string(), p.parent_path().string());
- CHECK_EQUAL(p.filename(), "foo");
- CHECK_EQUAL(p.root_name(), "\\\\net");
- CHECK_EQUAL(p.root_directory(), "\\");
- CHECK_EQUAL(p.root_path().string(), "\\\\net\\");
+ PATH_TEST_EQ(p.relative_path().string(), "foo");
+ PATH_TEST_EQ(p.parent_path().string(), "\\\\net\\");
+ PATH_TEST_EQ(q.remove_filename().string(), p.parent_path().string());
+ PATH_TEST_EQ(p.filename(), "foo");
+ PATH_TEST_EQ(p.root_name(), "\\\\net");
+ PATH_TEST_EQ(p.root_directory(), "\\");
+ PATH_TEST_EQ(p.root_path().string(), "\\\\net\\");
       BOOST_TEST(p.has_root_path());
       BOOST_TEST(p.has_root_name());
       BOOST_TEST(p.has_root_directory());
@@ -1270,9 +1296,9 @@
 
     else
     { // POSIX
- PATH_CHECK(path("/foo/bar/"), "/foo/bar/");
- PATH_CHECK(path("//foo//bar//"), "//foo//bar//");
- PATH_CHECK(path("///foo///bar///"), "///foo///bar///");
+ PATH_TEST_EQ(path("/foo/bar/"), "/foo/bar/");
+ PATH_TEST_EQ(path("//foo//bar//"), "//foo//bar//");
+ PATH_TEST_EQ(path("///foo///bar///"), "///foo///bar///");
 
       p = path("/usr/local/bin:/usr/bin:/bin");
       BOOST_TEST(p.string() == "/usr/local/bin:/usr/bin:/bin");
@@ -1293,142 +1319,142 @@
   {
     std::cout << "construction_tests..." << std::endl;
 
- PATH_CHECK("", "");
+ PATH_TEST_EQ("", "");
 
- PATH_CHECK("foo", "foo");
- PATH_CHECK("f", "f");
+ PATH_TEST_EQ("foo", "foo");
+ PATH_TEST_EQ("f", "f");
 
- PATH_CHECK("foo/", "foo/");
- PATH_CHECK("f/", "f/");
- PATH_CHECK("foo/..", "foo/..");
- PATH_CHECK("foo/../", "foo/../");
- PATH_CHECK("foo/bar/../..", "foo/bar/../..");
- PATH_CHECK("foo/bar/../../", "foo/bar/../../");
- PATH_CHECK(path("/"), "/");
- PATH_CHECK(path("/f"), "/f");
-
- PATH_CHECK("/foo", "/foo");
- PATH_CHECK(path("/foo/bar/"), "/foo/bar/");
- PATH_CHECK(path("//foo//bar//"), "//foo//bar//");
- PATH_CHECK(path("///foo///bar///"), "///foo///bar///");
- PATH_CHECK(path("\\/foo\\/bar\\/"), "\\/foo\\/bar\\/");
- PATH_CHECK(path("\\//foo\\//bar\\//"), "\\//foo\\//bar\\//");
+ PATH_TEST_EQ("foo/", "foo/");
+ PATH_TEST_EQ("f/", "f/");
+ PATH_TEST_EQ("foo/..", "foo/..");
+ PATH_TEST_EQ("foo/../", "foo/../");
+ PATH_TEST_EQ("foo/bar/../..", "foo/bar/../..");
+ PATH_TEST_EQ("foo/bar/../../", "foo/bar/../../");
+ PATH_TEST_EQ("/", "/");
+ PATH_TEST_EQ("/f", "/f");
+
+ PATH_TEST_EQ("/foo", "/foo");
+ PATH_TEST_EQ("/foo/bar/", "/foo/bar/");
+ PATH_TEST_EQ("//foo//bar//", "//foo//bar//");
+ PATH_TEST_EQ("///foo///bar///", "///foo///bar///");
+ PATH_TEST_EQ("\\/foo\\/bar\\/", "\\/foo\\/bar\\/");
+ PATH_TEST_EQ("\\//foo\\//bar\\//", "\\//foo\\//bar\\//");
 
     if (platform == "Windows")
     {
- PATH_CHECK(path("c:") / "foo", "c:foo");
- PATH_CHECK(path("c:") / "/foo", "c:/foo");
+ PATH_TEST_EQ(path("c:") / "foo", "c:foo");
+ PATH_TEST_EQ(path("c:") / "/foo", "c:/foo");
 
- PATH_CHECK(path("\\foo\\bar\\"), "\\foo\\bar\\");
- PATH_CHECK(path("\\\\foo\\\\bar\\\\"), "\\\\foo\\\\bar\\\\");
- PATH_CHECK(path("\\\\\\foo\\\\\\bar\\\\\\"), "\\\\\\foo\\\\\\bar\\\\\\");
-
- PATH_CHECK(path("\\"), "\\");
- PATH_CHECK(path("\\f"), "\\f");
- PATH_CHECK(path("\\foo"), "\\foo");
- PATH_CHECK(path("foo\\bar"), "foo\\bar");
- PATH_CHECK(path("foo bar"), "foo bar");
- PATH_CHECK(path("c:"), "c:");
- PATH_CHECK(path("c:/"), "c:/");
- PATH_CHECK(path("c:."), "c:.");
- PATH_CHECK(path("c:./foo"), "c:./foo");
- PATH_CHECK(path("c:.\\foo"), "c:.\\foo");
- PATH_CHECK(path("c:.."), "c:..");
- PATH_CHECK(path("c:/."), "c:/.");
- PATH_CHECK(path("c:/.."), "c:/..");
- PATH_CHECK(path("c:/../"), "c:/../");
- PATH_CHECK(path("c:\\..\\"), "c:\\..\\");
- PATH_CHECK(path("c:/../.."), "c:/../..");
- PATH_CHECK(path("c:/../foo"), "c:/../foo");
- PATH_CHECK(path("c:\\..\\foo"), "c:\\..\\foo");
- PATH_CHECK(path("c:../foo"), "c:../foo");
- PATH_CHECK(path("c:..\\foo"), "c:..\\foo");
- PATH_CHECK(path("c:/../../foo"), "c:/../../foo");
- PATH_CHECK(path("c:\\..\\..\\foo"), "c:\\..\\..\\foo");
- PATH_CHECK(path("c:foo/.."), "c:foo/..");
- PATH_CHECK(path("c:/foo/.."), "c:/foo/..");
- PATH_CHECK(path("c:/..foo"), "c:/..foo");
- PATH_CHECK(path("c:foo"), "c:foo");
- PATH_CHECK(path("c:/foo"), "c:/foo");
- PATH_CHECK(path("\\\\netname"), "\\\\netname");
- PATH_CHECK(path("\\\\netname\\"), "\\\\netname\\");
- PATH_CHECK(path("\\\\netname\\foo"), "\\\\netname\\foo");
- PATH_CHECK(path("c:/foo"), "c:/foo");
- PATH_CHECK(path("prn:"), "prn:");
+ PATH_TEST_EQ("\\foo\\bar\\", "\\foo\\bar\\");
+ PATH_TEST_EQ("\\\\foo\\\\bar\\\\", "\\\\foo\\\\bar\\\\");
+ PATH_TEST_EQ("\\\\\\foo\\\\\\bar\\\\\\", "\\\\\\foo\\\\\\bar\\\\\\");
+
+ PATH_TEST_EQ("\\", "\\");
+ PATH_TEST_EQ("\\f", "\\f");
+ PATH_TEST_EQ("\\foo", "\\foo");
+ PATH_TEST_EQ("foo\\bar", "foo\\bar");
+ PATH_TEST_EQ("foo bar", "foo bar");
+ PATH_TEST_EQ("c:", "c:");
+ PATH_TEST_EQ("c:/", "c:/");
+ PATH_TEST_EQ("c:.", "c:.");
+ PATH_TEST_EQ("c:./foo", "c:./foo");
+ PATH_TEST_EQ("c:.\\foo", "c:.\\foo");
+ PATH_TEST_EQ("c:..", "c:..");
+ PATH_TEST_EQ("c:/.", "c:/.");
+ PATH_TEST_EQ("c:/..", "c:/..");
+ PATH_TEST_EQ("c:/../", "c:/../");
+ PATH_TEST_EQ("c:\\..\\", "c:\\..\\");
+ PATH_TEST_EQ("c:/../..", "c:/../..");
+ PATH_TEST_EQ("c:/../foo", "c:/../foo");
+ PATH_TEST_EQ("c:\\..\\foo", "c:\\..\\foo");
+ PATH_TEST_EQ("c:../foo", "c:../foo");
+ PATH_TEST_EQ("c:..\\foo", "c:..\\foo");
+ PATH_TEST_EQ("c:/../../foo", "c:/../../foo");
+ PATH_TEST_EQ("c:\\..\\..\\foo", "c:\\..\\..\\foo");
+ PATH_TEST_EQ("c:foo/..", "c:foo/..");
+ PATH_TEST_EQ("c:/foo/..", "c:/foo/..");
+ PATH_TEST_EQ("c:/..foo", "c:/..foo");
+ PATH_TEST_EQ("c:foo", "c:foo");
+ PATH_TEST_EQ("c:/foo", "c:/foo");
+ PATH_TEST_EQ("\\\\netname", "\\\\netname");
+ PATH_TEST_EQ("\\\\netname\\", "\\\\netname\\");
+ PATH_TEST_EQ("\\\\netname\\foo", "\\\\netname\\foo");
+ PATH_TEST_EQ("c:/foo", "c:/foo");
+ PATH_TEST_EQ("prn:", "prn:");
     }
     else
     {
     }
 
- PATH_CHECK("foo/bar", "foo/bar");
- PATH_CHECK("a/b", "a/b"); // probe for length effects
- PATH_CHECK("..", "..");
- PATH_CHECK("../..", "../..");
- PATH_CHECK("/..", "/..");
- PATH_CHECK("/../..", "/../..");
- PATH_CHECK("../foo", "../foo");
- PATH_CHECK("foo/..", "foo/..");
- PATH_CHECK(path("foo/..bar"), "foo/..bar");
- PATH_CHECK("../f", "../f");
- PATH_CHECK("/../f", "/../f");
- PATH_CHECK("f/..", "f/..");
- PATH_CHECK("foo/../..", "foo/../..");
- PATH_CHECK("foo/../../..", "foo/../../..");
- PATH_CHECK("foo/../bar", "foo/../bar");
- PATH_CHECK("foo/bar/..", "foo/bar/..");
- PATH_CHECK("foo/bar/../..", "foo/bar/../..");
- PATH_CHECK("foo/bar/../blah", "foo/bar/../blah");
- PATH_CHECK("f/../b", "f/../b");
- PATH_CHECK("f/b/..", "f/b/..");
- PATH_CHECK("f/b/../a", "f/b/../a");
- PATH_CHECK("foo/bar/blah/../..", "foo/bar/blah/../..");
- PATH_CHECK("foo/bar/blah/../../bletch", "foo/bar/blah/../../bletch");
- PATH_CHECK("...", "...");
- PATH_CHECK("....", "....");
- PATH_CHECK("foo/...", "foo/...");
- PATH_CHECK("abc.", "abc.");
- PATH_CHECK("abc..", "abc..");
- PATH_CHECK("foo/abc.", "foo/abc.");
- PATH_CHECK("foo/abc..", "foo/abc..");
-
- PATH_CHECK(path(".abc"), ".abc");
- PATH_CHECK("a.c", "a.c");
- PATH_CHECK(path("..abc"), "..abc");
- PATH_CHECK("a..c", "a..c");
- PATH_CHECK(path("foo/.abc"), "foo/.abc");
- PATH_CHECK("foo/a.c", "foo/a.c");
- PATH_CHECK(path("foo/..abc"), "foo/..abc");
- PATH_CHECK("foo/a..c", "foo/a..c");
-
- PATH_CHECK(".", ".");
- PATH_CHECK("./foo", "./foo");
- PATH_CHECK("./..", "./..");
- PATH_CHECK("./../foo", "./../foo");
- PATH_CHECK("foo/.", "foo/.");
- PATH_CHECK("../.", "../.");
- PATH_CHECK("./.", "./.");
- PATH_CHECK("././.", "././.");
- PATH_CHECK("./foo/.", "./foo/.");
- PATH_CHECK("foo/./bar", "foo/./bar");
- PATH_CHECK("foo/./.", "foo/./.");
- PATH_CHECK("foo/./..", "foo/./..");
- PATH_CHECK("foo/./../bar", "foo/./../bar");
- PATH_CHECK("foo/../.", "foo/../.");
- PATH_CHECK("././..", "././..");
- PATH_CHECK("./../.", "./../.");
- PATH_CHECK(".././.", ".././.");
+ PATH_TEST_EQ("foo/bar", "foo/bar");
+ PATH_TEST_EQ("a/b", "a/b"); // probe for length effects
+ PATH_TEST_EQ("..", "..");
+ PATH_TEST_EQ("../..", "../..");
+ PATH_TEST_EQ("/..", "/..");
+ PATH_TEST_EQ("/../..", "/../..");
+ PATH_TEST_EQ("../foo", "../foo");
+ PATH_TEST_EQ("foo/..", "foo/..");
+ PATH_TEST_EQ("foo/..bar", "foo/..bar");
+ PATH_TEST_EQ("../f", "../f");
+ PATH_TEST_EQ("/../f", "/../f");
+ PATH_TEST_EQ("f/..", "f/..");
+ PATH_TEST_EQ("foo/../..", "foo/../..");
+ PATH_TEST_EQ("foo/../../..", "foo/../../..");
+ PATH_TEST_EQ("foo/../bar", "foo/../bar");
+ PATH_TEST_EQ("foo/bar/..", "foo/bar/..");
+ PATH_TEST_EQ("foo/bar/../..", "foo/bar/../..");
+ PATH_TEST_EQ("foo/bar/../blah", "foo/bar/../blah");
+ PATH_TEST_EQ("f/../b", "f/../b");
+ PATH_TEST_EQ("f/b/..", "f/b/..");
+ PATH_TEST_EQ("f/b/../a", "f/b/../a");
+ PATH_TEST_EQ("foo/bar/blah/../..", "foo/bar/blah/../..");
+ PATH_TEST_EQ("foo/bar/blah/../../bletch", "foo/bar/blah/../../bletch");
+ PATH_TEST_EQ("...", "...");
+ PATH_TEST_EQ("....", "....");
+ PATH_TEST_EQ("foo/...", "foo/...");
+ PATH_TEST_EQ("abc.", "abc.");
+ PATH_TEST_EQ("abc..", "abc..");
+ PATH_TEST_EQ("foo/abc.", "foo/abc.");
+ PATH_TEST_EQ("foo/abc..", "foo/abc..");
+
+ PATH_TEST_EQ(".abc", ".abc");
+ PATH_TEST_EQ("a.c", "a.c");
+ PATH_TEST_EQ("..abc", "..abc");
+ PATH_TEST_EQ("a..c", "a..c");
+ PATH_TEST_EQ("foo/.abc", "foo/.abc");
+ PATH_TEST_EQ("foo/a.c", "foo/a.c");
+ PATH_TEST_EQ("foo/..abc", "foo/..abc");
+ PATH_TEST_EQ("foo/a..c", "foo/a..c");
+
+ PATH_TEST_EQ(".", ".");
+ PATH_TEST_EQ("./foo", "./foo");
+ PATH_TEST_EQ("./..", "./..");
+ PATH_TEST_EQ("./../foo", "./../foo");
+ PATH_TEST_EQ("foo/.", "foo/.");
+ PATH_TEST_EQ("../.", "../.");
+ PATH_TEST_EQ("./.", "./.");
+ PATH_TEST_EQ("././.", "././.");
+ PATH_TEST_EQ("./foo/.", "./foo/.");
+ PATH_TEST_EQ("foo/./bar", "foo/./bar");
+ PATH_TEST_EQ("foo/./.", "foo/./.");
+ PATH_TEST_EQ("foo/./..", "foo/./..");
+ PATH_TEST_EQ("foo/./../bar", "foo/./../bar");
+ PATH_TEST_EQ("foo/../.", "foo/../.");
+ PATH_TEST_EQ("././..", "././..");
+ PATH_TEST_EQ("./../.", "./../.");
+ PATH_TEST_EQ(".././.", ".././.");
   }
 
   // append_tests --------------------------------------------------------------------//
 
   void append_test_aux(const path & p, const std::string & s, const std::string & expect)
   {
- PATH_CHECK(p / path(s), expect);
- PATH_CHECK(p / s.c_str(), expect);
- PATH_CHECK(p / s, expect);
+ PATH_TEST_EQ((p / path(s)).string(), expect);
+ PATH_TEST_EQ((p / s.c_str()).string(), expect);
+ PATH_TEST_EQ((p / s).string(), expect);
     path x(p);
     x.append(s.begin(), s.end());
- PATH_CHECK(x, expect);
+ PATH_TEST_EQ(x.string(), expect);
   }
 
   void append_tests()
@@ -1452,74 +1478,116 @@
     //for (int i = 0; i < sizeof(x)/sizeof(char*); ++i)
     // for (int j = 0; j < sizeof(y)/sizeof(char*); ++j)
     // {
- // std::cout << "\n PATH_CHECK(path(\"" << x[i] << "\") / \"" << y[j] << "\", \""
+ // std::cout << "\n PATH_TEST_EQ(path(\"" << x[i] << "\") / \"" << y[j] << "\", \""
     // << path(x[i]) / y[j] << "\");\n";
     // std::cout << " append_test_aux(\"" << x[i] << "\", \"" << y[j] << "\", \""
     // << path(x[i]) / y[j] << "\");\n";
     // }
 
- PATH_CHECK(path("") / "", "");
+ PATH_TEST_EQ(path("") / "", "");
     append_test_aux("", "", "");
 
- PATH_CHECK(path("") / "/", "/");
+ PATH_TEST_EQ(path("") / "/", "/");
     append_test_aux("", "/", "/");
 
- PATH_CHECK(path("") / "bar", "bar");
+ PATH_TEST_EQ(path("") / "bar", "bar");
     append_test_aux("", "bar", "bar");
 
- PATH_CHECK(path("") / "/bar", "/bar");
+ PATH_TEST_EQ(path("") / "/bar", "/bar");
     append_test_aux("", "/bar", "/bar");
 
- PATH_CHECK(path("/") / "", "/");
+ PATH_TEST_EQ(path("/") / "", "/");
     append_test_aux("/", "", "/");
 
- PATH_CHECK(path("/") / "/", "//");
+ PATH_TEST_EQ(path("/") / "/", "//");
     append_test_aux("/", "/", "//");
 
- PATH_CHECK(path("/") / "bar", "/bar");
+ PATH_TEST_EQ(path("/") / "bar", "/bar");
     append_test_aux("/", "bar", "/bar");
 
- PATH_CHECK(path("/") / "/bar", "//bar");
+ PATH_TEST_EQ(path("/") / "/bar", "//bar");
     append_test_aux("/", "/bar", "//bar");
 
- PATH_CHECK(path("foo") / "", "foo");
+ PATH_TEST_EQ(path("foo") / "", "foo");
     append_test_aux("foo", "", "foo");
 
- PATH_CHECK(path("foo") / "/", "foo/");
+ PATH_TEST_EQ(path("foo") / "/", "foo/");
     append_test_aux("foo", "/", "foo/");
 
- PATH_CHECK(path("foo") / "/bar", "foo/bar");
+ PATH_TEST_EQ(path("foo") / "/bar", "foo/bar");
     append_test_aux("foo", "/bar", "foo/bar");
 
- PATH_CHECK(path("foo/") / "", "foo/");
+ PATH_TEST_EQ(path("foo/") / "", "foo/");
     append_test_aux("foo/", "", "foo/");
 
- PATH_CHECK(path("foo/") / "/", "foo//");
+ PATH_TEST_EQ(path("foo/") / "/", "foo//");
     append_test_aux("foo/", "/", "foo//");
 
- PATH_CHECK(path("foo/") / "bar", "foo/bar");
+ PATH_TEST_EQ(path("foo/") / "bar", "foo/bar");
     append_test_aux("foo/", "bar", "foo/bar");
 
- PATH_CHECK(path("foo/") / "/bar", "foo//bar");
+ PATH_TEST_EQ(path("foo/") / "/bar", "foo//bar");
     append_test_aux("foo/", "/bar", "foo//bar");
 
     if (platform == "Windows")
     {
- PATH_CHECK(path("foo") / "bar", "foo\\bar");
+ PATH_TEST_EQ(path("foo") / "bar", "foo\\bar");
       append_test_aux("foo", "bar", "foo\\bar");
 
       // hand created test case specific to Windows
- PATH_CHECK(path("c:") / "bar", "c:bar");
+ PATH_TEST_EQ(path("c:") / "bar", "c:bar");
       append_test_aux("c:", "bar", "c:bar");
     }
     else
     {
- PATH_CHECK(path("foo") / "bar", "foo/bar");
+ PATH_TEST_EQ(path("foo") / "bar", "foo/bar");
       append_test_aux("foo", "bar", "foo/bar");
     }
 
   }
 
+// self_assign_and_append_tests ------------------------------------------------------//
+
+ void self_assign_and_append_tests()
+ {
+ std::cout << "self_assign_and_append_tests..." << std::endl;
+
+ path p;
+
+ p = "snafubar";
+ PATH_TEST_EQ(p = p, "snafubar");
+
+ p = "snafubar";
+ p = p.c_str();
+ PATH_TEST_EQ(p, "snafubar");
+
+ p = "snafubar";
+ p.assign(p.c_str(), path::codecvt());
+ PATH_TEST_EQ(p, "snafubar");
+
+ p = "snafubar";
+ PATH_TEST_EQ(p = p.c_str()+5, "bar");
+
+ p = "snafubar";
+ PATH_TEST_EQ(p.assign(p.c_str() + 5, p.c_str() + 7), "ba");
+
+ p = "snafubar";
+ p /= p;
+ PATH_TEST_EQ(p, "snafubar" BOOST_DIR_SEP "snafubar");
+
+ p = "snafubar";
+ p /= p.c_str();
+ PATH_TEST_EQ(p, "snafubar" BOOST_DIR_SEP "snafubar");
+
+ p = "snafubar";
+ p.append(p.c_str(), path::codecvt());
+ PATH_TEST_EQ(p, "snafubar" BOOST_DIR_SEP "snafubar");
+
+ p = "snafubar";
+ PATH_TEST_EQ(p.append(p.c_str() + 5, p.c_str() + 7), "snafubar" BOOST_DIR_SEP "ba");
+ }
+
+
   // name_function_tests -------------------------------------------------------------//
 
   void name_function_tests()
@@ -1628,7 +1696,7 @@
     BOOST_TEST(path("a.b.txt").replace_extension(".tex") == "a.b.tex");
     BOOST_TEST(path("a.b.txt").replace_extension("tex") == "a.b");
     BOOST_TEST(path("a/b").replace_extension(".c") == "a/b.c");
- BOOST_TEST_EQ(path("a.txt/b").replace_extension(".c"), "a.txt/b.c"); // ticket 4702
+ PATH_TEST_EQ(path("a.txt/b").replace_extension(".c"), "a.txt/b.c"); // ticket 4702
   }
   
   // make_preferred_tests ------------------------------------------------------------//
@@ -1678,6 +1746,7 @@
 
   construction_tests();
   append_tests();
+ self_assign_and_append_tests();
   overload_tests();
   query_and_decomposition_tests();
   composition_tests();
@@ -1704,18 +1773,18 @@
   // check the path member templates
   p5.assign(s1.begin(), s1.end());
 
- PATH_CHECK(p5, "//:somestring");
+ PATH_TEST_EQ(p5.string(), "//:somestring");
   p5 = s1;
- PATH_CHECK(p5, "//:somestring");
+ PATH_TEST_EQ(p5.string(), "//:somestring");
 
   // this code, courtesy of David Whetstone, detects a now fixed bug that
   // derefereced the end iterator (assuming debug build with checked itors)
   std::vector<char> v1;
   p5.assign(v1.begin(), v1.end());
   std::string s2(v1.begin(), v1.end());
- PATH_CHECK(p5, s2);
+ PATH_TEST_EQ(p5.string(), s2);
   p5.assign(s1.begin(), s1.begin() + 1);
- PATH_CHECK(p5, "/");
+ PATH_TEST_EQ(p5.string(), "/");
 
   BOOST_TEST(p1 != p4);
   BOOST_TEST(p1.string() == p2.string());


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk