|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r52402 - in branches/release: boost/filesystem libs/filesystem/src libs/filesystem/test libs/filesystem/test/msvc/filesystem_dll libs/filesystem/test/msvc/wide_test
From: bdawes_at_[hidden]
Date: 2009-04-15 08:17:27
Author: bemandawes
Date: 2009-04-15 08:17:22 EDT (Wed, 15 Apr 2009)
New Revision: 52402
URL: http://svn.boost.org/trac/boost/changeset/52402
Log:
Filesystem: merge from trunk
Text files modified:
branches/release/boost/filesystem/path.hpp | 39
branches/release/libs/filesystem/src/operations.cpp | 1
branches/release/libs/filesystem/src/path.cpp | 4
branches/release/libs/filesystem/test/convenience_test.cpp | 86 +-
branches/release/libs/filesystem/test/deprecated_test.cpp | 50
branches/release/libs/filesystem/test/fstream_test.cpp | 38
branches/release/libs/filesystem/test/msvc/filesystem_dll/filesystem_dll.vcproj | 1
branches/release/libs/filesystem/test/msvc/wide_test/wide_test.vcproj | 1
branches/release/libs/filesystem/test/operations_test.cpp | 588 +++++++++---------
branches/release/libs/filesystem/test/path_test.cpp | 1190 ++++++++++++++++++++-------------------
branches/release/libs/filesystem/test/wide_test.cpp | 48
11 files changed, 1034 insertions(+), 1012 deletions(-)
Modified: branches/release/boost/filesystem/path.hpp
==============================================================================
--- branches/release/boost/filesystem/path.hpp (original)
+++ branches/release/boost/filesystem/path.hpp 2009-04-15 08:17:22 EDT (Wed, 15 Apr 2009)
@@ -390,64 +390,69 @@
lhs.begin(), lhs.end(), tmp.begin(), tmp.end() );
}
+ // operator == uses string compare rather than !(lhs < rhs) && !(rhs < lhs) because
+ // the result is the same yet the direct string compare is much more efficient that
+ // lexicographical_compare, and lexicographical_compare used twice at that.
+
template< class String, class Traits >
inline bool operator==( const basic_path<String, Traits> & lhs, const basic_path<String, Traits> & rhs )
{
- return !(lhs < rhs) && !(rhs < lhs);
+ return lhs.string() == rhs.string();
}
template< class String, class Traits >
inline bool operator==( const typename basic_path<String, Traits>::string_type::value_type * lhs,
const basic_path<String, Traits> & rhs )
{
- basic_path<String, Traits> tmp( lhs );
- return !(tmp < rhs) && !(rhs < tmp);
+ return lhs == rhs.string();
}
template< class String, class Traits >
inline bool operator==( const typename basic_path<String, Traits>::string_type & lhs,
const basic_path<String, Traits> & rhs )
{
- basic_path<String, Traits> tmp( lhs );
- return !(tmp < rhs) && !(rhs < tmp);
+ return lhs == rhs.string();
}
template< class String, class Traits >
inline bool operator==( const basic_path<String, Traits> & lhs,
const typename basic_path<String, Traits>::string_type::value_type * rhs )
{
- basic_path<String, Traits> tmp( rhs );
- return !(lhs < tmp) && !(tmp < lhs);
+ return lhs.string() == rhs;
}
template< class String, class Traits >
inline bool operator==( const basic_path<String, Traits> & lhs,
const typename basic_path<String, Traits>::string_type & rhs )
{
- basic_path<String, Traits> tmp( rhs );
- return !(lhs < tmp) && !(tmp < lhs);
+ return lhs.string() == rhs;
}
template< class String, class Traits >
- inline bool operator!=( const basic_path<String, Traits> & lhs, const basic_path<String, Traits> & rhs ) { return !(lhs == rhs); }
+ inline bool operator!=( const basic_path<String, Traits> & lhs,
+ const basic_path<String, Traits> & rhs )
+ { return !(lhs == rhs); }
template< class String, class Traits >
- inline bool operator!=( const typename basic_path<String, Traits>::string_type::value_type * lhs,
- const basic_path<String, Traits> & rhs ) { return !(basic_path<String, Traits>(lhs) == rhs); }
+ inline bool operator!=( const typename basic_path<String,
+ Traits>::string_type::value_type * lhs,
+ const basic_path<String, Traits> & rhs )
+ { return !(lhs == rhs); }
template< class String, class Traits >
inline bool operator!=( const typename basic_path<String, Traits>::string_type & lhs,
- const basic_path<String, Traits> & rhs ) { return !(basic_path<String, Traits>(lhs) == rhs); }
+ const basic_path<String, Traits> & rhs )
+ { return !(lhs == rhs); }
template< class String, class Traits >
inline bool operator!=( const basic_path<String, Traits> & lhs,
- const typename basic_path<String, Traits>::string_type::value_type * rhs )
- { return !(lhs == basic_path<String, Traits>(rhs)); }
+ const typename basic_path<String, Traits>::string_type::value_type * rhs )
+ { return !(lhs == rhs); }
template< class String, class Traits >
inline bool operator!=( const basic_path<String, Traits> & lhs,
- const typename basic_path<String, Traits>::string_type & rhs )
- { return !(lhs == basic_path<String, Traits>(rhs)); }
+ const typename basic_path<String, Traits>::string_type & rhs )
+ { return !(lhs == rhs); }
template< class String, class Traits >
inline bool operator>( const basic_path<String, Traits> & lhs, const basic_path<String, Traits> & rhs ) { return rhs < lhs; }
Modified: branches/release/libs/filesystem/src/operations.cpp
==============================================================================
--- branches/release/libs/filesystem/src/operations.cpp (original)
+++ branches/release/libs/filesystem/src/operations.cpp 2009-04-15 08:17:22 EDT (Wed, 15 Apr 2009)
@@ -198,6 +198,7 @@
if ((ec.value() == ERROR_FILE_NOT_FOUND)
|| (ec.value() == ERROR_PATH_NOT_FOUND)
|| (ec.value() == ERROR_INVALID_NAME) // "tools/jam/src/:sys:stat.h", "//foo"
+ || (ec.value() == ERROR_INVALID_DRIVE) // USB card reader with no card inserted
|| (ec.value() == ERROR_INVALID_PARAMETER) // ":sys:stat.h"
|| (ec.value() == ERROR_BAD_PATHNAME) // "//nosuch" on Win64
|| (ec.value() == ERROR_BAD_NETPATH)) // "//nosuch" on Win32
Modified: branches/release/libs/filesystem/src/path.cpp
==============================================================================
--- branches/release/libs/filesystem/src/path.cpp (original)
+++ branches/release/libs/filesystem/src/path.cpp 2009-04-15 08:17:22 EDT (Wed, 15 Apr 2009)
@@ -34,8 +34,12 @@
// occurred before main(), preventing exceptions from being caught.)
std::locale & loc()
{
+#if !defined(macintosh) && !defined(__APPLE__) && !defined(__APPLE_CC__)
// ISO C calls this "the locale-specific native environment":
static std::locale lc("");
+#else
+ static std::locale lc = std::locale(); // Mac OS doesn't support locale("")
+#endif
return lc;
}
Modified: branches/release/libs/filesystem/test/convenience_test.cpp
==============================================================================
--- branches/release/libs/filesystem/test/convenience_test.cpp (original)
+++ branches/release/libs/filesystem/test/convenience_test.cpp 2009-04-15 08:17:22 EDT (Wed, 15 Apr 2009)
@@ -18,7 +18,7 @@
using fs::path;
namespace sys = boost::system;
-#include <boost/test/minimal.hpp>
+#include <boost/detail/lightweight_test.hpp>
#include <boost/bind.hpp>
#include <fstream>
#include <iostream>
@@ -53,45 +53,45 @@
// --------------------------------------------------------------------------//
-int test_main( int, char*[] )
+int main( int, char*[] )
{
// create_directories() tests ----------------------------------------------//
- BOOST_CHECK( !fs::create_directories( "" ) ); // should be harmless
- BOOST_CHECK( !fs::create_directories( "/" ) ); // ditto
+ BOOST_TEST( !fs::create_directories( "" ) ); // should be harmless
+ BOOST_TEST( !fs::create_directories( "/" ) ); // ditto
fs::remove_all( "xx" ); // make sure slate is blank
- BOOST_CHECK( !fs::exists( "xx" ) ); // reality check
+ BOOST_TEST( !fs::exists( "xx" ) ); // reality check
- BOOST_CHECK( fs::create_directories( "xx" ) );
- BOOST_CHECK( fs::exists( "xx" ) );
- BOOST_CHECK( fs::is_directory( "xx" ) );
-
- BOOST_CHECK( fs::create_directories( "xx/yy/zz" ) );
- BOOST_CHECK( fs::exists( "xx" ) );
- BOOST_CHECK( fs::exists( "xx/yy" ) );
- BOOST_CHECK( fs::exists( "xx/yy/zz" ) );
- BOOST_CHECK( fs::is_directory( "xx" ) );
- BOOST_CHECK( fs::is_directory( "xx/yy" ) );
- BOOST_CHECK( fs::is_directory( "xx/yy/zz" ) );
+ BOOST_TEST( fs::create_directories( "xx" ) );
+ BOOST_TEST( fs::exists( "xx" ) );
+ BOOST_TEST( fs::is_directory( "xx" ) );
+
+ BOOST_TEST( fs::create_directories( "xx/yy/zz" ) );
+ BOOST_TEST( fs::exists( "xx" ) );
+ BOOST_TEST( fs::exists( "xx/yy" ) );
+ BOOST_TEST( fs::exists( "xx/yy/zz" ) );
+ BOOST_TEST( fs::is_directory( "xx" ) );
+ BOOST_TEST( fs::is_directory( "xx/yy" ) );
+ BOOST_TEST( fs::is_directory( "xx/yy/zz" ) );
path is_a_file( "xx/uu" );
{
std::ofstream f( is_a_file.external_file_string().c_str() );
- BOOST_CHECK( !!f );
+ BOOST_TEST( !!f );
}
- BOOST_CHECK( throws_fs_error(
+ BOOST_TEST( throws_fs_error(
boost::bind( BOOST_BND(fs::create_directories), is_a_file ) ) );
- BOOST_CHECK( throws_fs_error(
+ BOOST_TEST( throws_fs_error(
boost::bind( BOOST_BND(fs::create_directories), is_a_file / "aa" ) ) );
// recursive_directory_iterator tests ----------------------------------------//
sys::error_code ec;
fs::recursive_directory_iterator it( "/no-such-path", ec );
- BOOST_CHECK( ec );
- BOOST_CHECK( throws_fs_error(
+ BOOST_TEST( ec );
+ BOOST_TEST( throws_fs_error(
boost::bind( create_recursive_iterator, "/no-such-path" ) ) );
fs::remove( "xx/uu" );
@@ -101,7 +101,7 @@
// on Windows but not necessarily on other operating systems
{
std::ofstream f( "xx/yya" );
- BOOST_CHECK( !!f );
+ BOOST_TEST( !!f );
}
for ( it = fs::recursive_directory_iterator( "xx" );
@@ -109,51 +109,51 @@
{ std::cout << it->path() << '\n'; }
it = fs::recursive_directory_iterator( "xx" );
- BOOST_CHECK( it->path() == "xx/yy" );
- BOOST_CHECK( it.level() == 0 );
+ BOOST_TEST( it->path() == "xx/yy" );
+ BOOST_TEST( it.level() == 0 );
++it;
- BOOST_CHECK( it->path() == "xx/yy/zz" );
- BOOST_CHECK( it.level() == 1 );
+ BOOST_TEST( it->path() == "xx/yy/zz" );
+ BOOST_TEST( it.level() == 1 );
it.pop();
- BOOST_CHECK( it->path() == "xx/yya" );
- BOOST_CHECK( it.level() == 0 );
+ BOOST_TEST( it->path() == "xx/yya" );
+ BOOST_TEST( it.level() == 0 );
it++;
- BOOST_CHECK( it == fs::recursive_directory_iterator() );
+ BOOST_TEST( it == fs::recursive_directory_iterator() );
it = fs::recursive_directory_iterator( "xx" );
- BOOST_CHECK( it->path() == "xx/yy" );
+ BOOST_TEST( it->path() == "xx/yy" );
it.no_push();
++it;
- BOOST_CHECK( it->path() == "xx/yya" );
+ BOOST_TEST( it->path() == "xx/yya" );
++it;
- BOOST_CHECK( it == fs::recursive_directory_iterator() );
+ BOOST_TEST( it == fs::recursive_directory_iterator() );
fs::remove( "xx/yya" );
#endif
it = fs::recursive_directory_iterator( "xx/yy/zz" );
- BOOST_CHECK( it == fs::recursive_directory_iterator() );
+ BOOST_TEST( it == fs::recursive_directory_iterator() );
it = fs::recursive_directory_iterator( "xx" );
- BOOST_CHECK( it->path() == "xx/yy" );
- BOOST_CHECK( it.level() == 0 );
+ BOOST_TEST( it->path() == "xx/yy" );
+ BOOST_TEST( it.level() == 0 );
++it;
- BOOST_CHECK( it->path() == "xx/yy/zz" );
- BOOST_CHECK( it.level() == 1 );
+ BOOST_TEST( it->path() == "xx/yy/zz" );
+ BOOST_TEST( it.level() == 1 );
it++;
- BOOST_CHECK( it == fs::recursive_directory_iterator() );
+ BOOST_TEST( it == fs::recursive_directory_iterator() );
it = fs::recursive_directory_iterator( "xx" );
- BOOST_CHECK( it->path() == "xx/yy" );
+ BOOST_TEST( it->path() == "xx/yy" );
it.no_push();
++it;
- BOOST_CHECK( it == fs::recursive_directory_iterator() );
+ BOOST_TEST( it == fs::recursive_directory_iterator() );
it = fs::recursive_directory_iterator( "xx" );
- BOOST_CHECK( it->path() == "xx/yy" );
+ BOOST_TEST( it->path() == "xx/yy" );
++it;
it.pop();
- BOOST_CHECK( it == fs::recursive_directory_iterator() );
+ BOOST_TEST( it == fs::recursive_directory_iterator() );
@@ -163,5 +163,5 @@
- return 0;
+ return ::boost::report_errors();
}
Modified: branches/release/libs/filesystem/test/deprecated_test.cpp
==============================================================================
--- branches/release/libs/filesystem/test/deprecated_test.cpp (original)
+++ branches/release/libs/filesystem/test/deprecated_test.cpp 2009-04-15 08:17:22 EDT (Wed, 15 Apr 2009)
@@ -13,7 +13,7 @@
// important to preserve existing code that uses the old names.
#include <boost/filesystem.hpp>
-#include <boost/test/minimal.hpp>
+#include <boost/detail/lightweight_test.hpp>
namespace fs = boost::filesystem;
using boost::filesystem::path;
@@ -24,14 +24,12 @@
{
std::string platform( BOOST_PLATFORM );
- int errors;
-
void check( const fs::path & source,
const std::string & expected, int line )
{
if ( source.string()== expected ) return;
- ++errors;
+ ++::boost::detail::test_errors();
std::cout << '(' << line << ") source.string(): \"" << source.string()
<< "\" != expected: \"" << expected
@@ -147,7 +145,7 @@
//----------------------------------------------------------------------------//
-int test_main( int /*argc*/, char * /*argv*/[] )
+int main( int /*argc*/, char * /*argv*/[] )
{
// The choice of platform is make at runtime rather than compile-time
// so that compile errors for all platforms will be detected even though
@@ -167,38 +165,38 @@
de.string();
fs::path ng( " no-way, Jose" );
- BOOST_CHECK( !fs::is_regular( ng ) ); // verify deprecated name still works
- BOOST_CHECK( !fs::symbolic_link_exists( "nosuchfileordirectory" ) );
+ BOOST_TEST( !fs::is_regular( ng ) ); // verify deprecated name still works
+ BOOST_TEST( !fs::symbolic_link_exists( "nosuchfileordirectory" ) );
check_normalize();
// extension() tests ---------------------------------------------------------//
- BOOST_CHECK( fs::extension("a/b") == "" );
- BOOST_CHECK( fs::extension("a/b.txt") == ".txt" );
- BOOST_CHECK( fs::extension("a/b.") == "." );
- BOOST_CHECK( fs::extension("a.b.c") == ".c" );
- BOOST_CHECK( fs::extension("a.b.c.") == "." );
- BOOST_CHECK( fs::extension("") == "" );
- BOOST_CHECK( fs::extension("a/") == "." );
+ BOOST_TEST( fs::extension("a/b") == "" );
+ BOOST_TEST( fs::extension("a/b.txt") == ".txt" );
+ BOOST_TEST( fs::extension("a/b.") == "." );
+ BOOST_TEST( fs::extension("a.b.c") == ".c" );
+ BOOST_TEST( fs::extension("a.b.c.") == "." );
+ BOOST_TEST( fs::extension("") == "" );
+ BOOST_TEST( fs::extension("a/") == "." );
// basename() tests ----------------------------------------------------------//
- BOOST_CHECK( fs::basename("b") == "b" );
- BOOST_CHECK( fs::basename("a/b.txt") == "b" );
- BOOST_CHECK( fs::basename("a/b.") == "b" );
- BOOST_CHECK( fs::basename("a.b.c") == "a.b" );
- BOOST_CHECK( fs::basename("a.b.c.") == "a.b.c" );
- BOOST_CHECK( fs::basename("") == "" );
+ BOOST_TEST( fs::basename("b") == "b" );
+ BOOST_TEST( fs::basename("a/b.txt") == "b" );
+ BOOST_TEST( fs::basename("a/b.") == "b" );
+ BOOST_TEST( fs::basename("a.b.c") == "a.b" );
+ BOOST_TEST( fs::basename("a.b.c.") == "a.b.c" );
+ BOOST_TEST( fs::basename("") == "" );
// change_extension tests ---------------------------------------------------//
- BOOST_CHECK( fs::change_extension("a.txt", ".tex").string() == "a.tex" );
- BOOST_CHECK( fs::change_extension("a.", ".tex").string() == "a.tex" );
- BOOST_CHECK( fs::change_extension("a", ".txt").string() == "a.txt" );
- BOOST_CHECK( fs::change_extension("a.b.txt", ".tex").string() == "a.b.tex" );
+ BOOST_TEST( fs::change_extension("a.txt", ".tex").string() == "a.tex" );
+ BOOST_TEST( fs::change_extension("a.", ".tex").string() == "a.tex" );
+ BOOST_TEST( fs::change_extension("a", ".txt").string() == "a.txt" );
+ BOOST_TEST( fs::change_extension("a.b.txt", ".tex").string() == "a.b.tex" );
// see the rationale in html docs for explanation why this works
- BOOST_CHECK( fs::change_extension("", ".png").string() == ".png" );
+ BOOST_TEST( fs::change_extension("", ".png").string() == ".png" );
- return errors;
+ return ::boost::report_errors();
}
Modified: branches/release/libs/filesystem/test/fstream_test.cpp
==============================================================================
--- branches/release/libs/filesystem/test/fstream_test.cpp (original)
+++ branches/release/libs/filesystem/test/fstream_test.cpp 2009-04-15 08:17:22 EDT (Wed, 15 Apr 2009)
@@ -31,7 +31,7 @@
namespace std { using ::remove; }
#endif
-#include <boost/test/minimal.hpp>
+#include <boost/detail/lightweight_test.hpp>
namespace
{
@@ -45,19 +45,19 @@
std::cout << " in test 1\n";
fs::filebuf fb;
fb.open( p, std::ios_base::in );
- BOOST_CHECK( fb.is_open() == fs::exists( p ) );
+ BOOST_TEST( fb.is_open() == fs::exists( p ) );
}
{
std::cout << " in test 2\n";
fs::filebuf fb1;
fb1.open( p, std::ios_base::out );
- BOOST_CHECK( fb1.is_open() );
+ BOOST_TEST( fb1.is_open() );
}
{
std::cout << " in test 3\n";
fs::filebuf fb2;
fb2.open( p, std::ios_base::in );
- BOOST_CHECK( fb2.is_open() );
+ BOOST_TEST( fb2.is_open() );
}
# else
std::cout << "<note>\n";
@@ -67,78 +67,78 @@
{
std::cout << " in test 4\n";
fs::ifstream tfs( p );
- BOOST_CHECK( tfs.is_open() );
+ BOOST_TEST( tfs.is_open() );
}
{
std::cout << " in test 4.1\n";
fs::ifstream tfs( p / p.filename() ); // should fail
- BOOST_CHECK( !tfs.is_open() );
+ BOOST_TEST( !tfs.is_open() );
}
{
std::cout << " in test 5\n";
fs::ifstream tfs( p, std::ios_base::in );
- BOOST_CHECK( tfs.is_open() );
+ BOOST_TEST( tfs.is_open() );
}
# if !BOOST_WORKAROUND( BOOST_MSVC, <= 1200 ) // VC++ 6.0 can't handle open
{
std::cout << " in test 6\n";
fs::ifstream tfs;
tfs.open( p );
- BOOST_CHECK( tfs.is_open() );
+ BOOST_TEST( tfs.is_open() );
}
{
std::cout << " in test 7\n";
fs::ifstream tfs;
tfs.open( p, std::ios_base::in );
- BOOST_CHECK( tfs.is_open() );
+ BOOST_TEST( tfs.is_open() );
}
# endif
{
std::cout << " in test 8\n";
fs::ofstream tfs( p );
- BOOST_CHECK( tfs.is_open() );
+ BOOST_TEST( tfs.is_open() );
}
{
std::cout << " in test 9\n";
fs::ofstream tfs( p, std::ios_base::out );
- BOOST_CHECK( tfs.is_open() );
+ BOOST_TEST( tfs.is_open() );
}
# if !BOOST_WORKAROUND( BOOST_MSVC, <= 1200 ) // VC++ 6.0 can't handle open
{
std::cout << " in test 10\n";
fs::ofstream tfs;
tfs.open( p );
- BOOST_CHECK( tfs.is_open() );
+ BOOST_TEST( tfs.is_open() );
}
{
std::cout << " in test 11\n";
fs::ofstream tfs;
tfs.open( p, std::ios_base::out );
- BOOST_CHECK( tfs.is_open() );
+ BOOST_TEST( tfs.is_open() );
}
# endif
{
std::cout << " in test 12\n";
fs::fstream tfs( p );
- BOOST_CHECK( tfs.is_open() );
+ BOOST_TEST( tfs.is_open() );
}
{
std::cout << " in test 13\n";
fs::fstream tfs( p, std::ios_base::in|std::ios_base::out );
- BOOST_CHECK( tfs.is_open() );
+ BOOST_TEST( tfs.is_open() );
}
# if !BOOST_WORKAROUND( BOOST_MSVC, <= 1200 ) // VC++ 6.0 can't handle open
{
std::cout << " in test 14\n";
fs::fstream tfs;
tfs.open( p );
- BOOST_CHECK( tfs.is_open() );
+ BOOST_TEST( tfs.is_open() );
}
{
std::cout << " in test 15\n";
fs::fstream tfs;
tfs.open( p, std::ios_base::in|std::ios_base::out );
- BOOST_CHECK( tfs.is_open() );
+ BOOST_TEST( tfs.is_open() );
}
# endif
@@ -147,7 +147,7 @@
} // test
} // unnamed namespace
-int test_main( int argc, char*[] )
+int main( int argc, char*[] )
{
if ( argc > 1 ) cleanup = false;
@@ -176,5 +176,5 @@
#endif
- return 0;
+ return ::boost::report_errors();
}
Modified: branches/release/libs/filesystem/test/msvc/filesystem_dll/filesystem_dll.vcproj
==============================================================================
--- branches/release/libs/filesystem/test/msvc/filesystem_dll/filesystem_dll.vcproj (original)
+++ branches/release/libs/filesystem/test/msvc/filesystem_dll/filesystem_dll.vcproj 2009-04-15 08:17:22 EDT (Wed, 15 Apr 2009)
@@ -46,6 +46,7 @@
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
+ DefaultCharIsUnsigned="false"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="4"
Modified: branches/release/libs/filesystem/test/msvc/wide_test/wide_test.vcproj
==============================================================================
--- branches/release/libs/filesystem/test/msvc/wide_test/wide_test.vcproj (original)
+++ branches/release/libs/filesystem/test/msvc/wide_test/wide_test.vcproj 2009-04-15 08:17:22 EDT (Wed, 15 Apr 2009)
@@ -46,6 +46,7 @@
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
+ DefaultCharIsUnsigned="false"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="4"
Modified: branches/release/libs/filesystem/test/operations_test.cpp
==============================================================================
--- branches/release/libs/filesystem/test/operations_test.cpp (original)
+++ branches/release/libs/filesystem/test/operations_test.cpp 2009-04-15 08:17:22 EDT (Wed, 15 Apr 2009)
@@ -18,8 +18,7 @@
namespace fs = boost::filesystem;
#include <boost/config.hpp>
-#include <boost/test/minimal.hpp>
-//#include <boost/concept_check.hpp>
+#include <boost/detail/lightweight_test.hpp>
using boost::system::error_code;
using boost::system::system_category;
@@ -149,11 +148,11 @@
if ( platform == "Windows" && language_id == 0x0409 ) // English (United States)
// the stdcxx standard library apparently appends additional info
// to what(), so check only the initial portion:
- BOOST_CHECK( std::strncmp( x.what(),
+ BOOST_TEST( std::strncmp( x.what(),
"boost::filesystem::create_directory",
sizeof("boost::filesystem::create_directory")-1 ) == 0 );
}
- BOOST_CHECK( exception_thrown );
+ BOOST_TEST( exception_thrown );
exception_thrown = false;
try
@@ -165,10 +164,10 @@
exception_thrown = true;
if ( report_throws ) std::cout << x.what() << std::endl;
if ( platform == "Windows" && language_id == 0x0409 ) // English (United States)
- BOOST_CHECK( std::strcmp( x.what(),
+ BOOST_TEST( std::strcmp( x.what(),
"boost::filesystem::create_directory: The system cannot find the path specified" ) == 0 );
}
- BOOST_CHECK( exception_thrown );
+ BOOST_TEST( exception_thrown );
exception_thrown = false;
try
@@ -183,14 +182,14 @@
{
bool ok ( std::strcmp( x.what(),
"boost::filesystem::create_directory: The system cannot find the path specified: \"no-such-dir\\foo\\bar\"" ) == 0 );
- BOOST_CHECK( ok );
+ BOOST_TEST( ok );
if ( !ok )
{
std::cout << "what returns \"" << x.what() << "\"" << std::endl;
}
}
}
- BOOST_CHECK( exception_thrown );
+ BOOST_TEST( exception_thrown );
exception_thrown = false;
try
@@ -205,14 +204,14 @@
{
bool ok ( std::strcmp( x.what(),
"boost::filesystem::create_directory: The system cannot find the path specified: \"no-such-dir\\foo\\bar\"" ) == 0 );
- BOOST_CHECK( ok );
+ BOOST_TEST( ok );
if ( !ok )
{
std::cout << "what returns \"" << x.what() << "\"" << std::endl;
}
}
}
- BOOST_CHECK( exception_thrown );
+ BOOST_TEST( exception_thrown );
}
void bad_file_size()
@@ -258,9 +257,9 @@
} // unnamed namespace
-// test_main ---------------------------------------------------------------//
+// main ------------------------------------------------------------------------------//
-int test_main( int argc, char * argv[] )
+int main( int argc, char * argv[] )
{
if ( argc > 1 && *argv[1]=='-' && *(argv[1]+1)=='t' ) report_throws = true;
@@ -291,45 +290,45 @@
std::cout << "\ninitial_path<fs::path>().file_string() is\n \""
<< fs::initial_path<fs::path>().file_string()
<< "\"\n\n";
- BOOST_CHECK( fs::initial_path<fs::path>().is_complete() );
- BOOST_CHECK( fs::current_path<fs::path>().is_complete() );
- BOOST_CHECK( fs::initial_path<fs::path>().string()
+ BOOST_TEST( fs::initial_path<fs::path>().is_complete() );
+ BOOST_TEST( fs::current_path<fs::path>().is_complete() );
+ BOOST_TEST( fs::initial_path<fs::path>().string()
== fs::current_path<fs::path>().string() );
- BOOST_CHECK( fs::complete( "" ).empty() );
- BOOST_CHECK( fs::complete( "/" ).string() == fs::initial_path<fs::path>().root_path().string() );
- BOOST_CHECK( fs::complete( "foo" ).string() == fs::initial_path<fs::path>().string()+"/foo" );
- BOOST_CHECK( fs::complete( "/foo" ).string() == fs::initial_path<fs::path>().root_path().string()+"foo" );
- BOOST_CHECK( fs::complete( "foo", fs::path( "//net/bar" ) ).string()
+ BOOST_TEST( fs::complete( "" ).empty() );
+ BOOST_TEST( fs::complete( "/" ).string() == fs::initial_path<fs::path>().root_path().string() );
+ BOOST_TEST( fs::complete( "foo" ).string() == fs::initial_path<fs::path>().string()+"/foo" );
+ BOOST_TEST( fs::complete( "/foo" ).string() == fs::initial_path<fs::path>().root_path().string()+"foo" );
+ BOOST_TEST( fs::complete( "foo", fs::path( "//net/bar" ) ).string()
== "//net/bar/foo" );
// predicate and status tests
- BOOST_CHECK( fs::exists( "/" ) );
+ BOOST_TEST( fs::exists( "/" ) );
fs::path ng( " no-way, Jose" );
- BOOST_CHECK( !fs::exists( ng ) );
- BOOST_CHECK( !fs::is_directory( ng ) );
- BOOST_CHECK( !fs::is_regular_file( ng ) );
- BOOST_CHECK( !fs::is_symlink( ng ) );
+ BOOST_TEST( !fs::exists( ng ) );
+ BOOST_TEST( !fs::is_directory( ng ) );
+ BOOST_TEST( !fs::is_regular_file( ng ) );
+ BOOST_TEST( !fs::is_symlink( ng ) );
fs::file_status stat( fs::status( ng ) );
- BOOST_CHECK( fs::status_known( stat ) );
- BOOST_CHECK( !fs::exists( stat ) );
- BOOST_CHECK( !fs::is_directory( stat ) );
- BOOST_CHECK( !fs::is_regular_file( stat ) );
- BOOST_CHECK( !fs::is_other( stat ) );
- BOOST_CHECK( !fs::is_symlink( stat ) );
+ BOOST_TEST( fs::status_known( stat ) );
+ BOOST_TEST( !fs::exists( stat ) );
+ BOOST_TEST( !fs::is_directory( stat ) );
+ BOOST_TEST( !fs::is_regular_file( stat ) );
+ BOOST_TEST( !fs::is_other( stat ) );
+ BOOST_TEST( !fs::is_symlink( stat ) );
stat = fs::status( "" );
- BOOST_CHECK( fs::status_known( stat ) );
- BOOST_CHECK( !fs::exists( stat ) );
- BOOST_CHECK( !fs::is_directory( stat ) );
- BOOST_CHECK( !fs::is_regular_file( stat ) );
- BOOST_CHECK( !fs::is_other( stat ) );
- BOOST_CHECK( !fs::is_symlink( stat ) );
+ BOOST_TEST( fs::status_known( stat ) );
+ BOOST_TEST( !fs::exists( stat ) );
+ BOOST_TEST( !fs::is_directory( stat ) );
+ BOOST_TEST( !fs::is_regular_file( stat ) );
+ BOOST_TEST( !fs::is_other( stat ) );
+ BOOST_TEST( !fs::is_symlink( stat ) );
fs::path dir( fs::initial_path<fs::path>() / temp_dir_name );
if ( fs::exists( dir ) )
fs::remove_all( dir ); // remove residue from prior failed tests
- BOOST_CHECK( !fs::exists( dir ) );
+ BOOST_TEST( !fs::exists( dir ) );
// create a directory, then check it for consistency
// take extra care to report problems, since if this fails
@@ -357,101 +356,102 @@
return 1;
}
- BOOST_CHECK( fs::exists( dir ) );
- BOOST_CHECK( BOOST_FS_IS_EMPTY( dir ) );
- BOOST_CHECK( fs::is_directory( dir ) );
- BOOST_CHECK( !fs::is_regular_file( dir ) );
- BOOST_CHECK( !fs::is_other( dir ) );
- BOOST_CHECK( !fs::is_symlink( dir ) );
+ BOOST_TEST( fs::exists( dir ) );
+ BOOST_TEST( BOOST_FS_IS_EMPTY( dir ) );
+ BOOST_TEST( fs::is_directory( dir ) );
+ BOOST_TEST( !fs::is_regular_file( dir ) );
+ BOOST_TEST( !fs::is_other( dir ) );
+ BOOST_TEST( !fs::is_symlink( dir ) );
stat = fs::status( dir );
- BOOST_CHECK( fs::exists( stat ) );
- BOOST_CHECK( fs::is_directory( stat ) );
- BOOST_CHECK( !fs::is_regular_file( stat ) );
- BOOST_CHECK( !fs::is_other( stat ) );
- BOOST_CHECK( !fs::is_symlink( stat ) );
+ BOOST_TEST( fs::exists( stat ) );
+ BOOST_TEST( fs::is_directory( stat ) );
+ BOOST_TEST( !fs::is_regular_file( stat ) );
+ BOOST_TEST( !fs::is_other( stat ) );
+ BOOST_TEST( !fs::is_symlink( stat ) );
// Windows only tests
if ( platform == "Windows" )
{
- BOOST_CHECK( !fs::exists( fs::path( "//share-not" ) ) );
- BOOST_CHECK( !fs::exists( fs::path( "//share-not/" ) ) );
- BOOST_CHECK( !fs::exists( fs::path( "//share-not/foo" ) ) );
- BOOST_CHECK( !fs::exists( "tools/jam/src/:sys:stat.h" ) ); // !exists() if ERROR_INVALID_NAME
- BOOST_CHECK( !fs::exists( ":sys:stat.h" ) ); // !exists() if ERROR_INVALID_PARAMETER
- BOOST_CHECK( dir.string().size() > 1
+ BOOST_TEST( !fs::exists( fs::path( "//share-not" ) ) );
+ BOOST_TEST( !fs::exists( fs::path( "//share-not/" ) ) );
+ BOOST_TEST( !fs::exists( fs::path( "//share-not/foo" ) ) );
+ BOOST_TEST( !fs::exists( "tools/jam/src/:sys:stat.h" ) ); // !exists() if ERROR_INVALID_NAME
+ BOOST_TEST( !fs::exists( ":sys:stat.h" ) ); // !exists() if ERROR_INVALID_PARAMETER
+ BOOST_TEST( !fs::exists( "1:/" ) );
+ BOOST_TEST( dir.string().size() > 1
&& dir.string()[1] == ':' ); // verify path includes drive
- BOOST_CHECK( fs::system_complete( "" ).empty() );
- BOOST_CHECK( fs::system_complete( "/" ).string()
+ BOOST_TEST( fs::system_complete( "" ).empty() );
+ BOOST_TEST( fs::system_complete( "/" ).string()
== fs::initial_path<fs::path>().root_path().string() );
- BOOST_CHECK( fs::system_complete( "foo" ).string()
+ BOOST_TEST( fs::system_complete( "foo" ).string()
== fs::initial_path<fs::path>().string()+"/foo" );
- BOOST_CHECK( fs::system_complete( "/foo" ).string()
+ BOOST_TEST( fs::system_complete( "/foo" ).string()
== fs::initial_path<fs::path>().root_path().string()+"foo" );
- BOOST_CHECK( fs::complete( fs::path( "c:/" ) ).string()
+ BOOST_TEST( fs::complete( fs::path( "c:/" ) ).string()
== "c:/" );
- BOOST_CHECK( fs::complete( fs::path( "c:/foo" ) ).string()
+ BOOST_TEST( fs::complete( fs::path( "c:/foo" ) ).string()
== "c:/foo" );
- BOOST_CHECK( fs::system_complete( fs::path( fs::initial_path<fs::path>().root_name() ) ).string() == fs::initial_path<fs::path>().string() );
- BOOST_CHECK( fs::system_complete( fs::path( fs::initial_path<fs::path>().root_name()
+ BOOST_TEST( fs::system_complete( fs::path( fs::initial_path<fs::path>().root_name() ) ).string() == fs::initial_path<fs::path>().string() );
+ BOOST_TEST( fs::system_complete( fs::path( fs::initial_path<fs::path>().root_name()
+ "foo" ) ).string() == fs::initial_path<fs::path>().string()+"/foo" );
- BOOST_CHECK( fs::system_complete( fs::path( "c:/" ) ).string()
+ BOOST_TEST( fs::system_complete( fs::path( "c:/" ) ).string()
== "c:/" );
- BOOST_CHECK( fs::system_complete( fs::path( "c:/foo" ) ).string()
+ BOOST_TEST( fs::system_complete( fs::path( "c:/foo" ) ).string()
== "c:/foo" );
- BOOST_CHECK( fs::system_complete( fs::path( "//share" ) ).string()
+ BOOST_TEST( fs::system_complete( fs::path( "//share" ) ).string()
== "//share" );
} // Windows
else if ( platform == "POSIX" )
{
- BOOST_CHECK( fs::system_complete( "" ).empty() );
- BOOST_CHECK( fs::initial_path<fs::path>().root_path().string() == "/" );
- BOOST_CHECK( fs::system_complete( "/" ).string() == "/" );
- BOOST_CHECK( fs::system_complete( "foo" ).string()
+ BOOST_TEST( fs::system_complete( "" ).empty() );
+ BOOST_TEST( fs::initial_path<fs::path>().root_path().string() == "/" );
+ BOOST_TEST( fs::system_complete( "/" ).string() == "/" );
+ BOOST_TEST( fs::system_complete( "foo" ).string()
== fs::initial_path<fs::path>().string()+"/foo" );
- BOOST_CHECK( fs::system_complete( "/foo" ).string()
+ BOOST_TEST( fs::system_complete( "/foo" ).string()
== fs::initial_path<fs::path>().root_path().string()+"foo" );
} // POSIX
// the bound functions should throw, so CHECK_EXCEPTION() should return true
- BOOST_CHECK( CHECK_EXCEPTION( bad_file_size, ENOENT ) );
+ BOOST_TEST( CHECK_EXCEPTION( bad_file_size, ENOENT ) );
// test path::exception members
try { fs::file_size( ng ); } // will throw
catch ( const fs::filesystem_error & ex )
{
- BOOST_CHECK( ex.path1().string() == " no-way, Jose" );
+ BOOST_TEST( ex.path1().string() == " no-way, Jose" );
}
// several functions give unreasonable results if uintmax_t isn't 64-bits
std::cout << "sizeof(boost::uintmax_t) = " << sizeof(boost::uintmax_t) << '\n';
- BOOST_CHECK( sizeof( boost::uintmax_t ) >= 8 );
+ BOOST_TEST( sizeof( boost::uintmax_t ) >= 8 );
// set the current directory, then check it for consistency
fs::path original_dir = fs::current_path<fs::path>();
- BOOST_CHECK( dir != original_dir );
+ BOOST_TEST( dir != original_dir );
fs::current_path( dir );
- BOOST_CHECK( fs::current_path<fs::path>() == dir );
- BOOST_CHECK( fs::current_path<fs::path>() != original_dir );
+ BOOST_TEST( fs::current_path<fs::path>() == dir );
+ BOOST_TEST( fs::current_path<fs::path>() != original_dir );
fs::current_path( original_dir );
- BOOST_CHECK( fs::current_path<fs::path>() == original_dir );
- BOOST_CHECK( fs::current_path<fs::path>() != dir );
+ BOOST_TEST( fs::current_path<fs::path>() == original_dir );
+ BOOST_TEST( fs::current_path<fs::path>() != dir );
// make sure the overloads work
fs::current_path( dir.string().c_str() );
- BOOST_CHECK( fs::current_path<fs::path>() == dir );
- BOOST_CHECK( fs::current_path<fs::path>() != original_dir );
+ BOOST_TEST( fs::current_path<fs::path>() == dir );
+ BOOST_TEST( fs::current_path<fs::path>() != original_dir );
fs::current_path( original_dir.string() );
- BOOST_CHECK( fs::current_path<fs::path>() == original_dir );
- BOOST_CHECK( fs::current_path<fs::path>() != dir );
+ BOOST_TEST( fs::current_path<fs::path>() == original_dir );
+ BOOST_TEST( fs::current_path<fs::path>() != dir );
// make some reasonable assuptions for testing purposes
fs::space_info spi( fs::space( dir ) );
- BOOST_CHECK( spi.capacity > 1000000 );
- BOOST_CHECK( spi.free > 1000 );
- BOOST_CHECK( spi.capacity > spi.free );
- BOOST_CHECK( spi.free >= spi.available );
+ BOOST_TEST( spi.capacity > 1000000 );
+ BOOST_TEST( spi.free > 1000 );
+ BOOST_TEST( spi.capacity > spi.free );
+ BOOST_TEST( spi.free >= spi.available );
// it is convenient to display space, but older VC++ versions choke
# if !defined(BOOST_MSVC) || _MSC_VER >= 1300 // 1300 == VC++ 7.0
@@ -461,117 +461,117 @@
# endif
if ( platform == "Windows" )
- BOOST_CHECK( CHECK_EXCEPTION( bad_directory_size, ENOENT ) );
+ BOOST_TEST( CHECK_EXCEPTION( bad_directory_size, ENOENT ) );
else
- BOOST_CHECK( CHECK_EXCEPTION( bad_directory_size, 0 ) );
- BOOST_CHECK( !fs::create_directory( dir ) );
+ BOOST_TEST( CHECK_EXCEPTION( bad_directory_size, 0 ) );
+ BOOST_TEST( !fs::create_directory( dir ) );
- BOOST_CHECK( !fs::is_symlink( dir ) );
- BOOST_CHECK( !fs::is_symlink( "nosuchfileordirectory" ) );
+ BOOST_TEST( !fs::is_symlink( dir ) );
+ BOOST_TEST( !fs::is_symlink( "nosuchfileordirectory" ) );
fs::path d1( dir / "d1" );
- BOOST_CHECK( fs::create_directory( d1 ) );
- BOOST_CHECK( fs::exists( d1 ) );
- BOOST_CHECK( fs::is_directory( d1 ) );
- BOOST_CHECK( BOOST_FS_IS_EMPTY( d1 ) );
+ BOOST_TEST( fs::create_directory( d1 ) );
+ BOOST_TEST( fs::exists( d1 ) );
+ BOOST_TEST( fs::is_directory( d1 ) );
+ BOOST_TEST( BOOST_FS_IS_EMPTY( d1 ) );
// boost::function_requires< boost::InputIteratorConcept< fs::directory_iterator > >();
bool dir_itr_exception(false);
try { fs::directory_iterator it( "" ); }
catch ( const fs::filesystem_error & ) { dir_itr_exception = true; }
- BOOST_CHECK( dir_itr_exception );
+ BOOST_TEST( dir_itr_exception );
dir_itr_exception = false;
try { fs::directory_iterator it( "nosuchdirectory" ); }
catch ( const fs::filesystem_error & ) { dir_itr_exception = true; }
- BOOST_CHECK( dir_itr_exception );
+ BOOST_TEST( dir_itr_exception );
dir_itr_exception = false;
try
{
error_code ec;
fs::directory_iterator it( "nosuchdirectory", ec );
- BOOST_CHECK( ec );
- BOOST_CHECK( ec == fs::detail::not_found_error() );
+ BOOST_TEST( ec );
+ BOOST_TEST( ec == fs::detail::not_found_error() );
}
catch ( const fs::filesystem_error & ) { dir_itr_exception = true; }
- BOOST_CHECK( !dir_itr_exception );
+ BOOST_TEST( !dir_itr_exception );
{
// probe query function overloads
fs::directory_iterator dir_itr( dir );
- BOOST_CHECK( fs::is_directory( *dir_itr ) );
- BOOST_CHECK( fs::is_directory( dir_itr->status() ) );
- BOOST_CHECK( fs::is_directory( fs::symlink_status(*dir_itr) ) );
- BOOST_CHECK( fs::is_directory( dir_itr->symlink_status() ) );
- BOOST_CHECK( dir_itr->path().filename() == "d1" );
+ BOOST_TEST( fs::is_directory( *dir_itr ) );
+ BOOST_TEST( fs::is_directory( dir_itr->status() ) );
+ BOOST_TEST( fs::is_directory( fs::symlink_status(*dir_itr) ) );
+ BOOST_TEST( fs::is_directory( dir_itr->symlink_status() ) );
+ BOOST_TEST( dir_itr->path().filename() == "d1" );
}
// create a second directory named d2
fs::path d2( dir / "d2" );
fs::create_directory(d2 );
- BOOST_CHECK( fs::exists( d2 ) );
- BOOST_CHECK( fs::is_directory( d2 ) );
+ BOOST_TEST( fs::exists( d2 ) );
+ BOOST_TEST( fs::is_directory( d2 ) );
// test the basic operation of directory_iterators, and test that
// stepping one iterator doesn't affect a different iterator.
{
fs::directory_iterator dir_itr( dir );
- BOOST_CHECK( fs::exists(dir_itr->status()) );
- BOOST_CHECK( fs::is_directory(dir_itr->status()) );
- BOOST_CHECK( !fs::is_regular_file(dir_itr->status()) );
- BOOST_CHECK( !fs::is_other(dir_itr->status()) );
- BOOST_CHECK( !fs::is_symlink(dir_itr->status()) );
+ BOOST_TEST( fs::exists(dir_itr->status()) );
+ BOOST_TEST( fs::is_directory(dir_itr->status()) );
+ BOOST_TEST( !fs::is_regular_file(dir_itr->status()) );
+ BOOST_TEST( !fs::is_other(dir_itr->status()) );
+ BOOST_TEST( !fs::is_symlink(dir_itr->status()) );
fs::directory_iterator dir_itr2( dir );
- BOOST_CHECK( dir_itr->path().filename() == "d1"
+ BOOST_TEST( dir_itr->path().filename() == "d1"
|| dir_itr->path().filename() == "d2" );
- BOOST_CHECK( dir_itr2->path().filename() == "d1" || dir_itr2->path().filename() == "d2" );
+ BOOST_TEST( dir_itr2->path().filename() == "d1" || dir_itr2->path().filename() == "d2" );
if ( dir_itr->path().filename() == "d1" )
{
- BOOST_CHECK( (++dir_itr)->path().filename() == "d2" );
- BOOST_CHECK( dir_itr2->path().filename() == "d1" );
- BOOST_CHECK( (++dir_itr2)->path().filename() == "d2" );
+ BOOST_TEST( (++dir_itr)->path().filename() == "d2" );
+ BOOST_TEST( dir_itr2->path().filename() == "d1" );
+ BOOST_TEST( (++dir_itr2)->path().filename() == "d2" );
}
else
{
- BOOST_CHECK( dir_itr->path().filename() == "d2" );
- BOOST_CHECK( (++dir_itr)->path().filename() == "d1" );
- BOOST_CHECK( (dir_itr2)->path().filename() == "d2" );
- BOOST_CHECK( (++dir_itr2)->path().filename() == "d1" );
- }
- BOOST_CHECK( ++dir_itr == fs::directory_iterator() );
- BOOST_CHECK( dir_itr2 != fs::directory_iterator() );
- BOOST_CHECK( ++dir_itr2 == fs::directory_iterator() );
+ BOOST_TEST( dir_itr->path().filename() == "d2" );
+ BOOST_TEST( (++dir_itr)->path().filename() == "d1" );
+ BOOST_TEST( (dir_itr2)->path().filename() == "d2" );
+ BOOST_TEST( (++dir_itr2)->path().filename() == "d1" );
+ }
+ BOOST_TEST( ++dir_itr == fs::directory_iterator() );
+ BOOST_TEST( dir_itr2 != fs::directory_iterator() );
+ BOOST_TEST( ++dir_itr2 == fs::directory_iterator() );
}
{ // *i++ must work to meet the standard's InputIterator requirements
fs::directory_iterator dir_itr( dir );
- BOOST_CHECK( dir_itr->path().filename() == "d1"
+ BOOST_TEST( dir_itr->path().filename() == "d1"
|| dir_itr->path().filename() == "d2" );
if ( dir_itr->path().filename() == "d1" )
{
- BOOST_CHECK( (*dir_itr++).path().filename() == "d1" );
- BOOST_CHECK( dir_itr->path().filename() == "d2" );
+ BOOST_TEST( (*dir_itr++).path().filename() == "d1" );
+ BOOST_TEST( dir_itr->path().filename() == "d2" );
}
else
{
// Check C++98 input iterator requirements
- BOOST_CHECK( (*dir_itr++).path().filename() == "d2" );
+ BOOST_TEST( (*dir_itr++).path().filename() == "d2" );
// input iterator requirements in the current WP would require this check:
- // BOOST_CHECK( implicit_cast<std::string const&>(*dir_itr++).filename() == "d1" );
+ // BOOST_TEST( implicit_cast<std::string const&>(*dir_itr++).filename() == "d1" );
- BOOST_CHECK( dir_itr->path().filename() == "d1" );
+ BOOST_TEST( dir_itr->path().filename() == "d1" );
}
// test case reported in comment to SourceForge bug tracker [937606]
fs::directory_iterator it( dir );
const fs::path p1 = *it++;
- BOOST_CHECK( it != fs::directory_iterator() );
+ BOOST_TEST( it != fs::directory_iterator() );
const fs::path p2 = *it++;
- BOOST_CHECK( p1 != p2 );
- BOOST_CHECK( it == fs::directory_iterator() );
+ BOOST_TEST( p1 != p2 );
+ BOOST_TEST( it == fs::directory_iterator() );
}
// Windows has a tricky special case when just the root-name is given,
@@ -581,61 +581,61 @@
{
fs::path root_name_path( fs::current_path<fs::path>().root_name() );
fs::directory_iterator it( root_name_path );
- BOOST_CHECK( it != fs::directory_iterator() );
- BOOST_CHECK( fs::exists( *it ) );
- BOOST_CHECK( it->path().parent_path() == root_name_path );
+ BOOST_TEST( it != fs::directory_iterator() );
+ BOOST_TEST( fs::exists( *it ) );
+ BOOST_TEST( it->path().parent_path() == root_name_path );
bool found(false);
do
{
if ( it->path().filename() == temp_dir_name ) found = true;
} while ( ++it != fs::directory_iterator() );
- BOOST_CHECK( found );
+ BOOST_TEST( found );
}
// create an empty file named "f0"
fs::path file_ph( dir / "f0");
create_file( file_ph, "" );
- BOOST_CHECK( fs::exists( file_ph ) );
- BOOST_CHECK( !fs::is_directory( file_ph ) );
- BOOST_CHECK( fs::is_regular_file( file_ph ) );
- BOOST_CHECK( BOOST_FS_IS_EMPTY( file_ph ) );
- BOOST_CHECK( fs::file_size( file_ph ) == 0 );
+ BOOST_TEST( fs::exists( file_ph ) );
+ BOOST_TEST( !fs::is_directory( file_ph ) );
+ BOOST_TEST( fs::is_regular_file( file_ph ) );
+ BOOST_TEST( BOOST_FS_IS_EMPTY( file_ph ) );
+ BOOST_TEST( fs::file_size( file_ph ) == 0 );
bad_create_directory_path = file_ph;
- BOOST_CHECK( CHECK_EXCEPTION( bad_create_directory, EEXIST ) );
+ BOOST_TEST( CHECK_EXCEPTION( bad_create_directory, EEXIST ) );
stat = fs::status( file_ph );
- BOOST_CHECK( fs::status_known( stat ) );
- BOOST_CHECK( fs::exists( stat ) );
- BOOST_CHECK( !fs::is_directory( stat ) );
- BOOST_CHECK( fs::is_regular_file( stat ) );
- BOOST_CHECK( !fs::is_other( stat ) );
- BOOST_CHECK( !fs::is_symlink( stat ) );
+ BOOST_TEST( fs::status_known( stat ) );
+ BOOST_TEST( fs::exists( stat ) );
+ BOOST_TEST( !fs::is_directory( stat ) );
+ BOOST_TEST( fs::is_regular_file( stat ) );
+ BOOST_TEST( !fs::is_other( stat ) );
+ BOOST_TEST( !fs::is_symlink( stat ) );
// create a file named "f1"
file_ph = dir / "f1";
create_file( file_ph, "foobar1" );
- BOOST_CHECK( fs::exists( file_ph ) );
- BOOST_CHECK( !fs::is_directory( file_ph ) );
- BOOST_CHECK( fs::is_regular_file( file_ph ) );
- BOOST_CHECK( fs::file_size( file_ph ) == 7 );
+ BOOST_TEST( fs::exists( file_ph ) );
+ BOOST_TEST( !fs::is_directory( file_ph ) );
+ BOOST_TEST( fs::is_regular_file( file_ph ) );
+ BOOST_TEST( fs::file_size( file_ph ) == 7 );
verify_file( file_ph, "foobar1" );
// equivalence tests
- BOOST_CHECK( CHECK_EXCEPTION( bad_equivalent, ENOENT ) );
- BOOST_CHECK( fs::equivalent( file_ph, dir / "f1" ) );
- BOOST_CHECK( fs::equivalent( dir, d1 / ".." ) );
- BOOST_CHECK( !fs::equivalent( file_ph, dir ) );
- BOOST_CHECK( !fs::equivalent( dir, file_ph ) );
- BOOST_CHECK( !fs::equivalent( d1, d2 ) );
- BOOST_CHECK( !fs::equivalent( dir, ng ) );
- BOOST_CHECK( !fs::equivalent( ng, dir ) );
- BOOST_CHECK( !fs::equivalent( file_ph, ng ) );
- BOOST_CHECK( !fs::equivalent( ng, file_ph ) );
+ BOOST_TEST( CHECK_EXCEPTION( bad_equivalent, ENOENT ) );
+ BOOST_TEST( fs::equivalent( file_ph, dir / "f1" ) );
+ BOOST_TEST( fs::equivalent( dir, d1 / ".." ) );
+ BOOST_TEST( !fs::equivalent( file_ph, dir ) );
+ BOOST_TEST( !fs::equivalent( dir, file_ph ) );
+ BOOST_TEST( !fs::equivalent( d1, d2 ) );
+ BOOST_TEST( !fs::equivalent( dir, ng ) );
+ BOOST_TEST( !fs::equivalent( ng, dir ) );
+ BOOST_TEST( !fs::equivalent( file_ph, ng ) );
+ BOOST_TEST( !fs::equivalent( ng, file_ph ) );
// hard link tests
fs::path from_ph( dir / "f3" );
- BOOST_CHECK( !fs::exists( from_ph ) );
- BOOST_CHECK( fs::exists( file_ph ) );
+ BOOST_TEST( !fs::exists( from_ph ) );
+ BOOST_TEST( fs::exists( file_ph ) );
bool create_hard_link_ok(true);
try { fs::create_hard_link( file_ph, from_ph ); }
catch ( const fs::filesystem_error & ex )
@@ -649,21 +649,22 @@
if ( create_hard_link_ok )
{
- std::cout << "create_hard_link() succeeded\n";
- BOOST_CHECK( fs::exists( from_ph ) );
- BOOST_CHECK( fs::exists( file_ph ) );
- BOOST_CHECK( fs::equivalent( from_ph, file_ph ) );
+ std::cout << "create_hard_link(\"" << file_ph << "\", \""
+ << from_ph << "\") succeeded\n";
+ BOOST_TEST( fs::exists( from_ph ) );
+ BOOST_TEST( fs::exists( file_ph ) );
+ BOOST_TEST( fs::equivalent( from_ph, file_ph ) );
}
error_code ec;
- BOOST_CHECK( fs::create_hard_link( fs::path("doesnotexist"),
+ BOOST_TEST( fs::create_hard_link( fs::path("doesnotexist"),
fs::path("shouldnotwork"), ec ) );
- BOOST_CHECK( ec );
+ BOOST_TEST( ec );
// symbolic link tests
from_ph = dir / "f4";
- BOOST_CHECK( !fs::exists( from_ph ) );
- BOOST_CHECK( fs::exists( file_ph ) );
+ BOOST_TEST( !fs::exists( from_ph ) );
+ BOOST_TEST( fs::exists( file_ph ) );
bool create_symlink_ok(true);
try { fs::create_symlink( file_ph, from_ph ); }
catch ( const fs::filesystem_error & ex )
@@ -678,217 +679,217 @@
if ( create_symlink_ok )
{
std::cout << "create_symlink() succeeded\n";
- BOOST_CHECK( fs::exists( from_ph ) );
- BOOST_CHECK( fs::is_symlink( from_ph ) );
- BOOST_CHECK( fs::exists( file_ph ) );
- BOOST_CHECK( fs::equivalent( from_ph, file_ph ) );
+ BOOST_TEST( fs::exists( from_ph ) );
+ BOOST_TEST( fs::is_symlink( from_ph ) );
+ BOOST_TEST( fs::exists( file_ph ) );
+ BOOST_TEST( fs::equivalent( from_ph, file_ph ) );
stat = fs::symlink_status( from_ph );
- BOOST_CHECK( fs::exists( stat ) );
- BOOST_CHECK( !fs::is_directory( stat ) );
- BOOST_CHECK( !fs::is_regular_file( stat ) );
- BOOST_CHECK( !fs::is_other( stat ) );
- BOOST_CHECK( fs::is_symlink( stat ) );
+ BOOST_TEST( fs::exists( stat ) );
+ BOOST_TEST( !fs::is_directory( stat ) );
+ BOOST_TEST( !fs::is_regular_file( stat ) );
+ BOOST_TEST( !fs::is_other( stat ) );
+ BOOST_TEST( fs::is_symlink( stat ) );
}
ec = error_code();
- BOOST_CHECK( fs::create_symlink( "doesnotexist", "", ec ) );
- BOOST_CHECK( ec );
+ BOOST_TEST( fs::create_symlink( "doesnotexist", "", ec ) );
+ BOOST_TEST( ec );
// 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;
{ di = fs::directory_iterator( dir ); }
- BOOST_CHECK( ++di != fs::directory_iterator() );
+ BOOST_TEST( ++di != fs::directory_iterator() );
}
// copy_file() tests
std::cout << "begin copy_file test..." << std::endl;
fs::copy_file( file_ph, d1 / "f2" );
std::cout << "copying complete" << std::endl;
- BOOST_CHECK( fs::exists( file_ph ) );
- BOOST_CHECK( fs::exists( d1 / "f2" ) );
- BOOST_CHECK( !fs::is_directory( 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" );
std::cout << "copy_file test complete" << std::endl;
// rename() test case numbers refer to operations.htm#rename table
// [case 1] make sure can't rename() a non-existent file
- BOOST_CHECK( !fs::exists( d1 / "f99" ) );
- BOOST_CHECK( !fs::exists( d1 / "f98" ) );
+ BOOST_TEST( !fs::exists( d1 / "f99" ) );
+ BOOST_TEST( !fs::exists( d1 / "f98" ) );
renamer n1a( d1 / "f99", d1 / "f98" );
- BOOST_CHECK( CHECK_EXCEPTION( n1a, ENOENT ) );
+ BOOST_TEST( CHECK_EXCEPTION( n1a, ENOENT ) );
renamer n1b( fs::path(""), d1 / "f98" );
- BOOST_CHECK( CHECK_EXCEPTION( n1b, ENOENT ) );
+ BOOST_TEST( CHECK_EXCEPTION( n1b, ENOENT ) );
// [case 2] rename() target.empty()
renamer n2( file_ph, "" );
- BOOST_CHECK( CHECK_EXCEPTION( n2, ENOENT ) );
+ BOOST_TEST( CHECK_EXCEPTION( n2, ENOENT ) );
// [case 3] make sure can't rename() to an existent file or directory
- BOOST_CHECK( fs::exists( dir / "f1" ) );
- BOOST_CHECK( fs::exists( d1 / "f2" ) );
+ BOOST_TEST( fs::exists( dir / "f1" ) );
+ BOOST_TEST( fs::exists( d1 / "f2" ) );
renamer n3a( dir / "f1", d1 / "f2" );
- BOOST_CHECK( CHECK_EXCEPTION( n3a, EEXIST ) );
+ BOOST_TEST( CHECK_EXCEPTION( n3a, EEXIST ) );
// several POSIX implementations (cygwin, openBSD) report ENOENT instead of EEXIST,
// so we don't verify error type on the above test.
renamer n3b( dir, d1 );
- BOOST_CHECK( CHECK_EXCEPTION( n3b, 0 ) );
+ BOOST_TEST( CHECK_EXCEPTION( n3b, 0 ) );
// [case 4A] can't rename() file to a nonexistent parent directory
- BOOST_CHECK( !fs::is_directory( dir / "f1" ) );
- BOOST_CHECK( !fs::exists( dir / "d3/f3" ) );
+ BOOST_TEST( !fs::is_directory( dir / "f1" ) );
+ BOOST_TEST( !fs::exists( dir / "d3/f3" ) );
renamer n4a( dir / "f1", dir / "d3/f3" );
- BOOST_CHECK( CHECK_EXCEPTION( n4a, ENOENT ) );
+ BOOST_TEST( CHECK_EXCEPTION( n4a, ENOENT ) );
// [case 4B] rename() file in same directory
- BOOST_CHECK( fs::exists( d1 / "f2" ) );
- BOOST_CHECK( !fs::exists( d1 / "f50" ) );
+ BOOST_TEST( fs::exists( d1 / "f2" ) );
+ BOOST_TEST( !fs::exists( d1 / "f50" ) );
fs::rename( d1 / "f2", d1 / "f50" );
- BOOST_CHECK( !fs::exists( d1 / "f2" ) );
- BOOST_CHECK( fs::exists( d1 / "f50" ) );
+ BOOST_TEST( !fs::exists( d1 / "f2" ) );
+ BOOST_TEST( fs::exists( d1 / "f50" ) );
fs::rename( d1 / "f50", d1 / "f2" );
- BOOST_CHECK( fs::exists( d1 / "f2" ) );
- BOOST_CHECK( !fs::exists( d1 / "f50" ) );
+ BOOST_TEST( fs::exists( d1 / "f2" ) );
+ BOOST_TEST( !fs::exists( d1 / "f50" ) );
// [case 4C] rename() file d1/f2 to d2/f3
fs::rename( d1 / "f2", d2 / "f3" );
- BOOST_CHECK( !fs::exists( d1 / "f2" ) );
- BOOST_CHECK( !fs::exists( d2 / "f2" ) );
- BOOST_CHECK( fs::exists( d2 / "f3" ) );
- BOOST_CHECK( !fs::is_directory( 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" );
fs::rename( d2 / "f3", d1 / "f2" );
- BOOST_CHECK( fs::exists( d1 / "f2" ) );
+ BOOST_TEST( fs::exists( d1 / "f2" ) );
// [case 5A] rename() directory to nonexistent parent directory
- BOOST_CHECK( fs::exists( d1 ) );
- BOOST_CHECK( !fs::exists( dir / "d3/d5" ) );
- BOOST_CHECK( !fs::exists( dir / "d3" ) );
+ BOOST_TEST( fs::exists( d1 ) );
+ BOOST_TEST( !fs::exists( dir / "d3/d5" ) );
+ BOOST_TEST( !fs::exists( dir / "d3" ) );
renamer n5a( d1, dir / "d3/d5" );
- BOOST_CHECK( CHECK_EXCEPTION( n5a, ENOENT ) );
+ BOOST_TEST( CHECK_EXCEPTION( n5a, ENOENT ) );
// [case 5B] rename() on directory
fs::path d3( dir / "d3" );
- BOOST_CHECK( fs::exists( d1 ) );
- BOOST_CHECK( fs::exists( d1 / "f2" ) );
- BOOST_CHECK( !fs::exists( d3 ) );
+ BOOST_TEST( fs::exists( d1 ) );
+ BOOST_TEST( fs::exists( d1 / "f2" ) );
+ BOOST_TEST( !fs::exists( d3 ) );
fs::rename( d1, d3 );
- BOOST_CHECK( !fs::exists( d1 ) );
- BOOST_CHECK( fs::exists( d3 ) );
- BOOST_CHECK( fs::is_directory( d3 ) );
- BOOST_CHECK( !fs::exists( d1 / "f2" ) );
- BOOST_CHECK( fs::exists( d3 / "f2" ) );
+ BOOST_TEST( !fs::exists( d1 ) );
+ BOOST_TEST( fs::exists( d3 ) );
+ BOOST_TEST( fs::is_directory( d3 ) );
+ BOOST_TEST( !fs::exists( d1 / "f2" ) );
+ BOOST_TEST( fs::exists( d3 / "f2" ) );
fs::rename( d3, d1 );
- BOOST_CHECK( fs::exists( d1 ) );
- BOOST_CHECK( fs::exists( d1 / "f2" ) );
- BOOST_CHECK( !fs::exists( d3 ) );
+ BOOST_TEST( fs::exists( d1 ) );
+ BOOST_TEST( fs::exists( d1 / "f2" ) );
+ BOOST_TEST( !fs::exists( d3 ) );
// [case 5C] rename() rename and move d1 to d2 / "d20"
- BOOST_CHECK( fs::exists( d1 ) );
- BOOST_CHECK( !fs::exists( d2 / "d20" ) );
- BOOST_CHECK( fs::exists( d1 / "f2" ) );
+ BOOST_TEST( fs::exists( d1 ) );
+ BOOST_TEST( !fs::exists( d2 / "d20" ) );
+ BOOST_TEST( fs::exists( d1 / "f2" ) );
fs::rename( d1, d2 / "d20" );
- BOOST_CHECK( !fs::exists( d1 ) );
- BOOST_CHECK( fs::exists( d2 / "d20" ) );
- BOOST_CHECK( fs::exists( d2 / "d20" / "f2" ) );
+ BOOST_TEST( !fs::exists( d1 ) );
+ BOOST_TEST( fs::exists( d2 / "d20" ) );
+ BOOST_TEST( fs::exists( d2 / "d20" / "f2" ) );
fs::rename( d2 / "d20", d1 );
- BOOST_CHECK( fs::exists( d1 ) );
- BOOST_CHECK( !fs::exists( d2 / "d20" ) );
- BOOST_CHECK( fs::exists( d1 / "f2" ) );
+ BOOST_TEST( fs::exists( d1 ) );
+ BOOST_TEST( !fs::exists( d2 / "d20" ) );
+ BOOST_TEST( fs::exists( d1 / "f2" ) );
// remove() file
file_ph = dir / "shortlife";
- BOOST_CHECK( !fs::exists( file_ph ) );
+ BOOST_TEST( !fs::exists( file_ph ) );
create_file( file_ph, "" );
- BOOST_CHECK( fs::exists( file_ph ) );
- BOOST_CHECK( !fs::is_directory( file_ph ) );
- BOOST_CHECK( fs::remove( file_ph ) );
- BOOST_CHECK( !fs::exists( file_ph ) );
- BOOST_CHECK( !fs::remove( "no-such-file" ) );
- BOOST_CHECK( !fs::remove( "no-such-directory/no-such-file" ) );
+ 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() directory
d1 = dir / "shortlife_dir";
- BOOST_CHECK( !fs::exists( d1 ) );
+ BOOST_TEST( !fs::exists( d1 ) );
fs::create_directory( d1 );
- BOOST_CHECK( fs::exists( d1 ) );
- BOOST_CHECK( fs::is_directory( d1 ) );
- BOOST_CHECK( BOOST_FS_IS_EMPTY( d1 ) );
+ BOOST_TEST( fs::exists( d1 ) );
+ BOOST_TEST( fs::is_directory( d1 ) );
+ BOOST_TEST( BOOST_FS_IS_EMPTY( d1 ) );
bad_remove_dir = dir;
- BOOST_CHECK( CHECK_EXCEPTION( bad_remove, ENOTEMPTY ) );
- BOOST_CHECK( fs::remove( d1 ) );
- BOOST_CHECK( !fs::exists( d1 ) );
+ BOOST_TEST( CHECK_EXCEPTION( bad_remove, ENOTEMPTY ) );
+ BOOST_TEST( fs::remove( d1 ) );
+ BOOST_TEST( !fs::exists( d1 ) );
if ( create_symlink_ok ) // only if symlinks supported
{
// remove() dangling symbolic link
fs::path link( "dangling_link" );
fs::remove( link ); // remove any residue from past tests
- BOOST_CHECK( !fs::is_symlink( link ) );
- BOOST_CHECK( !fs::exists( link ) );
+ BOOST_TEST( !fs::is_symlink( link ) );
+ BOOST_TEST( !fs::exists( link ) );
fs::create_symlink( "nowhere", link );
- BOOST_CHECK( !fs::exists( link ) );
- BOOST_CHECK( fs::is_symlink( link ) );
- BOOST_CHECK( fs::remove( link ) );
- BOOST_CHECK( !fs::is_symlink( link ) );
+ BOOST_TEST( !fs::exists( link ) );
+ BOOST_TEST( fs::is_symlink( link ) );
+ BOOST_TEST( fs::remove( link ) );
+ BOOST_TEST( !fs::is_symlink( link ) );
// remove() self-refering symbolic link
link = "link_to_self";
fs::remove( link ); // remove any residue from past tests
- BOOST_CHECK( !fs::is_symlink( link ) );
- BOOST_CHECK( !fs::exists( link ) );
+ BOOST_TEST( !fs::is_symlink( link ) );
+ BOOST_TEST( !fs::exists( link ) );
fs::create_symlink( link, link );
- BOOST_CHECK( fs::remove( link ) );
- BOOST_CHECK( !fs::exists( link ) );
- BOOST_CHECK( !fs::is_symlink( link ) );
+ BOOST_TEST( fs::remove( link ) );
+ BOOST_TEST( !fs::exists( link ) );
+ BOOST_TEST( !fs::is_symlink( link ) );
// remove() cyclic symbolic link
link = "link_to_a";
fs::path link2( "link_to_b" );
fs::remove( link ); // remove any residue from past tests
fs::remove( link2 ); // remove any residue from past tests
- BOOST_CHECK( !fs::is_symlink( link ) );
- BOOST_CHECK( !fs::exists( link ) );
+ BOOST_TEST( !fs::is_symlink( link ) );
+ BOOST_TEST( !fs::exists( link ) );
fs::create_symlink( link, link2 );
fs::create_symlink( link2, link );
- BOOST_CHECK( fs::remove( link ) );
- BOOST_CHECK( fs::remove( link2 ) );
- BOOST_CHECK( !fs::exists( link ) );
- BOOST_CHECK( !fs::exists( link2 ) );
- BOOST_CHECK( !fs::is_symlink( link ) );
+ BOOST_TEST( fs::remove( link ) );
+ BOOST_TEST( fs::remove( link2 ) );
+ BOOST_TEST( !fs::exists( link ) );
+ BOOST_TEST( !fs::exists( link2 ) );
+ BOOST_TEST( !fs::is_symlink( link ) );
// remove() symbolic link to file
file_ph = "link_target";
fs::remove( file_ph ); // remove any residue from past tests
- BOOST_CHECK( !fs::exists( file_ph ) );
+ BOOST_TEST( !fs::exists( file_ph ) );
create_file( file_ph, "" );
- BOOST_CHECK( fs::exists( file_ph ) );
- BOOST_CHECK( !fs::is_directory( file_ph ) );
- BOOST_CHECK( fs::is_regular_file( file_ph ) );
+ BOOST_TEST( fs::exists( file_ph ) );
+ BOOST_TEST( !fs::is_directory( file_ph ) );
+ BOOST_TEST( fs::is_regular_file( file_ph ) );
link = "non_dangling_link";
fs::create_symlink( file_ph, link );
- BOOST_CHECK( fs::exists( link ) );
- BOOST_CHECK( !fs::is_directory( link ) );
- BOOST_CHECK( fs::is_regular_file( link ) );
- BOOST_CHECK( fs::is_symlink( link ) );
- BOOST_CHECK( fs::remove( link ) );
- BOOST_CHECK( fs::exists( file_ph ) );
- BOOST_CHECK( !fs::exists( link ) );
- BOOST_CHECK( !fs::is_symlink( link ) );
- BOOST_CHECK( fs::remove( file_ph ) );
- BOOST_CHECK( !fs::exists( file_ph ) );
+ BOOST_TEST( fs::exists( link ) );
+ BOOST_TEST( !fs::is_directory( link ) );
+ BOOST_TEST( fs::is_regular_file( link ) );
+ BOOST_TEST( fs::is_symlink( link ) );
+ BOOST_TEST( fs::remove( link ) );
+ BOOST_TEST( fs::exists( file_ph ) );
+ BOOST_TEST( !fs::exists( link ) );
+ BOOST_TEST( !fs::is_symlink( link ) );
+ BOOST_TEST( fs::remove( file_ph ) );
+ BOOST_TEST( !fs::exists( file_ph ) );
}
// write time tests
file_ph = dir / "foobar2";
create_file( file_ph, "foobar2" );
- BOOST_CHECK( fs::exists( file_ph ) );
- BOOST_CHECK( !fs::is_directory( file_ph ) );
- BOOST_CHECK( fs::is_regular_file( file_ph ) );
- BOOST_CHECK( fs::file_size( file_ph ) == 7 );
+ BOOST_TEST( fs::exists( file_ph ) );
+ BOOST_TEST( !fs::is_directory( file_ph ) );
+ BOOST_TEST( fs::is_regular_file( file_ph ) );
+ BOOST_TEST( fs::file_size( file_ph ) == 7 );
verify_file( file_ph, "foobar2" );
// Some file system report last write time as local (FAT), while
@@ -907,7 +908,7 @@
std::time_t ft2 = fs::last_write_time( file_ph );
std::cout << "last_write_time() for the file is now "
<< std::asctime(std::gmtime(&ft2)) << std::endl;
- BOOST_CHECK( ft != fs::last_write_time( file_ph ) );
+ BOOST_TEST( ft != fs::last_write_time( file_ph ) );
std::cout << "\nReset to current time" << std::endl;
@@ -916,14 +917,15 @@
std::cout
<< "original last_write_time() - current last_write_time() is "
<< time_diff << " seconds" << std::endl;
- BOOST_CHECK( time_diff >= -60.0 && time_diff <= 60.0 );
+ BOOST_TEST( time_diff >= -60.0 && time_diff <= 60.0 );
// post-test cleanup
- BOOST_CHECK( fs::remove_all( dir ) != 0 );
+ BOOST_TEST( fs::remove_all( dir ) != 0 );
// above was added just to simplify testing, but it ended up detecting
// a bug (failure to close an internal search handle).
- BOOST_CHECK( !fs::exists( dir ) );
- BOOST_CHECK( fs::remove_all( dir ) == 0 );
- return 0;
+ BOOST_TEST( !fs::exists( dir ) );
+ BOOST_TEST( fs::remove_all( dir ) == 0 );
+
+ return ::boost::report_errors();
} // main
Modified: branches/release/libs/filesystem/test/path_test.cpp
==============================================================================
--- branches/release/libs/filesystem/test/path_test.cpp (original)
+++ branches/release/libs/filesystem/test/path_test.cpp 2009-04-15 08:17:22 EDT (Wed, 15 Apr 2009)
@@ -30,7 +30,7 @@
using boost::next;
using boost::prior;
-#include <boost/test/minimal.hpp>
+#include <boost/detail/lightweight_test.hpp>
#define PATH_CHECK( a, b ) check( a, b, __LINE__ )
#define DIR_CHECK( a, b ) check_dir( a, b, __LINE__ )
@@ -41,14 +41,12 @@
{
std::string platform( BOOST_PLATFORM );
- int errors;
-
void check( const fs::path & source,
const std::string & expected, int line )
{
if ( source.string()== expected ) return;
- ++errors;
+ ++::boost::detail::test_errors();
std::cout << '(' << line << ") source.string(): \"" << source.string()
<< "\" != expected: \"" << expected
@@ -60,7 +58,7 @@
{
if ( source.directory_string()== expected ) return;
- ++errors;
+ ++::boost::detail::test_errors();
std::cout << '(' << line << ") source.directory_string(): \""
<< source.directory_string()
@@ -73,7 +71,7 @@
{
if ( value == expected ) return;
- ++errors;
+ ++::boost::detail::test_errors();
std::cout << '(' << line << ") value: \"" << value
<< "\" != expected: \"" << expected
@@ -89,20 +87,20 @@
catch ( const fs::filesystem_error & ex )
{
//std::cout << ex.what() << "*" << std::endl;
- //BOOST_CHECK( std::strcmp( ex.what(),
+ //BOOST_TEST( std::strcmp( ex.what(),
// "string-1: Unknown error" ) == 0 );
- BOOST_CHECK( ex.code() == ec );
+ BOOST_TEST( ex.code() == ec );
}
try { throw fs::filesystem_error( str_1, "p1", "p2", ec ); }
catch ( const fs::filesystem_error & ex )
{
//std::cout << ex.what() << "*" << std::endl;
- //BOOST_CHECK( std::strcmp( ex.what(),
+ //BOOST_TEST( std::strcmp( ex.what(),
// "string-1: Unknown error: \"p1\", \"p2\"" ) == 0 );
- BOOST_CHECK( ex.code() == ec );
- BOOST_CHECK( ex.path1().string() == "p1" );
- BOOST_CHECK( ex.path2().string() == "p2" );
+ BOOST_TEST( ex.code() == ec );
+ BOOST_TEST( ex.path1().string() == "p1" );
+ BOOST_TEST( ex.path2().string() == "p2" );
}
}
@@ -113,86 +111,86 @@
{
std::cout << "name_function_tests..." << std::endl;
- BOOST_CHECK( fs::portable_posix_name( std::string( "x" ) ) );
- BOOST_CHECK( fs::windows_name( std::string( "x" ) ) );
- BOOST_CHECK( fs::portable_name( std::string( "x" ) ) );
- BOOST_CHECK( fs::portable_directory_name( std::string( "x" ) ) );
- BOOST_CHECK( fs::portable_file_name( std::string( "x" ) ) );
-
- BOOST_CHECK( fs::portable_posix_name( std::string( "." ) ) );
- BOOST_CHECK( fs::windows_name( std::string( "." ) ) );
- BOOST_CHECK( fs::portable_name( std::string( "." ) ) );
- BOOST_CHECK( fs::portable_directory_name( std::string( "." ) ) );
- BOOST_CHECK( !fs::portable_file_name( std::string( "." ) ) );
-
- BOOST_CHECK( fs::portable_posix_name( std::string( ".." ) ) );
- BOOST_CHECK( fs::windows_name( std::string( ".." ) ) );
- BOOST_CHECK( fs::portable_name( std::string( ".." ) ) );
- BOOST_CHECK( fs::portable_directory_name( std::string( ".." ) ) );
- BOOST_CHECK( !fs::portable_file_name( std::string( ".." ) ) );
-
- BOOST_CHECK( !fs::native( std::string( "" ) ) );
- BOOST_CHECK( !fs::portable_posix_name( std::string( "" ) ) );
- BOOST_CHECK( !fs::windows_name( std::string( "" ) ) );
- BOOST_CHECK( !fs::portable_name( std::string( "" ) ) );
- BOOST_CHECK( !fs::portable_directory_name( std::string( "" ) ) );
- BOOST_CHECK( !fs::portable_file_name( std::string( "" ) ) );
-
- BOOST_CHECK( !fs::native( std::string( " " ) ) );
- BOOST_CHECK( !fs::portable_posix_name( std::string( " " ) ) );
- BOOST_CHECK( !fs::windows_name( std::string( " " ) ) );
- BOOST_CHECK( !fs::portable_name( std::string( " " ) ) );
- BOOST_CHECK( !fs::portable_directory_name( std::string( " " ) ) );
- BOOST_CHECK( !fs::portable_file_name( std::string( " " ) ) );
-
- BOOST_CHECK( !fs::portable_posix_name( std::string( ":" ) ) );
- BOOST_CHECK( !fs::windows_name( std::string( ":" ) ) );
- BOOST_CHECK( !fs::portable_name( std::string( ":" ) ) );
- BOOST_CHECK( !fs::portable_directory_name( std::string( ":" ) ) );
- BOOST_CHECK( !fs::portable_file_name( std::string( ":" ) ) );
-
- BOOST_CHECK( fs::portable_posix_name( std::string( "-" ) ) );
- BOOST_CHECK( fs::windows_name( std::string( "-" ) ) );
- BOOST_CHECK( !fs::portable_name( std::string( "-" ) ) );
- BOOST_CHECK( !fs::portable_directory_name( std::string( "-" ) ) );
- BOOST_CHECK( !fs::portable_file_name( std::string( "-" ) ) );
-
- BOOST_CHECK( !fs::portable_posix_name( std::string( "foo bar" ) ) );
- BOOST_CHECK( fs::windows_name( std::string( "foo bar" ) ) );
- BOOST_CHECK( !fs::windows_name( std::string( " bar" ) ) );
- BOOST_CHECK( !fs::windows_name( std::string( "foo " ) ) );
- BOOST_CHECK( !fs::portable_name( std::string( "foo bar" ) ) );
- BOOST_CHECK( !fs::portable_directory_name( std::string( "foo bar" ) ) );
- BOOST_CHECK( !fs::portable_file_name( std::string( "foo bar" ) ) );
-
- BOOST_CHECK( fs::portable_posix_name( std::string( "foo.bar" ) ) );
- BOOST_CHECK( fs::windows_name( std::string( "foo.bar" ) ) );
- BOOST_CHECK( fs::portable_name( std::string( "foo.bar" ) ) );
- BOOST_CHECK( !fs::portable_directory_name( std::string( "foo.bar" ) ) );
- BOOST_CHECK( fs::portable_file_name( std::string( "foo.bar" ) ) );
-
- BOOST_CHECK( fs::portable_posix_name( std::string( "foo.barf" ) ) );
- BOOST_CHECK( fs::windows_name( std::string( "foo.barf" ) ) );
- BOOST_CHECK( fs::portable_name( std::string( "foo.barf" ) ) );
- BOOST_CHECK( !fs::portable_directory_name( std::string( "foo.barf" ) ) );
- BOOST_CHECK( !fs::portable_file_name( std::string( "foo.barf" ) ) );
-
- BOOST_CHECK( fs::portable_posix_name( std::string( ".foo" ) ) );
- BOOST_CHECK( fs::windows_name( std::string( ".foo" ) ) );
- BOOST_CHECK( !fs::portable_name( std::string( ".foo" ) ) );
- BOOST_CHECK( !fs::portable_directory_name( std::string( ".foo" ) ) );
- BOOST_CHECK( !fs::portable_file_name( std::string( ".foo" ) ) );
-
- BOOST_CHECK( fs::portable_posix_name( std::string( "foo." ) ) );
- BOOST_CHECK( !fs::windows_name( std::string( "foo." ) ) );
- BOOST_CHECK( !fs::portable_name( std::string( "foo." ) ) );
- BOOST_CHECK( !fs::portable_directory_name( std::string( "foo." ) ) );
- BOOST_CHECK( !fs::portable_file_name( std::string( "foo." ) ) );
+ BOOST_TEST( fs::portable_posix_name( std::string( "x" ) ) );
+ BOOST_TEST( fs::windows_name( std::string( "x" ) ) );
+ BOOST_TEST( fs::portable_name( std::string( "x" ) ) );
+ BOOST_TEST( fs::portable_directory_name( std::string( "x" ) ) );
+ BOOST_TEST( fs::portable_file_name( std::string( "x" ) ) );
+
+ BOOST_TEST( fs::portable_posix_name( std::string( "." ) ) );
+ BOOST_TEST( fs::windows_name( std::string( "." ) ) );
+ BOOST_TEST( fs::portable_name( std::string( "." ) ) );
+ BOOST_TEST( fs::portable_directory_name( std::string( "." ) ) );
+ BOOST_TEST( !fs::portable_file_name( std::string( "." ) ) );
+
+ BOOST_TEST( fs::portable_posix_name( std::string( ".." ) ) );
+ BOOST_TEST( fs::windows_name( std::string( ".." ) ) );
+ BOOST_TEST( fs::portable_name( std::string( ".." ) ) );
+ BOOST_TEST( fs::portable_directory_name( std::string( ".." ) ) );
+ BOOST_TEST( !fs::portable_file_name( std::string( ".." ) ) );
+
+ BOOST_TEST( !fs::native( std::string( "" ) ) );
+ BOOST_TEST( !fs::portable_posix_name( std::string( "" ) ) );
+ BOOST_TEST( !fs::windows_name( std::string( "" ) ) );
+ BOOST_TEST( !fs::portable_name( std::string( "" ) ) );
+ BOOST_TEST( !fs::portable_directory_name( std::string( "" ) ) );
+ BOOST_TEST( !fs::portable_file_name( std::string( "" ) ) );
+
+ BOOST_TEST( !fs::native( std::string( " " ) ) );
+ BOOST_TEST( !fs::portable_posix_name( std::string( " " ) ) );
+ BOOST_TEST( !fs::windows_name( std::string( " " ) ) );
+ BOOST_TEST( !fs::portable_name( std::string( " " ) ) );
+ BOOST_TEST( !fs::portable_directory_name( std::string( " " ) ) );
+ BOOST_TEST( !fs::portable_file_name( std::string( " " ) ) );
+
+ BOOST_TEST( !fs::portable_posix_name( std::string( ":" ) ) );
+ BOOST_TEST( !fs::windows_name( std::string( ":" ) ) );
+ BOOST_TEST( !fs::portable_name( std::string( ":" ) ) );
+ BOOST_TEST( !fs::portable_directory_name( std::string( ":" ) ) );
+ BOOST_TEST( !fs::portable_file_name( std::string( ":" ) ) );
+
+ BOOST_TEST( fs::portable_posix_name( std::string( "-" ) ) );
+ BOOST_TEST( fs::windows_name( std::string( "-" ) ) );
+ BOOST_TEST( !fs::portable_name( std::string( "-" ) ) );
+ BOOST_TEST( !fs::portable_directory_name( std::string( "-" ) ) );
+ BOOST_TEST( !fs::portable_file_name( std::string( "-" ) ) );
+
+ BOOST_TEST( !fs::portable_posix_name( std::string( "foo bar" ) ) );
+ BOOST_TEST( fs::windows_name( std::string( "foo bar" ) ) );
+ BOOST_TEST( !fs::windows_name( std::string( " bar" ) ) );
+ BOOST_TEST( !fs::windows_name( std::string( "foo " ) ) );
+ BOOST_TEST( !fs::portable_name( std::string( "foo bar" ) ) );
+ BOOST_TEST( !fs::portable_directory_name( std::string( "foo bar" ) ) );
+ BOOST_TEST( !fs::portable_file_name( std::string( "foo bar" ) ) );
+
+ BOOST_TEST( fs::portable_posix_name( std::string( "foo.bar" ) ) );
+ BOOST_TEST( fs::windows_name( std::string( "foo.bar" ) ) );
+ BOOST_TEST( fs::portable_name( std::string( "foo.bar" ) ) );
+ BOOST_TEST( !fs::portable_directory_name( std::string( "foo.bar" ) ) );
+ BOOST_TEST( fs::portable_file_name( std::string( "foo.bar" ) ) );
+
+ BOOST_TEST( fs::portable_posix_name( std::string( "foo.barf" ) ) );
+ BOOST_TEST( fs::windows_name( std::string( "foo.barf" ) ) );
+ BOOST_TEST( fs::portable_name( std::string( "foo.barf" ) ) );
+ BOOST_TEST( !fs::portable_directory_name( std::string( "foo.barf" ) ) );
+ BOOST_TEST( !fs::portable_file_name( std::string( "foo.barf" ) ) );
+
+ BOOST_TEST( fs::portable_posix_name( std::string( ".foo" ) ) );
+ BOOST_TEST( fs::windows_name( std::string( ".foo" ) ) );
+ BOOST_TEST( !fs::portable_name( std::string( ".foo" ) ) );
+ BOOST_TEST( !fs::portable_directory_name( std::string( ".foo" ) ) );
+ BOOST_TEST( !fs::portable_file_name( std::string( ".foo" ) ) );
+
+ BOOST_TEST( fs::portable_posix_name( std::string( "foo." ) ) );
+ BOOST_TEST( !fs::windows_name( std::string( "foo." ) ) );
+ BOOST_TEST( !fs::portable_name( std::string( "foo." ) ) );
+ BOOST_TEST( !fs::portable_directory_name( std::string( "foo." ) ) );
+ BOOST_TEST( !fs::portable_file_name( std::string( "foo." ) ) );
}
} // unnamed namespace
-int test_main( int, char*[] )
+int main( int, char*[] )
{
// The choice of platform is make at runtime rather than compile-time
// so that compile errors for all platforms will be detected even though
@@ -205,14 +203,29 @@
path p1( "fe/fi/fo/fum" );
path p2( p1 );
path p3;
- BOOST_CHECK( p1.string() != p3.string() );
+ BOOST_TEST( p1.string() != p3.string() );
+
+ // check each overload
+ BOOST_TEST( p1 != p3 );
+ BOOST_TEST( p1 != p3.string() );
+ BOOST_TEST( p1 != p3.string().c_str() );
+ BOOST_TEST( p1.string() != p3 );
+ BOOST_TEST( p1.string().c_str() != p3 );
+
p3 = p2;
- BOOST_CHECK( p1.string() == p3.string() );
+ BOOST_TEST( p1.string() == p3.string() );
+
+ // check each overload
+ BOOST_TEST( p1 == p3 );
+ BOOST_TEST( p1 == p3.string() );
+ BOOST_TEST( p1 == p3.string().c_str() );
+ BOOST_TEST( p1.string() == p3 );
+ BOOST_TEST( p1.string().c_str() == p3 );
path p4( "foobar" );
- BOOST_CHECK( p4.string() == "foobar" );
+ BOOST_TEST( p4.string() == "foobar" );
p4 = p4; // self-assignment
- BOOST_CHECK( p4.string() == "foobar" );
+ BOOST_TEST( p4.string() == "foobar" );
exception_tests();
name_function_tests();
@@ -258,7 +271,7 @@
p5 = s1;
PATH_CHECK( p5, "somestring" );
- BOOST_CHECK( p4.string() == path( p4.string().begin(), p4.string().end() ).string() );
+ BOOST_TEST( p4.string() == path( p4.string().begin(), p4.string().end() ).string() );
char c0 = 'a';
p5.assign( &c0, &c0 );
@@ -288,15 +301,15 @@
# endif
- BOOST_CHECK( p1 != p4 );
- BOOST_CHECK( p1.string() == p2.string() );
- BOOST_CHECK( p1.string() == p3.string() );
- BOOST_CHECK( path( "foo" ).filename() == "foo" );
- BOOST_CHECK( path( "foo" ).parent_path().string() == "" );
- BOOST_CHECK( p1.filename() == "fum" );
- BOOST_CHECK( p1.parent_path().string() == "fe/fi/fo" );
- BOOST_CHECK( path( "" ).empty() == true );
- BOOST_CHECK( path( "foo" ).empty() == false );
+ BOOST_TEST( p1 != p4 );
+ BOOST_TEST( p1.string() == p2.string() );
+ BOOST_TEST( p1.string() == p3.string() );
+ BOOST_TEST( path( "foo" ).filename() == "foo" );
+ BOOST_TEST( path( "foo" ).parent_path().string() == "" );
+ BOOST_TEST( p1.filename() == "fum" );
+ BOOST_TEST( p1.parent_path().string() == "fe/fi/fo" );
+ BOOST_TEST( path( "" ).empty() == true );
+ BOOST_TEST( path( "foo" ).empty() == false );
PATH_CHECK( "", "" );
@@ -457,35 +470,35 @@
path itr_ck = "";
path::const_iterator itr = itr_ck.begin();
- BOOST_CHECK( itr == itr_ck.end() );
+ BOOST_TEST( itr == itr_ck.end() );
itr_ck = "/";
itr = itr_ck.begin();
- BOOST_CHECK( *itr == std::string( "/" ) );
- BOOST_CHECK( ++itr == itr_ck.end() );
- BOOST_CHECK( *--itr == std::string( "/" ) );
+ BOOST_TEST( *itr == std::string( "/" ) );
+ BOOST_TEST( ++itr == itr_ck.end() );
+ BOOST_TEST( *--itr == std::string( "/" ) );
itr_ck = "foo";
- BOOST_CHECK( *itr_ck.begin() == std::string( "foo" ) );
- BOOST_CHECK( next( itr_ck.begin() ) == itr_ck.end() );
- BOOST_CHECK( *prior( itr_ck.end() ) == std::string( "foo" ) );
- BOOST_CHECK( prior( itr_ck.end() ) == itr_ck.begin() );
+ BOOST_TEST( *itr_ck.begin() == std::string( "foo" ) );
+ BOOST_TEST( next( itr_ck.begin() ) == itr_ck.end() );
+ BOOST_TEST( *prior( itr_ck.end() ) == std::string( "foo" ) );
+ BOOST_TEST( prior( itr_ck.end() ) == itr_ck.begin() );
itr_ck = path( "/foo" );
- BOOST_CHECK( *itr_ck.begin() == std::string( "/" ) );
- BOOST_CHECK( *next( itr_ck.begin() ) == std::string( "foo" ) );
- BOOST_CHECK( next(next( itr_ck.begin() )) == itr_ck.end() );
- BOOST_CHECK( next( itr_ck.begin() ) == prior( itr_ck.end() ) );
- BOOST_CHECK( *prior( itr_ck.end() ) == std::string( "foo" ) );
- BOOST_CHECK( *prior(prior( itr_ck.end() )) == std::string( "/" ) );
- BOOST_CHECK( prior(prior( itr_ck.end() )) == itr_ck.begin() );
+ 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() );
+ BOOST_TEST( next( itr_ck.begin() ) == prior( itr_ck.end() ) );
+ BOOST_TEST( *prior( itr_ck.end() ) == std::string( "foo" ) );
+ BOOST_TEST( *prior(prior( itr_ck.end() )) == std::string( "/" ) );
+ BOOST_TEST( prior(prior( itr_ck.end() )) == itr_ck.begin() );
itr_ck = "/foo/bar";
itr = itr_ck.begin();
- BOOST_CHECK( *itr == std::string( "/" ) );
- BOOST_CHECK( *++itr == std::string( "foo" ) );
- BOOST_CHECK( *++itr == std::string( "bar" ) );
- BOOST_CHECK( ++itr == itr_ck.end() );
+ BOOST_TEST( *itr == std::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, "/" );
@@ -494,7 +507,7 @@
itr = itr_ck.begin();
CHECK_EQUAL( *itr, ".." );
CHECK_EQUAL( *++itr, "f" );
- BOOST_CHECK( ++itr == itr_ck.end() );
+ BOOST_TEST( ++itr == itr_ck.end() );
CHECK_EQUAL( *--itr, "f" );
CHECK_EQUAL( *--itr, ".." );
@@ -505,7 +518,7 @@
CHECK_EQUAL( *++itr, "foo" );
CHECK_EQUAL( *++itr, "bar" );
CHECK_EQUAL( *++itr, "." );
- BOOST_CHECK( ++itr == itr_ck.end() );
+ BOOST_TEST( ++itr == itr_ck.end() );
CHECK_EQUAL( *--itr, "." );
CHECK_EQUAL( *--itr, "bar" );
CHECK_EQUAL( *--itr, "foo" );
@@ -518,7 +531,7 @@
CHECK_EQUAL( *++itr, "f" );
CHECK_EQUAL( *++itr, "b" );
CHECK_EQUAL( *++itr, "." );
- BOOST_CHECK( ++itr == itr_ck.end() );
+ BOOST_TEST( ++itr == itr_ck.end() );
CHECK_EQUAL( *--itr, "." );
CHECK_EQUAL( *--itr, "b" );
CHECK_EQUAL( *--itr, "f" );
@@ -529,14 +542,14 @@
// 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" );
- BOOST_CHECK( ++itr == itr_ck.end() );
+ BOOST_TEST( ++itr == itr_ck.end() );
CHECK_EQUAL( *--itr, "//net" );
itr_ck = "//net/";
itr = itr_ck.begin();
CHECK_EQUAL( *itr, "//net" );
CHECK_EQUAL( *++itr, "/" );
- BOOST_CHECK( ++itr == itr_ck.end() );
+ BOOST_TEST( ++itr == itr_ck.end() );
CHECK_EQUAL( *--itr, "/" );
CHECK_EQUAL( *--itr, "//net" );
@@ -546,7 +559,7 @@
CHECK_EQUAL( *++itr, "/" );
CHECK_EQUAL( *++itr, "bar" );
CHECK_EQUAL( *++itr, "." );
- BOOST_CHECK( ++itr == itr_ck.end() );
+ BOOST_TEST( ++itr == itr_ck.end() );
CHECK_EQUAL( *--itr, "." );
CHECK_EQUAL( *--itr, "bar" );
CHECK_EQUAL( *--itr, "/" );
@@ -559,7 +572,7 @@
CHECK_EQUAL( *++itr, "foo" );
CHECK_EQUAL( *++itr, "bar" );
CHECK_EQUAL( *++itr, "." );
- BOOST_CHECK( ++itr == itr_ck.end() );
+ BOOST_TEST( ++itr == itr_ck.end() );
CHECK_EQUAL( *--itr, "." );
CHECK_EQUAL( *--itr, "bar" );
CHECK_EQUAL( *--itr, "foo" );
@@ -571,80 +584,80 @@
itr = itr_ck.begin();
CHECK_EQUAL( *itr, "c:" );
CHECK_EQUAL( *++itr, "/" );
- BOOST_CHECK( ++itr == itr_ck.end() );
+ BOOST_TEST( ++itr == itr_ck.end() );
CHECK_EQUAL( *--itr, "/" );
CHECK_EQUAL( *--itr, "c:" );
itr_ck = "c:/foo";
itr = itr_ck.begin();
- BOOST_CHECK( *itr == std::string( "c:" ) );
- BOOST_CHECK( *++itr == std::string( "/" ) );
- BOOST_CHECK( *++itr == std::string( "foo" ) );
- BOOST_CHECK( ++itr == itr_ck.end() );
- BOOST_CHECK( *--itr == std::string( "foo" ) );
- BOOST_CHECK( *--itr == std::string( "/" ) );
- BOOST_CHECK( *--itr == std::string( "c:" ) );
+ 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 = "c:foo";
itr = itr_ck.begin();
- BOOST_CHECK( *itr == std::string( "c:" ) );
- BOOST_CHECK( *++itr == std::string( "foo" ) );
- BOOST_CHECK( ++itr == itr_ck.end() );
- BOOST_CHECK( *--itr == std::string( "foo" ) );
- BOOST_CHECK( *--itr == std::string( "c:" ) );
+ BOOST_TEST( *itr == std::string( "c:" ) );
+ BOOST_TEST( *++itr == std::string( "foo" ) );
+ BOOST_TEST( ++itr == itr_ck.end() );
+ BOOST_TEST( *--itr == std::string( "foo" ) );
+ BOOST_TEST( *--itr == std::string( "c:" ) );
itr_ck = "c:foo/";
itr = itr_ck.begin();
- BOOST_CHECK( *itr == std::string( "c:" ) );
- BOOST_CHECK( *++itr == std::string( "foo" ) );
- BOOST_CHECK( *++itr == std::string( "." ) );
- BOOST_CHECK( ++itr == itr_ck.end() );
- BOOST_CHECK( *--itr == std::string( "." ) );
- BOOST_CHECK( *--itr == std::string( "foo" ) );
- BOOST_CHECK( *--itr == std::string( "c:" ) );
+ BOOST_TEST( *itr == std::string( "c:" ) );
+ BOOST_TEST( *++itr == std::string( "foo" ) );
+ BOOST_TEST( *++itr == std::string( "." ) );
+ BOOST_TEST( ++itr == itr_ck.end() );
+ BOOST_TEST( *--itr == std::string( "." ) );
+ BOOST_TEST( *--itr == std::string( "foo" ) );
+ BOOST_TEST( *--itr == std::string( "c:" ) );
}
else
{
itr_ck = "///";
itr = itr_ck.begin();
CHECK_EQUAL( *itr, "/" );
- BOOST_CHECK( ++itr == itr_ck.end() );
+ BOOST_TEST( ++itr == itr_ck.end() );
}
path p;
p = "";
- BOOST_CHECK( p.relative_path().string() == "" );
- BOOST_CHECK( p.parent_path().string() == "" );
- BOOST_CHECK( p.filename() == "" );
- BOOST_CHECK( p.root_name() == "" );
- BOOST_CHECK( p.root_directory() == "" );
- BOOST_CHECK( p.root_path().string() == "" );
- BOOST_CHECK( !p.has_root_path() );
- BOOST_CHECK( !p.has_root_name() );
- BOOST_CHECK( !p.has_root_directory() );
- BOOST_CHECK( !p.has_relative_path() );
- BOOST_CHECK( !p.has_filename() );
- BOOST_CHECK( !p.has_parent_path() );
- BOOST_CHECK( !p.is_complete() );
+ BOOST_TEST( p.relative_path().string() == "" );
+ BOOST_TEST( p.parent_path().string() == "" );
+ BOOST_TEST( p.filename() == "" );
+ 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_filename() );
+ BOOST_TEST( !p.has_parent_path() );
+ BOOST_TEST( !p.is_complete() );
p = "/";
- BOOST_CHECK( p.relative_path().string() == "" );
- BOOST_CHECK( p.parent_path().string() == "" );
- BOOST_CHECK( p.filename() == "/" );
- BOOST_CHECK( p.root_name() == "" );
- BOOST_CHECK( p.root_directory() == "/" );
- BOOST_CHECK( p.root_path().string() == "/" );
- BOOST_CHECK( p.has_root_path() );
- BOOST_CHECK( !p.has_root_name() );
- BOOST_CHECK( p.has_root_directory() );
- BOOST_CHECK( !p.has_relative_path() );
- BOOST_CHECK( p.has_filename() );
- BOOST_CHECK( !p.has_parent_path() );
+ BOOST_TEST( p.relative_path().string() == "" );
+ BOOST_TEST( p.parent_path().string() == "" );
+ BOOST_TEST( p.filename() == "/" );
+ 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_filename() );
+ BOOST_TEST( !p.has_parent_path() );
if ( platform == "POSIX" )
- BOOST_CHECK( p.is_complete() );
+ BOOST_TEST( p.is_complete() );
else
- BOOST_CHECK( !p.is_complete() );
+ BOOST_TEST( !p.is_complete() );
p = "//";
CHECK_EQUAL( p.relative_path().string(), "" );
@@ -653,13 +666,13 @@
CHECK_EQUAL( p.root_name(), "//" );
CHECK_EQUAL( p.root_directory(), "" );
CHECK_EQUAL( p.root_path().string(), "//" );
- BOOST_CHECK( p.has_root_path() );
- BOOST_CHECK( p.has_root_name() );
- BOOST_CHECK( !p.has_root_directory() );
- BOOST_CHECK( !p.has_relative_path() );
- BOOST_CHECK( p.has_filename() );
- BOOST_CHECK( !p.has_parent_path() );
- BOOST_CHECK( !p.is_complete() );
+ 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_filename() );
+ BOOST_TEST( !p.has_parent_path() );
+ BOOST_TEST( !p.is_complete() );
p = "///";
@@ -669,61 +682,61 @@
CHECK_EQUAL( p.root_name(), "" );
CHECK_EQUAL( p.root_directory(), "/" );
CHECK_EQUAL( p.root_path().string(), "/" );
- BOOST_CHECK( p.has_root_path() );
- BOOST_CHECK( !p.has_root_name() );
- BOOST_CHECK( p.has_root_directory() );
- BOOST_CHECK( !p.has_relative_path() );
- BOOST_CHECK( p.has_filename() );
- BOOST_CHECK( !p.has_parent_path() );
+ 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_filename() );
+ BOOST_TEST( !p.has_parent_path() );
if ( platform == "POSIX" )
- BOOST_CHECK( p.is_complete() );
+ BOOST_TEST( p.is_complete() );
else
- BOOST_CHECK( !p.is_complete() );
+ BOOST_TEST( !p.is_complete() );
p = ".";
- BOOST_CHECK( p.relative_path().string() == "." );
- BOOST_CHECK( p.parent_path().string() == "" );
- BOOST_CHECK( p.filename() == "." );
- BOOST_CHECK( p.root_name() == "" );
- BOOST_CHECK( p.root_directory() == "" );
- BOOST_CHECK( p.root_path().string() == "" );
- BOOST_CHECK( !p.has_root_path() );
- BOOST_CHECK( !p.has_root_name() );
- BOOST_CHECK( !p.has_root_directory() );
- BOOST_CHECK( p.has_relative_path() );
- BOOST_CHECK( p.has_filename() );
- BOOST_CHECK( !p.has_parent_path() );
- BOOST_CHECK( !p.is_complete() );
+ BOOST_TEST( p.relative_path().string() == "." );
+ BOOST_TEST( p.parent_path().string() == "" );
+ BOOST_TEST( p.filename() == "." );
+ 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_filename() );
+ BOOST_TEST( !p.has_parent_path() );
+ BOOST_TEST( !p.is_complete() );
p = "..";
- BOOST_CHECK( p.relative_path().string() == ".." );
- BOOST_CHECK( p.parent_path().string() == "" );
- BOOST_CHECK( p.filename() == ".." );
- BOOST_CHECK( p.root_name() == "" );
- BOOST_CHECK( p.root_directory() == "" );
- BOOST_CHECK( p.root_path().string() == "" );
- BOOST_CHECK( !p.has_root_path() );
- BOOST_CHECK( !p.has_root_name() );
- BOOST_CHECK( !p.has_root_directory() );
- BOOST_CHECK( p.has_relative_path() );
- BOOST_CHECK( p.has_filename() );
- BOOST_CHECK( !p.has_parent_path() );
- BOOST_CHECK( !p.is_complete() );
+ BOOST_TEST( p.relative_path().string() == ".." );
+ BOOST_TEST( p.parent_path().string() == "" );
+ BOOST_TEST( p.filename() == ".." );
+ 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_filename() );
+ BOOST_TEST( !p.has_parent_path() );
+ BOOST_TEST( !p.is_complete() );
p = "foo";
- BOOST_CHECK( p.relative_path().string() == "foo" );
- BOOST_CHECK( p.parent_path().string() == "" );
- BOOST_CHECK( p.filename() == "foo" );
- BOOST_CHECK( p.root_name() == "" );
- BOOST_CHECK( p.root_directory() == "" );
- BOOST_CHECK( p.root_path().string() == "" );
- BOOST_CHECK( !p.has_root_path() );
- BOOST_CHECK( !p.has_root_name() );
- BOOST_CHECK( !p.has_root_directory() );
- BOOST_CHECK( p.has_relative_path() );
- BOOST_CHECK( p.has_filename() );
- BOOST_CHECK( !p.has_parent_path() );
- BOOST_CHECK( !p.is_complete() );
+ BOOST_TEST( p.relative_path().string() == "foo" );
+ BOOST_TEST( p.parent_path().string() == "" );
+ BOOST_TEST( p.filename() == "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_filename() );
+ BOOST_TEST( !p.has_parent_path() );
+ BOOST_TEST( !p.is_complete() );
p = "/foo";
CHECK_EQUAL( p.relative_path().string(), "foo" );
@@ -732,16 +745,16 @@
CHECK_EQUAL( p.root_name(), "" );
CHECK_EQUAL( p.root_directory(), "/" );
CHECK_EQUAL( p.root_path().string(), "/" );
- BOOST_CHECK( p.has_root_path() );
- BOOST_CHECK( !p.has_root_name() );
- BOOST_CHECK( p.has_root_directory() );
- BOOST_CHECK( p.has_relative_path() );
- BOOST_CHECK( p.has_filename() );
- BOOST_CHECK( p.has_parent_path() );
+ 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_filename() );
+ BOOST_TEST( p.has_parent_path() );
if ( platform == "POSIX" )
- BOOST_CHECK( p.is_complete() );
+ BOOST_TEST( p.is_complete() );
else
- BOOST_CHECK( !p.is_complete() );
+ BOOST_TEST( !p.is_complete() );
p = "/foo/";
CHECK_EQUAL( p.relative_path().string(), "foo/" );
@@ -750,16 +763,16 @@
CHECK_EQUAL( p.root_name(), "" );
CHECK_EQUAL( p.root_directory(), "/" );
CHECK_EQUAL( p.root_path().string(), "/" );
- BOOST_CHECK( p.has_root_path() );
- BOOST_CHECK( !p.has_root_name() );
- BOOST_CHECK( p.has_root_directory() );
- BOOST_CHECK( p.has_relative_path() );
- BOOST_CHECK( p.has_filename() );
- BOOST_CHECK( p.has_parent_path() );
+ 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_filename() );
+ BOOST_TEST( p.has_parent_path() );
if ( platform == "POSIX" )
- BOOST_CHECK( p.is_complete() );
+ BOOST_TEST( p.is_complete() );
else
- BOOST_CHECK( !p.is_complete() );
+ BOOST_TEST( !p.is_complete() );
p = "///foo";
CHECK_EQUAL( p.relative_path().string(), "foo" );
@@ -768,46 +781,46 @@
CHECK_EQUAL( p.root_name(), "" );
CHECK_EQUAL( p.root_directory(), "/" );
CHECK_EQUAL( p.root_path().string(), "/" );
- BOOST_CHECK( p.has_root_path() );
- BOOST_CHECK( !p.has_root_name() );
- BOOST_CHECK( p.has_root_directory() );
- BOOST_CHECK( p.has_relative_path() );
- BOOST_CHECK( p.has_filename() );
- BOOST_CHECK( p.has_parent_path() );
+ 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_filename() );
+ BOOST_TEST( p.has_parent_path() );
if ( platform == "POSIX" )
- BOOST_CHECK( p.is_complete() );
+ BOOST_TEST( p.is_complete() );
else
- BOOST_CHECK( !p.is_complete() );
+ BOOST_TEST( !p.is_complete() );
p = "foo/bar";
- BOOST_CHECK( p.relative_path().string() == "foo/bar" );
- BOOST_CHECK( p.parent_path().string() == "foo" );
- BOOST_CHECK( p.filename() == "bar" );
- BOOST_CHECK( p.root_name() == "" );
- BOOST_CHECK( p.root_directory() == "" );
- BOOST_CHECK( p.root_path().string() == "" );
- BOOST_CHECK( !p.has_root_path() );
- BOOST_CHECK( !p.has_root_name() );
- BOOST_CHECK( !p.has_root_directory() );
- BOOST_CHECK( p.has_relative_path() );
- BOOST_CHECK( p.has_filename() );
- BOOST_CHECK( p.has_parent_path() );
- BOOST_CHECK( !p.is_complete() );
+ BOOST_TEST( p.relative_path().string() == "foo/bar" );
+ BOOST_TEST( p.parent_path().string() == "foo" );
+ BOOST_TEST( p.filename() == "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_filename() );
+ BOOST_TEST( p.has_parent_path() );
+ BOOST_TEST( !p.is_complete() );
p = "../foo";
- BOOST_CHECK( p.relative_path().string() == "../foo" );
- BOOST_CHECK( p.parent_path().string() == ".." );
- BOOST_CHECK( p.filename() == "foo" );
- BOOST_CHECK( p.root_name() == "" );
- BOOST_CHECK( p.root_directory() == "" );
- BOOST_CHECK( p.root_path().string() == "" );
- BOOST_CHECK( !p.has_root_path() );
- BOOST_CHECK( !p.has_root_name() );
- BOOST_CHECK( !p.has_root_directory() );
- BOOST_CHECK( p.has_relative_path() );
- BOOST_CHECK( p.has_filename() );
- BOOST_CHECK( p.has_parent_path() );
- BOOST_CHECK( !p.is_complete() );
+ BOOST_TEST( p.relative_path().string() == "../foo" );
+ BOOST_TEST( p.parent_path().string() == ".." );
+ BOOST_TEST( p.filename() == "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_filename() );
+ BOOST_TEST( p.has_parent_path() );
+ BOOST_TEST( !p.is_complete() );
p = "..///foo";
CHECK_EQUAL( p.relative_path().string(), "..///foo" );
@@ -816,31 +829,31 @@
CHECK_EQUAL( p.root_name(), "" );
CHECK_EQUAL( p.root_directory(), "" );
CHECK_EQUAL( p.root_path().string(), "" );
- BOOST_CHECK( !p.has_root_path() );
- BOOST_CHECK( !p.has_root_name() );
- BOOST_CHECK( !p.has_root_directory() );
- BOOST_CHECK( p.has_relative_path() );
- BOOST_CHECK( p.has_filename() );
- BOOST_CHECK( p.has_parent_path() );
- BOOST_CHECK( !p.is_complete() );
+ 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_filename() );
+ BOOST_TEST( p.has_parent_path() );
+ BOOST_TEST( !p.is_complete() );
p = "/foo/bar";
- BOOST_CHECK( p.relative_path().string() == "foo/bar" );
- BOOST_CHECK( p.parent_path().string() == "/foo" );
- BOOST_CHECK( p.filename() == "bar" );
- BOOST_CHECK( p.root_name() == "" );
- BOOST_CHECK( p.root_directory() == "/" );
- BOOST_CHECK( p.root_path().string() == "/" );
- BOOST_CHECK( p.has_root_path() );
- BOOST_CHECK( !p.has_root_name() );
- BOOST_CHECK( p.has_root_directory() );
- BOOST_CHECK( p.has_relative_path() );
- BOOST_CHECK( p.has_filename() );
- BOOST_CHECK( p.has_parent_path() );
+ BOOST_TEST( p.relative_path().string() == "foo/bar" );
+ BOOST_TEST( p.parent_path().string() == "/foo" );
+ BOOST_TEST( p.filename() == "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_filename() );
+ BOOST_TEST( p.has_parent_path() );
if ( platform == "POSIX" )
- BOOST_CHECK( p.is_complete() );
+ BOOST_TEST( p.is_complete() );
else
- BOOST_CHECK( !p.is_complete() );
+ BOOST_TEST( !p.is_complete() );
// Both POSIX and Windows allow two leading slashs
// (POSIX meaning is implementation defined)
@@ -856,43 +869,43 @@
CHECK_EQUAL( p.root_name(), "//net" );
CHECK_EQUAL( p.root_directory(), "" );
CHECK_EQUAL( p.root_path().string(), "//net" );
- BOOST_CHECK( p.has_root_path() );
- BOOST_CHECK( p.has_root_name() );
- BOOST_CHECK( !p.has_root_directory() );
- BOOST_CHECK( !p.has_relative_path() );
- BOOST_CHECK( p.has_filename() );
- BOOST_CHECK( !p.has_parent_path() );
- BOOST_CHECK( !p.is_complete() );
+ 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_filename() );
+ BOOST_TEST( !p.has_parent_path() );
+ BOOST_TEST( !p.is_complete() );
p = path( "//net/" );
- BOOST_CHECK( p.relative_path().string() == "" );
- BOOST_CHECK( p.parent_path().string() == "//net" );
- BOOST_CHECK( p.filename() == "/" );
- BOOST_CHECK( p.root_name() == "//net" );
- BOOST_CHECK( p.root_directory() == "/" );
- BOOST_CHECK( p.root_path().string() == "//net/" );
- BOOST_CHECK( p.has_root_path() );
- BOOST_CHECK( p.has_root_name() );
- BOOST_CHECK( p.has_root_directory() );
- BOOST_CHECK( !p.has_relative_path() );
- BOOST_CHECK( p.has_filename() );
- BOOST_CHECK( p.has_parent_path() );
- BOOST_CHECK( p.is_complete() );
+ BOOST_TEST( p.relative_path().string() == "" );
+ BOOST_TEST( p.parent_path().string() == "//net" );
+ BOOST_TEST( p.filename() == "/" );
+ BOOST_TEST( p.root_name() == "//net" );
+ BOOST_TEST( p.root_directory() == "/" );
+ BOOST_TEST( p.root_path().string() == "//net/" );
+ 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_filename() );
+ BOOST_TEST( p.has_parent_path() );
+ BOOST_TEST( p.is_complete() );
p = path( "//net/foo" );
- BOOST_CHECK( p.relative_path().string() == "foo" );
- BOOST_CHECK( p.parent_path().string() == "//net/" );
- BOOST_CHECK( p.filename() == "foo" );
- BOOST_CHECK( p.root_name() == "//net" );
- BOOST_CHECK( p.root_directory() == "/" );
- BOOST_CHECK( p.root_path().string() == "//net/" );
- BOOST_CHECK( p.has_root_path() );
- BOOST_CHECK( p.has_root_name() );
- BOOST_CHECK( p.has_root_directory() );
- BOOST_CHECK( p.has_relative_path() );
- BOOST_CHECK( p.has_filename() );
- BOOST_CHECK( p.has_parent_path() );
- BOOST_CHECK( p.is_complete() );
+ BOOST_TEST( p.relative_path().string() == "foo" );
+ BOOST_TEST( p.parent_path().string() == "//net/" );
+ BOOST_TEST( p.filename() == "foo" );
+ BOOST_TEST( p.root_name() == "//net" );
+ BOOST_TEST( p.root_directory() == "/" );
+ BOOST_TEST( p.root_path().string() == "//net/" );
+ 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_filename() );
+ BOOST_TEST( p.has_parent_path() );
+ BOOST_TEST( p.is_complete() );
p = path( "//net///foo" );
CHECK_EQUAL( p.relative_path().string(), "foo" );
@@ -901,13 +914,13 @@
CHECK_EQUAL( p.root_name(), "//net" );
CHECK_EQUAL( p.root_directory(), "/" );
CHECK_EQUAL( p.root_path().string(), "//net/" );
- BOOST_CHECK( p.has_root_path() );
- BOOST_CHECK( p.has_root_name() );
- BOOST_CHECK( p.has_root_directory() );
- BOOST_CHECK( p.has_relative_path() );
- BOOST_CHECK( p.has_filename() );
- BOOST_CHECK( p.has_parent_path() );
- BOOST_CHECK( p.is_complete() );
+ 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_filename() );
+ BOOST_TEST( p.has_parent_path() );
+ BOOST_TEST( p.is_complete() );
if ( platform == "Windows" )
{
@@ -957,64 +970,64 @@
PATH_CHECK( path( "prn:" ), "prn:" );
p = path( "c:" );
- BOOST_CHECK( p.relative_path().string() == "" );
- BOOST_CHECK( p.parent_path().string() == "" );
- BOOST_CHECK( p.filename() == "c:" );
- BOOST_CHECK( p.root_name() == "c:" );
- BOOST_CHECK( p.root_directory() == "" );
- BOOST_CHECK( p.root_path().string() == "c:" );
- BOOST_CHECK( p.has_root_path() );
- BOOST_CHECK( p.has_root_name() );
- BOOST_CHECK( !p.has_root_directory() );
- BOOST_CHECK( !p.has_relative_path() );
- BOOST_CHECK( p.has_filename() );
- BOOST_CHECK( !p.has_parent_path() );
- BOOST_CHECK( !p.is_complete() );
+ BOOST_TEST( p.relative_path().string() == "" );
+ BOOST_TEST( p.parent_path().string() == "" );
+ BOOST_TEST( p.filename() == "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_filename() );
+ BOOST_TEST( !p.has_parent_path() );
+ BOOST_TEST( !p.is_complete() );
p = path( "c:foo" );
- BOOST_CHECK( p.relative_path().string() == "foo" );
- BOOST_CHECK( p.parent_path().string() == "c:" );
- BOOST_CHECK( p.filename() == "foo" );
- BOOST_CHECK( p.root_name() == "c:" );
- BOOST_CHECK( p.root_directory() == "" );
- BOOST_CHECK( p.root_path().string() == "c:" );
- BOOST_CHECK( p.has_root_path() );
- BOOST_CHECK( p.has_root_name() );
- BOOST_CHECK( !p.has_root_directory() );
- BOOST_CHECK( p.has_relative_path() );
- BOOST_CHECK( p.has_filename() );
- BOOST_CHECK( p.has_parent_path() );
- BOOST_CHECK( !p.is_complete() );
+ BOOST_TEST( p.relative_path().string() == "foo" );
+ BOOST_TEST( p.parent_path().string() == "c:" );
+ BOOST_TEST( p.filename() == "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_filename() );
+ BOOST_TEST( p.has_parent_path() );
+ BOOST_TEST( !p.is_complete() );
p = path( "c:/" );
- BOOST_CHECK( p.relative_path().string() == "" );
- BOOST_CHECK( p.parent_path().string() == "c:" );
- BOOST_CHECK( p.filename() == "/" );
- BOOST_CHECK( p.root_name() == "c:" );
- BOOST_CHECK( p.root_directory() == "/" );
- BOOST_CHECK( p.root_path().string() == "c:/" );
- BOOST_CHECK( p.has_root_path() );
- BOOST_CHECK( p.has_root_name() );
- BOOST_CHECK( p.has_root_directory() );
- BOOST_CHECK( !p.has_relative_path() );
- BOOST_CHECK( p.has_filename() );
- BOOST_CHECK( p.has_parent_path() );
- BOOST_CHECK( p.is_complete() );
+ BOOST_TEST( p.relative_path().string() == "" );
+ BOOST_TEST( p.parent_path().string() == "c:" );
+ BOOST_TEST( p.filename() == "/" );
+ 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_filename() );
+ BOOST_TEST( p.has_parent_path() );
+ BOOST_TEST( p.is_complete() );
p = path( "c:.." );
- BOOST_CHECK( p.relative_path().string() == ".." );
- BOOST_CHECK( p.parent_path().string() == "c:" );
- BOOST_CHECK( p.filename() == ".." );
- BOOST_CHECK( p.root_name() == "c:" );
- BOOST_CHECK( p.root_directory() == "" );
- BOOST_CHECK( p.root_path().string() == "c:" );
- BOOST_CHECK( p.has_root_path() );
- BOOST_CHECK( p.has_root_name() );
- BOOST_CHECK( !p.has_root_directory() );
- BOOST_CHECK( p.has_relative_path() );
- BOOST_CHECK( p.has_filename() );
- BOOST_CHECK( p.has_parent_path() );
- BOOST_CHECK( !p.is_complete() );
+ BOOST_TEST( p.relative_path().string() == ".." );
+ BOOST_TEST( p.parent_path().string() == "c:" );
+ BOOST_TEST( p.filename() == ".." );
+ 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_filename() );
+ BOOST_TEST( p.has_parent_path() );
+ BOOST_TEST( !p.is_complete() );
p = path( "c:/foo" );
CHECK_EQUAL( p.relative_path().string(), "foo" );
@@ -1023,13 +1036,13 @@
CHECK_EQUAL( p.root_name(), "c:" );
CHECK_EQUAL( p.root_directory(), "/" );
CHECK_EQUAL( p.root_path().string(), "c:/" );
- BOOST_CHECK( p.has_root_path() );
- BOOST_CHECK( p.has_root_name() );
- BOOST_CHECK( p.has_root_directory() );
- BOOST_CHECK( p.has_relative_path() );
- BOOST_CHECK( p.has_filename() );
- BOOST_CHECK( p.has_parent_path() );
- BOOST_CHECK( p.is_complete() );
+ 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_filename() );
+ BOOST_TEST( p.has_parent_path() );
+ BOOST_TEST( p.is_complete() );
p = path( "c://foo" );
CHECK_EQUAL( p.relative_path().string(), "foo" );
@@ -1038,13 +1051,13 @@
CHECK_EQUAL( p.root_name(), "c:" );
CHECK_EQUAL( p.root_directory(), "/" );
CHECK_EQUAL( p.root_path().string(), "c:/" );
- BOOST_CHECK( p.has_root_path() );
- BOOST_CHECK( p.has_root_name() );
- BOOST_CHECK( p.has_root_directory() );
- BOOST_CHECK( p.has_relative_path() );
- BOOST_CHECK( p.has_filename() );
- BOOST_CHECK( p.has_parent_path() );
- BOOST_CHECK( p.is_complete() );
+ 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_filename() );
+ BOOST_TEST( p.has_parent_path() );
+ BOOST_TEST( p.is_complete() );
p = path( "c:\\foo\\bar" );
CHECK_EQUAL( p.relative_path().string(), "foo/bar" );
@@ -1053,28 +1066,28 @@
CHECK_EQUAL( p.root_name(), "c:" );
CHECK_EQUAL( p.root_directory(), "/" );
CHECK_EQUAL( p.root_path().string(), "c:/" );
- BOOST_CHECK( p.has_root_path() );
- BOOST_CHECK( p.has_root_name() );
- BOOST_CHECK( p.has_root_directory() );
- BOOST_CHECK( p.has_relative_path() );
- BOOST_CHECK( p.has_filename() );
- BOOST_CHECK( p.has_parent_path() );
- BOOST_CHECK( p.is_complete() );
+ 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_filename() );
+ BOOST_TEST( p.has_parent_path() );
+ BOOST_TEST( p.is_complete() );
p = path( "prn:" );
- BOOST_CHECK( p.relative_path().string() == "" );
- BOOST_CHECK( p.parent_path().string() == "" );
- BOOST_CHECK( p.filename() == "prn:" );
- BOOST_CHECK( p.root_name() == "prn:" );
- BOOST_CHECK( p.root_directory() == "" );
- BOOST_CHECK( p.root_path().string() == "prn:" );
- BOOST_CHECK( p.has_root_path() );
- BOOST_CHECK( p.has_root_name() );
- BOOST_CHECK( !p.has_root_directory() );
- BOOST_CHECK( !p.has_relative_path() );
- BOOST_CHECK( p.has_filename() );
- BOOST_CHECK( !p.has_parent_path() );
- BOOST_CHECK( !p.is_complete() );
+ BOOST_TEST( p.relative_path().string() == "" );
+ BOOST_TEST( p.parent_path().string() == "" );
+ BOOST_TEST( p.filename() == "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_filename() );
+ BOOST_TEST( !p.has_parent_path() );
+ BOOST_TEST( !p.is_complete() );
p = path( "\\\\net\\\\\\foo" );
CHECK_EQUAL( p.relative_path().string(), "foo" );
@@ -1083,75 +1096,75 @@
CHECK_EQUAL( p.root_name(), "//net" );
CHECK_EQUAL( p.root_directory(), "/" );
CHECK_EQUAL( p.root_path().string(), "//net/" );
- BOOST_CHECK( p.has_root_path() );
- BOOST_CHECK( p.has_root_name() );
- BOOST_CHECK( p.has_root_directory() );
- BOOST_CHECK( p.has_relative_path() );
- BOOST_CHECK( p.has_filename() );
- BOOST_CHECK( p.has_parent_path() );
- BOOST_CHECK( p.is_complete() );
+ 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_filename() );
+ BOOST_TEST( p.has_parent_path() );
+ BOOST_TEST( p.is_complete() );
itr_ck = path( "c:" );
- BOOST_CHECK( *itr_ck.begin() == std::string( "c:" ) );
- BOOST_CHECK( next( itr_ck.begin() ) == itr_ck.end() );
- BOOST_CHECK( prior( itr_ck.end() ) == itr_ck.begin() );
- BOOST_CHECK( *prior( itr_ck.end() ) == std::string( "c:" ) );
+ 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:/" );
- BOOST_CHECK( *itr_ck.begin() == std::string( "c:" ) );
- BOOST_CHECK( *next( itr_ck.begin() ) == std::string( "/" ) );
- BOOST_CHECK( next( next( itr_ck.begin() )) == itr_ck.end() );
- BOOST_CHECK( prior( prior( itr_ck.end() )) == itr_ck.begin() );
- BOOST_CHECK( *prior( itr_ck.end() ) == std::string( "/" ) );
- BOOST_CHECK( *prior( 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" );
- BOOST_CHECK( *itr_ck.begin() == std::string( "c:" ) );
- BOOST_CHECK( *next( itr_ck.begin() ) == std::string( "foo" ) );
- BOOST_CHECK( next(next( itr_ck.begin() )) == itr_ck.end() );
- BOOST_CHECK( prior(prior( itr_ck.end() )) == itr_ck.begin() );
- BOOST_CHECK( *prior( itr_ck.end() ) == std::string( "foo" ) );
- BOOST_CHECK( *prior(prior( itr_ck.end() )) == std::string( "c:" ) );
+ 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" );
- BOOST_CHECK( *itr_ck.begin() == std::string( "c:" ) );
- BOOST_CHECK( *next( itr_ck.begin() ) == std::string( "/" ) );
- BOOST_CHECK( *next( next( itr_ck.begin() )) == std::string( "foo" ) );
- BOOST_CHECK( next( next( next( itr_ck.begin() ))) == itr_ck.end() );
- BOOST_CHECK( prior( prior( prior( itr_ck.end() ))) == itr_ck.begin() );
- BOOST_CHECK( *prior( itr_ck.end() ) == std::string( "foo" ) );
- BOOST_CHECK( *prior( prior( itr_ck.end() )) == std::string( "/" ) );
- BOOST_CHECK( *prior( prior( 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() )) == 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( "//net" );
- BOOST_CHECK( *itr_ck.begin() == std::string( "//net" ) );
- BOOST_CHECK( next( itr_ck.begin() ) == itr_ck.end() );
- BOOST_CHECK( prior( itr_ck.end() ) == itr_ck.begin() );
- BOOST_CHECK( *prior( itr_ck.end() ) == std::string( "//net" ) );
+ BOOST_TEST( *itr_ck.begin() == std::string( "//net" ) );
+ 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( "//net" ) );
itr_ck = path( "//net/" );
CHECK_EQUAL( *itr_ck.begin(), "//net" );
CHECK_EQUAL( *next( itr_ck.begin() ), "/" );
- BOOST_CHECK( next(next( itr_ck.begin() )) == itr_ck.end() );
- BOOST_CHECK( prior(prior( itr_ck.end() )) == itr_ck.begin() );
+ 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" );
itr_ck = path( "//net/foo" );
- BOOST_CHECK( *itr_ck.begin() == std::string( "//net" ) );
- BOOST_CHECK( *next( itr_ck.begin() ) == std::string( "/" ) );
- BOOST_CHECK( *next(next( itr_ck.begin() )) == std::string( "foo" ) );
- BOOST_CHECK( next(next(next( itr_ck.begin() ))) == itr_ck.end() );
- BOOST_CHECK( prior(prior(prior( itr_ck.end() ))) == itr_ck.begin() );
- BOOST_CHECK( *prior( itr_ck.end() ) == std::string( "foo" ) );
- BOOST_CHECK( *prior(prior( itr_ck.end() )) == std::string( "/" ) );
- BOOST_CHECK( *prior(prior(prior( itr_ck.end() ))) == std::string( "//net" ) );
+ BOOST_TEST( *itr_ck.begin() == std::string( "//net" ) );
+ 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( "//net" ) );
itr_ck = path( "prn:" );
- BOOST_CHECK( *itr_ck.begin() == std::string( "prn:" ) );
- BOOST_CHECK( next( itr_ck.begin() ) == itr_ck.end() );
- BOOST_CHECK( prior( itr_ck.end() ) == itr_ck.begin() );
- BOOST_CHECK( *prior( itr_ck.end() ) == std::string( "prn:" ) );
+ 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:" ) );
} // Windows
else
@@ -1161,7 +1174,7 @@
DIR_CHECK( path( "///foo///bar///" ), "///foo///bar///" );
p = path( "/usr/local/bin:/usr/bin:/bin" );
- BOOST_CHECK( p.file_string() == "/usr/local/bin:/usr/bin:/bin" );
+ BOOST_TEST( p.file_string() == "/usr/local/bin:/usr/bin:/bin" );
} // POSIX
// test non-member functions, particularly operator overloads
@@ -1185,137 +1198,137 @@
// swap
a.swap( b );
- BOOST_CHECK( a.string() == "b" );
- BOOST_CHECK( b.string() == "a" );
+ BOOST_TEST( a.string() == "b" );
+ BOOST_TEST( b.string() == "a" );
fs::swap( a, b );
- BOOST_CHECK( a.string() == "a" );
- BOOST_CHECK( b.string() == "b" );
+ BOOST_TEST( a.string() == "a" );
+ BOOST_TEST( b.string() == "b" );
// probe operator /
- BOOST_CHECK( (b / a).string() == "b/a" );
- BOOST_CHECK( (bs / a).string() == "b/a" );
- BOOST_CHECK( (bcs / a).string() == "b/a" );
- BOOST_CHECK( (b / as).string() == "b/a" );
- BOOST_CHECK( (b / acs).string() == "b/a" );
+ 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" );
// probe operator <
- BOOST_CHECK( !(e < e2) );
- BOOST_CHECK( !(es < e2) );
- BOOST_CHECK( !(ecs < e2) );
- BOOST_CHECK( !(e < es2) );
- BOOST_CHECK( !(e < ecs2) );
-
- BOOST_CHECK( e < a );
- BOOST_CHECK( es < a );
- BOOST_CHECK( ecs < a );
- BOOST_CHECK( e < as );
- BOOST_CHECK( e < acs );
-
- BOOST_CHECK( a < b );
- BOOST_CHECK( as < b );
- BOOST_CHECK( acs < b );
- BOOST_CHECK( a < bs );
- BOOST_CHECK( a < bcs );
-
- BOOST_CHECK( !(a < a2) );
- BOOST_CHECK( !(as < a2) );
- BOOST_CHECK( !(acs < a2) );
- BOOST_CHECK( !(a < as2) );
- BOOST_CHECK( !(a < acs2) );
+ BOOST_TEST( !(e < e2) );
+ BOOST_TEST( !(es < e2) );
+ BOOST_TEST( !(ecs < e2) );
+ BOOST_TEST( !(e < es2) );
+ BOOST_TEST( !(e < ecs2) );
+
+ BOOST_TEST( e < a );
+ BOOST_TEST( es < a );
+ BOOST_TEST( ecs < a );
+ BOOST_TEST( e < as );
+ BOOST_TEST( e < acs );
+
+ BOOST_TEST( a < b );
+ BOOST_TEST( as < b );
+ BOOST_TEST( acs < b );
+ BOOST_TEST( a < bs );
+ BOOST_TEST( a < bcs );
+
+ BOOST_TEST( !(a < a2) );
+ BOOST_TEST( !(as < a2) );
+ BOOST_TEST( !(acs < a2) );
+ BOOST_TEST( !(a < as2) );
+ BOOST_TEST( !(a < acs2) );
// make sure basic_path overloads don't conflict with std::string overloads
- BOOST_CHECK( !(as < as) );
- BOOST_CHECK( !(as < acs) );
- BOOST_CHECK( !(acs < as) );
+ BOOST_TEST( !(as < as) );
+ BOOST_TEST( !(as < acs) );
+ BOOST_TEST( !(acs < as) );
// reality check character set is as expected
- BOOST_CHECK( std::string("a.b") < std::string("a/b") );
+ BOOST_TEST( std::string("a.b") < std::string("a/b") );
// verify compare is actually lexicographical
- BOOST_CHECK( path("a/b") < path("a.b") );
+ BOOST_TEST( path("a/b") < path("a.b") );
// make sure the derivative operators also work
- BOOST_CHECK( a == a2 );
- BOOST_CHECK( as == a2 );
- BOOST_CHECK( acs == a2 );
- BOOST_CHECK( a == as2 );
- BOOST_CHECK( a == acs2 );
-
- BOOST_CHECK( a != b );
- BOOST_CHECK( as != b );
- BOOST_CHECK( acs != b );
- BOOST_CHECK( a != bs );
- BOOST_CHECK( a != bcs );
-
- BOOST_CHECK( b > a );
- BOOST_CHECK( b > as );
- BOOST_CHECK( b > acs );
- BOOST_CHECK( bs > a);
- BOOST_CHECK( bcs > a);
-
- BOOST_CHECK( !(a2 > a) );
- BOOST_CHECK( !(a2 > as) );
- BOOST_CHECK( !(a2 > acs) );
- BOOST_CHECK( !(as2 > a) );
- BOOST_CHECK( !(acs2 > a) );
-
- BOOST_CHECK( a <= b );
- BOOST_CHECK( as <= b );
- BOOST_CHECK( acs <= b );
- BOOST_CHECK( a <= bs );
- BOOST_CHECK( a <= bcs );
-
- BOOST_CHECK( a <= a2 );
- BOOST_CHECK( as <= a2 );
- BOOST_CHECK( acs <= a2 );
- BOOST_CHECK( a <= as2 );
- BOOST_CHECK( a <= acs2 );
-
- BOOST_CHECK( b >= a );
- BOOST_CHECK( bs >= a );
- BOOST_CHECK( bcs >= a );
- BOOST_CHECK( b >= as );
- BOOST_CHECK( b >= acs );
-
- BOOST_CHECK( a2 >= a );
- BOOST_CHECK( as2 >= a );
- BOOST_CHECK( acs2 >= a );
- BOOST_CHECK( a2 >= as );
- BOOST_CHECK( a2 >= acs );
+ BOOST_TEST( a == a2 );
+ BOOST_TEST( as == a2 );
+ BOOST_TEST( acs == a2 );
+ BOOST_TEST( a == as2 );
+ BOOST_TEST( a == acs2 );
+
+ BOOST_TEST( a != b );
+ BOOST_TEST( as != b );
+ BOOST_TEST( acs != b );
+ BOOST_TEST( a != bs );
+ BOOST_TEST( a != bcs );
+
+ BOOST_TEST( b > a );
+ BOOST_TEST( b > as );
+ BOOST_TEST( b > acs );
+ BOOST_TEST( bs > a);
+ BOOST_TEST( bcs > a);
+
+ BOOST_TEST( !(a2 > a) );
+ BOOST_TEST( !(a2 > as) );
+ BOOST_TEST( !(a2 > acs) );
+ BOOST_TEST( !(as2 > a) );
+ BOOST_TEST( !(acs2 > a) );
+
+ BOOST_TEST( a <= b );
+ BOOST_TEST( as <= b );
+ BOOST_TEST( acs <= b );
+ BOOST_TEST( a <= bs );
+ BOOST_TEST( a <= bcs );
+
+ BOOST_TEST( a <= a2 );
+ BOOST_TEST( as <= a2 );
+ BOOST_TEST( acs <= a2 );
+ BOOST_TEST( a <= as2 );
+ BOOST_TEST( a <= acs2 );
+
+ BOOST_TEST( b >= a );
+ BOOST_TEST( bs >= a );
+ BOOST_TEST( bcs >= a );
+ BOOST_TEST( b >= as );
+ BOOST_TEST( b >= acs );
+
+ BOOST_TEST( a2 >= a );
+ BOOST_TEST( as2 >= a );
+ BOOST_TEST( acs2 >= a );
+ BOOST_TEST( a2 >= as );
+ BOOST_TEST( a2 >= acs );
// extension() tests
- BOOST_CHECK( path("a/b").extension() == "" );
- BOOST_CHECK( path("a/b.txt").extension() == ".txt" );
- BOOST_CHECK( path("a/b.").extension() == "." );
- BOOST_CHECK( path("a.b.c").extension() == ".c" );
- BOOST_CHECK( path("a.b.c.").extension() == "." );
- BOOST_CHECK( path("").extension() == "" );
- BOOST_CHECK( path("a/").extension() == "." );
+ BOOST_TEST( path("a/b").extension() == "" );
+ BOOST_TEST( path("a/b.txt").extension() == ".txt" );
+ BOOST_TEST( path("a/b.").extension() == "." );
+ BOOST_TEST( path("a.b.c").extension() == ".c" );
+ BOOST_TEST( path("a.b.c.").extension() == "." );
+ BOOST_TEST( path("").extension() == "" );
+ BOOST_TEST( path("a/").extension() == "." );
// stem() tests
- BOOST_CHECK( path("b").stem() == "b" );
- BOOST_CHECK( path("a/b.txt").stem() == "b" );
- BOOST_CHECK( path("a/b.").stem() == "b" );
- BOOST_CHECK( path("a.b.c").stem() == "a.b" );
- BOOST_CHECK( path("a.b.c.").stem() == "a.b.c" );
- BOOST_CHECK( path("").stem() == "" );
+ BOOST_TEST( path("b").stem() == "b" );
+ BOOST_TEST( path("a/b.txt").stem() == "b" );
+ BOOST_TEST( path("a/b.").stem() == "b" );
+ BOOST_TEST( path("a.b.c").stem() == "a.b" );
+ BOOST_TEST( path("a.b.c.").stem() == "a.b.c" );
+ BOOST_TEST( path("").stem() == "" );
// replace_extension() tests
- BOOST_CHECK( path("a.txt").replace_extension("").string() == "a" );
- BOOST_CHECK( path("a.txt").replace_extension(".").string() == "a." );
- BOOST_CHECK( path("a.txt").replace_extension(".tex").string() == "a.tex" );
- BOOST_CHECK( path("a.txt").replace_extension("tex").string() == "a.tex" );
- BOOST_CHECK( path("a.").replace_extension(".tex").string() == "a.tex" );
- BOOST_CHECK( path("a.").replace_extension("tex").string() == "a.tex" );
- BOOST_CHECK( path("a").replace_extension(".txt").string() == "a.txt" );
- BOOST_CHECK( path("a").replace_extension("txt").string() == "a.txt" );
- BOOST_CHECK( path("a.b.txt" ).replace_extension(".tex").string() == "a.b.tex" );
- BOOST_CHECK( path("a.b.txt" ).replace_extension("tex").string() == "a.b.tex" );
+ BOOST_TEST( path("a.txt").replace_extension("").string() == "a" );
+ BOOST_TEST( path("a.txt").replace_extension(".").string() == "a." );
+ BOOST_TEST( path("a.txt").replace_extension(".tex").string() == "a.tex" );
+ BOOST_TEST( path("a.txt").replace_extension("tex").string() == "a.tex" );
+ BOOST_TEST( path("a.").replace_extension(".tex").string() == "a.tex" );
+ BOOST_TEST( path("a.").replace_extension("tex").string() == "a.tex" );
+ BOOST_TEST( path("a").replace_extension(".txt").string() == "a.txt" );
+ BOOST_TEST( path("a").replace_extension("txt").string() == "a.txt" );
+ BOOST_TEST( path("a.b.txt" ).replace_extension(".tex").string() == "a.b.tex" );
+ BOOST_TEST( path("a.b.txt" ).replace_extension("tex").string() == "a.b.tex" );
// see the rationale in html docs for explanation why this works
- BOOST_CHECK( path("").replace_extension(".png").string() == ".png" );
+ BOOST_TEST( path("").replace_extension(".png").string() == ".png" );
// inserter and extractor tests
# if !defined( BOOST_MSVC ) || BOOST_MSVC > 1300 // bypass VC++ 7.0 and earlier
@@ -1324,12 +1337,9 @@
ss << fs::path( "foo/bar" ) << std::endl;
fs::path round_trip;
ss >> round_trip;
- BOOST_CHECK( round_trip.string() == "foo/bar" );
+ BOOST_TEST( round_trip.string() == "foo/bar" );
std::cout << round_trip.string() << "..." << round_trip << " complete\n";
# endif
-
- std::cout << errors << " errors detected\n";
-
- return errors;
+ return ::boost::report_errors();
}
Modified: branches/release/libs/filesystem/test/wide_test.cpp
==============================================================================
--- branches/release/libs/filesystem/test/wide_test.cpp (original)
+++ branches/release/libs/filesystem/test/wide_test.cpp 2009-04-15 08:17:22 EDT (Wed, 15 Apr 2009)
@@ -21,7 +21,7 @@
#include <boost/filesystem/operations.hpp>
#include <boost/filesystem/fstream.hpp>
#include <boost/scoped_array.hpp>
-#include <boost/test/minimal.hpp>
+#include <boost/detail/lightweight_test.hpp>
#include "../src/utf8_codecvt_facet.hpp"
@@ -60,37 +60,37 @@
{
Path tmp;
tmp = file;
- BOOST_CHECK( tmp == file );
+ BOOST_TEST( tmp == file );
tmp = file.string();
- BOOST_CHECK( tmp == file );
+ BOOST_TEST( tmp == file );
tmp = file.string().c_str();
- BOOST_CHECK( tmp == file );
+ BOOST_TEST( tmp == file );
fs::initial_path<Path>();
fs::current_path<Path>();
fs::remove( dir / file );
fs::remove( dir );
- BOOST_CHECK( !fs::exists( dir / file ) );
- BOOST_CHECK( !fs::exists( dir ) );
- BOOST_CHECK( fs::create_directory( dir ) );
- BOOST_CHECK( fs::exists( dir ) );
- BOOST_CHECK( fs::is_directory( dir ) );
- BOOST_CHECK( fs::is_empty( dir ) );
+ BOOST_TEST( !fs::exists( dir / file ) );
+ BOOST_TEST( !fs::exists( dir ) );
+ BOOST_TEST( fs::create_directory( dir ) );
+ BOOST_TEST( fs::exists( dir ) );
+ BOOST_TEST( fs::is_directory( dir ) );
+ BOOST_TEST( fs::is_empty( dir ) );
create_file( dir / file, "wide_test file contents" );
- BOOST_CHECK( fs::exists( dir / file ) );
- BOOST_CHECK( !fs::is_directory( dir / file ) );
- BOOST_CHECK( !fs::is_empty( dir / file ) );
- BOOST_CHECK( fs::file_size( dir / file ) == 23 || fs::file_size( dir / file ) == 24 );
- BOOST_CHECK( fs::equivalent( dir / file, dot / dir / file ) );
- BOOST_CHECK( fs::last_write_time( dir / file ) );
+ BOOST_TEST( fs::exists( dir / file ) );
+ BOOST_TEST( !fs::is_directory( dir / file ) );
+ BOOST_TEST( !fs::is_empty( dir / file ) );
+ BOOST_TEST( fs::file_size( dir / file ) == 23 || fs::file_size( dir / file ) == 24 );
+ BOOST_TEST( fs::equivalent( dir / file, dot / dir / file ) );
+ BOOST_TEST( fs::last_write_time( dir / file ) );
typedef fs::basic_directory_iterator<Path> it_t;
int count(0);
for ( it_t it( dir ); it != it_t(); ++it )
{
- BOOST_CHECK( it->path() == dir / file );
- BOOST_CHECK( !fs::is_empty( it->path() ) );
+ BOOST_TEST( it->path() == dir / file );
+ BOOST_TEST( !fs::is_empty( it->path() ) );
++count;
}
- BOOST_CHECK( count == 1 );
+ BOOST_TEST( count == 1 );
if ( cleanup )
{
fs::remove( dir / file );
@@ -118,9 +118,9 @@
} // unnamed namespace
-// test_main ---------------------------------------------------------------//
+// main ------------------------------------------------------------------------------//
-int test_main( int argc, char * /*argv*/[] )
+int main( int argc, char * /*argv*/[] )
{
if ( argc > 1 ) cleanup = false;
@@ -134,8 +134,8 @@
for (std::size_t i = 0; i < s.size(); ++i )
std::cout << std::hex << int( static_cast<unsigned char>(s[i]) ) << " ";
std::cout << std::dec << std::endl;
- BOOST_CHECK( to_external( L"\x2780" ).size() == 3 );
- BOOST_CHECK( to_external( L"\x2780" ) == "\xE2\x9E\x80" );
+ BOOST_TEST( to_external( L"\x2780" ).size() == 3 );
+ BOOST_TEST( to_external( L"\x2780" ) == "\xE2\x9E\x80" );
// test fs::path
std::cout << "begin path test..." << std::endl;
@@ -157,5 +157,5 @@
test( ::user::lpath( dir ), ::user::lpath( file ), ::user::lpath( dot ) );
std::cout << "complete\n\n";
- return 0;
+ return ::boost::report_errors();
}
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