From: <bl...@us...> - 2003-04-01 08:26:35
|
Update of /cvsroot/cpptool/rfta/deplib/boostcvs/libs/filesystem/test In directory sc8-pr-cvs1:/tmp/cvs-serv17363/deplib/boostcvs/libs/filesystem/test Modified Files: fstream_test.cpp operations_test.cpp path_test.cpp Log Message: * upgraded to the official boost 1.30 Index: fstream_test.cpp =================================================================== RCS file: /cvsroot/cpptool/rfta/deplib/boostcvs/libs/filesystem/test/fstream_test.cpp,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** fstream_test.cpp 23 Oct 2002 20:22:58 -0000 1.1.1.1 --- fstream_test.cpp 1 Apr 2003 08:25:51 -0000 1.2 *************** *** 19,25 **** #endif ! ! #define BOOST_INCLUDE_MAIN ! #include <boost/test/test_tools.hpp> int test_main( int, char*[] ) --- 19,23 ---- #endif ! #include <boost/test/minimal.hpp> int test_main( int, char*[] ) Index: operations_test.cpp =================================================================== RCS file: /cvsroot/cpptool/rfta/deplib/boostcvs/libs/filesystem/test/operations_test.cpp,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** operations_test.cpp 23 Oct 2002 20:22:59 -0000 1.1.1.1 --- operations_test.cpp 1 Apr 2003 08:25:54 -0000 1.2 *************** *** 13,19 **** namespace fs = boost::filesystem; ! //#include <boost/test/test_tools.hpp> #include <boost/test/minimal.hpp> ! #include <boost/bind.hpp> using boost::bind; --- 13,19 ---- namespace fs = boost::filesystem; ! #include <boost/config.hpp> #include <boost/test/minimal.hpp> ! #include <boost/concept_check.hpp> #include <boost/bind.hpp> using boost::bind; *************** *** 21,34 **** #include <fstream> #include <iostream> namespace { fs::directory_iterator end_itr; void create_file( const fs::path & ph, const std::string & contents ) { ! std::ofstream f( ph.file_path().c_str() ); if ( !f ) ! throw fs::filesystem_error( "ofstream(): " + ph.generic_path() ); if ( !contents.empty() ) f << contents; } --- 21,38 ---- #include <fstream> #include <iostream> + #include <string> + #include <cerrno> namespace { + bool report_throws; fs::directory_iterator end_itr; void create_file( const fs::path & ph, const std::string & contents ) { ! std::ofstream f( ph.native_file_string().c_str() ); if ( !f ) ! throw fs::filesystem_error( "operations_test create_file", ! ph, errno ); if ( !contents.empty() ) f << contents; } *************** *** 36,61 **** void verify_file( const fs::path & ph, const std::string & expected ) { ! std::ifstream f( ph.file_path().c_str() ); if ( !f ) ! throw fs::filesystem_error( "ifstream(): " + ph.generic_path() ); std::string contents; f >> contents; if ( contents != expected ) ! throw fs::filesystem_error("verify_file(): " + ph.generic_path() ! + " contents \"" + contents + "\" != \"" + expected + "\"" ); } template< typename F > ! bool throws_fs_error( F func ) { try { func(); } ! catch ( const fs::filesystem_error & /*ex*/ ) { ! // std::cout << ex.what() << "\n"; ! return true; } - return false; } --- 40,70 ---- void verify_file( const fs::path & ph, const std::string & expected ) { ! std::ifstream f( ph.native_file_string().c_str() ); if ( !f ) ! throw fs::filesystem_error( "operations_test verify_file", ! ph, errno ); std::string contents; f >> contents; if ( contents != expected ) ! throw fs::filesystem_error( "operations_test verify_file", ! ph, " contents \"" + contents + "\" != \"" + expected + "\"" ); } template< typename F > ! bool throws_fs_error( F func, fs::error_code ec = ! ::boost::filesystem::no_error ) // VC++ 7.1 build 2292 won't accept fs:: { try { func(); } ! catch ( const fs::filesystem_error & ex ) { ! if ( report_throws ) std::cout << ex.what() << "\n"; ! if ( ec == fs::no_error || ec == ex.error() ) return true; ! std::cout << "filesystem_error::error() reports " << ex.error() ! << ", should be " << ec ! << "\n native_error() is " << ex.native_error() ! << std::endl; } return false; } *************** *** 65,84 **** // test_main ---------------------------------------------------------------// ! int test_main( int, char * [] ) { ! std::cout << "implemenation name: " ! << fs::detail::implementation_name() << "\n"; ! std::cout << "initial_directory() is \"" ! << fs::initial_directory().generic_path() << "\"\n"; ! fs::path dir( fs::initial_directory() << "temp_fs_test_directory" ); ! #ifdef BOOST_WINDOWS ! BOOST_TEST( dir.generic_path().size() > 1 ! && dir.generic_path()[1] == ':' ); // verify path includes drive ! #endif ! fs::path ng( " no-way, Jose ", fs::system_specific ); fs::remove_all( dir ); // in case residue from prior failed tests --- 74,160 ---- // test_main ---------------------------------------------------------------// ! int test_main( int argc, char * argv[] ) { ! if ( argc > 1 && *argv[1]=='-' && *(argv[1]+1)=='t' ) report_throws = true; ! ! std::string platform( BOOST_PLATFORM ); ! platform = ( platform == "Win32" || platform == "Win64" || platform == "Cygwin" ) ! ? "Windows" ! : "POSIX"; ! ! std::cout << "BOOST_PLATFORM: " ! << BOOST_PLATFORM << "\n"; ! std::cout << "Operating system family: " ! << platform << "\n"; ! std::cout << "initial_path().string() is\n \"" ! << fs::initial_path().string() ! << "\"\n"; ! std::cout << "initial_path().native_file_string() is\n \"" ! << fs::initial_path().native_file_string() << "\"\n"; ! BOOST_TEST( fs::initial_path().is_complete() ); ! BOOST_TEST( fs::current_path().is_complete() ); ! BOOST_TEST( fs::initial_path().string() == fs::current_path().string() ); ! ! BOOST_TEST( fs::complete( "" ).empty() ); ! BOOST_TEST( fs::complete( "/" ).string() ! == fs::initial_path().root_path().string() ); ! BOOST_TEST( fs::complete( "foo" ).string() ! == fs::initial_path().string()+"/foo" ); ! BOOST_TEST( fs::complete( "/foo" ).string() ! == fs::initial_path().root_path().string()+"foo" ); ! ! fs::path dir( fs::initial_path() / "temp_fs_test_directory" ); ! // Windows only tests ! if ( platform == "Windows" ) ! { ! BOOST_TEST( dir.string().size() > 1 ! && dir.string()[1] == ':' ); // verify path includes drive ! BOOST_TEST( fs::system_complete( "" ).empty() ); ! BOOST_TEST( fs::system_complete( "/" ).string() ! == fs::initial_path().root_path().string() ); ! BOOST_TEST( fs::system_complete( "foo" ).string() ! == fs::initial_path().string()+"/foo" ); ! BOOST_TEST( fs::system_complete( "/foo" ).string() ! == fs::initial_path().root_path().string()+"foo" ); ! ! // BOOST_TEST( fs::complete( fs::path( "c:", fs::native ) ).string() ! // == fs::initial_path().string() ); ! // BOOST_TEST( fs::complete( fs::path( "c:foo", fs::native ) ).string() ! // == fs::initial_path().string()+"/foo" ); ! BOOST_TEST( fs::complete( fs::path( "c:/", fs::native ) ).string() ! == "c:/" ); ! BOOST_TEST( fs::complete( fs::path( "c:/foo", fs::native ) ).string() ! == "c:/foo" ); ! BOOST_TEST( fs::complete( fs::path( "//share", fs::native ) ).string() ! == "//share" ); ! ! BOOST_TEST( fs::system_complete( fs::path( fs::initial_path().root_name(), ! fs::native ) ).string() == fs::initial_path().string() ); ! BOOST_TEST( fs::system_complete( fs::path( fs::initial_path().root_name() ! + "foo", fs::native ) ).string() == fs::initial_path().string()+"/foo" ); ! BOOST_TEST( fs::system_complete( fs::path( "c:/", fs::native ) ).string() ! == "c:/" ); ! BOOST_TEST( fs::system_complete( fs::path( "c:/foo", fs::native ) ).string() ! == "c:/foo" ); ! BOOST_TEST( fs::system_complete( fs::path( "//share", fs::native ) ).string() ! == "//share" ); ! } ! ! else if ( platform == "POSIX" ) ! { ! BOOST_TEST( fs::system_complete( "" ).empty() ); ! BOOST_TEST( fs::initial_path().root_path().string() == "/" ); ! BOOST_TEST( fs::system_complete( "/" ).string() == "/" ); ! BOOST_TEST( fs::system_complete( "foo" ).string() ! == fs::initial_path().string()+"/foo" ); ! BOOST_TEST( fs::system_complete( "/foo" ).string() ! == fs::initial_path().root_path().string()+"foo" ); ! } ! ! fs::path ng( " no-way, Jose ", fs::native ); fs::remove_all( dir ); // in case residue from prior failed tests *************** *** 86,90 **** // the bound functions should throw, so throws_fs_error() should return true ! BOOST_TEST( throws_fs_error( bind( fs::is_directory, ng ) ) ); BOOST_TEST( throws_fs_error( bind( fs::is_directory, dir ) ) ); BOOST_TEST( throws_fs_error( bind( fs::_is_empty, dir ) ) ); --- 162,166 ---- // the bound functions should throw, so throws_fs_error() should return true ! BOOST_TEST( throws_fs_error( bind( fs::is_directory, ng ), fs::not_found_error ) ); BOOST_TEST( throws_fs_error( bind( fs::is_directory, dir ) ) ); BOOST_TEST( throws_fs_error( bind( fs::_is_empty, dir ) ) ); *************** *** 97,101 **** BOOST_TEST( fs::is_directory( dir ) ); ! fs::path d1( dir << "d1" ); fs::create_directory( d1 ); BOOST_TEST( fs::exists( d1 ) ); --- 173,177 ---- BOOST_TEST( fs::is_directory( dir ) ); ! fs::path d1( dir / "d1" ); fs::create_directory( d1 ); BOOST_TEST( fs::exists( d1 ) ); *************** *** 103,106 **** --- 179,184 ---- BOOST_TEST( fs::_is_empty( d1 ) ); + boost::function_requires< boost::InputIteratorConcept< fs::directory_iterator > >(); + { fs::directory_iterator dir_itr( dir ); *************** *** 109,119 **** // create a second directory named d2 ! fs::path d2( dir << "d2" ); fs::create_directory(d2 ); BOOST_TEST( fs::exists( d2 ) ); BOOST_TEST( fs::is_directory( d2 ) ); // create an empty file named "f0" ! fs::path file_ph( dir << "f0"); create_file( file_ph, "" ); BOOST_TEST( fs::exists( file_ph ) ); --- 187,225 ---- // create a second directory named d2 ! fs::path d2( dir / "d2" ); fs::create_directory(d2 ); BOOST_TEST( fs::exists( d2 ) ); BOOST_TEST( fs::is_directory( d2 ) ); + { + fs::directory_iterator dir_itr( dir ); + BOOST_TEST( dir_itr->leaf() == "d1" || dir_itr->leaf() == "d2" ); + if ( dir_itr->leaf() == "d1" ) + { + BOOST_TEST( (++dir_itr)->leaf() == "d2" ); + } + else + { + BOOST_TEST( (++dir_itr)->leaf() == "d1" ); + } + } + + { // *i++ must work to meet the standard's InputIterator requirements + fs::directory_iterator dir_itr( dir ); + BOOST_TEST( dir_itr->leaf() == "d1" || dir_itr->leaf() == "d2" ); + if ( dir_itr->leaf() == "d1" ) + { + BOOST_TEST( (*dir_itr++).leaf() == "d1" ); + BOOST_TEST( dir_itr->leaf() == "d2" ); + } + else + { + BOOST_TEST( (*dir_itr++).leaf() == "d2" ); + BOOST_TEST( dir_itr->leaf() == "d1" ); + } + } + // create an empty file named "f0" ! fs::path file_ph( dir / "f0"); create_file( file_ph, "" ); BOOST_TEST( fs::exists( file_ph ) ); *************** *** 122,126 **** // create a file named "f1" ! file_ph = dir << "f1"; create_file( file_ph, "foobar1" ); BOOST_TEST( fs::exists( file_ph ) ); --- 228,232 ---- // create a file named "f1" ! file_ph = dir / "f1"; create_file( file_ph, "foobar1" ); BOOST_TEST( fs::exists( file_ph ) ); *************** *** 129,133 **** // there was an inital bug in directory_iterator that caused premature ! // close of an OS handle. The next five lines will detect regression. { fs::directory_iterator di; --- 235,239 ---- // there was an inital bug in directory_iterator that caused premature ! // close of an OS handle. This block will detect regression. { fs::directory_iterator di; *************** *** 137,185 **** // copy_file() tests ! fs::copy_file( file_ph, d1 << "f2" ); BOOST_TEST( fs::exists( file_ph ) ); ! BOOST_TEST( fs::exists( d1 << "f2" ) ); ! BOOST_TEST( !fs::is_directory( d1 << "f2" ) ); ! verify_file( d1 << "f2", "foobar1" ); // rename() on file d1/f2 to d2/f3 ! fs::rename( d1 << "f2", d2 << "f3" ); ! BOOST_TEST( !fs::exists( d1 << "f2" ) ); ! BOOST_TEST( !fs::exists( d2 << "f2" ) ); ! BOOST_TEST( fs::exists( d2 << "f3" ) ); ! BOOST_TEST( !fs::is_directory( d2 << "f3" ) ); ! verify_file( d2 << "f3", "foobar1" ); // make sure can't rename() a non-existent file ! BOOST_TEST( throws_fs_error( bind( fs::rename, d1 << "f2", d2 << "f4" ) ) ); // make sure can't rename() to an existent file ! BOOST_TEST( throws_fs_error( bind( fs::rename, dir << "f1", d2 << "f3" ) ) ); // make sure can't rename() to a nonexistent parent directory ! BOOST_TEST( throws_fs_error( bind( fs::rename, dir << "f1", dir << "d3/f3" ) ) ); // rename() on directory ! fs::path d3( dir << "d3" ); fs::rename( d2, d3 ); BOOST_TEST( !fs::exists( d2 ) ); BOOST_TEST( fs::exists( d3 ) ); BOOST_TEST( fs::is_directory( d3 ) ); ! BOOST_TEST( !fs::exists( d2 << "f3" ) ); ! BOOST_TEST( fs::exists( d3 << "f3" ) ); // remove() tests on file ! file_ph = dir << "shortlife"; BOOST_TEST( !fs::exists( file_ph ) ); create_file( file_ph, "" ); BOOST_TEST( fs::exists( file_ph ) ); BOOST_TEST( !fs::is_directory( file_ph ) ); ! fs::remove( file_ph ); BOOST_TEST( !fs::exists( file_ph ) ); ! fs::remove( "no-such-file" ); // should be harmless ! fs::remove( "no-such-directory/no-such-file" ); // ditto // remove test on directory ! d1 = dir << "shortlife_dir"; BOOST_TEST( !fs::exists( d1 ) ); fs::create_directory( d1 ); --- 243,299 ---- // copy_file() tests ! fs::copy_file( file_ph, d1 / "f2" ); BOOST_TEST( fs::exists( file_ph ) ); ! BOOST_TEST( fs::exists( d1 / "f2" ) ); ! BOOST_TEST( !fs::is_directory( d1 / "f2" ) ); ! verify_file( d1 / "f2", "foobar1" ); // rename() on file d1/f2 to d2/f3 ! fs::rename( d1 / "f2", d2 / "f3" ); ! BOOST_TEST( !fs::exists( d1 / "f2" ) ); ! BOOST_TEST( !fs::exists( d2 / "f2" ) ); ! BOOST_TEST( fs::exists( d2 / "f3" ) ); ! BOOST_TEST( !fs::is_directory( d2 / "f3" ) ); ! verify_file( d2 / "f3", "foobar1" ); // make sure can't rename() a non-existent file ! BOOST_TEST( !fs::exists( d1 / "f2" ) ); ! BOOST_TEST( throws_fs_error( bind( fs::rename, d1 / "f2", d2 / "f4" ), ! fs::not_found_error ) ); // make sure can't rename() to an existent file ! BOOST_TEST( fs::exists( dir / "f1" ) ); ! BOOST_TEST( fs::exists( d2 / "f3" ) ); ! BOOST_TEST( throws_fs_error( bind( fs::rename, dir / "f1", d2 / "f3" ) ) ); ! // several POSIX implementations (cygwin, openBSD) report ENOENT instead of EEXIST, ! // so we don't verify error type on the above test. // make sure can't rename() to a nonexistent parent directory ! BOOST_TEST( throws_fs_error( bind( fs::rename, dir / "f1", dir / "d3/f3" ), ! fs::not_found_error ) ); // rename() on directory ! fs::path d3( dir / "d3" ); ! BOOST_TEST( !fs::exists( d3 ) ); fs::rename( d2, d3 ); BOOST_TEST( !fs::exists( d2 ) ); BOOST_TEST( fs::exists( d3 ) ); BOOST_TEST( fs::is_directory( d3 ) ); ! BOOST_TEST( !fs::exists( d2 / "f3" ) ); ! BOOST_TEST( fs::exists( d3 / "f3" ) ); // remove() tests on file ! file_ph = dir / "shortlife"; BOOST_TEST( !fs::exists( file_ph ) ); create_file( file_ph, "" ); BOOST_TEST( fs::exists( file_ph ) ); BOOST_TEST( !fs::is_directory( file_ph ) ); ! BOOST_TEST( fs::remove( file_ph ) ); BOOST_TEST( !fs::exists( file_ph ) ); ! BOOST_TEST( !fs::remove( "no-such-file" ) ); ! BOOST_TEST( !fs::remove( "no-such-directory/no-such-file" ) ); // remove test on directory ! d1 = dir / "shortlife_dir"; BOOST_TEST( !fs::exists( d1 ) ); fs::create_directory( d1 ); *************** *** 187,192 **** BOOST_TEST( fs::is_directory( d1 ) ); BOOST_TEST( fs::_is_empty( d1 ) ); ! BOOST_TEST( throws_fs_error( bind( fs::remove, dir ) ) ); ! fs::remove( d1 ); BOOST_TEST( !fs::exists( d1 ) ); --- 301,306 ---- BOOST_TEST( fs::is_directory( d1 ) ); BOOST_TEST( fs::_is_empty( d1 ) ); ! BOOST_TEST( throws_fs_error( bind( fs::remove, dir ), fs::not_empty_error ) ); ! BOOST_TEST( fs::remove( d1 ) ); BOOST_TEST( !fs::exists( d1 ) ); Index: path_test.cpp =================================================================== RCS file: /cvsroot/cpptool/rfta/deplib/boostcvs/libs/filesystem/test/path_test.cpp,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** path_test.cpp 23 Oct 2002 20:23:00 -0000 1.1.1.1 --- path_test.cpp 1 Apr 2003 08:25:54 -0000 1.2 *************** *** 13,16 **** --- 13,18 ---- #include <boost/utility.hpp> #include <iostream> + #include <string> + #include <cstring> #include <cassert> *************** *** 20,25 **** using boost::prior; ! #define BOOST_INCLUDE_MAIN ! #include <boost/test/test_tools.hpp> namespace { --- 22,28 ---- using boost::prior; ! #include <boost/test/minimal.hpp> ! ! #define PATH_CHECK( a, b ) check( a, b, __LINE__ ) namespace { *************** *** 27,37 **** void check( const fs::path & source, ! const std::string & expected ) { ! if ( source.generic_path()== expected ) return; ++errors; ! std::cout << "source.generic_path(): \"" << source.generic_path() << "\" != expected: \"" << expected << "\"" << std::endl; --- 30,40 ---- void check( const fs::path & source, ! const std::string & expected, int line ) { ! if ( source.string()== expected ) return; ++errors; ! std::cout << '(' << line << ") source.string(): \"" << source.string() << "\" != expected: \"" << expected << "\"" << std::endl; *************** *** 57,67 **** int test_main( int, char*[] ) { path p1( "fe/fi/fo/fum" ); path p2( p1 ); path p3; p3 = p2; ! // p1.branch() = p2; // should fail // *p1.begin() = ""; // should fail --- 60,77 ---- int test_main( int, char*[] ) { + std::string platform( BOOST_PLATFORM ); + platform = ( platform == "Win32" || platform == "Win64" || platform == "Cygwin" ) + ? "Windows" + : "POSIX"; + + boost::function_requires< boost::ForwardIteratorConcept< fs::path::iterator > >(); path p1( "fe/fi/fo/fum" ); path p2( p1 ); path p3; + BOOST_TEST( p1.string() != p3.string() ); p3 = p2; ! // p1.branch_path() = p2; // should fail // *p1.begin() = ""; // should fail *************** *** 70,148 **** fs::exists( std::string( "foo" ) ); fs::exists( p1 ); ! fs::exists( "foo" << p1 ); ! fs::exists( std::string( "foo" ) << p1 ); fs::exists( fs::check_posix_leaf( "foo" ) ); ! BOOST_TEST( p1.generic_path() == p2.generic_path() ); ! BOOST_TEST( p1.generic_path() == p3.generic_path() ); BOOST_TEST( path( "foo" ).leaf() == "foo" ); ! BOOST_TEST( path( "foo" ).branch().generic_path() == "" ); BOOST_TEST( p1.leaf() == "fum" ); ! BOOST_TEST( p1.branch().generic_path() == "fe/fi/fo" ); ! BOOST_TEST( path( "" ).is_null() == true ); ! BOOST_TEST( path( "foo" ).is_null() == false ); ! check( "", "" ); ! check( "foo", "foo" ); ! check( path("") << "foo", "foo" ); ! check( path("foo") << "", "foo" ); ! check( "foo/bar", "foo/bar" ); ! check( path("foo") << "bar", "foo/bar" ); ! check( path("foo") << path("bar"), "foo/bar" ); ! check( "foo" << path("bar"), "foo/bar" ); ! check( "a/b", "a/b" ); // probe for length effects ! check( path("a") << "b", "a/b" ); ! check( "..", ".." ); ! check( path("..") << "", ".." ); ! check( path("") << "..", ".." ); ! check( "../..", "../.." ); ! check( path("..") << ".." , "../.." ); ! check( "../foo", "../foo" ); ! check( path("..") << "foo" , "../foo" ); ! check( "foo/..", "" ); ! check( path("foo") << ".." , "" ); ! check( "../f", "../f" ); ! check( path("..") << "f" , "../f" ); ! check( "f/..", "" ); ! check( path("f") << ".." , "" ); ! check( "foo/../..", ".." ); ! check( path("foo") << ".." << ".." , ".." ); ! check( "foo/../../..", "../.." ); ! check( path("foo") << ".." << ".." << ".." , "../.." ); ! check( "foo/../bar", "bar" ); ! check( path("foo") << ".." << "bar" , "bar" ); ! check( "foo/bar/..", "foo" ); ! check( path("foo") << "bar" << ".." , "foo" ); ! check( "foo/bar/../blah", "foo/blah" ); ! check( path("foo") << "bar" << ".." << "blah", "foo/blah" ); ! check( "f/../b", "b" ); ! check( path("f") << ".." << "b" , "b" ); ! check( "f/b/..", "f" ); ! check( path("f") << "b" << ".." , "f" ); ! check( "f/b/../a", "f/a" ); ! check( path("f") << "b" << ".." << "a", "f/a" ); ! check( "foo/bar/blah/../..", "foo" ); ! check( path("foo") << "bar" << "blah" << ".." << "..", "foo" ); ! check( "foo/bar/blah/../../bletch", "foo/bletch" ); ! check( path("foo") << "bar" << "blah" << ".." << ".." << "bletch", "foo/bletch" ); BOOST_TEST( fs::posix_name("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.-_") ); --- 80,172 ---- fs::exists( std::string( "foo" ) ); fs::exists( p1 ); ! fs::exists( "foo" / p1 ); ! fs::exists( std::string( "foo" ) / p1 ); fs::exists( fs::check_posix_leaf( "foo" ) ); ! BOOST_TEST( p1.string() == p2.string() ); ! BOOST_TEST( p1.string() == p3.string() ); BOOST_TEST( path( "foo" ).leaf() == "foo" ); ! BOOST_TEST( path( "foo" ).branch_path().string() == "" ); BOOST_TEST( p1.leaf() == "fum" ); ! BOOST_TEST( p1.branch_path().string() == "fe/fi/fo" ); ! BOOST_TEST( path( "" ).empty() == true ); ! BOOST_TEST( path( "foo" ).empty() == false ); ! PATH_CHECK( "", "" ); ! PATH_CHECK( "foo", "foo" ); ! PATH_CHECK( path("") / "foo", "foo" ); ! PATH_CHECK( path("foo") / "", "foo" ); ! PATH_CHECK( path( "/" ), "/" ); ! PATH_CHECK( path( "/" ) / "", "/" ); ! PATH_CHECK( path( "/f" ), "/f" ); ! PATH_CHECK( "/foo", "/foo" ); ! PATH_CHECK( path("") / "/foo", "/foo" ); ! PATH_CHECK( path("/foo") / "", "/foo" ); ! PATH_CHECK( "foo/", "foo" ); ! PATH_CHECK( path("") / "foo/", "foo" ); ! PATH_CHECK( path("foo") / "/", "foo" ); ! PATH_CHECK( "foo/bar", "foo/bar" ); ! PATH_CHECK( path("foo") / "bar", "foo/bar" ); ! PATH_CHECK( path("foo") / path("bar"), "foo/bar" ); ! PATH_CHECK( "foo" / path("bar"), "foo/bar" ); ! PATH_CHECK( "a/b", "a/b" ); // probe for length effects ! PATH_CHECK( path("a") / "b", "a/b" ); ! PATH_CHECK( "..", ".." ); ! PATH_CHECK( path("..") / "", ".." ); ! PATH_CHECK( path("") / "..", ".." ); ! PATH_CHECK( "../..", "../.." ); ! PATH_CHECK( path("..") / ".." , "../.." ); ! PATH_CHECK( "../foo", "../foo" ); ! PATH_CHECK( path("..") / "foo" , "../foo" ); ! PATH_CHECK( "foo/..", "" ); ! PATH_CHECK( path("foo") / ".." , "" ); ! PATH_CHECK( "../f", "../f" ); ! PATH_CHECK( path("..") / "f" , "../f" ); ! PATH_CHECK( "f/..", "" ); ! PATH_CHECK( path("f") / ".." , "" ); ! PATH_CHECK( "foo/../..", ".." ); ! PATH_CHECK( path("foo") / ".." / ".." , ".." ); ! PATH_CHECK( "foo/../../..", "../.." ); ! PATH_CHECK( path("foo") / ".." / ".." / ".." , "../.." ); ! PATH_CHECK( "foo/../bar", "bar" ); ! PATH_CHECK( path("foo") / ".." / "bar" , "bar" ); ! PATH_CHECK( "foo/bar/..", "foo" ); ! PATH_CHECK( path("foo") / "bar" / ".." , "foo" ); ! PATH_CHECK( "foo/bar/../..", "" ); ! PATH_CHECK( path("foo") / "bar" / ".." / "..", "" ); ! PATH_CHECK( "foo/bar/../blah", "foo/blah" ); ! PATH_CHECK( path("foo") / "bar" / ".." / "blah", "foo/blah" ); ! PATH_CHECK( "f/../b", "b" ); ! PATH_CHECK( path("f") / ".." / "b" , "b" ); ! PATH_CHECK( "f/b/..", "f" ); ! PATH_CHECK( path("f") / "b" / ".." , "f" ); ! ! PATH_CHECK( "f/b/../a", "f/a" ); ! PATH_CHECK( path("f") / "b" / ".." / "a", "f/a" ); ! ! PATH_CHECK( "foo/bar/blah/../..", "foo" ); ! PATH_CHECK( path("foo") / "bar" / "blah" / ".." / "..", "foo" ); ! ! PATH_CHECK( "foo/bar/blah/../../bletch", "foo/bletch" ); ! PATH_CHECK( path("foo") / "bar" / "blah" / ".." / ".." / "bletch", "foo/bletch" ); BOOST_TEST( fs::posix_name("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.-_") ); *************** *** 163,170 **** BOOST_TEST( !fs::boost_directory_name("F$O") ); - check_throw( "/" ); check_throw( "...." ); - check_throw( "/foo" ); - check_throw( "foo/" ); check_throw( "foo/...." ); check_throw( "foo//bar" ); --- 187,191 ---- *************** *** 185,191 **** check_throw( "prn:" ); ! path itr_ck( "/foo/bar", fs::system_specific ); path::iterator itr( itr_ck.begin() ); - //std::cout << "\"" << *itr << "\"" << std::endl; BOOST_TEST( *itr == std::string( "/" ) ); BOOST_TEST( *++itr == std::string( "foo" ) ); --- 206,211 ---- check_throw( "prn:" ); ! path itr_ck( "/foo/bar" ); path::iterator itr( itr_ck.begin() ); BOOST_TEST( *itr == std::string( "/" ) ); BOOST_TEST( *++itr == std::string( "foo" ) ); *************** *** 199,203 **** BOOST_TEST( itr_ck.begin() == itr_ck.end() ); ! itr_ck = path( "/", fs::system_specific ); BOOST_TEST( *itr_ck.begin() == std::string( "/" ) ); BOOST_TEST( next(itr_ck.begin()) == itr_ck.end() ); --- 219,223 ---- BOOST_TEST( itr_ck.begin() == itr_ck.end() ); ! itr_ck = path( "/" ); BOOST_TEST( *itr_ck.begin() == std::string( "/" ) ); BOOST_TEST( next(itr_ck.begin()) == itr_ck.end() ); *************** *** 205,209 **** BOOST_TEST( prior(itr_ck.end()) == itr_ck.begin() ); ! itr_ck = path( "/foo", fs::system_specific ); BOOST_TEST( *itr_ck.begin() == std::string( "/" ) ); BOOST_TEST( *next( itr_ck.begin() ) == std::string( "foo" ) ); --- 225,229 ---- BOOST_TEST( prior(itr_ck.end()) == itr_ck.begin() ); ! itr_ck = path( "/foo" ); BOOST_TEST( *itr_ck.begin() == std::string( "/" ) ); BOOST_TEST( *next( itr_ck.begin() ) == std::string( "foo" ) ); *************** *** 220,310 **** BOOST_TEST( prior( itr_ck.end() ) == itr_ck.begin() ); ! # ifdef BOOST_WINDOWS ! itr_ck = path( "c:", fs::system_specific ); ! BOOST_TEST( *itr_ck.begin() == std::string( "c:" ) ); ! BOOST_TEST( next( itr_ck.begin() ) == itr_ck.end() ); ! BOOST_TEST( prior( itr_ck.end() ) == itr_ck.begin() ); ! BOOST_TEST( *prior( itr_ck.end() ) == std::string( "c:" ) ); ! itr_ck = path( "c:/", fs::system_specific ); ! BOOST_TEST( *itr_ck.begin() == std::string( "c:/" ) ); ! BOOST_TEST( next( itr_ck.begin() ) == itr_ck.end() ); ! BOOST_TEST( prior( itr_ck.end() ) == itr_ck.begin() ); ! BOOST_TEST( *prior( itr_ck.end() ) == std::string( "c:/" ) ); ! itr_ck = path( "c:foo", fs::system_specific ); ! BOOST_TEST( *itr_ck.begin() == std::string( "c:" ) ); ! BOOST_TEST( *next( itr_ck.begin() ) == std::string( "foo" ) ); ! BOOST_TEST( next(next( itr_ck.begin() )) == itr_ck.end() ); ! BOOST_TEST( prior(prior( itr_ck.end() )) == itr_ck.begin() ); ! BOOST_TEST( *prior( itr_ck.end() ) == std::string( "foo" ) ); ! BOOST_TEST( *prior(prior( itr_ck.end() )) == std::string( "c:" ) ); ! itr_ck = path( "c:/foo", fs::system_specific ); ! BOOST_TEST( *itr_ck.begin() == std::string( "c:/" ) ); ! BOOST_TEST( *next( itr_ck.begin() ) == std::string( "foo" ) ); ! BOOST_TEST( next(next( itr_ck.begin() )) == itr_ck.end() ); ! BOOST_TEST( prior(prior( itr_ck.end() )) == itr_ck.begin() ); ! BOOST_TEST( *prior( itr_ck.end() ) == std::string( "foo" ) ); ! BOOST_TEST( *prior(prior( itr_ck.end() )) == std::string( "c:/" ) ); ! itr_ck = path( "//share", fs::system_specific ); ! BOOST_TEST( *itr_ck.begin() == std::string( "//share" ) ); ! BOOST_TEST( next( itr_ck.begin() ) == itr_ck.end() ); ! BOOST_TEST( prior( itr_ck.end() ) == itr_ck.begin() ); ! BOOST_TEST( *prior( itr_ck.end() ) == std::string( "//share" ) ); ! itr_ck = path( "//share/foo", fs::system_specific ); ! BOOST_TEST( *itr_ck.begin() == std::string( "//share" ) ); ! BOOST_TEST( *next( itr_ck.begin() ) == std::string( "foo" ) ); ! BOOST_TEST( next(next( itr_ck.begin() )) == itr_ck.end() ); ! BOOST_TEST( prior(prior( itr_ck.end() )) == itr_ck.begin() ); ! BOOST_TEST( *prior( itr_ck.end() ) == std::string( "foo" ) ); ! BOOST_TEST( *prior(prior( itr_ck.end() )) == std::string( "//share" ) ); ! itr_ck = path( "prn:", fs::system_specific ); ! BOOST_TEST( *itr_ck.begin() == std::string( "prn:" ) ); ! BOOST_TEST( next( itr_ck.begin() ) == itr_ck.end() ); ! BOOST_TEST( prior( itr_ck.end() ) == itr_ck.begin() ); ! BOOST_TEST( *prior( itr_ck.end() ) == std::string( "prn:" ) ); ! check( path( "/", fs::system_specific ), "/" ); ! check( path( "/f", fs::system_specific ), "/f" ); ! check( path( "/foo", fs::system_specific ), "/foo" ); ! check( path( "\\", fs::system_specific ), "/" ); ! check( path( "\\f", fs::system_specific ), "/f" ); ! check( path( "\\foo", fs::system_specific ), "/foo" ); ! check( path( "foo\\bar", fs::system_specific ), "foo/bar" ); ! check( path( "foo bar", fs::system_specific ), "foo bar" ); ! check( path( "c:", fs::system_specific ), "c:" ); ! check( path( "c:/", fs::system_specific ), "c:/" ); ! check( path( "c:foo", fs::system_specific ), "c:foo" ); ! check( path( "c:/foo", fs::system_specific ), "c:/foo" ); ! check( path( "//share", fs::system_specific ), "//share" ); ! check( path( "//share/foo", fs::system_specific ), "//share/foo" ); ! check( path( "\\\\share", fs::system_specific ), "//share" ); ! check( path( "\\\\share\\foo", fs::system_specific ), "//share/foo" ); ! check( path( "c:/foo", fs::system_specific ), "c:/foo" ); ! check( path( "prn:", fs::system_specific ), "prn:" ); ! BOOST_TEST( path( "/", fs::system_specific ).leaf() == "/" ); ! BOOST_TEST( path( "c:", fs::system_specific ).leaf() == "c:" ); ! BOOST_TEST( path( "c:/", fs::system_specific ).leaf() == "c:/" ); ! BOOST_TEST( path( "c:foo", fs::system_specific ).leaf() == "foo" ); ! BOOST_TEST( path( "c:/foo", fs::system_specific ).leaf() == "foo" ); ! BOOST_TEST( path( "//share", fs::system_specific ).leaf() == "//share" ); ! BOOST_TEST( path( "//share/foo", fs::system_specific ).leaf() == "foo" ); ! BOOST_TEST( path( "/", fs::system_specific ).branch().generic_path() == "" ); ! BOOST_TEST( path( "c:", fs::system_specific ).branch().generic_path() == "" ); ! BOOST_TEST( path( "c:/", fs::system_specific ).branch().generic_path() == "" ); ! BOOST_TEST( path( "c:foo", fs::system_specific ).branch().generic_path() == "c:" ); ! BOOST_TEST( path( "c:/foo", fs::system_specific ).branch().generic_path() == "c:/" ); ! BOOST_TEST( path( "//share", fs::system_specific ).branch().generic_path() == "" ); ! BOOST_TEST( path( "//share/foo", fs::system_specific ).branch().generic_path() == "//share" ); ! # endif // BOOST_WINDOWS // std::cout << errors << " errors detected\n"; --- 240,549 ---- BOOST_TEST( prior( itr_ck.end() ) == itr_ck.begin() ); ! path p; ! p = ""; ! BOOST_TEST( p.relative_path().string() == "" ); ! BOOST_TEST( p.branch_path().string() == "" ); ! BOOST_TEST( p.leaf() == "" ); ! BOOST_TEST( p.root_name() == "" ); ! BOOST_TEST( p.root_directory() == "" ); ! BOOST_TEST( p.root_path().string() == "" ); ! BOOST_TEST( !p.has_root_path() ); ! BOOST_TEST( !p.has_root_name() ); ! BOOST_TEST( !p.has_root_directory() ); ! BOOST_TEST( !p.has_relative_path() ); ! BOOST_TEST( !p.has_leaf() ); ! BOOST_TEST( !p.has_branch_path() ); ! BOOST_TEST( !p.is_complete() ); ! p = "/"; ! BOOST_TEST( p.relative_path().string() == "" ); ! BOOST_TEST( p.branch_path().string() == "" ); ! BOOST_TEST( p.leaf() == "/" ); ! BOOST_TEST( p.root_name() == "" ); ! BOOST_TEST( p.root_directory() == "/" ); ! BOOST_TEST( p.root_path().string() == "/" ); ! BOOST_TEST( p.has_root_path() ); ! BOOST_TEST( !p.has_root_name() ); ! BOOST_TEST( p.has_root_directory() ); ! BOOST_TEST( !p.has_relative_path() ); ! BOOST_TEST( p.has_leaf() ); ! BOOST_TEST( !p.has_branch_path() ); ! if ( platform == "POSIX" ) ! BOOST_TEST( p.is_complete() ); ! else ! BOOST_TEST( !p.is_complete() ); ! p = "foo"; ! BOOST_TEST( p.relative_path().string() == "foo" ); ! BOOST_TEST( p.branch_path().string() == "" ); ! BOOST_TEST( p.leaf() == "foo" ); ! BOOST_TEST( p.root_name() == "" ); ! BOOST_TEST( p.root_directory() == "" ); ! BOOST_TEST( p.root_path().string() == "" ); ! BOOST_TEST( !p.has_root_path() ); ! BOOST_TEST( !p.has_root_name() ); ! BOOST_TEST( !p.has_root_directory() ); ! BOOST_TEST( p.has_relative_path() ); ! BOOST_TEST( p.has_leaf() ); ! BOOST_TEST( !p.has_branch_path() ); ! BOOST_TEST( !p.is_complete() ); ! p = "/foo"; ! BOOST_TEST( p.relative_path().string() == "foo" ); ! BOOST_TEST( p.branch_path().string() == "/" ); ! BOOST_TEST( p.leaf() == "foo" ); ! BOOST_TEST( p.root_name() == "" ); ! BOOST_TEST( p.root_directory() == "/" ); ! BOOST_TEST( p.root_path().string() == "/" ); ! BOOST_TEST( p.has_root_path() ); ! BOOST_TEST( !p.has_root_name() ); ! BOOST_TEST( p.has_root_directory() ); ! BOOST_TEST( p.has_relative_path() ); ! BOOST_TEST( p.has_leaf() ); ! BOOST_TEST( p.has_branch_path() ); ! if ( platform == "POSIX" ) ! BOOST_TEST( p.is_complete() ); ! else ! BOOST_TEST( !p.is_complete() ); ! p = "foo/bar"; ! BOOST_TEST( p.relative_path().string() == "foo/bar" ); ! BOOST_TEST( p.branch_path().string() == "foo" ); ! BOOST_TEST( p.leaf() == "bar" ); ! BOOST_TEST( p.root_name() == "" ); ! BOOST_TEST( p.root_directory() == "" ); ! BOOST_TEST( p.root_path().string() == "" ); ! BOOST_TEST( !p.has_root_path() ); ! BOOST_TEST( !p.has_root_name() ); ! BOOST_TEST( !p.has_root_directory() ); ! BOOST_TEST( p.has_relative_path() ); ! BOOST_TEST( p.has_leaf() ); ! BOOST_TEST( p.has_branch_path() ); ! BOOST_TEST( !p.is_complete() ); ! p = "/foo/bar"; ! BOOST_TEST( p.relative_path().string() == "foo/bar" ); ! BOOST_TEST( p.branch_path().string() == "/foo" ); ! BOOST_TEST( p.leaf() == "bar" ); ! BOOST_TEST( p.root_name() == "" ); ! BOOST_TEST( p.root_directory() == "/" ); ! BOOST_TEST( p.root_path().string() == "/" ); ! BOOST_TEST( p.has_root_path() ); ! BOOST_TEST( !p.has_root_name() ); ! BOOST_TEST( p.has_root_directory() ); ! BOOST_TEST( p.has_relative_path() ); ! BOOST_TEST( p.has_leaf() ); ! BOOST_TEST( p.has_branch_path() ); ! if ( platform == "POSIX" ) ! BOOST_TEST( p.is_complete() ); ! else ! BOOST_TEST( !p.is_complete() ); ! if ( platform == "Windows" ) ! { ! PATH_CHECK( path( "\\", fs::native ), "/" ); ! PATH_CHECK( path( "\\f", fs::native ), "/f" ); ! PATH_CHECK( path( "\\foo", fs::native ), "/foo" ); ! PATH_CHECK( path( "foo\\bar", fs::native ), "foo/bar" ); ! PATH_CHECK( path( "foo bar", fs::native ), "foo bar" ); ! PATH_CHECK( path( "c:", fs::native ), "c:" ); ! PATH_CHECK( path( "c:/", fs::native ), "c:/" ); ! PATH_CHECK( path( "c:foo", fs::native ), "c:foo" ); ! PATH_CHECK( path( "c:/foo", fs::native ), "c:/foo" ); ! PATH_CHECK( path( "//share", fs::native ), "//share" ); ! PATH_CHECK( path( "//share/", fs::native ), "//share/" ); ! PATH_CHECK( path( "//share/foo", fs::native ), "//share/foo" ); ! PATH_CHECK( path( "\\\\share", fs::native ), "//share" ); ! PATH_CHECK( path( "\\\\share\\", fs::native ), "//share/" ); ! PATH_CHECK( path( "\\\\share\\foo", fs::native ), "//share/foo" ); ! PATH_CHECK( path( "c:/foo", fs::native ), "c:/foo" ); ! PATH_CHECK( path( "prn:", fs::native ), "prn:" ); ! p = path( "c:", fs::native ); ! BOOST_TEST( p.relative_path().string() == "" ); ! BOOST_TEST( p.branch_path().string() == "" ); ! BOOST_TEST( p.leaf() == "c:" ); ! BOOST_TEST( p.root_name() == "c:" ); ! BOOST_TEST( p.root_directory() == "" ); ! BOOST_TEST( p.root_path().string() == "c:" ); ! BOOST_TEST( p.has_root_path() ); ! BOOST_TEST( p.has_root_name() ); ! BOOST_TEST( !p.has_root_directory() ); ! BOOST_TEST( !p.has_relative_path() ); ! BOOST_TEST( p.has_leaf() ); ! BOOST_TEST( !p.has_branch_path() ); ! BOOST_TEST( !p.is_complete() ); ! p = path( "c:foo", fs::native ); ! BOOST_TEST( p.relative_path().string() == "foo" ); ! BOOST_TEST( p.branch_path().string() == "c:" ); ! BOOST_TEST( p.leaf() == "foo" ); ! BOOST_TEST( p.root_name() == "c:" ); ! BOOST_TEST( p.root_directory() == "" ); ! BOOST_TEST( p.root_path().string() == "c:" ); ! BOOST_TEST( p.has_root_path() ); ! BOOST_TEST( p.has_root_name() ); ! BOOST_TEST( !p.has_root_directory() ); ! BOOST_TEST( p.has_relative_path() ); ! BOOST_TEST( p.has_leaf() ); ! BOOST_TEST( p.has_branch_path() ); ! BOOST_TEST( !p.is_complete() ); ! ! p = path( "c:/", fs::native ); ! BOOST_TEST( p.relative_path().string() == "" ); ! BOOST_TEST( p.branch_path().string() == "c:" ); ! BOOST_TEST( p.leaf() == "/" ); ! BOOST_TEST( p.root_name() == "c:" ); ! BOOST_TEST( p.root_directory() == "/" ); ! BOOST_TEST( p.root_path().string() == "c:/" ); ! BOOST_TEST( p.has_root_path() ); ! BOOST_TEST( p.has_root_name() ); ! BOOST_TEST( p.has_root_directory() ); ! BOOST_TEST( !p.has_relative_path() ); ! BOOST_TEST( p.has_leaf() ); ! BOOST_TEST( p.has_branch_path() ); ! BOOST_TEST( p.is_complete() ); ! p = path( "c:/foo", fs::native ); ! BOOST_TEST( p.relative_path().string() == "foo" ); ! BOOST_TEST( p.branch_path().string() == "c:/" ); ! BOOST_TEST( p.leaf() == "foo" ); ! BOOST_TEST( p.root_name() == "c:" ); ! BOOST_TEST( p.root_directory() == "/" ); ! BOOST_TEST( p.root_path().string() == "c:/" ); ! BOOST_TEST( p.has_root_path() ); ! BOOST_TEST( p.has_root_name() ); ! BOOST_TEST( p.has_root_directory() ); ! BOOST_TEST( p.has_relative_path() ); ! BOOST_TEST( p.has_leaf() ); ! BOOST_TEST( p.has_branch_path() ); ! BOOST_TEST( p.is_complete() ); ! /* Commented out until the semantics of //share are clearer. + p = path( "//share", fs::native ); + BOOST_TEST( p.string() == "//share" ); + BOOST_TEST( p.relative_path().string() == "" ); + BOOST_TEST( p.branch_path().string() == "" ); + BOOST_TEST( p.leaf() == "//share" ); + BOOST_TEST( p.root_name() == "//share" ); + BOOST_TEST( p.root_directory() == "/" ); + BOOST_TEST( p.root_path().string() == "//share/" ); + BOOST_TEST( p.has_root_path() ); + BOOST_TEST( p.has_root_name() ); + BOOST_TEST( !p.has_root_directory() ); + BOOST_TEST( !p.has_relative_path() ); + BOOST_TEST( p.has_leaf() ); + BOOST_TEST( !p.has_branch_path() ); + BOOST_TEST( !p.is_complete() ); + */ + p = path( "//share/", fs::native ); + BOOST_TEST( p.relative_path().string() == "" ); + BOOST_TEST( p.branch_path().string() == "//share" ); + BOOST_TEST( p.leaf() == "/" ); + BOOST_TEST( p.root_name() == "//share" ); + BOOST_TEST( p.root_directory() == "/" ); + BOOST_TEST( p.root_path().string() == "//share/" ); + BOOST_TEST( p.has_root_path() ); + BOOST_TEST( p.has_root_name() ); + BOOST_TEST( p.has_root_directory() ); + BOOST_TEST( !p.has_relative_path() ); + BOOST_TEST( p.has_leaf() ); + BOOST_TEST( p.has_branch_path() ); + BOOST_TEST( p.is_complete() ); + + p = path( "//share/foo", fs::native ); + BOOST_TEST( p.relative_path().string() == "foo" ); + BOOST_TEST( p.branch_path().string() == "//share/" ); + BOOST_TEST( p.leaf() == "foo" ); + BOOST_TEST( p.root_name() == "//share" ); + BOOST_TEST( p.root_directory() == "/" ); + BOOST_TEST( p.root_path().string() == "//share/" ); + BOOST_TEST( p.has_root_path() ); + BOOST_TEST( p.has_root_name() ); + BOOST_TEST( p.has_root_directory() ); + BOOST_TEST( p.has_relative_path() ); + BOOST_TEST( p.has_leaf() ); + BOOST_TEST( p.has_branch_path() ); + BOOST_TEST( p.is_complete() ); + + p = path( "prn:", fs::native ); + BOOST_TEST( p.relative_path().string() == "" ); + BOOST_TEST( p.branch_path().string() == "" ); + BOOST_TEST( p.leaf() == "prn:" ); + BOOST_TEST( p.root_name() == "prn:" ); + BOOST_TEST( p.root_directory() == "" ); + BOOST_TEST( p.root_path().string() == "prn:" ); + BOOST_TEST( p.has_root_path() ); + BOOST_TEST( p.has_root_name() ); + BOOST_TEST( !p.has_root_directory() ); + BOOST_TEST( !p.has_relative_path() ); + BOOST_TEST( p.has_leaf() ); + BOOST_TEST( !p.has_branch_path() ); + BOOST_TEST( p.is_complete() ); + + itr_ck = path( "c:", fs::native ); + BOOST_TEST( *itr_ck.begin() == std::string( "c:" ) ); + BOOST_TEST( next( itr_ck.begin() ) == itr_ck.end() ); + BOOST_TEST( prior( itr_ck.end() ) == itr_ck.begin() ); + BOOST_TEST( *prior( itr_ck.end() ) == std::string( "c:" ) ); + + itr_ck = path( "c:/", fs::native ); + BOOST_TEST( *itr_ck.begin() == std::string( "c:" ) ); + BOOST_TEST( *next( itr_ck.begin() ) == std::string( "/" ) ); + BOOST_TEST( next( next( itr_ck.begin() )) == itr_ck.end() ); + BOOST_TEST( prior( prior( itr_ck.end() )) == itr_ck.begin() ); + BOOST_TEST( *prior( itr_ck.end() ) == std::string( "/" ) ); + BOOST_TEST( *prior( prior( itr_ck.end() )) == std::string( "c:" ) ); + + itr_ck = path( "c:foo", fs::native ); + BOOST_TEST( *itr_ck.begin() == std::string( "c:" ) ); + BOOST_TEST( *next( itr_ck.begin() ) == std::string( "foo" ) ); + BOOST_TEST( next(next( itr_ck.begin() )) == itr_ck.end() ); + BOOST_TEST( prior(prior( itr_ck.end() )) == itr_ck.begin() ); + BOOST_TEST( *prior( itr_ck.end() ) == std::string( "foo" ) ); + BOOST_TEST( *prior(prior( itr_ck.end() )) == std::string( "c:" ) ); + + itr_ck = path( "c:/foo", fs::native ); + BOOST_TEST( *itr_ck.begin() == std::string( "c:" ) ); + BOOST_TEST( *next( itr_ck.begin() ) == std::string( "/" ) ); + BOOST_TEST( *next( next( itr_ck.begin() )) == std::string( "foo" ) ); + BOOST_TEST( next( next( next( itr_ck.begin() ))) == itr_ck.end() ); + BOOST_TEST( prior( prior( prior( itr_ck.end() ))) == itr_ck.begin() ); + BOOST_TEST( *prior( itr_ck.end() ) == std::string( "foo" ) ); + BOOST_TEST( *prior( prior( itr_ck.end() )) == std::string( "/" ) ); + BOOST_TEST( *prior( prior( prior( itr_ck.end() ))) == std::string( "c:" ) ); + + itr_ck = path( "//share", fs::native ); + BOOST_TEST( *itr_ck.begin() == std::string( "//share" ) ); + BOOST_TEST( next( itr_ck.begin() ) == itr_ck.end() ); + BOOST_TEST( prior( itr_ck.end() ) == itr_ck.begin() ); + BOOST_TEST( *prior( itr_ck.end() ) == std::string( "//share" ) ); + + itr_ck = path( "//share/", fs::native ); + BOOST_TEST( *itr_ck.begin() == std::string( "//share" ) ); + BOOST_TEST( *next( itr_ck.begin() ) == std::string( "/" ) ); + BOOST_TEST( next(next( itr_ck.begin() )) == itr_ck.end() ); + BOOST_TEST( prior(prior( itr_ck.end() )) == itr_ck.begin() ); + BOOST_TEST( *prior( itr_ck.end() ) == std::string( "/" ) ); + BOOST_TEST( *prior(prior( itr_ck.end() )) == std::string( "//share" ) ); + + itr_ck = path( "//share/foo", fs::native ); + BOOST_TEST( *itr_ck.begin() == std::string( "//share" ) ); + BOOST_TEST( *next( itr_ck.begin() ) == std::string( "/" ) ); + BOOST_TEST( *next(next( itr_ck.begin() )) == std::string( "foo" ) ); + BOOST_TEST( next(next(next( itr_ck.begin() ))) == itr_ck.end() ); + BOOST_TEST( prior(prior(prior( itr_ck.end() ))) == itr_ck.begin() ); + BOOST_TEST( *prior( itr_ck.end() ) == std::string( "foo" ) ); + BOOST_TEST( *prior(prior( itr_ck.end() )) == std::string( "/" ) ); + BOOST_TEST( *prior(prior(prior( itr_ck.end() ))) == std::string( "//share" ) ); + + itr_ck = path( "prn:", fs::native ); + BOOST_TEST( *itr_ck.begin() == std::string( "prn:" ) ); + BOOST_TEST( next( itr_ck.begin() ) == itr_ck.end() ); + BOOST_TEST( prior( itr_ck.end() ) == itr_ck.begin() ); + BOOST_TEST( *prior( itr_ck.end() ) == std::string( "prn:" ) ); + } // std::cout << errors << " errors detected\n"; |