mirror of
https://github.com/boostorg/filesystem.git
synced 2026-02-01 20:42:08 +00:00
many path related review comments applied
[SVN r16394]
This commit is contained in:
@@ -21,20 +21,21 @@ using boost::filesystem::path;
|
||||
using boost::next;
|
||||
using boost::prior;
|
||||
|
||||
#define BOOST_INCLUDE_MAIN
|
||||
#include <boost/test/test_tools.hpp>
|
||||
#include <boost/test/minimal.hpp>
|
||||
|
||||
#define PATH_CHECK( a, b ) check( a, b, __LINE__ )
|
||||
|
||||
namespace {
|
||||
int errors;
|
||||
|
||||
void check( const fs::path & source,
|
||||
const std::string & expected )
|
||||
const std::string & expected, int line )
|
||||
{
|
||||
if ( source.generic_path()== expected ) return;
|
||||
if ( source.string()== expected ) return;
|
||||
|
||||
++errors;
|
||||
|
||||
std::cout << "source.generic_path(): \"" << source.generic_path()
|
||||
std::cout << '(' << line << ") source.string(): \"" << source.string()
|
||||
<< "\" != expected: \"" << expected
|
||||
<< "\"" << std::endl;
|
||||
}
|
||||
@@ -64,91 +65,102 @@ int test_main( int, char*[] )
|
||||
path p3;
|
||||
p3 = p2;
|
||||
|
||||
// p1.branch() = p2; // should fail
|
||||
// p1.branch_path() = p2; // should fail
|
||||
// *p1.begin() = ""; // should fail
|
||||
|
||||
// These verify various overloads don't cause compiler errors
|
||||
fs::exists( "foo" );
|
||||
fs::exists( std::string( "foo" ) );
|
||||
fs::exists( p1 );
|
||||
fs::exists( "foo" << p1 );
|
||||
fs::exists( std::string( "foo" ) << 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( p1.string() == p2.string() );
|
||||
BOOST_TEST( p1.string() == p3.string() );
|
||||
BOOST_TEST( path( "foo" ).leaf() == "foo" );
|
||||
BOOST_TEST( path( "foo" ).branch().generic_path() == "" );
|
||||
BOOST_TEST( path( "foo" ).branch_path().string() == "" );
|
||||
BOOST_TEST( p1.leaf() == "fum" );
|
||||
BOOST_TEST( p1.branch().generic_path() == "fe/fi/fo" );
|
||||
BOOST_TEST( p1.branch_path().string() == "fe/fi/fo" );
|
||||
BOOST_TEST( path( "" ).is_null() == true );
|
||||
BOOST_TEST( path( "foo" ).is_null() == false );
|
||||
|
||||
check( "", "" );
|
||||
PATH_CHECK( "", "" );
|
||||
|
||||
check( "foo", "foo" );
|
||||
check( path("") << "foo", "foo" );
|
||||
check( path("foo") << "", "foo" );
|
||||
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" );
|
||||
|
||||
check( "foo/bar", "foo/bar" );
|
||||
check( path("foo") << "bar", "foo/bar" );
|
||||
check( path("foo") << path("bar"), "foo/bar" );
|
||||
check( "foo" << path("bar"), "foo/bar" );
|
||||
PATH_CHECK( "/foo", "/foo" );
|
||||
PATH_CHECK( path("") / "/foo", "/foo" );
|
||||
PATH_CHECK( path("/foo") / "", "/foo" );
|
||||
|
||||
check( "a/b", "a/b" ); // probe for length effects
|
||||
check( path("a") << "b", "a/b" );
|
||||
PATH_CHECK( "foo/", "foo" );
|
||||
PATH_CHECK( path("") / "foo/", "foo" );
|
||||
PATH_CHECK( path("foo") / "/", "foo" );
|
||||
|
||||
check( "..", ".." );
|
||||
check( path("..") << "", ".." );
|
||||
check( path("") << "..", ".." );
|
||||
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" );
|
||||
|
||||
check( "../..", "../.." );
|
||||
check( path("..") << ".." , "../.." );
|
||||
PATH_CHECK( "a/b", "a/b" ); // probe for length effects
|
||||
PATH_CHECK( path("a") / "b", "a/b" );
|
||||
|
||||
check( "../foo", "../foo" );
|
||||
check( path("..") << "foo" , "../foo" );
|
||||
PATH_CHECK( "..", ".." );
|
||||
PATH_CHECK( path("..") / "", ".." );
|
||||
PATH_CHECK( path("") / "..", ".." );
|
||||
|
||||
check( "foo/..", "" );
|
||||
check( path("foo") << ".." , "" );
|
||||
PATH_CHECK( "../..", "../.." );
|
||||
PATH_CHECK( path("..") / ".." , "../.." );
|
||||
|
||||
check( "../f", "../f" );
|
||||
check( path("..") << "f" , "../f" );
|
||||
PATH_CHECK( "../foo", "../foo" );
|
||||
PATH_CHECK( path("..") / "foo" , "../foo" );
|
||||
|
||||
check( "f/..", "" );
|
||||
check( path("f") << ".." , "" );
|
||||
PATH_CHECK( "foo/..", "" );
|
||||
PATH_CHECK( path("foo") / ".." , "" );
|
||||
|
||||
check( "foo/../..", ".." );
|
||||
check( path("foo") << ".." << ".." , ".." );
|
||||
PATH_CHECK( "../f", "../f" );
|
||||
PATH_CHECK( path("..") / "f" , "../f" );
|
||||
|
||||
check( "foo/../../..", "../.." );
|
||||
check( path("foo") << ".." << ".." << ".." , "../.." );
|
||||
PATH_CHECK( "f/..", "" );
|
||||
PATH_CHECK( path("f") / ".." , "" );
|
||||
|
||||
check( "foo/../bar", "bar" );
|
||||
check( path("foo") << ".." << "bar" , "bar" );
|
||||
PATH_CHECK( "foo/../..", ".." );
|
||||
PATH_CHECK( path("foo") / ".." / ".." , ".." );
|
||||
|
||||
check( "foo/bar/..", "foo" );
|
||||
check( path("foo") << "bar" << ".." , "foo" );
|
||||
PATH_CHECK( "foo/../../..", "../.." );
|
||||
PATH_CHECK( path("foo") / ".." / ".." / ".." , "../.." );
|
||||
|
||||
check( "foo/bar/../..", "" );
|
||||
check( path("foo") << "bar" << ".." << "..", "" );
|
||||
PATH_CHECK( "foo/../bar", "bar" );
|
||||
PATH_CHECK( path("foo") / ".." / "bar" , "bar" );
|
||||
|
||||
check( "foo/bar/../blah", "foo/blah" );
|
||||
check( path("foo") << "bar" << ".." << "blah", "foo/blah" );
|
||||
PATH_CHECK( "foo/bar/..", "foo" );
|
||||
PATH_CHECK( path("foo") / "bar" / ".." , "foo" );
|
||||
|
||||
check( "f/../b", "b" );
|
||||
check( path("f") << ".." << "b" , "b" );
|
||||
PATH_CHECK( "foo/bar/../..", "" );
|
||||
PATH_CHECK( path("foo") / "bar" / ".." / "..", "" );
|
||||
|
||||
check( "f/b/..", "f" );
|
||||
check( path("f") << "b" << ".." , "f" );
|
||||
PATH_CHECK( "foo/bar/../blah", "foo/blah" );
|
||||
PATH_CHECK( path("foo") / "bar" / ".." / "blah", "foo/blah" );
|
||||
|
||||
check( "f/b/../a", "f/a" );
|
||||
check( path("f") << "b" << ".." << "a", "f/a" );
|
||||
PATH_CHECK( "f/../b", "b" );
|
||||
PATH_CHECK( path("f") / ".." / "b" , "b" );
|
||||
|
||||
check( "foo/bar/blah/../..", "foo" );
|
||||
check( path("foo") << "bar" << "blah" << ".." << "..", "foo" );
|
||||
PATH_CHECK( "f/b/..", "f" );
|
||||
PATH_CHECK( path("f") / "b" / ".." , "f" );
|
||||
|
||||
check( "foo/bar/blah/../../bletch", "foo/bletch" );
|
||||
check( path("foo") << "bar" << "blah" << ".." << ".." << "bletch", "foo/bletch" );
|
||||
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.-_") );
|
||||
BOOST_TEST( !fs::posix_name("F$O") );
|
||||
@@ -167,10 +179,7 @@ int test_main( int, char*[] )
|
||||
BOOST_TEST( !fs::boost_directory_name("12345678901234567890123456789012") );
|
||||
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" );
|
||||
check_throw( "foo\\bar" );
|
||||
@@ -189,9 +198,8 @@ int test_main( int, char*[] )
|
||||
check_throw( "//share" );
|
||||
check_throw( "prn:" );
|
||||
|
||||
path itr_ck( "/foo/bar", fs::system_specific );
|
||||
path itr_ck( "/foo/bar" );
|
||||
path::iterator itr( itr_ck.begin() );
|
||||
//std::cout << "\"" << *itr << "\"" << std::endl;
|
||||
BOOST_TEST( *itr == std::string( "/" ) );
|
||||
BOOST_TEST( *++itr == std::string( "foo" ) );
|
||||
BOOST_TEST( *++itr == std::string( "bar" ) );
|
||||
@@ -203,13 +211,13 @@ int test_main( int, char*[] )
|
||||
itr_ck = "";
|
||||
BOOST_TEST( itr_ck.begin() == itr_ck.end() );
|
||||
|
||||
itr_ck = path( "/", fs::system_specific );
|
||||
itr_ck = path( "/" );
|
||||
BOOST_TEST( *itr_ck.begin() == std::string( "/" ) );
|
||||
BOOST_TEST( next(itr_ck.begin()) == itr_ck.end() );
|
||||
BOOST_TEST( *prior(itr_ck.end()) == std::string( "/" ) );
|
||||
BOOST_TEST( prior(itr_ck.end()) == itr_ck.begin() );
|
||||
|
||||
itr_ck = path( "/foo", fs::system_specific );
|
||||
itr_ck = path( "/foo" );
|
||||
BOOST_TEST( *itr_ck.begin() == std::string( "/" ) );
|
||||
BOOST_TEST( *next( itr_ck.begin() ) == std::string( "foo" ) );
|
||||
BOOST_TEST( next(next( itr_ck.begin() )) == itr_ck.end() );
|
||||
@@ -224,8 +232,117 @@ int test_main( int, char*[] )
|
||||
BOOST_TEST( *prior( itr_ck.end() ) == std::string( "foo" ) );
|
||||
BOOST_TEST( prior( itr_ck.end() ) == itr_ck.begin() );
|
||||
|
||||
BOOST_TEST( path( "/" ).relative_path().string() == "" );
|
||||
BOOST_TEST( path( "/" ).branch_path().string() == "" );
|
||||
BOOST_TEST( path( "/" ).leaf() == "/" );
|
||||
BOOST_TEST( path( "/" ).system_specific_root() == "" );
|
||||
BOOST_TEST( path( "/" ).root_directory() == "/" );
|
||||
BOOST_TEST( path( "/" ).root_path().string() == "/" );
|
||||
|
||||
BOOST_TEST( path( "foo" ).relative_path().string() == "foo" );
|
||||
BOOST_TEST( path( "foo" ).branch_path().string() == "" );
|
||||
BOOST_TEST( path( "foo" ).leaf() == "foo" );
|
||||
BOOST_TEST( path( "foo" ).system_specific_root() == "" );
|
||||
BOOST_TEST( path( "foo" ).root_directory() == "" );
|
||||
BOOST_TEST( path( "foo" ).root_path().string() == "" );
|
||||
|
||||
BOOST_TEST( path( "/foo" ).relative_path().string() == "foo" );
|
||||
BOOST_TEST( path( "/foo" ).branch_path().string() == "/" );
|
||||
BOOST_TEST( path( "/foo" ).leaf() == "foo" );
|
||||
BOOST_TEST( path( "/foo" ).system_specific_root() == "" );
|
||||
BOOST_TEST( path( "/foo" ).root_directory() == "/" );
|
||||
BOOST_TEST( path( "/foo" ).root_path().string() == "/" );
|
||||
|
||||
BOOST_TEST( path( "foo/bar" ).relative_path().string() == "foo/bar" );
|
||||
BOOST_TEST( path( "foo/bar" ).branch_path().string() == "foo" );
|
||||
BOOST_TEST( path( "foo/bar" ).leaf() == "bar" );
|
||||
BOOST_TEST( path( "foo/bar" ).system_specific_root() == "" );
|
||||
BOOST_TEST( path( "foo/bar" ).root_directory() == "" );
|
||||
BOOST_TEST( path( "foo/bar" ).root_path().string() == "" );
|
||||
|
||||
BOOST_TEST( path( "/foo/bar" ).relative_path().string() == "foo/bar" );
|
||||
BOOST_TEST( path( "/foo/bar" ).branch_path().string() == "/foo" );
|
||||
BOOST_TEST( path( "/foo/bar" ).leaf() == "bar" );
|
||||
BOOST_TEST( path( "/foo/bar" ).system_specific_root() == "" );
|
||||
BOOST_TEST( path( "/foo/bar" ).root_directory() == "/" );
|
||||
BOOST_TEST( path( "/foo/bar" ).root_path().string() == "/" );
|
||||
|
||||
if ( std::strcmp( fs::detail::implementation_name(), "Windows" ) == 0 )
|
||||
{
|
||||
PATH_CHECK( path( "\\", fs::system_specific ), "/" );
|
||||
PATH_CHECK( path( "\\f", fs::system_specific ), "/f" );
|
||||
PATH_CHECK( path( "\\foo", fs::system_specific ), "/foo" );
|
||||
PATH_CHECK( path( "foo\\bar", fs::system_specific ), "foo/bar" );
|
||||
PATH_CHECK( path( "foo bar", fs::system_specific ), "foo bar" );
|
||||
PATH_CHECK( path( "c:", fs::system_specific ), "c:" );
|
||||
PATH_CHECK( path( "c:/", fs::system_specific ), "c:/" );
|
||||
PATH_CHECK( path( "c:foo", fs::system_specific ), "c:foo" );
|
||||
PATH_CHECK( path( "c:/foo", fs::system_specific ), "c:/foo" );
|
||||
PATH_CHECK( path( "//share", fs::system_specific ), "//share" );
|
||||
PATH_CHECK( path( "//share/", fs::system_specific ), "//share/" );
|
||||
PATH_CHECK( path( "//share/foo", fs::system_specific ), "//share/foo" );
|
||||
PATH_CHECK( path( "\\\\share", fs::system_specific ), "//share" );
|
||||
PATH_CHECK( path( "\\\\share\\", fs::system_specific ), "//share/" );
|
||||
PATH_CHECK( path( "\\\\share\\foo", fs::system_specific ), "//share/foo" );
|
||||
PATH_CHECK( path( "c:/foo", fs::system_specific ), "c:/foo" );
|
||||
PATH_CHECK( path( "prn:", fs::system_specific ), "prn:" );
|
||||
|
||||
BOOST_TEST( path( "c:", fs::system_specific ).relative_path().string() == "" );
|
||||
BOOST_TEST( path( "c:", fs::system_specific ).branch_path().string() == "" );
|
||||
BOOST_TEST( path( "c:", fs::system_specific ).leaf() == "c:" );
|
||||
BOOST_TEST( path( "c:", fs::system_specific ).system_specific_root() == "c:" );
|
||||
BOOST_TEST( path( "c:", fs::system_specific ).root_directory() == "" );
|
||||
BOOST_TEST( path( "c:", fs::system_specific ).root_path().string() == "c:" );
|
||||
|
||||
BOOST_TEST( path( "c:foo", fs::system_specific ).relative_path().string() == "foo" );
|
||||
BOOST_TEST( path( "c:foo", fs::system_specific ).branch_path().string() == "c:" );
|
||||
BOOST_TEST( path( "c:foo", fs::system_specific ).leaf() == "foo" );
|
||||
BOOST_TEST( path( "c:foo", fs::system_specific ).system_specific_root() == "c:" );
|
||||
BOOST_TEST( path( "c:foo", fs::system_specific ).root_directory() == "" );
|
||||
BOOST_TEST( path( "c:foo", fs::system_specific ).root_path().string() == "c:" );
|
||||
|
||||
BOOST_TEST( path( "c:/", fs::system_specific ).relative_path().string() == "" );
|
||||
BOOST_TEST( path( "c:/", fs::system_specific ).branch_path().string() == "c:" );
|
||||
BOOST_TEST( path( "c:/", fs::system_specific ).leaf() == "/" );
|
||||
BOOST_TEST( path( "c:/", fs::system_specific ).system_specific_root() == "c:" );
|
||||
BOOST_TEST( path( "c:/", fs::system_specific ).root_directory() == "/" );
|
||||
BOOST_TEST( path( "c:/", fs::system_specific ).root_path().string() == "c:/" );
|
||||
|
||||
BOOST_TEST( path( "c:/foo", fs::system_specific ).relative_path().string() == "foo" );
|
||||
BOOST_TEST( path( "c:/foo", fs::system_specific ).branch_path().string() == "c:/" );
|
||||
BOOST_TEST( path( "c:/foo", fs::system_specific ).leaf() == "foo" );
|
||||
BOOST_TEST( path( "c:/foo", fs::system_specific ).system_specific_root() == "c:" );
|
||||
BOOST_TEST( path( "c:/foo", fs::system_specific ).root_directory() == "/" );
|
||||
BOOST_TEST( path( "c:/foo", fs::system_specific ).root_path().string() == "c:/" );
|
||||
|
||||
BOOST_TEST( path( "//share", fs::system_specific ).relative_path().string() == "" );
|
||||
BOOST_TEST( path( "//share", fs::system_specific ).branch_path().string() == "" );
|
||||
BOOST_TEST( path( "//share", fs::system_specific ).leaf() == "//share" );
|
||||
BOOST_TEST( path( "//share", fs::system_specific ).system_specific_root() == "//share" );
|
||||
BOOST_TEST( path( "//share", fs::system_specific ).root_directory() == "/" );
|
||||
BOOST_TEST( path( "//share", fs::system_specific ).root_path().string() == "//share/" );
|
||||
|
||||
BOOST_TEST( path( "//share/", fs::system_specific ).relative_path().string() == "" );
|
||||
BOOST_TEST( path( "//share/", fs::system_specific ).branch_path().string() == "//share" );
|
||||
BOOST_TEST( path( "//share/", fs::system_specific ).leaf() == "/" );
|
||||
BOOST_TEST( path( "//share/", fs::system_specific ).system_specific_root() == "//share" );
|
||||
BOOST_TEST( path( "//share/", fs::system_specific ).root_directory() == "/" );
|
||||
BOOST_TEST( path( "//share/", fs::system_specific ).root_path().string() == "//share/" );
|
||||
|
||||
BOOST_TEST( path( "//share/foo", fs::system_specific ).relative_path().string() == "foo" );
|
||||
BOOST_TEST( path( "//share/foo", fs::system_specific ).branch_path().string() == "//share/" );
|
||||
BOOST_TEST( path( "//share/foo", fs::system_specific ).leaf() == "foo" );
|
||||
BOOST_TEST( path( "//share/foo", fs::system_specific ).system_specific_root() == "//share" );
|
||||
BOOST_TEST( path( "//share/foo", fs::system_specific ).root_directory() == "/" );
|
||||
BOOST_TEST( path( "//share/foo", fs::system_specific ).root_path().string() == "//share/" );
|
||||
|
||||
BOOST_TEST( path( "prn:", fs::system_specific ).relative_path().string() == "" );
|
||||
BOOST_TEST( path( "prn:", fs::system_specific ).branch_path().string() == "" );
|
||||
BOOST_TEST( path( "prn:", fs::system_specific ).leaf() == "prn:" );
|
||||
BOOST_TEST( path( "prn:", fs::system_specific ).system_specific_root() == "prn:" );
|
||||
BOOST_TEST( path( "prn:", fs::system_specific ).root_directory() == "" );
|
||||
BOOST_TEST( path( "prn:", fs::system_specific ).root_path().string() == "prn:" );
|
||||
|
||||
itr_ck = path( "c:", fs::system_specific );
|
||||
BOOST_TEST( *itr_ck.begin() == std::string( "c:" ) );
|
||||
BOOST_TEST( next( itr_ck.begin() ) == itr_ck.end() );
|
||||
@@ -233,10 +350,12 @@ int test_main( int, char*[] )
|
||||
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:/" ) );
|
||||
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::system_specific );
|
||||
BOOST_TEST( *itr_ck.begin() == std::string( "c:" ) );
|
||||
@@ -247,12 +366,14 @@ int test_main( int, char*[] )
|
||||
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( *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( "c:/" ) );
|
||||
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::system_specific );
|
||||
BOOST_TEST( *itr_ck.begin() == std::string( "//share" ) );
|
||||
@@ -260,54 +381,29 @@ int test_main( int, char*[] )
|
||||
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 );
|
||||
itr_ck = path( "//share/", fs::system_specific );
|
||||
BOOST_TEST( *itr_ck.begin() == std::string( "//share" ) );
|
||||
BOOST_TEST( *next( itr_ck.begin() ) == std::string( "foo" ) );
|
||||
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( "foo" ) );
|
||||
BOOST_TEST( *prior( itr_ck.end() ) == std::string( "/" ) );
|
||||
BOOST_TEST( *prior(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( "/" ) );
|
||||
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::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" );
|
||||
}
|
||||
// std::cout << errors << " errors detected\n";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user